/* Family Games — neo-brutalist shell. Per-game "worlds" live in worlds.css.
   Design handoff: thick 3px ink borders, hard offset shadows (no blur),
   zero border-radius in the shell, tilted sticker badges, loud flat color. */

:root {
  --paper: #fdfbf2;
  --ink: #111111;
  --yellow: #ffd60a;
  --pink: #ff4d9d;
  --lime: #b8f337;
  --blue: #2f6bff;
  --orange: #ff7a1a;
  --muted: #777777;
  --muted-2: #999999;
  --disabled: #eae6d8;
  --red: #b3202a;
  --green: #2f9e44;
  --gold: #ffd60a;
  --display: 'Archivo Black', 'Arial Black', sans-serif;
  --ui: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'Space Mono', ui-monospace, monospace;
  --shadow-card: 6px 6px 0 var(--ink);
  --shadow-row: 4px 4px 0 var(--ink);
  --shadow-chip: 3px 3px 0 var(--ink);
  --dots: radial-gradient(rgba(0,0,0,.12) 1.2px, transparent 1.6px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { margin: 0 0 .3em; line-height: 1.15; }
h1 { font-family: var(--display); font-size: 1.3rem; letter-spacing: -.01em; }
h2 { font-family: var(--display); font-size: 1.15rem; letter-spacing: -.01em; }
h3 {
  font-size: .8rem; color: var(--ink); text-transform: uppercase;
  letter-spacing: .08em; font-weight: 700;
}
p { margin: .3em 0; }
a { color: var(--ink); text-decoration-thickness: 3px; text-decoration-color: var(--yellow); }

.boot { text-align: center; padding: 40vh 0; font-family: var(--display); font-size: 1.4rem; }

.screen { max-width: 520px; margin: 0 auto; padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 4px 0 14px; min-height: 44px; }
.topbar h1 { flex: 1; text-align: center; margin: 0; font-size: 1.15rem; }
.topbar > :last-child:not(h1) { margin-left: auto; }
.btn-back {
  background: var(--paper); border: 2px solid var(--ink); color: var(--ink);
  font-family: var(--ui); font-size: .85rem; font-weight: 700; padding: 8px 10px;
  cursor: pointer; box-shadow: var(--shadow-chip); text-transform: uppercase;
}
.btn-back:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.me-chip { font-weight: 700; font-size: .85rem; }
.btn-icon { background: none; border: none; font-size: 1.3rem; padding: 6px; cursor: pointer; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 3px solid var(--ink); border-radius: 0; cursor: pointer;
  font-family: var(--ui); font-size: .95rem; font-weight: 700; color: var(--ink);
  background: var(--paper); padding: 12px 18px;
  box-shadow: var(--shadow-chip);
  transition: transform .08s ease, box-shadow .08s ease;
  touch-action: manipulation; text-transform: uppercase; letter-spacing: .02em;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: 1; background: var(--disabled); color: var(--muted); cursor: default; box-shadow: none; border-color: var(--muted-2); }
.btn-primary { background: var(--lime); box-shadow: 5px 5px 0 var(--ink); }
.btn-primary:active { box-shadow: 2px 2px 0 var(--ink); }
.btn-secondary { background: var(--paper); }
.btn-danger { background: #fff; color: var(--red); border-color: var(--red); box-shadow: 3px 3px 0 var(--red); }
.btn-ghost { background: transparent; border: 3px dashed var(--ink); box-shadow: none; }
.btn-small { padding: 8px 12px; font-size: .78rem; border-width: 2px; box-shadow: 2px 2px 0 var(--ink); }
.btn-big { width: 100%; padding: 16px; font-size: 1.05rem; min-height: 58px; box-shadow: 6px 6px 0 var(--ink); }
.btn-big:active { box-shadow: 2px 2px 0 var(--ink); }
.btn-giant {
  width: 100%; padding: 24px 16px; font-family: var(--display); font-size: 1.3rem;
  min-height: 84px; margin-top: 12px; background: var(--lime);
  box-shadow: 7px 7px 0 var(--ink); text-transform: uppercase;
}
.btn-giant:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row.center { justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.stack.center { align-items: center; }
.pulse { animation: none; }
.bounce { animation: bounce 1.2s infinite; display: inline-block; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- inputs ---------- */
.input {
  width: 100%; padding: 13px 14px; font-size: 16px;
  border: 3px solid var(--ink); border-radius: 0; background: #fff;
  color: var(--ink); font-family: var(--ui); font-weight: 500;
  box-shadow: var(--shadow-row);
}
.input::placeholder { color: var(--muted-2); }
.input:focus { outline: none; background: #fffef8; box-shadow: 4px 4px 0 var(--pink); }
.input-code { text-align: center; letter-spacing: .35em; font-weight: 700; text-transform: uppercase; font-family: var(--mono); }
.input-code-big { font-size: 2rem; max-width: 250px; }
select.input { appearance: auto; }

/* ---------- cards & lists ---------- */
.card {
  background: #fff; border: 3px solid var(--ink); border-radius: 0;
  padding: 14px 16px; box-shadow: var(--shadow-card); margin: 12px 0;
}
.card-list { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.card-list .card { margin: 0; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card.center, .center { text-align: center; }
.center-box { text-align: center; padding: 30vh 20px 0; font-family: var(--display); }
.hint { color: var(--muted); font-size: .85rem; margin: .2em 0; font-weight: 500; }
.lead { font-size: 1rem; color: var(--ink); margin: 12px 0; font-weight: 700; }
.badge {
  display: inline-block; background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink);
  font-family: var(--display); font-size: .58rem; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 7px; vertical-align: middle;
  box-shadow: 2px 2px 0 var(--ink); transform: rotate(-2deg);
}
.badge-warn { background: var(--yellow); }
/* badges that follow text/chips need air — the rotation makes them collide */
strong + .badge, .chip + .badge, span + .badge { margin-left: 8px; }
.badge-round { background: var(--ink); color: #fff; transform: rotate(2deg); }
.big-emoji { font-size: 3rem; line-height: 1.1; }
.link-quiet { display: block; text-align: center; margin-top: 18px; color: var(--muted); font-size: .9rem; font-weight: 700; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 8px; margin: 12px 0; overflow-x: auto; padding: 2px 2px 6px; }
.tab {
  flex: 1; white-space: nowrap; padding: 9px 12px; cursor: pointer;
  background: var(--paper); border: 2px solid var(--ink); color: var(--ink);
  font-family: var(--ui); font-weight: 700; font-size: .8rem; text-transform: uppercase;
  box-shadow: var(--shadow-chip); letter-spacing: .03em;
}
.tab.active { background: var(--ink); color: #fff; }
.tab:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

/* ---------- chips ---------- */
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips-wrap.center { justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  padding: 4px 10px 4px 6px; font-size: .85rem; font-weight: 700;
}
.chip-done { background: var(--lime); }
.chip-waiting { background: var(--disabled); color: var(--muted); border-color: var(--muted-2); box-shadow: none; }
.chip-live { background: var(--yellow); }
.chip-emoji { font-size: 1.1rem; }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; border: 3px solid var(--ink);
  padding: 10px 20px; font-weight: 700; font-size: .9rem; max-width: 88vw;
  box-shadow: 4px 4px 0 rgba(0,0,0,.3);
  opacity: 0; transform: translateY(-12px); transition: all .25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: var(--red); }
.toast-warn { background: var(--yellow); color: var(--ink); }
.toast-success { background: var(--lime); color: var(--ink); }

/* ---------- modal ---------- */
#overlay { position: fixed; inset: 0; z-index: 50; display: none; }
#overlay.open {
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(17, 17, 17, .6);
}
.modal {
  background: var(--paper); border: 3px solid var(--ink); border-bottom: none;
  width: 100%; max-width: 520px;
  padding: 18px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 88dvh; overflow-y: auto;
  animation: slideup .22s ease;
}
@keyframes slideup { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h2 { margin: 0; }
.modal-x {
  background: var(--paper); border: 2px solid var(--ink); font-size: .95rem; font-weight: 700;
  color: var(--ink); padding: 4px 9px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink);
}
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
@media (min-width: 600px) {
  #overlay.open { align-items: center; }
  .modal { border: 3px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); }
}

/* ---------- login ---------- */
.login-screen {
  padding-top: 6vh; text-align: center; min-height: 100dvh;
  margin: -14px -16px 0; padding-left: 16px; padding-right: 16px;
  background: var(--yellow); background-image: var(--dots); background-size: 22px 22px;
}
.login-logo { display: none; }
.login-title {
  font-family: var(--display); font-size: 2.2rem; line-height: 1.05; margin: 0 auto 24px;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 8px 8px 0 var(--ink);
  max-width: 340px; padding: 26px 20px 18px; transform: rotate(-1.5deg);
  text-transform: uppercase;
}
.login-title::after {
  content: ''; display: block; margin: 14px auto 0; width: 132px; height: 22px;
  background:
    linear-gradient(var(--pink), var(--pink)) 0 50% / 22px 22px no-repeat,
    radial-gradient(circle at 50% 50%, var(--orange) 10px, transparent 11px) 37px 50% / 22px 22px no-repeat,
    conic-gradient(from -45deg at 50% 100%, transparent 45deg, var(--blue) 45deg 135deg, transparent 135deg) 74px 50% / 22px 22px no-repeat,
    linear-gradient(45deg, transparent 28%, var(--lime) 28% 72%, transparent 72%) 110px 50% / 22px 22px no-repeat;
}
.login-form {
  text-align: left; max-width: 340px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 16px;
}
.login-form .btn-primary { background: var(--pink); font-family: var(--display); }
.avatar-picker { margin: 2px 0; }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.avatar-pick {
  font-size: 1.5rem; padding: 8px 0; background: #fff; border: 2px solid var(--ink);
  cursor: pointer; box-shadow: 2px 2px 0 var(--ink);
}
.avatar-pick:nth-child(3n) { transform: rotate(2deg); }
.avatar-pick:nth-child(3n+1) { transform: rotate(-2deg); }
.avatar-pick.selected { background: var(--lime); box-shadow: 3px 3px 0 var(--ink); transform: rotate(0) scale(1.08); }
.avatar-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.avatar-page-btn {
  width: 44px; height: 34px; font-size: 1.1rem; font-weight: 700; line-height: 1;
  background: var(--paper); border: 2px solid var(--ink); color: var(--ink);
  cursor: pointer; box-shadow: 2px 2px 0 var(--ink);
}
.avatar-page-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.avatar-dots { display: flex; gap: 8px; }
.avatar-dot {
  width: 12px; height: 12px; padding: 0; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--ink); cursor: pointer;
}
.avatar-dot.active { background: var(--ink); }
.login-screen .tabs { max-width: 340px; margin: 0 auto 18px; }
.login-screen .hint { color: var(--ink); font-weight: 700; margin-top: 18px; }

/* ---------- family ---------- */
.family-card.active-family { box-shadow: 6px 6px 0 var(--pink); }
.join-code-big {
  font-family: var(--mono); font-size: 2.2rem; font-weight: 700; letter-spacing: .25em;
  background: var(--ink); color: var(--lime); border: 3px solid var(--ink);
  padding: 12px 18px; margin: 8px 0; user-select: all; box-shadow: var(--shadow-card);
}
.join-code-inline { font-family: var(--mono); font-weight: 700; letter-spacing: .18em; user-select: all; }
.member-row { padding: 8px 0; border-bottom: 2px solid var(--disabled); }
.member-row:last-child { border-bottom: none; }

/* ---------- home ---------- */
.home-header {
  margin: -14px -16px 14px; padding: 16px 16px 14px;
  background: var(--yellow); border-bottom: 3px solid var(--ink);
  display: flex; align-items: flex-start; gap: 10px;
}
.home-header-info { flex: 1; min-width: 0; }
.family-switch {
  background: none; border: none; font-family: var(--display); font-size: 1.3rem;
  color: var(--ink); cursor: pointer; padding: 0; display: flex; align-items: center; gap: 4px;
  text-transform: uppercase; letter-spacing: -.01em; text-align: left;
}
.family-caret { font-size: 1rem; }
.home-stats-line { font-size: .8rem; font-weight: 700; margin-top: 2px; }
.me-tile {
  background: var(--pink); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; transform: rotate(4deg); cursor: pointer; flex-shrink: 0;
}
.resume-banner {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--ink); color: #fff; border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--pink);
  font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em;
  padding: 12px 14px; margin: 4px 0 14px; cursor: pointer; font-family: var(--ui);
}
.resume-banner::before {
  content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--lime);
  animation: blink 1s infinite; flex-shrink: 0;
}
.resume-banner .resume-cta { margin-left: auto; color: var(--lime); }
/* minmax(0,1fr): long one-word titles must not widen tracks past the container */
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin: 14px 0; }
.game-card {
  border: 3px solid var(--ink); border-radius: 0; padding: 18px 16px 14px;
  text-align: left; cursor: pointer; color: var(--ink);
  box-shadow: var(--shadow-card); min-height: 108px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  transition: transform .08s ease, box-shadow .08s ease;
  position: relative; background: #fff;
}
.game-card:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.game-emoji { display: none; }
.game-title { font-family: var(--display); font-size: 1.7rem; line-height: 1; text-transform: uppercase; letter-spacing: -.01em; }
.game-desc { font-size: .8rem; font-weight: 700; opacity: .95; margin-top: 4px; }
.join-cta { background: var(--paper); border-style: dashed; box-shadow: none; justify-content: space-between; }
.join-cta::after {
  content: 'JOIN'; background: var(--yellow); border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink); padding: 4px 12px; font-size: .78rem;
}
.home-links { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 20px; }
.home-link {
  font-weight: 700; text-decoration: none; border: 2px solid var(--ink);
  background: var(--paper); box-shadow: var(--shadow-chip); padding: 8px 14px;
  font-size: .8rem; text-transform: uppercase;
}
.seg-row { display: flex; gap: 10px; }
.seg {
  flex: 1; display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  background: #fff; border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  padding: 12px; cursor: pointer; font-family: var(--ui); font-size: .95rem;
  text-align: left; color: var(--ink);
}
.seg small { color: var(--muted); font-size: .72rem; font-weight: 600; }
.seg.selected { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); }
.seg-small { align-items: center; font-weight: 800; font-size: 1.1rem; font-family: var(--mono); }

/* ---------- room / lobby ---------- */
.offline-banner {
  background: var(--yellow); color: var(--ink); border: 3px solid var(--ink);
  font-weight: 700; text-align: center; padding: 8px; margin-bottom: 10px;
  font-size: .85rem; text-transform: uppercase; box-shadow: var(--shadow-chip);
}
.code-banner {
  display: flex; align-items: stretch; gap: 12px; margin-bottom: 14px;
}
.code-panel {
  flex: 1; background: var(--ink); color: #fff; border: 3px solid var(--ink);
  box-shadow: var(--shadow-card); padding: 12px 16px;
  display: flex; flex-direction: column; justify-content: center;
}
/* triple selector so per-world .hint recolors (often dark) can't win on the dark panel */
.code-banner .code-panel .hint { color: #c9c9c9; text-transform: uppercase; font-size: .68rem; letter-spacing: .12em; font-style: normal; font-family: var(--ui); }
.room-code { font-family: var(--mono); font-size: 2.3rem; font-weight: 700; letter-spacing: .18em; color: var(--lime); line-height: 1.1; }
.qr-side {
  background: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow-card);
  padding: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.qr-side svg { display: block; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px; }
.qr-box svg { border: 3px solid var(--ink); }
.teams-row { display: flex; gap: 12px; }
.team-col {
  flex: 1; background: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow-card);
  border-top-width: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
}
.team-name { font-family: var(--display); font-size: 1rem; text-transform: uppercase; }
.player-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-weight: 700; }
.player-row.disconnected { opacity: .4; }
.btn-kick { color: var(--red); font-size: .95rem; margin-left: auto; }
.lobby-footer { margin-top: 16px; }
.lobby-progress {
  border: 3px dashed var(--ink); padding: 10px 14px; margin: 12px 0;
  font-weight: 700; font-size: .85rem; text-transform: uppercase;
  display: flex; justify-content: space-between; gap: 8px;
}
.room-reactions {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: center;
  padding: 8px 0 calc(10px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.reaction-bar { display: flex; gap: 8px; pointer-events: auto; }
.reaction-btn {
  font-size: 1.3rem; background: #fff; border: 2px solid var(--ink);
  border-radius: 50%; width: 46px; height: 46px; cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink); transition: transform .08s;
}
.reaction-btn:active { transform: scale(1.2); }
.reaction-float {
  position: fixed; bottom: 70px; z-index: 40; font-size: 2.2rem; pointer-events: none;
  animation: floatup 2.5s ease-out forwards;
  display: flex; flex-direction: column; align-items: center;
}
/* sender's avatar carries the reaction in a speech bubble */
.reaction-bubble {
  position: relative; background: #fff; border: 2px solid var(--ink); border-radius: 12px;
  padding: 2px 9px; font-size: 1.4rem; line-height: 1.35; box-shadow: 2px 2px 0 var(--ink);
  margin-bottom: 8px;
}
.reaction-bubble::after {
  content: ''; position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: var(--ink); border-bottom: 0;
}
.reaction-avatar { font-size: 1.8rem; line-height: 1; }
@keyframes floatup {
  0% { transform: translateY(0) scale(.7); opacity: 0; }
  15% { opacity: 1; transform: translateY(-8vh) scale(1.15); }
  100% { transform: translateY(-55vh) scale(1); opacity: 0; }
}

/* ---------- shared game bits (worlds override) ---------- */
.round-banner {
  background: var(--ink); color: #fff; text-align: center;
  font-family: var(--display); font-size: .85rem; text-transform: uppercase;
  border: 3px solid var(--ink); padding: 8px; margin-bottom: 10px; letter-spacing: .06em;
}
.scoreboard { display: flex; gap: 12px; margin: 10px 0 14px; }
.score-team {
  flex: 1; color: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow-row);
  padding: 8px 14px 10px; text-align: left;
}
.score-team.active { box-shadow: 4px 4px 0 var(--lime); }
.score-team-name { font-family: var(--ui); font-weight: 700; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.score-team-points { font-family: var(--display); font-size: 2.1rem; line-height: 1.05; }
.up-next { border-width: 3px; }
.up-next-name { font-family: var(--display); font-size: 1.4rem; text-transform: uppercase; }
.up-next-team { font-weight: 700; }
.turn-strip {
  display: flex; justify-content: space-between; align-items: center;
  color: #fff; font-weight: 700; border: 3px solid var(--ink);
  padding: 10px 14px; margin-bottom: 8px; text-transform: uppercase; font-size: .8rem;
  letter-spacing: .04em; box-shadow: var(--shadow-row);
}
.turn-points { font-family: var(--display); font-size: 1.25rem; }

/* timer: numeric readout + striped progress bar */
.big-timer {
  text-align: center; font-family: var(--mono); font-size: 3.2rem; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.1; margin: 4px 0;
}
.big-timer.timer-warn { color: var(--ink); }
.big-timer.timer-danger { color: var(--red); }
.timer-panel {
  background: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow-row);
  padding: 8px 12px 12px; margin: 8px 0;
}
.timer-bar-track { border: 2px solid var(--ink); height: 20px; background: #fff; }
.timer-bar-fill {
  height: 100%; width: 100%;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 10px, var(--ink) 10px 12px);
}
.name-card {
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 10px 10px 0 var(--ink);
  font-family: Georgia, 'Times New Roman', serif; font-size: 2.1rem; font-weight: 700;
  text-align: center; padding: 44px 20px; margin: 16px 0 18px;
  word-break: break-word; min-height: 150px;
  display: flex; align-items: center; justify-content: center;
  animation: cardin .15s ease;
}
@keyframes cardin { from { transform: scale(.92) rotate(-1deg); } to { transform: none; } }
.turn-buttons { display: flex; gap: 12px; margin-top: 8px; }
.turn-buttons .btn { min-height: 76px; font-size: 1.1rem; font-family: var(--display); }
.btn-pass { flex: 1; background: var(--paper); }
.btn-heard { flex: 1.6; background: var(--lime); box-shadow: 6px 6px 0 var(--ink); }
.spectate-card { padding: 26px 16px; }
.winner-card {
  padding: 30px 18px; transform: rotate(-1.2deg); box-shadow: 10px 10px 0 var(--ink);
  position: relative; margin-top: 26px;
}
.winner-card::before {
  content: 'CHAMPIONS'; position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(2deg);
  background: var(--yellow); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  font-family: var(--display); font-size: .7rem; padding: 3px 12px; letter-spacing: .06em;
}
.winner-card h2 { font-size: 1.5rem; }
.name-reveal-row {
  display: flex; justify-content: space-between; gap: 8px; padding: 7px 0;
  border-bottom: 2px solid var(--disabled); font-weight: 600;
}
.name-reveal-row:last-child { border-bottom: none; }
.last-turn { padding: 8px 14px; }
.theme-banner {
  background: var(--orange); color: var(--ink); border: 3px solid var(--ink);
  box-shadow: var(--shadow-card); padding: 14px 16px; text-align: left; margin-bottom: 12px;
}
.theme-banner.compact { padding: 10px 14px; }
.theme-banner .hint { color: rgba(0,0,0,.55); text-transform: uppercase; font-size: .68rem; letter-spacing: .12em; }
.theme-text { font-family: var(--display); font-size: 1.25rem; line-height: 1.2; text-transform: uppercase; }
.guesser-strip {
  background: var(--yellow); border: 3px solid var(--ink); box-shadow: var(--shadow-row);
  padding: 10px 14px; text-align: center; margin-bottom: 10px; font-size: .9rem; font-weight: 700;
}
.guesser-strip.me { background: var(--lime); }
.answers-list { display: flex; flex-direction: column; gap: 10px; }
.answer-card {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow-row);
  padding: 12px 14px; font-weight: 600;
}
.answer-card.tappable { cursor: pointer; }
.answer-card.picked { background: var(--yellow); box-shadow: 4px 4px 0 var(--pink); }
.answer-card.revealed { background: var(--disabled); color: var(--muted); box-shadow: none; border-color: var(--muted-2); }
.answer-card.revealed .answer-text { text-decoration: line-through; }
.answer-num {
  background: var(--ink); color: #fff; font-family: var(--display); font-size: .85rem;
  min-width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.answer-text { flex: 1; word-break: break-word; }
.answer-author { font-size: .78rem; color: var(--muted); white-space: nowrap; font-weight: 700; }
.target-zone { margin: 14px 0; }
.target-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.target-btn { background: #fff; min-height: 58px; text-transform: none; }
.wins-row { margin-top: 16px; }

/* ---------- trivia base ---------- */
.trivia-timer { font-size: 1.8rem; margin: 0; text-align: left; }
.trivia-question { padding: 14px 4px; text-align: center; margin: 6px 0 14px; }
.trivia-question-text { font-family: var(--display); font-size: 1.5rem; line-height: 1.2; text-transform: uppercase; }
.trivia-choices { display: grid; grid-template-columns: 1fr; gap: 10px; }
.trivia-choice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: #fff; border: 3px solid var(--ink); padding: 14px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  font-family: var(--ui); color: var(--ink); min-height: 60px;
  box-shadow: var(--shadow-row); transition: transform .08s;
}
.trivia-choice:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.trivia-choice:disabled { cursor: default; }
.trivia-choice.picked { background: var(--yellow); }
.trivia-choice.correct { background: var(--lime); }
.trivia-choice.wrong-pick { background: #ffd9e6; }
.trivia-choice-letter {
  color: #fff; font-family: var(--display); min-width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.trivia-choice-text { flex: 1; }

/* ---------- two truths base ---------- */
.input-lie { border-color: var(--red); background: #fdf3ee; }
.answer-card.ttal-lie { border-color: var(--red); background: #fdf3ee; }
.answer-card.ttal-truth { opacity: .75; }
.answer-card.ttal-truth-highlight { border-color: var(--green); background: #eefbe7; }
.spotlight-card { padding: 20px 16px; }

/* ---------- scattergories base ---------- */
.scatter-letter-banner {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 8px 16px; margin-bottom: 6px; flex-wrap: wrap;
}
.scatter-letter {
  font-family: var(--display); font-size: 2.4rem;
  border: 3px solid var(--ink); box-shadow: var(--shadow-chip);
  padding: 2px 18px; background: #fff;
}
.scatter-form { gap: 8px; }
.scatter-row { display: flex; flex-direction: column; gap: 2px; }
.scatter-cat { font-weight: 700; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.scatter-answer {
  display: flex; align-items: center; gap: 8px; padding: 7px 0;
  border-bottom: 2px solid var(--disabled); font-weight: 600;
}
.scatter-answer:last-child { border-bottom: none; }
.scatter-answer-text { flex: 1; word-break: break-word; }
.scatter-answer.struck .scatter-answer-text { text-decoration: line-through; opacity: .5; }

/* ---------- doodlephone base ---------- */
.doodle-canvas {
  width: 100%; max-width: 400px; aspect-ratio: 1; margin: 0 auto;
  background: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow-row);
  touch-action: none; cursor: crosshair; display: block;
}
.doodle-board { align-items: center; }
.doodle-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.doodle-color {
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--ink);
  cursor: pointer; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.doodle-color.selected { transform: scale(1.18); box-shadow: 2px 2px 0 var(--ink); }
.doodle-size {
  width: 40px; height: 40px; border: 2px solid var(--ink); background: #fff; cursor: pointer;
}
.doodle-size.selected { background: var(--yellow); }
.doodle-img {
  width: 100%; max-width: 400px; border: 3px solid var(--ink); box-shadow: var(--shadow-row);
  background: #fff; display: block; margin: 8px auto;
}
.doodle-phrase { font-size: 1.2rem; font-weight: 800; text-align: center; padding: 8px; }
.doodle-gallery { display: flex; flex-direction: column; gap: 12px; }
.doodle-entry { animation: slideup .35s ease; }

/* ---------- werewolf base ---------- */
.role-card { padding: 10px; }
.role-details { margin-top: 8px; }
.role-details.hidden { display: none; }
.role-emoji { font-size: 1.6rem; }
.night-card { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.wolf-card { background: #2d1a1a; color: #f5dede; border-color: var(--red); }
.ghost-card { background: var(--disabled); }
.chip-dead { opacity: .5; }
.target-btn.target-picked { background: var(--yellow); }

/* ---------- telepathy base ---------- */
.clue-banner {
  background: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow-card);
  padding: 14px 16px; text-align: center; margin-bottom: 12px;
}

/* ---------- stats / hall of fame ---------- */
.stats-body { margin-top: 6px; }
.hof-header {
  margin: -14px -16px 14px; padding: 18px 16px; text-align: center;
  background: var(--yellow); border-bottom: 3px solid var(--ink);
}
.hof-header h1 { margin: 0; font-size: 1.5rem; text-transform: uppercase; }
.hof-header .hint { color: var(--ink); font-weight: 700; }
.leader-row { font-size: 1rem; position: relative; }
.leader-row.rank-1 { background: var(--yellow); transform: rotate(-1deg); box-shadow: 6px 6px 0 var(--ink); }
.leader-rank { font-family: var(--display); font-size: 1.2rem; min-width: 38px; }
.leader-name { flex: 1; font-family: var(--display); text-transform: uppercase; font-size: 1.05rem; }
.leader-stats { color: var(--muted); font-size: .8rem; font-weight: 700; }
.achievements-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.achievement {
  background: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow-row);
  padding: 12px; text-align: center;
}
.achievement:nth-child(odd) { transform: rotate(-1.2deg); }
.achievement:nth-child(even) { transform: rotate(1.2deg); }
.achievement:not(.earned) { background: var(--disabled); border-color: var(--muted-2); box-shadow: none; }
.achievement:not(.earned) .achievement-title, .achievement:not(.earned) .achievement-emoji { color: var(--muted-2); filter: grayscale(1); opacity: .8; }
.achievement.earned::after {
  content: 'EARNED'; display: inline-block; margin-top: 6px; background: var(--lime);
  border: 2px solid var(--ink); font-family: var(--display); font-size: .58rem;
  padding: 1px 8px; letter-spacing: .06em;
}
.achievement:not(.earned)::after {
  content: 'LOCKED'; display: inline-block; margin-top: 6px;
  border: 2px dashed var(--muted-2); color: var(--muted-2); font-family: var(--display);
  font-size: .58rem; padding: 1px 8px; letter-spacing: .06em;
}
.achievement-emoji { font-size: 1.7rem; }
.achievement-title { font-family: var(--display); font-size: .82rem; text-transform: uppercase; }
.achievement-desc { font-size: .72rem; color: var(--muted); font-weight: 600; }
.history-card { font-size: .95rem; }
.h2h-pickers { display: flex; align-items: center; gap: 10px; }
.h2h-vs { font-family: var(--display); color: var(--ink); }
.h2h-score { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 16px 0 4px; }
.h2h-side { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.h2h-wins { font-family: var(--display); font-size: 2.4rem; }

/* ---------- admin ---------- */
.theme-row.theme-off { opacity: .5; }

/* ---------- confetti ---------- */
.confetti-box { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -3vh; width: 11px; height: 15px; border: 2px solid var(--ink);
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall { to { transform: translateY(108vh) rotate(720deg); } }
.winner-shapes { position: relative; }
.winner-shapes .shape {
  position: absolute; border: 3px solid var(--ink); pointer-events: none; z-index: 0;
}

/* ---------- score module (quick/local styling lives in worlds.css) ---------- */
.score-round-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow-row);
  padding: 8px 10px; margin-bottom: 12px; font-family: var(--mono);
}
.score-list { display: flex; flex-direction: column; gap: 12px; }
.score-player-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow-row);
  padding: 10px 12px;
}
.score-player-info { display: flex; flex-direction: column; min-width: 0; }
.score-rank { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.score-name { font-family: var(--display); font-size: 1rem; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-round-pts { font-size: .72rem; color: var(--muted); font-weight: 700; }
.score-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.score-btn { width: 54px; height: 54px; font-size: 1.5rem; padding: 0; font-family: var(--mono); }
.score-btn.plus { background: var(--lime); }
.score-btn.minus { background: #fff; }
.score-total { font-family: var(--mono); font-size: 1.7rem; font-weight: 700; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
button.score-total { background: none; border: none; padding: 0 2px; color: inherit; cursor: pointer; }
.points-input { font-size: 1.8rem; max-width: 200px; }
.points-chips { margin-top: 2px; }
.score-add-row { display: flex; gap: 8px; margin-top: 14px; }
.score-add-row .input { flex: 1; }
.score-footer { margin-top: 16px; }
.timer-setup { font-size: 3rem; }
.timer-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 30px; width: 100%; height: 100%; background: var(--paper);
}
.fullscreen-timer { font-size: clamp(6rem, 32vw, 14rem); }

/* claims (shared scoresheet) */
.tappable { cursor: pointer; }
.btn-claim { background: var(--yellow); }
.claim-chip { display: inline-flex; align-items: center; gap: 2px; }
.claim-verify { font-size: .95rem; padding: 2px 4px; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.check-row input { width: 22px; height: 22px; accent-color: var(--ink); }
.rounds-scroll { overflow-x: auto; }
.rounds-table { border-collapse: collapse; font-size: .85rem; min-width: 100%; font-family: var(--mono); }
.rounds-table th, .rounds-table td {
  padding: 5px 9px; text-align: right; border-bottom: 2px solid var(--disabled); white-space: nowrap;
}
.rounds-table td:first-child, .rounds-table th:first-child { text-align: left; font-weight: 700; }
.rounds-table tr:last-child td { border-bottom: none; }

/* ---------- tv mode (shell defaults; worlds tint) ---------- */
.tv-screen { max-width: 1100px; padding: 3vh 4vw; text-align: center; }
.tv-title { font-size: clamp(1.8rem, 5vw, 3rem); margin-bottom: 3vh; text-transform: uppercase; }
.tv-back { position: fixed; top: 12px; left: 12px; }
.tv-lobby { display: flex; gap: 5vw; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
.tv-qr { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tv-qr svg { border: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.tv-code { font-family: var(--mono); font-size: clamp(2.5rem, 7vw, 4.5rem); font-weight: 700; letter-spacing: .25em; }
.tv-roster { text-align: left; min-width: 260px; }
.tv-player { font-size: clamp(1.2rem, 3vw, 1.8rem); font-weight: 700; padding: 6px 0; display: flex; gap: 10px; align-items: center; }
.tv-scoreboard { display: flex; gap: 2vw; justify-content: center; margin-bottom: 2vh; }
.tv-team { color: #fff; border: 4px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); padding: 2vh 5vw; min-width: 30vw; }
.tv-team-name { font-size: clamp(1.2rem, 3vw, 2rem); font-family: var(--display); text-transform: uppercase; }
.tv-team-score { font-size: clamp(3.5rem, 10vw, 7rem); font-family: var(--display); line-height: 1; }
.tv-round-banner { font-size: clamp(1.2rem, 3vw, 2rem); font-family: var(--display); background: var(--ink); color: #fff; border: 3px solid var(--ink); padding: 1vh; margin: 1.5vh auto; max-width: 600px; text-transform: uppercase; }
.tv-timer { font-size: clamp(6rem, 20vw, 13rem); }
.tv-active-player { font-size: clamp(1.4rem, 4vw, 2.4rem); font-family: var(--display); display: flex; align-items: center; justify-content: center; gap: 14px; }
.tv-active-emoji { font-size: clamp(2.5rem, 6vw, 4rem); }
.tv-between { display: flex; flex-direction: column; gap: 1.5vh; margin-top: 3vh; }
.tv-sub { font-size: clamp(1.1rem, 2.6vw, 1.7rem); color: var(--muted); font-weight: 700; }
.tv-winner { color: var(--ink); font-family: var(--display); }
.tv-big-number { font-size: clamp(4rem, 14vw, 9rem); font-family: var(--display); line-height: 1.1; }
.tv-theme {
  font-size: clamp(1.5rem, 4.5vw, 2.6rem); font-family: var(--display); color: var(--ink);
  background: var(--orange); border: 4px solid var(--ink); box-shadow: 10px 10px 0 var(--ink);
  padding: 2vh 3vw; margin-bottom: 2.5vh; text-transform: uppercase;
}
.tv-answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; text-align: left; }
.tv-answer {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); padding: 14px 18px;
  font-size: clamp(1rem, 2.4vw, 1.5rem); font-weight: 700;
}
.tv-answer.revealed { background: var(--disabled); box-shadow: none; }
.tv-answer.revealed .answer-text { text-decoration: line-through; }
.tv-answer-lie { border-color: var(--red); box-shadow: 6px 6px 0 var(--red); }
.tv-answer-correct { border-color: var(--ink); box-shadow: 6px 6px 0 var(--lime); background: var(--lime); }
.tv-trivia-timer { font-size: clamp(3rem, 8vw, 5rem); margin: 0; }
.tv-scatter-cell { align-items: flex-start; font-size: clamp(.85rem, 1.8vw, 1.1rem); }
.tv-scatter-entry.struck { text-decoration: line-through; opacity: .45; }
.tv-doodle-strip { display: flex; gap: 16px; overflow-x: auto; padding: 10px 0; align-items: flex-start; }
.tv-doodle-item { flex: 0 0 auto; max-width: 320px; text-align: center; }
.tv-doodle-img { width: 280px; border: 3px solid var(--ink); background: #fff; box-shadow: 6px 6px 0 var(--ink); }
.tv-doodle-phrase {
  background: #fff; border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
  padding: 20px 16px; font-size: 1.2rem; font-family: var(--display); max-width: 280px;
}
.tv-score-list { max-width: 700px; margin: 0 auto 3vh; display: flex; flex-direction: column; gap: 12px; }
.tv-score-row {
  display: flex; align-items: center; gap: 16px; background: #fff;
  border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); padding: 1.2vh 24px;
  font-size: clamp(1.2rem, 3.2vw, 2rem); font-family: var(--display);
}
.tv-score-row.leading { background: var(--yellow); transform: rotate(-.6deg); }
.tv-score-rank { min-width: 50px; }
.tv-score-name { flex: 1; text-align: left; }
.tv-score-total { font-variant-numeric: tabular-nums; font-family: var(--mono); font-weight: 700; }
.tv-dead { opacity: .4; }

/* ---------- tablet: stage + rail ---------- */
@media (min-width: 700px) {
  .screen { max-width: 640px; }
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .game-card { min-height: 150px; }
  .target-grid { grid-template-columns: 1fr 1fr 1fr; }
  .achievements-grid { grid-template-columns: 1fr 1fr 1fr; }
  .screen.has-rail { max-width: 1100px; }
  .game-split { display: flex; gap: 0; border: 3px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); background: #fff; }
  .game-rail { width: 270px; flex-shrink: 0; border-right: 3px solid var(--ink); padding: 16px; }
  .game-stage { flex: 1; padding: 20px; min-height: 60vh; display: flex; flex-direction: column; justify-content: center; }
}
