
:root {
  --bg1: #f8f5ff;
  --bg2: #f6ecdf;
  --text: #17171d;
  --muted: #5d5a68;
  --line: rgba(30, 30, 40, .12);
  --panel: rgba(255,255,255,.78);
  --panel2: rgba(255,255,255,.93);
  --accent: #7c5cff;
  --accent2: #ff7aa8;
  --good: #2f8a54;
  --bad: #d85e74;
  --shadow: 0 16px 40px rgba(20, 16, 30, .16);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124,92,255,.18), transparent 35%),
    radial-gradient(circle at top right, rgba(255,122,168,.13), transparent 30%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  transition: background 420ms ease, color 420ms ease;
}
body[data-stage="1"] {
  background:
    radial-gradient(circle at top left, rgba(255,122,168,.12), transparent 30%),
    linear-gradient(180deg, #f3ebea, #e5dbde);
}
body[data-stage="2"] {
  background:
    radial-gradient(circle at top left, rgba(124,92,255,.20), transparent 28%),
    linear-gradient(180deg, #201826, #0e0b11);
  color: #f3ecf7;
}
body[data-stage="3"] {
  background:
    radial-gradient(circle at top right, rgba(255,85,119,.13), transparent 28%),
    linear-gradient(180deg, #09070b, #1b1022);
  color: #f6effa;
}
.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .12;
  background-image:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 4px 4px;
  mix-blend-mode: soft-light;
}
.layout {
  height: 100dvh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 280px;
  gap: 16px;
  padding: 16px;
}
.panel {
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
body[data-stage="2"] .panel,
body[data-stage="3"] .panel {
  background: rgba(15, 12, 20, .78);
  border-color: rgba(255,255,255,.08);
}
.side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
}
.panel-title {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--muted);
}
.mini {
  font-size: .9rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.list, .notes {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow: auto;
}
.list li {
  margin-bottom: 10px;
  padding: 12px 13px;
  border-radius: 16px;
  background: rgba(255,255,255,.52);
  border: 1px solid rgba(0,0,0,.05);
}
body[data-stage="2"] .list li,
body[data-stage="3"] .list li,
body[data-stage="2"] .note,
body[data-stage="3"] .note {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.07);
}
.center {
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  min-width: 0;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 4.6rem);
  line-height: .92;
}
h1 span {
  color: var(--accent);
  text-shadow: 0 0 20px rgba(124,92,255,.35);
}
.subtitle {
  max-width: 62ch;
  margin: 10px 0 0;
  color: var(--muted);
}
.objective {
  margin-top: 12px;
  display: inline-flex;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(124,92,255,.12);
  border: 1px solid rgba(124,92,255,.16);
  color: inherit;
  font-size: .94rem;
}
.status {
  display: grid;
  gap: 10px;
  min-width: 255px;
}
.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--panel2);
  border: 1px solid var(--line);
}
.stat span {
  color: var(--muted);
  font-size: .86rem;
}
.time-badge {
  position: relative;
  overflow: hidden;
  animation: drift 3.2s ease-in-out infinite;
}
.time-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
  transform: translateX(-100%);
  animation: scan 3.8s linear infinite;
}
@keyframes drift {
  0%,100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}
@keyframes scan {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
body[data-stage="2"] .stat, body[data-stage="3"] .stat {
  background: rgba(255,255,255,.05);
}
.scene {
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto auto auto;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}
.scene-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: .92rem;
  letter-spacing: .03em;
}
.art-wrap {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  aspect-ratio: 16 / 7.4;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.05);
}
.art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 420ms ease, transform 420ms ease;
}
.art-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 70% 25%, rgba(124,92,255,.15), transparent 24%),
    radial-gradient(circle at 20% 15%, rgba(255,122,168,.10), transparent 24%);
  pointer-events: none;
}
body[data-stage="2"] .art-wrap img { filter: contrast(1.04) saturate(.92) brightness(.78); }
body[data-stage="3"] .art-wrap img { filter: contrast(1.1) saturate(.78) brightness(.6) blur(.3px); transform: scale(1.02); }
.scene-help {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(124,92,255,.08);
  border: 1px solid rgba(124,92,255,.14);
  color: inherit;
  font-size: .92rem;
}
.scene-help strong {
  color: var(--accent);
}
.log {
  min-height: 0;
  overflow: auto;
  padding: 14px 14px 10px;
  border-radius: 22px;
  background: rgba(255,255,255,.45);
  border: 1px solid rgba(0,0,0,.06);
}
body[data-stage="2"] .log, body[data-stage="3"] .log {
  background: rgba(0,0,0,.22);
}
.line {
  margin: 0 0 12px;
  line-height: 1.52;
  white-space: pre-wrap;
}
.line.sys { color: var(--muted); }
.line.player { color: var(--accent); }
.line.good { color: var(--good); }
.line.bad { color: var(--bad); }
.line.glitch {
  color: #f3d9ff;
  text-shadow: 0 0 8px rgba(255,90,120,.25);
  animation: flicker 1.4s steps(2) infinite;
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: .7; }
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.choice-btn, .command-bar button, input, button {
  font: inherit;
}
.choice-btn, .command-bar button {
  border: 0;
  padding: 12px 14px;
  border-radius: 999px;
  cursor: pointer;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 20px rgba(124,92,255,.22);
  transition: transform 150ms ease, filter 150ms ease;
}
.choice-btn:hover, .command-bar button:hover { transform: translateY(-2px); filter: brightness(1.05); }
.choice-btn.alt {
  background: rgba(255,255,255,.78);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--line);
}
.choice-btn.bad {
  background: linear-gradient(135deg, #8b1d37, #ff5b77);
}
body[data-stage="2"] .choice-btn.alt, body[data-stage="3"] .choice-btn.alt {
  background: rgba(255,255,255,.08);
  color: #f7f0fb;
  border-color: rgba(255,255,255,.08);
}
.command-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}
.command-bar label {
  color: var(--muted);
  font-size: .9rem;
}
.command-bar input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  outline: none;
}
body[data-stage="2"] .command-bar input, body[data-stage="3"] .command-bar input {
  background: rgba(255,255,255,.06);
  color: #f8f3fa;
  border-color: rgba(255,255,255,.11);
}
.hint {
  margin: 0;
  font-size: .88rem;
  color: var(--muted);
}
.notes {
  display: grid;
  gap: 10px;
}
.note {
  padding: 12px 13px;
  border-radius: 16px;
  border-left: 4px solid var(--accent);
  background: rgba(255,255,255,.5);
  border-top: 1px solid rgba(0,0,0,.05);
  border-right: 1px solid rgba(0,0,0,.05);
  border-bottom: 1px solid rgba(0,0,0,.05);
}
.tutorial-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.74);
  z-index: 20;
}
.tutorial-card {
  width: min(720px, 100%);
  padding: 22px;
}
.tutorial-card h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
}
.howto-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.howto-step {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(0,0,0,.06);
  display: grid;
  gap: 8px;
}
.howto-step b {
  font-size: 1rem;
}
.howto-step span {
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.45;
}
.tutorial-buttons {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.tutorial-examples {
  margin: 14px 0 0;
  color: var(--muted);
}
.jump-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 18;
}
.jump-overlay.show { opacity: 1; pointer-events: auto; }
.jump-box {
  text-align: center;
  padding: 30px 24px;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 22px;
  box-shadow: 0 0 60px rgba(255,0,65,.25);
  max-width: 520px;
}
.jump-small {
  color: #d7d4e0;
  font-size: .95rem;
  letter-spacing: .16em;
}
.jump-big {
  margin: 12px 0;
  color: white;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 900;
  line-height: .95;
  text-shadow: 0 0 18px rgba(255,65,65,.6);
}
.shake { animation: shake .42s linear 1; }
@keyframes shake {
  0% { transform: translate(0,0) rotate(0); }
  20% { transform: translate(-5px, 2px) rotate(-.4deg); }
  40% { transform: translate(4px, -3px) rotate(.3deg); }
  60% { transform: translate(-3px, 2px) rotate(-.2deg); }
  80% { transform: translate(3px, 1px) rotate(.15deg); }
  100% { transform: translate(0,0) rotate(0); }
}
@media (max-width: 1100px) {
  body { overflow: auto; }
  .layout {
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 1fr;
  }
  .panel { min-height: auto; }
  .side { order: 2; }
  .center { order: 1; }
  .howto-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .layout { padding: 10px; gap: 10px; }
  .center, .side { padding: 14px; }
  .top, .command-bar { grid-template-columns: 1fr; display: grid; }
  .status { min-width: 0; }
  .command-bar label { display: none; }
}
