:root {
  --bg: #0e100d;
  --bg-soft: #141812;
  --panel: rgba(22, 27, 20, 0.88);
  --panel-solid: #171c15;
  --panel-raised: #1d241b;
  --line: #2c3529;
  --line-soft: #222a20;
  --ink: #f2f5ea;
  --muted: #a7b0a2;
  --faint: #75806f;
  --lime: #c8f55a;
  --lime-ink: #182006;
  --lime-soft: rgba(200, 245, 90, 0.12);
  --blue: #7dd3fc;
  --blue-soft: rgba(125, 211, 252, 0.12);
  --red: #ff9b8a;
  --amber: #ffd166;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(900px 500px at 82% -12%, rgba(200, 245, 90, 0.13), transparent 60%),
    radial-gradient(700px 420px at -5% 108%, rgba(90, 160, 255, 0.1), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(18px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--lime);
  color: var(--lime-ink);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand-copy {
  display: grid;
  gap: 1px;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-copy span {
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ping {
  min-width: 58px;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  text-align: center;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.conn i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
}

.conn.is-online i {
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(200, 245, 90, 0.1);
}

.conn.is-offline i {
  background: var(--red);
}

.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 18px;
  color: #6d7768;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.footer-dot {
  color: var(--line);
}

/* ---------- Landing ---------- */

.landing {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  align-items: center;
  gap: clamp(28px, 5vw, 76px);
  padding: clamp(26px, 5vh, 64px) 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--lime);
}

.hero-title {
  font-size: clamp(46px, 7.2vw, 92px);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 0.91;
}

.hero-title em {
  color: var(--lime);
  font-style: normal;
}

.hero-lede {
  max-width: 48ch;
  margin-top: 24px;
  color: var(--muted);
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.6;
}

.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 26px;
}

.note-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--faint);
  font-size: 11px;
}

.note-pill strong {
  color: var(--muted);
  font-weight: 600;
}

.landing-card {
  padding: clamp(18px, 2.4vw, 26px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 36%),
    var(--panel);
  box-shadow: var(--shadow);
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.card-heading h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card-heading p {
  margin-top: 5px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.4;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.field-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #10140f;
  color: var(--ink);
  font-size: max(16px, 1rem);
  transition: border-color 150ms ease, background 150ms ease;
}

.input::placeholder {
  color: #5e685a;
}

.input:focus {
  border-color: rgba(200, 245, 90, 0.65);
  background: #12170f;
  outline: none;
}

.input.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 120ms ease, background 150ms ease, border-color 150ms ease;
}

.btn:active {
  transform: translateY(1px);
}

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

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

.btn-primary:hover {
  background: #d6ff72;
}

.btn-secondary {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: #465241;
  background: rgba(255, 255, 255, 0.05);
}

.btn-ghost {
  min-height: 40px;
  padding: 0 11px;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 36px;
  padding: 0 11px;
  font-size: 12px;
}

.btn-danger {
  border-color: rgba(255, 155, 138, 0.3);
  color: var(--red);
}

.divider {
  position: relative;
  margin: 2px 0;
  text-align: center;
}

.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line-soft);
}

.divider span {
  position: relative;
  display: inline-block;
  padding: 0 10px;
  background: var(--panel-solid);
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.room-code-hint {
  margin-top: 4px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
}

/* ---------- Shared room chrome ---------- */

.room-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 0 8px;
}

.room-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.room-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.room-label {
  color: var(--faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.room-code-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px dashed #46543d;
  border-radius: 10px;
  background: var(--lime-soft);
  color: var(--lime);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.16em;
  cursor: pointer;
}

.room-code-button span {
  color: var(--faint);
  font-family: inherit;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.room-code-button:active {
  transform: translateY(1px);
}

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

.lobby-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr);
  gap: 16px;
  align-items: start;
  align-content: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: clamp(16px, 2.2vw, 22px);
}

.panel + .panel {
  margin-top: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-title .muted {
  color: var(--faint);
  font-size: 11px;
}

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

.player-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 68px;
  padding: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.018);
}

.player-card.is-you {
  border-color: rgba(200, 245, 90, 0.28);
  background: rgba(200, 245, 90, 0.045);
}

.player-card.is-empty {
  border-style: dashed;
  color: var(--faint);
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #283125;
  color: var(--lime);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.player-card.is-you .avatar {
  background: var(--lime);
  color: var(--lime-ink);
}

.player-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.player-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--faint);
  font-size: 10px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.status-dot.online {
  background: var(--lime);
}

.status-dot.offline {
  background: var(--red);
}

.host-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--faint);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.selected-game {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.018);
}

.selected-game.is-empty {
  border-style: dashed;
}

.selected-game .game-icon {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.selected-game strong {
  display: block;
  font-size: 14px;
}

.selected-game span {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.4;
}

.ready-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.ready-row .btn {
  flex: 1;
  min-width: 150px;
}

.ready-note {
  flex: 1;
  min-width: 150px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
}

.catalog-grid {
  display: grid;
  gap: 10px;
}

.game-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 120ms ease;
}

.game-card:hover {
  border-color: #43503d;
  background: rgba(255, 255, 255, 0.035);
}

.game-card:active {
  transform: translateY(1px);
}

.game-card.is-selected {
  border-color: rgba(200, 245, 90, 0.55);
  background: rgba(200, 245, 90, 0.055);
}

.game-card.is-locked {
  cursor: default;
}

.game-card.is-locked:hover {
  border-color: var(--line-soft);
  background: rgba(255, 255, 255, 0.018);
}

.game-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #10140f;
  color: var(--lime);
  font-size: 20px;
}

.game-card[data-game="penalty"] .game-icon {
  color: var(--blue);
  border-color: rgba(125, 211, 252, 0.24);
  background: var(--blue-soft);
}

.game-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.game-copy strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.game-copy span {
  color: var(--faint);
  font-size: 11px;
  line-height: 1.45;
}

.game-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.room-tip {
  display: flex;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
}

.room-tip strong {
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Countdown ---------- */

.countdown-screen {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 30px 0;
}

.countdown-kicker {
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.countdown-number {
  margin: 10px 0 4px;
  color: var(--lime);
  font-size: clamp(96px, 18vw, 190px);
  font-weight: 800;
  letter-spacing: -0.08em;
  line-height: 0.9;
}

.countdown-sub {
  color: var(--muted);
  font-size: 14px;
}

.countdown-players {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 13px;
}

.countdown-vs {
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.14em;
}

/* ---------- Game shell ---------- */

.game-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 0 8px;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.game-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-title .game-icon {
  width: 36px;
  height: 36px;
  font-size: 16px;
}

.game-title h1 {
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: -0.03em;
}

.game-title p {
  margin-top: 2px;
  color: var(--faint);
  font-size: 11px;
}

.game-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 16px;
  align-items: stretch;
  align-content: start;
}

.game-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(14px, 2.6vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(500px 260px at 50% 0%, rgba(200, 245, 90, 0.06), transparent 70%),
    var(--panel);
}

.game-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.side-panel {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.side-panel h2 {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.scoreline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.score-player {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.score-player.is-right {
  text-align: right;
}

.score-player strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-player span {
  color: var(--faint);
  font-size: 10px;
}

.score-value {
  color: var(--lime);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
}

.score-sep {
  color: var(--faint);
  font-size: 12px;
}

.turn-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.turn-banner .status-dot {
  flex: 0 0 auto;
}

.turn-banner.is-you {
  border-color: rgba(200, 245, 90, 0.24);
  background: var(--lime-soft);
  color: var(--ink);
}

.game-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.result-card {
  padding: 14px;
  border: 1px solid rgba(200, 245, 90, 0.26);
  border-radius: 12px;
  background: var(--lime-soft);
  text-align: center;
}

.result-card h3 {
  font-size: 18px;
  letter-spacing: -0.03em;
}

.result-card p {
  margin: 5px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.result-card .btn {
  width: 100%;
}

/* ---------- Tic-tac-toe ---------- */

.ttt-wrap {
  width: min(100%, 480px);
  display: grid;
  gap: 12px;
}

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

.ttt-cell {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 55%),
    #121611;
  color: var(--ink);
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 100ms ease;
}

.ttt-cell:hover:not(:disabled) {
  border-color: #46543d;
  background-color: #171d14;
}

.ttt-cell:active:not(:disabled) {
  transform: scale(0.985);
}

.ttt-cell:disabled {
  cursor: default;
}

.ttt-cell.is-x {
  color: var(--lime);
  text-shadow: 0 0 30px rgba(200, 245, 90, 0.2);
}

.ttt-cell.is-o {
  color: var(--blue);
  text-shadow: 0 0 30px rgba(125, 211, 252, 0.2);
}

.ttt-cell.is-win {
  border-color: var(--lime);
  background: rgba(200, 245, 90, 0.09);
}

.ttt-cell.is-win.is-o {
  border-color: var(--blue);
  background: rgba(125, 211, 252, 0.09);
}

.ttt-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--faint);
  font-size: 11px;
}

/* ---------- Penalty ---------- */

.penalty-wrap {
  width: min(100%, 760px);
  display: grid;
  gap: 12px;
}

.goal-frame {
  position: relative;
  width: 100%;
  height: clamp(230px, 40vh, 430px);
  height: clamp(230px, 40svh, 430px);
  padding: 10px;
  border: 3px solid rgba(242, 245, 234, 0.78);
  border-bottom-width: 5px;
  border-radius: 8px 8px 14px 14px;
  background:
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(242, 245, 234, 0.045) 22px 23px),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(242, 245, 234, 0.045) 22px 23px),
    linear-gradient(180deg, #283a25 0%, #1a2a1d 58%, #111a12 100%);
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.55),
    0 18px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.goal-frame::before {
  content: "";
  position: absolute;
  inset: 7% 4% 13%;
  border: 1px solid rgba(242, 245, 234, 0.16);
  border-radius: 3px;
  pointer-events: none;
}

.goal-frame::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 24%;
  height: 4px;
  border-radius: 999px;
  background: rgba(242, 245, 234, 0.25);
  transform: translateX(-50%);
  pointer-events: none;
}

.goal-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  width: 100%;
  height: 100%;
}

.goal-zone {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.008);
  color: transparent;
  font-size: clamp(20px, 3vw, 34px);
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease, transform 100ms ease;
}

.goal-zone:hover:not(:disabled) {
  border-color: rgba(200, 245, 90, 0.55);
  background: rgba(200, 245, 90, 0.1);
}

.goal-zone:active:not(:disabled) {
  transform: scale(0.985);
}

.goal-zone:disabled {
  cursor: default;
}

.goal-zone.is-selected {
  border-color: var(--lime);
  background: rgba(200, 245, 90, 0.15);
  color: var(--lime);
}

.goal-zone.is-keeper-selected {
  border-color: var(--blue);
  background: rgba(125, 211, 252, 0.14);
  color: var(--blue);
}

.goal-zone.is-shot {
  border-color: var(--lime);
  background: rgba(200, 245, 90, 0.15);
  color: var(--lime);
}

.goal-zone.is-dive {
  border-color: var(--blue);
  background: rgba(125, 211, 252, 0.14);
  color: var(--blue);
}

.goal-zone.is-miss {
  border-color: rgba(255, 155, 138, 0.55);
  background: rgba(255, 155, 138, 0.1);
  color: var(--red);
}

.zone-mark {
  display: grid;
  place-items: center;
  width: 62%;
  height: 62%;
  border-radius: 50%;
  font-size: clamp(18px, 2.8vw, 30px);
  line-height: 1;
}

.zone-mark-stack {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 100%;
}

.zone-mark-stack .zone-mark {
  width: 44%;
  height: 62%;
  font-size: clamp(14px, 2vw, 22px);
}

.zone-mark.ball {
  background: #f4f7ee;
  color: #1b2417;
  box-shadow: 0 0 24px rgba(242, 245, 234, 0.3);
}

.zone-mark.gloves {
  background: var(--blue);
  color: #0a1b24;
  box-shadow: 0 0 24px rgba(125, 211, 252, 0.24);
}

.penalty-result {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: rgba(8, 12, 7, 0.52);
}

.result-badge {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 18px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(18, 24, 16, 0.94);
  text-align: center;
  box-shadow: var(--shadow);
}

.result-badge strong {
  font-size: clamp(28px, 5vw, 48px);
  letter-spacing: -0.06em;
  line-height: 1;
}

.result-badge span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-badge.is-goal strong {
  color: var(--lime);
}

.result-badge.is-save strong {
  color: var(--blue);
}

.result-badge.is-miss strong {
  color: var(--red);
}

.penalty-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--faint);
  font-size: 11px;
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.timer.is-urgent {
  border-color: rgba(255, 155, 138, 0.35);
  color: var(--red);
}

.role-card {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
}

.role-card .role-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--lime-soft);
  color: var(--lime);
  font-size: 16px;
}

.role-card.is-keeper .role-icon {
  background: var(--blue-soft);
  color: var(--blue);
}

.role-card.is-miss .role-icon {
  background: rgba(255, 155, 138, 0.1);
  color: var(--red);
}

.role-card strong {
  display: block;
  font-size: 13px;
}

.role-card span {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.45;
}

.choice-panel {
  display: grid;
  gap: 12px;
}

.zone-label {
  color: var(--faint);
  font-size: 11px;
  line-height: 1.4;
}

.power-row {
  display: grid;
  gap: 7px;
}

.power-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 11px;
}

.power-head strong {
  color: var(--lime);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
}

.power-range {
  width: 100%;
  height: 30px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.power-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--lime), var(--amber));
}

.power-range::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border: 2px solid var(--lime-ink);
  border-radius: 50%;
  background: var(--lime);
  -webkit-appearance: none;
  appearance: none;
}

.power-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--lime), var(--amber));
}

.power-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 2px solid var(--lime-ink);
  border-radius: 50%;
  background: var(--lime);
}

.history {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.history-dot {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
}

.history-dot.is-goal {
  border-color: rgba(200, 245, 90, 0.3);
  background: var(--lime-soft);
  color: var(--lime);
}

.history-dot.is-save {
  border-color: rgba(125, 211, 252, 0.3);
  background: var(--blue-soft);
  color: var(--blue);
}

.history-dot.is-miss {
  border-color: rgba(255, 155, 138, 0.3);
  background: rgba(255, 155, 138, 0.08);
  color: var(--red);
}

/* ---------- Toast / misc ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 20;
  max-width: min(90vw, 460px);
  padding: 11px 15px;
  border: 1px solid #43503d;
  border-radius: 10px;
  background: #1b2319;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  border-color: rgba(255, 155, 138, 0.4);
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  color: var(--ink);
  text-align: center;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 120px;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

.muted {
  color: var(--faint);
}

.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;
}

/* ---------- Responsive: iPad and smaller ---------- */

@media (max-width: 980px) {
  .landing {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 30px;
    max-width: 660px;
    margin: 0 auto;
    width: 100%;
  }

  .hero-lede {
    max-width: 54ch;
  }

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

  .game-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .game-actions {
    margin-top: 0;
  }

  .ttt-wrap {
    width: min(100%, 480px);
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding:
      max(14px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
  }

  .brand-copy span {
    display: none;
  }

  .ping {
    display: none;
  }

  .landing {
    gap: 24px;
    padding: 26px 0 18px;
  }

  .hero-title {
    font-size: clamp(44px, 13vw, 68px);
  }

  .hero-lede {
    margin-top: 18px;
    font-size: 15px;
  }

  .hero-notes {
    margin-top: 18px;
  }

  .room-screen,
  .game-screen {
    padding-top: 18px;
  }

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

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

  .goal-frame {
    height: clamp(220px, 34svh, 340px);
    padding: 7px;
  }

  .game-stage {
    padding: 12px;
  }

  .ttt-board {
    gap: 6px;
  }

  .ttt-cell {
    border-radius: 10px;
    font-size: clamp(36px, 13vw, 58px);
  }

  .game-title p {
    display: none;
  }

  .game-header-actions .btn {
    min-height: 38px;
    padding: 0 10px;
  }
}

@media (min-width: 700px) and (max-width: 1100px) {
  .app-shell {
    padding:
      max(18px, env(safe-area-inset-top))
      clamp(24px, 4vw, 42px)
      max(14px, env(safe-area-inset-bottom))
      clamp(24px, 4vw, 42px);
  }

  .landing {
    min-height: calc(100svh - 190px);
  }

  .hero-title {
    font-size: clamp(52px, 7.4vw, 78px);
  }
}

@media (min-width: 900px) and (max-height: 820px) {
  .landing {
    min-height: 0;
    padding: 10px 0 16px;
  }

  .hero-title {
    font-size: clamp(46px, 6.2vw, 72px);
  }

  .hero-lede {
    margin-top: 16px;
  }

  .hero-notes {
    margin-top: 18px;
  }

  .room-screen,
  .game-screen {
    padding-top: 14px;
    gap: 12px;
  }

  .ttt-wrap {
    width: min(100%, 450px);
  }

  .game-stage {
    padding: 12px;
  }
}

@media (orientation: portrait) and (min-width: 700px) {
  .app-shell {
    max-width: 780px;
  }

  .landing {
    min-height: 0;
  }

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

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

  .goal-frame {
    height: clamp(260px, 38svh, 430px);
  }
}

@media (pointer: coarse) {
  .btn {
    min-height: 48px;
  }

  .btn-sm {
    min-height: 40px;
  }

  .ttt-cell,
  .goal-zone {
    -webkit-user-select: none;
    user-select: none;
  }
}

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