﻿:root {
  --bg-1: #0b0f16;
  --bg-2: #121826;
  --bg-3: #1a2436;
  --card: rgba(255, 255, 255, 0.05);
  --card-strong: rgba(255, 255, 255, 0.08);
  --accent: #f97316;
  --accent-2: #38bdf8;
  --accent-3: #facc15;
  --text: #f8fafc;
  --muted: #b6c2d9;
  --stroke: rgba(255, 255, 255, 0.12);
  --shadow: 0 30px 60px rgba(5, 8, 16, 0.6);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", "Sora", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 400px at 15% -10%, rgba(56, 189, 248, 0.18), transparent 55%),
    radial-gradient(900px 420px at 110% 10%, rgba(249, 115, 22, 0.18), transparent 55%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px;
  position: relative;
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(249, 115, 22, 0.18), transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(56, 189, 248, 0.18), transparent 45%),
    radial-gradient(circle at 60% 80%, rgba(250, 204, 21, 0.16), transparent 45%);
  opacity: 0.7;
  filter: blur(0);
  z-index: 0;
  pointer-events: none;
  animation: ambientDrift 18s ease-in-out infinite;
}

.scene {
  width: min(1120px, 92vw);
  display: grid;
  gap: 24px;
  position: relative;
  z-index: 1;
  animation: riseIn 0.7s ease-out both;
}

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

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

.hero h1 {
  font-size: clamp(32px, 5vw, 44px);
  margin: 0 0 8px;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 520px;
}

.back {
  align-self: flex-start;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: transform 0.2s ease, border-color 0.2s ease;
  background: rgba(15, 23, 42, 0.6);
}

.back:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 0.9fr);
  gap: 24px;
}

.board {
  position: relative;
  background: var(--card);
  border-radius: 24px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  padding: 18px;
  overflow: hidden;
}

.board::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: 0.35;
  pointer-events: none;
}

canvas {
  width: 100%;
  height: 520px;
  display: block;
  border-radius: 18px;
  background: rgba(10, 15, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 1;
  cursor: crosshair;
  touch-action: none;
}

.hud {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  z-index: 2;
}

.hud__item {
  background: var(--card-strong);
  border-radius: 14px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  color: var(--muted);
  display: grid;
  gap: 4px;
}

.hud__item strong {
  font-size: 18px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

#resetBtn {
  border: none;
  border-radius: 14px;
  padding: 10px 18px;
  font-family: "Sora", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: linear-gradient(130deg, var(--accent), var(--accent-3));
  color: #1b1b1b;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 16px 28px rgba(249, 115, 22, 0.35);
}

#resetBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 30px rgba(249, 115, 22, 0.45);
}

.panel {
  display: grid;
  gap: 16px;
}

.panel__card {
  background: var(--card);
  border-radius: 18px;
  border: 1px solid var(--stroke);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel__card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.panel__card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.panel__card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ambientDrift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(30px, -20px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@media (max-width: 960px) {
  body {
    padding: 20px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .stage {
    grid-template-columns: 1fr;
  }

  canvas {
    height: 420px;
  }

  .hud {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene,
  .ambient {
    animation: none;
  }

  * {
    scroll-behavior: auto !important;
  }
}
