/* ==========================================================================
   NEON TETRIS - PREMIUM ARCADE & ROGUE-LITE DESIGN SYSTEM (ENHANCED UI)
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-dark: #070913;
  --bg-card: rgba(13, 17, 34, 0.88);
  --bg-card-hover: rgba(20, 26, 52, 0.95);
  --border-glass: rgba(0, 243, 255, 0.25);
  --border-glass-bright: rgba(0, 243, 255, 0.7);
  --border-subtle: rgba(255, 255, 255, 0.12);

  /* Neon Tetromino Colors */
  --color-cyan: #00f3ff;
  --color-blue: #0066ff;
  --color-orange: #ff7b00;
  --color-yellow: #ffe600;
  --color-green: #00ff66;
  --color-purple: #a800ff;
  --color-red: #ff0055;
  --color-magenta: #ff00aa;
  --color-gold: #ffcc00;

  /* Rarity Colors */
  --rarity-common: #cbd5e0;
  --rarity-rare: #00f3ff;
  --rarity-epic: #a800ff;
  --rarity-legendary: #ffcc00;

  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Glow Filters */
  --glow-cyan: 0 0 15px rgba(0, 243, 255, 0.5), 0 0 30px rgba(0, 243, 255, 0.2);
  --glow-magenta: 0 0 15px rgba(255, 0, 170, 0.5), 0 0 30px rgba(255, 0, 170, 0.2);
  --glow-gold: 0 0 15px rgba(255, 204, 0, 0.5), 0 0 30px rgba(255, 204, 0, 0.2);
  --glow-matrix: 0 0 25px rgba(0, 243, 255, 0.25), inset 0 0 20px rgba(0, 243, 255, 0.1);

  /* Fonts */
  --font-display: 'Orbitron', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-accent: 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Sizing & Transitions */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Utilities */
.hidden {
  display: none !important;
}

/* CSS Reset & Baseline */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
}

/* ==========================================================================
   DYNAMIC BACKGROUND (Nebula, Aurora & Grid)
   ========================================================================== */

.cyber-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.aurora {
  position: absolute;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  animation: auroraFloat 18s ease-in-out infinite alternate;
}

.aurora-1 {
  top: -10vw;
  left: -10vw;
  background: radial-gradient(circle, var(--color-cyan) 0%, transparent 70%);
}

.aurora-2 {
  bottom: -15vw;
  right: -10vw;
  background: radial-gradient(circle, var(--color-purple) 0%, transparent 70%);
  animation-duration: 22s;
  animation-direction: alternate-reverse;
}

@keyframes auroraFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.15); }
  100% { transform: translate(-40px, 80px) scale(0.95); }
}

.cyber-grid-plane {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(0, 243, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.85) 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.85) 0%, transparent 75%);
}

/* ==========================================================================
   LAYOUT CONTAINER
   ========================================================================== */

.app-container {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 10px 18px;
}

/* Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.5px;
  padding: 4px 8px;
  background: linear-gradient(135deg, var(--color-cyan), var(--color-purple));
  color: #fff;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.game-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(0, 243, 255, 0.6);
}

.game-title .highlight {
  color: var(--color-cyan);
}

/* Mode Switcher Tabs */
.mode-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  gap: 6px;
}

.mode-tab {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-tab:hover {
  color: var(--text-main);
}

.mode-tab.active {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.3), rgba(168, 0, 255, 0.3));
  border: 1px solid var(--border-glass-bright);
  color: var(--color-cyan);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.4);
}

.header-credits {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 204, 0, 0.15);
  border: 1px solid rgba(255, 204, 0, 0.5);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.header-track-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 243, 255, 0.12);
  border: 1px solid var(--border-glass-bright);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--color-cyan);
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.25);
  animation: trackGlowPulse 4s infinite alternate;
}

@keyframes trackGlowPulse {
  0% { box-shadow: 0 0 8px rgba(0, 243, 255, 0.2); }
  100% { box-shadow: 0 0 16px rgba(0, 243, 255, 0.5); }
}

.credit-val {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  color: var(--color-gold);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn .icon {
  width: 19px;
  height: 19px;
}

.icon-btn:hover {
  background: rgba(0, 243, 255, 0.15);
  border-color: var(--border-glass-bright);
  color: var(--color-cyan);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.icon-btn.muted {
  opacity: 0.45;
  color: var(--text-dim);
}

/* ==========================================================================
   MAIN GAMEPLAY LAYOUT (Sidebars + Center Board)
   ========================================================================== */

.game-layout {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  min-height: 0;
  max-height: calc(100vh - 75px);
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 195px;
  flex-shrink: 0;
}

/* Glass Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transition: border-color var(--transition-normal);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.card-tag {
  font-family: var(--font-accent);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--color-cyan);
  text-transform: uppercase;
}

.key-hint, .badge-count {
  font-size: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--text-main);
}

.canvas-box {
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mini-canvas-box {
  height: 90px;
}

.next-canvas-box {
  height: 270px;
}

/* Stats Rows */
.stat-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.highlight-cyan {
  color: var(--color-cyan);
  text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

.highlight-magenta {
  color: var(--color-magenta);
  text-shadow: 0 0 8px rgba(255, 0, 170, 0.5);
}

.highlight-gold {
  color: var(--color-gold);
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
}

/* Score Card & Level Card */
.score-card, .rogue-info-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.score-block {
  text-align: center;
}

.score-label {
  display: block;
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.score-number-wrapper {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.score-number {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: var(--color-cyan);
  text-shadow: 0 0 12px rgba(0, 243, 255, 0.6);
  letter-spacing: 1px;
}

.level-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.level-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.level-number {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  color: var(--color-magenta);
  text-shadow: 0 0 10px rgba(255, 0, 170, 0.6);
}

.level-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.level-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-cyan), var(--color-magenta));
  box-shadow: 0 0 8px rgba(0, 243, 255, 0.6);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.level-sub {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* ==========================================================================
   ROGUE-LITE BARS & HUD (PROMINENT & READABLE)
   ========================================================================== */

/* Live Operator Radio Transmission Widget */
.radio-chatter-widget {
  width: 100%;
  max-width: 320px;
  background: rgba(13, 17, 34, 0.95);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 243, 255, 0.25);
  transition: all var(--transition-fast);
}

.radio-avatar {
  font-size: 26px;
  background: rgba(0, 243, 255, 0.15);
  border: 2px solid var(--color-cyan);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
  flex-shrink: 0;
}

.radio-content {
  flex: 1;
}

.radio-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.radio-speaker-name {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--color-cyan);
}

.radio-live-tag {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  color: #00ff66;
  text-shadow: 0 0 6px #00ff66;
}

.radio-message {
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.4;
  font-weight: 500;
}

/* Interactive Story Dialogue & Choice Modal */
.dialogue-choice-box {
  max-width: 720px;
  padding: 30px;
}

.dialogue-character-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.dialogue-avatar {
  font-size: 34px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0, 243, 255, 0.15);
  border: 2px solid var(--color-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.5);
  flex-shrink: 0;
}

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

.dialogue-speaker-tag {
  font-family: var(--font-accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.dialogue-speaker-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  color: var(--color-cyan);
}

.dialogue-speech-box {
  background: rgba(0, 243, 255, 0.08);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(0, 243, 255, 0.1);
}

.dialogue-speech-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
}

.dialogue-choice-heading {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--color-gold);
  margin-bottom: 10px;
}

.dialogue-choices-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dialogue-choice-card {
  background: rgba(16, 22, 45, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.dialogue-choice-card:hover {
  background: rgba(0, 243, 255, 0.15);
  border-color: var(--color-cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 243, 255, 0.3);
}

.choice-card-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.choice-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Boss Top Header */
.rogue-boss-header {
  width: 100%;
  max-width: 320px;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 2px solid rgba(255, 0, 85, 0.5);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 6px;
  box-shadow: 0 6px 25px rgba(255, 0, 85, 0.25);
}

.boss-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.boss-avatar {
  font-size: 26px;
  background: rgba(255, 0, 85, 0.2);
  border: 2px solid rgba(255, 0, 85, 0.6);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(255, 0, 85, 0.5);
  flex-shrink: 0;
}

.boss-details {
  flex: 1;
}

.boss-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.boss-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ff3377;
}

.boss-stage {
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.boss-hp-bar {
  position: relative;
  width: 100%;
  height: 16px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 0, 85, 0.5);
}

.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff0055, #ff7b00);
  box-shadow: 0 0 12px rgba(255, 0, 85, 0.9);
  transition: width 0.2s ease;
}

.boss-hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 3px #000;
}

.boss-intent-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.intent-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-gold);
}

.intent-timer-bar {
  width: 95px;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

.intent-timer-fill {
  height: 100%;
  background: var(--color-gold);
  box-shadow: 0 0 8px var(--color-gold);
  transition: width 0.1s linear;
}

/* Player Hull & Ultimates Row */
.rogue-player-bar {
  width: 100%;
  max-width: 320px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hull-status {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.hull-hp-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.hull-label {
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.hull-value {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  color: var(--color-green);
}

.hull-hp-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  overflow: hidden;
}

.hull-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff66, #00f3ff);
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.7);
  transition: width 0.25s ease;
}

.skills-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.skill-btn {
  position: relative;
  background: rgba(13, 17, 34, 0.9);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all var(--transition-fast);
  overflow: hidden;
}

.skill-btn .skill-key {
  position: absolute;
  top: 3px;
  left: 5px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  color: var(--color-cyan);
}

.skill-btn .skill-icon {
  font-size: 20px;
  margin-top: 3px;
}

.skill-btn .skill-label {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  margin-top: 3px;
  color: var(--text-muted);
}

.skill-btn.ready {
  border-color: var(--color-cyan);
  box-shadow: 0 0 14px rgba(0, 243, 255, 0.6);
  animation: skillReadyPulse 2s infinite;
}

.skill-btn.ready .skill-label {
  color: var(--color-cyan);
}

.skill-btn:active {
  transform: scale(0.94);
}

@keyframes skillReadyPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(0, 243, 255, 0.4); }
  50% { transform: scale(1.04); box-shadow: 0 0 18px rgba(0, 243, 255, 0.85); }
}

/* In-Game Combat Live Hint Bar */
.in-game-hint-bar {
  width: 100%;
  max-width: 320px;
  margin-top: 6px;
  background: rgba(13, 17, 34, 0.9);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.hint-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.hint-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
}

/* Cyber Chips Deck */
.chips-card {
  max-height: 280px;
  overflow-y: auto;
}

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

.chip-slot {
  position: relative;
  height: 52px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip-slot.filled {
  border-style: solid;
  border-color: var(--border-glass-bright);
  background: rgba(0, 243, 255, 0.1);
}

.chip-slot.filled.rarity-common { border-color: var(--rarity-common); }
.chip-slot.filled.rarity-rare { border-color: var(--rarity-rare); box-shadow: 0 0 10px rgba(0,243,255,0.4); }
.chip-slot.filled.rarity-epic { border-color: var(--rarity-epic); box-shadow: 0 0 12px rgba(168,0,255,0.5); }
.chip-slot.filled.rarity-legendary { border-color: var(--rarity-legendary); box-shadow: 0 0 15px rgba(255,204,0,0.6); }

.chip-slot .chip-icon {
  font-size: 24px;
}

.chip-slot .chip-tooltip {
  position: absolute;
  left: 105%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  width: 220px;
  background: rgba(10, 14, 30, 0.98);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-main);
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.9);
  transition: opacity var(--transition-fast);
}

.chip-slot:hover .chip-tooltip {
  opacity: 1;
}

.chip-tooltip-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-cyan);
  margin-bottom: 4px;
  font-size: 13px;
}

/* ==========================================================================
   MATRIX (MAIN BOARD)
   ========================================================================== */

.matrix-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.matrix-glow-frame {
  padding: 8px;
  background: rgba(10, 14, 30, 0.85);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-glass);
  box-shadow: var(--glow-matrix), 0 20px 50px rgba(0, 0, 0, 0.7);
  position: relative;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.matrix-glow-frame.tetris-flash {
  border-color: var(--color-cyan);
  box-shadow: 0 0 40px rgba(0, 243, 255, 0.8), inset 0 0 30px rgba(0, 243, 255, 0.4);
}

.matrix-container {
  position: relative;
  width: 300px;
  height: 600px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(5, 7, 15, 0.95);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9);
}

#matrixCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#fxCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

/* Danger Warning Glow */
.danger-glow {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(circle at top, rgba(255, 0, 85, 0.35) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.danger-glow.active {
  opacity: 1;
  animation: dangerPulse 1.2s ease-in-out infinite alternate;
}

@keyframes dangerPulse {
  0% { opacity: 0.3; }
  100% { opacity: 0.85; }
}

/* Floating Action Banners */
.action-banner, .combo-banner {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0;
}

.action-banner {
  top: 40%;
  font-size: 24px;
}

.action-banner.show {
  animation: bannerPop 1.1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.combo-banner {
  top: 50%;
  font-size: 19px;
  color: var(--color-gold);
  text-shadow: 0 0 15px rgba(255, 204, 0, 0.8);
}

.combo-banner.show {
  animation: comboPop 0.9s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bannerPop {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(0.6); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  40% { transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -10px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -30px) scale(0.85); }
}

@keyframes comboPop {
  0% { opacity: 0; transform: translate(-50%, 15px) scale(0.7); }
  25% { opacity: 1; transform: translate(-50%, 0) scale(1.2); }
  80% { opacity: 1; transform: translate(-50%, -5px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -20px) scale(0.8); }
}

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */

.btn {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-cyan), #0099ff);
  color: #030816;
  box-shadow: 0 4px 18px rgba(0, 243, 255, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4df7ff, #33adff);
  box-shadow: 0 6px 24px rgba(0, 243, 255, 0.6);
  transform: translateY(-2px);
}

.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: rgba(0, 243, 255, 0.15);
  border-color: var(--border-glass-bright);
  color: var(--color-cyan);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--text-muted);
}

.btn-danger-outline {
  background: transparent;
  color: var(--color-red);
  border: 1px solid rgba(255, 0, 85, 0.3);
}

.btn-danger-outline:hover {
  background: rgba(255, 0, 85, 0.15);
  border-color: var(--color-red);
}

.highlight-btn {
  border-color: var(--color-gold);
  color: var(--color-gold);
  background: rgba(255, 204, 0, 0.12);
}

.highlight-btn:hover {
  background: rgba(255, 204, 0, 0.25);
  border-color: var(--color-gold);
  color: #fff;
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.5);
}

.pulse-btn {
  animation: buttonGlowPulse 2.5s infinite;
}

@keyframes buttonGlowPulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(0, 243, 255, 0.4); }
  50% { box-shadow: 0 4px 28px rgba(0, 243, 255, 0.8), 0 0 10px var(--color-cyan); }
}

/* ==========================================================================
   MODALS & OVERLAYS
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 6, 14, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), var(--glow-cyan);
  width: 100%;
  max-width: 520px;
  padding: 28px;
  position: relative;
  transform: scale(0.92) translateY(15px);
  transition: transform var(--transition-spring);
}

.modal-overlay.active .modal-box {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close:hover { color: var(--color-cyan); }

.modal-footer {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 14px;
}

.modal-footer.split { justify-content: space-between; }

/* Start Modal Specifics */
.start-box { text-align: center; max-width: 480px; }

.cyber-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--color-cyan);
  background: rgba(0, 243, 255, 0.12);
  border: 1px solid var(--border-glass);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.cyber-badge.highlight-gold {
  color: var(--color-gold);
  border-color: rgba(255, 204, 0, 0.5);
  background: rgba(255, 204, 0, 0.12);
}

.cyber-badge.highlight-cyan {
  color: var(--color-cyan);
  border-color: rgba(0, 243, 255, 0.5);
  background: rgba(0, 243, 255, 0.12);
}

.start-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 3px;
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(0, 243, 255, 0.6);
}

.start-desc {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.55;
}

.start-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.key-quick-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.key-pill {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

kbd {
  font-family: var(--font-display);
  font-size: 11px;
  background: rgba(0, 243, 255, 0.18);
  border: 1px solid var(--border-glass);
  color: var(--color-cyan);
  padding: 3px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   BRIEFING & LORE MODAL
   ========================================================================== */

.briefing-box {
  max-width: 620px;
}

.briefing-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  margin-bottom: 14px;
  text-shadow: 0 0 15px rgba(0, 243, 255, 0.6);
}

.lore-card {
  background: rgba(0, 243, 255, 0.08);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(0, 243, 255, 0.15);
}

.lore-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
}

.briefing-section-title {
  font-family: var(--font-accent);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--color-gold);
  margin-bottom: 12px;
}

.briefing-steps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.briefing-step-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.step-content strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-cyan);
  display: block;
  margin-bottom: 4px;
}

.step-content p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ==========================================================================
   ROGUE-LITE MODALS (MAP, DRAFT, SHOP, EVENT, VICTORY)
   ========================================================================== */

/* Map Modal */
.map-box {
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
}

.map-stats-pill {
  display: flex;
  gap: 16px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
}

.map-instruction {
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 16px;
  font-weight: 600;
}

.sector-map-canvas-wrapper {
  background: rgba(4, 7, 16, 0.9);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-stage-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: all var(--transition-normal);
}

.map-stage-wrapper.current-stage {
  background: rgba(0, 243, 255, 0.06);
  border-color: var(--border-glass-bright);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
}

.map-stage-wrapper.past-stage {
  opacity: 0.5;
}

.map-stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.stage-num {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--color-cyan);
}

.current-badge {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
  background: var(--color-gold);
  color: #030816;
  padding: 2px 8px;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(255, 204, 0, 0.6);
}

.map-node-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.map-node-card {
  background: rgba(16, 22, 45, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-fast);
}

.map-node-card.available {
  background: rgba(255, 204, 0, 0.12);
  border: 2px solid var(--color-gold);
  box-shadow: 0 0 18px rgba(255, 204, 0, 0.5);
  cursor: pointer;
}

.map-node-card.available:hover {
  background: rgba(255, 204, 0, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(255, 204, 0, 0.8);
}

.map-node-card.completed {
  border-color: rgba(0, 255, 102, 0.3);
  background: rgba(0, 255, 102, 0.05);
}

.map-node-card.locked {
  background: rgba(10, 14, 28, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
}

.node-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.node-card-icon {
  font-size: 26px;
  flex-shrink: 0;
}

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

.node-card-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
  color: #ffffff;
}

.map-node-card.available .node-card-title {
  color: var(--color-gold);
}

.node-card-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.node-action-btn {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--color-gold), #ff9900);
  color: #030816;
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(255, 204, 0, 0.6);
}

.node-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.badge-done {
  color: var(--color-green);
  background: rgba(0, 255, 102, 0.1);
  border: 1px solid rgba(0, 255, 102, 0.4);
}

.badge-locked {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
}

.map-row-connector {
  text-align: center;
  font-size: 14px;
  color: var(--color-cyan);
  opacity: 0.6;
  line-height: 1;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-around;
  margin-top: 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.legend-item { display: flex; align-items: center; gap: 6px; }

/* Draft Modal (Cards Grid) */
.draft-box {
  max-width: 680px;
  text-align: center;
}

.draft-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.draft-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.draft-card {
  background: rgba(10, 14, 30, 0.95);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.draft-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8);
}

.draft-card.rarity-common { border-color: var(--rarity-common); }
.draft-card.rarity-rare { border-color: var(--rarity-rare); box-shadow: 0 0 15px rgba(0, 243, 255, 0.3); }
.draft-card.rarity-epic { border-color: var(--rarity-epic); box-shadow: 0 0 20px rgba(168, 0, 255, 0.4); }
.draft-card.rarity-legendary { border-color: var(--rarity-legendary); box-shadow: 0 0 25px rgba(255, 204, 0, 0.5); }

.draft-card-rarity {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.draft-card.rarity-common .draft-card-rarity { color: var(--rarity-common); }
.draft-card.rarity-rare .draft-card-rarity { color: var(--rarity-rare); }
.draft-card.rarity-epic .draft-card-rarity { color: var(--rarity-epic); }
.draft-card.rarity-legendary .draft-card-rarity { color: var(--rarity-legendary); }

.draft-card-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.draft-card-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 10px;
}

.draft-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Shop Modal */
.shop-box { max-width: 640px; }
.shop-balance { font-family: var(--font-display); font-size: 16px; }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.shop-item-card {
  background: rgba(10, 14, 30, 0.95);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.shop-item-icon { font-size: 32px; }
.shop-item-details { flex: 1; }
.shop-item-name { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: #fff; }
.shop-item-desc { font-size: 11px; color: var(--text-muted); margin: 3px 0 8px; line-height: 1.35; }

/* Event Modal */
.event-box { max-width: 540px; }
.event-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.event-icon { font-size: 32px; }
.event-story { font-size: 14px; line-height: 1.6; color: var(--text-main); margin-bottom: 22px; }

.event-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.event-choice-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: left;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.event-choice-btn:hover {
  background: rgba(0, 243, 255, 0.15);
  border-color: var(--color-cyan);
}

.event-choice-title { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--color-cyan); }
.event-choice-effect { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Victory Modal */
.victory-box { text-align: center; max-width: 480px; }
.victory-title { font-family: var(--font-display); font-size: 28px; font-weight: 900; color: var(--color-cyan); margin: 8px 0 10px; }
.victory-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 22px; }

/* Pause Modal */
.pause-box { text-align: center; max-width: 400px; }
.pause-stats {
  display: flex;
  justify-content: space-around;
  background: rgba(0, 0, 0, 0.4);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin: 18px 0 24px;
}
.pause-stat-item span { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.pause-stat-item strong { font-family: var(--font-display); font-size: 20px; color: var(--color-cyan); }
.pause-buttons { display: flex; flex-direction: column; gap: 12px; }

/* Game Over Modal */
.gameover-box { text-align: center; max-width: 500px; }
.gameover-tag { font-family: var(--font-display); font-size: 13px; letter-spacing: 2px; color: var(--color-red); }
.gameover-title { font-family: var(--font-display); font-size: 26px; font-weight: 900; margin: 6px 0 12px; color: #fff; }
.new-record-banner {
  background: linear-gradient(90deg, rgba(255, 204, 0, 0.2), rgba(255, 0, 170, 0.2));
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  font-family: var(--font-display);
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  box-shadow: var(--glow-gold);
}
.gameover-score-hero {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
}
.hero-label { font-size: 12px; letter-spacing: 2px; color: var(--text-muted); display: block; margin-bottom: 5px; }
.hero-score { font-family: var(--font-display); font-size: 40px; font-weight: 900; color: var(--color-cyan); text-shadow: 0 0 20px rgba(0, 243, 255, 0.7); }
.gameover-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 26px; }
.go-stat-cell { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 12px 8px; }
.cell-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.cell-val { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.gameover-actions { display: flex; gap: 14px; }
.gameover-actions .btn { flex: 1; }

/* Settings Modal & Controls */
.settings-list { display: flex; flex-direction: column; gap: 18px; }
.setting-item { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--border-subtle); }
.setting-info { display: flex; flex-direction: column; gap: 3px; }
.setting-name { font-weight: 600; font-size: 15px; color: var(--text-main); }
.setting-desc { font-size: 13px; color: var(--text-muted); }
.setting-control { display: flex; align-items: center; gap: 12px; }
.volume-val { font-family: var(--font-display); font-size: 13px; min-width: 44px; text-align: right; color: var(--color-cyan); }

input[type="range"] {
  -webkit-appearance: none;
  width: 120px;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-cyan);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.8);
  cursor: pointer;
}

.switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: rgba(255, 255, 255, 0.18); transition: 0.3s; border-radius: 26px; }
.slider::before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: 0.3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--color-cyan); box-shadow: 0 0 12px rgba(0, 243, 255, 0.5); }
input:checked + .slider::before { transform: translateX(22px); background-color: #030816; }

/* How to Play */
.howto-content { display: flex; flex-direction: column; gap: 22px; max-height: 60vh; overflow-y: auto; padding-right: 8px; }
.howto-section h3 { font-size: 16px; font-weight: 700; color: var(--color-cyan); margin-bottom: 14px; }
.controls-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.ctrl-item { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-main); }
.ctrl-item span { color: var(--text-muted); }
.mechanics-list { list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--text-muted); line-height: 1.45; }
.mechanics-list strong { color: var(--text-main); }

/* High Scores Table */
.scores-table-wrapper { max-height: 320px; overflow-y: auto; margin: 12px 0; }
.scores-table { width: 100%; border-collapse: collapse; text-align: left; }
.scores-table th { font-family: var(--font-accent); font-size: 13px; letter-spacing: 1px; color: var(--text-muted); padding: 10px 8px; border-bottom: 1px solid var(--border-subtle); }
.scores-table td { padding: 12px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-family: var(--font-display); font-size: 14px; }
.scores-table tr:first-child td { color: var(--color-gold); font-weight: 700; }

/* ==========================================================================
   TOUCH CONTROLS
   ========================================================================== */

.touch-controls {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 8px 6px;
  gap: 12px;
  z-index: 20;
}

.touch-group { display: flex; gap: 8px; }
.touch-btn {
  background: rgba(20, 26, 52, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}
.touch-btn svg { width: 24px; height: 24px; }
.touch-btn:active, .touch-btn.pressed {
  background: rgba(0, 243, 255, 0.3);
  border-color: var(--color-cyan);
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.5);
  transform: scale(0.92);
}
.touch-btn-drop { background: rgba(255, 0, 85, 0.2); border-color: rgba(255, 0, 85, 0.4); color: #ff3377; }
.touch-btn-drop:active, .touch-btn-drop.pressed { background: rgba(255, 0, 85, 0.5); border-color: var(--color-red); box-shadow: 0 0 15px rgba(255, 0, 85, 0.6); }
.touch-btn-hold { background: rgba(168, 0, 255, 0.2); border-color: rgba(168, 0, 255, 0.4); color: #c966ff; }

.cyber-select {
  background: rgba(13, 17, 34, 0.95);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
}

.cyber-select option {
  background: #0d1122;
  color: #fff;
}

/* ==========================================================================
   DESKTOP & LARGE MONITOR SCALING
   ========================================================================== */

@media (min-width: 901px) {
  .app-container {
    max-width: 1440px;
    padding: 14px 24px;
  }

  .game-layout {
    gap: 24px;
  }

  .side-panel {
    width: 240px;
  }

  .matrix-container {
    width: 340px;
    height: 680px;
  }

  #matrixCanvas, #fxCanvas {
    width: 340px;
    height: 680px;
  }

  .mini-canvas-box {
    height: 110px;
  }

  .next-canvas-box {
    height: 320px;
  }

  .rogue-boss-header, .rogue-player-bar, .in-game-hint-bar {
    max-width: 340px;
  }

  .stat-label {
    font-size: 14px;
  }

  .stat-value {
    font-size: 16px;
  }

  .card-tag {
    font-size: 15px;
  }

  .score-number {
    font-size: 26px;
  }

  .level-number {
    font-size: 22px;
  }
}

/* 120% and 140% Large Monitor UI Scales */
[data-scale="120"], [data-scale="140"] {
  font-size: 18px;
}

[data-scale="120"] .modal-box, [data-scale="140"] .modal-box {
  max-width: 780px;
  padding: 34px;
}

[data-scale="120"] .map-box, [data-scale="140"] .map-box {
  max-width: 860px;
}

[data-scale="120"] .briefing-box, [data-scale="140"] .briefing-box {
  max-width: 800px;
}

[data-scale="120"] .draft-box, [data-scale="140"] .draft-box {
  max-width: 880px;
}

[data-scale="120"] .draft-card, [data-scale="140"] .draft-card {
  padding: 24px 18px;
}

[data-scale="120"] .draft-card-name, [data-scale="140"] .draft-card-name {
  font-size: 17px;
}

[data-scale="120"] .draft-card-desc, [data-scale="140"] .draft-card-desc {
  font-size: 14px;
}

[data-scale="120"] .shop-box, [data-scale="140"] .shop-box {
  max-width: 820px;
}

[data-scale="120"] .shop-item-card, [data-scale="140"] .shop-item-card {
  padding: 18px;
}

[data-scale="120"] .shop-item-name, [data-scale="140"] .shop-item-name {
  font-size: 15px;
}

[data-scale="120"] .shop-item-desc, [data-scale="140"] .shop-item-desc {
  font-size: 13px;
}

[data-scale="120"] .map-node-card .node-card-title, [data-scale="140"] .map-node-card .node-card-title {
  font-size: 16px;
}

[data-scale="120"] .map-node-card .node-card-desc, [data-scale="140"] .map-node-card .node-card-desc {
  font-size: 14px;
}

[data-scale="120"] .map-node-card .node-action-btn, [data-scale="140"] .map-node-card .node-action-btn {
  font-size: 13px;
  padding: 10px 16px;
}

[data-scale="120"] .in-game-hint-bar .hint-text, [data-scale="140"] .in-game-hint-bar .hint-text {
  font-size: 14px;
}

[data-scale="140"] .side-panel {
  width: 270px;
}

[data-scale="140"] .matrix-container {
  width: 380px;
  height: 760px;
}

[data-scale="140"] #matrixCanvas, [data-scale="140"] #fxCanvas {
  width: 380px;
  height: 760px;
}

[data-scale="140"] .mini-canvas-box {
  height: 125px;
}

[data-scale="140"] .next-canvas-box {
  height: 360px;
}

[data-scale="140"] .rogue-boss-header, [data-scale="140"] .rogue-player-bar, [data-scale="140"] .in-game-hint-bar {
  max-width: 380px;
}

/* Boss Dialogue & Speech Bubble */
.boss-dialogue-bubble {
  font-size: 11px;
  font-style: italic;
  color: #ff99bb;
  background: rgba(255, 0, 85, 0.12);
  border: 1px dashed rgba(255, 0, 85, 0.4);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-top: 8px;
  line-height: 1.35;
  text-align: center;
}

/* Cyber Dossier & Lore Modal */
.dossier-box {
  max-width: 820px;
  max-height: 85vh;
  overflow-y: auto;
}

.dossier-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
  overflow-x: auto;
}

.dossier-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.dossier-tab:hover {
  color: var(--text-main);
}

.dossier-tab.active {
  background: rgba(0, 243, 255, 0.15);
  border-color: var(--color-cyan);
  color: var(--color-cyan);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.dossier-pane {
  display: none;
}

.dossier-pane.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lore-entry {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  line-height: 1.6;
}

.lore-entry-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lore-badge {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
  background: var(--color-cyan);
  color: #030816;
  padding: 3px 8px;
  border-radius: 4px;
}

.lore-entry h4 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.boss-dossier-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.boss-dossier-card {
  background: rgba(255, 0, 85, 0.05);
  border: 1px solid rgba(255, 0, 85, 0.35);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.boss-dossier-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.boss-avatar-sm {
  font-size: 26px;
  width: 44px;
  height: 44px;
  background: rgba(255, 0, 85, 0.15);
  border: 1px solid rgba(255, 0, 85, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.boss-dossier-top strong {
  font-family: var(--font-display);
  font-size: 14px;
  color: #ff3377;
  display: block;
}

.boss-class {
  font-size: 11px;
  color: var(--text-muted);
}

.dossier-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.dossier-list strong {
  color: var(--color-cyan);
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */

@media (max-width: 900px) {
  .app-container { padding: 6px 8px; }
  .game-layout { gap: 10px; }
  .side-panel { width: 150px; }
  .matrix-container { width: 260px; height: 520px; }
  #matrixCanvas, #fxCanvas { width: 260px; height: 520px; }
}

@media (max-width: 700px) {
  .touch-controls { display: flex; }
  .game-layout { flex-direction: row; align-items: flex-start; gap: 6px; }
  .side-left { order: 1; width: 90px; }
  .matrix-wrapper { order: 2; }
  .side-right { order: 3; width: 90px; }
  .matrix-container { width: 190px; height: 380px; }
  #matrixCanvas, #fxCanvas { width: 190px; height: 380px; }
  .stats-card, .level-sub, .rogue-info-card, .in-game-hint-bar { display: none; }
  .glass-card { padding: 6px; }
  .mini-canvas-box { height: 55px; }
  .next-canvas-box { height: 160px; }
  .score-number { font-size: 16px; }
  .level-number { font-size: 16px; }
  .game-title { font-size: 16px; }
}
