/*
 * Bingo — one bright party theme, light and dark. Phones first: everything
 * is laid out for a ~375px screen and simply gets more room on bigger ones.
 */

:root {
  --bg: #fff4e0;
  --bg-2: #ffe9c7;
  --surface: #ffffff;
  --ink: #2a1f3d;
  --muted: #6f6485;
  --line: #eedcc0;
  --primary: #ff3f73;
  --primary-2: #e62a5e;
  --primary-ink: #ffffff;
  --accent: #19b3a1;
  --gold: #ffb800;
  --gold-soft: #fff0bf;
  --danger: #d6344b;
  --cell: #fffdf8;
  --cell-ink: #2a1f3d;
  --frame: #7a5cff;
  --frame-2: #5b3de0;
  --stamp: rgba(255, 63, 115, 0.62);
  --stamp-edge: rgba(230, 42, 94, 0.9);
  --free: #ffe7a3;
  --shadow: 0 1px 2px rgba(42, 31, 61, 0.06), 0 6px 18px rgba(42, 31, 61, 0.08);
  --radius: 16px;
  --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1530;
    --bg-2: #241b3d;
    --surface: #2a2146;
    --ink: #f6efff;
    --muted: #b3a8cc;
    --line: #3e3363;
    --primary: #ff5c8a;
    --primary-2: #ff4077;
    --accent: #3ad6c2;
    --gold: #ffc93c;
    --gold-soft: #4a3d1a;
    --danger: #ff6b7f;
    --cell: #332a55;
    --cell-ink: #f6efff;
    --frame: #6d52f0;
    --frame-2: #4f37c7;
    --stamp: rgba(255, 92, 138, 0.55);
    --stamp-edge: rgba(255, 64, 119, 0.95);
    --free: #5a4a1c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  background-image: radial-gradient(circle at 12% 0%, var(--bg-2), transparent 45%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
}

html.modal-open { overflow: hidden; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; }
h1 { font-size: 1.75rem; }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.dashboard > .small { margin-top: 16px; }
.spacer { flex: 1; }

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.brand-ball, .hero-ball {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8fb0, var(--primary) 55%, var(--primary-2));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.brand-ball { width: 32px; height: 32px; font-size: 1.1rem; }
.brand-title { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; }

.header-actions { margin-left: auto; display: flex; gap: 4px; }

/* ----------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 700 1rem var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover:not(:disabled) { background: var(--primary-2); border-color: var(--primary-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.big { min-height: 54px; font-size: 1.1rem; width: 100%; }

.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 3px solid currentColor;
  border-color: var(--muted) transparent var(--muted) transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn.primary.busy::after { border-color: #fff transparent #fff transparent; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.icon-btn:disabled { opacity: 0.3; cursor: default; background: none; }
.icon-btn.small { width: 36px; height: 36px; }
.icon-btn.danger { color: var(--danger); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------------ inputs */

.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 600 1rem var(--font-body);
}
.input:focus { outline: none; border-color: var(--accent); }
.input.big { min-height: 54px; font-size: 1.15rem; }
textarea.input { resize: vertical; line-height: 1.4; }

.field-label { display: block; font-weight: 800; margin: 0 0 6px; }
.form-error { color: var(--danger); font-weight: 700; min-height: 1.2em; margin: 6px 0; }

.section-label {
  font-size: 0.8rem;
  font-family: var(--font-body);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 24px 0 8px;
}

/* ------------------------------------------------------------------- pages */

.outlet { padding-bottom: env(safe-area-inset-bottom); }

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px 40px;
}

.page.center, .boot { display: grid; place-items: center; min-height: 60vh; }

.page.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding-top: 12vh;
}
.page.empty p { color: var(--muted); max-width: 30em; }
.empty-art { color: var(--muted); }

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 16px;
}
.page-head h1 { flex: 1; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 4px 0 12px -4px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.empty-inline {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

/* ------------------------------------------------------------------- cards */

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cards.faded .card { opacity: 0.75; }

.card {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 14px 44px 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.card-meta { color: var(--muted); font-size: 0.9rem; }
.card-winners { color: var(--ink); font-size: 0.9rem; font-weight: 700; display: flex; align-items: center; }
.card-winners .icon { color: var(--gold); }
.card-go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* ---------------------------------------------------------------- landing */

.landing { display: flex; flex-direction: column; gap: 28px; padding-top: 4vh; }

.hero { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.hero-ball { width: 96px; height: 96px; font-size: 3.2rem; animation: bob 3s ease-in-out infinite; }
.hero-title { font-size: 2.6rem; font-weight: 700; }
.hero-sub { color: var(--muted); font-weight: 700; }

@keyframes bob { 50% { transform: translateY(-6px) rotate(-6deg); } }

.code-form { padding: 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.code-row { display: flex; gap: 8px; }
.code-row .input { flex: 1; min-width: 0; font-family: var(--font-display); letter-spacing: 0.12em; text-transform: lowercase; }

.host-cta { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; color: var(--muted); }

/* ------------------------------------------------------------------- join */

.join { display: flex; flex-direction: column; gap: 20px; padding-top: 3vh; }

.join-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 18px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.join-badge {
  align-self: center;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--frame);
  color: #fff;
}
.join-title { font-size: 1.9rem; }
.join-meta { color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.join-form { display: flex; flex-direction: column; text-align: left; }
.ended-text { font-weight: 800; margin-bottom: 8px; }

.name-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.name-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 700;
}
.host-link { display: flex; justify-content: center; }

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: hsl(var(--hue) 75% 58%);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

/* ------------------------------------------------------------------- play */

.play {
  max-width: 600px;
  padding: 4px 12px calc(120px + env(safe-area-inset-bottom));
}

.play-head { display: flex; align-items: flex-start; gap: 8px; padding: 0 4px; }
.play-head > div { flex: 1; min-width: 0; }
.play-title { font-size: 1.35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-meta { color: var(--muted); font-size: 0.85rem; font-weight: 700; }

.offline {
  display: none;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}
.offline.show { display: inline-block; }

.players {
  display: flex;
  gap: 8px;
  margin: 10px -12px 12px;
  padding: 2px 12px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-padding: 12px;
}
.players::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 180px;
  padding: 5px 14px 5px 5px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.chip.me { border-color: var(--line); }
.chip.won { border-color: var(--gold); background: var(--gold-soft); }
.chip-text { display: grid; min-width: 0; line-height: 1.15; }
.chip-name { font-weight: 800; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-sub { font-size: 0.75rem; color: var(--muted); font-weight: 700; display: flex; align-items: center; }
.chip.won .chip-sub { color: var(--ink); }
.chip.won .chip-sub .icon { color: var(--gold); }

.hint { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 10px 0 0; }

/* ------------------------------------------------------------------ board */

.board-wrap { display: flex; justify-content: center; }

.board {
  --gap: 5px;
  display: grid;
  grid-template-columns: repeat(var(--size), minmax(0, 1fr));
  gap: var(--gap);
  width: min(100%, 560px, max(290px, calc(100dvh - 290px)));
  aspect-ratio: 1;
  padding: var(--gap);
  border-radius: 18px;
  background: linear-gradient(160deg, var(--frame), var(--frame-2));
  box-shadow: 0 8px 24px rgba(91, 61, 224, 0.28);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.board[style*="--size:3"] { --gap: 7px; }
.board.mini { --gap: 3px; width: 100%; border-radius: 12px; box-shadow: none; }

.cell {
  position: relative;
  display: grid;
  /* One column exactly as wide as the square, so a long word overflows
     (and gets measured, and shrunk) instead of widening the column. */
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  padding: 3px;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: var(--cell);
  color: var(--cell-ink);
  font: inherit;
  text-align: center;
  touch-action: manipulation;
}
.board.mini .cell { border-radius: 6px; padding: 2px; }
button.cell { cursor: pointer; }
button.cell:active { transform: scale(0.96); }

.cell-text {
  position: relative;
  z-index: 2;
  display: block;
  max-width: 100%;
  font-family: var(--font-body);
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
}
.cell.squashed .cell-text {
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.cell.has-img { padding: 0; }
.cell-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cell.has-img .cell-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 3px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell.free { background: var(--free); }
.free-star { position: absolute; font-size: 2.2em; color: var(--gold); opacity: 0.5; z-index: 1; }
.cell.free .cell-text { font-family: var(--font-display); letter-spacing: 0.05em; }

/* The dauber: a translucent blot that pops onto a stamped square. */
.stamp {
  position: absolute;
  inset: 7%;
  z-index: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, var(--stamp), var(--stamp) 62%, var(--stamp-edge) 64%, transparent 71%);
  transform: scale(0) rotate(-25deg);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.3, 1.6, 0.5, 1), opacity 0.15s;
  pointer-events: none;
}
.cell.stamped .stamp { transform: scale(1) rotate(0); opacity: 1; }
.cell.has-img .stamp { z-index: 1; }
.cell.free .stamp { display: none; }

.cell.in-line { box-shadow: inset 0 0 0 3px var(--gold); }
.board.mini .cell.in-line { box-shadow: inset 0 0 0 2px var(--gold); }
.board.ended .cell { cursor: default; }
.board.ended button.cell:active { transform: none; }

/* ------------------------------------------------------------ bingo button */

.bingo-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  display: flex;
  justify-content: center;
}

.bingo-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 460px);
  padding: 10px 20px;
  border: 0;
  border-radius: 22px;
  background: var(--line);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: transform 0.12s, background 0.2s;
}
.bingo-word { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; letter-spacing: 0.06em; line-height: 1.1; }
.bingo-sub { font-weight: 700; font-size: 0.8rem; }

.bingo-btn.ready {
  background: linear-gradient(160deg, #ff7aa0, var(--primary) 50%, var(--primary-2));
  color: #fff;
  box-shadow: 0 8px 22px rgba(255, 63, 115, 0.45);
  animation: pulse 1.1s ease-in-out infinite;
}
.bingo-btn.ready:active { transform: scale(0.97); animation: none; }
.bingo-btn.won { background: var(--gold-soft); color: var(--ink); box-shadow: inset 0 0 0 2px var(--gold); cursor: default; }

@keyframes pulse { 50% { transform: scale(1.035); } }

/* --------------------------------------------------------------- banners */

.banner {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(calc(100% - 24px), 420px);
  padding: 12px 18px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  border: 3px solid var(--gold);
  transform: translate(-50%, -140%);
  transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1);
  cursor: pointer;
}
.banner.in { transform: translate(-50%, 0); }
.banner strong { display: block; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.banner-emoji { font-size: 2rem; }
.banner-sub { color: var(--muted); font-weight: 700; font-size: 0.9rem; }

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

/* ------------------------------------------------------------- game over */

.over-card {
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.over-card h2 { font-size: 1.5rem; margin-bottom: 10px; }

.standings { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.standing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.over-card .standing, .join-card .standing { box-shadow: none; background: color-mix(in srgb, var(--ink) 5%, transparent); }
.standing.won { background: var(--gold-soft) !important; }
.place { width: 30px; text-align: center; font-weight: 800; color: var(--muted); display: grid; place-items: center; }
.standing.won .place { color: var(--gold); }
.st-name { flex: 1; font-weight: 800; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-sub { color: var(--muted); font-weight: 700; font-size: 0.85rem; }
.standing.won .st-sub { color: var(--ink); }

/* ----------------------------------------------------------------- peeks */

.peek { display: grid; gap: 12px; }
.peek-status { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--muted); }

.item-view { display: grid; gap: 12px; justify-items: center; text-align: center; }
.item-view img { border-radius: 12px; max-height: 50vh; object-fit: contain; }
.item-text { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; line-height: 1.2; }

/* ----------------------------------------------------------- list editor */

.editor h1 { margin-bottom: 18px; }

.add-box { margin-top: 8px; }
.add-box .section-label { margin-top: 20px; }
.add-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.fit-note { color: var(--muted); font-weight: 700; font-size: 0.9rem; margin: -2px 0 10px; }
.fit-note.bad { color: var(--danger); }

.item-rows { list-style: none; margin: 0 0 90px; padding: 0; display: grid; gap: 8px; }
.item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.item-row .row-text { flex: 1; min-width: 0; min-height: 40px; border-color: transparent; background: transparent; padding: 8px; }
.item-row .row-text:focus { border-color: var(--accent); background: var(--surface); }
.row-tools { display: flex; }

.thumb {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px dashed var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  overflow: hidden;
  cursor: pointer;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:not(.add) { border-style: solid; }
.thumb-x {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}

.save-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  display: flex;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 75%, transparent);
}

@media (max-width: 380px) {
  .row-tools .icon-btn.small { width: 30px; }
}

/* -------------------------------------------------------------- new game */

.new-game { display: flex; flex-direction: column; }
.new-game > .btn.big { margin-top: 8px; }

.choice-list { display: grid; gap: 8px; }
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
}
.choice.on { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.choice input { accent-color: var(--primary); width: 18px; height: 18px; margin: 0; }
.choice-name { flex: 1; font-weight: 800; }
.choice-meta { color: var(--muted); font-size: 0.9rem; font-weight: 700; }

.segmented { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.seg {
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 700 1.05rem var(--font-display);
  cursor: pointer;
}
.seg.on { background: var(--frame); color: #fff; }

.toggle-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; font-weight: 700; cursor: pointer; }
.toggle-row input { width: 22px; height: 22px; accent-color: var(--primary); margin: 0; }
.toggle-row.disabled { opacity: 0.5; cursor: default; }

.new-game .fit-note { margin: 12px 0 8px; }

/* ------------------------------------------------------------- host game */

.host-game h1 { font-size: 1.9rem; }

.share-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  padding: 4px 18px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.share-card .section-label { margin-top: 16px; margin-bottom: 0; }
.link-box { font-size: 0.9rem; }
.share-actions { display: flex; gap: 8px; }
.share-actions .btn { flex: 1; }
.code { font-family: var(--font-display); letter-spacing: 0.1em; color: var(--ink); }

.danger-zone { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }

/* ----------------------------------------------------------------- dialogs */

.dialog {
  width: min(calc(100% - 24px), 520px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  animation: pop 0.18s ease-out;
}
.dialog.small { width: min(calc(100% - 24px), 400px); }
.dialog::backdrop { background: rgba(20, 12, 40, 0.5); }
.dialog.closing { opacity: 0; transform: scale(0.97); transition: opacity 0.15s, transform 0.15s; }
.dialog-inner { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.dialog-head { display: flex; align-items: center; gap: 8px; padding: 14px 10px 6px 20px; }
.dialog-head h2 { flex: 1; font-size: 1.3rem; }
.dialog-body { padding: 6px 20px 20px; overflow-y: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; }
.peek-dialog .dialog-body { padding: 4px 14px 14px; }

@keyframes pop { from { opacity: 0; transform: scale(0.96); } }

.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form p:first-child { color: var(--muted); }
.confirm-text { color: var(--ink); }

/* ------------------------------------------------------------------ toasts */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(calc(100% - 24px), 420px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: auto;
}
.toast.in { opacity: 1; transform: none; }
.toast.bad { background: var(--danger); color: #fff; }
.toast-action { border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------------------------------------------------------------- spinner */

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner.large { width: 40px; height: 40px; border-width: 4px; }
.thumb.busy { border-style: solid; }

@keyframes spin { to { transform: rotate(360deg); } }

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