:root {
  color-scheme: dark;
  --bg: #000;
  --panel: rgba(4, 5, 9, 0.9);
  --panel-solid: #05070d;
  --line: rgba(255, 255, 255, 0.18);
  --text: #fffdf6;
  --muted: #c2c8d8;
  --hot: #ff4d7d;
  --amber: #ffc857;
  --mint: #58f6b0;
  --cyan: #48d7ff;
  --violet: #9b6dff;
  --danger: #ff6a3d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 340px;
  gap: 18px;
  width: min(1380px, 100vw);
  height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.game-stage {
  position: relative;
  min-height: 0;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 0 0 1px rgba(88, 246, 176, 0.06);
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

.overlay-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.9);
  box-shadow: 0 0 42px rgba(88, 246, 176, 0.14), 0 24px 90px rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(18px);
  padding: 30px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.6rem, 7vw, 5.8rem);
  line-height: 0.9;
}

h2 {
  font-size: clamp(1.65rem, 3.8vw, 2.4rem);
}

.menu-copy {
  max-width: 42ch;
  margin: 18px auto 0;
  color: var(--muted);
  line-height: 1.55;
}

.menu-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn {
  min-width: 128px;
  min-height: 44px;
  border-radius: 8px;
  padding: 0 18px;
  color: var(--text);
  font-weight: 800;
}

.primary-btn {
  background: linear-gradient(135deg, #ff2f6d, #ffd35d);
  box-shadow: 0 0 28px rgba(255, 77, 125, 0.22);
}

.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
}

.control-help {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.9rem;
}

.command-deck {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
}

.metric {
  min-height: 92px;
  padding: 15px;
}

.metric span,
.panel-header span,
.compact-help span,
.toggle-row,
.range-row {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  line-height: 1;
}

.panel {
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel h2 {
  font-size: 1rem;
}

.effect-list {
  display: grid;
  gap: 8px;
  min-height: 108px;
}

.effect-pill {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.045);
  padding: 10px;
  color: var(--text);
}

.effect-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.toggle-row,
.range-row,
.select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  gap: 16px;
}

input[type="checkbox"] {
  accent-color: var(--hot);
  width: 20px;
  height: 20px;
}

input[type="range"] {
  width: 132px;
  accent-color: var(--amber);
}

select {
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 8px 10px;
}

.compact-help {
  display: grid;
  gap: 8px;
  line-height: 1.35;
}

body.high-contrast {
  --bg: #000;
  --panel: rgba(0, 0, 0, 0.86);
  --line: rgba(255, 255, 255, 0.35);
  --muted: #d9def1;
}

@media (max-width: 980px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .game-stage {
    aspect-ratio: 1;
    min-height: auto;
  }

  .command-deck {
    padding-bottom: 18px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
    gap: 10px;
  }

  .overlay-panel {
    padding: 22px 16px;
  }

  .control-help {
    grid-template-columns: 1fr;
  }

  .status-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .metric {
    min-height: 74px;
    padding: 9px;
  }

  .metric strong {
    font-size: 1.35rem;
  }
}
