/* ——— Snake: a full-screen game that borrows the messenger's theme ——— */

html.game-open,
body.game-open {
  overflow: hidden;
}

.game-invite {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 2px 12px 10px;
  padding: 9px 12px 9px 9px;
  border: 0;
  border-radius: 16px;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(47, 224, 138, 0.5), transparent 62%),
    linear-gradient(135deg, #167a48, #0d5535);
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(13, 85, 53, 0.26);
  transition: transform 0.16s var(--ease), box-shadow 0.16s;
}
.game-invite:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(13, 85, 53, 0.32);
}
.game-invite:active {
  transform: scale(0.985);
}
.game-invite-art {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.game-invite-art svg {
  width: 38px;
  height: 38px;
}
.game-invite-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.game-invite-text strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}
.game-invite-text span {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.76);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-invite-go {
  flex: 0 0 auto;
  display: inline-flex;
  color: rgba(255, 255, 255, 0.7);
}
.game-invite-go svg {
  width: 18px;
  height: 18px;
}
@media (max-width: 640px) {
  .game-invite {
    margin: 2px 10px 8px;
    padding: 7px 10px 7px 7px;
  }
  .game-invite-art {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .game-invite-art svg {
    width: 33px;
    height: 33px;
  }
}

.game-screen {
  position: fixed;
  inset: 0;
  z-index: 4800;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 90% at 12% 0%, color-mix(in oklab, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(100% 80% at 88% 100%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 55%),
    var(--bg-root);
  color: var(--text);
  opacity: 0;
  transition: opacity 0.22s var(--ease);
  overscroll-behavior: none;
}
.game-screen.is-open {
  opacity: 1;
}
.game-screen * {
  box-sizing: border-box;
}

.game-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(var(--lg-edge-top) + 4px) max(16px, calc(var(--lg-edge-right) + 12px)) 10px
    max(16px, calc(var(--lg-edge-left) + 12px));
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
.game-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.game-brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #2fe08a, #17924f 55%, #0d6a3a);
  box-shadow: 0 8px 20px rgba(23, 146, 79, 0.32);
  flex: 0 0 auto;
}
.game-brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1.04;
  min-width: 0;
}
.game-brand-name strong {
  font-size: 17px;
  letter-spacing: -0.01em;
}
.game-brand-name span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.game-header-spacer {
  flex: 1 1 auto;
}
.game-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.game-icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.game-icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.game-icon-btn:active {
  transform: scale(0.94);
}
.game-icon-btn.is-on {
  background: color-mix(in oklab, #22b866 22%, var(--surface));
  border-color: color-mix(in oklab, #22b866 55%, var(--border));
  color: #189b52;
}
.game-icon-btn.is-off {
  background: color-mix(in oklab, var(--danger) 12%, var(--surface));
  border-color: color-mix(in oklab, var(--danger) 42%, var(--border));
  color: var(--danger);
}
.game-icon-btn[hidden] {
  display: none;
}

.game-hud {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.game-hud[hidden] {
  display: none;
}
.game-hud-chip {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.game-hud-chip small {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.game-hud-chip strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.game-hud-chip.is-accent {
  background: color-mix(in oklab, var(--accent) 13%, var(--surface));
  border-color: color-mix(in oklab, var(--accent) 34%, var(--border));
}

.game-main {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  overflow: hidden;
}

.game-panel {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  justify-content: center;
  padding: 26px max(18px, calc(var(--lg-edge-right) + 18px)) 34px
    max(18px, calc(var(--lg-edge-left) + 18px));
  animation: game-panel-in 0.28s var(--ease);
}
.game-panel[hidden] {
  display: none;
}
@keyframes game-panel-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
.game-wrap {
  width: 100%;
  max-width: 1120px;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  align-content: start;
}
.game-wrap.is-single {
  grid-template-columns: minmax(0, 560px);
  justify-content: center;
}
@media (max-width: 860px) {
  .game-wrap {
    grid-template-columns: minmax(0, 1fr);
    /* Chromium sizes a single-column auto row from a clipped item's padding,
       which collapsed the hero menu to a 62px strip under its overflow clip.
       min-content rows size the tracks from the real menu every time. */
    grid-auto-rows: min-content;
    gap: 16px;
  }
}

.game-hero {
  position: relative;
  /* A single-column grid (phones) sizes the row from this item's padding when
     overflow clips the content, so the menu collapsed to a 62px strip with
     only the badge visible. Pinning min-height to max-content keeps the row
     sized by the real menu, the clip stays for the corner decoration. */
  min-height: max-content;
  overflow: hidden;
  padding: 30px 28px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(120% 130% at 100% 0%, rgba(47, 224, 138, 0.26), transparent 58%),
    color-mix(in oklab, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.game-hero::after {
  content: '';
  position: absolute;
  right: -60px;
  bottom: -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 26px solid color-mix(in oklab, #22b866 16%, transparent);
  pointer-events: none;
}
.game-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in oklab, #22b866 14%, var(--surface));
  color: #189b52;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.game-hero h1 {
  margin: 16px 0 8px;
  font-size: clamp(28px, 4.4vw, 44px);
  line-height: 1.03;
  letter-spacing: -0.03em;
}
.game-hero p {
  margin: 0;
  max-width: 46ch;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.55;
}
.game-hero-art {
  position: relative;
  height: 132px;
  margin-top: 22px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--accent) 8%, transparent), transparent),
    repeating-linear-gradient(0deg, color-mix(in oklab, var(--muted) 13%, transparent) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(90deg, color-mix(in oklab, var(--muted) 13%, transparent) 0 1px, transparent 1px 22px);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  overflow: hidden;
}
.game-hero-art svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.game-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
}
.game-stat {
  padding: 13px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.game-stat small {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.game-stat strong {
  font-size: 21px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.game-side {
  display: grid;
  gap: 14px;
  align-content: start;
}
.game-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.game-card h2 {
  margin: 0 0 4px;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.game-card p.game-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.game-primary,
.game-secondary,
.game-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s, background 0.15s;
  white-space: nowrap;
}
.game-primary {
  color: #fff;
  background: linear-gradient(140deg, #29cf7c, #129153);
  box-shadow: 0 10px 24px rgba(24, 155, 82, 0.28);
}
.game-primary:hover {
  filter: brightness(1.05);
}
.game-primary:active,
.game-secondary:active,
.game-ghost:active {
  transform: scale(0.98);
}
.game-primary:disabled,
.game-secondary:disabled {
  opacity: 0.5;
  cursor: default;
  filter: none;
  box-shadow: none;
}
.game-primary.is-wide,
.game-secondary.is-wide {
  width: 100%;
}
.game-secondary {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.game-secondary:hover {
  background: var(--hover);
}
.game-ghost {
  background: transparent;
  color: var(--muted);
  min-height: 40px;
  padding: 0 12px;
}
.game-ghost:hover {
  background: var(--hover);
  color: var(--text);
}

.game-join {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.game-join input {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.game-join input::placeholder {
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--faint);
}
.game-join input:focus {
  outline: 2px solid color-mix(in oklab, var(--accent) 50%, transparent);
  outline-offset: 1px;
}

.game-missions {
  display: grid;
  gap: 8px;
}
.game-mission {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
}
.game-mission.is-done {
  border-color: color-mix(in oklab, #22b866 42%, var(--border));
  background: color-mix(in oklab, #22b866 10%, var(--surface-2));
}
.game-mission-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: color-mix(in oklab, var(--accent) 14%, var(--surface));
  color: var(--accent);
}
.game-mission-main {
  min-width: 0;
}
.game-mission-main strong {
  display: block;
  font-size: 13px;
}
.game-mission-main small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
}
.game-mission-bar {
  height: 4px;
  border-radius: 99px;
  background: color-mix(in oklab, var(--muted) 22%, transparent);
  margin-top: 6px;
  overflow: hidden;
}
.game-mission-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #29cf7c, #129153);
}
.game-mission-reward {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.game-mission.is-done .game-mission-reward {
  color: #189b52;
}
.game-week-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.game-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.game-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11.5px;
}
.game-key kbd {
  font-family: inherit;
  font-weight: 700;
  font-size: 11px;
  color: var(--text);
}

/* ——— Lobby ——— */

.game-lobby-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.game-code {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.game-code-value {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 750;
  letter-spacing: 0.16em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.game-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.game-copy:hover {
  background: var(--hover);
}
.game-players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 9px;
  margin-top: 4px;
}
.game-player {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-width: 0;
}
.game-player.is-you {
  border-color: color-mix(in oklab, var(--accent) 45%, var(--border));
  background: color-mix(in oklab, var(--accent) 8%, var(--surface-2));
}
.game-player.is-offline {
  opacity: 0.55;
}
.game-player-body {
  min-width: 0;
  flex: 1 1 auto;
}
.game-player-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}
.game-player-name > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-player-name em,
.game-player-name .game-host-crown {
  flex: 0 0 auto;
}
.game-player-name em {
  font-style: normal;
  font-size: 10px;
  color: var(--muted);
}
.game-player-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 6px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}
.game-player-state {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
}
.game-player-state.is-ready {
  color: #189b52;
}
.game-player-state.is-ready svg {
  color: #189b52;
}
.game-player-state.is-alive {
  color: #189b52;
}
.game-player-state.is-dead {
  color: var(--danger);
}
.game-player .game-mic-dot {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: #189b52;
}
.game-player .game-mic-dot.is-off {
  color: var(--faint);
}
.game-host-crown {
  color: #d99a12;
  display: inline-flex;
}

.game-lobby-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
}
.game-lobby-actions .game-spacer {
  flex: 1 1 auto;
}
.game-ready-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}
.game-side-note {
  display: flex;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--accent) 8%, var(--surface-2));
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.45;
}
.game-side-note svg {
  flex: 0 0 auto;
  color: var(--accent);
  margin-top: 1px;
}

/* ——— Stage ——— */

.game-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* Vertical panning has nothing to scroll while playing, but it is what lets
     the death card be scrolled on a short screen. The thumbs and the boost
     button keep their own touch-action: none. */
  touch-action: pan-y;
  user-select: none;
  background:
    radial-gradient(90% 70% at 50% 40%, color-mix(in oklab, var(--chat-bg) 88%, transparent), var(--bg-root));
}
.game-stage[hidden] {
  display: none;
}
.game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.game-overlay-hud {
  position: absolute;
  top: calc(var(--lg-edge-top) + 10px);
  left: calc(var(--lg-edge-left) + 14px);
  display: flex;
  gap: 7px;
  pointer-events: none;
  z-index: 3;
  flex-wrap: wrap;
  max-width: calc(100% - 120px);
}
.game-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  color: var(--text-2);
}
.game-pill strong {
  color: var(--text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.game-pill.is-score strong {
  color: #189b52;
}

.game-icon-fab {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 84%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.game-icon-fab.is-top-right {
  top: calc(var(--lg-edge-top) + 10px);
  right: calc(var(--lg-edge-right) + 14px);
}

.game-voice-strip {
  position: absolute;
  left: calc(var(--lg-edge-left) + 14px);
  bottom: calc(var(--lg-edge-bottom) + 14px);
  display: flex;
  gap: 6px;
  z-index: 3;
  pointer-events: none;
  max-width: 46%;
  flex-wrap: wrap;
}
.game-speaker {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.12s, transform 0.12s;
}
.game-speaker .avatar {
  border-radius: 50%;
}
.game-speaker.is-speaking {
  border-color: #22b866;
  transform: scale(1.08);
  box-shadow: 0 0 0 4px rgba(34, 184, 102, 0.18);
}
.game-speaker.is-muted::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 24, 0.42);
}
.game-speaker svg {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 15px;
  height: 15px;
  padding: 2px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  z-index: 2;
}

.game-joystick {
  position: absolute;
  left: calc(var(--lg-edge-left) + clamp(18px, 6vw, 46px));
  bottom: calc(var(--lg-edge-bottom) + clamp(18px, 5vh, 44px));
  width: clamp(112px, 23vh, 152px);
  height: clamp(112px, 23vh, 152px);
  border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--text) 13%, transparent);
  background:
    radial-gradient(circle at 50% 50%, color-mix(in oklab, var(--surface) 66%, transparent), transparent 72%);
  z-index: 4;
  touch-action: none;
}
.game-joystick::before {
  content: '';
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  border: 1px dashed color-mix(in oklab, var(--text) 10%, transparent);
}
.game-stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42%;
  height: 42%;
  margin: -21% 0 0 -21%;
  border-radius: 50%;
  background: color-mix(in oklab, var(--surface) 90%, transparent);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(10, 20, 30, 0.24);
  transition: transform 0.06s linear;
}
.game-joystick.is-active .game-stick {
  background: color-mix(in oklab, #22b866 22%, var(--surface));
}

.game-boost {
  position: absolute;
  right: calc(var(--lg-edge-right) + clamp(18px, 6vw, 48px));
  bottom: calc(var(--lg-edge-bottom) + clamp(20px, 6vh, 50px));
  width: clamp(84px, 17vh, 116px);
  height: clamp(84px, 17vh, 116px);
  border-radius: 50%;
  border: 2px solid color-mix(in oklab, #f5a524 46%, var(--border));
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.5), transparent 58%),
    linear-gradient(150deg, #ffc14d, #f08a12);
  color: #4a2a00;
  z-index: 4;
  display: grid;
  place-items: center;
  font: inherit;
  font-weight: 800;
  font-size: clamp(9px, 2.6vh, 11px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  box-shadow: 0 12px 28px rgba(240, 138, 18, 0.34);
  touch-action: none;
  cursor: pointer;
  transition: transform 0.09s, filter 0.12s;
}
.game-boost:active,
.game-boost.is-active {
  transform: scale(0.94);
  filter: brightness(1.08);
}
.game-boost:disabled {
  filter: grayscale(0.75) brightness(0.9);
  opacity: 0.65;
  box-shadow: none;
}
.game-boost span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1;
  max-width: 84%;
  text-align: center;
}
.game-boost small {
  font-size: 9.5px;
  letter-spacing: 0.02em;
  opacity: 0.75;
  text-transform: none;
}

.game-death {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 20px 20px calc(20px + var(--lg-edge-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background: rgba(8, 14, 20, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: game-panel-in 0.2s var(--ease);
}
.game-death[hidden] {
  display: none;
}
.game-death-card {
  width: min(420px, 100%);
  /* Auto margins centre a card that fits and keep its top reachable when it
     does not, which is what a short landscape phone needs. */
  margin: auto 0;
  padding: 26px 24px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.game-death-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
}
.game-death-card h2 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.game-death-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.game-death-score {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 18px 0;
}
.game-death-stat {
  flex: 1 1 0;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.game-death-stat small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}
.game-death-stat strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.game-death-actions {
  display: grid;
  gap: 8px;
}
.game-death-award {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: 10px;
  background: color-mix(in oklab, #22b866 12%, var(--surface-2));
  color: #189b52;
  font-size: 12.5px;
}

.game-reconnect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
}
.game-reconnect[hidden] {
  display: none;
}
.game-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  animation: game-spin 0.8s linear infinite;
}
@keyframes game-spin {
  to {
    transform: rotate(360deg);
  }
}

.game-start-flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: clamp(42px, 9vw, 86px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 10px 40px rgba(18, 145, 83, 0.55);
  animation: game-flash 0.85s var(--ease) forwards;
}
@keyframes game-flash {
  0% {
    opacity: 0;
    transform: scale(0.75);
  }
  25% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

.game-rotate {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: none;
  place-items: center;
  padding: 24px;
  background: color-mix(in oklab, var(--bg-root) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: center;
}
.game-rotate.is-shown {
  display: grid;
}
.game-rotate svg {
  color: var(--accent);
  animation: game-rotate-icon 2.6s ease-in-out infinite;
}
@keyframes game-rotate-icon {
  0%,
  20% {
    transform: rotate(0);
  }
  50%,
  70% {
    transform: rotate(90deg);
  }
  100% {
    transform: rotate(0);
  }
}
.game-rotate strong {
  display: block;
  margin-top: 14px;
  font-size: 18px;
}
.game-rotate p {
  margin: 6px 0 16px;
  color: var(--muted);
  font-size: 13px;
  max-width: 30ch;
}

.game-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--lg-edge-bottom) + 26px);
  transform: translate(-50%, 10px);
  z-index: 4900;
  max-width: min(460px, calc(100% - 32px));
  padding: 11px 16px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--text) 88%, transparent);
  color: var(--surface);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
.game-toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* The phone build hides the keyboard hints and shows the thumbs. */
.game-screen.is-touch .game-keys {
  display: none;
}
.game-screen:not(.is-touch) .game-joystick,
.game-screen:not(.is-touch) .game-boost.is-touch-only {
  display: none;
}

@media (max-width: 640px) {
  .game-header {
    gap: 8px;
    padding-top: calc(var(--lg-edge-top) + 2px);
    padding-bottom: 8px;
  }
  .game-brand-mark {
    width: 34px;
    height: 34px;
  }
  .game-brand-name span {
    display: none;
  }
  .game-hud-chip {
    padding: 6px 9px;
  }
  .game-hud-chip small {
    display: none;
  }
  /* A portrait phone cannot fit the brand, three counters and three buttons. */
  .game-header .game-hud {
    display: none;
  }
  .game-brand-name strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .game-panel {
    padding-top: 16px;
  }
  .game-hero {
    padding: 22px 18px;
  }
  .game-hero-art {
    height: 100px;
  }
  .game-stats {
    gap: 7px;
  }
  .game-stat {
    padding: 10px;
  }
  .game-stat strong {
    font-size: 17px;
  }
  .game-players {
    grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
  }
  .game-lobby-actions .game-primary,
  .game-lobby-actions .game-secondary {
    flex: 1 1 auto;
  }
  .game-voice-strip {
    bottom: calc(var(--lg-edge-bottom) + 104px);
    max-width: 40%;
  }
}

.game-screen.is-fullscreen .game-header {
  padding-top: 4px;
}

.game-screen[hidden],
.game-stage audio {
  display: none;
}

.game-menu-error {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: color-mix(in oklab, var(--danger) 12%, var(--surface-2));
  border: 1px solid color-mix(in oklab, var(--danger) 34%, var(--border));
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.4;
}

.game-pill small {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.game-hero .game-lobby-actions {
  margin-top: 18px;
}

.game-keys-card .game-keys {
  margin-top: 4px;
}

/* A phone repaints the canvas every frame. Frosted glass laid over a live
   picture makes the compositor re-blur that patch each frame, and on a phone
   the blur costs more than the drawing, so these surfaces turn solid there. */
.game-screen.is-touch .game-pill,
.game-screen.is-touch .game-icon-fab,
.game-screen.is-touch .game-death,
.game-screen.is-touch .game-rotate {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.game-screen.is-touch .game-pill,
.game-screen.is-touch .game-icon-fab {
  background: var(--surface);
}
.game-screen.is-touch .game-death {
  background: rgba(8, 14, 20, 0.62);
}
.game-screen.is-touch .game-rotate {
  background: var(--bg-root);
}

/* The messenger sits fully behind the game, but its themes keep animating
   there; paused, they cost nothing and nothing on screen changes. */
html.game-open #app,
html.game-open #app *,
html.game-open #app *::before,
html.game-open #app *::after {
  animation-play-state: paused;
}
