/* Layout: full-window app. Teal frosted panel on the left, live 3D living room on the right. */
:root {
  --panel-top: #5f8c88;
  --panel-bot: #46596d;
  --glass: rgba(255, 255, 255, .13);
  --glass-line: rgba(255, 255, 255, .32);
  --ink: #ffffff;
  --ink-soft: rgba(255, 255, 255, .8);
  --pine: #2f6d3c;
  --pine-hi: #3b8a4b;
  --gold: #f6c453;
  --berry: #d6455a;
  --card: #fdf7ec;
  --card-ink: #2b2219;
  --card-muted: #7d6c59;
  --room: #f0c79c;
  --display: "Fredoka", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
  box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; }
html, body { height: 100%; margin: 0; padding: 0; }
body { background: var(--panel-bot); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; overflow: hidden; }
img { max-width: 100%; }
[hidden]:not([hidden=until-found i]) { display: none !important; }

.app { height: 100%; display: grid; grid-template-columns: minmax(355px, 445px) minmax(0, 1fr); }
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { height: auto; grid-template-columns: minmax(0, 1fr); }
  .scene { order: -1; height: 60vh; height: 60dvh; min-height: 360px; }
  .panel { overflow: visible; }
  .card .pane { overflow: visible !important; }
}

/* ---------- Panel ---------- */
.panel {
  min-width: 0; overflow: auto; position: relative;
  background: linear-gradient(170deg, var(--panel-top) 0%, #557a80 40%, var(--panel-bot) 100%);
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: 20px;
  padding-block: 20px 22px;
  display: flex; flex-direction: column; gap: 14px;
}
@media (max-width: 860px) { .panel { padding-right: max(20px, env(safe-area-inset-right, 0px)); } }
.panel::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(80% 40% at 0% 0%, rgba(255,255,255,.16), transparent 70%); }

.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.hero .eyebrow { display: inline-flex; gap: 6px; font-weight: 800; font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--gold); }
.me-chip {
  font: inherit; font-family: var(--display); font-weight: 600; font-size: 13px;
  color: #fff; background: rgba(255,255,255,.16); border: 1.5px solid rgba(255,255,255,.32);
  border-radius: 999px; padding: 3px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-chip:hover { background: rgba(255,255,255,.26); }

.hero h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 3.6vw, 2.85rem); line-height: 1; letter-spacing: -.5px; margin: 0 0 8px; text-wrap: balance; }
.hero p { margin: 0; font-family: var(--display); font-weight: 500; font-size: 1.06rem; line-height: 1.3; max-width: 34ch; }
.hero p + p { margin-top: 5px; color: var(--ink-soft); font-size: .96rem; }

.clock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.clock .u { background: rgba(255,255,255,.12); border: 1.5px solid rgba(255,255,255,.28); border-radius: 18px; padding: 8px 4px 6px; text-align: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.clock .n { display: block; font-family: var(--display); font-weight: 700; font-size: 1.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
.clock .l { display: block; margin-top: 4px; font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 800; color: var(--ink-soft); }
.clock.xmas { grid-template-columns: 1fr; }
.clock.xmas .u { background: linear-gradient(120deg, rgba(246,196,83,.4), rgba(214,69,90,.35)); font-family: var(--display); font-weight: 700; font-size: 1.2rem; padding: 12px; }

.banner { display: flex; align-items: center; gap: 11px; padding: 10px 14px; border-radius: 18px; background: linear-gradient(120deg, rgba(246,196,83,.3), rgba(214,69,90,.28)); border: 1.5px solid rgba(255,255,255,.35); }
.banner.nice-banner { background: linear-gradient(120deg, rgba(47,109,60,.52), rgba(74,158,100,.38)); }
.banner.naughty-banner { background: linear-gradient(120deg, rgba(214,69,90,.54), rgba(160,36,54,.44)); }
.banner .ico { font-size: 24px; flex-shrink: 0; }
.banner .txt { flex: 1; min-width: 0; font-family: var(--display); font-weight: 500; font-size: .95rem; line-height: 1.25; }
.banner .txt b { font-weight: 700; display: block; }

.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; background: rgba(0,0,0,.15); border-radius: 999px; }
.tab { font: inherit; font-family: var(--display); font-weight: 600; font-size: .9rem; color: var(--ink-soft); background: none; border: 0; border-radius: 999px; padding: 8px 4px; cursor: pointer; position: relative; white-space: nowrap; }
.tab:hover { color: #fff; }
.tab[aria-selected="true"] { background: rgba(255,255,255,.93); color: #2f4f55; }
.tab .dot { position: absolute; top: 4px; right: 10%; width: 7px; height: 7px; border-radius: 50%; background: var(--berry); }

.card { position: relative; background: var(--glass); border: 1.5px solid var(--glass-line); border-radius: 28px; padding: 16px 15px 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 18px 40px rgba(20, 30, 45, .18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); min-height: 220px; flex: 1 1 auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 4px 6px; }
.card-head h2 { font-family: var(--display); font-weight: 700; font-size: 1.6rem; margin: 0; }
.count-badge { font-family: var(--display); font-weight: 700; font-size: .85rem; background: rgba(255,255,255,.2); border-radius: 999px; padding: 2px 9px; margin-left: 7px; vertical-align: 4px; font-variant-numeric: tabular-nums; }
.pane { overflow: auto; min-height: 0; flex: 1 1 auto; margin: 0 -6px; padding: 0 6px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.pill { font: inherit; font-family: var(--display); font-weight: 600; font-size: .98rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 16px; border-radius: 999px; border: 2px solid rgba(255,255,255,.85); color: #fff; background: var(--pine); box-shadow: 0 4px 0 rgba(0,0,0,.14); transition: transform .15s, background .15s; position: relative; white-space: nowrap; text-decoration: none; }
.pill:hover { background: var(--pine-hi); transform: translateY(-1px); }
.pill:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(0,0,0,.14); }
.pill.gold { background: var(--gold); color: #3b2700; border-color: #fff3cf; }
.pill.gold:hover { background: #ffd370; }
.pill.berry { background: var(--berry); border-color: #ffd1d8; }
.pill.berry:hover { background: #e3566b; }
.pill.ghost { background: rgba(255,255,255,.14); }
.pill.ghost:hover { background: rgba(255,255,255,.24); }
.pill.small { padding: 5px 12px; font-size: .88rem; }
.pill.sparkle::before, .pill.sparkle::after { content: "✦"; position: absolute; color: var(--gold); font-size: 11px; pointer-events: none; }
.pill.sparkle::before { top: -11px; left: 38%; }
.pill.sparkle::after { bottom: -12px; right: 18%; font-size: 9px; }
.pill svg { width: 17px; height: 17px; }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; align-items: start; text-align: left; width: 100%; padding: 10px 8px; border-radius: 18px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.row:hover { background: rgba(255,255,255,.09); }
.ava { width: 42px; height: 42px; border-radius: 50%; }
.ava .init { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.6); background: rgba(255,255,255,.2); font-family: var(--display); font-weight: 700; font-size: 18px; }
.row .who { font-family: var(--display); font-weight: 500; font-size: 1rem; color: var(--ink-soft); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.row .what { font-family: var(--display); font-weight: 600; font-size: 1.02rem; line-height: 1.3; overflow-wrap: anywhere; white-space: pre-wrap; }
.row .what.sealed { color: var(--ink-soft); font-weight: 500; }
.row .meta { display: flex; gap: 10px; margin-top: 4px; font-size: 12.5px; font-weight: 800; color: var(--ink-soft); flex-wrap: wrap; }
.row .meta .thx { color: var(--gold); overflow-wrap: anywhere; }
.row .side { align-self: center; display: flex; }
.row .side svg { margin-left: -10px; filter: drop-shadow(0 3px 3px rgba(0,0,0,.25)); }
.row .side svg:first-child { margin-left: 0; }
.tag { display: inline-block; font-family: var(--body); font-size: 10.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; background: var(--gold); color: #3b2700; padding: 1px 7px; border-radius: 6px; }
.tag.tier { background: rgba(246,196,83,.25); color: #ffe7a3; border: 1px solid rgba(246,196,83,.45); text-transform: none; letter-spacing: 0; }
.tag.nice { background: rgba(59, 138, 75, .55); color: #e6ffea; }
.tag.naughty { background: rgba(214, 69, 90, .6); color: #ffe5e9; }

.empty-art { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 16px 8px 20px; }
.empty-art p { margin: 0; color: var(--ink-soft); font-family: var(--display); font-weight: 500; font-size: 1.02rem; max-width: 30ch; }
.empty-art .ghosts { display: flex; align-items: flex-end; gap: 2px; opacity: .55; }

/* Giving Progress Card (Sent Tab) */
.giver-card {
  background: linear-gradient(135deg, rgba(246,196,83,.24), rgba(255,255,255,.1));
  border: 1.5px solid rgba(246,196,83,.45);
  border-radius: 20px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.giver-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.giver-badge { display: flex; align-items: center; gap: 9px; font-family: var(--display); }
.giver-badge .em { font-size: 28px; line-height: 1; }
.giver-badge b { display: block; font-size: 1.05rem; line-height: 1.1; }
.giver-badge small { color: var(--ink-soft); font-size: 12.5px; }
.progress-track { height: 8px; border-radius: 999px; background: rgba(0,0,0,.22); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f6c453, #ffe599); transition: width .4s ease; }
.giver-foot { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-soft); font-weight: 700; }

/* Naughty & Nice Scroll Tab */
.nn-wrap { display: flex; flex-direction: column; gap: 12px; padding: 2px 2px 8px; }
.nn-suggest { background: rgba(0,0,0,.14); border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.nn-suggest-title { font-family: var(--display); font-size: 13px; color: var(--gold); font-weight: 600; }
.nn-suggest-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--display); font-size: 14px; }
.nn-sec { border-radius: 18px; padding: 11px 12px; display: flex; flex-direction: column; gap: 6px; }
.nn-sec.nice { background: rgba(47, 109, 60, .28); border: 1.5px solid rgba(150, 235, 165, .3); }
.nn-sec.naughty { background: rgba(214, 69, 90, .26); border: 1.5px solid rgba(255, 175, 185, .32); }
.nn-sec-head { display: flex; align-items: center; justify-content: space-between; font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.nn-item { background: rgba(255,255,255,.1); border-radius: 13px; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nn-item .nm { font-family: var(--display); font-weight: 600; font-size: .98rem; line-height: 1.2; }
.nn-item .nt { font-size: 12.5px; color: var(--ink-soft); }
.nn-item .acts { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn { width: 30px; height: 30px; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 13px; }
.icon-btn:hover { background: rgba(255,255,255,.25); }

.advent { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 4px 2px 10px; }
.door { aspect-ratio: 1; border-radius: 16px; border: 2px solid rgba(255,255,255,.5); font: inherit; font-family: var(--display); font-weight: 700; font-size: 1.35rem; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; position: relative; box-shadow: 0 4px 0 rgba(0,0,0,.18); transition: transform .14s ease, box-shadow .14s ease; padding: 6px; }
.door:hover:not([data-state="locked"]) { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(0,0,0,.22); }
.door:nth-child(4n+1) { background: linear-gradient(155deg, #c74254, #a42d3e); }
.door:nth-child(4n+2) { background: linear-gradient(155deg, #377d46, #275d33); }
.door:nth-child(4n+3) { background: linear-gradient(155deg, #d6a436, #b38221); }
.door:nth-child(4n) { background: linear-gradient(155deg, #44769e, #315a7c); }
.door[data-state="locked"] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.door[data-state="open"] { background: rgba(253,247,236,.94) !important; color: #3a2a1a; border-color: #f4d68c; }
.door[data-state="today"] { animation: bob 1.6s ease-in-out infinite; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(246,196,83,.3), 0 5px 0 rgba(0,0,0,.2); }
.door .d-num { font-size: 1.55rem; line-height: 1; }
.door .d-em { font-size: 1.85rem; line-height: 1; }
.door .d-sub { font-family: var(--body); font-size: 11px; font-weight: 800; opacity: .82; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes bob { 50% { transform: translateY(-3px); } }

/* Spacious Advent Calendar stage over the 3D scene */
.advent-stage {
  position: absolute; inset: 0; z-index: 4;
  background: linear-gradient(160deg, rgba(44, 72, 82, .88) 0%, rgba(44, 54, 72, .93) 100%);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(22px, env(safe-area-inset-top, 0px)) max(26px, env(safe-area-inset-right, 0px)) max(22px, env(safe-area-inset-bottom, 0px)) max(26px, env(safe-area-inset-left, 0px));
  overflow: auto;
}
.advent-stage-inner {
  width: min(860px, 100%);
  max-height: 100%;
  display: flex; flex-direction: column; gap: 16px;
}
.advent-stage-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.advent-stage-head .eyebrow {
  font-size: 11.5px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); margin-bottom: 2px;
}
.advent-stage-head h2 {
  font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 2.5vw, 2.1rem); margin: 0; line-height: 1.05;
}
.advent-big {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 11px;
}
.advent-big .door { aspect-ratio: 1.15; border-radius: 18px; }
@media (max-width: 1100px) {
  .advent-big { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .advent-big .door { aspect-ratio: 1; }
}
@media (max-width: 860px) {
  .advent-stage { justify-content: flex-start; padding: 16px; }
  .advent-big { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .advent-big .door { aspect-ratio: 1; }
  .door .d-num { font-size: 1.25rem; }
  .door .d-em { font-size: 1.45rem; }
}
.advent-stage-foot {
  text-align: center; color: var(--ink-soft); font-family: var(--display); font-size: .96rem; margin: 0;
}

/* Mystery Stocking Card (Advent Tab + Modal) */
.stocking-card {
  background: linear-gradient(135deg, rgba(214,69,90,.36), rgba(47,109,60,.34));
  border: 1.5px solid rgba(255,255,255,.38);
  border-radius: 20px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.stocking-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stocking-title { display: flex; align-items: center; gap: 9px; font-family: var(--display); }
.stocking-title .em { font-size: 30px; line-height: 1; }
.stocking-title b { display: block; font-size: 1.05rem; line-height: 1.15; }
.stocking-title small { color: var(--ink-soft); font-size: 12.5px; }
.stocking-pips { display: flex; flex-wrap: wrap; gap: 5px; }
.stocking-pip {
  width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255,255,255,.16); border: 1.5px solid rgba(255,255,255,.32);
  font-size: 15px; font-family: var(--display); font-weight: 700; color: var(--gold);
}
.stocking-pip.revealed { background: var(--card); color: var(--card-ink); border-color: var(--gold); }
.clue-box {
  background: rgba(0,0,0,.2); border: 1.5px dashed rgba(246,196,83,.5);
  border-radius: 16px; padding: 11px 14px; font-family: var(--display);
  font-size: 1.02rem; color: #fff6dc; text-align: center;
}
.verse-note {
  width: 100%; margin-top: 6px; padding-top: 11px;
  border-top: 1px solid rgba(255,255,255,.18);
  text-align: center; color: rgba(255,255,255,.78);
  font-size: 13.5px; line-height: 1.45;
}
.verse-note blockquote { margin: 0; font-style: italic; }
.verse-note cite { display: block; margin-top: 4px; font-style: normal; font-size: 12px; font-weight: 800; letter-spacing: .5px; color: rgba(246,196,83,.88); }
.stuffer-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow: auto; }
.stuffer-row {
  background: rgba(255,255,255,.12); border: 1.5px solid rgba(255,255,255,.22);
  border-radius: 16px; padding: 10px 12px; display: flex; align-items: center; gap: 11px; text-align: left;
}
.stuffer-row.revealed { background: var(--card); color: var(--card-ink); border-color: var(--gold); }
.stuffer-row .em { font-size: 30px; line-height: 1; flex-shrink: 0; }
.stuffer-row b { display: block; font-family: var(--display); font-size: 1rem; }
.stuffer-row small { display: block; font-size: 12.5px; opacity: .82; line-height: 1.3; }

.note { font-size: 13px; color: var(--ink-soft); border-top: 1px solid rgba(255,255,255,.18); padding-top: 9px; margin: 0 4px; }
.note strong { color: #fff; }
.foot { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Scene ---------- */
.scene { position: relative; min-width: 0; background: var(--room); overflow: hidden; touch-action: none; }
.scene canvas { display: block; width: 100%; height: 100%; cursor: grab; opacity: 0; transition: opacity 1.1s ease; }
.scene.ready canvas { opacity: 1; }
.scene canvas.drag { cursor: grabbing; }
.scene canvas.hover { cursor: pointer; }
.vignette { position: absolute; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(120% 90% at 55% 55%, transparent 55%, rgba(70, 30, 10, .38) 100%); }
.room-label, .hud, .hint, .tip, .pop, .fallback { z-index: 2; }
.room-label { position: absolute; top: max(22px, env(safe-area-inset-top, 0px)); left: 28px; pointer-events: none; text-shadow: 0 2px 10px rgba(80, 40, 10, .35); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: calc(100% - 220px); }
.room-label b { display: block; font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 2.5vw, 2.15rem); line-height: 1.05; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(255, 244, 230, .28); border: 1.5px solid rgba(255,255,255,.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-family: var(--display); font-weight: 500; font-size: .96rem; color: #fff; }
button.chip { pointer-events: auto; cursor: pointer; font: inherit; font-family: var(--display); font-weight: 500; }
button.chip:hover { background: rgba(255, 244, 230, .44); }
.chip code { font-family: var(--display); font-weight: 700; letter-spacing: .3px; }
.hud { position: absolute; top: max(18px, env(safe-area-inset-top, 0px)); right: max(18px, env(safe-area-inset-right, 0px)); display: flex; gap: 4px; padding: 6px; border-radius: 22px; background: rgba(255, 244, 230, .32); border: 1.5px solid rgba(255,255,255,.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 8px 24px rgba(90, 50, 20, .18); }
.hud button { width: 46px; height: 46px; border-radius: 16px; border: 0; background: transparent; color: #fff; cursor: pointer; display: grid; place-items: center; filter: drop-shadow(0 2px 3px rgba(80,40,10,.35)); }
.hud button:hover { background: rgba(255,255,255,.22); }
.hud button[aria-pressed="true"], .hud button[aria-expanded="true"] { background: rgba(255,255,255,.3); }
.hud svg { width: 25px; height: 25px; }
@media (max-width: 560px) { .room-label { max-width: calc(100% - 56px); top: calc(max(18px, env(safe-area-inset-top, 0px)) + 66px); left: 18px; } }
.hint { position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); font-weight: 800; font-size: 13px; color: #fff; background: rgba(60, 35, 15, .38); padding: 6px 14px; border-radius: 999px; pointer-events: none; white-space: nowrap; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: opacity .5s; }
.hint.gone { opacity: 0; }
.tip { position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 14px)); background: var(--card); color: var(--card-ink); font-family: var(--display); font-weight: 600; padding: 6px 12px; border-radius: 12px; white-space: nowrap; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: #5a3a1e; font-family: var(--display); font-size: 1.2rem; }
.pop { position: absolute; top: calc(max(18px, env(safe-area-inset-top, 0px)) + 68px); right: max(18px, env(safe-area-inset-right, 0px)); width: min(325px, calc(100% - 36px)); max-height: 68%; overflow: auto; background: rgba(62, 82, 98, .96); border: 1.5px solid var(--glass-line); border-radius: 22px; padding: 12px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 20px 40px rgba(0,0,0,.28); display: flex; flex-direction: column; gap: 4px; }
.pop h3 { margin: 4px 8px 6px; font-family: var(--display); font-weight: 700; font-size: 1.18rem; }
.pop a, .pop .song, .pop .tree-link { display: grid; grid-template-columns: 32px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 8px; border-radius: 14px; color: #fff; text-decoration: none; font: inherit; font-family: var(--display); font-weight: 500; background: none; border: 0; text-align: left; cursor: pointer; width: 100%; }
.pop a:hover, .pop .song:hover, .pop .tree-link:hover { background: rgba(255,255,255,.12); }
.pop a[aria-current="page"], .pop .song[aria-pressed="true"], .pop .tree-link[aria-current="page"] { background: rgba(246,196,83,.22); }
.pop .mini { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.15); font-size: 15px; font-weight: 700; }
.pop .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop .ct { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: 13.5px; }
.pop p { margin: 4px 8px 6px; color: var(--ink-soft); font-size: 13.5px; }
.pop form { display: flex; gap: 6px; margin: 4px; }
.pop input[type="text"] { flex: 1; min-width: 0; font: inherit; font-family: var(--display); font-size: 15px; padding: 8px 12px; border-radius: 12px; border: 0; background: var(--card); color: var(--card-ink); }
.pop label.vol { display: flex; align-items: center; gap: 10px; margin: 8px; font-family: var(--display); }
.pop input[type="range"] { flex: 1; min-width: 0; accent-color: var(--gold); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

.place-bar { position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; border-radius: 999px; background: rgba(40, 60, 70, .86); border: 1.5px solid rgba(255,255,255,.45); backdrop-filter: blur(8px); font-family: var(--display); font-weight: 600; color: #fff; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.orn-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 460px) { .orn-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.orn-grid .pick { min-height: 92px; justify-content: center; }
.orn-grid .pick .em { font-size: 34px; line-height: 1; }

/* ---------- Modals ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(20, 28, 38, .58); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.overlay.see-through { background: rgba(20,28,38,.12); backdrop-filter: none; -webkit-backdrop-filter: none; justify-content: flex-start; align-items: stretch; }
.overlay.see-through .modal { width: min(440px, 100%); }
.modal { width: min(600px, 100%); max-height: 100%; overflow: auto; background: linear-gradient(170deg, #628f8b, #4a5e71); border: 1.5px solid var(--glass-line); border-radius: 28px; padding: 24px; display: flex; flex-direction: column; gap: 15px; box-shadow: 0 30px 80px rgba(0,0,0,.42); }
.modal > * { min-width: 0; }
.modal h3 { font-family: var(--display); font-weight: 700; font-size: 1.8rem; line-height: 1.06; margin: 0; text-wrap: balance; }
.modal .sub { color: var(--ink-soft); margin: -6px 0 0; font-family: var(--display); font-weight: 500; font-size: 1rem; }

/* Present Catalog Picker */
.present-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-height: 230px; overflow: auto; padding: 2px; }
@media (max-width: 500px) { .present-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.present-opt {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 10px 8px; border-radius: 16px; cursor: pointer; font: inherit;
  background: rgba(255,255,255,.11); border: 2px solid transparent; color: #fff;
  transition: transform .12s, background .12s;
}
.present-opt:hover { background: rgba(255,255,255,.18); transform: translateY(-1px); }
.present-opt[aria-checked="true"] { border-color: var(--gold); background: rgba(246,196,83,.22); }
.present-opt .em { font-size: 30px; line-height: 1.1; }
.present-opt .nm { font-family: var(--display); font-weight: 600; font-size: 13.5px; line-height: 1.15; }
.present-opt .ds { font-size: 11.5px; color: var(--ink-soft); line-height: 1.25; }

.picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 460px) { .picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pick { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; padding: 10px 6px 8px; min-height: 104px; border-radius: 18px; cursor: pointer; font: inherit; font-family: var(--display); font-weight: 500; font-size: 12.5px; color: var(--ink-soft); background: rgba(255,255,255,.1); border: 2px solid transparent; }
.pick:hover { background: rgba(255,255,255,.17); }
.pick[aria-checked="true"] { border-color: var(--gold); background: rgba(246,196,83,.18); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { font: inherit; font-family: var(--display); font-weight: 600; font-size: .92rem; cursor: pointer; padding: 6px 12px; border-radius: 999px; border: 2px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff; display: inline-flex; align-items: center; gap: 6px; }
.opt:hover { background: rgba(255,255,255,.18); }
.opt[aria-checked="true"] { border-color: var(--gold); background: rgba(246,196,83,.25); }
.opt .sw { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.7); }
.stickers .opt { font-size: 1.2rem; padding: 4px 8px; min-width: 42px; justify-content: center; }
.fl { font-family: var(--display); font-weight: 600; font-size: 1.02rem; }

input.text-in, textarea {
  width: 100%; font-family: var(--display); font-weight: 500; font-size: 16.5px; line-height: 1.4;
  background: var(--card); color: var(--card-ink); border: 0; border-radius: 16px; padding: 12px 15px;
}
textarea { min-height: 98px; resize: vertical; }
textarea.short { min-height: 68px; font-size: 15.5px; }
input.text-in::placeholder, textarea::placeholder { color: var(--card-muted); }

.mrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.count { color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.err { color: #ffd0d6; font-weight: 800; margin: 0; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.22); }

/* Share & Recovery Boxes */
.code-hero {
  background: rgba(0,0,0,.22); border: 1.5px solid rgba(255,255,255,.28); border-radius: 20px;
  padding: 16px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.code-hero .big-code { font-family: var(--display); font-size: 1.95rem; font-weight: 700; color: var(--gold); letter-spacing: .5px; word-break: break-all; }
.code-hero .url-preview { font-size: 13.5px; color: var(--ink-soft); word-break: break-all; }
.secret-box {
  background: rgba(0,0,0,.18); border: 1.5px dashed rgba(246,196,83,.5); border-radius: 18px;
  padding: 13px 14px; display: flex; flex-direction: column; gap: 8px;
}
.secret-box p { margin: 0; font-size: 13.5px; color: var(--ink-soft); }

/* Unwrap & Present Reveal */
.stage { position: relative; height: 200px; display: flex; align-items: flex-end; justify-content: center; }
.big .lid, .big .bow { transition: transform .7s cubic-bezier(.3,1.4,.5,1), opacity .6s; transform-box: fill-box; transform-origin: 50% 100%; }
.opening .big .bow { transform: translate(-40px, -120px) rotate(-40deg); opacity: 0; }
.opening .big .lid { transform: translate(90px, -60px) rotate(28deg); opacity: 0; }
.shaking { animation: shake .6s ease; transform-origin: 50% 100%; }
@keyframes shake { 0%,100% { transform: rotate(0) } 20% { transform: rotate(-9deg) } 40% { transform: rotate(9deg) } 60% { transform: rotate(-6deg) } 80% { transform: rotate(3deg) } }
.gift-tag { align-self: center; background: var(--card); color: var(--card-ink); border-radius: 10px; padding: 8px 16px 8px 26px; position: relative; font-family: var(--display); font-weight: 600; box-shadow: 0 6px 14px rgba(0,0,0,.2); transform: rotate(-3deg); max-width: 100%; overflow-wrap: anywhere; }
.gift-tag::before { content: ""; position: absolute; left: 9px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #b9a58b; }
.gift-tag small { display: block; font-size: 12px; color: var(--card-muted); font-weight: 500; }
.guess { text-align: center; font-family: var(--display); font-weight: 600; font-size: 1.12rem; min-height: 1.5em; margin: 0; }
.heart { font: inherit; font-family: var(--display); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; border: 2px solid rgba(255,255,255,.7); background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.heart[aria-pressed="true"] { background: #e0536a; border-color: #ffd0d8; }
.heart svg { width: 18px; height: 18px; }

.present-reveal {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(120deg, #fff5dc, #fdecc8);
  border: 2px solid #f0cf82; border-radius: 16px; padding: 11px 14px;
}
.present-reveal .em { font-size: 38px; line-height: 1; }
.present-reveal .info b { display: block; font-family: var(--display); font-size: 1.18rem; color: #3a2305; }
.present-reveal .info span { font-size: 12.5px; color: #7a5c32; font-weight: 700; }

.wish-card { background: var(--card); color: var(--card-ink); border-radius: 20px; padding: 18px 18px 16px; box-shadow: 0 14px 30px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 10px; position: relative; }
.wish-card .w { font-family: var(--display); font-weight: 500; font-size: 1.24rem; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.wish-card .from { display: flex; align-items: center; gap: 8px; color: var(--card-muted); font-weight: 800; font-size: 14px; }
.wish-card .label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--berry); font-weight: 800; }
.wish-card .stk { position: absolute; top: -18px; right: 14px; font-size: 42px; transform: rotate(10deg); filter: drop-shadow(0 4px 4px rgba(0,0,0,.2)); }
.wish-card .reply { border-top: 1px dashed #d9cbb6; padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.wish-card .reply textarea { background: #fff; border: 1.5px solid #e4d6c1; }
.wish-card .reply .pill { align-self: flex-end; }
.rise { animation: rise .7s .4s both cubic-bezier(.2,1.2,.4,1); }
@keyframes rise { from { opacity: 0; transform: translateY(40px) scale(.9) } to { opacity: 1; transform: none } }

/* Celebration Modal */
.celeb { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 6px 0; }
.celeb .crest {
  width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; font-size: 56px;
  background: radial-gradient(circle, rgba(246,196,83,.45), rgba(246,196,83,.12));
  border: 3px solid var(--gold); box-shadow: 0 0 36px rgba(246,196,83,.45);
}
.celeb .pill-stat { background: rgba(0,0,0,.2); border-radius: 999px; padding: 6px 14px; font-family: var(--display); font-weight: 600; color: var(--gold); }
.celeb p { margin: 0; font-family: var(--display); font-size: 1.12rem; max-width: 34ch; }

.advent-open { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.advent-open .big-emoji { font-size: 72px; line-height: 1; }
.advent-open p { font-family: var(--display); font-weight: 500; font-size: 1.2rem; margin: 0; max-width: 32ch; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 80; background: var(--card); color: var(--card-ink); padding: 11px 20px; border-radius: 999px; font-family: var(--display); font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: calc(100% - 32px); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .rise, .door[data-state="today"], .shaking { animation: none; }
  .big .lid, .big .bow, .pill { transition: none; }
}
