:root {
  color-scheme: dark;
  --bg: #050806;
  --panel: #090e0b;
  --line: #284334;
  --text: #d7e4d9;
  --muted: #7f9988;
  --green: #73f59a;
  --cyan: #72dddf;
  --gold: #f1ce72;
  --red: #ff7777;
  --shadow: rgba(37, 255, 123, .09);
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -20%, #183124 0, transparent 45%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px),
    var(--bg);
}
input, button { font: inherit; }
.shell { width: min(980px, 100%); max-width: 100vw; height: 100vh; height: 100dvh; min-height: 0; margin: auto; padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 14px; overflow: hidden; }
.masthead { display: flex; justify-content: space-between; align-items: end; border-bottom: 1px solid var(--line); padding-bottom: 13px; }
.display-controls { display: flex; gap: 8px; }
.display-toggle { min-width: 112px; padding: 7px 10px; border: 1px solid var(--line); color: var(--green); background: rgba(9,14,11,.86); cursor: pointer; text-transform: uppercase; font-size: .68rem; letter-spacing: .06em; }
.display-toggle:hover, .display-toggle:focus-visible { border-color: var(--green); background: #102018; outline: none; box-shadow: 0 0 14px var(--shadow); }
.eyebrow { color: var(--muted); margin: 0 0 5px; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
h1 { color: var(--green); margin: 0; font-size: clamp(1.45rem, 5vw, 2.2rem); letter-spacing: .22em; text-shadow: 0 0 18px var(--shadow); }
.status { display: grid; grid-template-columns: 1.2fr repeat(3,.65fr) 1.4fr; border: 1px solid var(--line); background: rgba(9,14,11,.86); }
.status div { padding: 8px 12px; border-right: 1px solid var(--line); min-width: 0; }
.status div:last-child { border: 0; }
.status span { display: block; color: var(--muted); text-transform: uppercase; font-size: .62rem; letter-spacing: .1em; }
.status strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--green); margin-top: 3px; }
.terminal { width: 100%; min-width: 0; min-height: 0; overflow: hidden; display: grid; grid-template-rows: minmax(0, 1fr) auto; border: 1px solid var(--line); background: rgba(6,10,8,.93); box-shadow: 0 18px 60px #000, inset 0 0 60px rgba(24,75,42,.06); }
.output { min-width: 0; overflow-y: auto; overflow-x: hidden; padding: clamp(15px, 3vw, 28px); line-height: 1.48; scrollbar-color: var(--line) transparent; }
.entry { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry.title { color: var(--cyan); font-weight: 700; }
.entry.success { color: var(--green); }
.entry.warning { color: var(--gold); }
.entry.danger { color: var(--red); font-weight: 700; }
.entry.muted { color: var(--muted); }
.entry.command { color: #aac6b2; margin-top: 15px; }
.entry.art { width: max-content; max-width: 100%; margin: 14px auto; color: var(--gold); white-space: pre; overflow-x: auto; overflow-wrap: normal; word-break: normal; font-size: clamp(.64rem, 1.8vw, .9rem); line-height: 1.15; }
.pixel-art { display: grid; justify-items: center; gap: 6px; margin: 14px auto 18px; }
.pixel-art img { display: block; width: min(280px, 72vw); max-height: min(310px, 42vh); object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 10px 18px #000) drop-shadow(0 0 14px rgba(114,221,223,.14)); }
.pixel-art figcaption { color: var(--gold); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.help-row { display: grid; grid-template-columns: minmax(145px, .7fr) minmax(0, 1.6fr); gap: 14px; margin-bottom: 5px; }
.help-command { color: var(--green); }
.help-description { color: var(--text); }
.command-row { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.command-row label { color: var(--green); font-weight: 700; }
.command-row input { width: 100%; min-width: 0; color: var(--text); background: transparent; border: 0; outline: 0; }
footer { display: flex; justify-content: space-between; color: var(--muted); font-size: .7rem; }
@keyframes player-impact { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 45% { transform: translateX(6px); } 70% { transform: translateX(-3px); } }
@keyframes enemy-impact { 0%,100% { transform: translateX(0); filter: none; } 35% { transform: translateX(5px); filter: brightness(1.55); } 65% { transform: translateX(-3px); } }
@keyframes health-impact { 0%,100% { color: var(--green); background: transparent; } 40% { color: #fff; background: rgba(255,70,70,.3); } }
.shell.impact-player .terminal { animation: player-impact 240ms steps(2, end); box-shadow: 0 18px 60px #000, inset 0 0 70px rgba(255,50,50,.2); }
.shell.impact-player #health-status { animation: health-impact 360ms ease-out; }
.output.impact-enemy { animation: enemy-impact 180ms steps(2, end); }
@media (max-width: 700px) {
  .shell { padding: 10px; }
  .masthead { align-items: flex-start; flex-direction: column; gap: 10px; }
  .display-controls { width: 100%; }
  .display-toggle { flex: 1; min-width: 0; }
  .status { grid-template-columns: repeat(4,1fr); }
  .status div { padding: 7px; }
  .status div:first-child { grid-column: span 2; }
  .status div:last-child { grid-column: span 2; border-top: 1px solid var(--line); }
  .terminal { grid-template-rows: minmax(0, 1fr) auto; }
  .output { font-size: .84rem; }
  .help-row { grid-template-columns: 1fr; gap: 0; margin-bottom: 9px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; } }
