/* Suited Ape Society - SUITRIS
 * Cyberpunk dark arcade Tetris + 1v1 real-time multiplayer styling
 */

:root {
  --bg-obsidian: #070a0f;
  --bg-card: rgba(11, 16, 25, 0.88);
  --lime: #ccff00;
  --cyan: #00e5ff;
  --magenta: #ff2a9d;
  --gold: #ffd426;
  --danger: #ff3b5c;
  --text-main: #f4f7fb;
  --text-muted: #93a3b8;
  --border-subtle: rgba(204, 255, 0, 0.22);
  --border-strong: rgba(204, 255, 0, 0.55);
  --font-display: 'Chakra Petch', 'Space Grotesk', system-ui, sans-serif;
  --font-ui: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-obsidian);
  color: var(--text-main);
  font-family: var(--font-ui);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #121d2e 0%, #070a0f 74%);
}

/* ==================== BACKGROUND ==================== */
.cyber-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(204, 255, 0, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(204, 255, 0, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.85) 20%, transparent 80%);
}

.bg-watermark {
  position: absolute;
  inset: 0;
  background: url('./assets/sas-logo.png') center 45% / min(380px, 52vw) no-repeat;
  opacity: 0.055;
}

/* ==================== TOP HUD ==================== */
.hud-top {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
}

.hud-brand {
  grid-column: 1;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: start;
  text-decoration: none;
  background: rgba(9, 13, 20, 0.8);
  border: 1px solid rgba(204, 255, 0, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 5px 11px 5px 7px;
  border-radius: 13px;
  white-space: nowrap;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.hud-brand:hover {
  border-color: var(--lime);
  transform: translateY(-1px);
}

.brand-crest {
  width: 28px;
  height: 25px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(204, 255, 0, 0.42));
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  color: var(--lime);
}

.brand-route {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.hud-center-status {
  grid-column: 2;
  justify-self: center;
}

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(9, 14, 22, 0.82);
  border: 1px solid rgba(0, 229, 255, 0.34);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.online-pill:hover {
  border-color: var(--lime);
  transform: translateY(-1px);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
}

.status-dot.connected {
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
}

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

.hud-controls {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(9, 13, 20, 0.8);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

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

.icon-btn.muted {
  color: #5b6a80;
  opacity: 0.7;
}

/* ==================== MAIN ARENA ==================== */
.arena-main {
  position: relative;
  z-index: 5;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 12px max(10px, env(safe-area-inset-bottom));
  gap: 8px;
}

.mobile-stats-strip {
  display: none;
  width: min(390px, 100%);
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.m-chip {
  background: rgba(11, 16, 25, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 4px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.m-label {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.m-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: #ffffff;
}

.m-val.lime { color: var(--lime); }
.m-val.gold { color: var(--gold); }
.m-val.cyan { color: var(--cyan); }

.arena-grid {
  display: grid;
  grid-template-columns: 185px auto 185px;
  align-items: start;
  justify-content: center;
  gap: 16px;
  max-height: 100%;
}

.side-col {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.panel-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 11px 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.box-title {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--lime);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.box-key {
  font-size: 0.58rem;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  padding: 1px 5px;
}

.preview-box canvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.stats-box {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.stat-k {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-v {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.88rem;
  color: #ffffff;
}

.stat-v.lime { color: var(--lime); }
.stat-v.gold { color: var(--gold); }
.stat-v.cyan { color: var(--cyan); }

/* Full-body Ape Mascot Box */
.mascot-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px 8px;
  overflow: hidden;
  border-color: rgba(204, 255, 0, 0.34);
}

.mascot-glow {
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(204, 255, 0, 0.25), transparent 70%);
  filter: blur(12px);
}

.mascot-sprite {
  position: relative;
  z-index: 1;
  height: 144px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.75));
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
  animation: mascotFloat 2.8s ease-in-out infinite;
}

.mascot-box.hype .mascot-sprite {
  transform: scale(1.14) translateY(-6px);
  filter: drop-shadow(0 0 18px rgba(204, 255, 0, 0.75));
}

@keyframes mascotFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

.mascot-mood {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--lime);
  text-align: center;
}

/* ==================== BOARD STAGE ==================== */
.board-stage {
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-frame {
  position: relative;
  display: flex;
  align-items: stretch;
  padding: 5px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(16, 24, 38, 0.95), rgba(8, 12, 20, 0.98));
  border: 2px solid var(--border-strong);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.8),
    0 0 36px rgba(204, 255, 0, 0.16);
}

.board-frame.shake {
  animation: boardShake 0.18s linear;
}

@keyframes boardShake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-4px, 3px); }
  50% { transform: translate(4px, -3px); }
  75% { transform: translate(-2px, 2px); }
}

#boardCanvas {
  display: block;
  border-radius: 12px;
  background: #060910;
  height: min(640px, calc(100dvh - 104px));
  width: auto;
  aspect-ratio: 1 / 2;
  touch-action: none;
}

.garbage-meter {
  width: 9px;
  margin-right: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 59, 92, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.garbage-meter-fill {
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, #ff3b5c 0%, #ffd426 100%);
  box-shadow: 0 0 10px rgba(255, 59, 92, 0.8);
  transition: height 0.14s ease;
}

.countdown-banner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 5rem;
  color: var(--lime);
  text-shadow: 0 0 30px rgba(204, 255, 0, 0.85), 0 6px 18px rgba(0, 0, 0, 0.95);
  background: rgba(5, 8, 14, 0.45);
  border-radius: 14px;
  pointer-events: none;
}

.callout-banner {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 212, 38, 0.8), 0 4px 12px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  animation: calloutPop 0.95s ease-out forwards;
}

@keyframes calloutPop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); }
  18% { opacity: 1; transform: translate(-50%, 0px) scale(1.1); }
  80% { opacity: 1; transform: translate(-50%, -14px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -26px) scale(0.95); }
}

/* ==================== RIGHT SIDEBAR CARDS ==================== */
.live-rank-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--lime);
  background: rgba(204, 255, 0, 0.1);
  border: 1px solid rgba(204, 255, 0, 0.34);
  border-radius: 8px;
  padding: 5px 8px;
  text-align: center;
  margin-bottom: 10px;
}

.wall-meter-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.wall-meter-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
  margin-bottom: 12px;
}

.wall-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--lime));
  transition: width 0.2s ease;
}

.mini-controls-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-muted);
}

.mini-controls-list > div {
  display: flex;
  justify-content: space-between;
}

.mini-controls-list b {
  color: #e6eef8;
}

/* Opponent Live Mini-Board */
.opponent-box {
  border-color: rgba(0, 229, 255, 0.42);
}

.opp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.opp-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.74rem;
  color: var(--cyan);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opp-wins {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--gold);
  background: rgba(255, 212, 38, 0.14);
  border-radius: 6px;
  padding: 2px 6px;
}

#oppCanvas {
  display: block;
  margin: 0 auto;
  width: 130px;
  height: 260px;
  border-radius: 8px;
  background: #05080e;
  border: 1px solid rgba(0, 229, 255, 0.28);
}

.opp-stats-row {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
}

.opp-stats-row b {
  color: #ffffff;
}

.opp-alert {
  margin-top: 5px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 800;
  color: #ff3b5c;
  background: rgba(255, 59, 92, 0.14);
  border: 1px solid rgba(255, 59, 92, 0.45);
  border-radius: 6px;
  padding: 3px 6px;
}

/* ==================== MOBILE TOUCH PAD ==================== */
.touch-pad {
  display: none;
  width: min(410px, 100%);
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pad-group {
  display: flex;
  gap: 7px;
}

.pad-btn {
  min-width: 52px;
  height: 48px;
  padding: 0 10px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(13, 20, 32, 0.9);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.pad-btn:active {
  transform: scale(0.93);
  border-color: var(--lime);
  background: rgba(204, 255, 0, 0.16);
}

.pad-sub {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.pad-accent {
  border-color: rgba(0, 229, 255, 0.45);
  color: var(--cyan);
}

.pad-slam {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  border-color: rgba(204, 255, 0, 0.65);
  background: rgba(204, 255, 0, 0.16);
  color: var(--lime);
}

/* ==================== OVERLAYS & MODALS ==================== */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.modal-overlay {
  background: rgba(4, 7, 13, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hidden {
  display: none !important;
}

.start-card,
.modal-card {
  width: min(490px, 100%);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(13, 19, 30, 0.96) 0%, rgba(8, 11, 18, 0.98) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 22px;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.85),
    0 0 46px rgba(204, 255, 0, 0.15);
  animation: panelRise 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.compact-card {
  width: min(360px, 100%);
  text-align: center;
}

@keyframes panelRise {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.start-top-split {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.start-ape-stage {
  position: relative;
  flex-shrink: 0;
  width: 118px;
  height: 162px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ape-aura {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(204, 255, 0, 0.32), rgba(0, 229, 255, 0.12) 55%, transparent 74%);
  filter: blur(14px);
}

.start-ape-img {
  position: relative;
  z-index: 1;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.85));
  animation: mascotFloat 2.6s ease-in-out infinite;
}

.start-head-copy {
  min-width: 0;
}

.society-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(204, 255, 0, 0.1);
  border: 1px solid rgba(204, 255, 0, 0.32);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--lime);
  margin-bottom: 6px;
}

.tag-icon {
  width: 15px;
  height: 14px;
  object-fit: contain;
}

.game-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 3.3rem);
  line-height: 0.94;
  letter-spacing: 0.04em;
  margin-bottom: 7px;
}

.title-suit { color: #ffffff; }
.title-ris { color: var(--lime); text-shadow: 0 0 26px rgba(204, 255, 0, 0.55); }

.game-subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.start-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.mini-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.mini-label {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

.mini-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
}

.mini-value.rank-accent { color: var(--lime); font-size: 0.76rem; }
.cyan-text { color: var(--cyan) !important; }
.lime-text { color: var(--lime) !important; }

.mini-divider {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.1);
}

.start-cta-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==================== BUTTONS ==================== */
.cta-primary {
  position: relative;
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #d8ff1f 0%, #b5f200 100%);
  color: #070a0f;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.09em;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(204, 255, 0, 0.34);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 34px rgba(204, 255, 0, 0.48);
}

.cta-glow {
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  animation: shimmerSweep 2.8s infinite;
}

@keyframes shimmerSweep {
  0% { left: -60%; }
  45% { left: 130%; }
  100% { left: 130%; }
}

.cta-label { position: relative; z-index: 1; }

.cta-multi {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 14px;
  padding: 13px 16px;
  border: 1px solid rgba(0, 229, 255, 0.55);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.14) 0%, rgba(168, 85, 247, 0.14) 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.96rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.cta-multi:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
  box-shadow: 0 8px 26px rgba(0, 229, 255, 0.25);
}

.live-dot-inline {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
}

.lobby-count-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.2);
  color: var(--cyan);
}

.cta-secondary {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  padding: 11px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.cta-secondary:hover {
  border-color: var(--lime);
  background: rgba(204, 255, 0, 0.1);
  color: var(--lime);
}

.cyan-outline {
  border-color: rgba(0, 229, 255, 0.45);
  color: var(--cyan);
}

.x-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.controls-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 13px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
}

.key-cap {
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e6eef8;
  font-weight: 700;
}

.key-sep { color: rgba(255, 255, 255, 0.25); }

/* ==================== MULTIPLAYER LOBBY MODAL ==================== */
.lobby-card {
  width: min(500px, 100%);
}

.lobby-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.close-x-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.close-x-btn:hover {
  border-color: var(--lime);
  color: var(--lime);
}

.lobby-metrics-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.lobby-metrics-bar b { color: #ffffff; }
.lobby-metrics-bar .sep { color: rgba(255, 255, 255, 0.2); }

.handle-row {
  margin-bottom: 12px;
}

.handle-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.handle-input-group,
.join-room-group {
  display: flex;
  gap: 7px;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
  background: rgba(6, 10, 17, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 9px 12px;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--lime);
}

.small-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.small-btn:hover {
  border-color: var(--lime);
  color: var(--lime);
}

.lime-btn {
  background: rgba(204, 255, 0, 0.16);
  border-color: rgba(204, 255, 0, 0.55);
  color: var(--lime);
}

.danger-btn {
  border-color: rgba(255, 59, 92, 0.5);
  color: #ff6b84;
}

.queue-banner,
.room-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(204, 255, 0, 0.1);
  border: 1px solid rgba(204, 255, 0, 0.45);
  margin-bottom: 12px;
}

.radar-spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid rgba(204, 255, 0, 0.25);
  border-top-color: var(--lime);
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}

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

.queue-copy { flex: 1; min-width: 0; }
.queue-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--lime);
}
.queue-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.room-label {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}
.room-code-big {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--lime);
}
.room-banner-btns { display: flex; gap: 6px; }

.lobby-actions-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 9px;
  margin-bottom: 10px;
}

.private-room-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.join-room-group { flex: 1; }

.waiting-list-wrap {
  background: rgba(6, 10, 17, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px;
}

.waiting-list-title {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--cyan);
  margin-bottom: 8px;
}

.waiting-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 156px;
  overflow-y: auto;
}

.waiting-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  padding: 14px 8px;
}

.waiting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.waiting-row.is-me {
  border-color: rgba(204, 255, 0, 0.35);
  background: rgba(204, 255, 0, 0.07);
}

.w-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.w-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.84rem;
  color: #ffffff;
}

.w-meta {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-muted);
}

/* ==================== GAME OVER CARD ==================== */
.modal-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--lime);
}

.modal-heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.62rem;
  letter-spacing: 0.04em;
  color: #ffffff;
  line-height: 1.1;
}

.modal-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 8px 0 16px;
}

.gameover-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.avatar-ring {
  width: 64px;
  height: 64px;
  border-radius: 15px;
  padding: 2px;
  background: linear-gradient(135deg, var(--lime), var(--cyan), var(--magenta));
  flex-shrink: 0;
}

.pilot-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 13px;
  display: block;
}

.gameover-title-group { display: flex; flex-direction: column; gap: 4px; }
.gameover-kicker-row { display: flex; align-items: center; gap: 8px; }

.new-best-pill {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--gold);
  color: #080b10;
}

.rank-pill {
  display: inline-flex;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(204, 255, 0, 0.12);
  border: 1px solid rgba(204, 255, 0, 0.38);
  color: var(--lime);
}

.duel-summary {
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.35);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--cyan);
  margin-bottom: 12px;
  text-align: center;
}

.score-hero-box {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(204, 255, 0, 0.25);
  border-radius: 16px;
  padding: 13px 15px;
  margin-bottom: 11px;
}

.score-hero-main { display: flex; flex-direction: column; justify-content: center; }
.hero-label { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.12em; color: var(--text-muted); }
.hero-number { font-family: var(--font-display); font-weight: 700; font-size: 2.5rem; line-height: 1; color: #ffffff; }
.score-hero-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  padding-left: 14px;
  min-width: 108px;
}
.side-metric { display: flex; flex-direction: column; }
.side-label { font-family: var(--font-mono); font-size: 0.56rem; color: var(--text-muted); }
.side-val { font-family: var(--font-mono); font-weight: 700; font-size: 0.92rem; color: #ffffff; }
.side-val.lime { color: var(--lime); }

.bonus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.bonus-cell {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bonus-label { font-family: var(--font-mono); font-size: 0.52rem; color: var(--text-muted); }
.bonus-val { font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: #ffffff; }
.bonus-val.gold { color: var(--gold); }
.bonus-val.cyan { color: var(--cyan); }

.history-section { margin-bottom: 12px; }
.history-title { font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: 6px; }
.history-list { display: flex; flex-direction: column; gap: 5px; }
.history-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}
.history-row.current { background: rgba(204, 255, 0, 0.09); border-color: rgba(204, 255, 0, 0.35); }
.h-pos { color: var(--lime); font-weight: 700; }
.h-score { color: #ffffff; font-weight: 700; }
.h-lines { color: var(--cyan); font-size: 0.64rem; }
.h-time { color: var(--text-muted); }

.modal-actions { display: flex; flex-direction: column; gap: 8px; }
.share-row { display: flex; gap: 8px; }

.toast {
  position: absolute;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(14, 22, 34, 0.96);
  border: 1px solid var(--lime);
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 9px 16px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */
@media (max-width: 860px) {
  .hud-top {
    padding: max(8px, env(safe-area-inset-top)) 10px 4px 10px;
  }

  .hud-brand {
    padding: 4px 8px 4px 6px;
    gap: 6px;
  }

  .brand-crest { width: 22px; height: 20px; }
  .brand-title { font-size: 0.62rem; }
  .brand-route { font-size: 0.5rem; }

  .online-pill {
    padding: 4px 8px;
    font-size: 0.56rem;
    gap: 5px;
  }

  .icon-btn { width: 34px; height: 34px; border-radius: 10px; }

  .mobile-stats-strip {
    display: grid;
  }

  .arena-grid {
    grid-template-columns: auto 92px;
    gap: 8px;
    align-items: start;
  }

  .left-col {
    display: none;
  }

  .right-col {
    gap: 7px;
  }

  .panel-box {
    padding: 7px 6px;
    border-radius: 12px;
  }

  .next-box canvas {
    width: 74px;
    height: 158px;
  }

  .solo-progress-box {
    display: none;
  }

  #oppCanvas {
    width: 74px;
    height: 148px;
  }

  .opp-header { margin-bottom: 4px; }
  .opp-name { font-size: 0.58rem; }
  .opp-wins { display: none; }
  .opp-stats-row { font-size: 0.52rem; }

  #boardCanvas {
    height: min(500px, calc(100dvh - 196px));
  }

  .touch-pad {
    display: flex;
  }

  .start-top-split {
    gap: 12px;
  }

  .start-ape-stage {
    width: 86px;
    height: 124px;
  }

  .lobby-actions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .online-pill {
    display: none;
  }

  .pad-btn {
    min-width: 44px;
    height: 44px;
    font-size: 1rem;
    padding: 0 8px;
  }

  .pad-sub,
  .pad-slam {
    font-size: 0.62rem;
  }
}
