:root {
  --bg-1: #040912;
  --bg-2: #0f1b30;
  --accent: #38f9a5;
  --accent-2: #ff9a4d;
  --text: #e6f1ff;
  --muted: #9bb0c9;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 15px 40px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(56, 249, 165, 0.08), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(255, 154, 77, 0.06), transparent 30%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  overflow: hidden;
}

.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 18px 18px;
  display: grid;
  gap: 16px;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent-2);
  margin: 0 0 6px;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
}

.lede {
  margin: 6px 0 0;
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0a0f18;
  box-shadow: 0 12px 30px rgba(56, 249, 165, 0.35);
}

.btn.ghost {
  backdrop-filter: blur(10px);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.canvas-wrap {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: radial-gradient(circle at 50% 50%, rgba(56, 249, 165, 0.08), rgba(15, 27, 48, 0.92));
}

canvas {
  display: block;
  width: 100%;
  height: 620px;
  background: transparent;
}

.scoreboard {
  position: absolute;
  top: 12px;
  left: 12px;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 8px;
  background: rgba(0, 0, 0, 0.45);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

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

.label {
  font-size: 12px;
  color: var(--muted);
}

.value {
  font-family: "Press Start 2P", monospace;
  font-size: 18px;
  color: var(--accent);
}

.hint {
  position: absolute;
  bottom: 12px;
  right: 14px;
  background: rgba(0, 0, 0, 0.45);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.reveal {
  position: absolute;
  inset: 0;
  pointer-events: none;
  --split: 99.5%;
}

.reveal__panel {
  position: absolute;
  top: 0;
  left: var(--split);
  right: 0;
  height: 100%;
  overflow: hidden;
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 30px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  transition: left 0.08s ease;
}

.reveal__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(15, 27, 48, 0.95), rgba(4, 9, 18, 0.9));
}

.reveal__code {
  position: absolute;
  inset: 0;
  padding: 16px 18px;
  overflow: auto;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  color: var(--accent);
  background: linear-gradient(180deg, rgba(56, 249, 165, 0.08), rgba(4, 9, 18, 0.95));
  line-height: 1.6;
}

.reveal__code pre {
  margin: 0;
  white-space: pre;
}

.reveal__divider {
  position: absolute;
  inset: 0;
  width: 3px;
  left: 0;
  background: linear-gradient(180deg, rgba(56, 249, 165, 0.8), rgba(255, 154, 77, 0.8));
  box-shadow: -6px 0 14px rgba(0, 0, 0, 0.45);
}

.reveal__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  right: calc(100% - var(--split));
  width: 28px;
  pointer-events: auto;
  cursor: ew-resize;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
}

.reveal__label {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.reveal__grab {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0d1727;
  border: 2px solid var(--accent);
  box-shadow: 0 0 18px rgba(56, 249, 165, 0.6);
}

.reveal__grab::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -12px;
  bottom: -12px;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(56, 249, 165, 0.8), rgba(255, 154, 77, 0.8));
  opacity: 0.85;
}

.reveal__handle input[type="range"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: auto;
  cursor: ew-resize;
}

.foot {
  display: flex;
  justify-content: center;
  padding: 12px 0 28px;
}

@media (max-width: 720px) {
  .hud {
    flex-direction: column;
    align-items: flex-start;
  }

  canvas {
    height: 480px;
  }
}
