/**
 * 『SUPER NITRO KART: HORIZON DX』
 * Nintendo Switch 2世代 グラスモーフィズム＆ネオンレーシングUIスタイルシート
 */

:root {
  --bg-dark: #070b19;
  --panel-bg: rgba(13, 20, 40, 0.78);
  --panel-border: rgba(255, 255, 255, 0.14);
  --neon-cyan: #00f0ff;
  --neon-pink: #ff2a6d;
  --neon-gold: #ffd700;
  --neon-green: #22c55e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Meiryo', system-ui, sans-serif;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  display: block;
}

/* ターボ中のスピードライン視覚効果 */
.speed-lines-overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: radial-gradient(
    circle at center,
    transparent 52%,
    rgba(0, 240, 255, 0.12) 78%,
    rgba(255, 42, 109, 0.26) 100%
  );
}

.speed-lines-overlay.active {
  opacity: 1;
  animation: pulseSpeed 0.16s infinite alternate;
}

@keyframes pulseSpeed {
  from { transform: scale(1); }
  to { transform: scale(1.025); }
}

.hidden {
  display: none !important;
}

/* 上部グローバルバー */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(180deg, rgba(7, 11, 25, 0.92) 0%, rgba(7, 11, 25, 0.2) 100%);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
  display: flex;
  flex-direction: column;
}

.brand-tag {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--neon-cyan);
}

.brand-logo h1 {
  font-size: 1.35rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px rgba(0, 240, 255, 0.4);
}

.horizon-accent {
  color: var(--neon-pink);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pad-badge {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.8);
}

.pad-badge.connected {
  border-color: var(--neon-green);
  color: #86efac;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.35);
}

.pad-badge.disconnected {
  color: #cbd5e1;
}

.action-pill-btn {
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid rgba(0, 240, 255, 0.45);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.action-pill-btn:hover {
  background: rgba(0, 240, 255, 0.22);
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.4);
}

/* メインメニュー画面レイアウト */
.menu-screen {
  position: fixed;
  top: 66px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(430px, 540px) 1fr;
  gap: 22px;
  padding: 16px 24px 22px;
  pointer-events: none;
}

.menu-left-panel,
.menu-right-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 100%;
}

.menu-left-panel {
  pointer-events: auto;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
  overflow-y: auto;
}

.menu-right-panel {
  justify-content: flex-end;
  align-items: flex-end;
}

.menu-right-panel > * {
  pointer-events: auto;
}

/* ステップタブ */
.step-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.step-tab {
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.step-tab.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.25), rgba(255, 42, 109, 0.28));
  border-color: var(--neon-cyan);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.28);
}

.step-num {
  color: var(--neon-cyan);
  margin-right: 3px;
}

.menu-step-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.menu-step-panel.active {
  display: flex;
}

.panel-header h2 {
  font-size: 1.2rem;
  font-weight: 900;
  color: #ffffff;
}

.panel-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* キャラクター選択グリッド */
.char-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.select-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.72);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
}

.select-card:hover {
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
}

.select-card.active {
  border-color: var(--accent, var(--neon-cyan));
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.92));
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.32);
}

.card-emblem {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  flex-shrink: 0;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-subtitle {
  font-size: 0.68rem;
  color: var(--neon-cyan);
  font-weight: 700;
}

.card-title {
  font-size: 1.0rem;
  font-weight: 900;
}

.card-type {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.char-profile-box {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(0, 240, 255, 0.25);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.profile-badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 42, 109, 0.25);
  border: 1px solid var(--neon-pink);
  font-size: 0.72rem;
  font-weight: 800;
}

.char-profile-box p {
  font-size: 0.82rem;
  line-height: 1.45;
  color: #cbd5e1;
}

/* マシンカスタマイズ画面 */
.parts-customizer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.part-selector-row {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: all 0.18s ease;
}

.part-selector-row.focused {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.22);
}

.part-category {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--neon-cyan);
  letter-spacing: 0.08em;
}

.carousel-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.arrow-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(30, 41, 59, 0.9);
  color: #ffffff;
  font-size: 1rem;
  cursor: pointer;
}

.arrow-btn:hover {
  background: var(--neon-cyan);
  color: #020617;
}

.part-text {
  display: flex;
  flex-direction: column;
  text-align: center;
  flex: 1;
}

.part-text strong {
  font-size: 1.02rem;
  color: #ffffff;
}

.part-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* コース選択グリッド */
.track-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.track-card {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px;
}

.track-cup-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--neon-gold);
}

.track-card-title {
  font-size: 0.98rem;
  font-weight: 900;
}

.track-card-eng {
  font-size: 0.68rem;
  color: var(--neon-cyan);
  letter-spacing: 0.06em;
}

.track-card-diff {
  font-size: 0.72rem;
  color: #fde047;
}

.track-card-desc {
  font-size: 0.74rem;
  color: #cbd5e1;
  line-height: 1.38;
  margin-top: 3px;
}

/* ボタン類 */
.step-footer {
  margin-top: auto;
  display: flex;
  gap: 10px;
}

.step-footer.dual {
  justify-content: space-between;
}

.primary-next-btn,
.race-launch-btn,
.secondary-back-btn {
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
}

.primary-next-btn {
  width: 100%;
  background: linear-gradient(135deg, #00c6ff, #0072ff);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 198, 255, 0.35);
}

.primary-next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 198, 255, 0.55);
}

.race-launch-btn {
  flex: 1;
  background: linear-gradient(135deg, #ff2a6d, #ff7b00);
  color: #ffffff;
  font-size: 1rem;
  box-shadow: 0 6px 24px rgba(255, 42, 109, 0.45);
}

.race-launch-btn:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 28px rgba(255, 42, 109, 0.65);
}

.secondary-back-btn {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
}

.secondary-back-btn:hover {
  background: rgba(51, 65, 85, 0.95);
}

/* 右カラム：ステータス＆ガイド */
.showcase-caption {
  text-align: right;
  margin-bottom: auto;
}

.live-3d-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 240, 255, 0.18);
  border: 1px solid var(--neon-cyan);
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--neon-cyan);
}

.showcase-caption p {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-top: 4px;
}

.stats-card,
.quick-guide-card {
  width: min(420px, 100%);
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 15px 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.stats-card h3,
.quick-guide-card h3 {
  font-size: 0.92rem;
  font-weight: 900;
  color: var(--neon-cyan);
  margin-bottom: 10px;
}

.stat-row {
  display: grid;
  grid-template-columns: 145px 1fr 34px;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #cbd5e1;
}

.stat-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.stat-fill.speed { background: linear-gradient(90deg, #f97316, #ef4444); }
.stat-fill.accel { background: linear-gradient(90deg, #38bdf8, #00f0ff); }
.stat-fill.weight { background: linear-gradient(90deg, #eab308, #f59e0b); }
.stat-fill.handling { background: linear-gradient(90deg, #22c55e, #10b981); }
.stat-fill.drift { background: linear-gradient(90deg, #a855f7, #ec4899); }

.stat-num {
  font-size: 0.78rem;
  font-weight: 800;
  text-align: right;
}

.control-list {
  list-style: none;
  font-size: 0.76rem;
  line-height: 1.55;
  color: #e2e8f0;
  margin-bottom: 10px;
}

.control-list code {
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(0, 240, 255, 0.16);
  color: var(--neon-cyan);
  font-weight: 700;
}

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

.item-pills span {
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.72rem;
  font-weight: 700;
}

/* =========================================================
   レース中HUDスタイル
   ========================================================= */
.race-hud {
  position: fixed;
  inset: 62px 0 0 0;
  z-index: 12;
  pointer-events: none;
  padding: 16px 26px 24px;
}

.hud-top-left {
  position: absolute;
  top: 14px;
  left: 26px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.hud-item-slot {
  width: 118px;
  height: 118px;
  border-radius: 22px;
  background: rgba(10, 16, 34, 0.82);
  border: 3px solid rgba(0, 240, 255, 0.65);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 0 22px rgba(0, 240, 255, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
}

.hud-item-slot.spinning {
  border-color: var(--neon-gold);
  animation: slotSpinPulse 0.14s infinite alternate;
}

.hud-item-slot.has-item {
  border-color: var(--neon-pink);
  box-shadow: 0 0 24px rgba(255, 42, 109, 0.5);
}

@keyframes slotSpinPulse {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

.item-slot-label {
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--neon-cyan);
}

.item-slot-icon {
  font-size: 2.4rem;
  line-height: 1;
}

.item-slot-name {
  font-size: 0.68rem;
  font-weight: 800;
  color: #ffffff;
  text-align: center;
}

.hud-track-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(10, 16, 34, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.86rem;
  font-weight: 800;
}

.badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--neon-pink);
  box-shadow: 0 0 10px var(--neon-pink);
}

.hud-top-right {
  position: absolute;
  top: 14px;
  right: 26px;
  display: flex;
  gap: 12px;
}

.hud-metric-pill {
  min-width: 112px;
  padding: 10px 16px;
  border-radius: 16px;
  background: rgba(10, 16, 34, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-metric-pill.coin-pill {
  border-color: rgba(255, 215, 0, 0.55);
}

.metric-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--neon-cyan);
  letter-spacing: 0.1em;
}

.metric-val {
  font-size: 1.32rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

/* カウントダウン＆イベントバナー */
.countdown-banner {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: 7.5rem;
  font-weight: 900;
  font-style: italic;
  color: #ffffff;
  text-shadow: 0 0 35px var(--neon-cyan), 0 8px 25px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.countdown-banner.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.countdown-banner.go {
  color: var(--neon-gold);
  text-shadow: 0 0 45px #ff2a6d, 0 8px 25px rgba(0, 0, 0, 0.85);
}

.race-event-banner {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -15px);
  padding: 10px 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 42, 109, 0.92), rgba(124, 58, 237, 0.92));
  border: 2px solid #ffffff;
  font-size: 1.15rem;
  font-weight: 900;
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: all 0.25s ease;
}

.race-event-banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 左下：順位バッジ */
.hud-bottom-left {
  position: absolute;
  bottom: 24px;
  left: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hud-rank-box {
  display: inline-flex;
  align-items: baseline;
  padding: 10px 24px;
  border-radius: 22px;
  background: rgba(10, 16, 34, 0.84);
  border: 3px solid var(--neon-gold);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

.hud-rank-box[data-rank="1"] { border-color: #ffd700; color: #fde047; }
.hud-rank-box[data-rank="2"] { border-color: #e2e8f0; color: #f1f5f9; }
.hud-rank-box[data-rank="3"] { border-color: #f97316; color: #fdba74; }

.rank-num {
  font-size: 4.2rem;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
}

.rank-suffix {
  font-size: 1.6rem;
  font-weight: 900;
  margin-left: 4px;
}

.hud-controls-hint {
  display: flex;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 12px;
  background: rgba(10, 16, 34, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.75rem;
  font-weight: 700;
  color: #cbd5e1;
}

/* 右下：ミニマップ＆スピードメーター */
.hud-bottom-right {
  position: absolute;
  bottom: 24px;
  right: 26px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.minimap-box {
  width: 170px;
  height: 170px;
  border-radius: 22px;
  background: rgba(10, 16, 34, 0.8);
  border: 2px solid rgba(0, 240, 255, 0.45);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.speedometer-box {
  width: 210px;
  padding: 14px 18px;
  border-radius: 22px;
  background: rgba(10, 16, 34, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drift-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  text-align: center;
  background: rgba(30, 41, 59, 0.9);
  color: #94a3b8;
}

.drift-badge.tier-1 {
  background: rgba(0, 229, 255, 0.25);
  border: 1px solid #00e5ff;
  color: #00e5ff;
}

.drift-badge.tier-2 {
  background: rgba(255, 123, 0, 0.28);
  border: 1px solid #ff7b00;
  color: #ffae42;
}

.drift-badge.tier-3 {
  background: linear-gradient(90deg, #ff2a6d, #7c3aed, #00f0ff);
  color: #ffffff;
}

.speed-readout {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
}

.speed-num {
  font-size: 2.8rem;
  font-weight: 900;
  font-style: italic;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.speed-unit {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--neon-cyan);
}

.speed-bar-bg {
  height: 10px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.95);
  overflow: hidden;
}

.speed-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00f0ff, #ff2a6d);
  transition: width 0.08s linear;
}

/* ポーズ・リザルト画面オーバーレイ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(4, 7, 17, 0.78);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: min(560px, 100%);
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid var(--neon-cyan);
  border-radius: 24px;
  padding: 28px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
}

.modal-card.results-card {
  width: min(760px, 100%);
}

.modal-card h2 {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.modal-btn-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.results-subtitle {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--neon-cyan);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 22px;
  font-size: 0.92rem;
}

.results-table th,
.results-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

.results-table th {
  color: var(--neon-cyan);
  font-size: 0.78rem;
}

.results-table tr.player-row {
  background: rgba(0, 240, 255, 0.16);
  font-weight: 900;
}

.racer-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* =========================================================
   ネイティブ <dialog> コントローラー設定 (modern-web-guidance 準拠)
   ========================================================= */
dialog#controller-dialog {
  margin: auto;
  width: min(860px, 94vw);
  max-height: 88vh;
  border-radius: 24px;
  border: 2px solid var(--neon-cyan);
  background: rgba(13, 20, 40, 0.96);
  color: var(--text-main);
  padding: 0;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.85);
}

dialog#controller-dialog[open] {
  display: block;
}

/* MANDATORY scroll containment rules from modern-web-guidance (dialog) */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(6px);
}

.dialog-inner {
  padding: 24px 28px;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dialog-header h2 {
  font-size: 1.35rem;
  font-weight: 900;
}

.dialog-close-btn {
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(30, 41, 59, 0.9);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.dialog-lead {
  font-size: 0.84rem;
  color: #cbd5e1;
  margin-bottom: 18px;
  line-height: 1.5;
}

.controller-test-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
}

.stick-monitor-card,
.remap-list-card {
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stick-monitor-card {
  align-items: center;
  text-align: center;
}

.stick-monitor-card h3,
.remap-list-card h3 {
  font-size: 0.92rem;
  color: var(--neon-cyan);
}

.stick-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px dashed rgba(0, 240, 255, 0.55);
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stick-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--neon-pink);
  box-shadow: 0 0 12px var(--neon-pink);
  transition: transform 0.04s linear;
}

.pressed-readout {
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pressed-readout strong {
  color: var(--neon-gold);
}

.remap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
}

.remap-btn {
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0, 240, 255, 0.4);
  background: rgba(30, 41, 59, 0.9);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.remap-btn.listening {
  border-color: var(--neon-pink);
  background: rgba(255, 42, 109, 0.28);
  color: #fde047;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
}

.dialog-footer-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
