/* ============================================================
   Guess my Birth — Design System
   Style: Soft UI Evolution · warm nursery · gender-neutral
   Type:  Fredoka (display/UI) · Nunito (body) · Fraunces (keepsake)
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Brand — warm terracotta + sage, gender-neutral */
  --terra:        #C0563A;
  --terra-600:    #A6482F;
  --terra-050:    #FBEEE8;
  --terra-100:    #F7DFD3;
  --sage:         #5C7A5A;
  --sage-700:     #46603F;
  --sage-050:     #E7EEE3;
  --amber:        #CE8B36;   /* honor / trophy */
  --amber-050:    #FBEFD9;
  --trust:        #2C6E8F;   /* security / payment cues */
  --trust-050:    #E4F0F5;
  --success:      #4E8B5B;
  --danger:       #C63D2E;

  /* Neutrals (light) */
  --bg:           #ECE5DB;   /* page backdrop behind phone */
  --cream:        #FAF5EE;   /* app canvas */
  --surface:      #FFFFFF;
  --surface-2:    #FBF7F1;
  --ink:          #26201B;
  --muted:        #71675E;
  --faint:        #9A8F84;
  --border:       #E9E0D4;
  --border-strong:#DCCFBE;
  --tick:         #D6CBBB;

  /* Radii */
  --r-xs: 10px;  --r-sm: 14px;  --r-md: 18px;  --r-lg: 24px;  --r-xl: 30px;  --r-full: 999px;

  /* Elevation — soft, layered */
  --sh-1: 0 1px 2px rgba(60,42,28,.05), 0 2px 6px rgba(60,42,28,.05);
  --sh-2: 0 2px 6px rgba(60,42,28,.06), 0 8px 20px rgba(60,42,28,.08);
  --sh-3: 0 6px 16px rgba(60,42,28,.08), 0 18px 40px rgba(60,42,28,.12);
  --sh-cta: 0 6px 16px rgba(192,86,58,.30);
  --sh-phone: 0 30px 80px rgba(40,25,15,.28), 0 8px 24px rgba(40,25,15,.14);

  /* Typography */
  --font-ui:   'Fredoka', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-key:  'Fraunces', Georgia, 'Times New Roman', serif;

  /* Motion */
  --ease-out: cubic-bezier(.22,.61,.36,1);
  --ease-in:  cubic-bezier(.55,.06,.68,.19);
  --dur: 240ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --terra:        #E5885F;
    --terra-600:    #EE9871;
    --terra-050:    #33241C;
    --terra-100:    #402A20;
    --sage:         #93B48C;
    --sage-700:     #A9C6A2;
    --sage-050:     #23301F;
    --amber:        #E4B35F;
    --amber-050:    #33280F;
    --trust:        #6FB4D3;
    --trust-050:    #16303A;
    --success:      #79C089;
    --danger:       #F08A7B;

    --bg:           #100C09;
    --cream:        #1A1511;
    --surface:      #241D18;
    --surface-2:    #2B231D;
    --ink:          #F3EBE1;
    --muted:        #BCAFA2;
    --faint:        #8C8175;
    --border:       #382E26;
    --border-strong:#463A30;
    --tick:         #4A3E33;

    --sh-1: 0 1px 2px rgba(0,0,0,.4);
    --sh-2: 0 2px 8px rgba(0,0,0,.45);
    --sh-3: 0 10px 34px rgba(0,0,0,.55);
    --sh-cta: 0 6px 18px rgba(0,0,0,.5);
    --sh-phone: 0 30px 80px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  --terra:#E5885F; --terra-600:#EE9871; --terra-050:#33241C; --terra-100:#402A20;
  --sage:#93B48C; --sage-700:#A9C6A2; --sage-050:#23301F; --amber:#E4B35F; --amber-050:#33280F;
  --trust:#6FB4D3; --trust-050:#16303A; --success:#79C089; --danger:#F08A7B;
  --bg:#100C09; --cream:#1A1511; --surface:#241D18; --surface-2:#2B231D;
  --ink:#F3EBE1; --muted:#BCAFA2; --faint:#8C8175; --border:#382E26; --border-strong:#463A30; --tick:#4A3E33;
  --sh-1:0 1px 2px rgba(0,0,0,.4); --sh-2:0 2px 8px rgba(0,0,0,.45); --sh-3:0 10px 34px rgba(0,0,0,.55);
  --sh-cta:0 6px 18px rgba(0,0,0,.5); --sh-phone:0 30px 80px rgba(0,0,0,.7);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; }
:focus-visible {
  outline: 3px solid var(--trust);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Ambient page background */
.app-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(60% 50% at 18% 8%, var(--terra-050) 0%, transparent 60%),
    radial-gradient(55% 45% at 85% 92%, var(--sage-050) 0%, transparent 60%),
    var(--bg);
}

/* Theme toggle */
.theme-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  width: 44px; height: 44px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: var(--sh-2); transition: transform var(--dur) var(--ease-out);
}
.theme-toggle:hover { transform: translateY(-1px) rotate(-8deg); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .moon,
:root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
:root[data-theme="dark"] .theme-toggle .sun,
:root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .moon { display: none; }
}

/* ---------- Phone frame ---------- */
.stage {
  position: relative; z-index: 1;
  min-height: 100dvh;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 32px 16px 56px;
}
.phone {
  position: relative;
  width: 400px; max-width: 100%;
  background: var(--cream);
  border-radius: 40px;
  box-shadow: var(--sh-phone);
  overflow: hidden;
  min-height: 812px;
  border: 1px solid rgba(255,255,255,.35);
}
:root[data-theme="dark"] .phone,
:root:not([data-theme="light"]) .phone { border-color: rgba(255,255,255,.06); }

/* progress rail under status region */
.progress {
  position: sticky; top: 0; z-index: 20;
  height: 3px; background: transparent;
}
.progress .bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--terra), var(--amber));
  border-radius: 0 var(--r-full) var(--r-full) 0;
  transition: width 420ms var(--ease-out);
}

.screen { display: none; padding: 28px 22px 40px; }
.screen.active { display: block; animation: screen-in var(--dur) var(--ease-out); }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; min-height: 32px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand .mark {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(150deg, var(--terra), var(--amber));
  display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: var(--sh-1);
}
.brand .mark svg { width: 16px; height: 16px; }
.brand .name { font-family: var(--font-ui); font-weight: 600; font-size: 18px; letter-spacing: -.01em; color: var(--ink); }
.brand.sm .name { font-size: 15px; }
.brand.sm .mark { width: 24px; height: 24px; }
.brand.sm .mark svg { width: 14px; height: 14px; }

.tlink {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-ui); font-weight: 500; font-size: 14px;
  color: var(--sage); background: none; border: none; cursor: pointer;
  padding: 8px 6px; border-radius: var(--r-sm); min-height: 40px;
  transition: color var(--dur) var(--ease-out);
}
.tlink:hover { color: var(--sage-700); }
.back {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-ui); font-weight: 500; font-size: 14px;
  color: var(--muted); background: none; border: none; cursor: pointer;
  padding: 8px 10px 8px 6px; border-radius: var(--r-full); min-height: 40px;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.back:hover { background: var(--surface-2); color: var(--ink); }
.back svg { width: 16px; height: 16px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(158deg, var(--terra-100), var(--terra-050) 60%, var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 26px 22px;
  box-shadow: var(--sh-2);
  margin-bottom: 24px;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(206,139,54,.28), transparent 70%);
  pointer-events: none;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--sage);
  border-radius: var(--r-full); padding: 6px 12px;
  font-family: var(--font-ui); font-size: 11px; font-weight: 500; letter-spacing: .02em;
  margin-bottom: 14px; box-shadow: var(--sh-1);
}
.pill svg { width: 13px; height: 13px; }
h1 {
  font-family: var(--font-ui); font-weight: 600;
  font-size: 28px; line-height: 1.15; letter-spacing: -.02em; color: var(--ink);
  margin-bottom: 12px;
}
h1 .accent {
  color: var(--terra);
  background: linear-gradient(transparent 62%, var(--amber-050) 62%);
}
.sub { font-size: 15px; line-height: 1.55; color: var(--muted); margin-bottom: 18px; }
.ctx { font-size: 14px; font-weight: 700; color: var(--sage); margin-bottom: 8px; font-family: var(--font-ui); }
.duedate { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.duedate strong { color: var(--ink); font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: none; border-radius: var(--r-full);
  background: var(--terra); color: #fff;
  font-family: var(--font-ui); font-weight: 600; font-size: 16px;
  padding: 16px 18px; min-height: 52px; cursor: pointer;
  box-shadow: var(--sh-cta);
  transition: transform var(--dur) var(--ease-out), background var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.btn:hover { background: var(--terra-600); }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn.ghost {
  background: var(--surface); color: var(--terra);
  box-shadow: none; border: 1.5px solid var(--border-strong);
}
.btn.ghost:hover { background: var(--surface-2); border-color: var(--terra); }
:root[data-theme="dark"] .btn { color: #24170F; }
:root:not([data-theme="light"]) .btn { }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn { color: #24170F; } }
:root[data-theme="dark"] .btn.ghost { color: var(--terra); }
.linkbtn {
  display: block; width: 100%; text-align: center;
  color: var(--terra); background: none; border: none; cursor: pointer;
  font-family: var(--font-ui); font-weight: 500; font-size: 14px;
  padding: 12px; margin-top: 10px; min-height: 44px;
  transition: color var(--dur) var(--ease-out);
}
.linkbtn:hover { color: var(--terra-600); text-decoration: underline; }

/* ---------- Steps ---------- */
.section-title {
  font-family: var(--font-ui); font-size: 13px; font-weight: 600;
  letter-spacing: .01em; color: var(--sage); margin: 0 2px 12px;
}
.stepcard {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 15px 16px;
  box-shadow: var(--sh-1); margin-bottom: 10px;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.stepcard:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.badge {
  flex: none; width: 34px; height: 34px; border-radius: var(--r-full);
  background: var(--sage-050); color: var(--sage);
  display: grid; place-items: center;
  font-family: var(--font-ui); font-weight: 600; font-size: 15px;
}
.stepcard .t { font-family: var(--font-ui); font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.stepcard .d { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* trust footer */
.trust {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  text-align: center; font-size: 12px; color: var(--faint); margin-top: 18px;
}
.trust svg { width: 13px; height: 13px; flex: none; }

/* ---------- Fields ---------- */
.field {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 12px;
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.field:focus-within { border-color: var(--terra); box-shadow: 0 0 0 3px var(--terra-050); }
.field.accent { border-color: var(--terra); box-shadow: var(--sh-1); }
.field label {
  display: block; font-family: var(--font-ui);
  font-size: 11px; font-weight: 500; letter-spacing: .02em;
  color: var(--sage); margin-bottom: 3px;
}
.field input, .field select {
  width: 100%; border: none; outline: none; background: none;
  font-family: var(--font-body); font-size: 16px; font-weight: 600; color: var(--ink);
}
.field input::placeholder { color: var(--faint); font-weight: 500; }
.field input[type=date], .field input[type=time] { color: var(--ink); min-height: 26px; }
.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 18px; box-shadow: var(--sh-1); margin-bottom: 14px;
}
.card .lbl {
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  letter-spacing: .02em; color: var(--sage); margin-bottom: 12px;
}
.amount {
  font-family: var(--font-ui); font-size: 34px; font-weight: 600;
  color: var(--terra); text-align: center; margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Slider ---------- */
.slider-wrap { position: relative; padding: 8px 0 2px; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 8px;
  border-radius: var(--r-full);
  background: linear-gradient(to right, var(--terra) 44%, var(--border-strong) 44%);
  outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; border-radius: var(--r-full);
  background: #fff; border: 3px solid var(--terra);
  box-shadow: 0 2px 8px rgba(192,86,58,.35); cursor: pointer;
  transition: transform var(--dur) var(--ease-out);
}
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type=range]::-moz-range-thumb {
  width: 28px; height: 28px; border-radius: var(--r-full);
  background: #fff; border: 3px solid var(--terra);
  box-shadow: 0 2px 8px rgba(192,86,58,.35); cursor: pointer;
}
.ticks { position: relative; height: 12px; margin-top: 6px; }
.ticks .tk { position: absolute; top: 0; width: 2px; height: 6px; background: var(--tick); border-radius: 2px; transform: translateX(-1px); }
.ticks .tk.big { height: 10px; background: var(--faint); }
.range-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); margin-top: 8px; font-weight: 600; }
.autre-wrap { text-align: center; margin-top: 14px; }
.autre-btn {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-full); padding: 10px 16px; min-height: 40px;
  font-family: var(--font-ui); font-weight: 500; font-size: 13px; color: var(--ink); cursor: pointer;
  transition: border-color var(--dur) var(--ease-out);
}
.autre-btn:hover { border-color: var(--terra); }
.autre-input { margin-top: 12px; display: none; }
.autre-input.show { display: block; animation: screen-in var(--dur) var(--ease-out); }
.note { font-size: 12.5px; color: var(--muted); margin-top: 12px; line-height: 1.45; }

/* ---------- Honor / win boxes ---------- */
.honor {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--sage-050); border: 1px solid transparent;
  border-radius: var(--r-sm); padding: 14px 16px; margin-bottom: 16px;
}
.honor .ic { flex: none; width: 22px; height: 22px; color: var(--sage); margin-top: 1px; }
.honor .ic svg { width: 100%; height: 100%; }
.honor .t { font-family: var(--font-ui); font-size: 13.5px; font-weight: 500; color: var(--sage-700); margin-bottom: 2px; }
.honor .d { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.live { display: flex; align-items: center; justify-content: center; gap: 7px; text-align: center; font-size: 13px; font-weight: 700; color: var(--sage); margin-top: 14px; font-family: var(--font-ui); }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(78,139,91,.5); animation: pulse 2s var(--ease-out) infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(78,139,91,.45)} 70%{box-shadow:0 0 0 8px rgba(78,139,91,0)} 100%{box-shadow:0 0 0 0 rgba(78,139,91,0)} }

.winbox {
  background: linear-gradient(158deg, var(--amber-050), var(--terra-050));
  border: 1px solid var(--terra-100); border-radius: var(--r-md);
  padding: 16px; margin-bottom: 16px; text-align: center;
}
.winbox .wt { font-family: var(--font-ui); display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: var(--terra); margin-bottom: 4px; }
.winbox .wt svg { width: 18px; height: 18px; color: var(--amber); }
.winbox .wd { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

/* ---------- Stats + participant list ---------- */
.stats { display: flex; gap: 10px; margin: 18px 0; }
.stat { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px 12px; text-align: center; box-shadow: var(--sh-1); }
.stat .num { font-family: var(--font-ui); font-size: 26px; font-weight: 600; color: var(--terra); font-variant-numeric: tabular-nums; }
.stat .cap { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.plist .prow {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 8px; box-shadow: var(--sh-1);
}
.plist .who { display: flex; align-items: center; gap: 10px; }
.plist .av {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-ui); font-weight: 600; font-size: 13px; color: var(--sage); background: var(--sage-050);
}
.plist .pn { font-weight: 700; font-size: 14px; }
.plist .pa { font-family: var(--font-ui); font-size: 14px; color: var(--sage); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Auth (google) + divider ---------- */
.btn-oauth {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--r-full);
  padding: 15px; min-height: 52px; font-family: var(--font-ui); font-weight: 500; font-size: 15px; color: var(--ink); cursor: pointer;
  transition: border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.btn-oauth:hover { border-color: var(--faint); background: var(--surface-2); }
.btn-oauth svg { width: 18px; height: 18px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Share ---------- */
.linkbox {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 7px 7px 7px 16px; margin: 16px 0 14px;
}
.linkbox .url { flex: 1; display: flex; align-items: center; gap: 8px; overflow: hidden; }
.linkbox .url svg { width: 15px; height: 15px; color: var(--faint); flex: none; }
.linkbox .url span { font-weight: 700; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copybtn {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  background: var(--terra); color: #fff; border: 1.5px solid transparent;
  border-radius: var(--r-full); padding: 10px 14px; min-height: 40px;
  font-family: var(--font-ui); font-weight: 600; font-size: 13px; cursor: pointer;
  transition: background var(--dur) var(--ease-out);
}
:root[data-theme="dark"] .copybtn { color: #24170F; }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .copybtn{ color:#24170F; } }
.copybtn svg { width: 14px; height: 14px; }
.copybtn:hover { background: var(--terra-600); }
.copybtn.copied { background: var(--sage); }
.share-row { display: flex; gap: 10px; margin-bottom: 18px; }
.share-ic {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 12px 6px; font-family: var(--font-ui); font-size: 12px; font-weight: 500; color: var(--ink);
  text-decoration: none; cursor: pointer;
  transition: border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.share-ic:hover { border-color: var(--terra); transform: translateY(-1px); }
.share-ic svg { width: 22px; height: 22px; color: var(--sage); }

/* ---------- Calendar ---------- */
.cal-head { display: grid; grid-template-columns: repeat(7,1fr); gap: 5px; margin-bottom: 6px; }
.cal-head span { text-align: center; font-size: 10px; color: var(--faint); font-weight: 700; font-family: var(--font-ui); }
.cal { display: grid; grid-template-columns: repeat(7,1fr); gap: 5px; }
.cal .cell { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: var(--r-xs); font-size: 12px; font-weight: 600; color: var(--ink); background: var(--surface-2); }
.cal .cell.blank { background: transparent; }
.cal .cell.taken { background: var(--terra-050); color: var(--terra); font-weight: 700; }
.cal .cell .h { font-size: 8px; color: var(--terra); line-height: 1; margin-top: 2px; font-weight: 700; }
.cal .cell.due { box-shadow: inset 0 0 0 1.5px var(--sage); }
.cal-legend { display: flex; align-items: center; gap: 14px; font-size: 11px; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.cal-legend i { display: inline-flex; align-items: center; gap: 6px; font-style: normal; }
.cal-legend .sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.cal-legend .sw.t { background: var(--terra-050); }
.cal-legend .sw.d { box-shadow: inset 0 0 0 1.5px var(--sage); }

/* ---------- Upload ---------- */
.upload {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-sm); padding: 14px 16px; font-size: 14px; color: var(--muted);
  cursor: pointer; margin-bottom: 12px; min-height: 52px;
  transition: border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.upload:hover { border-color: var(--terra); background: var(--surface-2); }
.upload input { display: none; }
.upload svg { width: 20px; height: 20px; color: var(--sage); flex: none; }

/* ---------- Consent ---------- */
.consent { margin-bottom: 16px; }
.consent-label { font-family: var(--font-ui); font-size: 13px; color: var(--ink); font-weight: 500; margin-bottom: 8px; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); margin-right: 18px; cursor: pointer; font-weight: 600; }
.chk input { width: 18px; height: 18px; accent-color: var(--terra); }

/* ---------- Payment ---------- */
.payrecap { display: flex; justify-content: space-between; align-items: flex-start; }
.payrecap .k { font-size: 11px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.payrecap .v { font-family: var(--font-ui); font-size: 17px; font-weight: 600; color: var(--ink); }
.applepay {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: #000; color: #fff; border: none; border-radius: var(--r-full);
  padding: 15px; min-height: 52px; font-family: var(--font-ui); font-weight: 600; font-size: 15px; cursor: pointer;
  transition: transform var(--dur) var(--ease-out);
}
.applepay:active { transform: scale(.98); }
.applepay.gpay { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border-strong); }
.applepay svg { width: 18px; height: 18px; }

/* ---------- Segmented + templates ---------- */
.seglabel { font-family: var(--font-ui); font-size: 11px; font-weight: 500; letter-spacing: .02em; color: var(--sage); margin: 2px 2px 8px; }
.segmented { display: flex; gap: 8px; margin-bottom: 16px; background: var(--surface-2); padding: 4px; border-radius: var(--r-sm); }
.seg {
  flex: 1; background: transparent; border: none; border-radius: 11px;
  padding: 11px; font-family: var(--font-ui); font-weight: 500; font-size: 14px; color: var(--muted); cursor: pointer; min-height: 44px;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.seg.active { background: var(--surface); color: var(--terra); box-shadow: var(--sh-1); }
.tpl-row { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.tpl-row::-webkit-scrollbar { display: none; }
.tpl {
  flex: none; width: 62px; height: 76px; border-radius: var(--r-xs);
  border: 2.5px solid transparent; cursor: pointer;
  display: flex; align-items: flex-end; justify-content: center; padding: 6px;
  transition: transform var(--dur) var(--ease-out);
}
.tpl:hover { transform: translateY(-2px); }
.tpl.active { border-color: var(--terra); }
.tpl span { background: rgba(255,255,255,.85); border-radius: 6px; padding: 2px 6px; font-family: var(--font-ui); font-size: 10px; font-weight: 600; color: #5a4a3a; }
.tpl.t1 { background: linear-gradient(158deg, #F5D9C6, #FBEFE6); }
.tpl.t2 { background: linear-gradient(158deg, #D5E4D0, #EEF4EC); }
.tpl.t3 { background: linear-gradient(158deg, #D2E1EF, #EEF4FA); }
.tpl.t4 { background: linear-gradient(158deg, #EEE6D8, #FBF7F0); }
.tpl.t5 { background: linear-gradient(158deg, #F7DBE2, #FDEFD6); }

/* ---------- Faire-part (email preview) ---------- */
.email-head { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm) var(--r-sm) 0 0; padding: 12px 16px; font-size: 13px; }
.email-head .row { display: flex; gap: 10px; padding: 3px 0; }
.email-head .row .lab { color: var(--faint); width: 52px; flex: none; font-weight: 600; }
.email-head .row span:last-child { color: var(--ink); font-weight: 600; }
.faire-part {
  background: linear-gradient(158deg, #FBEFE6, var(--surface));
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg); padding: 28px 22px; text-align: center; margin-bottom: 16px;
}
.fp-emoji { font-size: 46px; margin-bottom: 8px; line-height: 1; }
.fp-photo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin: 0 auto 10px; display: none; box-shadow: 0 6px 18px rgba(0,0,0,.16); }
.fp-kicker { font-family: var(--font-ui); font-size: 11px; letter-spacing: .16em; color: var(--sage); font-weight: 500; margin-bottom: 8px; }
.fp-name { font-family: var(--font-key); font-size: 40px; font-weight: 500; color: #3a2c22; margin-bottom: 6px; line-height: 1; }
.fp-meta { font-size: 13px; color: var(--muted); line-height: 1.5; }
.fp-sep { height: 1px; background: rgba(120,90,60,.2); margin: 16px auto; width: 56%; }
.fp-text { font-size: 14px; color: var(--muted); line-height: 1.55; }
/* faire-part color themes */
.faire-part.t2 { background: linear-gradient(158deg, #EEF4EC, var(--surface)); }
.faire-part.t2 .fp-kicker { color: #5a785a; }
.faire-part.t3 { background: linear-gradient(158deg, #EEF4FA, var(--surface)); }
.faire-part.t3 .fp-kicker { color: #4a6f99; }
.faire-part.t4 { background: linear-gradient(158deg, #FBF7F0, var(--surface)); }
.faire-part.t4 .fp-kicker { color: #9a7b4a; }
.faire-part.t5 { background: linear-gradient(158deg, #FDEFD6, #FBE0E6); }
.faire-part.t5 .fp-kicker { color: #c0568a; }
:root[data-theme="dark"] .faire-part, .faire-part.t2, .faire-part.t3, .faire-part.t4 { }
.fp-name { }

.hourrule { font-size: 11.5px; color: var(--muted); margin-top: 8px; line-height: 1.4; }

/* ---------- Reveal / winner / board ---------- */
.center-emoji { font-size: 54px; text-align: center; margin: 8px 0 14px; line-height: 1; }
.center-emoji.sm { font-size: 44px; margin: 0 0 10px; }
.big-center { text-align: center; }
.summary { display: flex; gap: 10px; margin: 18px 0; }
.summary .s { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 14px; text-align: center; box-shadow: var(--sh-1); }
.summary .s .k { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.summary .s .v { font-family: var(--font-ui); font-size: 18px; font-weight: 600; color: var(--ink); }
.winner {
  position: relative; overflow: hidden;
  background: linear-gradient(158deg, var(--amber-050), var(--terra-050));
  border: 1px solid var(--terra-100); border-radius: var(--r-lg);
  padding: 24px; text-align: center; box-shadow: var(--sh-2); margin-bottom: 14px;
}
.winner .crown { color: var(--amber); margin-bottom: 6px; }
.winner .crown svg { width: 38px; height: 38px; }
.winner .name { font-family: var(--font-ui); font-size: 24px; font-weight: 600; margin-bottom: 4px; color: var(--ink); }
.winner .meta { font-size: 13px; color: var(--muted); }
.board .row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 8px; box-shadow: var(--sh-1);
}
.board .who { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.board .rank { width: 26px; height: 26px; border-radius: var(--r-full); background: var(--sage-050); color: var(--sage); font-family: var(--font-ui); font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.board .guess { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pot { text-align: center; background: var(--sage-050); border-radius: var(--r-sm); padding: 14px; margin: 14px 0; font-size: 14px; color: var(--sage-700); font-weight: 700; font-family: var(--font-ui); }

/* ---------- Responsive ---------- */
@media (max-width: 440px) {
  .stage { padding: 0; }
  .phone { border-radius: 0; min-height: 100dvh; box-shadow: none; border: none; }
  .theme-toggle { top: 12px; right: 12px; width: 40px; height: 40px; }
  /* reserve room so the fixed theme toggle never overlaps topbar content */
  .topbar { padding-right: 46px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
