:root {
  --bg: #05010f;
  --bg-elev: #0d0620;
  --bg-card: #140a28;
  --text: #e8f6ff;
  --muted: #8b9bb8;
  --line: #2a1a4a;
  --lava: #ff2bd6;
  --lava-deep: #9b00ff;
  --lava-glow: rgba(255, 43, 214, 0.55);
  --cyan: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.45);
  --safe: #39ff14;
  --safe-deep: #12a00a;
  --warn: #ffd447;
  --pulse: #ff2bd6;
  --bug: #7cff4a;
  --alien: #b6ff3b;
  --cowboy: #ff9f43;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.65);
  --radius: 18px;
  --font: "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --app-height: 100dvh;
  --touch-min: 48px;
  --pad-x: 16px;
  --jitter: 0;
  --pulse-ms: 900ms;
}

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

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: var(--app-height);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  overscroll-behavior: none;
  position: fixed;
  inset: 0;
}

body {
  min-height: 100dvh;
  min-height: var(--app-height);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(155, 0, 255, 0.25), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(0, 240, 255, 0.12), transparent 45%),
    var(--bg);
}

body.is-playing {
  touch-action: none;
  overscroll-behavior: none;
}

#scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.35;
}

#app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  height: 100dvh;
  height: var(--app-height);
  margin: 0 auto;
  overflow: hidden;
  transform: translateZ(0);
  z-index: 1;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding:
    max(12px, calc(var(--sat) + 8px))
    max(var(--pad-x), var(--sar))
    max(12px, calc(var(--sab) + 10px))
    max(var(--pad-x), var(--sal));
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.screen[hidden] {
  display: none !important;
}

.home-glow {
  position: absolute;
  left: 50%;
  top: -12%;
  width: 130%;
  height: 55%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, var(--lava-glow), transparent 65%);
  pointer-events: none;
  filter: blur(10px);
}

.orbit-ring {
  position: absolute;
  left: 50%;
  top: 18%;
  width: 220px;
  height: 220px;
  margin: -110px 0 0 -110px;
  border: 1px dashed rgba(0, 240, 255, 0.25);
  border-radius: 50%;
  animation: spin 18s linear infinite;
  pointer-events: none;
}

.orbit-ring::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  top: 0;
  left: 50%;
}

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

.home-header {
  position: relative;
  margin-top: clamp(12px, 5vh, 8vh);
  text-align: center;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
  font-weight: 700;
  text-shadow: 0 0 12px var(--cyan-glow);
}

.home-header h1,
.lobby-header h2,
.board-header h2,
.result-card h2 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 800;
  text-transform: uppercase;
}

.home-header .lava {
  color: var(--lava);
  text-shadow:
    0 0 8px var(--lava-glow),
    0 0 28px var(--lava-glow),
    3px 0 var(--cyan);
}

.tagline {
  margin: 14px auto 0;
  max-width: 32ch;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.mode-picker {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: clamp(14px, 3vh, 28px) 0 clamp(12px, 2vh, 18px);
}

.mode-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 10, 40, 0.95), rgba(8, 4, 20, 0.95));
  color: var(--text);
  border-radius: 14px;
  padding: 14px 12px;
  min-height: var(--touch-min);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
  -webkit-touch-callout: none;
}

.mode-btn:active {
  transform: scale(0.98);
}

.mode-btn.selected {
  border-color: var(--lava);
  box-shadow:
    inset 0 0 0 1px rgba(255, 43, 214, 0.35),
    0 0 18px rgba(255, 43, 214, 0.25);
  background: linear-gradient(180deg, rgba(255, 43, 214, 0.18), rgba(20, 10, 40, 0.5));
}

.mode-name {
  display: block;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.mode-desc {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.mode-btn-wide {
  grid-column: 1 / -1;
}

.name-gate,
.field-label {
  margin-bottom: 12px;
  display: block;
}

.name-gate-label,
.field-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.name-input {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(8, 4, 20, 0.9);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  font-size: 1rem;
  min-height: var(--touch-min);
  outline: none;
}

.name-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.2);
}

.name-gate-status {
  min-height: 1.2em;
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--warn);
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-primary,
.btn-ghost,
.btn-neon {
  appearance: none;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  -webkit-touch-callout: none;
}

.btn-primary {
  width: 100%;
  padding: 16px 20px;
  min-height: 52px;
  background: linear-gradient(90deg, var(--lava), #ff6a00 40%, var(--lava-deep));
  color: #120018;
  box-shadow: 0 0 24px var(--lava-glow);
  font-size: 1.02rem;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled,
.btn-primary.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.35);
}

.btn-neon {
  width: 100%;
  padding: 14px 18px;
  min-height: var(--touch-min);
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.2), inset 0 0 12px rgba(0, 240, 255, 0.08);
}

.btn-neon:active {
  transform: scale(0.98);
  background: rgba(0, 240, 255, 0.1);
}

.btn-ghost {
  width: 100%;
  padding: 14px 18px;
  min-height: var(--touch-min);
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-ghost:active {
  transform: scale(0.98);
  background: var(--bg-elev);
}

.btn-mini {
  width: auto;
  padding: 8px 12px;
  min-height: 40px;
  font-size: 0.75rem;
}

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

.home-footer {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.best-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(13, 6, 32, 0.9);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.best-row strong {
  color: var(--cyan);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px var(--cyan-glow);
}

/* Lobby */
.lobby-header,
.board-header {
  text-align: center;
  margin-bottom: 10px;
}

.lobby-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  border-radius: 12px;
  padding: 12px;
  min-height: 48px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.tab.selected {
  color: var(--bg);
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 16px var(--cyan-glow);
}

.lobby-pane {
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding-bottom: 8px;
}

.lobby-room {
  margin-top: 8px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(13, 6, 32, 0.85);
}

.lobby-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.lobby-code-row span {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
}

.lobby-code-row strong {
  font-size: 1.4rem;
  letter-spacing: 0.2em;
  color: var(--warn);
  text-shadow: 0 0 12px rgba(255, 212, 71, 0.4);
}

.pot-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.pot-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.pot-row div {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
}

.pot-row span {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.pot-row strong {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.pay-box {
  margin: 8px 0 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--cyan);
  background: rgba(0, 240, 255, 0.06);
}

.pay-label {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--cyan);
}

.pay-invoice {
  margin: 0 0 10px;
  font-size: 0.72rem;
  word-break: break-all;
  color: var(--text);
  line-height: 1.35;
}

.mono {
  font-family: var(--mono);
}

.room-players {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  max-height: 28vh;
  overflow: auto;
}

.room-players li {
  display: flex;
  justify-content: space-between;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.room-players .paid {
  color: var(--safe);
}

.room-players .wait {
  color: var(--warn);
}

.board-filter,
.board-filter-label select {
  appearance: none;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
}

.field-label .board-filter,
.field-label .name-input {
  margin-top: 6px;
  display: block;
  width: 100%;
}

/* HUD / play */
.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.hud-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-block.center {
  align-items: center;
}

.hud-block.right {
  align-items: flex-end;
}

.hud-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud-value {
  font-size: 1.45rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan-glow);
}

.hud-value.small {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-shadow: none;
}

.analytics-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(8, 4, 20, 0.88);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.an-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.an-item span {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.an-item strong {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.an-item.wide {
  grid-column: 1 / -1;
}

.an-item.wide strong {
  color: var(--warn);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: normal;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(0, 240, 255, 0.25);
  background: #020010;
  touch-action: none;
  box-shadow: inset 0 0 40px rgba(155, 0, 255, 0.15);
  transform: translate3d(calc(var(--jitter) * 2px), calc(var(--jitter) * -1.5px), 0);
}

.gl,
.fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.fx {
  pointer-events: none;
  z-index: 4;
}

.pulse-border {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  pointer-events: none;
  z-index: 3;
  animation: pulseBorder var(--pulse-ms) ease-in-out infinite;
}

@keyframes pulseBorder {
  0%,
  100% {
    box-shadow: inset 0 0 0 2px rgba(255, 43, 214, 0.15), 0 0 0 0 rgba(0, 240, 255, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px rgba(255, 43, 214, 0.55), 0 0 24px 2px rgba(0, 240, 255, 0.25);
  }
}

.safe-zone {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56%;
  height: 56%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px dashed rgba(57, 255, 20, 0.55);
  box-shadow: inset 0 0 40px rgba(57, 255, 20, 0.08);
  pointer-events: none;
  opacity: 0;
  z-index: 2;
  transition: opacity 0.25s ease;
}

.safe-zone.on {
  opacity: 1;
}

.hold-target {
  position: absolute;
  left: 50%;
  top: 58%;
  width: 128px;
  height: 128px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  z-index: 5;
  cursor: pointer;
}

.hold-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 240, 255, 0.65);
  box-shadow:
    0 0 28px rgba(255, 43, 214, 0.55),
    inset 0 0 24px rgba(0, 240, 255, 0.25);
  animation: ringPulse 1.4s ease-in-out infinite;
}

.hold-core {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff6c2 0%, #ff2bd6 28%, #9b00ff 62%, #120018 100%);
  box-shadow: 0 0 40px rgba(255, 43, 214, 0.75);
}

.hold-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 0 10px #000, 0 0 12px var(--cyan);
  pointer-events: none;
}

.hold-target.held .hold-ring {
  border-color: var(--safe);
  box-shadow:
    0 0 32px rgba(57, 255, 20, 0.55),
    inset 0 0 24px rgba(57, 255, 20, 0.25);
  animation: none;
}

@keyframes ringPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.85;
  }
}

.bugs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.bug {
  position: absolute;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50% 40% 50% 40%;
  background:
    radial-gradient(circle at 30% 30%, #e8ff9a, var(--alien) 45%, #1a4a00 100%);
  box-shadow: 0 0 16px rgba(182, 255, 59, 0.6);
  pointer-events: auto;
  touch-action: none;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #102000;
  animation: bugBob 0.55s ease-in-out infinite alternate;
}

.bug.cowboy {
  background: radial-gradient(circle at 30% 30%, #ffe0a0, var(--cowboy) 50%, #5a2a00 100%);
  color: #2a1200;
  box-shadow: 0 0 16px rgba(255, 159, 67, 0.55);
  border-radius: 8px;
}

@keyframes bugBob {
  from {
    transform: scale(1) rotate(-8deg);
  }
  to {
    transform: scale(1.1) rotate(8deg);
  }
}

.disaster {
  position: absolute;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  z-index: 8;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(10, 0, 24, 0.9);
  border: 1px solid var(--lava);
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.8rem;
  box-shadow: 0 0 24px var(--lava-glow);
  pointer-events: none;
  white-space: nowrap;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 9;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--cyan);
  color: var(--text);
  font-size: 0.85rem;
  pointer-events: none;
}

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

.result-card {
  margin: auto 0;
  padding: 22px 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--bg-card), var(--bg-elev));
  border: 1px solid rgba(0, 240, 255, 0.25);
  box-shadow: var(--shadow), 0 0 40px rgba(255, 43, 214, 0.12);
  text-align: center;
}

.result-sub {
  margin: 8px 0 18px;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  padding: 12px 8px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
}

.stat-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
}

.result-quote,
.result-ai {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.result-ai {
  color: var(--warn);
  font-size: 0.88rem;
}

.submit-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

.logged-as,
.submit-status,
.board-status,
.board-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.board-sub {
  margin: 6px 0 12px;
  font-size: 0.9rem;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.board-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.board-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.board-list li {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.board-rank {
  font-weight: 800;
  color: var(--lava);
  font-variant-numeric: tabular-nums;
}

.board-name {
  font-weight: 700;
  text-align: left;
}

.board-meta {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.board-score {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
}

body.shake .stage {
  animation: quake 0.35s linear;
}

@keyframes quake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-6px, 3px);
  }
  40% {
    transform: translate(7px, -4px);
  }
  60% {
    transform: translate(-5px, -2px);
  }
  80% {
    transform: translate(4px, 5px);
  }
}

@media (min-width: 520px) {
  #app {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

@media (max-height: 700px) {
  .home-header {
    margin-top: 8px;
  }
  .tagline {
    font-size: 0.9rem;
  }
  .mode-picker {
    margin: 10px 0;
  }
  .hold-target {
    width: 112px;
    height: 112px;
  }
}

@media (max-height: 500px) {
  .analytics-panel {
    display: none;
  }
}

@media (pointer: coarse) {
  .mode-btn,
  .btn-primary,
  .btn-ghost,
  .btn-neon,
  .name-input {
    min-height: 52px;
  }
  .bug {
    width: 54px;
    height: 54px;
    margin: -27px 0 0 -27px;
  }
}

@media (display-mode: standalone) {
  .home-header {
    margin-top: max(8px, var(--sat));
  }
}

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

@media (max-width: 380px) {
  .hud-value {
    font-size: 1.2rem;
  }
  .pot-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.pot-row {
    grid-template-columns: repeat(2, 1fr);
  }
}


.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.result-lobby {
  margin: 12px 0;
  text-align: left;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}

.result-lobby .board-list {
  max-height: 28vh;
}
