/* CSV Music Club Store — Production Stylesheet (DESIGN_TOKENS.md + FRONTEND_ADDENDUM.md) */
@font-face {
  font-family: Fredoka;
  font-weight: 500;
  src: local("Fredoka Medium"), url("/fonts/fredoka-500.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: Fredoka;
  font-weight: 600;
  src: local("Fredoka SemiBold"), url("/fonts/fredoka-600.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  font-weight: 400;
  src: local("DM Sans"), url("/fonts/dm-sans-400.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  font-weight: 500;
  src: local("DM Sans Medium"), url("/fonts/dm-sans-500.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  font-weight: 700;
  src: local("DM Sans Bold"), url("/fonts/dm-sans-700.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #F4F6F7;
  --ink: #16181A;
  --accent: #1D6E8C;
  --accent-text: #145268;
  --accent-tint: rgba(29, 110, 140, .12);
  --card: #FFFFFF;
  --border: #DDE1E3;
  --muted: #5B5852;
  --ink-muted: #B3B9BC;
  --ink-border: #3A3F43;
  --ok: #1F6B45;
  --ok-bg: #E6F4EC;
  --warn: #8A5A00;
  --warn-bg: #FFF4D6;
  --err: #A12B2B;
  --err-bg: #FDECEC;
  --shiguang-band: #F6EFE2;
  --shiguang-tile: #FFF8EC;
  --shiguang-border: #E7DCC6;
  --shiguang-green: #1F4D36;
  --shiguang-ink: #FAF7F2;
  --shiguang-orange: #D9772A;
  --gongming: #1C1C1E;
  --gongming-tile: #2A2A2D;
  --gongming-border: #3A3A3E;
  --gongming-orange: #FF6A2B;
  --gongming-muted: #C9C9CE;
  --font-head: Fredoka, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --glass: rgba(244, 246, 247, .72);
  --glass-sheet: rgba(244, 246, 247, .78);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 var(--font-body);
}
body { min-height: 100vh; display: flex; flex-direction: column; }
#app { flex: 1 0 auto; display: flex; flex-direction: column; }
main.flow-wrap, main.wrap { flex: 1 0 auto; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; width: 100%; }
@media (min-width: 900px) { .wrap { padding: 0 32px; } }
.flow-wrap { max-width: 560px; margin: 0 auto; padding: 24px 16px 32px; width: 100%; }

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0; }
h1 { font-size: 34px; line-height: 1.2; }
h2 { font-size: 24px; line-height: 1.25; }
h3 { font-size: 18px; line-height: 1.3; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }

/* Glass header */
.hdr {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid rgba(22, 24, 26, .08);
}
.hdr .wrap { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  min-height: 44px;
  font: 600 17px var(--font-head);
  white-space: nowrap;
}
.logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.hdr-actions { display: flex; align-items: center; gap: 2px; }
.hdr-link {
  min-height: 44px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 22px;
}
.ib {
  min-width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  position: relative;
  border-radius: 22px;
  padding: 0 8px;
  text-decoration: none;
}
.badge {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

@media (prefers-reduced-transparency: reduce) {
  .hdr, .sheet, .cartbar, dialog.modal-sheet {
    background: var(--bg) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}
@supports not (backdrop-filter: blur(1px)) {
  .hdr, .sheet, .cartbar, dialog.modal-sheet {
    background: var(--bg) !important;
  }
}

/* Bars & Announcements */
.pickupbar {
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  padding: 10px 16px;
  text-align: center;
}
.sale-banner {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 16px;
  text-align: center;
}
.ann-photo-card {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  padding: 14px;
}
@media (min-width: 640px) {
  .ann-photo-card { flex-direction: row; align-items: center; }
}
.ann-photo-media {
  width: 100%;
  max-width: 240px;
  border-radius: 14px;
  overflow: hidden;
  flex: 0 0 auto;
}
.ann-photo-media img { width: 100%; height: 150px; object-fit: cover; }
.ann-photo-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; }

/* Buttons & Chips */
.btn {
  min-height: 48px;
  padding: 0 24px;
  border-radius: 24px;
  border: 1.5px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  text-align: center;
}
.btn.alt { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.chip {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 22px;
  border: 1.5px solid var(--ink-muted);
  background: #fff;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.center-text { text-align: center; }

/* Carousel */
.carousel-wrap { position: relative; padding-top: 16px; }
.car {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.car::-webkit-scrollbar { display: none; }
.slide {
  flex: 0 0 322px;
  height: 216px;
  border-radius: 22px;
  scroll-snap-align: start;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-decoration: none;
  color: #fff;
  position: relative;
  overflow: hidden;
  border: 0;
  text-align: left;
}
.slide-0 { background: #1F4D36; }
.slide-1 { background: #E26A1B; }
.slide-2 { background: #1D6E8C; }
.slide-3 { background: #1C1C1E; }
.slide-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .42;
}
.slide-content { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 4px; }
.slide-title { font: 600 24px/1.2 var(--font-head); }
@media (min-width: 900px) {
  .slide { flex-basis: 640px; height: 340px; }
  .slide-title { font-size: 28px; }
}
.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 12px;
}
.dots { display: flex; gap: 6px; align-items: center; }
.dot-btn {
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dot-pip {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: #C9CED1;
  display: block;
}
.dot-btn[aria-current="true"] .dot-pip {
  width: 20px;
  background: var(--ink);
}
.carousel-nav { display: flex; align-items: center; gap: 6px; }
.carousel-arrow { display: none; }
@media (min-width: 900px) {
  .carousel-arrow { display: inline-flex; }
}
.carousel-pause {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 22px;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 700;
}

/* Collection Rooms & Product Grid (2 mobile -> 3 tablet -> 4 desktop) */
.room { margin-top: 28px; padding: 20px 0 28px; }
.room.sg { background: var(--shiguang-band); }
.room.gm { background: var(--gongming); color: #fff; }
.banner {
  border-radius: 22px;
  padding: 20px;
  font: 600 28px/1.2 var(--font-head);
  margin-bottom: 16px;
  background: var(--card);
  border: 1px solid var(--border);
}
.sg .banner { background: var(--shiguang-green); color: var(--shiguang-ink); border-color: transparent; }
.gm .banner { background: #000; color: var(--gongming-orange); border-color: transparent; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 14px; }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 16px; }
}

.tile {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  display: block;
  width: 100%;
  min-height: 44px;
}
.art {
  aspect-ratio: 4/5;
  border-radius: 18px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 40px var(--font-head);
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--accent-text);
}
.sg .art { background: var(--shiguang-tile); border-color: var(--shiguang-border); color: var(--shiguang-orange); }
.gm .art { background: var(--gongming-tile); border-color: var(--gongming-border); color: var(--gongming-orange); }
.art img { width: 100%; height: 100%; object-fit: cover; }

.tag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  border-radius: 12px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
}
.tag.low { background: var(--gongming-orange); color: #16181A; }
.tag.sold { background: #5B5852; color: #fff; }
.pname { font-weight: 700; margin-top: 8px; }
.price { margin-top: 2px; }
.gm .muted { color: var(--gongming-muted); }

/* Sheets & Native Dialogs */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; }
.sheet {
  position: fixed;
  z-index: 41;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92vh;
  overflow: auto;
  background: var(--glass-sheet);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 28px 28px 0 0;
  padding: 12px 16px 24px;
}
@media (min-width: 900px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 560px;
    border-radius: 28px;
    padding: 20px 24px 24px;
  }
}
.grab {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: rgba(22, 24, 26, .25);
  margin: 0 auto 12px;
}

dialog.modal-sheet {
  margin: auto 0 0 0;
  width: 100%;
  max-width: 100%;
  max-height: 92vh;
  border: 0;
  border-radius: 28px 28px 0 0;
  padding: 16px 16px 24px;
  background: var(--glass-sheet);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  color: var(--ink);
}
dialog.modal-sheet::backdrop { background: rgba(0, 0, 0, .35); }
@media (min-width: 900px) {
  dialog.modal-sheet {
    margin: auto;
    width: 560px;
    max-width: calc(100vw - 32px);
    border-radius: 28px;
    padding: 20px 24px 24px;
  }
}

.menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  z-index: 42;
  background: var(--card);
  border-left: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}
.menu-item {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--bg);
}

/* Product Gallery & Sizes */
.gallery-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: 18px;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide {
  flex: 0 0 100%;
  aspect-ratio: 16/10;
  scroll-snap-align: start;
  border-radius: 18px;
  overflow: hidden;
  background: var(--shiguang-tile);
  border: 1px solid var(--shiguang-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 42px var(--font-head);
  color: var(--shiguang-orange);
}
.gallery-slide img { width: 100%; height: 100%; object-fit: cover; }
.gallery-dots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }

.sizes { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.size {
  min-width: 64px;
  min-height: 48px;
  padding: 6px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--ink);
  background: #fff;
  font-weight: 700;
}
.size[aria-pressed="true"] { background: var(--ink); color: #fff; }
.size[disabled] {
  border-color: var(--ink-muted);
  color: #9aa0a3;
  background: transparent;
  text-decoration: line-through;
  cursor: not-allowed;
}
.size-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 12px; }
.size-table th, .size-table td { border: 1px solid var(--border); padding: 8px; text-align: left; }
.size-table th { background: var(--bg); font-weight: 700; }

.step {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 24px;
}
.step button { width: 44px; height: 44px; border: 0; background: none; font-size: 20px; font-weight: 700; }
.step b { min-width: 28px; text-align: center; }

.cartbar {
  position: sticky;
  bottom: 0;
  z-index: 15;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-top: 1px solid rgba(22, 24, 26, .08);
  padding: 10px 0;
}

/* Forms & Notices */
label.f { display: block; font-weight: 700; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="tel"] {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1.5px solid var(--ink-muted);
  padding: 0 14px;
  font: inherit;
  background: #fff;
}
input.bad { border-color: var(--err); }
.err { color: var(--err); font-size: 13px; margin-top: 4px; }
.consent-row { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 6px 0; }
.consent-check { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 2px; }

.slot {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 14px;
  border: 1.5px solid var(--ink-muted);
  border-radius: 16px;
  background: #fff;
  width: 100%;
  text-align: left;
}
.slot[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-tint); }
.slot[disabled] { opacity: .5; cursor: not-allowed; }
.slot-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }

.notice {
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
}
.notice.err { background: var(--err-bg); border-color: #E8B4B4; color: #6E1D1D; }
.notice.warn { background: var(--warn-bg); border-color: #EBD28A; color: #5A3B00; }
.notice.ok { background: var(--ok-bg); border-color: #A9D3BA; color: #14482E; }
.notice.info { background: var(--accent-tint); border-color: #A8CCD9; color: var(--accent-text); }

/* Payment & Order */
.amount { font: 600 44px/1.1 var(--font-head); }
.amount-sm { font: 600 28px/1.1 var(--font-head); }
.order-heading { font-size: clamp(1.05rem, 4.5vw, 1.5rem); overflow-wrap: anywhere; }
.ref-code { font-size: 16px; word-break: break-all; }
.qr-box {
  width: 220px;
  height: 220px;
  margin: 0 auto;
  border: 2px dashed var(--ink-muted);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  background: #fff;
  overflow: hidden;
  padding: 8px;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.copy-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 22px;
  border: 1.5px solid var(--ink);
  background: #fff;
  font-weight: 700;
  white-space: nowrap;
}
.pcode {
  font: 600 56px/1.1 var(--font-head);
  letter-spacing: .18em;
  text-align: center;
}
.pickup-code-card { text-align: center; }
.pickup-code-subtle {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
}
.status-chip {
  display: inline-block;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 13px;
  background: var(--accent-tint);
  color: var(--accent-text);
}
.divider-top { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }

progress.upload-progress { width: 100%; height: 10px; accent-color: var(--accent); }
.file-input-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

details {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0 14px;
  background: #fff;
}
summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  font-weight: 700;
  cursor: pointer;
}
.details-body { padding-bottom: 14px; }

/* Skeleton */
.skel { background: #E3E7E9; border-radius: 18px; }
.skel-bar { height: 22px; border-radius: 10px; }
.skel-tile { aspect-ratio: 4/5; border-radius: 18px; }

/* Footer & Toast */
footer.ft {
  background: var(--ink);
  color: var(--bg);
  padding: 32px 0 28px;
  font-size: 14px;
  margin-top: 40px;
}
.ft-logo { background: var(--bg); color: var(--ink); }
.ft-brand { font: 600 18px var(--font-head); }
.ft-section-title { color: var(--ink-muted); font-size: 12px; margin-top: 14px; }
.ft-box {
  border: 1px solid var(--ink-border);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 16px 0;
}
.ft-links { display: flex; flex-wrap: wrap; gap: 18px; }
footer.ft a { color: var(--bg); min-height: 44px; display: inline-flex; align-items: center; }
.ft-meta {
  color: var(--ink-muted);
  font-size: 12px;
  border-top: 1px solid var(--ink-border);
  padding-top: 12px;
  margin-top: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  z-index: 60;
  font-weight: 700;
}
