/* ============================================================
   飯聚聚 Fanjuju — shared design tokens + phone-shell chrome
   Year-1 LIFF + Telegram Mini App
   ------------------------------------------------------------
   Tier swap: every `.screen[data-tier="standard|premium"]` gets
   its own token scope. The doc body / chrome is tier-neutral.
   ============================================================ */

/* ---------- Tier tokens ---------------------------------- */
[data-tier="standard"] {
  --bg-page:        #FAFAFA;
  --bg-card:        #FFFFFF;
  --bg-logo:        #FFFFFF;
  --text-primary:   #1A1A1A;
  --text-secondary: #5F5F5F;
  --text-tertiary:  #8A8A8A;
  --cta-bg:         #2E7D32;
  --cta-text:       #FFFFFF;
  --cta-bg-secondary: #FFFFFF;
  --cta-text-secondary: #1A1A1A;
  --cta-border-secondary: rgba(0,0,0,0.18);
  --logo-mark:      #C9A961;
  --gold:           #C9A961;
  --warning:        #C62828;
  --accent-amber:   #F9A825;
  --accent-amber-bg:#FFFBE6;
  --tile-green-bg:  #E8F5E9;
  --tile-green-edge:#C7E2C9;
  --status-online:  #2E7D32;
  --hairline:       rgba(0,0,0,0.10);
  --hairline-soft:  rgba(0,0,0,0.06);
  --row-divider:    rgba(0,0,0,0.08);
  --status-tint:    #1A1A1A;
  --tabbar-bg:      #FFFFFF;
  --tabbar-active:  #2E7D32;
  --tabbar-inactive:#8A8A8A;
}

[data-tier="premium"] {
  --bg-page:        #1A0F26;
  --bg-card:        #221432;
  --bg-logo:        #1A0F26;
  --text-primary:   #FAFAFA;
  --text-secondary: #C8C0D6;
  --text-tertiary:  #8C829E;
  --cta-bg:         #C9A961;
  --cta-text:       #1A0F26;
  --cta-bg-secondary: #221432;
  --cta-text-secondary: #FAFAFA;
  --cta-border-secondary: rgba(255,255,255,0.20);
  --logo-mark:      #C9A961;
  --gold:           #C9A961;
  --warning:        #FF8585;
  --accent-amber:   #FFC857;
  --accent-amber-bg:#3A2A14;
  --tile-green-bg:  #1F3326;
  --tile-green-edge:#2F5C3A;
  --status-online:  #6AD17D;
  --hairline:       rgba(255,255,255,0.12);
  --hairline-soft:  rgba(255,255,255,0.06);
  --row-divider:    rgba(255,255,255,0.10);
  --status-tint:    #FAFAFA;
  --tabbar-bg:      #221432;
  --tabbar-active:  #C9A961;
  --tabbar-inactive:#8C829E;
}

/* ---------- Reset ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }

/* ---------- Document chrome ------------------------------ */
body {
  font-family: "Noto Sans TC", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "PingFang TC", sans-serif;
  background: #ECECEC;
  color: #1A1A1A;
  min-height: 100vh;
  padding: 32px 16px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.doc-head {
  width: 800px;
  max-width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  color: #6B6B6B;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.doc-head .title {
  color: #1A1A1A;
  font-size: 13px;
  font-weight: 700;
}
.doc-head .title .pill {
  display: inline-block;
  padding: 2px 8px;
  background: #1A1A1A;
  color: #FAFAFA;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-right: 8px;
  vertical-align: 2px;
}
.doc-head .meta { font-variant-numeric: tabular-nums; }

.doc-foot {
  width: 800px;
  max-width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: #8A8A8A;
  font-size: 11px;
  letter-spacing: 0.03em;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.doc-foot code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: #DDD;
  color: #1A1A1A;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}

/* Nav between screens */
.doc-nav {
  width: 800px;
  max-width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.doc-nav a {
  color: #5F5F5F;
  padding: 6px 12px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 9999px;
  background: #FFF;
}
.doc-nav a.home { font-weight: 600; color: #1A1A1A; }

/* ---------- Stage (2-up or 1-up) ------------------------- */
.stage {
  width: 800px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
}
.stage.single { justify-content: center; }

.screen-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ---------- The phone screen ----------------------------- */
.screen {
  width: 390px;
  height: 844px;
  background: var(--bg-page);
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04), 0 12px 32px rgba(0,0,0,0.08);
  font-size: 18px;          /* body baseline per spec */
  line-height: 1.6;
}

/* Status bar */
.status-bar {
  height: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--status-tint);
  font-variant-numeric: tabular-nums;
  z-index: 4;
}
.status-icons { display: flex; align-items: center; gap: 6px; }
.status-icons svg { display: block; }
.status-icons svg path,
.status-icons svg rect { fill: var(--status-tint); }
.status-icons svg .stroke { fill: none; stroke: var(--status-tint); opacity: 0.5; }
.status-icons svg .filled { fill: var(--status-tint); }

/* Font-scale sticky row (A- A A+ A++) — total width ~134px so hero content has 240px clear */
.font-scale {
  position: absolute;
  top: 60px;
  right: 14px;
  display: flex;
  gap: 2px;
  z-index: 10;
}
.font-scale button {
  min-width: 32px;
  min-height: 32px;
  padding: 0 5px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  border-radius: 9px;
  transition: transform 0.12s ease;
  line-height: 1;
}
.font-scale button:active { transform: translateY(2px); }
.font-scale button[aria-pressed="true"] {
  color: var(--text-primary);
  border-color: var(--text-primary);
  font-weight: 700;
  background: var(--hairline-soft);
}

/* Home indicator */
.home-indicator {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  border-radius: 999px;
  background: var(--text-primary);
  opacity: 0.45;
  z-index: 3;
  pointer-events: none;
}

/* ---------- Common UI atoms ------------------------------ */

/* Heading row with voice readback */
.h1-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.h1-row.center { justify-content: center; }
.screen h1 {
  font-size: 28px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.screen h2 {
  font-size: 22px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text-primary);
}
.screen .caption {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-secondary);
  text-wrap: pretty;
}
.screen .caption.center { text-align: center; }
.screen .caption-small {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-tertiary);
}

.voice-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  transition: transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.voice-btn:active { transform: translateY(2px); }
.voice-btn svg { width: 22px; height: 22px; display: block; }
.voice-btn svg path { fill: currentColor; }

/* CTA button — pill 56pt */
.cta {
  width: 100%;
  min-height: 56px;
  border-radius: 9999px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 32px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
  transition: transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.cta:active { transform: translateY(2px); }
.cta.secondary {
  background: var(--cta-bg-secondary);
  color: var(--cta-text-secondary);
  box-shadow: none;
  border: 1.5px solid var(--cta-border-secondary);
}
.cta-icon { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; }
.cta-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cta-arrow { font-size: 20px; line-height: 1; }

/* CTA zone bottom anchor */
.cta-zone {
  padding: 0 24px 50px;
  flex-shrink: 0;
}
.cta-zone .caption { margin-top: 12px; text-align: center; }

/* Progress dots (e.g. 2 of 4) */
.progress-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.progress-dots .dot {
  width: 8px; height: 8px;
  border-radius: 9999px;
  background: var(--hairline);
  transition: background 0.2s ease;
}
.progress-dots .dot.active {
  background: var(--text-primary);
  width: 28px;
}
.progress-dots .dot.done { background: var(--cta-bg); }

/* Progress bar (e.g. 1/3) */
.progress-bar {
  height: 6px;
  width: 100%;
  background: var(--hairline-soft);
  border-radius: 9999px;
  overflow: hidden;
}
.progress-bar > i {
  display: block;
  height: 100%;
  background: var(--cta-bg);
  border-radius: 9999px;
}

/* Tier label below screen */
.tier-label {
  width: 390px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}
.tier-label .name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1A1A1A;
}
.tier-label .swatches {
  display: flex;
  align-items: center;
  gap: 6px;
}
.swatch {
  width: 14px; height: 14px;
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.swatch.s-bg-1   { background: #FAFAFA; }
.swatch.s-bg-2   { background: #FFFFFF; }
.swatch.s-text   { background: #1A1A1A; }
.swatch.s-cta    { background: #2E7D32; }
.swatch.s-accent { background: #C9A961; }
.swatch.p-bg-1   { background: #1A0F26; }
.swatch.p-bg-2   { background: #221432; }
.swatch.p-text   { background: #FAFAFA; }
.swatch.p-cta    { background: #C9A961; }
.swatch.p-accent { background: #FFC857; }

/* Logo card — used on the splash; full-bleed, no rounding */
.logo-card {
  width: 200px;
  height: 200px;
  background: var(--bg-logo);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logo-card svg {
  width: 100%;
  height: 100%;
  display: block;
  color: var(--logo-mark);
}

/* Tab bar (host = 5 items, companion = 4) */
.tab-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 76px;
  padding: 8px 8px 28px;     /* room for home indicator */
  background: var(--tabbar-bg);
  border-top: 1px solid var(--hairline-soft);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  z-index: 2;
}
.tab-bar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--tabbar-inactive);
  font-size: 11px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease;
}
.tab-bar .tab:active { transform: translateY(1px); }
.tab-bar .tab.active { color: var(--tabbar-active); font-weight: 700; }
.tab-bar .tab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab-bar .tab.active svg { stroke-width: 2.4; }
.tab-bar .tab .glyph {
  font-size: 22px;
  line-height: 1;
  display: inline-block;
  height: 24px;
}

/* Common input field */
.input-field {
  display: flex;
  align-items: stretch;
  min-height: 64px;
  background: var(--bg-card);
  border: 1.5px solid var(--hairline);
  border-radius: 16px;
  overflow: hidden;
}
.input-field .prefix {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  border-right: 1.5px solid var(--hairline);
  cursor: pointer;
}
.input-field input {
  flex: 1;
  padding: 0 18px;
  font-size: 22px;
  font-weight: 500;
  border: none;
  outline: none;
  background: transparent;
  letter-spacing: 0.04em;
}
.input-field input::placeholder { color: var(--text-tertiary); font-weight: 400; }

/* Generic auto-fill row */
.fill-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  background: var(--bg-card);
  border: 1.5px solid var(--hairline);
  border-radius: 18px;
  text-align: left;
  transition: transform 0.12s ease;
  width: 100%;
}
.fill-row:active { transform: translateY(2px); }
.fill-row .lead {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}
.fill-row .body { flex: 1; min-width: 0; }
.fill-row .body .v {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
.fill-row .body .h {
  font-size: 14px;
  color: var(--text-tertiary);
  line-height: 1.4;
  margin-top: 2px;
}
.fill-row .chev {
  color: var(--text-tertiary);
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

/* Sticky chip (Screen 7) */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.status-chip .dot {
  width: 10px; height: 10px;
  border-radius: 9999px;
  background: var(--status-online);
  position: relative;
}
.status-chip .dot.pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 9999px;
  background: var(--status-online);
  opacity: 0.25;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(0.6); opacity: 0.5; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Tablet width gate */
@media (max-width: 880px) {
  body { padding: 16px 8px 32px; }
  .doc-head, .doc-foot, .doc-nav, .stage { width: 100%; }
  .stage { gap: 12px; transform-origin: top center; }
}
