/* ============================================================
   Crackerbloom — design system
   Base theme: "Night Table" (dark, candlelit). A light theme
   follows the system preference via prefers-color-scheme.
   One accent (candlelight amber, glows), sage = alive/good.
   ============================================================ */

/* ---------- theme tokens: dark (base) ---------- */
:root {
  --page-width: 980px;
  --bg: #171310;
  --bg-glow: radial-gradient(1100px 480px at 50% -10%, rgba(242, 169, 59, 0.07), transparent 60%);
  --surface: #201b16;
  --surface-2: #2a231c;
  --surface-3: #1a1510;
  --ink: #f2e9db;
  --muted: #a2937c;
  --faint: #6f6350;
  --accent: #f2a93b;
  --accent-deep: #f2a93b;
  --accent-ink: #241a0c;
  --accent-soft: rgba(242, 169, 59, 0.13);
  --accent-line: rgba(242, 169, 59, 0.55);
  --glow: 0 0 0 1px rgba(242, 169, 59, 0.35), 0 0 18px rgba(242, 169, 59, 0.18);
  --glow-strong: 0 0 0 1px rgba(242, 169, 59, 0.5), 0 0 26px rgba(242, 169, 59, 0.3);
  --leaf: #a3bd8a;
  --leaf-deep: #a3bd8a;
  --leaf-soft: rgba(163, 189, 138, 0.13);
  --leaf-line: rgba(163, 189, 138, 0.4);
  --danger: #e2705a;
  --danger-soft: rgba(226, 112, 90, 0.12);
  --border: #372f26;
  --border-strong: #4a3f32;
  --radius: 14px;
  --radius-sm: 10px;
  --logo-petal: #f2a93b;
  --logo-ring-bg: #241a0c;
  --logo-ring-stroke: #f2a93b;
  --logo-filter: drop-shadow(0 0 8px rgba(242, 169, 59, 0.45));
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px rgba(0, 0, 0, 0.28);
  --placeholder: #6f6350;
}

/* ---------- theme tokens: light (follows system) ---------- */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4efe4;
    --bg-glow: radial-gradient(1100px 480px at 50% -10%, rgba(217, 122, 31, 0.08), transparent 60%);
    --surface: #fffdf8;
    --surface-2: #f6efdf;
    --surface-3: #f8f2e6;
    --ink: #2b2118;
    --muted: #7d6f5c;
    --faint: #a3967f;
    --accent: #d97a1f;
    --accent-deep: #b96315;
    --accent-ink: #fff8ec;
    --accent-soft: rgba(217, 122, 31, 0.12);
    --accent-line: rgba(217, 122, 31, 0.55);
    --glow: 0 0 0 1px rgba(217, 122, 31, 0.28), 0 0 16px rgba(217, 122, 31, 0.16);
    --glow-strong: 0 0 0 1px rgba(217, 122, 31, 0.45), 0 0 24px rgba(217, 122, 31, 0.25);
    --leaf: #4f7a41;
    --leaf-deep: #3f6333;
    --leaf-soft: rgba(79, 122, 65, 0.12);
    --leaf-line: rgba(79, 122, 65, 0.4);
    --danger: #b0472f;
    --danger-soft: rgba(176, 71, 47, 0.1);
    --border: #e0d5bf;
    --border-strong: #c9bda2;
    --logo-petal: #d97a1f;
    --logo-ring-bg: #fff8ec;
    --logo-ring-stroke: #b96315;
    --logo-filter: drop-shadow(0 0 6px rgba(217, 122, 31, 0.25));
    --shadow: 0 1px 2px rgba(96, 64, 20, 0.05), 0 6px 18px rgba(96, 64, 20, 0.08);
    --placeholder: #a3967f;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
h1 { font-size: 1.7rem; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 {
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin: 30px 0 12px;
}
h3 { margin: 0 0 0.4em; font-size: 1rem; }
h3 small { display: block; font-weight: 400; color: var(--muted); }
p.note, .note { color: var(--muted); font-size: 0.92rem; }

/* ---------- topbar ---------- */
#topbar {
  display: flex; align-items: center; gap: 12px;
  width: min(var(--page-width), calc(100% - 32px));
  margin: 12px auto 0;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.mark { width: 29px; height: 29px; filter: var(--logo-filter); flex: none; }
.mark-petals { fill: var(--logo-petal); }
.mark-ring { fill: var(--logo-ring-bg); stroke: var(--logo-ring-stroke); stroke-width: 2.5; }
.mark-dot { fill: var(--logo-ring-stroke); }
.logo .word {
  font-size: 0.98rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink); white-space: nowrap;
}
.logo .word em { font-style: normal; color: var(--accent); }

.back-btn {
  background: transparent; color: var(--ink); font-size: 1.15rem;
  padding: 4px 11px; border-radius: 10px; border: 1px solid var(--border);
  cursor: pointer; line-height: 1.2;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

#nav { display: flex; gap: 4px; align-items: center; margin-left: auto; }
#nav a {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.92rem;
  padding: 7px 13px; border-radius: 9px; white-space: nowrap;
}
#nav a:hover { color: var(--ink); background: var(--surface-2); }

.me-wrap { position: relative; margin-left: 4px; flex: none; }
.me-btn {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  font-size: 1.2rem; line-height: 1;
  width: 42px; height: 42px; padding: 0; cursor: pointer;
  display: grid; place-items: center; overflow: hidden;
}
.me-btn:hover { border-color: var(--accent); }

.me-menu[hidden] { display: none; }
.me-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  min-width: 190px; padding: 6px; z-index: 30;
}
.me-menu a {
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: 0.92rem;
  padding: 9px 12px; border-radius: 8px;
}
.me-menu a:hover { background: var(--surface-2); }
.me-menu button {
  background: transparent; color: var(--danger); border: none;
  border-radius: 8px; text-align: left; font: inherit; font-weight: 600;
  padding: 9px 12px; cursor: pointer;
}
.me-menu button:hover { background: var(--danger-soft); }

/* ---------- layout ---------- */
main {
  width: min(var(--page-width), calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 60px;
  flex: 1;
}

/* ---------- footer ---------- */
#footer {
  width: min(var(--page-width), calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 4px 26px;
  border-top: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  color: var(--muted); font-size: 0.85rem;
}
#footer .links { margin-left: auto; display: flex; gap: 16px; }
#footer a { color: var(--muted); text-decoration: none; font-weight: 600; }
#footer a:hover { color: var(--accent); }

/* ---------- controls ---------- */
button {
  font: inherit; font-weight: 700;
  color: var(--accent-ink); background: var(--accent);
  border: none; border-radius: 11px;
  padding: 9px 18px; cursor: pointer;
}
button:hover { box-shadow: var(--glow); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
button.ghost {
  background: transparent; color: var(--muted);
  border: 1.5px solid var(--border-strong);
}
button.ghost:hover { color: var(--danger); border-color: var(--danger); box-shadow: none; }
button.small { padding: 5px 12px; font-size: 0.85rem; border-radius: 9px; }

input, .input {
  font: inherit; color: var(--ink);
  padding: 9px 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface-3);
  min-width: 0;
}
input::placeholder { color: var(--placeholder); }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input:read-only { color: var(--muted); }

/* ---------- cards & dashboard ---------- */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 20px;
}
.card-title { font-weight: 700; font-size: 1.05rem; }
.card-sub { color: var(--muted); font-size: 0.88rem; margin-top: 3px; }
a.cta {
  display: block; text-decoration: none; color: inherit; cursor: pointer;
  border-color: var(--border-strong);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
a.cta:hover { border-color: var(--accent); box-shadow: var(--glow); }

.games { display: flex; flex-direction: column; gap: 10px; }
.game-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 20px;
  text-decoration: none; color: inherit;
}
.game-card:hover { border-color: var(--accent); box-shadow: var(--glow); }
.game-card .name { font-weight: 700; font-size: 1.05rem; }
.game-card .meta { color: var(--muted); font-size: 0.88rem; margin-top: 1px; }
.game-card .go { margin-left: auto; color: var(--accent); font-weight: 800; white-space: nowrap; }

.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-right: 6px; vertical-align: 0;
  box-shadow: 0 0 8px rgba(242, 169, 59, 0.8);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: 0.4; } }

/* ---------- tags & badges ---------- */
.tag {
  display: inline-block;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--leaf-soft); color: var(--leaf);
  border-radius: 999px; padding: 2px 10px; vertical-align: 2px;
}
.tag.invite { background: var(--accent-soft); color: var(--accent); }
.badge {
  display: inline-block;
  font-size: 0.72rem; font-weight: 800;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; padding: 1px 8px;
}

/* ---------- friends ---------- */
.inline-form { display: inline-flex; gap: 8px; margin: 8px 0; }
.pick-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.pick {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer; user-select: none;
}
.pick input { width: auto; padding: 0; accent-color: var(--accent); }
.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }

/* ---------- creation, search & account ---------- */
.view-start, .view-friends, .view-account { width: min(720px, calc(100% - 32px)); margin-inline: auto; }
.start-field { width: 100%; }
.start-field input { width: 100%; }
.recipient-picker { position: relative; width: 100%; }
.recipient-picker input { width: 100%; }
.search-results {
  position: absolute; z-index: 12; top: calc(100% - 19px); left: 0; right: 0;
  background: var(--surface); border: 1.5px solid var(--accent-line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 5px;
  max-height: 270px; overflow: auto;
}
.search-results button {
  display: block; width: 100%; text-align: left; color: var(--ink);
  background: transparent; padding: 9px 12px; border-radius: 8px;
}
.search-results button:hover, .search-results button:focus-visible {
  background: var(--accent-soft); box-shadow: none;
}
.search-results p { margin: 8px 10px; }
.selected-people { margin: 8px 0 20px; }
.chip-remove {
  padding: 0 2px 0 8px; color: inherit; background: transparent;
  font-size: 1.1rem; line-height: 1;
}
.chip-remove:hover { box-shadow: none; color: var(--danger); }
.creation-options { width: 100%; }
.choice-card { border: 1.5px solid var(--border); }
.choice-card.selected { border-color: var(--accent-line); background: var(--accent-soft); }
.choice-heading { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.choice-heading input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.choice-heading small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.choice-card .wordbtns, .choice-card > input, .choice-card > .hint, .choice-card > .checkbox { margin: 12px 0 0 28px; }
.choice-card > input { width: min(380px, calc(100% - 28px)); }
/* merged "choose a word" card has no radio: content aligns with the heading */
.choice-card:has(.choice-heading:not(:has(input))) .wordbtns,
.choice-card:has(.choice-heading:not(:has(input))) > input,
.choice-card:has(.choice-heading:not(:has(input))) > .hint,
.choice-card:has(.choice-heading:not(:has(input))) > .checkbox { margin-left: 0; }
.choice-card:has(.choice-heading:not(:has(input))) > input { width: min(420px, 100%); }
.wordbtn.chosen { background: var(--accent); color: var(--accent-ink); }
.creation-submit { margin-top: 12px; padding: 11px 24px; }
.form-error { color: var(--danger); font-weight: 700; }
.account-form, .notification-form { width: 100%; }
.account-form input { width: 100%; }
.friend-links { display: grid; gap: 9px; margin-top: 16px; }
.friend-link-form { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.friend-link-form .field { margin-bottom: 14px; }
.friend-link-form input[type="date"] { width: min(320px, 100%); }
.friend-link-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.friend-link-types label { position: relative; min-width: 0; cursor: pointer; }
.friend-link-types label + label { border-left: 1px solid var(--border-strong); }
.friend-link-types label input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.friend-link-types span { display: grid; place-items: center; min-height: 46px; padding: 10px 6px; white-space: nowrap; background: var(--surface); }
.friend-link-types input:checked + span { background: var(--accent-soft); color: var(--accent-deep); font-weight: 700; }
.friend-link-types input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }
#friend-link-type-help { margin: 10px 0 0; }
.friend-link-row { align-items: flex-start; }
.friend-link-details { display: grid; gap: 3px; flex: 1; min-width: min(100%, 220px); }
.friend-link-details input { width: 100%; font-size: 0.85rem; }
.friend-link-details small { line-height: 1.3; }
.setting-row {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 12px 14px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer;
}
.setting-row input { width: 19px; height: 19px; accent-color: var(--accent); flex: none; }
.notification-form button { margin-top: 8px; }
.invite-landing { max-width: 520px; margin: 24px auto; }
.invite-actions, .inline-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.auth-invite { margin-bottom: 14px; justify-content: space-between; }
.invite-section { margin-top: 32px; border-top: 1px solid var(--border); padding-top: 8px; }
.invitation-row > span { min-width: 0; overflow-wrap: anywhere; }
.invitation-row small { display: block; }
.custom-round-form .hint { margin: 2px 0 8px; }

.list-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  margin-bottom: 8px;
}
.list-row button { margin-left: 6px; }

/* ---------- room ---------- */
.room-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.room-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
/* Share-your-game panel shown right after the host creates the game. */
.share-panel {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 14px 0;
}
.share-panel h2 { margin: 0 0 10px; font-size: 1rem; }
.share-panel .share-row { align-items: center; }
.share-panel .note button { margin-left: 10px; }
/* Game settings dialog sections. */
.settings-section { margin-bottom: 18px; }
.settings-section:last-child { margin-bottom: 0; }
.settings-section h2 { margin: 0 0 10px; font-size: 0.95rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: 0.82rem; font-weight: 600;
  border-radius: 999px; padding: 4px 12px;
  border: 1.5px solid var(--border);
  background: var(--surface); color: var(--muted);
}
.chip.active { color: var(--leaf); border-color: var(--leaf-line); background: var(--leaf-soft); }
.chip.invited { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.chip.excused { opacity: 0.45; }
.chip.ended { opacity: 0.45; }

.invite-panel {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 12px 0;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}

.invite-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 12px 0;
}
.invite-result .link-row { display: flex; gap: 8px; margin: 8px 0; }
.invite-result .link-row input { flex: 1; font-size: 0.85rem; }
.invite-result .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.scoreboard {
  margin: 14px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline;
}
.scoreboard .lbl { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.18em; color: var(--muted); }
.score { font-size: 0.92rem; color: var(--muted); }
.score b { color: var(--ink); }
.score.lead b { color: var(--accent); }
.score.excused { opacity: 0.5; }

.banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 14px 0;
}
.banner.win { border-left-color: var(--leaf); }

/* The finished round's answer, big and bold, while the table reviews the
   guesses and the winner sets up the next round. */
.solution {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--leaf);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-align: center;
  margin: 14px 0;
}
.solution.revealed { border-left: 4px dashed var(--accent-line); }
.solution-kicker { margin: 0 0 8px; font-size: 0.92rem; color: var(--muted); }
.solution-kicker b { color: var(--ink); }
.solution-word {
  font-size: 2.3rem; font-weight: 800; letter-spacing: 0.05em;
  text-transform: lowercase; line-height: 1.2;
  overflow-wrap: anywhere;
}
.solution.solved .solution-word { text-shadow: 0 0 26px rgba(163, 189, 138, 0.4); }

.word-options { display: grid; gap: 14px; margin: 14px 0; }
.opt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.wordbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.wordbtn {
  font-size: 1.05rem; letter-spacing: 0.4px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}
.wordbtn:hover { box-shadow: var(--glow); }
.invite-line { margin-top: 10px; }

.guess-form { display: flex; gap: 8px; margin: 12px 0; max-width: 520px; }
.guess-form input { flex: 1; }
.countdown { color: var(--accent); font-weight: 700; }

/* ---------- phrase rounds ---------- */
.game-type-hint { margin-top: 8px; }
.wordbtns.phrase-wordbtns .wordbtn { font-size: 0.95rem; letter-spacing: 0.2px; }
.phrase-board { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.phrase-slot {
  min-width: 76px; text-align: center; padding: 10px 12px;
  border: 1.5px dashed var(--border-strong); border-radius: 10px;
  background: var(--surface-3);
  font-weight: 700; letter-spacing: 0.04em; text-transform: lowercase;
  color: var(--muted);
}
.phrase-slot .slot-dots { color: var(--faint); letter-spacing: 3px; }
.phrase-slot.filled { border: 1.5px solid var(--accent-line); background: var(--accent-soft); color: var(--accent-deep); }
.phrase-slot.target {
  border: 1.5px solid var(--accent);
  animation: slot-pulse 2.2s ease-in-out infinite;
}
@keyframes slot-pulse {
  0%, 100% { box-shadow: var(--glow); }
  50% { box-shadow: var(--glow-strong); }
}
.phrase-caption { margin-top: 0; }
.guess .found { color: var(--leaf); font-weight: 700; }

.reveal-panel {
  background: var(--accent-soft);
  border: 1.5px dashed var(--accent-line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 12px 0;
}
.reveal-panel p { margin: 0 0 10px; font-size: 0.92rem; }
.reveal-panel p:last-child { margin-bottom: 0; }

.skip-panel {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 0.92rem;
}
.skip-panel button { background: var(--danger); color: #fff; }
.skip-panel button:hover { box-shadow: 0 0 0 1px rgba(226, 112, 90, 0.5), 0 0 18px rgba(226, 112, 90, 0.25); }

.turn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 18px;
  margin: 12px 0;
}
.turn-title {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.guess {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.guess:first-of-type { border-top: none; }
.guess .who { color: var(--muted); font-size: 0.85rem; min-width: 92px; }
.guess .word { font-weight: 700; letter-spacing: 0.05em; text-transform: lowercase; }
.guess .hit { font-size: 0.85rem; color: var(--muted); }
.guess .hit.win { color: var(--leaf); font-weight: 800; }
/* Letter-count badge: green when the guess hit at least one letter,
   red when it hit none. */
.guess .hits {
  display: inline-block; min-width: 1.5em; text-align: center;
  font-size: 0.78rem; font-weight: 800; line-height: 1.5;
  border-radius: 999px; padding: 1px 7px;
  vertical-align: baseline;
}
.guess .hits.good { color: var(--leaf); background: var(--leaf-soft); border: 1px solid var(--leaf-line); }
.guess .hits.zero { color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger); }
.guess.exact { background: var(--leaf-soft); border-radius: 8px; padding: 6px 10px; border-top: none; }
.skipped { color: var(--muted); font-size: 0.85rem; margin-top: 6px; font-style: italic; }

/* ---------- account ---------- */
.avatar-grid { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; justify-content: center; }
.avatar-image { display: inline-block; width: 1.3em; height: 1.3em; object-fit: cover; border-radius: 50%; vertical-align: -0.22em; flex: none; }
.avatar-emoji { display: inline-block; line-height: 1; vertical-align: -0.08em; }
.me-btn .avatar-image { width: 36px; height: 36px; vertical-align: middle; }
.picture-control { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.picture-summary { display: flex; align-items: center; gap: 14px; }
.picture-preview { display: grid; place-items: center; width: 58px; height: 58px; flex: none; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); font-size: 1.8rem; overflow: hidden; }
.picture-preview .avatar-image { width: 100%; height: 100%; border-radius: 0; }
.picture-options { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.picture-options .note { margin: 0 0 12px; }
/* Inside the chooser dialog the options are the whole content. */
.dialog-picture-options { border-top: 0; margin-top: 0; padding-top: 0; }
.upload-button { display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--accent-line); border-radius: 10px; padding: 8px 14px; color: var(--accent); cursor: pointer; font-weight: 700; }
.upload-button:hover { background: var(--accent-soft); }
.upload-button:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.field-label { display: block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field-label .optional { opacity: 0.6; text-transform: none; letter-spacing: 0; font-weight: 600; }
.avatar-pick {
  font-size: 1.7rem; line-height: 1;
  width: 62px; height: 62px;
  border-radius: 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  cursor: pointer; padding: 0;
}
.avatar-pick .avatar-image { width: 100%; height: 100%; border-radius: 14px; }
.avatar-pick:hover { border-color: var(--accent); }
.avatar-pick.current {
  border-color: var(--accent); background: var(--accent-soft);
  box-shadow: var(--glow);
}
.email-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 0.92rem;
}
.verified-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.75rem; font-weight: 800; letter-spacing: 0.04em;
  color: var(--leaf); background: var(--leaf-soft);
  border: 1px solid var(--leaf-line);
  border-radius: 999px; padding: 2px 10px;
}

/* ---------- auth ---------- */
.auth { max-width: 420px; margin: 5vh auto 0; }
.auth .brand { display: flex; align-items: center; gap: 10px; justify-content: center; }
.auth .brand .mark { width: 36px; height: 36px; }
.auth .brand .word { font-size: 1.15rem; }
.auth .tagline { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 10px 0 18px; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.auth-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.auth-tabs button {
  flex: 1;
  background: transparent; color: var(--muted);
  border: 1.5px solid var(--border);
  font-weight: 700;
}
.auth-tabs button.active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.auth-tabs button:hover { box-shadow: none; }

.field { margin-bottom: 13px; }
.field > label {
  display: block; font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.field > label .optional { opacity: 0.6; text-transform: none; letter-spacing: 0; font-weight: 600; }
.field input { width: 100%; }
.field .hint { font-size: 0.78rem; color: var(--muted); margin-top: 5px; }

.captcha-box {
  border: 1.5px dashed var(--border-strong);
  border-radius: 11px;
  background: var(--surface-3);
  padding: 10px;
  margin-bottom: 14px;
  min-height: 64px;
  text-align: center; /* the Turnstile widget renders left-aligned by default */
}
.captcha-note { font-size: 0.75rem; color: var(--faint); text-align: center; padding-top: 14px; }

.step-pill {
  display: inline-block;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 4px 12px; margin-bottom: 14px;
}
.privacy-box {
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  padding: 14px 16px;
  font-size: 0.88rem;
  margin-bottom: 14px;
}
.privacy-box b { display: block; margin-bottom: 5px; color: var(--accent); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 0.88rem; margin-bottom: 14px; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.btn-block { width: 100%; }
.auth-alt { text-align: center; margin: 14px 0 0; font-size: 0.85rem; color: var(--muted); }

/* ---------- flash toast ---------- */
#flash {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid var(--danger);
  color: var(--ink);
  font-weight: 600; font-size: 0.92rem;
  border-radius: 999px;
  padding: 10px 22px;
  box-shadow: 0 0 0 1px rgba(226, 112, 90, 0.3), 0 0 22px rgba(226, 112, 90, 0.2), var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 40; max-width: 90vw;
}
#flash.ok {
  border-color: var(--leaf-line);
  box-shadow: 0 0 0 1px var(--leaf-line), 0 0 22px rgba(163, 189, 138, 0.25), var(--shadow);
}
#flash.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- about / privacy static pages ---------- */
.prose {
  width: min(720px, 100% - 32px);
  margin: 0 auto;
  padding: 36px 0 60px;
}
.prose .kicker {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 6px;
}
.prose h1 { font-size: 2rem; margin: 0 0 18px; }
.prose h2 { margin-top: 30px; }
.prose p { font-size: 0.98rem; }
.prose .card { margin: 14px 0; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .row { grid-template-columns: 1fr; }
  #topbar { gap: 8px; padding: 8px 12px; }
  .nav-desktop { display: none; }
  .logo .word { font-size: 0.85rem; letter-spacing: 0.1em; }
  .room-actions { margin-left: 0; }
  .game-card { padding: 12px 14px; gap: 10px; }
  .auth { margin-top: 18px; }
  .creation-options { gap: 10px; }
  .creation-options .opt { padding: 12px; }
  .inline-actions { width: 100%; }
  .friend-link-row .inline-actions { width: auto; }
  .invitation-row .inline-actions button { flex: 1; }
  .guess-form, .custom-round-form .inline-form { display: flex; flex-wrap: wrap; }
  .guess-form input, .custom-round-form input { min-width: 100%; }
}

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

/* Shared friend picker and invitation dialog */
.people-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.people-actions > button { flex: 1 1 160px; }
.selected-player > span { display: flex; align-items: center; gap: 9px; min-width: 0; overflow-wrap: anywhere; }
.people-dialog { color: var(--ink); background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: 16px; padding: 22px; width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: var(--shadow); }
.people-dialog::backdrop { background: rgba(0,0,0,.65); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.dialog-heading h1 { font-size: 1.35rem; margin: 0; }
.friend-choice { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); min-height: 54px; cursor: pointer; }
.friend-choice input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.friend-choice span { overflow-wrap: anywhere; min-width: 0; }
.friend-choice:has(input:checked) { color: var(--accent); background: var(--accent-soft); }
.chooser-pages { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 15px 0; }
.chooser-pages span { font-size: .8rem; color: var(--muted); }
.invitation-method { margin-bottom: 22px; }
.people-dialog .friend-link-types { width: 100%; }
.people-dialog button { min-height: 44px; }
.profile-link { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.view-profile { width: min(720px, calc(100% - 32px)); margin-inline: auto; }
.profile-heading { display: flex; align-items: center; gap: 16px; }
.profile-heading > .avatar-image { width: 64px; height: 64px; }
.profile-heading > .avatar-emoji { font-size: 3rem; }
.shared-game { margin-bottom: 12px; flex-wrap: wrap; }
.shared-game small { display: block; margin-top: 5px; }
.friend-link-details small { overflow-wrap: anywhere; }
