:root {
  --bg-main: #060c18;
  --bg-card: #0b1528;
  --panel-border: #1a2942;
  --neon-blue: #00e5ff;
  --neon-red: #ff2a5f;
  --neon-green: #00ff88;
  --neon-yellow: #ffd700;
  --text-main: #f0f6fc;
  --text-dim: #8b9bb4;
  --font-main: 'Manrope', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  background-image: 
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(255, 42, 95, 0.15), transparent 70%),
    radial-gradient(ellipse 50% 50% at 80% 90%, rgba(0, 229, 255, 0.08), transparent 60%);
}

.app-layout {
  display: grid;
  grid-template-columns: 780px 340px;
  gap: 20px;
  max-width: 1140px;
  width: 100%;
}

@media (max-width: 1120px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
}

/* GAME CANVAS CONTAINER */
.game-container {
  background: var(--bg-card);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  position: relative;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 12px;
}

.game-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--neon-red);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-stats {
  display: flex;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  align-items: center;
}

.hud-stats b {
  color: var(--neon-blue);
}

.hud-lives {
  display: flex;
  gap: 4px;
  font-size: 14px;
  align-items: center;
}

.heart {
  filter: drop-shadow(0 0 4px var(--neon-red));
  transition: transform 0.2s, opacity 0.2s;
}

.heart.is-empty {
  filter: grayscale(1);
  opacity: 0.3;
}

.tag-ground {
  color: var(--neon-green) !important;
}

.tag-air {
  color: var(--neon-yellow) !important;
}

.tag-hazard {
  color: var(--neon-red) !important;
}

.canvas-wrapper {
  position: relative;
  width: 760px;
  height: 440px;
  margin: 0 auto;
}

@media (max-width: 800px) {
  .canvas-wrapper {
    width: 100%;
    height: auto;
  }
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #040813;
  border-radius: 8px;
  border: 1px solid #162238;
}

/* OVERLAYS (GAME OVER & VICTORY) */
.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 19, 0.88);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.game-overlay[hidden] {
  display: none;
}

.overlay-icon {
  font-size: 48px;
}

.overlay-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.gameover .overlay-title {
  color: var(--neon-red);
  text-shadow: 0 0 20px rgba(255, 42, 95, 0.6);
}

.victory .overlay-title {
  color: var(--neon-green);
  text-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
}

.overlay-desc {
  font-size: 14px;
  color: var(--text-dim);
  max-width: 440px;
  line-height: 1.5;
}

.overlay-stats {
  display: flex;
  gap: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
}

.btn-overlay {
  background: linear-gradient(135deg, #00e5ff, #0077ff);
  color: #040813;
  border: none;
  padding: 12px 28px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 229, 255, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-overlay:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.6);
}

.btn-overlay-red {
  background: linear-gradient(135deg, #ff2a5f, #ff6b3d);
  box-shadow: 0 4px 15px rgba(255, 42, 95, 0.4);
}

.btn-overlay-red:hover {
  box-shadow: 0 6px 20px rgba(255, 42, 95, 0.6);
}

.controls-hint {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* SIDEBAR */
.sidebar {
  background: var(--bg-card);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lang-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #070e1b;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
}

.btn-lang {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-lang:hover {
  color: var(--text-main);
}

.btn-lang.is-active {
  background: var(--neon-red);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255, 42, 95, 0.35);
}

.sidebar h2 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-sub {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

.difficulty-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.btn-diff {
  background: #0a1324;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.btn-diff:hover {
  border-color: #2e4368;
  color: var(--text-main);
}

.btn-diff.is-active {
  border-color: var(--neon-blue);
  background: rgba(0, 229, 255, 0.12);
  color: var(--neon-blue);
}

.btn-diff.diff-hard.is-active {
  border-color: var(--neon-red);
  background: rgba(255, 42, 95, 0.15);
  color: var(--neon-red);
}

.param-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.param-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.param-label b {
  color: var(--neon-blue);
}

input[type=range] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: #0e1a30;
  border-radius: 4px;
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neon-blue);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

.ai-box {
  background: rgba(255, 42, 95, 0.06);
  border: 1px dashed rgba(255, 42, 95, 0.35);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-title {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--neon-red);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-box code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #e2e8f0;
  line-height: 1.45;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-radius: 4px;
  display: block;
}

/* FULLSCREEN STYLES */
.btn-fullscreen {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(0, 229, 255, 0.1);
  color: var(--neon-blue);
  border: 1px solid rgba(0, 229, 255, 0.4);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-fullscreen:hover {
  background: var(--neon-blue);
  color: #060c18;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.btn-fullscreen.is-active {
  background: rgba(255, 42, 95, 0.15);
  color: var(--neon-red);
  border-color: rgba(255, 42, 95, 0.5);
}

.btn-fullscreen.is-active:hover {
  background: var(--neon-red);
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 42, 95, 0.6);
}

.game-container:fullscreen,
.game-container:-webkit-full-screen,
.game-container.is-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  padding: 14px 24px !important;
  box-sizing: border-box !important;
  background: #060c18 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 10px !important;
  overflow: hidden !important;
  z-index: 99999 !important;
}

.game-container:fullscreen .game-header,
.game-container:-webkit-full-screen .game-header,
.game-container.is-fullscreen .game-header {
  width: 100%;
  max-width: 1100px;
}

.game-container:fullscreen .canvas-wrapper,
.game-container:-webkit-full-screen .canvas-wrapper,
.game-container.is-fullscreen .canvas-wrapper {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  height: auto;
  max-height: calc(100vh - 130px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-container:fullscreen #gameCanvas,
.game-container:-webkit-full-screen #gameCanvas,
.game-container.is-fullscreen #gameCanvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  aspect-ratio: 760 / 440;
  object-fit: contain;
}

.game-container:fullscreen .controls-hint,
.game-container:-webkit-full-screen .controls-hint,
.game-container.is-fullscreen .controls-hint {
  width: 100%;
  max-width: 1100px;
}
