/* Monchel & Frens — Air Hockey v1.11.0  (Nexus arcade, portrait cabinet) */
:root {
  --bg: #07040f;
  --bg-2: #12081f;
  --ink: #f5f0ff;
  --muted: #b6a6d4;
  --line: rgba(196, 181, 253, 0.22);
  --purple: #a855f7;
  --purple-2: #c084fc;
  --cyan: #67e8f9;
  --pink: #f472b6;
  --glow: 0 0 24px rgba(168, 85, 247, 0.45);
  --font: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  --display: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --hud-top: #fdbA74;
  --hud-bottom: #67e8f9;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body {
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  position: fixed;
  inset: 0;
  width: 100%;
  -webkit-text-size-adjust: 100%;
}
button { font-family: inherit; cursor: pointer; touch-action: manipulation; pointer-events: auto; }
button:disabled { cursor: default; opacity: 0.5; }

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background:
    radial-gradient(ellipse at 50% 0%, #2a1060 0%, transparent 55%),
    radial-gradient(ellipse at 80% 100%, #1a0a3a 0%, transparent 45%),
    var(--bg);
}

.arcade-root {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
  overflow: clip;
  overscroll-behavior: none;
  touch-action: manipulation;
  padding:
    var(--safe-t)
    var(--safe-r)
    var(--safe-b)
    var(--safe-l);
}

.cabinet {
  position: relative;
  width: min(100%, 28rem);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow: clip;
  overscroll-behavior: none;
  touch-action: manipulation;
}

.ambient {
  pointer-events: none;
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 20% 30%, rgba(168, 85, 247, 0.14), transparent 32%),
    radial-gradient(circle at 80% 70%, rgba(34, 211, 238, 0.07), transparent 30%);
  z-index: 0;
}

/* HUD — main header score at the very top; tools tucked underneath. */
.hud-band {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  padding: 0.28rem 0.55rem 0.22rem;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  background: linear-gradient(180deg, rgba(10, 6, 22, 0.94), rgba(10, 6, 22, 0.72));
  border-bottom: 1px solid var(--line);
  touch-action: manipulation;
  pointer-events: auto;
}
/* 2P on a phone lying flat: no header — pause/sound live in the pads. */
.arcade-root[data-layout="2p-table"] .hud-band { display: none !important; }
/* 2P desktop / keyboard: slim tools-only bar; scores are on the court. */
.arcade-root[data-mode="2p"]:not([data-layout="2p-table"]) .hud-main { display: none; }
.arcade-root[data-mode="2p"]:not([data-layout="2p-table"]) .hud-band {
  padding: 0.16rem 0.55rem;
}
.hud-main {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 5.6rem 1fr;
  align-items: center;
  min-height: 2.35rem;
}
.hud-p1, .hud-p2 {
  min-width: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.hud-p1 { text-align: left; justify-self: start; }
.hud-p2 { text-align: right; justify-self: end; grid-column: 3; flex-direction: row; }
.hud-face-wrap {
  position: relative;
  width: 1.95rem;
  height: 1.95rem;
  flex: 0 0 1.95rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#c4b5fd calc(var(--charge, 0) * 360deg), rgba(196,181,253,0.14) 0);
}
.hud-face-wrap.is-ready {
  background: conic-gradient(#f0abfc 360deg, #f0abfc 0);
}
.hud-face-wrap.is-flash {
  background: conic-gradient(#fff 360deg, #fff 0);
}
.hud-face-wrap.is-on::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #0b0614;
  z-index: 0;
}
.hud-face-wrap .hud-face {
  position: relative;
  z-index: 1;
  width: 1.45rem;
  height: 1.45rem;
  flex: none;
}
.hud-face {
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 1.7rem;
  display: block;
  border-radius: 50%;
  background: rgba(8, 4, 18, 0.45);
  box-shadow: 0 0 0 1px rgba(196, 181, 253, 0.25);
}
.hud-who { min-width: 0; }
.hud-role {
  display: block;
  font-size: 0.52rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.8;
  line-height: 1.15;
}
.hud-name {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.hud-p1 .hud-role, .hud-p1 .hud-name { color: var(--hud-bottom); }
.hud-p2 .hud-role, .hud-p2 .hud-name { color: var(--hud-top); }
.hud-fx {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem;
  min-height: 0.7rem;
  margin-top: 0.08rem;
  max-width: 6.4rem;
}
.hud-p2 .hud-fx { justify-content: flex-end; }
.hud-fx.is-crowded {
  gap: 0.06rem;
  max-width: 7.2rem;
}
.hud-fx.is-crowded .hud-fx-icon {
  width: 0.68rem;
  height: 0.68rem;
  font-size: 0.42rem;
}
.hud-fx-icon {
  width: 0.78rem;
  height: 0.78rem;
  border-radius: 0.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.48rem;
  flex: 0 0 auto;
  font-weight: 800;
  letter-spacing: 0;
  color: #0b0614;
  background: var(--fx, #c4b5fd);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2), 0 0 8px color-mix(in srgb, var(--fx) 70%, transparent);
}
/* Dash sits on the exact horizontal centre; scores grow outward. */
.hud-score {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  z-index: 2;
}
.score-left,
.score-right,
.score-dash {
  font-family: var(--display);
  font-size: clamp(1.7rem, 7.2vw, 2.25rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score-left {
  text-align: right;
  padding-right: 0.18em;
  color: var(--hud-bottom);
  text-shadow: 0 0 12px color-mix(in srgb, var(--hud-bottom) 55%, transparent);
}
.score-dash {
  text-align: center;
  color: rgba(237, 233, 254, 0.92);
}
.score-right {
  text-align: left;
  padding-left: 0.18em;
  color: var(--hud-top);
  text-shadow: 0 0 12px color-mix(in srgb, var(--hud-top) 55%, transparent);
}
.shell-badge-mini {
  font-size: 0.6rem;
  color: #fde68a;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.shell-badge-mini strong { font-size: 0.74rem; }
.hud-tools {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  justify-content: space-between;
  align-items: center;
}
.hud-tool-btns { display: flex; flex-wrap: wrap; gap: 0.22rem; justify-content: flex-end; align-items: center; }
.btn-hud {
  border: 1px solid var(--line);
  background: rgba(10, 6, 22, 0.7);
  color: var(--ink);
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.btn-hud:hover { border-color: var(--purple-2); }

/* Court */
.stage {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  justify-items: center;
  align-content: start;
}
.game-canvas {
  display: block;
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(196, 181, 253, 0.18),
    0 0 28px rgba(124, 58, 237, 0.22);
  background: #0b0616;
  touch-action: none;
  max-width: 100%;
  max-height: 100%;
}

/* Thumb pad — JS layout sizes this during play so the court fills leftover space.
   SPECIAL lives in its own grid column so it never covers the rail or hint,
   including on 360×740 and 390×844 phones. */
.thumb-zone {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  justify-items: center;
  column-gap: 0.4rem;
  row-gap: 0.18rem;
  padding: 0.28rem 0.4rem 0.32rem;
  touch-action: none;
  background: linear-gradient(0deg, rgba(16, 8, 32, 0.96), rgba(16, 8, 32, 0.7));
  border-top: 1px solid var(--line);
  user-select: none;
}
.thumb-bottom {
  height: 15dvh;
  min-height: 5.2rem;
  max-height: 8.4rem;
}
.thumb-top {
  height: 11dvh;
  min-height: 3.8rem;
  max-height: 6.2rem;
  grid-template-columns: auto minmax(0, 1fr);
  border-top: none;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 8, 32, 0.96), rgba(16, 8, 32, 0.7));
}
.arcade-root[data-mode="2p"] .thumb-bottom { height: 14dvh; }
/* Phone-flat 2P: exact mirror of the bottom pad, rotated to face the top player. */
.arcade-root[data-layout="2p-table"] .thumb-top,
.arcade-root[data-layout="2p-table"] .thumb-bottom {
  height: 15dvh;
  min-height: 5.2rem;
  max-height: 8.4rem;
  grid-template-columns: minmax(0, 1fr) auto;
  border-top: 1px solid var(--line);
  border-bottom: none;
  background: linear-gradient(0deg, rgba(16, 8, 32, 0.96), rgba(16, 8, 32, 0.7));
}
.arcade-root[data-layout="2p-table"] .thumb-top {
  transform: rotate(180deg);
}
.thumb-tools {
  display: none;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  align-self: center;
  gap: 0.2rem;
  z-index: 7;
  pointer-events: auto;
}
.arcade-root[data-layout="2p-table"] .thumb-tools { display: flex; }
.arcade-root[data-layout="2p-table"] .thumb-rail { grid-row: 2; }
.arcade-root[data-layout="2p-table"] .thumb-zone .hint { grid-row: 3; }
.arcade-root[data-layout="2p-table"] .btn-special { grid-row: 1 / span 3; }
.thumb-rail {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  max-width: 18rem;
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(196, 181, 253, 0.16);
  box-shadow: inset 0 0 0 1px rgba(196, 181, 253, 0.2);
  justify-self: center;
}
.thumb-top .thumb-rail { grid-column: 2; }
.arcade-root[data-layout="2p-table"] .thumb-top .thumb-rail { grid-column: 1; }
.btn-special {
  position: static;
  transform: none;
  grid-column: 2;
  grid-row: 1 / span 2;
  z-index: 6;
  width: 2.7rem;
  height: 2.7rem;
  margin: 0;
  border-radius: 50%;
  padding: 0;
  border: 1px solid rgba(232, 121, 249, 0.55);
  background: rgba(24, 10, 40, 0.92);
  color: #f5d0fe;
  font-size: 0.46rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.05;
  touch-action: manipulation;
  pointer-events: auto;
  justify-self: end;
  align-self: center;
  flex-shrink: 0;
}
.thumb-top .btn-special {
  grid-column: 1;
  left: auto;
  right: auto;
  justify-self: start;
}
.arcade-root[data-layout="2p-table"] .thumb-top .btn-special {
  grid-column: 2;
  justify-self: end;
}
.btn-special.is-ready {
  background: linear-gradient(180deg, #c026d3, #7c3aed);
  color: #fff;
  border-color: #f0abfc;
}
.btn-special.is-wait {
  opacity: 0.55;
}
.btn-special.hidden { display: none; }
.slot-special {
  display: block;
  margin: 0.08rem 0 0;
  font-size: 0.58rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: rgba(237, 233, 254, 0.82);
  font-style: normal;
  max-width: 100%;
}
.thumb-zone span, .hint {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 0.64rem;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: rgba(237, 233, 254, 0.7);
  text-align: center;
  pointer-events: none;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.thumb-top .hint { display: none; }
.arcade-root[data-layout="2p-table"] .thumb-top .hint {
  display: -webkit-box;
}
@media (max-width: 380px) {
  .btn-special { width: 2.5rem; height: 2.5rem; font-size: 0.42rem; }
  .thumb-zone span, .hint { font-size: 0.58rem; }
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem;
  overflow: auto;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
  pointer-events: auto;
}
.overlay-bottom {
  align-items: flex-end;
  background: linear-gradient(180deg, rgba(7, 4, 15, 0) 0%, rgba(7, 4, 15, 0.12) 36%, rgba(7, 4, 15, 0.55) 100%);
}
.overlay-dim { background: rgba(5, 2, 12, 0.5); }
.hidden { display: none !important; }

.panel {
  width: min(760px, 100%);
  text-align: center;
  padding: 1.15rem 1.1rem 1rem;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(28, 14, 52, 0.88), rgba(10, 6, 20, 0.92));
  border: 1px solid rgba(196, 181, 253, 0.22);
  box-shadow:
    0 0 0 1px rgba(168, 85, 247, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.4);
}
.title-panel { padding: 0.9rem 1rem 0.85rem; }
.arcade-root[data-effects="lite"] .panel {
  background: #140a24;
}

.kicker {
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--purple-2);
  margin-bottom: 0.25rem;
}
.logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.8rem, 8vw, 3.1rem);
  letter-spacing: 0.02em;
  line-height: 0.95;
  color: #fff;
  text-shadow: 0 0 18px rgba(168, 85, 247, 0.8);
}
.logo span { color: var(--cyan); text-shadow: 0 0 16px rgba(103, 232, 249, 0.7); }
.game-name {
  margin-top: 0.1rem;
  font-size: clamp(1.15rem, 3.5vw, 1.7rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(103, 232, 249, 0.55);
}
.tagline { margin: 0.55rem 0 0.85rem; color: var(--muted); font-size: 0.9rem; }

.btn {
  border: 1px solid rgba(196, 181, 253, 0.3);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.btn-primary {
  background: linear-gradient(180deg, #c084fc, #7c3aed);
  border-color: #e9d5ff;
  color: #fff;
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.45);
}
.btn-xl { padding: 0.8rem 2rem; font-size: 1.02rem; letter-spacing: 0.14em; text-transform: uppercase; }
.btn-rematch {
  display: block;
  width: min(420px, 100%);
  margin: 1.1rem auto 0.6rem;
  padding: 1.05rem 1.5rem;
  font-size: 1.3rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-radius: 18px;
  background: linear-gradient(180deg, #f0abfc, #a855f7 55%, #6d28d9);
  box-shadow: 0 0 0 1px #f5d0fe, 0 0 32px rgba(232, 121, 249, 0.45);
}
.btn-ghost { background: transparent; }
.btn-chip { padding: 0.4rem 0.9rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }
.btn-chip.active {
  background: linear-gradient(180deg, rgba(192, 132, 252, 0.55), rgba(109, 40, 217, 0.7));
  border-color: #f5d0fe;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(245, 208, 254, 0.55), 0 0 16px rgba(168, 85, 247, 0.45);
  font-weight: 800;
}

.title-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  align-items: center;
  margin: 0.85rem 0 0.7rem;
}
.shell-badge {
  display: flex;
  flex-direction: column;
  padding: 0.3rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.08);
  min-width: 7rem;
}
.shell-label { font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase; color: #fde68a; }
.shell-badge strong { font-size: 1.1rem; color: #fef3c7; }
.wallet-chip {
  font-size: 0.7rem;
  color: #c4b5fd;
  border: 1px dashed rgba(196, 181, 253, 0.45);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  opacity: 0.85;
  user-select: none;
}

.scoreboard { margin-top: 0.2rem; }
.scoreboard .empty { color: var(--muted); font-size: 0.85rem; }
.scores { width: 100%; border-collapse: collapse; font-size: 0.82rem; color: #ede9fe; }
.scores th {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a78bfa;
  padding: 0.22rem;
  text-align: left;
}
.scores td { padding: 0.22rem 0.3rem; border-top: 1px solid var(--line); text-align: left; }
.scores .rank { color: var(--muted); width: 2rem; }
.scores .ini { font-weight: 800; letter-spacing: 0.16em; }
.scores .shell { color: #fde68a; font-weight: 700; text-align: right; }
.footnote { margin-top: 0.7rem; font-size: 0.68rem; color: #8b7aa8; line-height: 1.4; }

.overlay[data-screen="select"] {
  align-items: stretch;
  justify-content: stretch;
  padding: 0.5rem;
  overflow: hidden;
  /* Opaque so the attract-mode court (puck, rounded canvas frame) cannot
     show through behind the character grid or the preview. */
  background: #0a0614;
}
.select-panel {
  position: relative;
  width: min(860px, 100%);
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #1c0e34, #0a0614);
}
.arcade-root[data-screen="select"] .stage {
  visibility: hidden;
  pointer-events: none;
}
.select-panel .btn-xl { flex: 0 0 auto; }
.select-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.select-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
@keyframes preview-glow-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
@keyframes preview-swap {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .slot-preview-glow { animation: none; opacity: 0.92; }
  .slot-preview-stage.is-swapping .slot-preview-art,
  .slot-preview-stage.is-swapping .slot-preview-fallback { animation: none; }
}
.fren-grid-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  margin-bottom: 0.55rem;
  padding: 0.4rem 0.15rem 0.55rem;
}
.select-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
  margin-bottom: 0.35rem;
}
.select-head h2 { font-size: 1.2rem; }
.mode-label {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--purple-2);
  font-weight: 700;
}
.mode-row-ball { align-items: center; gap: 0.28rem; margin: 0.08rem 0 0.14rem; }
.mode-row-ball .btn-chip { padding: 0.24rem 0.62rem; font-size: 0.68rem; }
.mode-row { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center; margin: 0.12rem 0; }
.mode-row[data-intensity-row] { margin: 0 0 0.12rem; gap: 0.25rem; }
.mode-row[data-intensity-row] .btn-chip { padding: 0.24rem 0.55rem; font-size: 0.66rem; }
.mode-row[data-intensity-row].is-disabled { display: none; }

.setup-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin: 0 0 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(216, 180, 254, 0.45);
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.2), rgba(76, 29, 149, 0.28));
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  flex: 0 0 auto;
}
.setup-summary:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.setup-summary-ball {
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  border-radius: 50%;
  pointer-events: none;
}
.setup-summary-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.setup-summary-gear {
  flex: 0 0 auto;
  color: #e9d5ff;
  text-shadow: 0 0 10px rgba(216, 180, 254, 0.8);
  font-size: 0.95rem;
}

.setup-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.setup-layer.is-open,
.setup-layer.is-closing {
  pointer-events: auto;
}
.setup-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  border-radius: 0;
  background: rgba(6, 2, 16, 0.64);
  opacity: 0;
  transition: opacity 280ms ease;
  cursor: pointer;
}
.setup-layer.is-open .setup-backdrop { opacity: 1; }
.setup-layer.is-closing .setup-backdrop { opacity: 0; }
.setup-sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(86%, 36rem);
  overflow: hidden;
  background: linear-gradient(180deg, #2d1658 0%, #140824 52%, #0a0614 100%);
  border: 1px solid rgba(216, 180, 254, 0.4);
  border-bottom: 0;
  box-shadow: 0 -8px 40px rgba(168, 85, 247, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.04);
  border-radius: 22px 22px 0 0;
  padding: 0.35rem 1rem 1rem;
  transform: translateY(110%);
  transition: transform 280ms ease;
  outline: none;
  color: var(--ink);
}
.setup-layer.is-open .setup-sheet { transform: translateY(0); }
.setup-layer.is-closing .setup-sheet { transform: translateY(110%); }
.setup-sheet.is-dragging { transition: none; }
.setup-handle {
  width: 3rem;
  height: 0.3rem;
  border-radius: 999px;
  background: rgba(216, 180, 254, 0.45);
  margin: 0.35rem auto 0.45rem;
}
.setup-title {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f5d0fe;
  text-shadow: 0 0 14px rgba(232, 121, 249, 0.45);
  text-align: center;
}
.setup-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.35rem;
}
.setup-section { margin: 0 0 0.7rem; text-align: left; }
.setup-section .mode-row { justify-content: flex-start; margin: 0.2rem 0 0; }
.setup-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--purple-2);
  font-weight: 700;
}
.setup-done {
  flex: 0 0 auto;
  width: 100%;
  margin-top: 0.35rem;
}
.btn-ball {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem 0.28rem 0.35rem;
}
.ball-thumb {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  pointer-events: none;
}

@media (min-width: 720px) {
  .setup-layer { align-items: center; }
  .setup-sheet {
    width: min(28rem, 92%);
    max-height: min(86%, 34rem);
    border-radius: 22px;
    border-bottom: 1px solid rgba(216, 180, 254, 0.4);
    padding: 0.7rem 1.1rem 1.1rem;
    transform: translateY(14px) scale(0.97);
    opacity: 0;
    transition: transform 240ms ease, opacity 240ms ease;
  }
  .setup-layer.is-open .setup-sheet {
    transform: none;
    opacity: 1;
  }
  .setup-layer.is-closing .setup-sheet {
    transform: translateY(10px) scale(0.98);
    opacity: 0;
  }
  .setup-handle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .setup-backdrop,
  .setup-sheet { transition: none; }
  .setup-layer.is-open .setup-sheet,
  .setup-layer.is-closing .setup-sheet {
    transform: none;
    opacity: 1;
  }
  .setup-layer.is-closing .setup-backdrop { opacity: 0; }
  .setup-layer.is-closing .setup-sheet { opacity: 0; }
}

.slots {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.2rem 0.35rem;
  align-items: center;
  margin: 0.35rem 0 0.4rem;
  flex: 0 1 auto;
}
.slot,
.slot-preview {
  border: 1px solid color-mix(in srgb, var(--slot-color, var(--purple-2)) 45%, transparent);
  border-radius: 18px;
  padding: 0.3rem 0.3rem 0.4rem;
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
  text-align: center;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.slot.aimed { outline: 2px solid var(--cyan); }
.slot.empty {
  border-style: dashed;
  border-color: rgba(196, 181, 253, 0.35);
  background: rgba(8, 4, 18, 0.25);
}
.slot.empty strong { color: var(--muted); font-weight: 700; }
.slot-preview[data-slot="bottom"] {
  --slot-color: var(--cyan);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cyan) 18%, transparent);
}
.slot-preview[data-slot="top"] {
  --slot-color: #fdba74;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #fdba74 18%, transparent);
}
.slot-label {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slot-color, var(--purple-2));
  margin-bottom: 0.05rem;
}
.slot strong { display: block; font-size: 0.92rem; line-height: 1.15; }
.slot em { display: block; font-style: normal; font-size: 0.64rem; color: var(--muted); line-height: 1.2; }
.versus {
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--cyan);
  font-size: 0.85rem;
  padding: 0 0.1rem;
}
.slot-preview-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  flex: 0 0 auto;
  overflow: visible;
}
.slot-preview-glow,
.slot-preview-art,
.slot-preview-fallback {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.slot-preview-glow {
  z-index: 0;
  animation: preview-glow-pulse 2.6s ease-in-out infinite;
  will-change: opacity;
}
.slot-preview-art,
.slot-preview-fallback {
  z-index: 1;
}
.slot-preview-stage.is-swapping .slot-preview-art,
.slot-preview-stage.is-swapping .slot-preview-fallback {
  animation: preview-swap 200ms ease;
}
.select-help { font-size: 0.72rem; color: var(--muted); margin-bottom: 0.5rem; }
.fren-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
@media (min-width: 560px) {
  .fren-grid { grid-template-columns: repeat(6, 1fr); }
}
.fren-card {
  position: relative;
  border: 1px solid var(--line);
  background: rgba(8, 4, 18, 0.55);
  border-radius: 14px;
  color: var(--ink);
  padding: 0.35rem 0.25rem 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  min-width: 0;
  overflow: visible;
}
.fren-badge {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.12rem 0.32rem;
  border-radius: 999px;
  color: #0b0616;
  background: #c4b5fd;
  box-shadow: 0 0 8px rgba(196, 181, 253, 0.5);
  z-index: 1;
}
.fren-badge-p1 { background: #67e8f9; left: 0.25rem; right: auto; }
.fren-badge-p2 { background: #fdbA74; left: auto; right: 0.25rem; }
.fren-badge-both { background: #c084fc; }
.fren-card-art-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  overflow: visible;
}
.fren-card-art,
.fren-card-fallback {
  width: 64px;
  height: 64px;
  display: block;
  object-fit: contain;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
}
.fren-card-art[hidden],
.fren-card-fallback[hidden] {
  display: none !important;
}
.fren-card-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}
.fren-card.previewing {
  border-color: rgba(168, 85, 247, 0.9);
}
.fren-name { font-weight: 800; font-size: 0.82rem; text-align: center; line-height: 1.15; max-width: 100%; }
.fren-tag {
  font-size: 0.6rem;
  color: var(--muted);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fren-card.picked { border-color: rgba(196, 181, 253, 0.7); }
.fren-card.picked-left { box-shadow: inset 0 0 0 2px #67e8f9; }
.fren-card.picked-right { box-shadow: inset 0 0 0 2px #f472b6; }
.fren-card.picked-left.picked-right { box-shadow: inset 0 0 0 2px #c084fc; }

.final-score {
  font-size: clamp(2.2rem, 8vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0.2rem 0 0.45rem;
}
.shell-earned { font-size: 1.1rem; font-weight: 800; color: #fde68a; }
.shell-after, .match-meta { color: var(--muted); margin-top: 0.2rem; font-size: 0.88rem; }
.initials-block { margin: 0.85rem 0 0.35rem; }
.initials-block > p:first-child {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--purple-2);
  margin-bottom: 0.35rem;
}
.initials { display: flex; gap: 0.4rem; justify-content: center; }
.ini-slot {
  width: 2.8rem;
  height: 3rem;
  border-radius: 10px;
  border: 1px solid rgba(196, 181, 253, 0.4);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
}
.ini-slot.focus, .ini-slot:focus { border-color: var(--cyan); outline: none; }
.ini-help { font-size: 0.7rem; color: var(--muted); margin-top: 0.3rem; }
.pause-panel h2 { margin-bottom: 1rem; letter-spacing: 0.2em; text-transform: uppercase; }
.pause-panel .btn-ghost { display: block; margin: 0.7rem auto 0; }

@media (orientation: landscape) and (min-width: 800px) {
  .cabinet { width: min(30rem, 100%); }
  .arcade-root[data-screen="select"] .cabinet { width: min(46rem, 96vw); }
  .thumb-bottom { height: 16vh; }
  .slot strong { font-size: 1.05rem; }
  .versus { font-size: 1rem; }
}

@media (max-width: 430px) {
  .footnote { display: none; }
  .title-panel { padding: 0.75rem 0.85rem 0.65rem; }
  .btn-hud { padding: 0.24rem 0.42rem; font-size: 0.58rem; }
  .fren-card-art-wrap,
  .fren-card-art,
  .fren-card-fallback { width: 56px; height: 56px; }
  .fren-name { font-size: 0.68rem; text-align: center; line-height: 1.15; }
  .fren-tag { display: none; }
  .slot canvas { width: 56px; height: 56px; }
  .slot { padding: 0.3rem; }
  .slot strong { font-size: 0.82rem; }
  .select-help { display: none; }
  .slot:not(.empty) em { display: none; }
  .mode-row { margin: 0.15rem 0; }
  .slots { margin: 0.15rem 0 0.15rem; }
}
@media (max-height: 700px) {
  .logo { font-size: 1.7rem; }
  .footnote { display: none; }
  .title-panel .scoreboard { display: none; }
  .thumb-bottom { min-height: 4.8rem; }
  .fren-card-art-wrap,
  .fren-card-art,
  .fren-card-fallback { width: 48px; height: 48px; }
  .fren-tag { display: none; }
  .slot strong { font-size: 0.82rem; }
  .select-head { margin-bottom: 0.3rem; }
  .slots { margin: 0.4rem 0 0.2rem; }
}

/* —— v1.11.0 online lobby ——————————————————————————————— */
.online-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
  margin-top: 0.15rem;
}
.online-actions.hidden { display: none; }
.join-row {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
}
.room-input {
  flex: 1 1 6rem;
  min-width: 0;
  border: 1px solid rgba(196, 181, 253, 0.35);
  background: rgba(12, 6, 24, 0.8);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
}
.room-input:focus {
  outline: 2px solid rgba(196, 181, 253, 0.55);
  outline-offset: 1px;
}
.ping-indicator {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: rgba(196, 181, 253, 0.7);
  text-transform: uppercase;
  padding: 0 0.2rem;
}
.lobby-panel {
  width: min(420px, 100%);
  max-height: calc(100dvh - 1.2rem);
  overflow: hidden;
  padding: 0.7rem 0.9rem 0.85rem;
  display: flex;
  flex-direction: column;
}
.lobby-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}
.lobby-head h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
}
.lobby-ping {
  font-size: 0.68rem;
  color: rgba(196, 181, 253, 0.75);
  letter-spacing: 0.08em;
}
.lobby-status {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0.15rem 0 0.6rem;
}
.lobby-code-wrap { text-align: center; margin-bottom: 0.7rem; }
.lobby-code-label {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(196, 181, 253, 0.7);
}
.lobby-code {
  font-size: clamp(2.1rem, 9vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #ede9fe;
  margin: 0.15rem 0 0.4rem;
  line-height: 1.1;
}
.lobby-code-actions { display: flex; justify-content: center; gap: 0.35rem; flex-wrap: wrap; }
.lobby-players {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.35rem;
  align-items: stretch;
  margin: 0.4rem 0 0.7rem;
}
.lobby-slot.is-ready { box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.55), 0 0 18px rgba(139, 92, 246, 0.25); }
.lobby-rules { margin-bottom: 0.6rem; }
.lobby-rules.is-readonly .btn-chip { opacity: 0.85; }
.lobby-grid-wrap { flex: 1 1 auto; min-height: 6rem; max-height: none; overflow: auto; margin-bottom: 0.55rem; }
.lobby-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lobby-panel [data-action="toggle-ready"] { flex: 0 0 auto; width: 100%; }
.btn.is-ready, [data-action="toggle-ready"].is-ready {
  background: linear-gradient(180deg, #7c3aed, #5b21b6);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.35);
}
.net-alert {
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}
.net-alert.hidden, .net-alert[hidden] { display: none !important; }
.arcade-root[data-mode="online"] .hud-band { display: flex; }
.mode-row { flex-wrap: wrap; }
