:root {
  color-scheme: light dark;
  --bg: #f5f2ea;
  --surface: #fffdf8;
  --surface-2: #efe9dc;
  --ink: #1f1d1a;
  --muted: #6b665c;
  --line: #e2dccd;
  --accent: #3b5bdb;
  --accent-ink: #ffffff;
  --warning-bg: #fff1d6;
  --warning-ink: #7a4b00;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(40 30 10 / 0.06), 0 4px 16px rgb(40 30 10 / 0.06);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141518;
    --surface: #1d1f24;
    --surface-2: #262931;
    --ink: #ecebe6;
    --muted: #9a9a93;
    --line: #30333b;
    --accent: #8ea2ff;
    --accent-ink: #10121a;
    --warning-bg: #3a2c12;
    --warning-ink: #ffd48a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
  }
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

#app {
  /* Board column (640) + gap (16) + panel (300) + side padding (2 × 16). */
  max-width: 988px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

h1,
h2,
h3 {
  line-height: 1.15;
  margin: 0;
}

a {
  color: var(--accent);
}

.muted {
  color: var(--muted);
  font-weight: 400;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Brand ---------- */

.brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.brand-accent {
  color: var(--accent);
}

.brand-large {
  font-size: clamp(2.4rem, 9vw, 3.6rem);
}

/* ---------- Cards, forms, buttons ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.select {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background-color: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 36px 10px 12px;
  appearance: none;
  /* Chevron drawn with two gradients so it follows the text color in both themes. */
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.field-gap {
  margin-top: 10px;
}

.rematch-theme {
  text-align: left;
}

input[type="text"]:focus-visible,
.select:focus-visible,
.btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(0.97);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

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

.btn-small {
  padding: 6px 12px;
  font-size: 0.9rem;
}

.btn .icon {
  flex: none;
}

.btn-danger {
  background: #d1343a;
  border-color: #d1343a;
  color: #ffffff;
}

.btn-exit {
  margin-left: 4px;
}

/* Square icon-only button (tooltip + aria-label carry the meaning). */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--accent);
}

.icon-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.form-error {
  color: #d1343a;
  font-size: 0.9rem;
  margin: 8px 0 0;
  min-height: 1.2em;
}

@media (prefers-color-scheme: dark) {
  .form-error {
    color: #ff8a8f;
  }
}

/* ---------- Home ---------- */

.home {
  display: grid;
  gap: 24px;
  max-width: 440px;
  margin: 6vh auto 0;
}

.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: -8px;
}

/* Way back to the WorkBrawl hub this title is part of. */
.hub-link {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
}

.hub-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Compact UI-language switcher (home corner and room header). */
.select-lang {
  width: auto;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 6px 30px 6px 10px;
  background-color: var(--surface);
}

/* Language of the room's words, next to the theme. */
.lang-tag {
  margin-left: 0;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.home-hero {
  text-align: center;
}

.tagline {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 6px 0 0;
}

.intro {
  color: var(--muted);
  margin: 8px 0 0;
}

.home-card {
  display: grid;
  gap: 4px;
}

.home-card .btn-primary {
  margin-top: 12px;
}

.notice {
  background: var(--warning-bg);
  color: var(--warning-ink);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 0 0 12px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 16px 0 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.join-row {
  display: flex;
  gap: 8px;
}

/* Turnstile only renders here when Cloudflare needs the user to interact. */
.turnstile-slot {
  display: flex;
  justify-content: center;
}

.turnstile-slot:empty {
  display: none;
}

.join-form .form-error {
  margin-top: 6px;
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 700;
}

.center-screen {
  display: grid;
  gap: 24px;
  justify-items: center;
  margin-top: 8vh;
  text-align: center;
}

.name-prompt {
  display: grid;
  gap: 8px;
  width: min(100%, 400px);
  text-align: left;
}

.name-prompt p {
  margin: 0 0 8px;
}

.center-card {
  display: grid;
  gap: 16px;
  justify-items: center;
  text-align: center;
  max-width: 420px;
  margin: 8vh auto 0;
}

.center-card p {
  margin: 0;
  font-size: 1.1rem;
}

/* ---------- Game layout ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-code {
  font-size: 1.1rem;
  letter-spacing: 0.12em;
}

/* Floating message: pinned to the top center, slides down from the edge. */
.toast {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  z-index: 50;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.16), 0 2px 6px rgb(0 0 0 / 0.08);
  font-weight: 600;
  text-align: center;
}

.toast[hidden] {
  display: none;
}

.toast.toast-warning {
  background: var(--warning-bg);
  color: var(--warning-ink);
  border-color: color-mix(in srgb, var(--warning-ink) 25%, transparent);
}

.toast-in {
  animation: toast-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-100% - 16px));
  }
}

.wordboard-layout {
  display: grid;
  gap: 16px;
  grid-template-areas:
    "theme"
    "board"
    "panel";
}

.board-area {
  grid-area: board;
  display: grid;
  justify-items: center;
  min-width: 0;
}

.theme {
  grid-area: theme;
  font-size: 1.1rem;
  justify-self: start;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}

/* Theme picker styled as an accent button; picking an option applies it immediately. */
.select-inline {
  width: auto;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-ink);
  background-color: var(--accent);
  border-color: var(--accent);
  border-radius: 999px;
  padding: 6px 34px 6px 14px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
}

.select-inline:hover {
  filter: brightness(1.06);
}

.select-inline:disabled {
  opacity: 0.7;
  cursor: progress;
}

.select-inline option {
  color: var(--ink);
  background: var(--surface);
  font-weight: 600;
}

.panel {
  grid-area: panel;
  display: grid;
  gap: 16px;
  align-content: start;
}

.panel-title {
  font-size: 1rem;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

@media (min-width: 900px) {
  /* The theme line sits above the board only, so the panel starts level with the board. */
  .wordboard-layout {
    grid-template-columns: minmax(0, 640px) 300px;
    grid-template-areas:
      "theme ."
      "board panel";
    justify-content: center;
    align-items: start;
    row-gap: 10px;
  }

  .board-area {
    justify-items: start;
  }

  .board {
    /* Leave room for the top bar and the round/theme heading (messages float above). */
    width: min(100%, calc(100dvh - 150px));
  }
}

/* ---------- Board ---------- */

.board {
  --size: 12;
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  container-type: inline-size;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.board-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Floating readout of the letters being dragged (the finger hides them on phones). */
.selection-label {
  --sel: var(--accent);
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  max-width: calc(100% - 16px);
  padding: 4px 14px;
  border: 2px solid var(--sel);
  border-radius: 999px;
  background: color-mix(in srgb, var(--sel) 14%, var(--surface));
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: clamp(1rem, 4.5cqi, 1.5rem);
  letter-spacing: 0.12em;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
}

.selection-label[hidden] {
  display: none;
}

.selection-label-bottom {
  top: auto;
  bottom: 8px;
}

.board-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  grid-template-rows: repeat(var(--size), 1fr);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.board-row {
  display: contents;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: calc(100cqi / var(--size) * 0.54);
  line-height: 1;
}

.line {
  fill: none;
  stroke-width: 0.78;
  stroke-linecap: round;
}

.line-found {
  stroke-opacity: 0.38;
}

.line-selection {
  stroke-opacity: 0.5;
  visibility: hidden;
}

.line-preview {
  stroke-opacity: 0.22;
  stroke-width: 0.62;
  transition: stroke-opacity 0.15s;
}

@media (prefers-color-scheme: dark) {
  .line-found {
    stroke-opacity: 0.5;
  }
  .line-selection {
    stroke-opacity: 0.6;
  }
  .line-preview {
    stroke-opacity: 0.3;
  }
}

.board-disabled .board-grid {
  cursor: not-allowed;
}

.board-disabled .cell {
  opacity: 0.45;
}

/* ---------- Feedback animations ---------- */

/* Own find: the line swells briefly, then settles. */
.line-pop {
  animation: line-pop 0.6s ease-out;
}

@keyframes line-pop {
  0% {
    stroke-width: 0.78;
    stroke-opacity: 0.75;
  }
  35% {
    stroke-width: 1;
    stroke-opacity: 0.75;
  }
  100% {
    stroke-width: 0.78;
  }
}

/* Someone else's find: a quiet fade in. */
.line-appear {
  animation: line-appear 0.45s ease-out;
}

@keyframes line-appear {
  from {
    stroke-opacity: 0;
  }
}

/* Rejected selection: short shake, then fade out. Units are cells (SVG user space). */
.line-miss {
  animation: line-miss 0.45s ease-in-out forwards;
}

@keyframes line-miss {
  0%,
  100% {
    transform: translateX(0);
  }
  15%,
  55% {
    transform: translateX(-0.18px);
  }
  35%,
  75% {
    transform: translateX(0.18px);
  }
  100% {
    stroke-opacity: 0;
  }
}

.word-pop {
  animation: bump 0.6s ease-out;
}

.player-scored .player-score {
  display: inline-block;
  animation: bump 0.6s ease-out;
}

@keyframes bump {
  30% {
    transform: scale(1.18);
  }
}

/* New board: letters flip in along a diagonal wave (~0.7s total). */
.cell-deal {
  animation: cell-deal 0.32s cubic-bezier(0.2, 0.8, 0.3, 1.2) backwards;
  animation-delay: calc(var(--wave, 0) * 18ms);
}

@keyframes cell-deal {
  from {
    opacity: 0;
    transform: scale(0.4) rotate(-12deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cell-deal,
  .line-pop,
  .line-appear,
  .word-pop,
  .player-scored .player-score {
    animation: none;
  }
  .line-miss {
    animation: line-miss-reduced 0.45s forwards;
  }
  @keyframes line-miss-reduced {
    to {
      stroke-opacity: 0;
    }
  }
}

/* ---------- Words ---------- */

.word-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.word {
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
}

.word-found {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--by, var(--muted));
  text-decoration-thickness: 3px;
  box-shadow: inset 0 0 0 2px var(--by, transparent);
  background: transparent;
}

/* ---------- Players ---------- */

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

.player {
  --player: var(--muted);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.player-offline {
  opacity: 0.55;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--ink);
  background: color-mix(in srgb, var(--player) 18%, var(--surface));
  box-shadow: inset 0 0 0 3px var(--player);
}

.player-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.tag {
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.player-score {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
}

.board-locked .board-grid {
  cursor: default;
}

/* ---------- Status banner action ---------- */


/* ---------- Dialogs ---------- */

.dialog {
  width: min(calc(100% - 32px), 420px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25);
}

.dialog::backdrop {
  background: rgb(20 18 14 / 0.45);
  backdrop-filter: blur(2px);
}

.dialog[open] {
  animation: dialog-in 0.2s ease-out;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.dialog-body {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.dialog-title {
  font-size: 1.35rem;
}

.dialog-body p {
  margin: 0;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.dialog-actions .btn {
  flex: 1 1 140px;
}

/* ---------- Results ---------- */

.results .dialog-body {
  text-align: center;
}

.results-headline {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
}

.ranking {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: left;
}

.ranking-row {
  --player: var(--muted);
  display: grid;
  grid-template-columns: 2.2em auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

.ranking-first {
  background: color-mix(in srgb, var(--player) 16%, var(--surface));
  box-shadow: inset 0 0 0 2px var(--player);
}

.ranking-pos {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.ranking-first .ranking-pos {
  color: var(--ink);
}

.ranking .player-score {
  font-size: 1rem;
}

/* ---------- Invite / QR ---------- */

.invite-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.invite-head {
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.invite-head .panel-title {
  margin-bottom: 0;
}

.icon-actions {
  display: flex;
  gap: 6px;
}

.invite .dialog-body {
  justify-items: center;
  text-align: center;
}

.invite .dialog-actions {
  width: 100%;
}

.qr-box-large {
  width: min(100%, 280px);
}

.qr-box {
  width: min(100%, 200px);
  padding: 8px;
  background: #ffffff;
  border-radius: 12px;
}

.qr {
  display: block;
  width: 100%;
  height: auto;
}

.invite-url {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
  word-break: break-all;
}

/* ---------- Touch devices ---------- */

/* No double-tap zoom or tap delay on controls (the board already uses touch-action: none). */
button,
a,
select,
input,
label {
  touch-action: manipulation;
}

/* Finger-sized targets (~44px) where the primary input is touch. */
@media (pointer: coarse) {
  .btn,
  .select-inline {
    min-height: 44px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }
}

/* ---------- Small screens ---------- */

.room-info {
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 420px) {
  #app {
    padding: 12px;
  }

  .room-label {
    display: none;
  }

  /* Brand, code and both buttons fit on one row from ~340px up. */
  .topbar {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .topbar .brand {
    font-size: 1.1rem;
  }

  .room-info {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .room-code {
    font-size: 1rem;
    letter-spacing: 0.08em;
  }

  .btn-small {
    padding: 6px 10px;
  }

  .card {
    padding: 14px;
  }
}

@media (max-width: 340px) {
  .topbar,
  .room-info {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast-in,
  .dialog[open] {
    animation: none;
  }
}

/* ---------- Home info (how to play, FAQ) and footer ---------- */

.info {
  display: grid;
  gap: 10px;
  color: var(--ink);
}

.info h2 {
  font-size: 1.1rem;
  margin-top: 8px;
}

.steps {
  margin: 0;
  padding-left: 1.3em;
  display: grid;
  gap: 8px;
}

.faq {
  margin: 0;
  display: grid;
  gap: 4px;
}

.faq dt {
  font-weight: 700;
  margin-top: 8px;
}

.faq dd {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 8px 0 24px;
}

.site-footer a,
.link-button {
  color: var(--muted);
}

.link-button {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

.static-card p {
  margin: 0;
}

/* ---------- Cookie consent ---------- */

.consent {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 60;
  transform: translateX(-50%);
  width: min(calc(100vw - 24px), 560px);
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.16);
  font-size: 0.92rem;
}

.consent p {
  margin: 0;
  padding-right: 28px; /* room for the close button */
}

.consent-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.consent-close:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.consent-close:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.consent-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.consent-actions .btn {
  flex: 0 1 140px;
}

/* ---------- Static pages (privacy) ---------- */

.prose {
  display: grid;
  gap: 16px;
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.6;
}

.prose h1 {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.prose h2 {
  font-size: 1.1rem;
  margin: 18px 0 6px;
}

.prose ul {
  padding-left: 1.2em;
}

.prose code {
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 6px;
}

.center-text {
  text-align: center;
}

/* ==========================================================================
   Game look
   Chunky display type, beveled buttons that press down, framed panels with
   ribbon titles. Applies to every page whose <body> has class "brawl-ui"; rules
   that only make sense on the home screen stay under .home.
   ========================================================================== */

/* Lilita One (SIL OFL 1.1), self-hosted: see public/fonts/LICENSE-lilita-one.txt */
@font-face {
  font-family: "Lilita One";
  src: url("/snakebrawl/fonts/lilita-one-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-display: "Lilita One", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  /* Button faces: highlight (top), base (bottom) and edge (border + the "depth" below). */
  --go-hi: #74d95c;
  --go: #3fb144;
  --go-edge: #257f2e;
  --pick-hi: #6f8dff;
  --pick: #3b5bdb;
  --pick-edge: #283f9f;
  --ribbon-hi: #ffc35c;
  --ribbon: #f39a12;
  --ribbon-edge: #b86a00;
  --panel-bg: #fff9ea;
  --panel-edge: #e6cd97;
  --panel-depth: #d4b878;
  --field-bg: #ffffff;
  --field-edge: #dccba4;
  --glow-a: #ffefc2;
  --glow-b: #dfe6ff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --go-hi: #5fc74b;
    --go: #2f9838;
    --go-edge: #1b6524;
    --pick-hi: #6482f5;
    --pick: #3552c9;
    --pick-edge: #213583;
    --ribbon-hi: #f5b548;
    --ribbon: #d9850a;
    --ribbon-edge: #8f5200;
    --panel-bg: #22242c;
    --panel-edge: #454a61;
    --panel-depth: #14151a;
    --field-bg: #16181d;
    --field-edge: #3d4257;
    --glow-a: #2a2414;
    --glow-b: #1a2040;
  }
}

/* Soft colored glows behind every screen. */
body.brawl-ui {
  background:
    radial-gradient(60rem 28rem at 15% -5%, var(--glow-a), transparent 60%),
    radial-gradient(50rem 26rem at 100% 0%, var(--glow-b), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- Wordmark and headings ---------- */

.brawl-ui .brand-large {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 13vw, 4.6rem);
  letter-spacing: 0.01em;
  line-height: 1;
  text-shadow: 0 4px 0 rgb(0 0 0 / 0.14);
}

.home .tagline {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.25rem, 5vw, 1.55rem);
  letter-spacing: 0.02em;
  margin-top: 10px;
}

.home .info h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.45rem;
  letter-spacing: 0.02em;
}

/* ---------- Framed panel with ribbon title ---------- */

.brawl-ui .brawl-panel {
  position: relative;
  margin-top: 22px;
  padding: 38px 18px 20px;
  background: var(--panel-bg);
  border: 3px solid var(--panel-edge);
  border-radius: 28px;
  box-shadow:
    0 7px 0 var(--panel-depth),
    0 22px 40px rgb(40 30 10 / 0.14);
}

.panel-ribbon {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 7px 26px 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #ffffff;
  text-shadow: 0 2px 0 rgb(0 0 0 / 0.28);
  background: linear-gradient(var(--ribbon-hi), var(--ribbon));
  border: 3px solid var(--ribbon-edge);
  border-radius: 18px;
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.4),
    0 4px 0 var(--ribbon-edge);
}

/* ---------- Labels and fields ---------- */

.brawl-ui label,
.brawl-ui .field-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.brawl-ui .field-gap {
  margin-top: 14px;
}

.brawl-ui input[type="text"],
.brawl-ui .select {
  font-weight: 700;
  font-size: 1.05rem;
  padding: 12px 14px;
  background-color: var(--field-bg);
  border: 3px solid var(--field-edge);
  border-radius: 16px;
  box-shadow: inset 0 3px 0 rgb(0 0 0 / 0.06);
}

.brawl-ui .select {
  padding-right: 40px;
}

.brawl-ui input[type="text"]:focus-visible,
.brawl-ui .select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--pick) 55%, transparent);
  outline-offset: 2px;
  border-color: var(--pick);
}

/* ---------- Beveled buttons (and language tiles) ---------- */

.brawl-ui .btn,
.lang-tile {
  --hi: var(--pick-hi);
  --face: var(--pick);
  --edge: var(--pick-edge);
  position: relative;
  min-height: 50px;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 2px 0 rgb(0 0 0 / 0.3);
  background: linear-gradient(var(--hi), var(--face));
  border: 2px solid var(--edge);
  border-radius: 16px;
  /* Glossy top edge + a solid "side" below that the button sinks into when pressed. */
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.38),
    0 5px 0 var(--edge);
  margin-bottom: 5px;
  transition:
    transform 0.07s ease-out,
    box-shadow 0.07s ease-out,
    filter 0.15s;
}

.brawl-ui .btn:hover,
.lang-tile:hover {
  filter: brightness(1.07);
}

.brawl-ui .btn:active,
.lang-tile:active {
  transform: translateY(4px);
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.38),
    0 1px 0 var(--edge);
}

.brawl-ui .btn:disabled {
  filter: saturate(0.55);
  opacity: 0.85;
  cursor: progress;
}

/* Main actions are green. */
.brawl-ui .btn-primary {
  --hi: var(--go-hi);
  --face: var(--go);
  --edge: var(--go-edge);
}

/* The home's "Create room": full width and bigger, like a Play button. */
.home .btn-primary {
  width: 100%;
  min-height: 58px;
  margin-top: 18px;
  font-size: 1.5rem;
}

.brawl-ui .btn:focus-visible,
.tile-input:focus-visible + .lang-tile {
  outline: 3px solid color-mix(in srgb, var(--ink) 55%, transparent);
  outline-offset: 3px;
}

/* ---------- Word-language tiles ---------- */

.lang-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 12px 10px;
}

.home .lang-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  /* Reset the generic .home label styles. */
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}

/* Selected language: green, like the active option on a language screen. */
.tile-input:checked + .lang-tile {
  --hi: var(--go-hi);
  --face: var(--go);
  --edge: var(--go-edge);
}

/* ---------- Smaller pieces ---------- */

.brawl-ui .select-lang {
  font-weight: 800;
  background-color: var(--field-bg);
  border: 3px solid var(--field-edge);
  border-radius: 999px;
  padding: 6px 32px 6px 14px;
}

.home .divider {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 20px 0 14px;
}

.home .divider::before,
.home .divider::after {
  height: 3px;
  border-radius: 3px;
  background: var(--field-edge);
}

.home .join-row {
  align-items: flex-start;
}

.home .join-row .btn {
  flex: none;
}

.home .static-card p {
  font-weight: 600;
}

/* Error lines only take space once they have something to say. */
.brawl-ui .form-error:empty {
  display: none;
}

.brawl-ui .form-error {
  font-weight: 700;
  margin-top: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .brawl-ui .btn,
  .lang-tile {
    transition: none;
  }
}

/* ==========================================================================
   Brawl look — room screen, dialogs and floating messages
   ========================================================================== */

:root {
  /* Neutral button face for low-key actions (leave, share, copy). */
  --mute-hi: #fffaf0;
  --mute: #ece3cf;
  --mute-edge: #c2b594;
  --danger-hi: #ff8a84;
  --danger: #e5484d;
  --danger-edge: #a52a30;
}

@media (prefers-color-scheme: dark) {
  :root {
    --mute-hi: #414656;
    --mute: #2e3240;
    --mute-edge: #14161c;
    --danger-hi: #f0716c;
    --danger: #cf3b41;
    --danger-edge: #8a2026;
  }
}

/* ---------- Button variants ---------- */

.brawl-ui .btn-small {
  min-height: 40px;
  padding: 6px 14px;
  font-size: 0.95rem;
  border-radius: 13px;
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.38),
    0 4px 0 var(--edge);
  margin-bottom: 4px;
}

.brawl-ui .btn-small:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.38),
    0 1px 0 var(--edge);
}

.brawl-ui .btn-danger {
  --hi: var(--danger-hi);
  --face: var(--danger);
  --edge: var(--danger-edge);
}

/* Neutral, quieter buttons: "Leave" in the header and the icon buttons. */
.brawl-ui .btn-exit,
.brawl-ui .icon-btn {
  --hi: var(--mute-hi);
  --face: var(--mute);
  --edge: var(--mute-edge);
  color: var(--ink);
  text-shadow: none;
}

.brawl-ui .icon-btn {
  width: 42px;
  height: 42px;
  background: linear-gradient(var(--hi), var(--face));
  border: 2px solid var(--edge);
  border-radius: 13px;
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.5),
    0 4px 0 var(--edge);
  margin-bottom: 4px;
  transition:
    transform 0.07s ease-out,
    box-shadow 0.07s ease-out;
}

.brawl-ui .icon-btn:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.5),
    0 1px 0 var(--edge);
}

/* ---------- Top bar ---------- */

.brawl-ui .topbar .brand {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.3rem, 5.6vw, 1.75rem);
  letter-spacing: 0.01em;
  text-shadow: 0 2px 0 rgb(0 0 0 / 0.12);
}

.brawl-ui .room-label {
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}

.brawl-ui .room-code {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.14em;
  padding: 4px 8px 4px 12px;
  background: var(--field-bg);
  border: 3px solid var(--field-edge);
  border-radius: 12px;
}

.brawl-ui .select-lang {
  min-height: 40px;
  font-size: 0.9rem;
  box-shadow: none;
}

/* ---------- Round / theme line ---------- */

.brawl-ui .theme {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  /* Same height with or without the theme picker, so the board never jumps when the
     picker disappears after the first word is found. */
  min-height: 48px;
}

.brawl-ui .theme strong {
  font-weight: 400;
  color: var(--accent);
}

/* Theme picker: a beveled blue button; picking an option applies it. */
.brawl-ui .select-inline {
  width: auto;
  min-height: 40px;
  padding: 6px 36px 6px 14px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-shadow: 0 2px 0 rgb(0 0 0 / 0.28);
  border: 2px solid var(--pick-edge);
  border-radius: 14px;
  background-color: var(--pick);
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%),
    linear-gradient(var(--pick-hi), var(--pick));
  background-position:
    calc(100% - 19px) 55%,
    calc(100% - 14px) 55%,
    0 0;
  background-size:
    5px 5px,
    5px 5px,
    100% 100%;
  background-repeat: no-repeat;
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.38),
    0 4px 0 var(--pick-edge);
  margin-bottom: 4px;
}

/* Locked (theme can't change any more): same box, flat and quiet, no arrow. */
.brawl-ui .select-inline.is-locked {
  color: var(--accent);
  text-shadow: none;
  background-color: var(--field-bg);
  background-image: none;
  border-color: var(--field-edge);
  box-shadow: 0 4px 0 var(--field-edge);
  opacity: 1;
  cursor: default;
}

/* Waiting for the new board after picking a theme. */
.brawl-ui .select-inline[aria-busy="true"] {
  opacity: 0.7;
  cursor: progress;
}

.brawl-ui .select-inline option {
  font-family: var(--font);
  font-weight: 600;
  text-shadow: none;
}

.brawl-ui .lang-tag {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  color: var(--ink);
  background: var(--field-bg);
  border: 2px solid var(--field-edge);
}

/* ---------- Board ---------- */

.brawl-ui .board {
  border: 3px solid var(--panel-edge);
  border-radius: 22px;
  box-shadow:
    0 6px 0 var(--panel-depth),
    0 18px 34px rgb(40 30 10 / 0.12);
}

.brawl-ui .selection-label {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.14em;
  border-width: 3px;
}

/* ---------- Side panels ---------- */

.brawl-ui .panel .card,
.brawl-ui .center-card,
.brawl-ui .name-prompt,
.brawl-ui .prose .card {
  background: var(--panel-bg);
  border: 3px solid var(--panel-edge);
  border-radius: 22px;
  box-shadow:
    0 5px 0 var(--panel-depth),
    0 14px 28px rgb(40 30 10 / 0.1);
}

.brawl-ui .panel-title,
.brawl-ui .name-prompt h2,
.brawl-ui .prose h1,
.brawl-ui .prose h2 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.03em;
}

.brawl-ui .panel-title {
  font-size: 1.25rem;
  align-items: baseline;
}

.brawl-ui .panel-title .muted {
  font-size: 0.95rem;
}

.brawl-ui .name-prompt h2 {
  font-size: 1.6rem;
}

/* Word chips: little tiles; found ones are outlined in the finder's color. */
.brawl-ui .word {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0.07em;
  padding: 4px 12px 3px;
  background: var(--field-bg);
  border: 2px solid var(--field-edge);
  border-bottom-width: 4px;
  border-radius: 12px;
}

.brawl-ui .word-found {
  background: transparent;
  border-color: var(--by, var(--field-edge));
  box-shadow: none;
}

/* ---------- Scoreboard ---------- */

.brawl-ui .avatar {
  width: 36px;
  height: 36px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.1rem;
  box-shadow:
    inset 0 0 0 3px var(--player),
    0 3px 0 color-mix(in srgb, var(--player) 55%, #000);
}

.brawl-ui .player-name {
  font-weight: 700;
}

.brawl-ui .player-score {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
}

.brawl-ui .tag {
  font-weight: 800;
}

/* ---------- Floating messages and cookie banner ---------- */

.brawl-ui .toast {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  background: var(--panel-bg);
  border: 3px solid var(--panel-edge);
  border-radius: 16px;
  box-shadow:
    0 5px 0 var(--panel-depth),
    0 14px 30px rgb(0 0 0 / 0.18);
}

.brawl-ui .toast.toast-warning {
  background: var(--warning-bg);
  color: var(--warning-ink);
  border-color: color-mix(in srgb, var(--warning-ink) 45%, transparent);
  box-shadow:
    0 5px 0 color-mix(in srgb, var(--warning-ink) 35%, transparent),
    0 14px 30px rgb(0 0 0 / 0.18);
}

.brawl-ui .consent {
  background: var(--panel-bg);
  border: 3px solid var(--panel-edge);
  border-radius: 20px;
  box-shadow:
    0 5px 0 var(--panel-depth),
    0 14px 30px rgb(0 0 0 / 0.18);
}

/* Accept and Reject look identical on purpose (equal prominence). */
.brawl-ui .consent .btn-primary {
  --hi: var(--pick-hi);
  --face: var(--pick);
  --edge: var(--pick-edge);
}

/* ---------- Dialogs ---------- */

.brawl-ui .dialog {
  background: var(--panel-bg);
  border: 3px solid var(--panel-edge);
  border-radius: 26px;
  box-shadow:
    0 7px 0 var(--panel-depth),
    0 30px 70px rgb(0 0 0 / 0.3);
}

.brawl-ui .dialog-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.75rem;
  letter-spacing: 0.02em;
  text-align: center;
}

.brawl-ui .confirm .dialog-body {
  text-align: center;
}

.brawl-ui .results-headline {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.brawl-ui .ranking-row {
  background: var(--field-bg);
  border: 2px solid var(--field-edge);
  border-bottom-width: 4px;
  border-radius: 14px;
}

.brawl-ui .ranking-first {
  background: color-mix(in srgb, var(--player) 14%, var(--field-bg));
  border-color: var(--player);
  box-shadow: none;
}

.brawl-ui .ranking-pos {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.15rem;
}

.brawl-ui .ranking .player-score {
  font-size: 1.1rem;
}

/* ---------- Small screens ---------- */

@media (max-width: 420px) {
  /* Round, theme picker and language tag on a single line. */
  .brawl-ui .theme {
    flex-wrap: nowrap;
  }

  .brawl-ui .theme-prefix {
    white-space: nowrap;
  }

  .brawl-ui .theme-word {
    display: none;
  }

  .brawl-ui .select-inline {
    min-width: 0;
    flex: 0 1 auto;
    text-overflow: ellipsis;
  }

  /* Header fits brand, code, language and an icon-only "Leave". */
  .brawl-ui .btn-exit .btn-label {
    display: none;
  }

  .brawl-ui .btn-exit {
    padding: 6px 10px;
  }

  .brawl-ui .room-code {
    font-size: 1rem;
    padding: 3px 6px 3px 9px;
  }

  .brawl-ui .select-lang {
    padding: 5px 26px 5px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brawl-ui .icon-btn {
    transition: none;
  }
}


/* ---------- SnakeBrawl arena ---------- */

:root {
  --arena-floor: #fffdf8;
  --arena-tile: #f4efe3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --arena-floor: #1d1f24;
    --arena-tile: #22252b;
  }
}

.arena-layout {
  display: grid;
  gap: 16px;
}

/* .panel names a grid area in the base layout; here it just flows as the second item. */
.arena-layout .panel {
  grid-area: auto;
}

.arena-area {
  display: grid;
  /* minmax(0, …): the canvas has a fixed pixel width and must never widen its column,
     or the arena could not shrink when the window does. */
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.arena-hud {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.clock {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* While a round runs the clock is colored by --clock-hue (set from web/room.ts):
   green with time to spare, red when it is about to run out. */
.clock-running {
  color: hsl(var(--clock-hue, 135) 80% 33%);
}

@media (prefers-color-scheme: dark) {
  .clock-running {
    color: hsl(var(--clock-hue, 135) 75% 58%);
  }
}

/* Last seconds of the round: red (hue 0 by then) and blinking once per second. */
.clock-final {
  animation: clock-blink 1s steps(1, end) infinite;
}

@keyframes clock-blink {
  50% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .clock-final {
    animation: none;
  }
}

/* The canvas sizes itself to a whole number of cells, so the wrap centers it. */
.arena-wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.arena-canvas {
  display: block;
  border-radius: var(--radius);
  box-shadow: 0 0 0 3px var(--line), var(--shadow);
}

.arena-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  /* "safe" keeps the top reachable when the content is taller than a small arena. */
  align-content: safe center;
  justify-items: center;
  gap: 8px;
  padding: 12px;
  overflow: auto;
  text-align: center;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.arena-overlay[hidden],
.arena-pill[hidden] {
  display: none;
}

.arena-overlay h2,
.arena-overlay p {
  margin: 0;
}

.arena-overlay .ranking {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  width: min(100%, 320px);
  text-align: left;
}

.arena-overlay .ranking-row {
  padding: 4px 10px;
}

.arena-overlay .avatar {
  width: 26px;
  height: 26px;
  font-size: 0.85rem;
}

.countdown {
  font-size: clamp(3rem, 18vw, 6rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* The zooming number must not make the overlay scroll. */
.arena-overlay:has(.countdown) {
  overflow: hidden;
}

/* Each number zooms towards the viewer and fades out over its second. */
.countdown-pop {
  animation: countdown-pop 1s ease-in forwards;
}

@keyframes countdown-pop {
  from {
    transform: scale(0.6);
    opacity: 1;
  }
  60% {
    opacity: 1;
  }
  to {
    transform: scale(2.6);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .countdown-pop {
    animation: none;
  }
}

.arena-pill {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.arena-legend {
  margin: 0;
  font-weight: 700;
  text-align: center;
}

.arena-hint {
  margin: 0;
  font-size: 0.85rem;
  text-align: center;
}

@media (min-width: 900px) {
  .arena-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    align-items: start;
  }
}
