/* ==========================================================================
   PRISM COCKTAIL: REFRACTION MIX (光の屈折カクテル)
   Cyber-Minimal Neon Dark Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Rajdhani:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg-main: #07080d;
  --bg-surface: #0b0d14;
  --bg-card: rgba(16, 22, 36, 0.75);
  --bg-glass: rgba(16, 22, 36, 0.65);
  --border-glass: rgba(0, 240, 255, 0.18);
  --border-glow: rgba(0, 240, 255, 0.5);

  --neon-red: #ff3366;
  --neon-green: #00ff88;
  --neon-blue: #00bfff;
  --neon-yellow: #ffea00;
  --neon-magenta: #ff00ee;
  --neon-cyan: #00ffff;
  --neon-white: #ffffff;

  --font-display: 'Orbitron', -apple-system, sans-serif;
  --font-sub: 'Rajdhani', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  background-color: var(--bg-main);
  color: #e2e8f0;
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Background Atmosphere */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: 10%;
  width: 80%;
  height: 60%;
  background: radial-gradient(circle, rgba(0, 191, 255, 0.08) 0%, rgba(255, 0, 238, 0.04) 50%, transparent 80%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

/* App Container */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Screen View Toggle */
.view-screen {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
}

.view-screen.active {
  display: flex;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   1. 開始画面 (Start Screen) スタイル
   ========================================================================== */

#start-screen {
  max-width: 980px;
  gap: 20px;
  padding-bottom: 30px;
}

.start-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  position: relative;
}

.brand-wrapper.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 140px;
}

h1.logo-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff 0%, #00ffff 50%, #ff00ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 25px rgba(0, 255, 255, 0.4);
}

h1.logo-title.large {
  font-size: 2.2rem;
  letter-spacing: 3px;
}

.logo-sub {
  font-family: var(--font-sub);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #8899b8;
}

.start-audio-toggle {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-family: var(--font-sub);
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-cyan);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.btn-icon.muted {
  border-color: #ff3366;
  color: #ff88a3;
}

/* ゲーム説明・ルールパネル */
.instructions-panel {
  width: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.instructions-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
  border-bottom: 1px solid rgba(0, 240, 255, 0.2);
  padding-bottom: 8px;
}

.instructions-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 18px;
}

.instruction-card {
  background: rgba(10, 15, 25, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.card-header {
  font-family: var(--font-sub);
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.card-icon {
  font-size: 1.1rem;
}

.zero-rule-highlight {
  background: rgba(0, 255, 136, 0.1);
  border-left: 3px solid var(--neon-green);
  padding: 8px 10px;
  border-radius: 4px;
  margin-top: 6px;
  color: #e2e8f0;
}

.device-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
}

.device-list li {
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border-left: 2px solid rgba(0, 240, 255, 0.4);
}

/* 光の調合レシピカード (開始画面) */
.recipe-showcase-card {
  background: rgba(12, 17, 28, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recipe-showcase-header {
  font-family: var(--font-sub);
  font-size: 0.95rem;
  font-weight: 700;
  color: #00ffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.recipe-pills-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
}

.recipe-pill {
  background: rgba(20, 28, 45, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-family: var(--font-sub);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #cbd5e1;
  white-space: nowrap;
}

.recipe-pill.white-highlight {
  background: rgba(35, 45, 70, 0.88);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.22);
}

.recipe-formula {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.color-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.plus {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0 1px;
}

.recipe-arrow {
  color: #00ffff;
  font-size: 0.92rem;
  opacity: 0.75;
  flex-shrink: 0;
  margin: 0 4px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.result-badge.yellow {
  color: #ffea00;
  background: rgba(255, 234, 0, 0.14);
  border: 1px solid rgba(255, 234, 0, 0.4);
}

.result-badge.magenta {
  color: #ff00ee;
  background: rgba(255, 0, 238, 0.14);
  border: 1px solid rgba(255, 0, 238, 0.4);
}

.result-badge.cyan {
  color: #00ffff;
  background: rgba(0, 255, 255, 0.14);
  border: 1px solid rgba(0, 255, 255, 0.4);
}

.result-badge.white {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.6);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
}

/* カラー丸ドット */
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.dot.red { background: var(--neon-red); box-shadow: 0 0 6px var(--neon-red); }
.dot.green { background: var(--neon-green); box-shadow: 0 0 6px var(--neon-green); }
.dot.blue { background: var(--neon-blue); box-shadow: 0 0 6px var(--neon-blue); }
.dot.yellow { background: var(--neon-yellow); box-shadow: 0 0 6px var(--neon-yellow); }
.dot.magenta { background: var(--neon-magenta); box-shadow: 0 0 6px var(--neon-magenta); }
.dot.cyan { background: var(--neon-cyan); box-shadow: 0 0 6px var(--neon-cyan); }
.dot.white { background: #ffffff; box-shadow: 0 0 6px #ffffff; }

/* ステージ選択セクション */
.stage-select-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stage-select-heading {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 1px;
  text-align: center;
}

.stage-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  width: 100%;
}

.stage-card {
  background: linear-gradient(145deg, rgba(20, 28, 45, 0.85) 0%, rgba(12, 17, 28, 0.95) 100%);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.stage-card:hover {
  background: linear-gradient(145deg, rgba(0, 240, 255, 0.2) 0%, rgba(255, 0, 238, 0.15) 100%);
  border-color: var(--neon-cyan);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 240, 255, 0.35);
}

.stage-card.speedrun-card {
  border-color: rgba(255, 234, 0, 0.35);
}

.stage-card.speedrun-card:hover {
  border-color: var(--neon-yellow);
  box-shadow: 0 8px 25px rgba(255, 234, 0, 0.45);
}

.stage-badge {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--neon-cyan);
  letter-spacing: 1px;
}

.stage-badge.speedrun {
  color: var(--neon-yellow);
}

.stage-name {
  font-family: var(--font-sub);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.stage-desc {
  font-size: 0.78rem;
  color: #94a3b8;
}

.stage-target {
  font-size: 0.75rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: 4px;
}

/* ==========================================================================
   2. ゲーム画面 (Play Screen) — 大画面・盤面集中レイアウト
   ========================================================================== */

#game-screen {
  max-width: 920px;
  gap: 8px;
}

/* ゲーム用 コンパクトナビゲーションバー */
.game-nav-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
}

.btn-back {
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid var(--neon-cyan);
  color: #00ffff;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-family: var(--font-sub);
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-back:hover {
  background: rgba(0, 240, 255, 0.25);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.game-current-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.current-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.current-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #00ffff;
  letter-spacing: 0.8px;
}

.level-pattern-badge {
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: #00ffff;
  font-family: var(--font-sub);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.5);
}

.level-difficulty-stars {
  color: #ffea00;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(255, 234, 0, 0.6);
}

.current-subtitle {
  font-family: var(--font-sub);
  font-size: 0.8rem;
  color: #94a3b8;
}

/* コンパクト HUD */
.compact-hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  background: rgba(13, 18, 30, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
  gap: 8px;
}

.compact-hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-receptors {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hud-label {
  font-family: var(--font-sub);
  font-size: 0.84rem;
  font-weight: 700;
  color: #00ffff;
}

.receptors-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.receptor-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 20, 32, 0.85);
  border: 1px solid var(--rec-color, #00ffff);
  padding: 3px 9px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-family: var(--font-sub);
  font-weight: 600;
  transition: all 0.3s ease;
}

.receptor-pill.satisfied {
  background: rgba(0, 255, 136, 0.18);
  border-color: #00ff88;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

.receptor-pill.pending {
  color: #cbd5e1;
}

.compact-hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-chip {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sub);
  font-size: 0.82rem;
  font-weight: 600;
}

.stat-chip span {
  color: var(--neon-cyan);
  font-family: var(--font-display);
  margin-left: 4px;
}

.zero-badge {
  background: rgba(255, 51, 102, 0.15);
  border: 1px solid var(--neon-red);
  color: #ff88a3;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sub);
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.3s ease;
}

.zero-badge.ready {
  background: rgba(0, 255, 136, 0.15);
  border-color: var(--neon-green);
  color: #00ff88;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.35);
}

/* タイマーバー (ステージ5用) */
.timer-container {
  width: 100%;
  display: none;
  margin-top: 2px;
}

.timer-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00ff88, #ffea00);
  border-radius: 4px;
  transition: width 1s linear;
}

.timer-bar.urgent {
  background: #ff3366;
  box-shadow: 0 0 15px rgba(255, 51, 102, 0.8);
  animation: pulseUrgent 0.6s infinite alternate;
}

@keyframes pulseUrgent {
  from { opacity: 0.7; }
  to { opacity: 1.0; }
}

.timer-info {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  color: #cbd5e1;
  margin-top: 1px;
}

/* 大画面化された盤面キャンバスコンテナ */
.board-wrapper.play-large {
  width: 100%;
  max-width: 820px;
  min-height: 420px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 10px;
  box-shadow: 0 10px 45px rgba(0, 0, 0, 0.75);
  touch-action: none;
}

#game-canvas {
  display: block;
  cursor: crosshair;
  border-radius: var(--radius-md);
}

/* プレイドック & ツールバー */
.dock-panel.play-dock {
  width: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dock-tools {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.tool-btn {
  flex: 1;
  min-width: 140px;
  max-width: 200px;
  background: rgba(22, 30, 48, 0.75);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.tool-btn:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-cyan);
  transform: translateY(-2px);
}

.tool-btn.selected {
  background: linear-gradient(145deg, rgba(0, 240, 255, 0.28) 0%, rgba(255, 0, 238, 0.2) 100%);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.45);
}

.tool-btn.depleted {
  opacity: 0.5;
  border-color: rgba(255, 255, 255, 0.08);
}

.tool-icon {
  font-size: 1.3rem;
}

.tool-name {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #e2e8f0;
}

.tool-hotkey {
  font-family: var(--font-sub);
  font-size: 0.68rem;
  color: #7e8da6;
}

.badge-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--neon-green);
  color: #0b0d14;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 12px;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}

.badge-count.zero {
  background: #475569;
  color: #cbd5e1;
  box-shadow: none;
}

.dock-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  padding: 5px 12px;
  font-family: var(--font-sub);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.action-btn.reroll-btn {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25) 0%, rgba(0, 240, 255, 0.2) 100%);
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #d8b4fe;
  font-weight: 700;
}

.action-btn.reroll-btn:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.45) 0%, rgba(0, 240, 255, 0.35) 100%);
  border-color: #c084fc;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.5);
  transform: translateY(-1px);
}

.action-btn.primary {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.action-btn.primary:hover {
  background: rgba(0, 240, 255, 0.25);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.action-btn.reveal-btn {
  background: linear-gradient(135deg, rgba(255, 170, 0, 0.25) 0%, rgba(255, 0, 238, 0.25) 100%);
  border: 1px solid #ffaa00;
  color: #ffea00;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 0 10px rgba(255, 170, 0, 0.35);
}

.action-btn.reveal-btn:hover {
  background: linear-gradient(135deg, rgba(255, 170, 0, 0.4) 0%, rgba(255, 0, 238, 0.4) 100%);
  box-shadow: 0 0 18px rgba(255, 170, 0, 0.6);
  transform: translateY(-1px);
}

.win-revealed-badge {
  background: rgba(255, 170, 0, 0.18);
  border: 1px solid #ffaa00;
  color: #ffea00;
  font-family: var(--font-sub);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  box-shadow: 0 0 12px rgba(255, 170, 0, 0.4);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

/* ==========================================================================
   3. モーダルダイアログ
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 8, 13, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: linear-gradient(160deg, #131929 0%, #0b0d14 100%);
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.45);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 18px var(--neon-cyan);
}

.modal-sub {
  font-family: var(--font-sub);
  font-size: 1.05rem;
  color: #94a3b8;
}

.win-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.stat-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-family: var(--font-sub);
  font-size: 0.78rem;
  color: #7e8da6;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--neon-cyan);
}

.cocktail-showcase {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cocktail-card {
  background: rgba(25, 35, 55, 0.6);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
}

.cocktail-name {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
}

.cocktail-flavor {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 2px;
}

.modal-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}

.btn-modal {
  flex: 1;
  min-width: 130px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.8px;
  transition: all 0.2s ease;
}

.btn-modal.primary {
  background: linear-gradient(135deg, var(--neon-cyan) 0%, #0088ff 100%);
  border: none;
  color: #07080d;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.5);
}

.btn-modal.primary:hover {
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.8);
  transform: translateY(-2px);
}

.btn-modal.secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
}

.btn-modal.secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: #ffffff;
}

.btn-modal.tertiary {
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: #00ffff;
}

.btn-modal.tertiary:hover {
  background: rgba(0, 240, 255, 0.25);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

/* ==========================================================================
   4. スマホ・モバイル最適化レイアウト (Mobile Responsive Overhaul)
   ========================================================================== */
@media (max-width: 680px) {
  body {
    padding: 0;
    min-height: 100dvh;
  }

  .app-container {
    padding: 6px 8px;
    width: 100%;
    max-width: 100vw;
    min-height: 100dvh;
  }

  /* Start Screen Mobile */
  .start-header {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 12px;
  }

  .brand-wrapper.center {
    padding: 0;
    width: 100%;
  }

  h1.logo-title.large {
    font-size: clamp(1.2rem, 5.4vw, 1.55rem);
    letter-spacing: clamp(1px, 0.4vw, 2px);
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
  }

  .logo-sub {
    font-size: clamp(0.72rem, 3.2vw, 0.82rem);
    letter-spacing: 1px;
    margin-top: 3px;
    text-align: center;
    white-space: nowrap;
  }

  .start-audio-toggle {
    position: static;
    top: auto;
    right: auto;
    transform: none;
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 2px;
  }

  .start-audio-toggle .btn-icon {
    padding: 6px 16px;
    font-size: 0.8rem;
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 20px;
  }

  .btn-icon {
    padding: 5px 10px;
    font-size: 0.78rem;
  }

  .instructions-panel {
    padding: 12px 14px;
    gap: 10px;
  }

  .instructions-title {
    font-size: 0.98rem;
  }

  .instructions-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .instruction-card {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  .recipe-pills-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .recipe-pill {
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .stage-select-heading {
    font-size: 0.95rem;
  }

  .stage-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stage-card {
    padding: 9px 8px;
    min-height: 82px;
  }

  .stage-card.speedrun-card {
    grid-column: span 2;
  }

  .stage-badge {
    font-size: 0.7rem;
  }

  .stage-name {
    font-size: 0.85rem;
  }

  .stage-desc {
    font-size: 0.72rem;
  }

  .stage-target {
    font-size: 0.72rem;
  }

  /* Game Play Screen Mobile */
  #game-screen {
    gap: 6px;
    width: 100%;
    min-height: 100dvh;
    justify-content: flex-start;
  }

  .game-nav-bar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "back . mute"
      "stage stage stage";
    row-gap: 6px;
    padding: 8px 10px;
    align-items: center;
  }

  .btn-back {
    grid-area: back;
    padding: 5px 10px;
    font-size: 0.76rem;
  }

  #btn-mute-play {
    grid-area: mute;
    padding: 5px 10px;
    font-size: 0.76rem;
  }

  .game-current-stage {
    grid-area: stage;
    width: 100%;
  }

  .current-title {
    font-size: 0.88rem;
  }

  .current-subtitle {
    font-size: 0.7rem;
  }

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

  .hud-label {
    font-size: 0.75rem;
  }

  .receptor-pill {
    padding: 2px 7px;
    font-size: 0.72rem;
  }

  .stat-chip {
    padding: 2px 7px;
    font-size: 0.72rem;
  }

  .zero-badge {
    padding: 2px 7px;
    font-size: 0.72rem;
  }

  /* Board Wrapper Mobile */
  .board-wrapper.play-large {
    padding: 4px;
    min-height: auto;
    border-radius: var(--radius-md);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #game-canvas {
    max-width: 100%;
    height: auto;
    touch-action: none;
  }

  /* Dock Panel Mobile */
  .dock-panel.play-dock {
    padding: 6px 8px;
    gap: 6px;
    width: 100%;
  }

  .dock-tools {
    display: flex;
    gap: 6px;
    width: 100%;
  }

  .tool-btn {
    flex: 1;
    min-width: 0;
    max-width: none;
    padding: 7px 4px;
    gap: 2px;
  }

  .tool-icon {
    font-size: 1.18rem;
  }

  .tool-name {
    font-size: 0.72rem;
  }

  .tool-hotkey {
    font-size: 0.6rem;
  }

  .badge-count {
    top: -4px;
    right: -4px;
    font-size: 0.68rem;
    padding: 1px 6px;
  }

  .dock-actions {
    display: flex;
    gap: 6px;
    width: 100%;
  }

  .action-btn {
    flex: 1;
    padding: 8px 4px;
    font-size: 0.76rem;
    text-align: center;
    min-height: 38px;
  }

  .action-btn.reveal-btn {
    flex: 1.4;
    font-size: 0.82rem;
  }

  /* Modals on Mobile */
  .modal-card {
    padding: 18px 14px;
    width: 94%;
    gap: 10px;
  }

  .modal-title {
    font-size: 1.25rem;
  }

  .modal-sub {
    font-size: 0.8rem;
  }

  .stat-val {
    font-size: 1.15rem;
  }

  .modal-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .btn-modal {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
}
