:root {
  color-scheme: dark;
  --bg: #05070d;
  --panel: #0d1424;
  --panel2: #111b30;
  --text: #eef7ff;
  --muted: #9fb1c8;
  --cyan: #46e7ff;
  --teal: #00e5c8;
  --purple: #8b5cf6;
  --danger: #ff4d7d;
  --safe: #77ffb0;
  --border: rgba(255,255,255,.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(0, 229, 200, .18), transparent 32rem),
    radial-gradient(circle at 85% 35%, rgba(139, 92, 246, .22), transparent 28rem),
    var(--bg);
  color: var(--text);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 72px;
}

.hero {
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(9, 18, 32, .94), rgba(24, 13, 50, .92));
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  letter-spacing: .22em;
  text-transform: uppercase;
  font-size: .78rem;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(2.3rem, 7vw, 5.4rem);
  line-height: .92;
}

h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.lede {
  max-width: 780px;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.6;
}

.cta-row, .button-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button, button {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 16px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary, button:hover {
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: #051018;
  border: none;
}

.demo-grid {
  display: grid;
  grid-template-columns: 1.35fr .85fr;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(13, 20, 36, .9);
  box-shadow: 0 18px 60px rgba(0,0,0,.25);
  padding: 22px;
}

.world {
  position: relative;
  min-height: 430px;
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px),
    radial-gradient(circle at 20% 20%, rgba(70,231,255,.14), transparent 18rem),
    radial-gradient(circle at 76% 68%, rgba(119,255,176,.10), transparent 16rem),
    #07101d;
  background-size: 32px 32px, 32px 32px, auto, auto, auto;
}

.zone {
  position: absolute;
  min-width: 115px;
  min-height: 82px;
  transform: translate(-50%, -50%);
}

.zone::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 18px;
  border: 2px solid rgba(70,231,255,var(--pulse, .12));
  box-shadow: 0 0 calc(40px * var(--pulse, .1)) rgba(70,231,255,var(--pulse, .1));
  pointer-events: none;
}

.npc {
  position: absolute;
  left: 50%;
  top: 78%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: #06101a;
  font-weight: 900;
  transition: left .6s ease, top .6s ease, box-shadow .3s ease;
}

.npc.alert {
  box-shadow: 0 0 40px rgba(255, 77, 125, .8);
}

.hint {
  color: var(--muted);
  margin: 14px 0 0;
}

.controls-panel .button-stack {
  flex-direction: column;
  margin-bottom: 28px;
}

.meter {
  margin: 14px 0;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 6px;
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}

.fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--teal), var(--purple));
  transition: width .15s linear;
}

.log-panel {
  margin-top: 18px;
}

pre {
  min-height: 170px;
  max-height: 260px;
  overflow: auto;
  padding: 16px;
  border-radius: 16px;
  background: rgba(0,0,0,.36);
  color: #ccf7ff;
  white-space: pre-wrap;
}

@media (max-width: 820px) {
  .demo-grid { grid-template-columns: 1fr; }
  .world { min-height: 360px; }
  .hero { padding: 24px; }
}
