    :root {
      --bg-1: #07111f;
      --bg-2: #101a33;
      --ink: #f7fbff;
      --text: #f7fbff;
      --muted: #aebbd0;
      --paper: #0d1629;
      --line: rgba(255, 255, 255, .12);
      --gold: #f6b91a;
      --gold-deep: #ffd873;
      --a: #29c1ef;
      --a-dark: #7fe0ff;
      --a-soft: rgba(41, 193, 239, .16);
      --b: #ff7a54;
      --b-dark: #ffb28f;
      --b-soft: rgba(255, 122, 84, .16);
      --good: #26d98b;
      --good-soft: rgba(38, 217, 139, .16);
      --bad: #ff5d73;
      --bad-soft: rgba(255, 93, 115, .16);
      --shadow: 0 24px 70px rgba(0, 0, 0, .45);
      --cell: clamp(34px, min(calc((100vw - 330px) / 18), calc((100dvh - 180px) / 10.8)), 84px);
      --radius: 22px;
      color-scheme: dark;
      font-family: Inter, ui-rounded, "Segoe UI", Arial, sans-serif;
    }

    * { box-sizing: border-box; }

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

    body {
      margin: 0;
      min-width: 320px;
      color: var(--text);
      background:
        radial-gradient(circle at 15% 10%, rgba(41, 193, 239, .16), transparent 30%),
        radial-gradient(circle at 85% 12%, rgba(255, 122, 84, .14), transparent 30%),
        linear-gradient(145deg, var(--bg-1), var(--bg-2));
      overflow: hidden;
    }

    button, input, select { font: inherit; }

    button { touch-action: manipulation; }

    button:focus-visible,
    input:focus-visible,
    select:focus-visible {
      outline: 4px solid rgba(246, 185, 26, .58);
      outline-offset: 3px;
    }

    .app {
      min-height: 100dvh;
      display: grid;
      grid-template-rows: auto 1fr;
    }

    .topbar {
      min-height: 72px;
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
      gap: 16px;
      padding: 10px 18px;
      color: #fff;
      background: linear-gradient(115deg, #0b2239, #123d5a 48%, #173149);
      box-shadow: 0 8px 24px rgba(15, 42, 67, .18);
      z-index: 30;
    }

    .brand { min-width: 0; }

    .brand h1 {
      margin: 0;
      font-size: clamp(1.1rem, 2.1vw, 1.85rem);
      line-height: 1.05;
      letter-spacing: -.025em;
    }

    .brand p {
      margin: 4px 0 0;
      color: #b9d8e9;
      font-size: clamp(.72rem, 1vw, .9rem);
      font-weight: 700;
    }

    .turn-pill {
      display: flex;
      align-items: center;
      gap: 9px;
      min-height: 44px;
      padding: 8px 18px;
      border: 1px solid rgba(255,255,255,.23);
      border-radius: 999px;
      background: rgba(255,255,255,.12);
      backdrop-filter: blur(8px);
      font-weight: 900;
      letter-spacing: .015em;
      white-space: nowrap;
    }

    .turn-dot {
      width: 12px;
      height: 12px;
      border: 3px solid rgba(255,255,255,.7);
      border-radius: 50%;
      background: var(--a);
      box-shadow: 0 0 0 4px rgba(8,126,164,.28);
    }

    .turn-pill.team-b .turn-dot {
      background: var(--b);
      box-shadow: 0 0 0 4px rgba(232,93,63,.28);
    }

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

    .icon-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 44px;
      min-height: 44px;
      border: 1px solid rgba(255,255,255,.22);
      border-radius: 14px;
      color: #fff;
      background: rgba(255,255,255,.1);
      cursor: pointer;
      font-weight: 800;
      font-size: 1.1rem;
      text-decoration: none;
    }

    .icon-button:hover { background: rgba(255,255,255,.18); }

    .arena {
      min-height: 0;
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 12px;
      padding: 12px;
    }

    .team-panel {
      position: relative;
      min-width: 0;
      min-height: 0;
      display: grid;
      grid-template-rows: auto 1fr;
      overflow: hidden;
      border: 2px solid rgba(255,255,255,.08);
      border-radius: var(--radius);
      background: rgba(13,22,42,.72);
      box-shadow: var(--shadow);
      transition: border-color .25s ease, box-shadow .25s ease, opacity .25s ease;
    }

    .team-panel.team-a { --team: var(--a); --team-dark: var(--a-dark); --team-soft: var(--a-soft); }
    .team-panel.team-b { --team: var(--b); --team-dark: var(--b-dark); --team-soft: var(--b-soft); }

    .team-panel[data-active="true"] {
      border-color: var(--team);
      box-shadow: 0 0 0 4px color-mix(in srgb, var(--team) 18%, transparent), var(--shadow);
    }

    .team-panel[data-active="false"] { opacity: .86; }

    .team-header {
      min-height: 52px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 8px 14px;
      border-bottom: 1px solid color-mix(in srgb, var(--team) 26%, rgba(255,255,255,.12));
      background: linear-gradient(90deg, var(--team-soft), rgba(255,255,255,.02) 68%);
    }

    .team-title-wrap {
      display: flex;
      align-items: center;
      min-width: 0;
      gap: 9px;
    }

    .team-mark {
      width: 34px;
      height: 34px;
      display: grid;
      place-items: center;
      flex: 0 0 auto;
      border-radius: 11px;
      color: #fff;
      background: var(--team);
      font-weight: 950;
      box-shadow: inset 0 -3px 0 rgba(0,0,0,.12);
    }

    .team-name {
      overflow: hidden;
      margin: 0;
      font-size: clamp(1rem, 1.6vw, 1.35rem);
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .stats {
      display: flex;
      gap: 7px;
      flex: 0 0 auto;
      font-size: .82rem;
      font-weight: 900;
    }

    .stat {
      min-width: 42px;
      padding: 5px 8px;
      border-radius: 10px;
      text-align: center;
      color: var(--text);
      background: rgba(255,255,255,.08);
    }

    .stat.good { color: var(--good); background: var(--good-soft); }
    .stat.bad { color: var(--bad); background: var(--bad-soft); }

    .play-layout {
      min-height: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: clamp(7px, 1vw, 16px);
      padding: 8px;
    }

    .team-a .control-rail { order: 1; }
    .team-a .board-shell { order: 2; }
    .team-b .board-shell { order: 1; }
    .team-b .control-rail { order: 2; }

    .board-shell {
      position: relative;
      width: calc(var(--cell) * 9);
      height: calc(24px + var(--cell) * 10.72);
      flex: 0 0 auto;
    }

    .board {
      position: absolute;
      top: 24px;
      left: 0;
      width: calc(var(--cell) * 9);
      height: calc(var(--cell) * 10);
      display: grid;
      grid-template-columns: repeat(9, var(--cell));
      grid-template-rows: repeat(10, var(--cell));
      overflow: visible;
    }

    .cell {
      position: relative;
      width: var(--cell);
      height: var(--cell);
      padding: clamp(2px, calc(var(--cell) * .055), 5px);
    }

    .cell-inner {
      position: relative;
      width: 100%;
      height: 100%;
      display: grid;
      place-items: center;
      overflow: hidden;
      border: 1px solid #c9d7e3;
      border-radius: clamp(8px, calc(var(--cell) * .18), 15px);
      color: #16222f;
      background: linear-gradient(145deg, #ffffff, #e9f0f5);
      box-shadow: inset 0 -3px 0 rgba(16,42,67,.08), 0 3px 8px rgba(0,0,0,.35);
    }

    .cell.connector .cell-inner {
      border-color: #b7c9d8;
      background: linear-gradient(180deg, #f9fcff, #dce8f0);
    }

    .cell.connector .cell-inner::after {
      content: "↑";
      position: absolute;
      right: 5px;
      bottom: 2px;
      color: rgba(16,42,67,.4);
      font-size: clamp(.6rem, calc(var(--cell) * .22), .9rem);
      font-weight: 900;
    }

    .cell.question .cell-inner {
      border-color: #e0aa15;
      color: #6e4800;
      background:
        radial-gradient(circle at 32% 25%, rgba(255,255,255,.85), transparent 30%),
        linear-gradient(145deg, #fff4ad, #f8c63e);
      box-shadow: inset 0 -4px 0 rgba(137,85,0,.16), 0 3px 8px rgba(173,112,0,.18);
    }

    .cell.final .cell-inner {
      border-color: #ad7300;
      color: #fff;
      background: linear-gradient(145deg, #f7c843, #d78b00);
      box-shadow: 0 0 0 3px rgba(246,185,26,.22), inset 0 -4px 0 rgba(102,61,0,.2);
    }

    .cell-number {
      position: absolute;
      top: 3px;
      left: 5px;
      z-index: 1;
      font-size: clamp(.52rem, calc(var(--cell) * .17), .72rem);
      font-weight: 900;
      opacity: .72;
    }

    .cell-icon {
      font-size: clamp(.9rem, calc(var(--cell) * .38), 1.75rem);
      font-weight: 950;
      line-height: 1;
    }

    .cell.final .cell-icon { font-size: clamp(.72rem, calc(var(--cell) * .2), .95rem); letter-spacing: .04em; }

    .cell.flash .cell-inner { animation: cellFlash .35s ease; }

    @keyframes cellFlash {
      50% { transform: scale(.9); filter: brightness(1.15); }
    }

    .token {
      position: absolute;
      top: 0;
      left: 0;
      z-index: 12;
      width: calc(var(--cell) * .78);
      min-width: 0;
      height: calc(var(--cell) * .56);
      display: grid;
      place-items: center;
      padding: 0 4px;
      border: 3px solid rgba(255,255,255,.96);
      border-radius: 999px;
      color: #fff;
      background: var(--team);
      box-shadow: 0 7px 13px rgba(15,42,67,.25), inset 0 -4px 0 rgba(0,0,0,.14);
      transform: translate3d(0, 0, 0);
      transition: transform 210ms cubic-bezier(.2,.85,.35,1.1);
      font-size: clamp(.56rem, calc(var(--cell) * .16), .76rem);
      font-weight: 950;
      letter-spacing: .025em;
      text-align: center;
      text-overflow: ellipsis;
      white-space: nowrap;
      overflow: hidden;
      pointer-events: none;
    }

    .token.step { animation: tokenHop 210ms ease; }

    @keyframes tokenHop {
      50% { scale: 1.12; }
    }

    .cup {
      position: absolute;
      top: -17px;
      z-index: 5;
      width: 64px;
      transform: translateX(-50%);
      text-align: center;
      filter: drop-shadow(0 6px 5px rgba(143,92,0,.23));
      pointer-events: none;
    }

    .team-a .cup { left: 94.444%; }
    .team-b .cup { left: 5.556%; }

    .cup-icon {
      display: block;
      font-size: clamp(1.5rem, calc(var(--cell) * .52), 2.6rem);
      line-height: .9;
    }

    .cup-label {
      display: block;
      margin-top: 3px;
      color: var(--gold);
      font-size: .58rem;
      font-weight: 950;
      letter-spacing: .08em;
    }

    .cup.won { animation: cupWin .8s ease-in-out infinite alternate; }

    @keyframes cupWin {
      to { transform: translateX(-50%) translateY(-7px) rotate(4deg) scale(1.12); filter: drop-shadow(0 9px 8px rgba(246,185,26,.48)); }
    }

    .start-pad {
      position: absolute;
      top: calc(24px + var(--cell) * 10 + 4px);
      width: var(--cell);
      min-height: calc(var(--cell) * .48);
      display: grid;
      place-items: center;
      border: 2px dashed color-mix(in srgb, var(--team) 55%, transparent);
      border-radius: 10px;
      color: var(--team-dark);
      background: var(--team-soft);
      font-size: clamp(.48rem, calc(var(--cell) * .15), .68rem);
      font-weight: 950;
      letter-spacing: .04em;
    }

    .team-a .start-pad { left: 0; }
    .team-b .start-pad { right: 0; }

    .control-rail {
      width: clamp(96px, 8.7vw, 148px);
      min-width: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 10px 8px;
      border: 1px solid color-mix(in srgb, var(--team) 22%, rgba(255,255,255,.14));
      border-radius: 18px;
      background: linear-gradient(180deg, rgba(255,255,255,.04), var(--team-soft));
    }

    .position-label {
      color: var(--team-dark);
      font-size: clamp(.68rem, 1vw, .82rem);
      font-weight: 900;
      text-align: center;
    }

    .position-value {
      display: block;
      margin-top: 2px;
      color: var(--text);
      font-size: clamp(1rem, 1.7vw, 1.35rem);
    }

    .dice {
      width: clamp(62px, 6vw, 86px);
      aspect-ratio: 1;
      display: grid;
      place-items: center;
      border: 3px solid var(--team);
      border-radius: 22%;
      color: var(--team-dark);
      background: rgba(13,22,42,.85);
      box-shadow: inset 0 -7px 0 rgba(255,255,255,.05), 0 8px 18px rgba(0,0,0,.4);
      font-size: clamp(1.8rem, 4vw, 3.2rem);
      font-weight: 950;
      line-height: 1;
    }

    .dice.rolling { animation: diceRoll .18s linear infinite; }

    @keyframes diceRoll {
      50% { transform: rotate(5deg) scale(.94); }
    }

    .roll-button {
      width: 100%;
      min-height: 54px;
      border: 0;
      border-radius: 16px;
      color: #fff;
      background: linear-gradient(180deg, color-mix(in srgb, var(--team) 88%, #fff), var(--team-dark));
      box-shadow: inset 0 -5px 0 rgba(0,0,0,.15), 0 7px 14px color-mix(in srgb, var(--team) 22%, transparent);
      cursor: pointer;
      font-weight: 950;
      line-height: 1.05;
    }

    .roll-button small { display: block; margin-top: 3px; font-size: .65rem; opacity: .85; }
    .roll-button:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
    .roll-button:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); }
    .roll-button:disabled { cursor: not-allowed; filter: grayscale(.35); opacity: .42; box-shadow: none; }

    .status-text {
      min-height: 38px;
      margin: 0;
      color: var(--muted);
      font-size: clamp(.66rem, 1vw, .78rem);
      font-weight: 800;
      line-height: 1.25;
      text-align: center;
    }

    .question-layer {
      position: absolute;
      inset: 0;
      z-index: 40;
      display: grid;
      place-items: center;
      padding: clamp(12px, 2vw, 26px);
      background: rgba(10, 31, 48, .68);
      backdrop-filter: blur(4px);
      opacity: 0;
      visibility: hidden;
      transition: opacity .2s ease, visibility .2s ease;
    }

    .question-layer.open { opacity: 1; visibility: visible; }

    .question-card {
      width: min(94%, 560px);
      max-height: 94%;
      overflow: auto;
      padding: clamp(16px, 2.4vw, 28px);
      border: 3px solid var(--team);
      border-radius: 24px;
      color: var(--text);
      background: rgba(16,26,50,.97);
      box-shadow: 0 22px 55px rgba(0,0,0,.5);
      transform: translateY(12px) scale(.96);
      transition: transform .23s ease;
    }

    .question-layer.open .question-card { transform: translateY(0) scale(1); }

    .question-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
    }

    .category-badge,
    .difficulty-badge {
      display: inline-flex;
      align-items: center;
      min-height: 30px;
      padding: 5px 10px;
      border-radius: 999px;
      font-size: .73rem;
      font-weight: 900;
    }

    .category-badge { color: var(--team-dark); background: var(--team-soft); }
    .difficulty-badge { color: #795000; background: #fff2ad; }

    .question-timer {
      display: grid;
      grid-template-columns: auto auto;
      align-items: center;
      gap: 5px 10px;
      margin: -2px 0 14px;
      padding: 8px 11px;
      border: 2px solid color-mix(in srgb, var(--team) 32%, #d8e4ec);
      border-radius: 14px;
      color: var(--team-dark);
      background: var(--team-soft);
      font-size: .72rem;
      font-weight: 950;
      letter-spacing: .06em;
    }

    .timer-value {
      justify-self: end;
      min-width: 2ch;
      font-size: 1.45rem;
      line-height: 1;
      text-align: right;
    }

    .timer-track {
      grid-column: 1 / -1;
      height: 7px;
      overflow: hidden;
      border-radius: 999px;
      background: rgba(255,255,255,.14);
    }

    .timer-fill {
      display: block;
      width: 100%;
      height: 100%;
      border-radius: inherit;
      background: var(--team);
      transform-origin: left center;
      transition: width .25s linear, background .2s ease;
    }

    .question-timer.warning {
      border-color: #e98613;
      color: #9b4200;
      background: #fff0d8;
      animation: timerPulse .6s ease-in-out infinite alternate;
    }

    .question-timer.warning .timer-fill { background: #e14d3d; }

    @keyframes timerPulse {
      to { transform: scale(1.018); }
    }

    .flag-display {
      justify-content: center;
      margin: 0 0 14px;
    }

    .flag-display:not([hidden]) { display: flex; }

    .flag-display img {
      width: min(220px, 60%);
      aspect-ratio: 3 / 2;
      object-fit: cover;
      border-radius: 10px;
      border: 1px solid rgba(255,255,255,.18);
      box-shadow: 0 10px 26px rgba(0,0,0,.35);
    }

    .profile-card {
      display: none;
      grid-template-columns: auto 1fr;
      gap: 6px 12px;
      margin: 0 0 14px;
      padding: 12px 14px;
      border: 1px solid rgba(255,255,255,.14);
      border-radius: 15px;
      background: rgba(255,255,255,.06);
      font-size: clamp(.85rem, 1.3vw, 1rem);
    }

    .profile-card.show { display: grid; }
    .profile-label { color: var(--muted); font-weight: 800; }
    .profile-value { font-weight: 950; }

    .question-prompt {
      margin: 0 0 16px;
      color: var(--text);
      font-size: clamp(1.15rem, 2vw, 1.6rem);
      line-height: 1.25;
    }

    .options {
      display: grid;
      gap: 9px;
    }

    .answer-option {
      width: 100%;
      min-height: 50px;
      padding: 10px 13px;
      border: 2px solid rgba(255,255,255,.16);
      border-radius: 14px;
      color: var(--text);
      background: rgba(255,255,255,.05);
      cursor: pointer;
      font-size: clamp(.92rem, 1.35vw, 1.08rem);
      font-weight: 800;
      text-align: left;
      transition: transform .14s ease, border-color .14s ease, background .14s ease;
    }

    .answer-option:hover:not(:disabled) { transform: translateX(3px); border-color: var(--team); background: var(--team-soft); }
    .answer-option:disabled { cursor: default; }
    .answer-option.correct { border-color: var(--good); color: var(--good); background: var(--good-soft); }
    .answer-option.wrong { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }

    .feedback {
      min-height: 28px;
      margin: 13px 0 0;
      color: var(--muted);
      font-weight: 900;
      line-height: 1.3;
    }

    .feedback.good { color: var(--good); }
    .feedback.bad { color: var(--bad); }

    dialog {
      width: min(92vw, 610px);
      padding: 0;
      border: 1px solid rgba(255,255,255,.1);
      border-radius: 26px;
      color: var(--text);
      background: rgba(16,26,50,.98);
      box-shadow: 0 30px 90px rgba(0,0,0,.6);
    }

    dialog::backdrop { background: rgba(3, 8, 16, .78); backdrop-filter: blur(6px); }

    .dialog-body { padding: clamp(20px, 4vw, 36px); }
    .dialog-kicker { margin: 0 0 6px; color: var(--a); font-size: .78rem; font-weight: 950; letter-spacing: .11em; text-transform: uppercase; }
    .dialog-title { margin: 0; font-size: clamp(1.65rem, 4vw, 2.6rem); line-height: 1.05; letter-spacing: -.035em; }
    .dialog-copy { margin: 10px 0 22px; color: var(--muted); line-height: 1.55; }

    .setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
    .field { display: grid; gap: 6px; }
    .field.full { grid-column: 1 / -1; }
    .field label { font-size: .83rem; font-weight: 900; }
    .field input, .field select {
      width: 100%;
      min-height: 48px;
      padding: 9px 12px;
      border: 2px solid rgba(255,255,255,.18);
      border-radius: 13px;
      color: var(--text);
      background: rgba(255,255,255,.06);
    }

    .check-row {
      display: flex;
      align-items: center;
      gap: 10px;
      min-height: 48px;
      padding: 9px 12px;
      border: 1px solid rgba(255,255,255,.14);
      border-radius: 13px;
      background: rgba(255,255,255,.05);
      font-weight: 800;
    }

    .check-row input { width: 20px; height: 20px; accent-color: var(--a); }

    .mode-field label { margin-bottom: 2px; }

    .mode-select {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .mode-btn {
      min-height: 58px;
      padding: 8px 10px;
      border: 2px solid rgba(255,255,255,.16);
      border-radius: 13px;
      color: var(--text);
      background: rgba(255,255,255,.05);
      cursor: pointer;
      font-weight: 900;
      line-height: 1.35;
      text-align: center;
    }

    .mode-btn small { font-weight: 700; opacity: .78; }

    .mode-btn.selected {
      border-color: var(--a);
      color: #fff;
      background: linear-gradient(180deg, color-mix(in srgb, var(--a) 88%, #fff), var(--a-dark));
    }

    .mode-btn:hover:not(.selected) { border-color: color-mix(in srgb, var(--a) 45%, rgba(255,255,255,.16)); }

    .dialog-actions {
      display: flex;
      justify-content: flex-end;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 22px;
    }

    .primary-button,
    .secondary-button,
    .danger-button {
      min-height: 48px;
      padding: 10px 18px;
      border-radius: 13px;
      cursor: pointer;
      font-weight: 950;
    }

    .primary-button { border: 0; color: #fff; background: linear-gradient(180deg, #1388af, #086684); }
    .secondary-button { border: 2px solid rgba(255,255,255,.18); color: var(--text); background: rgba(255,255,255,.06); }
    .danger-button { border: 0; color: #fff; background: linear-gradient(180deg, #de554c, #ae312b); }

    .winner-icon { margin-bottom: 10px; font-size: 4rem; line-height: 1; text-align: center; }
    .winner-title { text-align: center; }
    .winner-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
    .winner-summary:has(.summary-card[hidden]) { grid-template-columns: 1fr; max-width: 260px; margin-inline: auto; }
    .summary-card { padding: 14px; border: 1px solid rgba(255,255,255,.14); border-radius: 15px; background: rgba(255,255,255,.05); text-align: center; }
    .summary-card strong { display: block; margin-bottom: 5px; }

    .confetti {
      position: fixed;
      inset: 0;
      z-index: 100;
      overflow: hidden;
      pointer-events: none;
    }

    .confetti-piece {
      position: absolute;
      top: -18px;
      left: var(--x);
      width: 10px;
      height: 18px;
      border-radius: 3px;
      background: var(--color);
      animation: confettiFall var(--duration) linear var(--delay) forwards;
    }

    @keyframes confettiFall {
      to { transform: translate3d(var(--drift), 110dvh, 0) rotate(920deg); }
    }

    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0,0,0,0);
      white-space: nowrap;
      border: 0;
    }

    @media (max-width: 1050px) {
      :root { --cell: clamp(34px, min(calc((100vw - 258px) / 18), calc((100dvh - 168px) / 10.8)), 66px); }
      .brand p { display: none; }
      .topbar { min-height: 62px; padding: 8px 12px; }
      .arena { gap: 8px; padding: 8px; }
      .team-header { padding: 6px 9px; }
      .play-layout { gap: 5px; padding: 5px; }
      .control-rail { width: 105px; padding: 7px 5px; }
      .status-text { font-size: .65rem; }
      .board { top: 21px; }
      .start-pad { top: calc(21px + var(--cell) * 10 + 3px); }
    }

    @media (max-width: 760px), (orientation: portrait) and (max-width: 900px) {
      body { overflow: auto; }
      :root { --cell: min(calc((100vw - 32px) / 9), 54px); }
      .app { min-height: 100dvh; display: block; }
      .topbar { position: sticky; top: 0; grid-template-columns: 1fr auto; z-index: 60; }
      .turn-pill { grid-column: 1 / -1; grid-row: 2; justify-self: center; min-height: 36px; padding: 5px 13px; }
      .arena { grid-template-columns: 1fr; }
      .team-panel { min-height: auto; overflow: visible; }
      .play-layout { flex-direction: column; padding: 10px 6px 16px; }
      .team-a .board-shell, .team-a .control-rail,
      .team-b .board-shell, .team-b .control-rail { order: initial; }
      .board-shell { height: calc(24px + var(--cell) * 10.84); }
      .control-rail {
        width: min(100%, calc(var(--cell) * 9));
        flex-direction: row;
        justify-content: space-between;
      }
      .dice { width: 58px; }
      .roll-button { width: min(170px, 43vw); }
      .status-text { max-width: 120px; }
      .question-layer { position: fixed; inset: 0; z-index: 80; }
      .setup-grid { grid-template-columns: 1fr; }
      .field.full { grid-column: auto; }
      .mode-select { grid-template-columns: 1fr 1fr; }
    }

    /* ── 1 Kişilik (solo) mod: yalnızca Team A paneli, ortalanmış tek sütun ──
       --cell normalde iki panelin ortak genişliğine göre (18 kareye bölerek)
       hesaplanır; tek panelde bu formül kullanılırsa pano, dar sabit bir
       genişliğe sığdırılmaya çalışılıp panel kenarında kırpılıyordu (overflow:
       hidden). Tek panelde 9 kareye göre yeniden hesaplayıp panele o genişliğe
       göre esnek bir üst sınır veriyoruz. */
    .arena.mode-solo {
      grid-template-columns: minmax(0, 1fr);
      justify-items: center;
      --cell: clamp(34px, min(calc((100vw - 210px) / 9), calc((100dvh - 180px) / 10.8)), 84px);
    }
    .arena.mode-solo .team-panel.team-b { display: none; }
    .arena.mode-solo .team-panel.team-a { width: 100%; max-width: 960px; }

    /* ── Kritik veri hatası ekranı ── */
    .fatal-error {
      position: fixed;
      inset: 0;
      z-index: 200;
      place-items: center;
      padding: 20px;
      background: rgba(3, 8, 16, .92);
    }

    .fatal-error:not([hidden]) { display: grid; }

    .fatal-error-box {
      width: min(92vw, 480px);
      padding: 28px;
      border: 1px solid rgba(255,255,255,.12);
      border-radius: 22px;
      color: var(--text);
      background: rgba(16,26,50,.97);
      box-shadow: 0 30px 90px rgba(0,0,0,.6);
      text-align: center;
    }

    .fatal-error-icon { margin-bottom: 10px; font-size: 2.6rem; line-height: 1; }
    .fatal-error-box h2 { margin: 0 0 10px; font-size: 1.3rem; }
    .fatal-error-box p { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
      }
    }
