


.game-body {
  overflow-x: hidden;
  min-height: 100vh;
}

.snake-shell {
  background: #0a0d18;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.55);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 26px;
  background: #0f1322;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: var(--transition-smooth);
}
.back-link:hover {
  color: var(--primary-accent);
}

.hud-game-title {
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 2px;
  font-weight: bold;
}

.sound-toggle-btn {
  background: #171d30;
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  color: #b7aed1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}
.sound-toggle-btn:hover {
  background: #232b47;
  color: var(--primary-accent);
  border-color: rgba(217, 188, 122, 0.4);
}


.game-viewport {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  height: clamp(480px, calc(100vh - 260px), 760px);
  width: 100%;
  margin: 0 auto;
  gap: 16px;
  padding: 0 16px;
  box-sizing: border-box;
}

.mobile-settings-toggle {
  display: none;
}

.game-arena-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  position: relative;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
}


.control-panel-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.skin-selector, .mode-selector, .speed-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skin-btn, .mode-btn, .speed-btn {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-sans);
  text-align: left;
  transition: var(--transition-smooth);
}

.skin-btn:hover, .mode-btn:hover, .speed-btn:hover {
  background: var(--panel-hover-bg);
  border-color: rgba(var(--primary-accent-rgb), 0.3);
}

.skin-btn.active, .mode-btn.active, .speed-btn.active {
  background: var(--primary-accent);
  color: black;
  border-color: var(--primary-accent);
  font-weight: 700;
}

.skin-emoji {
  margin-right: 8px;
}

.mode-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.mode-desc {
  display: block;
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}
.mode-btn.active .mode-desc {
  opacity: 0.9;
}

.speed-selector {
  flex-direction: row;
}
.speed-btn {
  flex-grow: 1;
  text-align: center;
  padding: 10px;
}


.game-stats-hud {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hud-stat-box {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.hud-stat-num {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: bold;
  color: var(--secondary-accent);
}

.mode-spec-indicator {
  border-color: rgba(var(--primary-accent-rgb), 0.3);
}
.warning-flash {
  color: var(--danger-color);
  animation: timer-flash 1s infinite alternate;
}
@keyframes timer-flash {
  0% { opacity: 0.6; }
  100% { opacity: 1; text-shadow: 0 0 8px var(--danger-color); }
}

.keyboard-legend {
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--panel-border);
  border-radius: 12px;
  padding: 16px;
  margin-top: auto;
}
.legend-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.legend-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}
.legend-list kbd {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  box-shadow: 0 2px 0 var(--panel-border);
  font-size: 11px;
}


.hidden {
  display: none !important;
}



.arcade-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.arcade-cabinet {
  background: hsl(230, 20%, 10%);
  border: 4px solid #1a1a2e;
  border-radius: 16px;
  width: 100%;
  max-width: min(560px, calc((100vh - 230px) * 0.95), 100%);
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: 
    0 20px 40px rgba(0,0,0,0.8),
    0 0 30px rgba(var(--primary-accent-rgb), 0.1);
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 8px;
  gap: 8px;
}

.arcade-marquee {
  flex-shrink: 0;
  background: linear-gradient(180deg, #111 0%, #000 100%);
  padding: 6px 12px;
  text-align: center;
  border: 2px solid var(--secondary-accent);
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.neon-text {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 4px;
  text-shadow: 
    0 0 4px #fff,
    0 0 10px var(--secondary-accent),
    0 0 20px var(--secondary-accent);
}

.arcade-screen-container {
  position: relative;
  background: #000;
  border: 2px solid #1a1a2f;
  border-radius: 8px;
  padding: 8px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.arcade-screen-container::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 1px solid rgba(var(--secondary-accent-rgb, 0, 240, 255), 0.3);
  border-radius: 6px;
  pointer-events: none;
  margin: 6px;
}

#arcade-canvas {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  background-color: hsl(230, 25%, 3%);
  border-radius: 4px;
  display: block;
  object-fit: contain;
  margin: 0 auto;
}


.arcade-wrapper .screen-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 5, 15, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 4px;
}

.terminal-wrapper .screen-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(2, 10, 2, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 4px;
}

.arcade-overlay-panel {
  background: rgba(0, 0, 0, 0.85);
  border: 2px solid var(--primary-accent);
  border-radius: 12px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 0 20px rgba(var(--primary-accent-rgb), 0.3);
}

.arcade-title {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 800;
  color: var(--primary-accent);
  letter-spacing: 2px;
  text-shadow: 0 0 8px var(--primary-accent);
}
.death-neon {
  color: var(--danger-color);
  text-shadow: 0 0 8px var(--danger-color);
}

.arcade-start-btn {
  background: var(--primary-accent);
  color: #000;
  border: none;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 14px;
  padding: 12px 30px;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: var(--transition-bounce);
  box-shadow: 0 4px 0 hsl(38, 80%, 25%);
}

.arcade-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 hsl(38, 80%, 25%);
}
.arcade-start-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 hsl(38, 80%, 25%);
}

.arcade-score-text {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text-primary);
}


.arcade-joystick-panel {
  flex-shrink: 0;
  background: linear-gradient(0deg, #181c24 0%, #2a303e 100%);
  border: 2px solid #2e2e4a;
  border-radius: 10px;
  height: 74px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 20px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
  box-sizing: border-box;
}

.joystick-assembly {
  position: relative;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.joystick-base {
  width: 44px;
  height: 44px;
  background-color: #000;
  border: 3px solid #333;
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.8);
}

.joystick-shaft {
  width: 8px;
  height: 26px;
  background: linear-gradient(90deg, #999 0%, #ccc 50%, #666 100%);
  border-radius: 4px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -85%);
  transform-origin: bottom center;
  transition: transform 0.1s ease;
  z-index: 2;
}

.joystick-knob {
  width: 22px;
  height: 22px;
  background: radial-gradient(circle at 7px 7px, #ff3344, #aa0011);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -150%);
  z-index: 3;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
  transition: transform 0.1s ease;
}

.arcade-buttons {
  display: flex;
  gap: 16px;
  align-items: center;
}

.arc-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid #222;
  cursor: pointer;
  position: relative;
  box-shadow: 0 3px 0 #111, 0 3px 6px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
  outline: none;
}

.arc-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #111, 0 1px 2px rgba(0,0,0,0.3);
}

.btn-cap {
  font-size: 8px;
  font-weight: 800;
  color: white;
  position: absolute;
  bottom: -18px;
  letter-spacing: 0.5px;
  font-family: var(--font-sans);
  pointer-events: none;
}

.btn-red {
  background: radial-gradient(circle at 15px 15px, hsl(355, 90%, 55%), hsl(355, 90%, 35%));
}
.btn-blue {
  background: radial-gradient(circle at 15px 15px, hsl(205, 90%, 55%), hsl(205, 90%, 35%));
}



.terminal-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.terminal-monitor {
  background-color: hsl(25, 6%, 15%);
  border: 8px solid hsl(25, 6%, 22%);
  border-radius: 20px;
  padding: 8px;
  box-shadow: 
    0 20px 40px rgba(0,0,0,0.8),
    inset 0 4px 6px rgba(255,255,255,0.05);
  width: 100%;
  max-width: min(560px, calc((100vh - 230px) * 0.95), 100%);
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.crt-bezel {
  background-color: hsl(25, 4%, 28%);
  border: 8px solid hsl(25, 6%, 10%);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 
    inset 0 10px 15px rgba(0,0,0,0.8),
    0 2px 4px rgba(255,255,255,0.06);
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.crt-screen {
  background-color: #0b110b;
  border-radius: 8px;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 1);
}


.crt-scanlines {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px;
  z-index: 8;
  pointer-events: none;
}

.crt-flicker {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(18, 16, 16, 0.05);
  opacity: 0.15;
  z-index: 9;
  pointer-events: none;
  animation: crt-glow-flicker 0.15s infinite;
}

@keyframes crt-glow-flicker {
  0% { opacity: 0.15; }
  50% { opacity: 0.18; }
  100% { opacity: 0.14; }
}

.terminal-hud {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #33ff33;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  text-shadow: 0 0 4px rgba(51, 255, 51, 0.5);
  z-index: 5;
  flex-shrink: 0;
}

#terminal-canvas {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  background-color: transparent;
  flex: 1 1 auto;
  min-height: 0;
  display: block;
  object-fit: contain;
  margin: 0 auto;
}

.terminal-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 40px;
  text-align: left;
}

.terminal-prompt {
  font-family: var(--font-mono);
  font-size: 16px;
  color: #33ff33;
  text-shadow: 0 0 4px rgba(51,255,51,0.5);
}

.terminal-cursor {
  width: 10px;
  height: 18px;
  background-color: #33ff33;
  box-shadow: 0 0 4px rgba(51,255,51,0.5);
  animation: blink-nokia 0.8s infinite steps(2);
}

.terminal-btn {
  background: transparent;
  border: 1px solid #33ff33;
  color: #33ff33;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
  margin-top: 15px;
  text-shadow: 0 0 3px rgba(51,255,51,0.5);
  box-shadow: inset 0 0 4px rgba(51,255,51,0.2), 0 0 4px rgba(51,255,51,0.2);
  transition: all 0.2s ease;
}
.terminal-btn:hover {
  background-color: rgba(51, 255, 51, 0.15);
  box-shadow: inset 0 0 8px rgba(51,255,51,0.4), 0 0 8px rgba(51,255,51,0.4);
}
.terminal-btn:active {
  background-color: rgba(51, 255, 51, 0.3);
}



.mobile-dpad-overlay {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: static;
  margin: 12px auto 0;
  z-index: 20;
}


#skin-wrapper-nokia.active ~ .mobile-dpad-overlay,
.nokia-wrapper.active ~ .mobile-dpad-overlay {
  display: none !important;
}


@media (max-width: 1024px) {
  #skin-wrapper-arcade.active ~ .mobile-dpad-overlay,
  #skin-wrapper-terminal.active ~ .mobile-dpad-overlay,
  .arcade-wrapper.active ~ .mobile-dpad-overlay,
  .terminal-wrapper.active ~ .mobile-dpad-overlay {
    display: none !important;
  }
}


.dpad-row {
  display: flex;
  gap: 36px;
}

.dpad-btn {
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  color: var(--text-primary);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: transform 0.08s ease, background 0.08s ease;
}

.dpad-btn:active,
.dpad-btn.touch-active {
  background: var(--primary-accent);
  color: black;
  transform: scale(0.92);
}

.dpad-pause {
  font-size: 16px;
}




@media (min-width: 1441px) {
  .game-viewport {
    grid-template-columns: 320px 1fr 320px;
    max-width: 1840px;
    gap: 24px;
  }
  .arcade-cabinet, .terminal-monitor {
    max-width: min(640px, calc((100vh - 200px) * 0.95), 100%);
  }
  .hud-stat-num {
    font-size: 32px;
  }
  .hud-stat-label {
    font-size: 11px;
  }
}


@media (min-width: 1025px) and (max-width: 1440px) {
  .game-viewport {
    grid-template-columns: 280px 1fr 280px;
    max-width: 1400px;
    gap: 16px;
  }
  .arcade-cabinet, .terminal-monitor {
    max-width: min(560px, calc((100vh - 230px) * 0.95), 100%);
  }
}


@media (min-width: 769px) and (max-width: 1024px) {
  .game-viewport {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 12px 20px;
  }
  .settings-sidebar {
    display: none;
  }
  .mobile-settings-toggle {
    display: flex;
  }
  .gameplay-sidebar {
    order: -1;
    width: 100%;
    max-width: 600px;
    border: none;
    padding: 0;
    margin-bottom: 12px;
  }
  .game-stats-hud {
    flex-direction: row;
    width: 100%;
  }
  .hud-stat-box {
    flex: 1;
    text-align: center;
  }
  .arcade-cabinet, .terminal-monitor {
    width: 100%;
    max-width: min(520px, calc((100vh - 200px) * 0.95));
  }
}


@media (max-width: 768px) {
  .mobile-settings-toggle {
    display: flex;
  }
  .game-body {
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .game-viewport {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: auto;
    min-height: calc(100dvh - 56px);
    position: relative;
    padding: 6px 12px;
    gap: 8px;
    width: 100%;
  }
  .settings-sidebar {
    display: none;
  }
  .settings-sidebar.mobile-open {
    display: flex !important;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 20, 32, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 99;
    padding: 24px;
    overflow-y: auto;
  }
  .gameplay-sidebar {
    border: none;
    padding: 0;
    background: transparent;
    width: 100%;
    max-width: 440px;
    order: -1;
  }
  .game-stats-hud {
    flex-direction: row;
    gap: 8px;
    width: 100%;
  }
  .hud-stat-box {
    padding: 6px 10px;
    flex: 1;
    text-align: center;
    border-radius: 8px;
  }
  .hud-stat-num {
    font-size: 20px;
  }
  .keyboard-legend {
    display: none;
  }
  .arcade-cabinet, .terminal-monitor {
    width: min(420px, 94vw);
    max-width: 100%;
    border-radius: 16px;
    height: auto;
    max-height: none;
  }
  .arcade-marquee {
    padding: 6px 0;
  }
  .neon-text {
    font-size: 16px;
  }
  .arcade-screen-container {
    padding: 6px;
  }
  #arcade-canvas, #terminal-canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
  .arcade-joystick-panel {
    display: none !important;
  }
}

