/* 12 Drams of Christmas */
:root {
  --evergreen: #0f3d2e;
  --pine: #0a2b20;
  --pine-deep: #061c15;
  --cranberry: #b3132b;
  --cranberry-dark: #8c0f22;
  --gold: #d4a84b;
  --gold-soft: #f1dca4;
  --snow: #faf7f2;
  --paper: #fffdf8;
  --amber: #c8781e;
  --ink: #1f1d1a;
  --muted: #6f6a60;
  --line: #e7dfd0;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --display: "Mountains of Christmas", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  color: var(--snow);
  background:
    radial-gradient(1200px 600px at 50% -200px, #1d5a43 0%, transparent 70%),
    radial-gradient(800px 500px at 100% 100%, rgba(179, 19, 43, 0.22), transparent 70%),
    linear-gradient(180deg, var(--evergreen), var(--pine-deep));
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
body.noscroll { overflow: hidden; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
#app { position: relative; z-index: 1; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---------- Snow ---------- */
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
#snow i {
  position: absolute; top: -12px; border-radius: 50%; background: #fff;
  animation: fall linear infinite; filter: blur(0.3px);
}
@keyframes fall {
  0% { transform: translate3d(0, -10px, 0); }
  50% { transform: translate3d(18px, 50vh, 0); }
  100% { transform: translate3d(-10px, 105vh, 0); }
}
.burst { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.burst span { position: absolute; top: -40px; animation: burst 2.6s ease-in forwards; }
@keyframes burst {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0.2; }
}

/* ---------- Type ---------- */
.title {
  font-family: var(--display); font-weight: 700; font-size: 3rem; line-height: 0.95;
  margin: 0; color: var(--gold-soft); text-shadow: 0 2px 0 var(--cranberry-dark), 0 6px 18px rgba(0, 0, 0, 0.4);
}
.title span { display: block; font-size: 0.62em; color: var(--snow); margin-top: 6px; }
.title.sm { font-size: 2.1rem; }
.sub { margin: 8px 0 0; color: rgba(250, 247, 242, 0.8); }
.muted { color: var(--muted); }
.loading { padding: 40vh 16px 0; text-align: center; color: var(--gold-soft); font-family: var(--display); font-size: 1.6rem; }
code { background: rgba(255, 255, 255, 0.12); padding: 1px 6px; border-radius: 6px; }

/* ---------- Top bar + string lights ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(6, 28, 21, 0.86); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding-top: env(safe-area-inset-top); }
.lights { display: flex; justify-content: space-between; padding: 0 10px; height: 14px; position: relative; }
.lights::before { content: ""; position: absolute; left: 0; right: 0; top: 2px; height: 2px; background: #2b2b2b; border-radius: 2px; }
.lights i {
  position: relative; top: 3px; width: 8px; height: 11px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--c, var(--gold)); box-shadow: 0 0 10px 2px var(--c, var(--gold));
  animation: twinkle 1.6s ease-in-out infinite; animation-delay: calc(var(--d, 0) * 1s);
}
.lights i:nth-child(4n + 1) { --c: #ff4757; --d: 0.1; }
.lights i:nth-child(4n + 2) { --c: #ffd166; --d: 0.6; }
.lights i:nth-child(4n + 3) { --c: #2ed573; --d: 0.3; }
.lights i:nth-child(4n + 4) { --c: #6ec6ff; --d: 0.9; }
@keyframes twinkle { 50% { opacity: 0.35; box-shadow: none; } }
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 16px 10px; }
.brand { font-family: var(--display); font-size: 1.6rem; font-weight: 700; color: var(--gold-soft); text-decoration: none; }
.back { text-decoration: none; color: var(--snow); font-weight: 600; padding: 6px 0; }
.who {
  justify-self: end; background: rgba(255, 255, 255, 0.1); color: var(--snow); border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 12px; border-radius: 999px; font-size: 0.9rem;
}

/* ---------- Login ---------- */
.login { max-width: 520px; margin: 0 auto; padding: calc(48px + env(safe-area-inset-top)) 16px 24px; text-align: center; }
.hero-icon { filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.4)); }
.hero .title { font-size: 3.6rem; margin-top: 10px; }
.who-q { margin: 40px 0 6px; font-weight: 600; letter-spacing: 0.02em; }
.ornaments { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; }
.ornament { background: none; border: 0; color: var(--snow); display: flex; flex-direction: column; align-items: center; width: 150px; padding: 0; }
.ornament .cap { width: 26px; height: 14px; background: linear-gradient(90deg, #a07a2a, var(--gold), #a07a2a); border-radius: 4px 4px 2px 2px; position: relative; }
.ornament .cap::before { content: ""; position: absolute; left: 50%; top: -10px; width: 12px; height: 12px; border: 2px solid var(--gold); border-radius: 50%; transform: translateX(-50%); }
.ornament .ball {
  width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--display); font-size: 2rem; font-weight: 700; margin-top: -2px;
  box-shadow: inset -14px -18px 30px rgba(0, 0, 0, 0.35), inset 12px 12px 24px rgba(255, 255, 255, 0.25), var(--shadow);
  transition: transform 0.2s;
}
.ornament.jesse .ball { background: radial-gradient(circle at 35% 30%, #e43a52, var(--cranberry) 55%, #6d0a19); }
.ornament.zack .ball { background: radial-gradient(circle at 35% 30%, #3f9a6d, #19603f 55%, #0a2b20); }
.ornament:not(:disabled):active .ball { transform: scale(0.95) rotate(-4deg); }
@media (hover: hover) { .ornament:not(:disabled):hover .ball { transform: rotate(-6deg); } }
.ornament .hint { margin-top: 10px; font-size: 0.85rem; color: rgba(250, 247, 242, 0.75); }
.ornament:disabled { cursor: not-allowed; }
.ornament:disabled .ball { filter: grayscale(0.85) brightness(0.6); }
.devnote { margin-top: 28px; font-size: 0.85rem; color: var(--gold-soft); }

/* ---------- Home ---------- */
.home, .day, .reveal { max-width: 720px; margin: 0 auto; padding: 20px 16px; }
.intro { text-align: center; margin: 6px 0 18px; }
.banner {
  display: block; text-align: center; padding: 14px 16px; border-radius: var(--radius); margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.08); border: 1px dashed rgba(255, 255, 255, 0.3); text-decoration: none; font-weight: 600;
}
.banner.gold { background: linear-gradient(135deg, var(--gold), #b78a2e); color: var(--pine-deep); border: 0; box-shadow: var(--shadow); }
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (min-width: 600px) { .doors { grid-template-columns: repeat(4, 1fr); } }
.door {
  position: relative; aspect-ratio: 3 / 4; border-radius: 14px; text-decoration: none; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px;
  background: linear-gradient(160deg, var(--cranberry), var(--cranberry-dark));
  border: 2px solid rgba(212, 168, 75, 0.55); box-shadow: var(--shadow); transition: transform 0.15s;
}
/* ribbon */
.door::before, .door::after { content: ""; position: absolute; background: rgba(212, 168, 75, 0.55); }
.door::before { left: 50%; top: 0; bottom: 0; width: 10px; transform: translateX(-50%); }
.door::after { top: 34%; left: 0; right: 0; height: 10px; }
.door > * { position: relative; z-index: 1; }
.door:active { transform: scale(0.97); }
.door-num {
  font-family: var(--display); font-weight: 700; font-size: 2.6rem; line-height: 1; color: var(--snow);
  background: var(--cranberry-dark); border-radius: 50%; width: 58px; height: 58px; display: grid; place-items: center;
  border: 2px solid var(--gold); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.door-date { font-size: 0.8rem; font-weight: 600; background: rgba(0, 0, 0, 0.35); padding: 1px 8px; border-radius: 999px; }
.door-status { font-size: 0.72rem; text-align: center; background: rgba(0, 0, 0, 0.4); padding: 2px 6px; border-radius: 8px; line-height: 1.25; }
.door.waiting { background: linear-gradient(160deg, #1d5a43, var(--evergreen)); }
.door.nudge { animation: wiggle 2.5s ease-in-out infinite; }
.door.revealed { background: linear-gradient(160deg, #e3c06d, #b58a32); }
.door.revealed .door-num { background: var(--evergreen); }
.door.today { outline: 3px solid var(--gold-soft); outline-offset: 3px; box-shadow: 0 0 26px 4px rgba(241, 220, 164, 0.55); }
@keyframes wiggle { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-3deg); } 96% { transform: rotate(3deg); } }
.footnote { text-align: center; font-size: 0.85rem; color: rgba(250, 247, 242, 0.7); margin-top: 22px; }

/* ---------- Cards ---------- */
.card { background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 18px 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-family: var(--display); font-size: 1.8rem; color: var(--cranberry); }
.card.center { text-align: center; }
.card.center .title { color: var(--cranberry); text-shadow: none; }
.center-page { max-width: 480px; margin: 0 auto; padding: 30vh 16px 0; }

/* ---------- Day page ---------- */
.day-head { text-align: center; margin-bottom: 16px; }
.day-badge {
  display: inline-block; background: var(--cranberry); color: var(--snow); border: 2px solid var(--gold);
  border-radius: 999px; padding: 3px 14px; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.04em;
}
.day-head .title { margin-top: 6px; }
.status { margin: 8px 0 0; color: var(--gold-soft); font-weight: 500; }

.field { display: block; margin-bottom: 16px; }
.field > span, .rating-top label { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--cranberry); }
textarea, input[type="number"], select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
textarea { resize: vertical; min-height: 64px; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.3); }
.note { background: #fff6dc; border: 1px solid var(--gold-soft); padding: 8px 12px; border-radius: 10px; font-size: 0.9rem; }
.fine { font-size: 0.82rem; color: var(--muted); text-align: center; margin: 10px 0 0; }

.rating { background: #fbf6ea; border-radius: 14px; padding: 12px; border: 1px solid var(--line); }
.rating-top { display: flex; justify-content: space-between; align-items: center; }
.rating-top label { margin: 0; }
.rating-num { display: flex; align-items: baseline; gap: 4px; }
.rating-num input { width: 76px; text-align: center; font-weight: 700; font-size: 1.3rem; padding: 6px; color: var(--cranberry); }
.rating-num small { color: var(--muted); }
input[type="range"] { width: 100%; margin: 12px 0 4px; accent-color: var(--cranberry); height: 28px; }
.rating.unset input[type="range"] { opacity: 0.45; }
.rating-label { text-align: center; font-family: var(--display); font-weight: 700; font-size: 1.35rem; color: var(--evergreen); }
.rating.unset .rating-label { color: var(--muted); font-family: var(--body); font-weight: 500; font-size: 0.95rem; }

.pick {
  width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; gap: 2px; color: var(--ink); min-height: 52px;
}
.pick b { font-size: 1rem; }
.pick small { color: var(--muted); }
.pick.empty { border-style: dashed; color: var(--muted); justify-content: center; }
.linkish { background: none; border: 0; color: var(--cranberry); font-size: 0.8rem; text-decoration: underline; padding: 0; margin-left: auto; }

.actions { display: flex; gap: 10px; margin-top: 6px; }
.btn { flex: 1; border-radius: 14px; padding: 14px; font-weight: 700; font-size: 1rem; border: 2px solid transparent; }
.btn.primary { background: var(--cranberry); color: var(--snow); border-color: var(--gold); box-shadow: 0 6px 14px rgba(179, 19, 43, 0.35); }
.btn.ghost { background: #fff; color: var(--evergreen); border-color: var(--evergreen); }
.btn:disabled { opacity: 0.6; }

/* Reveal side-by-side */
.reveal-card { border: 3px solid var(--gold); }
.pcols { display: grid; gap: 12px; }
@media (min-width: 560px) { .pcols { grid-template-columns: 1fr 1fr; } }
.pcol { border-radius: 14px; padding: 12px; }
.pcol.me { background: #fdeef0; }
.pcol.them { background: #eaf5ef; }
.pcol-head { display: flex; justify-content: space-between; align-items: center; }
.score { font-weight: 800; font-size: 1.4rem; color: var(--cranberry); }
.score small { font-size: 0.7rem; color: var(--muted); font-weight: 500; }
.pcol dl { margin: 8px 0 0; }
.pcol dt { font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-top: 8px; }
.pcol dd { margin: 2px 0 0; white-space: pre-wrap; }
.tag { display: inline-block; font-size: 0.75rem; background: #fff3c4; color: #7a5a00; padding: 2px 8px; border-radius: 999px; margin-top: 4px; }

/* ---------- FAB + Drawer ---------- */
.fabs {
  position: fixed; right: 16px; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; justify-content: flex-end; gap: 10px; pointer-events: none;
}
.fab {
  pointer-events: auto;
  background: linear-gradient(135deg, var(--gold), #b78a2e); color: var(--pine-deep); border: 2px solid var(--gold-soft);
  padding: 14px 16px; border-radius: 999px; font-weight: 800; box-shadow: var(--shadow); white-space: nowrap;
}
.fab.alt { background: linear-gradient(135deg, var(--cranberry), var(--cranberry-dark)); color: var(--snow); border-color: var(--gold); }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.25s; z-index: 40; }
.backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 86vh; max-width: 720px; margin: 0 auto;
  background: var(--snow); color: var(--ink); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
  display: flex; flex-direction: column; transform: translateY(105%); transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.drawer.open { transform: translateY(0); }
.grip { width: 44px; height: 5px; background: #cfc6b4; border-radius: 3px; margin: 8px auto 0; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 0; }
.drawer-head h2 { margin: 0; font-family: var(--display); color: var(--cranberry); font-size: 1.7rem; }
.drawer-head small { font-family: var(--body); font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.x { background: #eee6d6; border: 0; width: 36px; height: 36px; border-radius: 50%; font-size: 1rem; }
.drawer-tools { display: flex; gap: 8px; padding: 10px 16px; align-items: center; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: #fff; color: var(--ink); padding: 6px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; }
.chip.on { background: var(--evergreen); color: var(--snow); border-color: var(--evergreen); }
.drawer-tools select { width: auto; flex: none; padding: 6px 8px; font-size: 14px; }
.wlist { overflow-y: auto; padding: 12px 16px 20px; display: grid; gap: 10px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.wcard { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; }
.wcard.picked { border-color: var(--cranberry); box-shadow: 0 0 0 2px rgba(179, 19, 43, 0.15); }
.wcard.used:not(.picked) { opacity: 0.6; }
.wtop { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.wtop h3 { margin: 0; font-size: 1.02rem; }
.type { flex: none; font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #eee; color: #333; }
.t-bourbon { background: #f7e1c4; color: #7a4310; }
.t-rye { background: #f3d4d4; color: #7d1d1d; }
.t-scotch { background: #d9e8d9; color: #1d4d2a; }
.t-irish { background: #d3f0dc; color: #0d5c2c; }
.t-american { background: #dbe4f5; color: #1e3a73; }
.t-japanese { background: #f6dbe6; color: #7a1f47; }
.t-canadian { background: #fde1dc; color: #8b2a1a; }
.wmeta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wmeta span { font-size: 0.8rem; background: #f4efe4; padding: 2px 8px; border-radius: 8px; color: #4b463d; }
.wline { font-size: 0.85rem; color: #4b463d; margin-top: 5px; }
.wnotes { font-size: 0.85rem; color: var(--muted); margin: 6px 0 0; font-style: italic; }
.marks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.marks span { font-size: 0.75rem; background: #fff3c4; color: #7a5a00; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.wbtns { display: flex; gap: 8px; margin-top: 10px; }
.wbtns button { flex: 1; border: 1.5px solid var(--line); background: #faf7f2; color: var(--ink); border-radius: 10px; padding: 10px 6px; font-weight: 700; font-size: 0.9rem; }
.wbtns button.focus { border-color: var(--gold); }
.wbtns button.on { background: var(--cranberry); color: #fff; border-color: var(--cranberry); }
.empty-list { text-align: center; color: var(--muted); }

/* ---------- Flavor wheel ---------- */
.wheel-body { overflow-y: auto; padding: 10px 16px 20px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); background: #eee6d6; border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; color: var(--ink); padding: 8px 2px; border-radius: 9px; font-weight: 600; font-size: 0.82rem; }
.seg button.on { background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); color: var(--cranberry); }
.wheel-preview {
  margin: 8px 2px 0; font-size: 0.85rem; color: #4b463d;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
#wheel-svg { display: block; width: min(320px, 84vw); height: auto; margin: 6px auto 4px; overflow: visible; }
.wseg { cursor: pointer; transition: transform 0.2s, opacity 0.2s; outline: none; }
.wseg path { stroke: var(--snow); stroke-width: 2.5; }
.wseg.dim { opacity: 0.45; }
.wseg.on path { stroke: var(--gold); stroke-width: 4; }
.wseg:focus-visible path { stroke: var(--ink); stroke-width: 4; }
.wicon { font-size: 17px; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.wlabel { font: 700 10.5px var(--body); fill: #fff; text-anchor: middle; dominant-baseline: middle; pointer-events: none; paint-order: stroke; stroke: rgba(0, 0, 0, 0.35); stroke-width: 2px; }
.whub { fill: var(--paper); stroke: var(--gold); stroke-width: 3; }
.whub-t { font: 700 12px var(--body); fill: var(--cranberry); text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.whub-t.sm { font-size: 10px; fill: var(--muted); font-weight: 500; }
.wheel-notes h3 { margin: 6px 0 8px; font-size: 1rem; color: var(--c); }
.note-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.note-chip {
  border: 1.5px solid var(--c); background: #fff; color: var(--ink); padding: 8px 12px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; text-transform: capitalize;
}
.note-chip.on { background: var(--c); color: #fff; }
.center-text { text-align: center; font-size: 0.9rem; }

/* ---------- Grand Reveal ---------- */
.summary h3 { margin: 0 0 6px; color: var(--evergreen); font-size: 1rem; }
.summary ol { margin: 0 0 12px; padding-left: 20px; }
.summary li { margin-bottom: 4px; }
.summary p { margin: 6px 0; }
.sum-grid { display: grid; gap: 8px; }
@media (min-width: 560px) { .sum-grid { grid-template-columns: 1fr 1fr; } }
.rv-head { display: flex; align-items: center; gap: 10px; }
.rv-day h3 { margin: 10px 0 2px; font-size: 1.25rem; color: var(--cranberry); }
.rv-day > p { margin: 0 0 10px; font-size: 0.9rem; }
.rv-people { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rv-p { background: #f6f1e6; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.rv-p b { display: flex; justify-content: space-between; align-items: center; }
.rv-p .score { font-size: 1.1rem; }
.decoys { margin: 0; padding-left: 20px; }
.decoys li { margin-bottom: 6px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--evergreen); color: var(--snow); border: 2px solid var(--gold); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 70;
  max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--cranberry); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
