/* Family Hub: "heirloom"
   Warm porcelain and charcoal, one deep evergreen moment on the home screen,
   and a muted, earthy tone for each tool. */

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --ink: #24211d;
  --muted: #7b756c;
  --line: #e7e3dc;
  --soft: #f1efea;
  --brand: #2c4a42;          /* evergreen */
  --brand-ink: #f3f0e9;
  --gold: #b8913f;
  --danger: #a3474f;
  --ok: #4f7a4b;

  /* tool tones */
  --t-grocery: #5f7d5b;      /* sage */
  --t-chores: #7a5878;       /* plum */
  --t-picker: #b07d35;       /* saffron */
  --t-polls: #a35763;        /* rosewood */
  --t-scores: #3e5573;       /* slate */
  --t-dice: #3e7774;         /* spruce */
  --t-countdown: #66639a;    /* dusty indigo */
  --t-santa: #8e2f3a;        /* cranberry */

  --tool: var(--brand);
  --tint: color-mix(in srgb, var(--tool) 10%, var(--card));

  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 11px;
  --shadow: 0 1px 2px rgba(36, 33, 29, .04), 0 6px 20px -8px rgba(36, 33, 29, .08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141513;
    --card: #1c1e1b;
    --ink: #ece9e2;
    --muted: #9c978e;
    --line: #2d302b;
    --soft: #242622;
    --brand: #2f5048;
    --t-grocery: #86a582;
    --t-chores: #b08cae;
    --t-picker: #d3a35c;
    --t-polls: #cf8692;
    --t-scores: #8aa3c4;
    --t-dice: #73aaa6;
    --t-countdown: #9b98cf;
    --t-santa: #d0707b;
    --shadow: none;
    --tint: color-mix(in srgb, var(--tool) 16%, var(--card));
  }
}

body[data-tool="grocery"] { --tool: var(--t-grocery); }
body[data-tool="chores"] { --tool: var(--t-chores); }
body[data-tool="picker"] { --tool: var(--t-picker); }
body[data-tool="polls"] { --tool: var(--t-polls); }
body[data-tool="scores"] { --tool: var(--t-scores); }
body[data-tool="dice"] { --tool: var(--t-dice); }
body[data-tool="countdown"] { --tool: var(--t-countdown); }
body[data-tool="santa"] { --tool: var(--t-santa); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16.5px/1.5 var(--font);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--tool) 60%, transparent); outline-offset: 2px; }
h1, h2, h3 { letter-spacing: -0.02em; }
#app { min-height: 100vh; }
.ico { display: block; flex: none; }

/* ---------- page header ---------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
  padding: calc(var(--safe-top) + 8px) 12px 10px;
  display: flex; align-items: center; gap: 10px; min-height: 58px;
}
.bar h1 { font-size: 18px; margin: 0; flex: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .back { width: 38px; height: 38px; margin-left: -4px; }
.bar .badge-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--tint); color: var(--tool); }
.icon-btn {
  border: 0; background: transparent; border-radius: 10px; color: var(--ink);
  display: inline-grid; place-items: center; min-height: 38px; min-width: 38px;
}
.icon-btn:active { background: var(--soft); }

.page { padding: 18px 16px calc(var(--safe-bottom) + 40px); max-width: 640px; margin: 0 auto; }

/* ---------- home ---------- */
.home-head { padding: calc(var(--safe-top) + 18px) 18px 0; max-width: 640px; margin: 0 auto; }
.home-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.home-head .date { color: var(--muted); font-size: 14px; font-weight: 500; }
.home-head h1 { margin: 2px 0 0; font-size: 30px; line-height: 1.12; font-weight: 700; letter-spacing: -0.03em; }
.round-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; color: var(--ink); box-shadow: var(--shadow);
}

/* the one bold moment: what needs you today */
.today {
  margin: 18px 16px 0; padding: 18px 18px 8px; border-radius: 22px; max-width: 608px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,.09), transparent 55%),
    linear-gradient(160deg, color-mix(in srgb, var(--brand) 88%, #000), var(--brand));
  color: var(--brand-ink);
  box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--brand) 80%, #000);
}
@media (min-width: 640px) { .today { margin-left: auto; margin-right: auto; } }
.today h2 { margin: 0 0 6px; font-size: 15px; font-weight: 600; opacity: .75; letter-spacing: 0; }
.today .item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid rgba(255,255,255,.1); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; color: inherit; text-align: left; }
.today .item:first-of-type { border-top: 0; }
.today .item .ic { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.1); display: grid; place-items: center; flex: none; }
.today .item b { font-weight: 600; flex: 1; }
.today .item .ico.chev { opacity: .5; }
.today .calm { padding: 6px 0 14px; opacity: .85; font-size: 15px; }

.tiles {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 0 16px; max-width: 640px; margin: 0 auto;
}
.tile {
  --c: var(--brand);
  border: 1px solid var(--line); background: var(--card); color: var(--ink); text-align: left;
  border-radius: var(--r-lg); padding: 14px; min-height: 118px; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s;
}
.tile:active { transform: scale(.98); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); }
.tile .chip-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 12%, var(--card)); color: var(--c); }
.tile b { font-size: 15.5px; font-weight: 700; margin-top: auto; padding-top: 14px; letter-spacing: -0.01em; }
.tile .hint { font-size: 13px; color: var(--muted); margin-top: 1px; min-height: 19px; line-height: 1.35; }
.tile .hint.hot { color: var(--c); font-weight: 600; }
.tile.grocery { --c: var(--t-grocery); }
.tile.chores { --c: var(--t-chores); }
.tile.picker { --c: var(--t-picker); }
.tile.polls { --c: var(--t-polls); }
.tile.scores { --c: var(--t-scores); }
.tile.dice { --c: var(--t-dice); }
.tile.countdown { --c: var(--t-countdown); }
.tile.santa { --c: var(--t-santa); }

@media (prefers-reduced-motion: no-preference) {
  .today.intro { animation: settle .5s cubic-bezier(.2,.8,.2,1) both; }
}
@keyframes settle { from { opacity: 0; transform: translateY(8px); } }

.upcoming-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.upcoming-row:first-child { border-top: 0; padding-top: 0; }
.upcoming-row:last-child { padding-bottom: 0; }
.date-chip { width: 46px; flex: none; text-align: center; border-radius: 11px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.date-chip span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; background: color-mix(in srgb, var(--t-countdown) 12%, var(--card)); color: var(--t-countdown); padding: 2px 0; }
.date-chip b { display: block; font-size: 18px; padding: 2px 0 3px; }

.family-strip { display: flex; flex-wrap: wrap; gap: 14px 8px; }
.family-strip > div { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 62px; }
.family-strip span.n { font-size: 12.5px; color: var(--muted); text-align: center; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- welcome screens ---------- */
.hero { padding: calc(var(--safe-top) + 40px) 22px 4px; max-width: 640px; margin: 0 auto; }
.hero .logo { width: 52px; height: 52px; border-radius: 14px; display: block; margin-bottom: 22px; box-shadow: var(--shadow); }
.hero h1 { margin: 0; font-size: 30px; line-height: 1.12; font-weight: 700; letter-spacing: -0.03em; }
.hero p { margin: 8px 0 0; color: var(--muted); }

/* ---------- cards & text ---------- */
.card {
  background: var(--card); border-radius: var(--r-lg); border: 1px solid var(--line);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 4px; font-size: 19px; font-weight: 700; }
.card h3 { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.section-title { font-size: 15px; font-weight: 700; margin: 26px 4px 10px; color: var(--ink); letter-spacing: -0.01em; }

/* ---------- avatars & photos ---------- */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 17px; flex: none; overflow: hidden; letter-spacing: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { width: 84px; height: 84px; font-size: 32px; }
.avatar.xl { width: 104px; height: 104px; font-size: 40px; }
.avatar.md { width: 50px; height: 50px; font-size: 19px; }
.avatar.sm { width: 30px; height: 30px; font-size: 12.5px; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.faces { display: inline-flex; vertical-align: middle; }
.faces .avatar { margin-left: -7px; box-shadow: 0 0 0 2px var(--card); }
.faces .avatar:first-child { margin-left: 0; }

.people { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 10px; margin-top: 22px; }
.person { background: transparent; border: 0; padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.person b { font-size: 15px; font-weight: 600; text-align: center; word-break: break-word; }
.person .avatar { transition: transform .12s; box-shadow: 0 0 0 3px var(--card), 0 0 0 4px var(--line); }
.person:active .avatar { transform: scale(.95); }
.photo-edit { display: flex; align-items: center; gap: 16px; }

/* ---------- PIN pad ---------- */
.pin-wrap { display: flex; flex-direction: column; align-items: center; padding-top: 8px; }
.pin-wrap h2 { font-size: 24px; margin: 16px 0 2px; font-weight: 700; }
.pin-dots { display: flex; gap: 14px; margin: 22px 0 6px; min-height: 14px; }
.pin-dots i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--muted); transition: all .1s; }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 24px; margin-top: 16px; }
.keypad button {
  width: 76px; height: 76px; border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  font-size: 27px; font-weight: 500; box-shadow: var(--shadow);
}
.keypad button:active { background: var(--soft); }
.keypad button.text { font-size: 15px; font-weight: 600; background: transparent; box-shadow: none; border: 0; color: var(--muted); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-sm); padding: 12px 14px;
  outline: none; min-height: 48px; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--tool) 60%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tool) 14%, transparent); }
input[type=checkbox] { accent-color: var(--tool); }
::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 13px; padding: 13px 18px; min-height: 50px; font-weight: 650; font-size: 16px;
  background: var(--tool); color: #fff; transition: transform .1s, filter .1s; letter-spacing: -0.005em;
}
@media (prefers-color-scheme: dark) { .btn { color: #141513; } }
.btn:active { transform: scale(.985); filter: brightness(.94); }
.btn.block { width: 100%; }
.btn.red { background: var(--tool); }
.btn.secondary { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--line); }
.btn.gold { background: var(--ink); color: var(--bg); }
.btn.small { min-height: 40px; padding: 8px 13px; font-size: 14.5px; border-radius: 11px; }
.btn:disabled { opacity: .4; transform: none; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { min-width: 0; }
.grow { flex: 1; }
.stack > * + * { margin-top: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--card); padding: 7px 14px; border-radius: 999px;
  font-size: 14.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; min-height: 40px;
}
.chip .avatar { margin-left: -7px; }
.chip.on { background: color-mix(in srgb, var(--tool) 11%, var(--card)); border-color: color-mix(in srgb, var(--tool) 55%, transparent); color: var(--ink); font-weight: 650; }

.seg { display: inline-flex; background: var(--soft); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 8px 13px; border-radius: 9px; font-size: 14.5px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(36,33,29,.12); font-weight: 650; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; padding-top: 2px; }
.list-item:last-child { padding-bottom: 2px; }
.tap { cursor: pointer; }
.tap:active { opacity: .7; }
.chev { color: var(--muted); }

.badge { display: inline-block; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.green { background: color-mix(in srgb, var(--ok) 13%, var(--card)); color: var(--ok); }
.badge.red { background: color-mix(in srgb, var(--danger) 12%, var(--card)); color: var(--danger); }

.link-card { display: flex; align-items: center; gap: 14px; }
.link-card .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--tint); color: var(--tool); flex: none; }

/* ---------- Secret Santa ---------- */
.reveal {
  border-radius: var(--r-lg); padding: 28px 18px; text-align: center; user-select: none; width: 100%; border: 0;
  color: #f7ede6;
  background:
    radial-gradient(90% 70% at 0% 0%, rgba(255,255,255,.08), transparent 60%),
    linear-gradient(150deg, #9b3541, #6f1f2a);
  box-shadow: inset 0 0 0 1px rgba(232, 200, 140, .35), 0 14px 28px -18px #5a1620;
}
.reveal .big { font-size: 14.5px; opacity: .85; }
.reveal .name { font-size: 32px; font-weight: 750; margin: 8px 0; letter-spacing: -0.03em; }
.reveal .gift { width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 6px; display: grid; place-items: center; background: rgba(255,255,255,.1); color: #f0d9a4; }
.reveal.shown { background: radial-gradient(90% 70% at 0% 0%, rgba(255,255,255,.08), transparent 60%), linear-gradient(150deg, #345a50, #22403a); box-shadow: inset 0 0 0 1px rgba(232,200,140,.3); }
.reveal .avatar { margin: 6px auto 0; box-shadow: 0 0 0 3px rgba(240, 217, 164, .6); }
.wish { white-space: pre-wrap; background: var(--soft); border-radius: var(--r-sm); padding: 12px 14px; margin-top: 8px; text-align: left; }

/* ---------- Score keeper ---------- */
.board { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.score { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 13px; position: relative; box-shadow: var(--shadow); }
.score .who { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
.score .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score .pts { font-size: 34px; font-weight: 750; letter-spacing: -0.035em; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.score.lead { border-color: color-mix(in srgb, var(--gold) 70%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 50%, transparent), var(--shadow); }
.score.lead::after { content: "Leading"; position: absolute; top: 11px; right: 11px; font-size: 11px; font-weight: 700; color: var(--gold); }
table.rounds { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14.5px; }
table.rounds th, table.rounds td { padding: 9px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.rounds th { font-weight: 600; color: var(--muted); font-size: 12.5px; }
table.rounds th:first-child, table.rounds td:first-child { text-align: left; color: var(--muted); }
table.rounds tr.tap:active td { background: var(--soft); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.entry { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.entry .nm { flex: 1; display: flex; align-items: center; gap: 9px; font-weight: 600; min-width: 0; }
.entry .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry input { width: 100px; text-align: right; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pm { width: 44px; height: 48px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card); font-size: 19px; flex: none; color: var(--muted); }
.pm.neg { background: color-mix(in srgb, var(--danger) 12%, var(--card)); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.banner { background: color-mix(in srgb, var(--gold) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 12px; font-size: 15px; }
.winner { text-align: center; padding: 22px 12px; }
.winner .trophy { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: color-mix(in srgb, var(--gold) 14%, var(--card)); color: var(--gold); }
.winner .avatar { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--gold); }
.winner h2 { font-size: 26px; margin: 12px 0 2px; font-weight: 750; }
.bars .barrow { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.bars .track { flex: 1; height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.bars .fill { height: 100%; border-radius: 4px; background: var(--tool); }
.bars .n { width: 30px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- picker / turn picker ---------- */
.spin-box { min-height: 128px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 0 16px; }
.spin-word { font-size: 34px; font-weight: 750; letter-spacing: -0.035em; line-height: 1.15; margin: 4px 0; text-align: center; }
.spin-word.rolling { color: var(--muted); }
.spin-word.pop { color: var(--tool); }
@media (prefers-reduced-motion: no-preference) { .spin-word.pop { animation: pop .4s cubic-bezier(.2,.9,.3,1.3); } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.turn-list { text-align: left; font-size: 19px; font-weight: 650; margin: 4px auto 0; display: inline-flex; flex-direction: column; gap: 10px; }
.turn-row { display: flex; align-items: center; gap: 11px; }
.turn-n { width: 24px; font-size: 14px; color: var(--tool); font-weight: 750; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- grocery ---------- */
.check {
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--muted) 60%, transparent); background: var(--card); flex: none;
  color: #fff; display: grid; place-items: center; padding: 0;
}
.check.on { background: var(--tool); border-color: var(--tool); }

/* ---------- polls ---------- */
.poll-opt {
  position: relative; overflow: hidden; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card);
  border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
}
.poll-opt:disabled { cursor: default; }
.poll-opt.mine { border-color: color-mix(in srgb, var(--tool) 60%, transparent); }
.poll-fill { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--tool) 10%, transparent); z-index: 0; transition: width .4s; }
.poll-text, .poll-n, .poll-who { position: relative; z-index: 1; }
.poll-text { flex: 1; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.poll-text .ico { color: var(--tool); }
.poll-n { font-weight: 750; font-variant-numeric: tabular-nums; }
.poll-who { flex-basis: 100%; display: flex; gap: 6px; align-items: center; }

/* ---------- dice ---------- */
.dice-out { min-height: 116px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-bottom: 16px; }
.dice-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.die {
  width: 66px; height: 66px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 28px; font-weight: 750; color: var(--tool);
  box-shadow: 0 1px 0 var(--line), 0 8px 18px -10px rgba(36,33,29,.35);
}
.die.six { grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 12px; }
.die.six i { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
@media (prefers-reduced-motion: no-preference) { .shaking .die { animation: wobble .12s infinite alternate; } }
@keyframes wobble { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
.coin {
  width: 128px; height: 128px; border-radius: 50%; margin: 6px auto 14px; display: grid; place-items: center;
  color: #6d5320; font-size: 15px; font-weight: 750; letter-spacing: .02em;
  background: radial-gradient(circle at 35% 30%, #f1dfb2, #c9a45c 70%);
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.25), inset 0 -5px 0 rgba(0,0,0,.08), 0 12px 24px -14px #7d6025;
}
@media (prefers-reduced-motion: no-preference) { .coin.flipping { animation: flip .9s ease-in-out; } }
@keyframes flip { 0% { transform: rotateY(0) translateY(0); } 50% { transform: rotateY(900deg) translateY(-36px); } 100% { transform: rotateY(1800deg) translateY(0); } }

/* ---------- countdowns ---------- */
.cd-n { font-size: 30px; font-weight: 750; line-height: 1; letter-spacing: -0.035em; color: var(--tool); font-variant-numeric: tabular-nums; }
.card.today-cd { border-color: color-mix(in srgb, var(--tool) 50%, transparent); background: var(--tint); }
.emoji-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; font-size: 22px; flex: none; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty .ic { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--tint); color: var(--tool); }
#toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 24px); transform: translateX(-50%) translateY(30px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 13px; font-size: 14.5px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .25s; max-width: calc(100% - 32px); z-index: 50; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.offline { padding: calc(var(--safe-top) + 64px) 24px 24px; text-align: center; max-width: 480px; margin: 0 auto; }
.offline .ic { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto; display: grid; place-items: center; background: var(--soft); color: var(--muted); }
.offline h2 { font-size: 24px; margin: 16px 0 6px; }
.offline ol { text-align: left; }

.sheet-bg { position: fixed; inset: 0; background: rgba(20, 18, 15, .4); z-index: 20; display: flex; align-items: flex-end; }
.sheet {
  background: var(--card); width: 100%; max-width: 640px; margin: 0 auto; border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(var(--safe-bottom) + 18px); max-height: 88vh; overflow-y: auto;
}
.sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 16px; }
.sheet h2 { margin: 0 0 14px; font-size: 20px; font-weight: 700; }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: rise .22s ease-out; } }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }

/* ---------- the flying Santa ---------- */
.flying-santa {
  position: fixed; left: 0; z-index: 30; width: 280px; border: 0; background: none; padding: 0;
  animation: fly 11s linear forwards; filter: drop-shadow(0 8px 10px rgba(0,0,0,.16));
}
.flying-santa svg { display: block; width: 100%; animation: bob 1.1s ease-in-out infinite alternate; }
@keyframes fly { from { transform: translateX(-300px); } to { transform: translateX(calc(100vw + 30px)); } }
@keyframes bob { from { transform: translateY(-7px) rotate(-2deg); } to { transform: translateY(7px) rotate(2deg); } }
.santa-preview { background: radial-gradient(120% 100% at 80% 0%, #2f4b61, #1b2733); border-radius: var(--r-md); padding: 16px 10px 6px; position: relative; overflow: hidden; }
.santa-preview::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(1.2px 1.2px at 12% 22%, #fff9, transparent), radial-gradient(1px 1px at 32% 12%, #fff8, transparent), radial-gradient(1.4px 1.4px at 58% 28%, #fffa, transparent), radial-gradient(1px 1px at 76% 14%, #fff7, transparent), radial-gradient(1.2px 1.2px at 90% 34%, #fff9, transparent); }
.santa-preview svg { width: 100%; max-width: 330px; display: block; margin: 0 auto; position: relative; }
.santa-preview p { color: #c9d3dc !important; text-align: center; margin: 24px 0; position: relative; }

/* ---------- bigger screens (computers, iPads) ---------- */
@media (min-width: 700px) {
  .bar { padding-left: max(12px, calc((100% - 616px) / 2)); padding-right: max(12px, calc((100% - 616px) / 2)); }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .sheet { border-radius: 24px; margin-bottom: 5vh; }
  .sheet-bg { align-items: center; }
}
