/* ============================================================
   heykz.com — "summer ghibli" theme (docs/redesign.html is the plan;
   docs/style-guide.html predates the reskin — tokens here are canonical).
   ============================================================ */

/* --- Self-hosted fonts (variable weights) --- */
@font-face {
  font-family: "Cormorant Garamond";
  src: url("/fonts/cormorant-garamond.woff2") format("woff2");
  font-weight: 500 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Great Vibes";
  src: url("/fonts/great-vibes.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/fonts/lora.woff2") format("woff2");
  font-weight: 400 600; font-style: normal; font-display: swap;
}

:root {
  /* aged poster paper */
  --paper: #f7efd8; --paper-2: #f1e6c5; --paper-3: #e9dbb4;
  --card-fill: #fbf5e4;
  --line: #e0d2ac; --line-2: #cbbb8f; --ink-line: #2f4a58;

  /* sea-ink text scale */
  --ink: #2f4a58; --ink-2: #56707c; --ink-3: #86988f; --ink-4: #b7c3b4;
  --inv-ink: #fdf8ea; --inv-ink-2: #d7e4ea;

  /* watermelon accent (keeps every job "red" had) */
  --red: #c9584a; --red-dark: #a83f33; --red-pale: #f4ddd0;

  /* scenery — decorative only, never text */
  --sky: #63a9d8; --sky-deep: #3f8ec4; --sea: #6fb8bd;
  --grass: #6f9e57; --grass-deep: #4c7a3d; --sand: #e5d0a1; --sun: #f2c94c;

  --ok: #4c7a3d; --ok-soft: #e3ecd4; --warn: #8a5f06; --warn-soft: #f3e6c2;

  /* storybook-soft geometry */
  --r-sm: 6px; --r-md: 10px; --r-pill: 999px;
  --shadow-pop: 0 2px 10px rgba(47, 74, 88, 0.14);
  --shadow-modal: 0 8px 40px rgba(47, 74, 88, 0.22);

  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem; --sp-6: 2rem; --sp-8: 3rem;
  --measure: 42rem; --navbar-h: 58px;

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-script: "Great Vibes", cursive;
  --font-body: "Lora", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: "Lora", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }
code { font-family: var(--font-mono); font-size: 0.85em; background: var(--paper-3); padding: 1px 5px; border-radius: var(--r-sm); }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: 0; color: var(--ink); }
h1 { font-size: 2.5rem; line-height: 1.08; }
h2 { font-size: 1.7rem; line-height: 1.15; }
h3 { font-size: 1.25rem; line-height: 1.25; }
p { margin: 0; }

/* the "save the date" voice: letterspaced display caps */
.label {
  font-family: var(--font-display); font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.22em; color: var(--ink-2);
}
.label--red { color: var(--red); }
.label--ink { color: var(--ink); }
.script { font-family: var(--font-script); color: var(--red); }

/* --- Layout shells --- */
.container { max-width: 1080px; margin: 0 auto; padding: var(--sp-5); }
.container--narrow { max-width: 560px; }

/* the poster frame: party pages sit on an aged-paper sheet */
body.theme-party { background: var(--paper-2); }
body.theme-party .container {
  background: var(--paper);
  border: 1px solid var(--line-2);
  outline: 1px solid var(--line-2); outline-offset: -8px;
  border-radius: 4px;
  margin: 1.25rem auto;
  padding: var(--sp-6);
  box-shadow: var(--shadow-pop);
  min-height: calc(100vh - var(--navbar-h) - 2.5rem - 4px);
}
@media (max-width: 640px) {
  body.theme-party .container { margin: 0.5rem; padding: var(--sp-4); }
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 0.5rem 1.1rem; border-radius: var(--r-md);
  border: 1px solid var(--ink-line); background: var(--ink); color: var(--inv-ink);
  font-family: var(--font-body); font-weight: 600; font-size: 0.9rem; line-height: 1.2;
  text-decoration: none;
}
.btn:hover { background: #253d49; }
.btn:active { transform: translateY(1px); }
.btn--secondary { background: var(--card-fill); color: var(--ink); border-color: var(--line-2); }
.btn--secondary:hover { background: var(--paper-2); }
.btn--red { background: var(--red); border-color: var(--red); color: #fff; }
.btn--red:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { color: var(--ink); background: var(--paper-2); }
.btn--sm { padding: 0.25rem 0.7rem; font-size: 0.8rem; }
.btn--lg { padding: 0.7rem 1.4rem; font-size: 1rem; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* --- Links --- */
.link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link:hover { color: var(--red); text-decoration-color: var(--red); }
.link--quiet { text-decoration: none; color: var(--ink-2); }
.link--quiet:hover { color: var(--red); }

/* --- Navbar --- */
.navbar {
  display: flex; align-items: center; gap: var(--sp-5);
  height: var(--navbar-h); padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--line-2); background: var(--paper);
}
.navbar .wordmark { font-family: var(--font-display); font-weight: 700; text-decoration: none; font-size: 1.3rem; color: var(--ink); }
.navbar .wordmark .dot { color: var(--red); }
.navbar nav { display: flex; gap: var(--sp-4); margin-left: auto; align-items: center; }
.navbar nav a, .navbar nav .navlink {
  text-decoration: none; color: var(--ink-2);
  font-family: var(--font-display); font-weight: 700; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.18em;
  padding: 4px 2px; border-bottom: 2px solid transparent;
  background: none; border-top: 0; border-left: 0; border-right: 0;
}
.navbar nav a:hover { color: var(--ink); }
.navbar nav a.active { color: var(--ink); border-bottom-color: var(--red); }

/* the party navbar: a strip of sky with cloud puffs along the bottom */
.navbar--inverse {
  border-bottom: 1px solid var(--ink-line);
  background:
    radial-gradient(ellipse 90px 26px at 10% 112%, rgba(255, 251, 235, 0.55), transparent 70%),
    radial-gradient(ellipse 130px 32px at 48% 120%, rgba(255, 251, 235, 0.45), transparent 70%),
    radial-gradient(ellipse 100px 28px at 85% 108%, rgba(255, 251, 235, 0.5), transparent 70%),
    linear-gradient(to bottom, var(--sky-deep), var(--sky));
}
.navbar--inverse .wordmark {
  font-family: var(--font-script); font-weight: 400; font-size: 1.9rem;
  color: #fff; text-shadow: 0 1px 3px rgba(47, 74, 88, 0.45);
}
.navbar--inverse nav a, .navbar--inverse nav .navlink { color: var(--inv-ink-2); text-shadow: 0 1px 2px rgba(47, 74, 88, 0.35); }
.navbar--inverse nav a:hover { color: #fff; }
.navbar--inverse nav a.active { color: #fff; border-bottom-color: var(--sun); }

/* --- Tabs (the corner) --- */
.tabs { display: flex; gap: 3px; border-bottom: 2px solid var(--ink-line); flex-wrap: wrap; margin: var(--sp-4) 0 var(--sp-5); }
.tabs a {
  padding: 6px 14px; text-decoration: none; color: var(--ink-2);
  font-family: var(--font-display); font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.tabs a:hover { color: var(--ink); background: var(--paper-2); }
.tabs a.active { background: var(--ink); color: var(--inv-ink); }
.tabs .todo-dot { color: var(--red); }
.tabs a.active .todo-dot { color: var(--sun); }

/* --- Forms --- */
.field { display: flex; flex-direction: column; gap: var(--sp-1); max-width: 26rem; margin-bottom: var(--sp-4); }
.field label { font-weight: 600; font-size: 0.9rem; }
.field .hint { font-size: 0.8rem; color: var(--ink-3); }
.input, select.input, textarea.input {
  padding: 0.5rem 0.7rem; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: #fffdf4; font: inherit; font-size: 0.95rem; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.input--error { border-color: var(--red); }
.field .error-msg { font-size: 0.8rem; color: var(--red); }
.input--code {
  font-family: var(--font-mono); text-transform: lowercase; letter-spacing: 0.12em;
  text-align: center; font-size: 1.1rem; padding: 0.7rem;
}

/* --- Cards --- */
.card { border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--card-fill); padding: var(--sp-5); box-shadow: 0 1px 4px rgba(47, 74, 88, 0.07); }
.card--frame { border-color: var(--ink-line); }
.card--pop { border-color: var(--ink-line); box-shadow: var(--shadow-pop); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-4); }

/* --- Tables --- */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
  text-align: left; padding: var(--sp-2) var(--sp-3); border-bottom: 2px solid var(--ink-line);
  font-family: var(--font-display); font-size: 0.74rem; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--ink-2); font-weight: 700;
}
.table td { padding: var(--sp-3); border-bottom: 1px solid var(--line); }
.table tr:hover td { background: var(--paper-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 0.85rem; }
.table .mid { text-align: center; font-family: var(--font-mono); font-size: 0.85rem; }
.table th.mid { text-align: center; }

/* --- Pills & ranks --- */
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px; border-radius: var(--r-pill);
  font-family: var(--font-display); font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  border: 1px solid var(--line-2); color: var(--ink-2); background: var(--card-fill);
}
.pill--ink { background: var(--ink); border-color: var(--ink); color: var(--inv-ink); }
.pill--red { background: var(--red); border-color: var(--red); color: #fff; }
.pill--red-outline { border-color: var(--red); color: var(--red); }
.pill--ok { background: var(--ok-soft); border-color: var(--ok-soft); color: var(--ok); }
.pill--warn { background: var(--warn-soft); border-color: var(--warn-soft); color: var(--warn); }
.rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700;
  border: 1px solid var(--line-2); color: var(--ink-2); background: var(--card-fill);
}
.rank--1 { background: var(--ink); border-color: var(--ink); color: #fff; }
.rank--2 { background: var(--card-fill); border-color: var(--ink); color: var(--ink); }
.rank--3 { background: var(--paper-3); border-color: var(--line-2); color: var(--ink); }
.rank--celebrant { background: var(--red); border-color: var(--red); color: #fff; }

/* --- Avatars --- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 1px solid var(--ink-line);
  font-size: 0.85rem; background: var(--paper-2); overflow: hidden; vertical-align: middle;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* --- Boh 🐭 --- */
.boh { animation: boh-bob 3.4s ease-in-out infinite; }
@keyframes boh-bob { 50% { transform: translateY(-7px) rotate(-2deg); } }
.boh--greeter { width: 56px; vertical-align: middle; margin-right: 6px; }
.boh--tiny { width: 40px; opacity: 0.9; display: block; margin: 0 auto var(--sp-2); }

/* --- Flash --- */
.flash {
  display: flex; gap: var(--sp-3); align-items: baseline;
  border: 1px solid var(--ink-line); border-left-width: 4px; border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-4); font-size: 0.92rem; background: var(--card-fill);
  margin-bottom: var(--sp-4);
}
.flash--notice { border-left-color: var(--grass-deep); }
.flash--alert { border-left-color: var(--red); border-color: var(--red); color: var(--red-dark); background: var(--red-pale); }

/* --- Empty states --- */
.empty { border: 1px dashed var(--line-2); border-radius: var(--r-md); padding: var(--sp-6); text-align: center; color: var(--ink-3); }
.empty .label { display: block; margin-bottom: var(--sp-2); }

/* --- Prose (wall messages, blog later) --- */
.prose { font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.75; max-width: var(--measure); color: var(--ink); }
.prose h1, .prose h2, .prose h3 { font-family: var(--font-display); margin: 1.6em 0 0.5em; }
.prose h1 { margin-top: 0; }
.prose p { margin: 0 0 1.1em; }
.prose a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--red); }
.prose blockquote { margin: 1.4em 0; padding-left: 1.1em; border-left: 3px solid var(--red); font-style: italic; color: var(--ink-2); }
.prose ul, .prose ol { margin: 0 0 1.1em; padding-left: 1.4em; }

/* --- Typeracer --- */
.type-prompt {
  font-family: var(--font-mono); font-size: 1.05rem; line-height: 2;
  border: 1px solid var(--ink-line); border-radius: var(--r-md);
  padding: var(--sp-5); background: var(--card-fill);
}
.type-prompt .todo { color: var(--ink-3); }
.type-prompt .ok { color: var(--ink); }
.type-prompt .bad { color: var(--red); }
.type-prompt .miss { color: var(--ink-4); }
.type-prompt .xtra { color: var(--red-dark); opacity: 0.75; }
.type-prompt .w-bad { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.type-prompt .w { display: inline-block; margin-right: 0.1ch; }
.type-caret {
  display: inline-block; width: 2px; height: 1.15em; margin: 0 -1px;
  background: var(--red); vertical-align: -0.18em;
  animation: type-caret-blink 1.1s steps(1) infinite;
}
@keyframes type-caret-blink { 50% { opacity: 0; } }
.type-stage { position: relative; cursor: text; }
.type-stage.blurred .type-prompt { filter: blur(3px); }
.type-stage .focus-note {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-2); pointer-events: none; text-align: center;
}
.type-stage.blurred .focus-note { display: flex; }
.type-sink { position: absolute; opacity: 0; width: 1px; height: 1px; border: 0; padding: 0; top: 0; left: 0; }
.meter { height: 8px; border: 1px solid var(--ink-line); border-radius: var(--r-pill); overflow: hidden; background: var(--card-fill); }
.meter > i { display: block; height: 100%; background: var(--red); }
.stat { display: inline-flex; flex-direction: column; gap: 2px; min-width: 90px; }
.stat b { font-size: 1.8rem; font-weight: 700; font-family: var(--font-mono); letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--ink-line); padding: var(--sp-5);
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.85rem; color: var(--ink-3); margin-top: var(--sp-8);
}
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--red); }

/* --- Login front door: the beach --- */
.front-door {
  min-height: 100vh; display: grid; place-items: center; padding: var(--sp-5);
  background: linear-gradient(to bottom,
    #4f9cd1 0%, #7db9de 32%, #b7d9e4 50%, #e9dcae 68%, var(--sand) 100%);
  position: relative; overflow: hidden;
}
.front-door .cloud {
  position: absolute; background: rgba(255, 251, 235, 0.85); border-radius: 999px; filter: blur(1.5px);
}
.front-door .invite { max-width: 360px; width: 100%; text-align: center; position: relative; }
.front-door .invite .label { color: #fff; text-shadow: 0 1px 2px rgba(47, 74, 88, 0.5); }
.front-door .invite .headline {
  font-family: var(--font-script); font-size: 3.2rem; line-height: 1.1; color: #fff;
  text-shadow: 0 2px 4px rgba(47, 74, 88, 0.45);
}
.front-door .invite .sub { color: #f4fbff; text-shadow: 0 1px 2px rgba(47, 74, 88, 0.45); }
.front-door .boh--door { width: 88px; margin-bottom: -4px; }
.front-door .panel {
  background: rgba(251, 245, 228, 0.96); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: var(--sp-5); display: grid; gap: var(--sp-3); margin-top: var(--sp-4);
  color: var(--ink); box-shadow: var(--shadow-pop); text-align: left;
}

/* --- Question widgets --- */
.q-block { margin-bottom: var(--sp-6); }
.q-block > h3 { margin-bottom: 2px; }
.q-blurb {
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); margin-bottom: var(--sp-3);
}
.q-blurb b { color: var(--red); }

.choice-list { display: grid; gap: 6px; max-width: 24rem; }
.choice {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 8px 12px; background: var(--card-fill);
}
.choice:hover { border-color: var(--ink-3); }
.choice:has(input:checked) { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.choice input[type="radio"] { accent-color: var(--red); }

.opt-img { width: 60px; height: 60px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line-2); flex-shrink: 0; }

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-width: 26rem; }
.rank-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 8px 12px; background: var(--card-fill);
}
.rank-item.sortable-chosen { border-color: var(--red); box-shadow: var(--shadow-pop); }
.drag-handle { cursor: grab; color: var(--ink-3); font-family: var(--font-mono); user-select: none; }
.drag-handle:active { cursor: grabbing; }

.tier-board { display: grid; gap: 8px; max-width: 34rem; }
.tier-row { display: grid; grid-template-columns: 3rem 1fr; gap: 8px; align-items: stretch; }
.tier-name {
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 700;
  border: 1px solid var(--ink-line); border-radius: var(--r-md); background: var(--paper-3);
}
.tier-bucket {
  display: flex; flex-wrap: wrap; gap: 6px; min-height: 52px;
  border: 1px dashed var(--line-2); border-radius: var(--r-md); padding: 6px; background: rgba(255, 253, 244, 0.5);
}
.tier-bucket .tier-item {
  display: flex; align-items: center; gap: 6px; cursor: grab;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 4px 10px; background: var(--card-fill); font-size: 0.9rem;
}
.tier-bucket .tier-item.sortable-chosen { border-color: var(--red); }
.tier-tray { border-style: solid; background: var(--paper-2); }

.rating-grid { display: grid; gap: 8px; max-width: 26rem; }
.rating-row { display: flex; align-items: center; gap: 10px; }
.rating-row .input { width: 6rem; }

/* --- Play tabs (Jul 13 UX pass): centered pane, autosave, combined games --- */
.play-pane { max-width: 46rem; margin: 0 auto; text-align: center; }
.play-pane .play-intro { max-width: 44ch; margin: 0.75rem auto 0; color: var(--ink-2); font-size: 0.95rem; }
.play-pane .choice-list, .play-pane .rank-list, .play-pane .tier-board,
.play-pane .rating-grid { margin-left: auto; margin-right: auto; }
.play-pane .q-block { margin-top: var(--sp-5); }
.autosave-status {
  font-family: var(--font-display); font-size: 0.74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-3); margin-top: var(--sp-4);
}
.autosave-status.ok { color: var(--ok); }

.opt-img--lg { width: 100px; height: 100px; }
.opt-img--poster { width: 120px; height: 150px; }
.rank-item { cursor: grab; }
.rank-item:active { cursor: grabbing; }

.tier-row--tray { grid-template-columns: 1fr; }
.tier-name--fav { background: #fdf3cf; border-color: var(--sun); font-size: 0.7rem; line-height: 1.2; }
.tier-bucket--fav { border-color: var(--sun); background: rgba(242, 201, 76, 0.12); min-height: 60px; }
.tier-item--poster { flex-direction: column; width: 136px; padding: 8px; font-size: 0.8rem; text-align: center; gap: 6px; }

.rating-row { align-items: flex-start; text-align: left; }
.rating-main { flex: 1; display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.rating-slider { display: flex; align-items: center; gap: 10px; }
.rating-slider input[type="range"] { flex: 1; accent-color: var(--red); max-width: 240px; }
.rating-value { font-family: var(--font-mono); font-weight: 700; min-width: 2.2rem; }
.fav-badge {
  font-family: var(--font-display); font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--red);
  border: 1px solid var(--red); border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.rating-grid { max-width: 30rem; }

/* --- Jul 13 evening pass: welcome hero, wide shows board, typeracer window --- */
.welcome-hero { text-align: center; max-width: 40rem; margin: 2rem auto; }
.welcome-hero h1 { font-size: 2.8rem; }
.welcome-hero p { font-size: 1.15rem; color: var(--ink-2); margin-top: 1rem; }

.play-pane--wide { max-width: 100%; }
.play-pane--wide .tier-board { max-width: 100%; }

.fav-badge { visibility: hidden; }
.fav-badge.shown { visibility: visible; }
.rating-slider { display: grid; grid-template-columns: 1fr 2.6rem 6.5rem; align-items: center; gap: 10px; }
.rating-slider input[type="range"] { max-width: none; }

.type-prompt--window { height: calc(2em * 3 + 3rem); overflow: hidden; scroll-behavior: smooth; }

/* --- Manage modal (turbo-frame overlay) --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; overflow: auto;
  background: rgba(47, 74, 88, 0.45);
  display: grid; place-items: start center; padding: 3rem 1.5rem;
}
.modal-card {
  background: var(--paper); border: 1px solid var(--ink-line); border-radius: var(--r-md);
  box-shadow: var(--shadow-modal); max-width: 760px; width: 100%; padding: var(--sp-5);
}

/* --- Native <dialog> modal (wall composer) --- */
.dialog-card {
  border: 1px solid var(--ink-line); border-radius: var(--r-md);
  background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-modal); padding: var(--sp-5);
  width: min(620px, 92vw); max-height: 85vh; overflow: auto;
}
.dialog-card::backdrop { background: rgba(47, 74, 88, 0.45); }

/* --- Birthday Wishes: single full-width column --- */
.wishes-stack { display: grid; gap: 1rem; }

/* --- Wide tables: horizontal scroll with a pinned first column --- */
.table-scroll { overflow-x: auto; }
.table--pinned-first th, .table--pinned-first td { white-space: nowrap; }
.table--pinned-first th:first-child,
.table--pinned-first td:first-child {
  position: sticky; left: 0; z-index: 1;
  background: var(--paper);
  box-shadow: 6px 0 8px -6px rgba(47, 74, 88, 0.25);
}
.table--pinned-first tr:hover td:first-child { background: var(--paper-2); }

/* --- Total Points row: stands apart from the question rows --- */
.table-total td,
.table .table-total:hover td,
.table--pinned-first .table-total td:first-child {
  background: var(--paper-3);
  border-bottom: 2px solid var(--ink-line);
  font-size: 0.95rem;
}
.table--pinned-first td.mid, .table--pinned-first th.mid { min-width: 7.5rem; }

/* --- Navbar account dropdown --- */
.nav-user { position: relative; }
.nav-avatar { background: none; border: 0; padding: 0; cursor: pointer; display: grid; }
.avatar--nav { width: 2.1rem; height: 2.1rem; border-color: rgba(255, 251, 235, 0.85); box-shadow: 0 1px 3px rgba(47, 74, 88, 0.35); }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 40;
  min-width: 170px; padding: 6px; display: grid; gap: 2px;
  background: var(--paper); border: 1px solid var(--ink-line); border-radius: var(--r-md);
  box-shadow: var(--shadow-modal);
}
.dropdown-menu .button_to { display: block; width: 100%; }
.dropdown-item {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  font: inherit; font-size: 0.92rem; color: var(--ink); padding: 8px 12px;
  border-radius: var(--r-sm); cursor: pointer; text-shadow: none;
}
.dropdown-item:hover { background: var(--paper-2); color: var(--ink); }

/* --- Login: the beach poster as backdrop, washed + blurred so it stays calm --- */
.front-door--poster {
  background: url("/login-bg.jpg") center / cover no-repeat;
}
.front-door--poster::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom,
    rgba(125, 185, 222, 0.30) 0%,
    rgba(247, 239, 216, 0.35) 55%,
    rgba(247, 239, 216, 0.65) 100%);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
}
.front-door--poster .invite { z-index: 1; }
.dropdown-menu[hidden] { display: none; } /* display:grid above beats the hidden attr otherwise */

/* --- Welcome hero: one-line title + photo --- */
.welcome-hero { max-width: 56rem; }
.welcome-hero h1 { font-size: clamp(1.7rem, 4.2vw, 2.7rem); white-space: nowrap; }
@media (max-width: 720px) { .welcome-hero h1 { white-space: normal; } }
.welcome-photo {
  display: block; width: 100%; height: auto; margin-top: 1.5rem;
  border-radius: var(--r-md); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-pop);
}

/* --- Uniform tab width: everything matches the Welcome pane (56rem) --- */
.play-pane { max-width: 56rem; }
.play-pane--wide { max-width: 56rem; }
.pane { max-width: 56rem; margin: 0 auto; }
.play-pane .play-intro { max-width: none; } /* full pane width, like the welcome copy */

/* --- One-line truncation with native tooltip (title attr) --- */
.truncate-1 {
  display: block; max-width: 24rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- Table scroll: no white track, just a quiet thumb --- */
.table-scroll { scrollbar-color: var(--line-2) transparent; scrollbar-width: thin; }
.table-scroll::-webkit-scrollbar { height: 8px; background: transparent; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
.fav-badge { text-align: center; display: inline-flex; align-items: center; justify-content: center; }

/* --- Tab progress dots: red untouched · amber in progress · green submitted --- */
.tab-dot { font-size: 0.7em; vertical-align: 1px; }
.tab-dot--none { color: var(--red); }
.tab-dot--partial { color: #d99a26; }
.tab-dot--done { color: var(--grass-deep); }
.tabs a.active .tab-dot--none { color: var(--sun); }
.tabs a.active .tab-dot--partial { color: #f2c94c; }
.tabs a.active .tab-dot--done { color: #9fd08a; }

/* --- Birthday Wishes cards: author spacing, full-width photos, own-post menu --- */
.wish-head { display: flex; justify-content: space-between; align-items: center; }
.wish-author { display: inline-flex; align-items: center; gap: 9px; }
.wish-photo {
  display: block; width: auto; height: auto;
  height: 320px; width: auto; max-width: 100%; object-fit: contain;
  border-radius: var(--r-sm); border: 1px solid var(--line-2);
}
.wish-photos { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; margin-top: 0.75rem; }
@media (max-width: 640px) { .wish-photo { height: 240px; } }

/* --- Wish hearts: muted khaki until someone hearts, then red; hover names --- */
.heart { position: relative; display: inline-flex; }
.heart-form { display: inline-flex; }
.heart-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; padding: 2px; cursor: pointer;
  color: var(--line-2); transition: transform 0.1s ease;
}
.heart-btn svg { display: block; }
.heart-btn:not(.heart-btn--static):hover { transform: scale(1.15); }
.heart-btn--static { cursor: default; }
.heart--on .heart-btn { color: var(--red); }
.heart-count { font-size: 0.8rem; font-variant-numeric: tabular-nums; line-height: 1; }
.heart-tip {
  position: absolute; bottom: calc(100% + 7px); right: -4px; z-index: 30;
  background: var(--ink); color: var(--paper); white-space: nowrap;
  font-size: 0.78rem; line-height: 1; padding: 6px 9px; border-radius: var(--r-sm);
  opacity: 0; pointer-events: none; transition: opacity 0.1s ease;
}
.heart-tip::after {
  content: ""; position: absolute; top: 100%; right: 12px;
  border: 5px solid transparent; border-top-color: var(--ink);
}
.heart:hover .heart-tip, .heart:focus-within .heart-tip { opacity: 1; }

/* --- Pinned table column: desktop only (scrolls freely on phones) --- */
@media (max-width: 640px) {
  .table--pinned-first th:first-child,
  .table--pinned-first td:first-child { position: static; box-shadow: none; }
}

/* --- Mobile navbar: Boh only, no wordmark text --- */
@media (max-width: 640px) {
  .wordmark-text { display: none; }
}

/* --- Celebrant celebration banner: yellow with confetti --- */
.celebration-banner {
  margin: 1rem auto; padding: 0.85rem 1.4rem; max-width: 42rem;
  border: 1px solid #dcb63a; border-radius: var(--r-md);
  font-family: var(--font-display); font-weight: 700; font-size: 1.02rem;
  color: var(--ink); text-align: center;
  background-color: #fbeeb8;
  background-image:
    radial-gradient(circle 2.5px at 11px 14px,  rgba(201, 88, 74, 0.6) 99%, transparent),
    radial-gradient(circle 2px   at 47px 38px,  rgba(63, 127, 174, 0.55) 99%, transparent),
    radial-gradient(circle 2.5px at 84px 10px,  rgba(111, 158, 87, 0.6) 99%, transparent),
    radial-gradient(circle 2px   at 118px 30px, rgba(201, 88, 74, 0.55) 99%, transparent),
    radial-gradient(circle 2px   at 66px 24px,  rgba(217, 154, 38, 0.7) 99%, transparent),
    radial-gradient(circle 2.5px at 132px 46px, rgba(63, 127, 174, 0.5) 99%, transparent);
  background-size: 140px 52px;
  background-repeat: repeat;
}

/* --- Wall recap carousel --- */
.recap-carousel { position: relative; margin: 1rem 0 2rem; }
.recap-viewport { position: relative; overflow: hidden; transition: height 0.38s ease; }
.recap-slide-anim {
  position: absolute; top: 0; left: 0; width: 100%;
  transition: transform 0.38s ease, opacity 0.38s ease;
}
.recap-card { text-align: center; cursor: grab; }
.recap-card:active { cursor: grabbing; }
.recap-card h3 { font-size: 1.6rem; }
.recap-card .recap-intro { color: var(--ink-2); margin: 0.35rem 0 1rem; }
.recap-card .wish-photos { justify-content: center; }
/* friend-message cards read like wall posts: left-aligned */
.recap-card--post { text-align: left; }
.recap-card--post .wish-photos { justify-content: flex-start; }
.recap-arrow {
  /* pinned near the top so it never moves as card heights change */
  position: absolute; top: 0.9rem; z-index: 5;
  width: 2.3rem; height: 2.3rem; border-radius: 50%; border: 1px solid var(--line-2);
  background: rgba(247, 239, 216, 0.94); color: var(--ink); font-size: 1.15rem;
  box-shadow: 0 1px 6px rgba(47, 74, 88, 0.22); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.recap-arrow--prev { left: -0.7rem; }
.recap-arrow--next { right: -0.7rem; }
.recap-bars { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 0.85rem; }
.recap-bar {
  width: 22px; height: 5px; border-radius: 999px; border: 0; padding: 0;
  background: var(--line-2); cursor: pointer;
}
.recap-bar.active { background: var(--red); }

.recap-rank-row { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 3px 0; }
.recap-rank-row > b { min-width: 12rem; text-align: left; }
.recap-rank-row .opt-img { width: 38px; height: 38px; }
.recap-rank-pos { font-family: var(--font-mono); color: var(--ink-3); min-width: 1.6rem; text-align: right; }

.recap-tier { margin-top: 0.9rem; }
.recap-tier-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 0.4rem; }
.recap-show { width: 76px; text-align: center; font-size: 0.72rem; line-height: 1.25; color: var(--ink-2); }
.recap-show img { width: 64px; height: 80px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line-2); }

.recap-book-row { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 4px 0; }
.recap-book-row .opt-img { width: 40px; height: 50px; }
.recap-book-row input[type="range"] { flex: 1; max-width: 16rem; }
.recap-book-label { min-width: 0; flex: 0 1 16rem; font-size: 0.9rem; text-align: left; }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-top: 1rem; }
.stat-tile { border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--paper-2); padding: 1.1rem 0.8rem; text-align: center; }
.stat-tile b { display: block; font-size: 2.3rem; font-family: var(--font-mono); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-tile .label { margin-top: 6px; display: block; }

.recap-race-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r-sm); }
.recap-race-row--jeny { background: var(--red-pale); border: 1px solid var(--red); }
.recap-race-row--closest { background: var(--ok-soft); border: 1px solid var(--ok); }
.recap-race-wpm { margin-left: auto; font-family: var(--font-mono); font-weight: 700; }

.friend-strip {
  display: flex; gap: 10px; overflow-x: auto; margin-top: 0.6rem; padding-bottom: 6px;
  text-align: left; cursor: grab; user-select: none;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; /* thumb only, no rail */
}
.friend-strip:active { cursor: grabbing; }
.friend-strip::-webkit-scrollbar { height: 6px; background: transparent; }
.friend-strip::-webkit-scrollbar-track { background: transparent; border: 0; }
.friend-strip::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
.friend-chip {
  flex: 0 0 auto; width: 15rem; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--paper-2); padding: 0.6rem 0.75rem; font-size: 0.8rem; line-height: 1.45;
}
.friend-chip-head { display: flex; align-items: center; gap: 6px; font-weight: 700; margin-bottom: 0.4rem; }
.friend-chip .match { color: var(--ok); font-weight: 700; }
.friend-chip-total {
  margin-left: auto; white-space: nowrap;
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-2);
}
.friend-chip-points { margin-top: 2px; font-weight: 700; font-size: 0.75rem; }
.recap-race-points { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-2); min-width: 3.2rem; text-align: right; }

/* --- Player-vs-Jeny comparison modal --- */
.col-click { cursor: pointer; }
.dialog-card--wide { width: min(46rem, calc(100vw - 2rem)); max-width: none; }
.compare-table td { vertical-align: top; font-size: 0.85rem; line-height: 1.5; }
.compare-table .compare-jeny { color: var(--red-dark); }
.compare-table td, .compare-table th { white-space: normal; }
.compare-table .compare-prompt { color: var(--ink-2); min-width: 8rem; }
.compare-item + .compare-item { margin-top: 2px; }
.compare-tier + .compare-tier, .compare-item + .compare-tier, .compare-tier + .compare-item { margin-top: 0.6rem; }
.compare-table .match { color: var(--ok); font-weight: 700; }
.winner-chip { margin-top: 4px; }

/* --- Trivia contest header: avatar above name, long names wrap --- */
.th-player { vertical-align: bottom; }
.th-player .avatar {
  display: flex; margin: 0 auto 0.35rem;
  width: 2.4rem; height: 2.4rem; font-size: 1.2rem;
}
.th-player-name {
  display: block; white-space: normal; overflow-wrap: break-word;
  max-width: 8.5rem; min-width: 4.5rem; margin: 0 auto; line-height: 1.3;
}
