:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --surface-strong: #fcf7ea;
  --ink: #172022;
  --muted: #667174;
  --line: #dbe1da;
  --accent: #0f8b8d;
  --accent-dark: #0a6466;
  --sun: #f5b942;
  --coral: #ef6f6c;
  --green: #2f9e62;
  --danger: #c24134;
  --shadow: 0 18px 50px rgba(25, 32, 28, 0.11);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101412;
  --surface: #19201d;
  --surface-strong: #20261f;
  --ink: #f3f7f2;
  --muted: #a7b3ad;
  --line: #344039;
  --accent: #2db8b3;
  --accent-dark: #85ded8;
  --sun: #f0b84f;
  --coral: #f07976;
  --green: #48b878;
  --danger: #ff8a7e;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
}

:root[data-profile-theme="rose"] {
  --accent: #d65b7c;
  --accent-dark: #9f2949;
  --surface-strong: #fff0f4;
}

:root[data-profile-theme="ocean"] {
  --accent: #277da1;
  --accent-dark: #15556f;
  --surface-strong: #eef8fb;
}

:root[data-profile-theme="sunset"] {
  --accent: #d97735;
  --accent-dark: #9a4817;
  --surface-strong: #fff3e8;
}

:root[data-theme="dark"][data-profile-theme="rose"] {
  --accent: #ff82a3;
  --accent-dark: #ffb3c5;
  --surface-strong: #2a1c22;
}

:root[data-theme="dark"][data-profile-theme="ocean"] {
  --accent: #5bc0eb;
  --accent-dark: #a2def4;
  --surface-strong: #182932;
}

:root[data-theme="dark"][data-profile-theme="sunset"] {
  --accent: #ff9b54;
  --accent-dark: #ffd0ae;
  --surface-strong: #2b2119;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(15, 139, 141, 0.08), transparent 36%),
    linear-gradient(315deg, rgba(245, 185, 66, 0.14), transparent 32%),
    var(--bg);
  color: var(--ink);
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(135deg, rgba(45, 184, 179, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(240, 184, 79, 0.08), transparent 32%),
    var(--bg);
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--sun);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 0.9rem;
}

.theme-toggle {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 13px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 850;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.site-nav {
  display: flex;
  flex: 1;
  justify-content: flex-end;
  gap: 6px;
}

.site-nav a {
  border-radius: var(--radius);
  padding: 9px 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: var(--surface-strong);
  color: var(--ink);
  outline: none;
}

.hub-shell,
.game-shell,
.soon-shell,
.utility-shell,
.together-shell,
.drawing-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.utility-shell {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.together-shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.together-shell .panel {
  grid-column: 1 / -1;
}

.drawing-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.hub-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
  align-items: center;
  gap: 28px;
  min-height: 360px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.35rem, 7vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 620px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.hero-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  aspect-ratio: 1;
  padding: 12px;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: rotate(2deg);
}

.hero-board span {
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #edf2ef;
  color: var(--accent-dark);
  font-size: clamp(1.8rem, 6vw, 3.6rem);
  font-weight: 900;
}

:root[data-theme="dark"] .hero-board span,
:root[data-theme="dark"] .pill.muted,
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .shared-note,
:root[data-theme="dark"] .inline-form input,
:root[data-theme="dark"] .player-badge,
:root[data-theme="dark"] .cell,
:root[data-theme="dark"] .bingo-cell,
:root[data-theme="dark"] .number-chip,
:root[data-theme="dark"] .choice-btn,
:root[data-theme="dark"] .bingo-word span {
  background: #121815;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.game-card {
  display: flex;
  min-height: 190px;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.game-card:hover,
.game-card:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  outline: none;
}

.game-card.is-ready {
  background: var(--surface-strong);
}

.home-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.tool-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
  text-decoration: none;
}

.tool-card:hover,
.tool-card:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  outline: none;
}

.tool-card small {
  color: var(--muted);
  line-height: 1.45;
}

.game-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--sun);
  color: var(--ink);
  font-weight: 900;
}

.grid-icon {
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 7px;
  background: var(--accent);
}

.grid-icon i {
  aspect-ratio: 1;
  border-radius: 3px;
  background: #fff;
}

.connect-icon {
  background:
    radial-gradient(circle at 32% 32%, var(--coral) 0 17%, transparent 18%),
    radial-gradient(circle at 68% 32%, var(--sun) 0 17%, transparent 18%),
    radial-gradient(circle at 32% 68%, var(--sun) 0 17%, transparent 18%),
    radial-gradient(circle at 68% 68%, var(--coral) 0 17%, transparent 18%),
    var(--accent);
}

.quiz-icon {
  background: var(--coral);
  font-size: 2rem;
}

.ship-icon {
  background:
    linear-gradient(90deg, transparent 16%, var(--ink) 17% 24%, transparent 25% 42%, var(--ink) 43% 50%, transparent 51%),
    linear-gradient(145deg, transparent 0 35%, var(--accent) 36% 66%, transparent 67%),
    var(--sun);
}

.word-icon {
  background: var(--green);
  color: white;
}

.game-info strong,
.game-info small {
  display: block;
}

.game-info strong {
  font-size: 1.18rem;
}

.game-info small {
  margin-top: 6px;
  color: var(--muted);
}

.pill {
  align-self: flex-start;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.78rem;
  font-weight: 800;
}

.pill.muted {
  background: #e9eeea;
  color: var(--muted);
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  align-items: start;
  gap: 22px;
}

.panel,
.game-panel,
.soon-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 26px rgba(25, 32, 28, 0.08);
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .game-panel,
:root[data-theme="dark"] .soon-panel {
  background: rgba(25, 32, 29, 0.92);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel h1 {
  font-size: 2.2rem;
  line-height: 1.05;
}

.panel-copy,
.small-note {
  color: var(--muted);
  line-height: 1.5;
}

.form-stack {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 800;
}

.field input,
.field select,
.shared-note,
.inline-form input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 13px;
  background: white;
  color: var(--ink);
  text-transform: none;
}

.field input[type="color"] {
  padding: 4px;
}

.field input[type="range"] {
  padding: 0;
}

.shared-note {
  min-height: 180px;
  padding: 13px;
  line-height: 1.5;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.shared-note:focus,
.inline-form input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 139, 141, 0.18);
}

.button-row,
.room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 16px;
  background: #e9eeea;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.btn.primary {
  background: var(--accent);
  color: white;
}

.btn.warning {
  background: var(--coral);
  color: white;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.status-box {
  margin-top: 18px;
  border-radius: var(--radius);
  padding: 13px;
  background: #eef6f5;
  color: var(--accent-dark);
  font-weight: 800;
}

.status-box.error {
  background: #fff0ee;
  color: var(--danger);
}

.profile-list,
.reminder-list,
.checkin-list {
  display: grid;
  gap: 10px;
}

.profile-card,
.reminder-item,
.mini-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.profile-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: center;
  padding: 14px;
  color: var(--ink);
  text-align: left;
}

.profile-card span {
  grid-row: span 2;
  font-size: 2rem;
}

.profile-card small,
.reminder-item small,
.mini-card small,
.idea-list small {
  color: var(--muted);
}

.reminder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.reminder-item.done {
  opacity: 0.68;
}

.reminder-item.done strong {
  text-decoration: line-through;
}

.reminder-item p,
.mini-card p {
  margin: 6px 0;
  color: var(--muted);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.idea-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.idea-list li,
.mini-card {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.drawing-tools {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.drawing-panel {
  padding: 10px;
}

.drawing-canvas {
  display: block;
  width: 100%;
  height: min(72vh, 720px);
  min-height: 460px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: #fffdf7;
  touch-action: none;
}

:root[data-theme="dark"] .drawing-canvas {
  background: #101412;
}

.room-strip {
  display: none;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  padding: 12px;
}

.room-strip.is-visible {
  display: flex;
}

.room-code {
  font-size: 1.8rem;
  font-weight: 950;
  letter-spacing: 0;
}

.game-panel {
  padding: 16px;
}

.match-topbar {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.player-badge {
  display: grid;
  min-width: 110px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: white;
}

.player-badge strong {
  font-size: 0.84rem;
}

.player-badge span {
  color: var(--muted);
  font-size: 0.78rem;
}

.player-badge.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(15, 139, 141, 0.16);
}

.board-wrap {
  display: grid;
  place-items: center;
}

.ttt-board {
  display: grid;
  width: min(100%, 520px);
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  aspect-ratio: 1;
}

.cell {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  font-size: clamp(2.4rem, 13vw, 6.5rem);
  font-weight: 950;
  line-height: 1;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.cell:not(:disabled):hover,
.cell:not(:disabled):focus-visible {
  border-color: var(--accent);
  background: #f0fbfa;
  transform: scale(0.985);
  outline: none;
}

.cell:disabled {
  cursor: default;
}

.cell.mark-x {
  color: var(--accent-dark);
}

.cell.mark-o {
  color: var(--coral);
}

.cell.win {
  background: #fff4cf;
  border-color: var(--sun);
}

.connect-stack {
  display: grid;
  width: min(100%, 620px);
  gap: 8px;
}

.drop-controls {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.drop-btn {
  min-height: 42px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--sun);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.drop-btn:not(:disabled):hover,
.drop-btn:not(:disabled):focus-visible {
  background: #ffe29a;
  outline: none;
  transform: translateY(-2px);
}

.connect-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--accent);
}

.c4-cell {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: white;
  transition: transform 120ms ease, background 120ms ease;
}

.c4-cell.red {
  background: var(--coral);
}

.c4-cell.yellow {
  background: var(--sun);
}

.c4-cell.win {
  box-shadow: inset 0 0 0 5px white;
}

.section-title {
  margin: 0 0 10px;
  font-size: 1rem;
  line-height: 1.2;
}

.bingo-play,
.ocean-layout {
  display: grid;
  gap: 18px;
}

.bingo-play {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.bingo-play > div,
.ocean-layout > div {
  min-width: 0;
}

.ocean-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bingo-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-bottom: 18px;
}

.call-grid {
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-auto-flow: column;
  grid-auto-columns: 54px;
  gap: 7px;
  overflow-x: auto;
  padding: 4px 2px 10px;
}

.bingo-cell,
.number-chip {
  display: grid;
  aspect-ratio: 1;
  min-width: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  font-weight: 850;
}

.bingo-cell.marked,
.number-chip.called {
  background: var(--green);
  color: white;
}

.bingo-line {
  position: absolute;
  z-index: 2;
  display: block;
  border-radius: 999px;
  background: var(--coral);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

.bingo-line.row {
  left: 3%;
  top: calc((var(--line-index) * 20%) + 10%);
  width: 94%;
  height: 5px;
  transform: translateY(-50%);
}

.bingo-line.col {
  top: 3%;
  left: calc((var(--line-index) * 20%) + 10%);
  width: 5px;
  height: 94%;
  transform: translateX(-50%);
}

.bingo-line.diag-down,
.bingo-line.diag-up {
  top: 50%;
  left: 50%;
  width: 132%;
  height: 5px;
}

.bingo-line.diag-down {
  transform: translate(-50%, -50%) rotate(45deg);
}

.bingo-line.diag-up {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.bingo-word {
  display: grid;
  gap: 8px;
}

.bingo-word span {
  position: relative;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  font-size: 1.65rem;
  font-weight: 950;
}

.bingo-word span.crossed {
  background: #fff4cf;
  color: var(--muted);
}

.bingo-word span.crossed::after {
  position: absolute;
  width: 82%;
  height: 5px;
  border-radius: 999px;
  background: var(--coral);
  content: "";
  transform: rotate(-12deg);
}

.number-chip:not(:disabled):hover,
.number-chip:not(:disabled):focus-visible {
  border-color: var(--accent);
  background: #eef9f7;
  outline: none;
}

.quiz-question {
  min-height: 88px;
  margin: 0 0 18px;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  line-height: 1.12;
}

.word-round {
  display: grid;
  grid-template-columns: minmax(110px, 160px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.round-letter {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--sun);
  color: var(--ink);
  font-size: clamp(3.2rem, 11vw, 6rem);
  font-weight: 950;
}

.word-form {
  display: grid;
  gap: 10px;
}

.answer-reveal {
  margin-top: 18px;
  overflow-x: auto;
}

.word-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

.word-table th,
.word-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
}

.word-table th {
  color: var(--muted);
  font-size: 0.82rem;
}

.word-table strong {
  color: var(--green);
}

.next-round-btn {
  display: none;
}

.next-round-btn.is-visible {
  display: inline-block;
}

.choices {
  display: grid;
  gap: 10px;
}

.choice-btn {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: white;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.choice-btn:not(:disabled):hover,
.choice-btn:not(:disabled):focus-visible,
.choice-btn.selected {
  border-color: var(--accent);
  background: #eef9f7;
  outline: none;
}

.ocean-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.ocean-cell {
  display: grid;
  aspect-ratio: 1;
  min-width: 0;
  place-items: center;
  border: 1px solid #b8d4de;
  border-radius: 6px;
  background: #e7f7fb;
  color: var(--ink);
  font-weight: 900;
}

.ocean-cell.ship {
  background: #9aa6a8;
  border-color: var(--ink);
}

.ocean-cell.hit {
  background: var(--coral);
  border-color: var(--danger);
  color: white;
}

.ocean-cell.miss {
  background: #d2e9f2;
}

:root[data-theme="dark"] .ocean-cell {
  background: #16313a;
  border-color: #33535c;
}

:root[data-theme="dark"] .ocean-cell.miss {
  background: #223d46;
}

.target .ocean-cell:not(:disabled):hover,
.target .ocean-cell:not(:disabled):focus-visible {
  border-color: var(--accent);
  background: #cceff4;
  outline: none;
}

.post-game {
  display: none;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.post-game.is-visible {
  display: flex;
}

.soon-shell {
  display: grid;
  min-height: 70vh;
  place-items: center;
}

.soon-panel {
  width: min(620px, 100%);
  padding: 24px;
}

.soon-panel h1 {
  font-size: clamp(2.2rem, 9vw, 4.6rem);
}

@media (max-width: 900px) {
  .hub-hero,
  .game-shell,
  .utility-shell,
  .together-shell,
  .drawing-shell,
  .drawing-shell {
    grid-template-columns: 1fr;
  }

  .site-header {
    flex-wrap: wrap;
  }

  .site-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .hero-board {
    width: min(330px, 100%);
  }

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-tools {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .site-header,
  .hub-shell,
  .game-shell,
  .soon-shell,
  .utility-shell,
  .together-shell,
  .drawing-shell {
    width: min(100% - 22px, 1120px);
  }

  .hub-hero {
    min-height: auto;
    padding-top: 14px;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .game-card {
    min-height: 136px;
  }

  .match-topbar,
  .room-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .button-row .btn,
  .room-actions .btn {
    flex: 1 1 auto;
  }

  .reminder-item {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .drawing-canvas {
    height: 62vh;
    min-height: 360px;
  }

  .ttt-board {
    gap: 7px;
  }

  .connect-board,
  .drop-controls {
    gap: 5px;
  }

  .connect-board {
    padding: 7px;
  }

  .drop-btn {
    min-height: 36px;
    padding: 0;
    font-size: 0;
  }

  .drop-btn::before {
    font-size: 1rem;
    content: "↓";
  }

  .bingo-play,
  .ocean-layout {
    grid-template-columns: 1fr;
  }

  .bingo-word {
    grid-template-columns: repeat(5, 1fr);
  }

  .bingo-word span {
    width: auto;
    height: auto;
    aspect-ratio: 1;
  }

  .word-round {
    grid-template-columns: 1fr;
  }

  .round-letter {
    width: min(150px, 100%);
  }

  .bingo-cell,
  .number-chip,
  .ocean-cell {
    font-size: 0.9rem;
  }
}

/* Visual refresh */
:root {
  --bg: #f2f5f6;
  --surface: #ffffff;
  --surface-strong: #edf8f6;
  --ink: #13201f;
  --muted: #66777a;
  --line: #cfdbdc;
  --accent: #0f8b8d;
  --accent-dark: #086567;
  --sun: #f2bc4b;
  --coral: #ec6a64;
  --green: #2d9b68;
  --blue: #3f7cac;
  --rose: #d85a7f;
  --paper: #fffdf8;
  --shadow: 0 20px 50px rgba(24, 36, 40, 0.14);
  --shadow-soft: 0 10px 24px rgba(24, 36, 40, 0.09);
}

:root[data-theme="dark"] {
  --bg: #0e1313;
  --surface: #171f20;
  --surface-strong: #1d2b2b;
  --ink: #f3f8f6;
  --muted: #9eb0b1;
  --line: #304142;
  --paper: #141b1b;
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.34);
}

body {
  background:
    linear-gradient(rgba(15, 139, 141, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 124, 172, 0.07) 1px, transparent 1px),
    linear-gradient(135deg, rgba(242, 188, 75, 0.16), transparent 34%),
    var(--bg);
  background-size: 34px 34px, 34px 34px, auto, auto;
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(rgba(45, 184, 179, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 124, 172, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, rgba(236, 106, 100, 0.08), transparent 34%),
    var(--bg);
  background-size: 34px 34px, 34px 34px, auto, auto;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 10px;
  min-height: 68px;
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 18px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.brand {
  min-width: max-content;
  padding-right: 4px;
  font-size: 1.02rem;
}

.brand-mark {
  border: 0;
  background:
    linear-gradient(135deg, var(--sun) 0 48%, var(--accent) 48% 100%);
  color: #10211f;
  box-shadow: inset 0 0 0 2px rgba(19, 32, 31, 0.22);
}

.site-nav {
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px;
  background: color-mix(in srgb, var(--surface-strong) 68%, transparent);
}

.site-nav a {
  white-space: nowrap;
}

.site-nav a.active {
  background: var(--ink);
  color: var(--surface);
}

:root[data-theme="dark"] .site-nav a.active {
  background: var(--accent);
  color: #071010;
}

.theme-toggle {
  min-width: 76px;
  border: 1px solid var(--ink);
  background: var(--surface-strong);
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--ink) 82%, transparent);
}

.hub-shell,
.game-shell,
.utility-shell,
.together-shell,
.drawing-shell {
  padding-top: 36px;
}

.hub-hero {
  position: relative;
  min-height: 430px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(22px, 4vw, 44px);
  overflow: hidden;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface-strong) 92%, transparent)),
    var(--surface);
  box-shadow: var(--shadow);
}

.hub-hero::before {
  position: absolute;
  inset: 0 0 auto;
  height: 9px;
  background: linear-gradient(90deg, var(--accent), var(--sun), var(--coral), var(--blue));
  content: "";
}

.hub-hero h1 {
  max-width: 680px;
  font-size: clamp(3rem, 8vw, 7.2rem);
}

.hero-copy {
  font-size: 1.12rem;
}

.hero-board {
  position: relative;
  border: 0;
  border-radius: 22px;
  padding: 16px;
  background:
    linear-gradient(135deg, var(--ink), color-mix(in srgb, var(--accent) 45%, var(--ink)));
  box-shadow: 12px 12px 0 var(--sun), var(--shadow);
}

.hero-board span {
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 92%, var(--accent) 8%);
  color: var(--ink);
}

.game-grid {
  margin-top: 20px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.game-card,
.tool-card {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 82%, var(--accent));
  border-radius: 20px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--sun) 4%), var(--surface));
  box-shadow: var(--shadow-soft);
}

.game-card::before,
.tool-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--sun), var(--coral));
  content: "";
}

.game-card {
  min-height: 210px;
  padding: 20px;
}

.game-card:hover,
.game-card:focus-visible,
.tool-card:hover,
.tool-card:focus-visible {
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

.game-icon {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 2px rgba(19, 32, 31, 0.18), 0 10px 24px rgba(0, 0, 0, 0.12);
}

.game-info strong,
.tool-card strong {
  font-size: 1.22rem;
  line-height: 1.16;
}

.pill {
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
}

.home-tools {
  margin-top: 22px;
}

.tool-card {
  min-height: 126px;
  padding: 20px;
}

.game-shell,
.utility-shell,
.drawing-shell {
  grid-template-columns: minmax(290px, 380px) minmax(0, 1fr);
  gap: 26px;
}

.together-shell {
  gap: 22px;
}

.panel,
.game-panel,
.soon-panel {
  position: relative;
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.panel::before,
.game-panel::before,
.soon-panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--accent), var(--sun));
  content: "";
}

.panel,
.game-panel {
  padding: 22px;
}

.panel h1 {
  font-size: clamp(2.3rem, 5vw, 3.45rem);
  line-height: 0.98;
}

.panel-copy {
  font-size: 1rem;
}

.form-stack {
  gap: 14px;
}

.field {
  color: color-mix(in srgb, var(--ink) 92%, var(--accent));
}

.field input,
.field select,
.shared-note,
.inline-form input {
  border: 1px solid color-mix(in srgb, var(--line) 82%, var(--accent));
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 96%, var(--surface-strong));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.btn {
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-strong) 86%, var(--line));
  box-shadow: 0 8px 18px rgba(20, 31, 33, 0.1);
}

.btn.primary {
  background: var(--accent);
  color: white;
}

.btn.warning {
  background: var(--coral);
  color: white;
}

.status-box {
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-strong) 82%, white);
}

:root[data-theme="dark"] .status-box {
  background: color-mix(in srgb, var(--surface-strong) 82%, black);
}

.room-strip {
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-strong) 72%, transparent);
}

.match-topbar {
  min-height: 72px;
  margin-bottom: 20px;
}

.player-badge {
  border-radius: 18px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--surface) 94%, var(--surface-strong));
  box-shadow: var(--shadow-soft);
}

.player-badge.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow-soft);
}

.ttt-board,
.connect-stack {
  width: min(100%, 560px);
}

.ttt-board {
  gap: 12px;
  padding: 12px;
  border-radius: 24px;
  background: var(--ink);
  box-shadow: var(--shadow);
}

.cell {
  border: 0;
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
}

.ttt-board {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  justify-items: stretch;
  aspect-ratio: 1 / 1;
  inline-size: min(100%, 560px);
  max-inline-size: 560px;
  overflow: hidden;
}

.ttt-board .cell {
  inline-size: 100%;
  block-size: 100%;
  aspect-ratio: 1 / 1;
  min-inline-size: 0;
  min-block-size: 0;
  padding: 0;
  overflow: hidden;
  contain: layout paint;
}

.connect-board {
  border: 0;
  border-radius: 24px;
  padding: 14px;
  background:
    linear-gradient(135deg, var(--blue), var(--accent));
  box-shadow: var(--shadow);
}

.drop-btn {
  border: 0;
  border-radius: 14px;
  background: var(--sun);
  box-shadow: 0 7px 0 color-mix(in srgb, var(--sun) 70%, var(--ink));
}

.c4-cell {
  border: 0;
  background: var(--paper);
  box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.22);
}

.bingo-board,
.ocean-grid,
.choices,
.word-form {
  border-radius: 20px;
}

.bingo-board {
  padding: 10px;
  background: var(--ink);
  box-shadow: var(--shadow-soft);
}

.bingo-cell,
.number-chip,
.choice-btn,
.ocean-cell {
  border-radius: 14px;
  border-color: color-mix(in srgb, var(--line) 80%, var(--accent));
}

.bingo-word span {
  border: 0;
  border-radius: 16px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.choice-btn {
  min-height: 68px;
  box-shadow: var(--shadow-soft);
}

.quiz-question {
  border-radius: 20px;
  padding: 18px;
  background: var(--surface-strong);
}

.round-letter {
  border: 0;
  border-radius: 24px;
  box-shadow: 10px 10px 0 var(--accent), var(--shadow);
}

.word-table {
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
}

.ocean-grid {
  padding: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 70%, white), var(--accent));
  box-shadow: var(--shadow-soft);
}

.ocean-cell {
  border: 0;
  border-radius: 12px;
}

.profile-card,
.reminder-item,
.mini-card,
.idea-list li {
  border-radius: 18px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, var(--surface-strong)), var(--surface));
  box-shadow: var(--shadow-soft);
}

.profile-card:hover,
.profile-card:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.drawing-panel {
  padding: 14px;
  background: var(--ink);
}

.drawing-canvas {
  border: 0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent);
}

@media (max-width: 900px) {
  .site-header {
    top: 0;
    margin-top: 0;
    border-radius: 0 0 18px 18px;
  }

  .hub-hero {
    min-height: auto;
  }

  .game-shell,
  .utility-shell,
  .drawing-shell,
  .together-shell {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .game-panel,
  .panel,
  .drawing-panel {
    min-width: 0;
  }

  .site-nav {
    flex: 0 0 100%;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .hub-hero {
    padding: 20px;
  }

  .hub-hero h1 {
    font-size: clamp(2.65rem, 14vw, 4rem);
  }

  .game-card {
    min-height: 154px;
  }

  .panel,
  .game-panel {
    padding: 18px;
  }

  .site-nav a {
    padding: 9px 11px;
  }
}
