/* Colours come from the current month — see THEMES in app.js. These are November's. */
:root {
  --accent: #7a4a2b;
  --on-accent: #f6efe6;
  --pop: #d9a441;
  --on-pop: #1c120b;
  --paper: #f3ebe1;
  --card: #fbf7f1;
  --ink: #1c120b;
  --muted: color-mix(in srgb, var(--ink) 62%, var(--paper));
  --good: #2f8f5b;
  --bad: #d23a2f;
  --line: 2px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'Space Mono', ui-monospace, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--paper); color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* paper grain */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .22; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1; margin: 0 0 .35em; letter-spacing: -.01em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: var(--line); background: var(--card); color: var(--ink); border-radius: 0;
  padding: .75em 1.4em; cursor: pointer; text-decoration: none;
  font-family: var(--mono); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem;
  box-shadow: 4px 4px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: 4px 4px 0 var(--ink); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.pop { background: var(--pop); color: var(--on-pop); }
.btn.big { font-size: 1rem; padding: 1em 2em; }
.btn.ghost { box-shadow: none; background: transparent; }

/* ---------- mid-century shapes ---------- */
.shapes { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.shapes i { position: absolute; display: block; }
.shapes .sun { width: 70vmin; height: 70vmin; border-radius: 50%; background: var(--accent); top: -22vmin; right: -18vmin; }
.shapes .arch { width: 46vmin; height: 23vmin; border-radius: 46vmin 46vmin 0 0; background: var(--pop); bottom: 0; left: -6vmin; }
.shapes .bar { width: 5vmin; height: 60vmin; background: var(--ink); bottom: -10vmin; right: 14vmin; transform: rotate(18deg); }
.shapes .dot { width: 9vmin; height: 9vmin; border-radius: 50%; border: var(--line); top: 18vmin; left: 10vmin; }

/* ---------- opening video ---------- */
.intro {
  position: fixed; inset: 0; z-index: 40; background: var(--accent); color: var(--on-accent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  padding: 24px 16px calc(24px + var(--safe-b)); overflow: hidden; transition: opacity .6s;
}
.intro.leaving { opacity: 0; }
.intro::before { content: ''; position: absolute; width: 120vmax; height: 120vmax; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--on-accent) 35%, transparent); top: 50%; left: 50%; transform: translate(-50%, -50%); }
.intro-frame {
  position: relative; height: min(58vh, 125vw); aspect-ratio: 3 / 4; border-radius: 999px 999px 0 0; overflow: hidden;
  border: 3px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); background: var(--ink);
  animation: rise .8s cubic-bezier(.2,.7,.2,1) both;
}
.intro-frame video { width: 100%; height: 100%; object-fit: cover; border: 0; display: block; }
.intro-title { position: relative; z-index: 2; margin: -9vh 0 0; text-align: center; line-height: .9; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.intro-title span { display: inline-block; animation: slamIn .55s cubic-bezier(.2,1.6,.4,1) both; }
.intro-title span:nth-child(1) { font-family: var(--sans); font-weight: 700; text-transform: uppercase; font-size: clamp(2.6rem, 14vw, 5.5rem); background: var(--pop); color: var(--on-pop); border: 3px solid var(--ink); padding: 0 .18em .04em; transform: rotate(-4deg); box-shadow: 6px 6px 0 var(--ink); animation-delay: .5s; }
.intro-title span:nth-child(2) { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(4rem, 23vw, 9.5rem); color: var(--on-accent); text-shadow: 4px 4px 0 var(--ink); margin: -.06em 0 -.12em; animation-delay: .8s; }
.intro-title span:nth-child(3) { font-family: var(--sans); font-weight: 700; text-transform: uppercase; font-size: clamp(2.2rem, 12vw, 4.6rem); background: var(--paper); color: var(--ink); border: 3px solid var(--ink); padding: 0 .2em .04em; transform: rotate(3deg); box-shadow: 6px 6px 0 var(--ink); animation-delay: 1.1s; }
@keyframes slamIn { from { opacity: 0; scale: 2.6; } to { opacity: 1; scale: 1; } }
.intro-actions { position: relative; z-index: 2; display: flex; gap: 12px; margin-top: 26px; animation: rise .6s 1.6s both; }
.intro .btn.ghost { color: var(--on-accent); border-color: var(--on-accent); }

/* ---------- fireworks & opening song ---------- */
.fw { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.intro > *:not(.fw) { position: relative; z-index: 3; }
.intro > .intro-frame { z-index: 1; }
.intro > .fw { z-index: 2; }
#lock { position: relative; overflow: hidden; }
#lock .lock-card { position: relative; z-index: 1; }
#fw-top { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 79; }
.intro-music {
  position: fixed; left: 50%; bottom: calc(12px + var(--safe-b)); transform: translateX(-50%); z-index: 45;
  width: min(360px, calc(100% - 24px)); background: var(--card); border: var(--line); box-shadow: 4px 4px 0 var(--ink); padding: 6px 6px 4px;
}
.im-label { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .65rem; text-transform: uppercase; letter-spacing: .12em; padding: 2px 4px 6px; }
.im-eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 10px; }
.im-eq i { width: 3px; height: 3px; background: var(--accent); }
.intro-music.on .im-eq i { animation: eq .8s ease-in-out infinite; }
.intro-music.on .im-eq i:nth-child(2) { animation-delay: .2s; } .intro-music.on .im-eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 50% { height: 10px; } }
#intro-embed, .intro-music iframe { display: block; width: 100%; border: 0; border-radius: 10px; }
.intro .intro-actions { margin-bottom: 100px; }
@media (max-height: 760px) { .intro-frame { height: min(46vh, 110vw); } }

/* ---------- lock & reveal ---------- */
.screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; text-align: center; position: relative; }
.lock-card { width: 100%; max-width: 380px; background: var(--card); border: var(--line); box-shadow: var(--shadow); padding: 34px 26px 26px; }
.lock-card h1 { font-size: 3rem; font-style: italic; }
.stamp { display: inline-block; font-family: var(--mono); text-transform: uppercase; letter-spacing: .2em; font-size: .72rem; border: var(--line); padding: .35em .9em; border-radius: 99px; background: var(--paper); }
.hint { color: var(--muted); font-style: italic; min-height: 1.5em; margin: .2em 0 0; }
#lock-form { display: grid; gap: 14px; margin-top: 18px; }
#pw { font: inherit; font-family: var(--mono); font-size: 1.05rem; text-align: center; color: var(--ink); background: var(--paper); border: var(--line); border-radius: 0; padding: .9em 1em; }
#pw:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
.remember { color: var(--muted); font-size: .85rem; display: flex; gap: .5em; align-items: center; justify-content: center; }
.remember input { accent-color: var(--accent); }
.error { color: var(--bad); min-height: 1.5em; margin: 0; font-family: var(--mono); font-size: .85rem; }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-8px) } 75% { transform: translateX(8px) } }

.reveal-inner { max-width: 620px; width: 100%; }
.reveal-inner > * { opacity: 0; animation: rise .9s cubic-bezier(.2,.7,.2,1) forwards; }
.reveal-inner > *:nth-child(2) { animation-delay: .2s; }
.reveal-inner > *:nth-child(3) { animation-delay: .55s; }
.reveal-inner > *:nth-child(4) { animation-delay: 1s; }
.reveal-inner > *:nth-child(5) { animation-delay: 1.5s; }
.reveal-inner > *:nth-child(6) { animation-delay: 1.8s; }
@keyframes rise { from { opacity: 0; transform: translateY(22px) } to { opacity: 1; transform: none } }
.reveal-name { font-size: clamp(7rem, 42vw, 15rem); font-style: italic; line-height: .85; margin: .08em 0 .12em; color: var(--ink); }
.reveal-name span { display: inline-block; animation: bob 4s ease-in-out infinite; }
.reveal-name span:nth-child(2) { animation-delay: .25s; color: var(--accent); }
.reveal-name span:nth-child(3) { animation-delay: .5s; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg) } }
.reveal-msg { font-family: var(--serif); font-size: clamp(1.35rem, 5vw, 1.85rem); line-height: 1.25; background: var(--card); border: var(--line); box-shadow: var(--shadow); padding: 22px 24px; text-align: left; margin: 0 0 22px; }
.stats { font-family: var(--mono); text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; margin: 0 0 22px; }
.from { font-family: var(--serif); font-style: italic; font-size: 1.3rem; margin-top: 18px; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; background: var(--paper); border-bottom: var(--line);
}
.brand { background: none; border: 0; font-family: var(--serif); font-style: italic; font-size: 1.6rem; cursor: pointer; padding: 0; line-height: 1; }
.tabs { display: flex; gap: 6px; }
.tabs a { text-decoration: none; padding: 7px 12px; font-family: var(--mono); text-transform: uppercase; font-size: .75rem; letter-spacing: .08em; border: 2px solid transparent; display: flex; gap: 6px; align-items: center; }
.tabs a span { font-size: 1rem; line-height: 1; }
.tabs a.active { background: var(--accent); color: var(--on-accent); border-color: var(--ink); }
main { max-width: 900px; margin: 0 auto; padding: 30px 16px calc(120px + var(--safe-b)); }

@media (max-width: 700px) {
  .topbar { justify-content: center; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; justify-content: space-around; gap: 0;
    background: var(--paper); border-top: var(--line); padding: 6px 2px calc(6px + var(--safe-b));
  }
  .tabs a { flex-direction: column; gap: 3px; font-size: .62rem; padding: 6px 4px; flex: 1; }
  .tabs a span { font-size: 1.25rem; }
  .mini { bottom: calc(74px + var(--safe-b)) !important; }
  main { padding-bottom: calc(180px + var(--safe-b)); }
}

.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: clamp(2.6rem, 10vw, 4.4rem); }
.page-head h1 em { color: var(--accent); }
.page-head p { color: var(--muted); margin: 0; max-width: 34em; }
.card { background: var(--card); border: var(--line); box-shadow: var(--shadow); padding: 20px; }
.stack > * + * { margin-top: 22px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- avatars & images ---------- */
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; background: var(--pop); color: var(--on-pop); display: grid; place-items: center; font-family: var(--serif); font-style: italic; font-size: 1.6rem; border: var(--line); }
.avatar.xl { width: 128px; height: 128px; font-size: 4rem; box-shadow: 5px 5px 0 var(--ink); }
.avatar.sm { width: 34px; height: 34px; font-size: 1rem; border-width: 1.5px; }
img.loading { background: repeating-linear-gradient(45deg, var(--paper) 0 8px, var(--card) 8px 16px); }

/* ---------- friends ---------- */
.friend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; }
.friend-tile { background: var(--card); border: var(--line); box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; text-align: left; transition: transform .1s, box-shadow .1s; padding: 0; }
.friend-tile:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.friend-tile .ph { aspect-ratio: 1; width: 100%; object-fit: cover; display: grid; place-items: center; border-bottom: var(--line); background: var(--pop); color: var(--on-pop); font-family: var(--serif); font-style: italic; font-size: 4.5rem; }
.friend-tile:nth-child(3n+2) .ph:not(img) { background: var(--accent); color: var(--on-accent); }
.friend-tile:nth-child(3n) .ph:not(img) { background: var(--ink); color: var(--paper); }
.friend-tile .meta { padding: 10px 12px 12px; }
.friend-tile .num { font-family: var(--mono); font-size: .7rem; color: var(--muted); }
.friend-tile .name { font-family: var(--serif); font-size: 1.8rem; line-height: 1; }
.friend-tile .counts { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 6px; }

.back { font-family: var(--mono); text-transform: uppercase; font-size: .78rem; letter-spacing: .08em; text-decoration: none; display: inline-block; margin-bottom: 18px; border-bottom: var(--line); }
.friend-hero { display: flex; gap: 20px; align-items: center; margin-bottom: 24px; }
.friend-hero h1 { font-size: clamp(3.2rem, 13vw, 5.5rem); font-style: italic; margin: 0; }
.greeting { font-family: var(--serif); font-size: 1.45rem; line-height: 1.3; white-space: pre-line; }
.section-title { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; margin: 34px 0 14px; }
.section-title::after { content: ''; flex: 1; border-top: var(--line); }

.vn { display: flex; align-items: center; gap: 14px; background: var(--card); border: var(--line); box-shadow: 4px 4px 0 var(--ink); padding: 8px 18px 8px 8px; cursor: pointer; width: 100%; text-align: left; font-family: var(--serif); font-size: 1.3rem; }
.vn + .vn { margin-top: 12px; }
.vn.playing { background: var(--pop); color: var(--on-pop); }
.play-dot { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--on-accent); border: var(--line); display: grid; place-items: center; font-size: 1rem; flex: none; font-family: var(--sans); }

.photos { columns: 3 160px; column-gap: 12px; }
.photos img { width: 100%; display: block; margin-bottom: 12px; border: var(--line); cursor: zoom-in; break-inside: avoid; }
.photos img:nth-child(odd) { transform: rotate(-.6deg); }
.photos img:nth-child(even) { transform: rotate(.7deg); }
video { width: 100%; display: block; border: var(--line); background: #000; }
.video-ph { aspect-ratio: 16/9; background: var(--ink); color: var(--paper); display: grid; place-items: center; cursor: pointer; border: var(--line); font-family: var(--mono); text-transform: uppercase; letter-spacing: .1em; }

.embed { width: 100%; border: 0; border-radius: 12px; display: block; }
.song + .song { margin-top: 12px; }
.song-note { font-family: var(--serif); font-style: italic; font-size: 1.15rem; margin: 6px 4px 0; }
.locked { text-align: center; }
.locked p { margin: 0 0 16px; font-family: var(--serif); font-size: 1.35rem; line-height: 1.25; }

/* ---------- listen ---------- */
.now { text-align: center; padding: 26px 18px 28px; }
.now .art { width: min(270px, 66vw); aspect-ratio: 1; object-fit: cover; margin: 0 auto 20px; display: grid; place-items: center; background: var(--pop); color: var(--on-pop); font-family: var(--serif); font-style: italic; font-size: 7rem; border: var(--line); border-radius: 50%; box-shadow: var(--shadow); }
.now.spin .art { animation: record 8s linear infinite; }
@keyframes record { to { transform: rotate(360deg) } }
.now h2 { font-size: 2.4rem; font-style: italic; margin-bottom: 4px; }
.now .sub { margin: 0 0 16px; }
.progress { width: 100%; accent-color: var(--accent); margin: 6px 0 2px; }
.times { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .75rem; }
.controls { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 14px; }
.ctrl { width: 56px; height: 56px; border-radius: 50%; border: var(--line); background: var(--card); cursor: pointer; font-size: 1.15rem; box-shadow: 3px 3px 0 var(--ink); }
.ctrl:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.ctrl:disabled { opacity: .35; }
.ctrl.main { width: 80px; height: 80px; font-size: 1.7rem; background: var(--accent); color: var(--on-accent); }
.queue { list-style: none; padding: 0; margin: 0; }
.queue li { display: flex; align-items: center; gap: 12px; padding: 9px 8px; cursor: pointer; border-bottom: 1px dashed color-mix(in srgb, var(--ink) 30%, transparent); font-family: var(--serif); font-size: 1.25rem; }
.queue li:last-child { border-bottom: 0; }
.queue li.current { background: var(--pop); color: var(--on-pop); }
.queue .num { width: 26px; text-align: right; font-family: var(--mono); font-size: .75rem; }
.tip { background: var(--paper); border-style: dashed; box-shadow: none; }

.mini {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--safe-b)); z-index: 15;
  width: min(560px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--paper); border: var(--line); padding: 7px 8px 7px 7px; box-shadow: 5px 5px 0 var(--accent);
}
.mini .info { flex: 1; min-width: 0; cursor: pointer; }
.mini .info div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--serif); font-size: 1.2rem; line-height: 1.1; }
.mini .info small { font-family: var(--mono); font-size: .68rem; opacity: .7; }
.mini button.ctrl { width: 42px; height: 42px; font-size: .95rem; box-shadow: none; border-color: var(--paper); background: transparent; color: var(--paper); }
.mini .avatar { border-color: var(--paper); }

/* ---------- songs & spotify ---------- */
.btn.small { padding: .55em 1em; font-size: .72rem; box-shadow: 3px 3px 0 var(--ink); }
.btn.ghost.small { box-shadow: none; }
.song-card { background: var(--card); border: var(--line); box-shadow: 4px 4px 0 var(--ink); padding: 12px; }
.song-row { display: flex; gap: 14px; align-items: center; }
.song-art { width: 64px; height: 64px; object-fit: cover; flex: none; border: var(--line); background: var(--pop); display: grid; place-items: center; font-size: 1.6rem; color: var(--on-pop); }
.song-text { min-width: 0; flex: 1; text-align: left; }
.song-title { font-family: var(--serif); font-size: 1.45rem; line-height: 1.05; }
.song-artist { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 4px; }
.song-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; justify-content: inherit; }
.quiz-card .song-actions { justify-content: center; }
.sp-card { background: var(--paper); box-shadow: 4px 4px 0 var(--ink); }
.sp-card.on { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.sp-lead { font-family: var(--serif); font-size: 1.35rem; line-height: 1.2; margin: 0 0 12px; }
.sp-card.on .sp-lead { margin: 0; font-size: 1.15rem; }
.sp-card.on .sp-lead::first-letter { color: #1db954; }
.fine { font-family: var(--sans); font-size: .8rem; color: var(--muted); margin: 12px 0 0; line-height: 1.4; }
.sp-card.on .fine { margin: 0; }
.now .stamp { margin-bottom: 10px; }
.now.song .art { border-radius: 0; animation: none; }
.now .msg { background: var(--pop); color: var(--on-pop); border: var(--line); padding: 10px 12px; margin: 0 0 14px; font-weight: 500; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.queue-scroll { max-height: 420px; overflow-y: auto; margin: 0 -8px; padding: 0 8px; }
.queue li.song { font-size: 1.05rem; }
.queue li.song .avatar { border-radius: 0; }
.queue .q-text { display: flex; flex-direction: column; min-width: 0; }
.queue .q-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue .q-text small { font-family: var(--mono); font-size: .65rem; text-transform: uppercase; letter-spacing: .05em; opacity: .7; }
.queue li.voice .q-text span { font-style: italic; }
.mini img.avatar, .mini .avatar { flex: none; }

/* ---------- map (town) ---------- */
.row-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.row-head h1 { margin: 0; }
.seg { display: inline-flex; border: var(--line); box-shadow: 3px 3px 0 var(--ink); background: var(--card); }
.seg button { border: 0; background: none; padding: .55em 1em; font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; cursor: pointer; }
.seg button + button { border-left: var(--line); }
.seg button.on { background: var(--accent); color: var(--on-accent); }
#view.wide { max-width: 1100px; }
#view.wide .page-head { margin-bottom: 14px; }
#view.wide .page-head h1 { font-size: clamp(2.2rem, 9vw, 3.6rem); }
.town {
  position: relative; width: 100%; height: clamp(420px, calc(100dvh - 270px), 820px);
  border: var(--line); box-shadow: var(--shadow); background: var(--ink); overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
@media (max-width: 700px) { .town { height: calc(100dvh - 250px - var(--safe-b)); min-height: 380px; margin: 0 -6px; width: calc(100% + 12px); } }
.town-canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; cursor: pointer; }
.town.entering::after { content: ''; position: absolute; inset: 0; background: var(--ink); animation: doorFade .42s ease-in forwards; }
@keyframes doorFade { from { clip-path: circle(0% at 50% 55%); } to { clip-path: circle(80% at 50% 55%); } }
.town-btn { position: absolute; top: 10px; right: 10px; z-index: 2; border: var(--line); background: var(--card); box-shadow: 3px 3px 0 var(--ink); font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; padding: .5em .8em; cursor: pointer; }
.dpad { position: absolute; left: 10px; bottom: 10px; z-index: 2; width: 120px; height: 120px; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); opacity: .92; }
.dpad .dp { border: var(--line); background: var(--card); color: var(--ink); font-size: .85rem; cursor: pointer; touch-action: none; box-shadow: 2px 2px 0 var(--ink); }
.dpad .dp:active { background: var(--pop); }
.dpad .up { grid-area: 1 / 2; } .dpad .left { grid-area: 2 / 1; } .dpad .right { grid-area: 2 / 3; } .dpad .down { grid-area: 3 / 2; }
@media (hover: hover) and (pointer: fine) { .dpad { opacity: .75; } }
.town-box {
  position: absolute; left: 140px; right: 10px; bottom: 10px; z-index: 3; background: var(--card); border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; cursor: pointer;
}
@media (max-width: 520px) { .town-box { left: 10px; bottom: 140px; } }
.tb-title { font-family: var(--serif); font-size: 1.6rem; line-height: 1; }
.tb-sub { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tb-say { font-family: var(--mono); font-size: .9rem; line-height: 1.45; min-height: 2.9em; }
.tb-more { align-self: flex-end; font-family: var(--mono); font-size: .65rem; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.town-quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 18px; }
.chip-mini { border: 1.5px solid var(--ink); background: var(--card); border-radius: 99px; padding: .25em .75em; font: inherit; font-size: .8rem; cursor: pointer; }
.chip-mini:hover { background: var(--pop); color: var(--on-pop); }

/* ---------- quiz ---------- */
.quiz-card { text-align: center; }
.quiz-art { width: 170px; height: 170px; object-fit: cover; margin: 6px auto 16px; display: block; border: var(--line); box-shadow: 5px 5px 0 var(--ink); }
.quiz-card h2 { font-size: 2.2rem; font-style: italic; margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 22px 0; }
.chip { display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border-radius: 99px; border: var(--line); background: var(--card); cursor: pointer; font-weight: 500; }
.chip.selected { background: var(--pop); color: var(--on-pop); box-shadow: 3px 3px 0 var(--ink); }
.chip.right { background: var(--good); color: #fff; }
.chip.wrong { background: var(--bad); color: #fff; text-decoration: line-through; }
.chip.missed { border-style: dashed; border-color: var(--good); color: var(--good); }
.verdict { font-family: var(--serif); font-style: italic; font-size: 2rem; margin: 6px 0; }
.score-big { font-family: var(--serif); font-style: italic; font-size: 6rem; color: var(--accent); line-height: 1; margin: 6px 0; }
.who { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; margin: 6px 4px 0; }

/* ---------- wheel ---------- */
.wheel-wrap { position: relative; width: min(440px, 100%); margin: 8px auto 0; aspect-ratio: 1; }
.wheel-wrap.shake { animation: wshake .6s; }
@keyframes wshake { 20% { transform: rotate(-4deg) } 40% { transform: rotate(4deg) } 60% { transform: rotate(-3deg) } 80% { transform: rotate(2deg) } }
.wheel-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; }
.wheel text { font-family: var(--sans); font-weight: 600; }
.seg-drop { transition: transform 1.4s cubic-bezier(.5,0,.8,.3), opacity 1.4s; }
.pointer { position: absolute; left: 50%; top: -14px; transform: translateX(-50%); width: 0; height: 0; border-left: 18px solid transparent; border-right: 18px solid transparent; border-top: 34px solid var(--ink); z-index: 2; filter: drop-shadow(3px 3px 0 var(--accent)); transform-origin: 50% 0; }
.pointer.tick { animation: tick .12s; }
@keyframes tick { 50% { transform: translateX(-50%) rotate(-14deg) } }
.wheel-actions { text-align: center; margin-top: 26px; }
.spin-count { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; margin-top: 14px; }

.result { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, var(--ink) 55%, transparent); }
.result .card { max-width: 420px; width: 100%; text-align: center; transform: rotate(-2deg); animation: slam .45s cubic-bezier(.2,1.6,.4,1); padding: 30px 24px; }
@keyframes slam { from { transform: scale(2.2) rotate(-12deg); opacity: 0 } to { transform: scale(1) rotate(-2deg); opacity: 1 } }
.result .prize { font-family: var(--serif); font-style: italic; font-size: clamp(2.4rem, 11vw, 3.6rem); line-height: 1; margin: 10px 0 18px; }
.gotcha { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; pointer-events: none; }
.gotcha div {
  font-family: var(--mono); font-weight: 700; text-transform: uppercase; font-size: clamp(2.2rem, 12vw, 5rem); line-height: .95; text-align: center;
  color: var(--bad); border: 8px solid var(--bad); padding: 14px 22px; background: color-mix(in srgb, var(--card) 85%, transparent);
  transform: rotate(-12deg); animation: stamp .5s cubic-bezier(.2,1.8,.4,1) both;
}
.gotcha small { display: block; font-size: .32em; letter-spacing: .1em; margin-top: 10px; }
@keyframes stamp { from { transform: scale(4) rotate(-30deg); opacity: 0 } to { transform: scale(1) rotate(-12deg); opacity: 1 } }
.won { text-align: center; }
.won .prize { font-family: var(--serif); font-style: italic; font-size: clamp(2.6rem, 12vw, 4rem); line-height: 1; margin: 8px 0 12px; color: var(--accent); }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--ink) 92%, transparent); display: grid; place-items: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 86vh; border: 3px solid var(--paper); }
.lightbox .lb-close { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 14px; background: none; border: 0; font-size: 2.2rem; color: var(--paper); cursor: pointer; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: var(--paper); border: var(--line); color: var(--ink); font-size: 1.6rem; width: 46px; height: 46px; cursor: pointer; border-radius: 50%; }
.lightbox .lb-prev { left: 10px; } .lightbox .lb-next { right: 10px; }

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

/* ---------- opening gate (connect to Spotify, then one tap starts everything) ---------- */
.intro-gate { display: none; }
.intro.gated > .intro-gate { display: flex; flex-direction: column; align-items: center; gap: 18px; position: absolute; inset: 0; justify-content: center; z-index: 5; background: var(--accent); }
.intro.gated > .intro-gate .stamp { background: var(--paper); color: var(--ink); }
.intro.gated > .intro-gate .btn { font-size: 1.1rem; padding: 1.1em 2.2em; animation: pulse 1.6s ease-in-out infinite; }
.intro.gated > .intro-gate .btn:disabled { animation: none; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.gate-status { color: var(--on-accent); opacity: .85; }
.intro.gated > *:not(.intro-gate):not(.fw) { visibility: hidden; }
.intro-music.sdk #intro-embed { display: none; }
.intro-music.sdk { padding-bottom: 6px; }

/* ---------- map extras ---------- */
.town-btn.bike { right: auto; left: 10px; }
.town-btn:disabled { opacity: .5; }
.town-toast {
  position: absolute; top: 54px; left: 50%; transform: translate(-50%, -12px); z-index: 4; opacity: 0; pointer-events: none;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); padding: 8px 16px; text-align: center; transition: opacity .3s, transform .3s; max-width: calc(100% - 24px);
}
.town-toast.show { opacity: 1; transform: translate(-50%, 0); }
.tt-title { font-family: var(--mono); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; font-size: .9rem; }
.town-toast.region .tt-title::before { content: 'Welcome to '; font-weight: 400; letter-spacing: .06em; font-size: .7rem; display: block; color: var(--muted); }
.tt-sub { font-family: var(--serif); font-style: italic; font-size: 1.05rem; line-height: 1.2; }
.tb-sign { font-family: var(--mono); font-weight: 700; font-size: .85rem; line-height: 1.6; }
.town-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 6; transition: opacity .35s; }
.town.flash .town-flash { opacity: 1; }

/* ---------- colour question on the video screen ---------- */
.intro { overflow-y: auto; justify-content: flex-start; padding-top: max(24px, 4vh); }
.intro-frame { height: min(46vh, 112vw); }
.intro-below { position: relative; z-index: 3; width: min(440px, 100%); margin: 26px auto 110px; animation: rise .6s 1.4s both; }
.intro-lock { background: var(--card); color: var(--ink); border: var(--line); box-shadow: 6px 6px 0 var(--ink); padding: 18px 18px 14px; text-align: center; }
.intro-q { display: block; font-family: var(--serif); font-style: italic; font-size: clamp(1.7rem, 7vw, 2.2rem); line-height: 1.05; margin-bottom: 14px; }
.intro-row { display: flex; gap: 10px; }
.intro-row #pw { flex: 1; min-width: 0; }
.intro-row .btn { flex: none; }
.intro-lock .error { margin-top: 10px; }
.intro-lock .remember { margin-top: 4px; font-size: .78rem; }
.intro.leaving { opacity: 0; transition: opacity .7s; }

/* ---------- the present ---------- */
.gift-box { position: relative; display: block; width: 150px; height: 150px; margin: 6px auto 26px; border: 0; background: none; padding: 0; cursor: pointer; animation: giftWiggle 2.6s ease-in-out infinite; }
@keyframes giftWiggle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-6deg); } 80% { transform: rotate(6deg); } 85% { transform: rotate(-4deg); } 90% { transform: rotate(3deg); } }
.gb-body { position: absolute; left: 12px; right: 12px; bottom: 0; height: 96px; background: var(--accent); border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.gb-body::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 22px; transform: translateX(-50%); background: var(--pop); border-left: 3px solid var(--ink); border-right: 3px solid var(--ink); }
.gb-lid { position: absolute; left: 2px; right: 2px; top: 30px; height: 30px; background: var(--accent); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); transform-origin: 20% 100%; z-index: 2; }
.gb-lid::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 22px; transform: translateX(-50%); background: var(--pop); border-left: 3px solid var(--ink); border-right: 3px solid var(--ink); }
.gb-bow { position: absolute; left: 50%; bottom: 100%; width: 0; height: 0; }
.gb-bow::before, .gb-bow::after { content: ''; position: absolute; bottom: -3px; width: 34px; height: 26px; background: var(--pop); border: 3px solid var(--ink); border-radius: 50% 50% 8px 50%; }
.gb-bow::before { right: 0; transform: rotate(-20deg); transform-origin: 100% 100%; }
.gb-bow::after { left: 0; transform: rotate(20deg) scaleX(-1); transform-origin: 0 100%; }
.gb-glow { position: absolute; left: 50%; top: 60px; width: 20px; height: 20px; margin: -10px; border-radius: 50%; background: radial-gradient(circle, #fff 0%, var(--pop) 40%, transparent 70%); opacity: 0; z-index: 1; }
.gift-box.open { animation: giftShake .45s ease-in-out; }
@keyframes giftShake { 20% { transform: rotate(-8deg) scale(1.04); } 40% { transform: rotate(8deg) scale(1.06); } 60% { transform: rotate(-5deg) scale(1.08); } 80% { transform: rotate(3deg) scale(1.1); } }
.gift-box.open .gb-lid { animation: lidOff 1.1s .4s cubic-bezier(.2,.8,.3,1) forwards; }
@keyframes lidOff { 0% { transform: none; } 35% { transform: translate(-10px, -90px) rotate(-30deg); } 100% { transform: translate(-160px, -40px) rotate(-120deg); opacity: 0; } }
.gift-box.open .gb-glow { animation: glow 1.4s .45s ease-out forwards; }
@keyframes glow { 0% { opacity: 0; transform: scale(1); } 25% { opacity: 1; transform: scale(8); } 100% { opacity: 0; transform: scale(40); } }
#reveal.opening .reveal-inner > *:not(.gift-box) { transition: opacity .6s .9s; opacity: 0 !important; }

/* fixes: gift visibility (its own animations replace the fade-in), question card layout */
.reveal-inner > .gift-box { opacity: 1; animation: rise .9s 1s both, giftWiggle 2.6s 2.2s ease-in-out infinite; }
.reveal-inner > .gift-box.open { opacity: 1; animation: giftShake .45s ease-in-out; }
#lock-form.intro-lock { display: block; }
.intro-row #pw { width: 100%; padding: .75em .8em; font-size: 1rem; }
.intro-row .btn { padding: .75em 1.1em; }

.gate-skip { color: var(--on-accent) !important; border-color: transparent !important; text-decoration: underline; }
.intro-music.sdk .im-label { flex-wrap: wrap; }
