/* ==============================================================
   CODEWORLD: STICKMAN HACKER (ARCENGINE 2D)
   Steam Indie Platformer Styling
   ============================================================== */

:root {
  --neon-blue: #00f0ff;
  --neon-green: #00ff88;
  --neon-purple: #b026ff;
  --neon-yellow: #ffe600;
  --neon-red: #ff2a5f;
  --bg-dark: #070913;
  --panel-bg: rgba(13, 19, 33, 0.92);
  --panel-border: rgba(0, 240, 255, 0.4);
  --glass-blur: blur(12px);
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: 'JetBrains Mono', 'Segoe UI', Consolas, monospace;
  color: #fff;
}

/* Game Canvas (Full window 2D) */
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  background: #070913;
}

/* In-Game HUD Overlay */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
}

/* Top Header */
.top-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: auto;
  gap: 16px;
}

.left-status-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.engine-badge {
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  padding: 7px 16px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0, 240, 255, 0.2);
}

.engine-logo {
  font-size: 18px;
  color: var(--neon-blue);
  animation: logoPulse 2s infinite ease-in-out;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px var(--neon-blue)); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 10px var(--neon-blue)); }
}

.engine-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #e2e8f0;
}

.engine-lang {
  background: rgba(0, 255, 136, 0.15);
  color: var(--neon-green);
  border: 1px solid rgba(0, 255, 136, 0.4);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Stage Indicator Pills */
.stage-pills {
  display: flex;
  gap: 6px;
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  padding: 5px 8px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: fit-content;
}

.stage-pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
  color: #64748b;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  font-weight: 700;
}

.stage-pill.active {
  background: rgba(0, 240, 255, 0.2);
  color: var(--neon-blue);
  border-color: var(--neon-blue);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
}

.stage-pill.completed {
  background: rgba(0, 255, 136, 0.15);
  color: var(--neon-green);
  border-color: rgba(0, 255, 136, 0.4);
}

/* Right Status Group (Level Badge & 30s Timer) */
.right-status-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.level-badge {
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 230, 0, 0.35);
  padding: 7px 16px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--neon-yellow);
  box-shadow: 0 4px 15px rgba(255, 230, 0, 0.15);
}

/* 30 Seconds Countdown Timer Display */
#timer-container {
  display: none;
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  border: 2px solid var(--neon-yellow);
  padding: 8px 16px;
  border-radius: 18px;
  box-shadow: 0 0 25px rgba(255, 230, 0, 0.4);
  flex-direction: column;
  align-items: center;
  min-width: 160px;
  animation: timerGlow 1.5s infinite alternate;
}

#timer-container.active {
  display: flex;
}

#timer-container.urgent {
  border-color: var(--neon-red);
  box-shadow: 0 0 35px rgba(255, 42, 95, 0.7);
  animation: urgentShake 0.4s infinite alternate;
}

@keyframes timerGlow {
  0% { box-shadow: 0 0 15px rgba(255, 230, 0, 0.3); }
  100% { box-shadow: 0 0 30px rgba(255, 230, 0, 0.6); }
}

@keyframes urgentShake {
  0% { transform: scale(1); filter: drop-shadow(0 0 8px var(--neon-red)); }
  100% { transform: scale(1.05); filter: drop-shadow(0 0 20px var(--neon-red)); }
}

.timer-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #94a3b8;
  text-transform: uppercase;
}

.timer-digits {
  font-size: 24px;
  font-weight: 900;
  color: var(--neon-yellow);
  letter-spacing: 2px;
}

#timer-container.urgent .timer-digits {
  color: var(--neon-red);
}

.timer-bar-wrap {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--neon-yellow);
  transition: width 0.1s linear;
}

#timer-container.urgent .timer-bar-fill {
  background: var(--neon-red);
}

/* Tutorial Hint Banner */
.tutorial-banner {
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(0, 255, 136, 0.4);
  border-left: 5px solid var(--neon-green);
  border-radius: 14px;
  padding: 14px 18px;
  max-width: 520px;
  margin-top: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  transition: all 0.3s ease;
}

.tutorial-banner-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--neon-green);
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
}

.tutorial-banner-desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: #cbd5e1;
}

.tutorial-code-hint {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hint-chip {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 230, 0, 0.35);
  padding: 5px 12px;
  border-radius: 8px;
  color: var(--neon-yellow);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.hint-chip:hover {
  background: rgba(255, 230, 0, 0.2);
  border-color: var(--neon-yellow);
  transform: translateY(-1px);
}

/* Bottom Controls Helper */
.bottom-hints {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #94a3b8;
  pointer-events: auto;
  flex-wrap: wrap;
}

.hint-pill {
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 12px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.key-tag {
  background: rgba(0, 240, 255, 0.2);
  color: var(--neon-blue);
  border: 1px solid rgba(0, 240, 255, 0.4);
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 800;
  font-size: 10px;
}

/* ================= HOLOGRAPHIC PYTHON TERMINAL ================= */
#terminal-container {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 480px;
  max-width: 90vw;
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 240, 255, 0.2);
  z-index: 30;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  pointer-events: auto;
}

#terminal-container.minimized {
  transform: translateY(calc(100% - 42px));
  opacity: 0.92;
}

.terminal-header {
  background: rgba(0, 240, 255, 0.08);
  border-bottom: 1px solid rgba(0, 240, 255, 0.2);
  padding: 9px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.terminal-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--neon-blue);
}

.terminal-controls {
  display: flex;
  gap: 6px;
}

.term-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 15px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.term-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.terminal-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.terminal-output {
  background: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #94a3b8;
  max-height: 110px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.output-line {
  margin-bottom: 4px;
  word-break: break-word;
}

.output-success {
  color: var(--neon-green);
  font-weight: 700;
}

.output-error {
  color: var(--neon-red);
  font-weight: 700;
}

.output-info {
  color: var(--neon-blue);
}

.output-warning {
  color: var(--neon-yellow);
  font-weight: 700;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 10px;
  padding: 8px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.terminal-input-row:focus-within {
  border-color: var(--neon-blue);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.35);
}

.terminal-prompt {
  color: var(--neon-green);
  font-weight: 800;
  font-size: 14px;
}

#code-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
}

#code-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
}

.btn-run-code {
  background: linear-gradient(135deg, var(--neon-blue), #0284c7);
  color: #04101e;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 800;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-run-code:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/* Click-to-Play Start Overlay Screen */
#start-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(13, 19, 33, 0.94), rgba(7, 9, 19, 0.99));
  backdrop-filter: blur(14px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: default;
  transition: opacity 0.3s ease;
}

#start-overlay.hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.splash-box {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--panel-border);
  padding: 36px 44px;
  border-radius: 26px;
  box-shadow: 0 0 60px rgba(0, 240, 255, 0.25);
  max-width: 620px;
  width: 90%;
}

.splash-logo {
  font-size: 52px;
  margin-bottom: 10px;
}

.splash-title {
  font-size: 30px;
  font-weight: 900;
  background: linear-gradient(90deg, var(--neon-blue), var(--neon-green));
  -webkit-background-clip: text;
  color: transparent;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.splash-desc {
  font-size: 13.5px;
  line-height: 1.6;
  color: #94a3b8;
  margin-bottom: 22px;
}

.splash-features {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 26px;
  font-size: 11.5px;
  font-weight: 700;
}

.splash-feat-pill {
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 5px 12px;
  border-radius: 14px;
  color: var(--neon-blue);
}

.splash-btn {
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-green));
  color: #04101e;
  font-size: 15px;
  font-weight: 800;
  padding: 13px 34px;
  border-radius: 26px;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.splash-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 35px rgba(0, 255, 136, 0.6);
}

/* Modals (Victory, Timeout, Play, Pause, Controls) */
.game-modal {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 19, 0.88);
  backdrop-filter: blur(12px);
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.game-modal.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.modal-card {
  background: #0f172a;
  border-radius: 24px;
  padding: 34px 40px;
  text-align: center;
  max-width: 480px;
}

.modal-card.victory {
  border: 2px solid var(--neon-green);
  box-shadow: 0 0 50px rgba(0, 255, 136, 0.35);
}

.modal-card.timeout {
  border: 2px solid var(--neon-red);
  box-shadow: 0 0 50px rgba(255, 42, 95, 0.4);
}

.btn-restart {
  background: linear-gradient(135deg, var(--neon-red), #e11d48);
  color: #fff;
  font-size: 14.5px;
  font-weight: 800;
  padding: 12px 28px;
  border-radius: 24px;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(255, 42, 95, 0.5);
  transition: transform 0.15s ease;
}

.btn-restart:hover {
  transform: scale(1.05);
}

/* ================= BACKGROUND YOUTUBE MUSIC WIDGET ================= */
#music-widget {
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 16px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  transition: all 0.3s ease;
  width: fit-content;
}

#music-widget:hover {
  border-color: var(--neon-blue);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.25);
}

.music-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.music-icon {
  font-size: 16px;
  color: var(--neon-blue);
  display: inline-block;
  transition: transform 0.3s ease;
}

.music-icon.playing {
  animation: noteBounce 1.2s infinite ease-in-out alternate;
  color: var(--neon-green);
}

@keyframes noteBounce {
  0% { transform: scale(1) rotate(-6deg); filter: drop-shadow(0 0 3px var(--neon-green)); }
  100% { transform: scale(1.2) rotate(6deg); filter: drop-shadow(0 0 8px var(--neon-green)); }
}

.music-text-group {
  display: flex;
  flex-direction: column;
}

.music-title {
  font-size: 11.5px;
  font-weight: 800;
  color: #e2e8f0;
  letter-spacing: 0.3px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-sub {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.music-ctrl-btn {
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: #fff;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.music-ctrl-btn:hover {
  background: rgba(0, 240, 255, 0.35);
  transform: scale(1.08);
}

#music-vol-slider {
  width: 60px;
  height: 4px;
  accent-color: var(--neon-blue);
  cursor: pointer;
}

/* ==============================================================
   DEVTOOLS FULLSCREEN INSPECTOR MODAL (30+ OBJECTS)
   ============================================================== */

.fullscreen-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(7, 9, 19, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.devtools-window {
  width: 100%;
  max-width: 1100px;
  height: 86vh;
  max-height: 740px;
  background: rgba(13, 19, 33, 0.96);
  border: 1px solid var(--neon-blue);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.25), inset 0 0 20px rgba(0, 240, 255, 0.05);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.devtools-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(7, 12, 22, 0.98);
  border-bottom: 1px solid rgba(0, 240, 255, 0.25);
}

.devtools-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.devtools-icon {
  font-size: 20px;
  filter: drop-shadow(0 0 6px var(--neon-blue));
}

.devtools-head-text {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #e2e8f0;
}

.devtools-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: var(--neon-blue);
  padding: 2px 10px;
  border-radius: 12px;
}

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

.devtools-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.devtools-btn.minimize:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--neon-blue);
  color: var(--neon-blue);
  transform: translateY(-1px);
}

.devtools-btn.close:hover {
  background: rgba(255, 42, 95, 0.25);
  border-color: var(--neon-red);
  color: #ff6b8b;
  transform: translateY(-1px);
}

.devtools-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(10, 15, 28, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
}

.devtools-path-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', Consolas, monospace;
}

.devtools-path-label {
  color: #64748b;
  font-weight: 700;
}

.devtools-path-text {
  color: var(--neon-green);
  background: rgba(0, 255, 136, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.devtools-tip {
  color: #94a3b8;
  font-size: 12px;
}

.devtools-tip code {
  color: var(--neon-yellow);
  font-weight: bold;
}

.devtools-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}

.devtools-body::-webkit-scrollbar {
  width: 8px;
}
.devtools-body::-webkit-scrollbar-track {
  background: rgba(10, 15, 28, 0.5);
}
.devtools-body::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.3);
  border-radius: 4px;
}
.devtools-body::-webkit-scrollbar-thumb:hover {
  background: var(--neon-blue);
}

.devtools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.devtools-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.devtools-card:hover {
  background: rgba(20, 32, 58, 0.85);
  border-color: rgba(0, 240, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 240, 255, 0.15);
}

.devtools-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.devtools-card-icon {
  font-size: 18px;
}

.devtools-card-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.status-protected {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.status-vulnerable {
  background: rgba(255, 42, 95, 0.2);
  color: #ff4d79;
  border: 1px solid rgba(255, 42, 95, 0.5);
}

.status-disguised {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.devtools-card-name {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.devtools-card-desc {
  font-size: 11px;
  color: #64748b;
}

/* Stage 1 Highlighted Target (Glow & Pulse) */
.devtools-card.target-highlight {
  border: 2px solid var(--neon-green) !important;
  background: rgba(0, 255, 136, 0.12) !important;
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.4), inset 0 0 10px rgba(0, 255, 136, 0.2) !important;
  animation: targetPulseGlow 1.5s infinite ease-in-out;
}

.devtools-card.target-highlight .devtools-card-name {
  color: var(--neon-green) !important;
  font-size: 13px !important;
}

@keyframes targetPulseGlow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3), inset 0 0 5px rgba(0, 255, 136, 0.1);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 28px rgba(0, 255, 136, 0.6), inset 0 0 14px rgba(0, 255, 136, 0.3);
    transform: scale(1.02);
  }
}

.devtools-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(7, 12, 22, 0.98);
  border-top: 1px solid rgba(0, 240, 255, 0.15);
  font-size: 12px;
  color: #94a3b8;
}

.devtools-btn-quickclose {
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid var(--neon-blue);
  color: #fff;
  padding: 6px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.devtools-btn-quickclose:hover {
  background: var(--neon-blue);
  color: #070913;
}

/* Floating Minimized DevTools Pill Button */
#elements-minimized-pill {
  position: fixed;
  bottom: 235px;
  right: 24px;
  z-index: 900;
  background: rgba(13, 19, 33, 0.94);
  border: 1px solid var(--neon-blue);
  box-shadow: 0 4px 20px rgba(0, 240, 255, 0.35);
  backdrop-filter: blur(10px);
  padding: 10px 18px;
  border-radius: 24px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#elements-minimized-pill:hover {
  background: rgba(0, 240, 255, 0.25);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 6px 25px rgba(0, 240, 255, 0.5);
}

.pill-pulse {
  width: 8px;
  height: 8px;
  background: var(--neon-green);
  border-radius: 50%;
  animation: pillDotPulse 1.2s infinite;
}

@keyframes pillDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

/* ==============================================================
   PERMANENT GRAVITY SUPERPOWER BADGE & MATRIX UPDATE GLITCH
   ============================================================== */

.gravity-power-badge {
  background: rgba(0, 240, 255, 0.16);
  border: 1px solid var(--neon-blue);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.35);
  padding: 5px 12px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  animation: gravBadgePulse 2s infinite ease-in-out;
  backdrop-filter: blur(8px);
}

@keyframes gravBadgePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 240, 255, 0.3); border-color: rgba(0, 240, 255, 0.4); }
  50% { box-shadow: 0 0 20px rgba(0, 240, 255, 0.7); border-color: var(--neon-blue); }
}

.speed-power-badge {
  background: rgba(255, 102, 0, 0.18);
  border: 1px solid #ff7700;
  box-shadow: 0 0 14px rgba(255, 102, 0, 0.35);
  padding: 5px 12px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  animation: speedBadgePulse 1.8s infinite ease-in-out;
  backdrop-filter: blur(8px);
}

@keyframes speedBadgePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 102, 0, 0.3); border-color: rgba(255, 102, 0, 0.4); }
  50% { box-shadow: 0 0 22px rgba(255, 102, 0, 0.75); border-color: #ffaa00; }
}

.matrix-update-glitch {
  filter: invert(1) hue-rotate(180deg) saturate(2);
  transition: filter 0.05s ease;
}

/* ==============================================================
   SYSTEM CREATOR IDE MODAL & GHOST TEXT EDITOR (THEME 7)
   ============================================================== */

.system-ide-window {
  width: 100%;
  max-width: 950px;
  height: 80vh;
  max-height: 680px;
  background: rgba(14, 18, 30, 0.97);
  border: 1px solid #ff7700;
  box-shadow: 0 0 35px rgba(255, 119, 0, 0.3), inset 0 0 20px rgba(255, 119, 0, 0.05);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.system-ide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(9, 12, 20, 0.98);
  border-bottom: 1px solid rgba(255, 119, 0, 0.3);
}

.system-ide-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.system-ide-icon {
  font-size: 20px;
  filter: drop-shadow(0 0 6px #ff7700);
}

.system-ide-head-text {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #fff;
}

.system-ide-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 119, 0, 0.15);
  border: 1px solid rgba(255, 119, 0, 0.4);
  color: #ff9933;
  padding: 2px 10px;
  border-radius: 12px;
}

.system-ide-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  background: rgba(8, 11, 18, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.system-tab-active {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 119, 0, 0.12);
  border: 1px solid rgba(255, 119, 0, 0.3);
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #ffaa44;
  font-family: 'JetBrains Mono', Consolas, monospace;
}

.tab-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00ff88;
  box-shadow: 0 0 6px #00ff88;
}

.system-ide-tip {
  font-size: 11.5px;
  color: #94a3b8;
}

.system-ide-body {
  flex: 1;
  display: flex;
  background: #0a0d14;
  overflow: hidden;
  position: relative;
}

.editor-container {
  flex: 1;
  display: flex;
  height: 100%;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 15px;
  line-height: 26px;
}

.line-numbers {
  width: 45px;
  padding: 16px 8px;
  background: rgba(5, 7, 12, 0.6);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  color: #475569;
  text-align: right;
  user-select: none;
}

.editor-content-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.editor-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 16px 20px;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: pre;
  tab-size: 4;
  box-sizing: border-box;
}

.ghost-layer {
  display: none !important;
}

.input-layer {
  background: rgba(10, 14, 23, 0.95);
  color: #38bdf8;
  caret-color: #ffaa00;
  border: none;
  outline: none;
  resize: none;
  z-index: 2;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  padding: 12px 14px;
  width: 100%;
  height: 100%;
}

.system-ide-hud {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 16px;
  background: rgba(9, 12, 20, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', Consolas, monospace;
}

.hud-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 700;
}

.hud-val {
  font-size: 12px;
  color: #38bdf8;
  font-weight: 800;
}

.hud-val.danger {
  color: #ff4466;
}

.system-ide-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(7, 10, 16, 0.98);
}

.system-footer-left {
  font-size: 12px;
  color: #cbd5e1;
}

.system-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-ide-reset {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ide-reset:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-ide-run {
  background: linear-gradient(135deg, #ff7700, #ff2200);
  border: 1px solid #ffaa44;
  color: #fff;
  padding: 8px 22px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(255, 102, 0, 0.4);
  transition: all 0.2s ease;
}

.btn-ide-run:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(255, 102, 0, 0.7);
}

/* Convenient Floating System Creator Pill (Left side, directly below tutorial banner) */
#system-creator-pill {
  position: fixed;
  top: 195px;
  left: 24px;
  z-index: 100;
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid #ff7700;
  box-shadow: 0 0 20px rgba(255, 119, 0, 0.4);
  color: #ffaa44;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
}

#system-creator-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 28px rgba(255, 119, 0, 0.7);
  border-color: #ffaa00;
  color: #fff;
}

.pill-pulse.orange {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff7700;
  box-shadow: 0 0 10px #ff7700;
  animation: pulseOrange 1.5s infinite;
}

@keyframes pulseOrange {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
}

/* Convenient Top Bar System Creator Button */
.system-creator-top-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 119, 0, 0.16);
  border: 1px solid #ff7700;
  color: #ffaa44;
  padding: 5px 14px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 119, 0, 0.3);
  transition: all 0.2s ease;
}

.system-creator-top-btn:hover {
  background: rgba(255, 119, 0, 0.35);
  box-shadow: 0 0 18px rgba(255, 119, 0, 0.65);
  transform: translateY(-1px);
  color: #fff;
}

/* Convenient Tutorial Banner Button */
.btn-banner-action {
  background: linear-gradient(135deg, #ff7700, #ff4400);
  border: 1px solid #ffa347;
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 12px;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 14px rgba(255, 119, 0, 0.45);
  transition: all 0.2s ease;
}

.btn-banner-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(255, 119, 0, 0.8);
  background: linear-gradient(135deg, #ff8811, #ff5500);
}

/* Convenient Terminal Header Button */
.system-term-btn {
  background: rgba(255, 119, 0, 0.2) !important;
  border: 1px solid #ff7700 !important;
  color: #ffaa44 !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  padding: 3px 10px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: all 0.2s ease;
}

.system-term-btn:hover {
  background: rgba(255, 119, 0, 0.4) !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(255, 119, 0, 0.5);
}

/* ==============================================================
   CODE EDUCATION: MAIN MENU, PAUSE, SETTINGS & CHAPTERS MODALS
   ============================================================== */

/* Main Menu Header Elements */
.main-title {
  font-size: 34px !important;
  font-weight: 900 !important;
  letter-spacing: 2px !important;
  text-shadow: 0 0 25px rgba(0, 240, 255, 0.6);
}

.splash-subtitle {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #ffaa00;
  text-shadow: 0 0 12px rgba(255, 170, 0, 0.6);
  margin-top: -4px;
  margin-bottom: 14px;
}

/* Save Preview Badge in Menu */
.menu-save-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 255, 136, 0.12);
  border: 1px solid rgba(0, 255, 136, 0.4);
  color: var(--neon-green);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 18px;
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.2);
}

/* Main Action Buttons Grid / List */
.main-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 11px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(18, 26, 46, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: #e2e8f0;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 13px 24px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-btn:hover {
  background: rgba(30, 41, 69, 0.95);
  border-color: var(--neon-blue);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.4);
}

.menu-btn.primary {
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-green));
  border: none;
  color: #04101e;
  font-size: 16px;
  padding: 15px 28px;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.45);
}

.menu-btn.primary:hover {
  transform: scale(1.03) translateY(-2px);
  box-shadow: 0 0 40px rgba(0, 255, 136, 0.7);
}

.menu-btn.danger {
  background: linear-gradient(135deg, rgba(255, 42, 95, 0.25), rgba(255, 0, 50, 0.45));
  border: 1px solid var(--neon-red);
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 42, 95, 0.35);
}

.menu-btn.danger:hover {
  background: linear-gradient(135deg, rgba(255, 42, 95, 0.5), rgba(255, 0, 50, 0.75));
  box-shadow: 0 0 35px rgba(255, 42, 95, 0.7);
  transform: translateY(-2px);
  border-color: #ff6688;
}

.menu-footer-credits {
  margin-top: 24px;
  font-size: 11px;
  color: #64748b;
  letter-spacing: 0.5px;
}

/* Top HUD Pause Button */
.hud-pause-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: #e2e8f0;
  padding: 5px 12px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
  transition: all 0.2s ease;
}

.hud-pause-btn:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--neon-blue);
  color: #fff;
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.4);
}

/* Play Select Modal (Continue vs New Game) */
.play-card {
  max-width: 520px !important;
  width: 90% !important;
  border: 2px solid var(--neon-blue) !important;
  box-shadow: 0 0 50px rgba(0, 240, 255, 0.35) !important;
}

.modal-header-icon {
  font-size: 44px;
  margin-bottom: 6px;
}

.modal-heading {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 22px;
}

.play-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.play-choice-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(18, 26, 46, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  font-family: inherit;
}

.play-choice-btn:hover {
  background: rgba(30, 44, 76, 0.95);
  border-color: var(--neon-blue);
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.3);
}

.play-choice-btn.primary {
  border-color: rgba(0, 255, 136, 0.5);
  background: rgba(0, 255, 136, 0.08);
}

.play-choice-btn.primary:hover {
  border-color: var(--neon-green);
  box-shadow: 0 0 25px rgba(0, 255, 136, 0.4);
}

.choice-icon {
  font-size: 28px;
}

.choice-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.choice-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.choice-sub {
  font-size: 12px;
  color: #94a3b8;
}

.choice-arrow {
  font-size: 18px;
  color: var(--neon-blue);
  transition: transform 0.2s ease;
}

.play-choice-btn:hover .choice-arrow {
  transform: translateX(4px);
}

.modal-back-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #94a3b8;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-back-btn:hover {
  color: #fff;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

/* In-Game Pause Modal */
.pause-card {
  max-width: 440px !important;
  width: 90% !important;
  border: 2px solid #38bdf8 !important;
  box-shadow: 0 0 60px rgba(56, 189, 248, 0.35) !important;
}

.pause-header {
  margin-bottom: 20px;
}

.pause-icon-big {
  font-size: 40px;
  display: inline-block;
  margin-bottom: 4px;
}

.pause-title {
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1px;
}

.pause-level-info {
  font-size: 13px;
  font-weight: 700;
  color: var(--neon-blue);
  margin-top: 4px;
}

.pause-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pause-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(18, 26, 46, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  padding: 12px 20px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pause-btn:hover {
  background: rgba(30, 44, 76, 0.95);
  border-color: var(--neon-blue);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.pause-btn.primary {
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-green));
  border: none;
  color: #04101e;
  font-size: 15px;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.4);
}

.pause-btn.primary:hover {
  transform: scale(1.02) translateY(-2px);
  box-shadow: 0 0 35px rgba(0, 255, 136, 0.6);
}

.pause-btn.danger {
  border-color: rgba(255, 42, 95, 0.35);
  color: #fca5a5;
}

.pause-btn.danger:hover {
  background: rgba(255, 42, 95, 0.2);
  border-color: var(--neon-red);
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 42, 95, 0.4);
}

/* Settings Window (Modal) */
.settings-window {
  width: 92%;
  max-width: 680px;
  max-height: 88vh;
  background: #0d1322;
  border: 2px solid var(--neon-blue);
  border-radius: 20px;
  box-shadow: 0 0 60px rgba(0, 240, 255, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.25s ease;
}

.settings-header {
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(0, 240, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #fff;
}

.settings-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.settings-section {
  background: rgba(18, 26, 46, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--neon-blue);
  border-bottom: 1px solid rgba(0, 240, 255, 0.15);
  padding-bottom: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.row-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.row-label span:first-child {
  font-size: 13.5px;
  font-weight: 700;
  color: #e2e8f0;
}

.row-desc {
  font-size: 11.5px;
  color: #64748b;
}

.row-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row-control input[type="range"] {
  width: 140px;
  accent-color: var(--neon-green);
  cursor: pointer;
}

.range-val {
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--neon-green);
  min-width: 42px;
  text-align: right;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}

.toggle-track:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-track {
  background-color: var(--neon-green);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.4);
}

.toggle-switch input:checked + .toggle-track:before {
  transform: translateX(22px);
  background-color: #04101e;
}

.settings-select {
  background: #0f172a;
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
}

.settings-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.ctrl-chip {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.ctrl-chip .k {
  background: rgba(0, 240, 255, 0.15);
  color: var(--neon-blue);
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 800;
  font-family: monospace;
}

.settings-footer {
  padding: 14px 24px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
}

.settings-btn-save {
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-green));
  color: #04101e;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  padding: 10px 24px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.35);
}

.settings-btn-save:hover {
  transform: scale(1.03);
  box-shadow: 0 0 28px rgba(0, 255, 136, 0.6);
}

/* Chapters Selector Window */
.chapters-window {
  width: 94%;
  max-width: 860px;
  max-height: 90vh;
  background: #0d1322;
  border: 2px solid #ff7700;
  border-radius: 20px;
  box-shadow: 0 0 60px rgba(255, 119, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.25s ease;
}

.chapters-header {
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(255, 119, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chapters-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 900;
  color: #ffaa44;
}

.chapters-subbar {
  padding: 10px 24px;
  background: rgba(255, 119, 0, 0.08);
  font-size: 12px;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(255, 119, 0, 0.15);
}

.chapters-grid {
  padding: 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.chapter-card {
  background: rgba(18, 26, 46, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.chapter-card:hover {
  transform: translateY(-3px);
  border-color: #ffaa44;
  box-shadow: 0 0 25px rgba(255, 119, 0, 0.35);
  background: rgba(28, 38, 64, 0.95);
}

.chapter-card.unlocked-current {
  border-color: var(--neon-green);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.25);
}

.chapter-card-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 119, 0, 0.2);
  color: #ffaa44;
  border: 1px solid rgba(255, 119, 0, 0.4);
}

.chapter-card-title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.chapter-card-desc {
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.4;
}

.chapter-card-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-green);
  margin-top: 4px;
}

.chapters-footer {
  padding: 12px 24px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
}

/* Controls Cheatsheet Modal */
.controls-card {
  max-width: 580px !important;
  width: 92% !important;
  border: 2px solid var(--neon-blue) !important;
}

.controls-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
  text-align: left;
}

.ctrl-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(18, 26, 46, 0.7);
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ctrl-key {
  font-family: monospace;
  font-weight: 800;
  font-size: 12px;
  color: var(--neon-blue);
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  min-width: 110px;
  text-align: center;
}

.ctrl-desc {
  font-size: 12.5px;
  color: #cbd5e1;
}

/* Floating Save Toast */
.save-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--neon-green);
  box-shadow: 0 0 25px rgba(0, 255, 136, 0.45);
  color: #fff;
  padding: 12px 22px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.save-toast.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-icon {
  font-size: 20px;
}



