:root {
  --bg: #000;
  --win: #0a0a12;
  --fg: #aaa;
  --blue: #0000aa;
  --t0: #aaa; --t1: #55ff55; --t2: #55ffff; --t3: #8c8cff; --t4: #ff55ff; --t5: #ffff55;
  --row: 2rem;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 "Courier New", ui-monospace, Menlo, Consolas, monospace;
  -webkit-font-smoothing: none;
  image-rendering: pixelated;
}
[hidden] { display: none !important; }
.desktop {
  min-height: 100vh; padding: 16px;
  /* CRT scanlines: hard-edged, no blur, on the wallpaper only so they never dim the text */
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(0,0,170,.18) 31px 32px),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(0,0,170,.18) 31px 32px),
    #00001a;
}
.win {
  max-width: 680px; margin: 3vh auto 0;
  background: var(--win); border: 2px solid #aaa;
  box-shadow: 4px 4px 0 #000, inset 0 0 0 2px #555;
}
.title { display: flex; justify-content: space-between; align-items: center; background: var(--blue); color: #fff; padding: 2px 8px; border-bottom: 2px solid #aaa; }
.title h1 { margin: 0; font-size: 1rem; font-weight: bold; letter-spacing: .05em; }
.btns { display: flex; gap: 4px; }
.btns i { width: 12px; height: 12px; border: 2px solid #fff; }
.btns i:nth-child(1) { background: #ffff55; } .btns i:nth-child(2) { background: #55ff55; } .btns i:nth-child(3) { background: #ff5555; }
.body { display: grid; grid-template-columns: 1fr 8.5rem; gap: 16px; padding: 16px; }
.hud { margin: 0 0 12px; color: #55ffff; }
.prompt { margin: 0 0 14px; font-size: 1.4rem; line-height: 1.25; color: #ffff55; font-weight: bold; }
#f { display: flex; gap: 8px; align-items: center; }
.ps { color: #55ff55; font-weight: bold; }
input { flex: 1; min-width: 0; font: inherit; color: #55ffff; background: #000; border: 2px solid #55ffff; padding: 6px 8px; border-radius: 0; caret-color: #ffff55; }
button { font: inherit; color: #000; background: #aaa; border: 2px solid #fff; border-right-color: #555; border-bottom-color: #555; padding: 6px 12px; border-radius: 0; cursor: pointer; }
button:hover { background: #fff; }
button:active { border-color: #555 #fff #fff #555; }
#skip { background: #555; color: #fff; }
:focus-visible { outline: 3px solid #ffff55; outline-offset: 2px; }
.timer { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.bar { position: relative; flex: 1; height: 16px; background: #222; border: 2px solid #555; }
.bar i { display: block; height: 100%; width: 100%; background: #55ff55; }
.bar.mid i { background: #ffff55; } .bar.low i { background: #ff5555; }
/* second ticks: 25 hard gaps painted over the fill */
.bar::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(4% - 2px), #000 calc(4% - 2px) 4%); }
#secs { min-width: 2.5ch; text-align: right; color: #ffff55; }
.card { margin-top: 14px; border: 2px solid #aaa; padding: 10px 12px; background: #000; }
.card p { margin: 0 0 8px; }
#cblurb { color: #fff; }
.cname { font-size: 1.15rem; font-weight: bold; }
.cname[data-t="0"] { color: var(--t0); } .cname[data-t="1"] { color: var(--t1); } .cname[data-t="2"] { color: var(--t2); }
.cname[data-t="3"] { color: var(--t3); } .cname[data-t="4"] { color: var(--t4); } .cname[data-t="5"] { color: var(--t5); }
.cname[data-t="miss"] { color: #ff5555; }
.log { margin-top: 14px; min-height: 5.5em; font-size: .9rem; color: #aaa; }
.log p { margin: 0; overflow-wrap: anywhere; }
.log .bad { color: #ff5555; } .log .ok { color: #55ff55; }
.shake { animation: shake .25s steps(4); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ring meter */
.rings { position: relative; list-style: none; margin: 0; padding: 0; align-self: start; border: 2px solid #555; background: #000; }
.rings li { height: var(--row); line-height: calc(var(--row) - 2px); padding: 0 8px; border-bottom: 1px dashed #333; }
.rings li:last-of-type { border-bottom: 0; }
.rings li[data-t="0"] { color: var(--t0); } .rings li[data-t="1"] { color: var(--t1); } .rings li[data-t="2"] { color: var(--t2); }
.rings li[data-t="3"] { color: var(--t3); } .rings li[data-t="4"] { color: var(--t4); } .rings li[data-t="5"] { color: var(--t5); }

/* end screen */
h2 { margin: 0 0 10px; color: #ff55ff; font-size: 1.1rem; }
.sum { margin: 0 0 12px; padding: 0; list-style: none; }
.sum li { display: grid; grid-template-columns: 1.6ch 1fr; gap: 10px; padding: 3px 0; border-bottom: 1px dashed #333; }
.sum b { font-weight: normal; } .sum small { display: block; color: #aaa; }
.share { margin: 0 0 12px; padding: 10px; background: #000; border: 2px solid #55ff55; color: #55ff55; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }

/* kernel panic: the panel appears once, lines type in at 4/s, cursor blinks at 1 Hz. Nothing flashes more than 3 times a second. */
.panic { position: fixed; inset: 0; z-index: 20; background: var(--blue); color: #fff; display: grid; place-items: center; padding: 16px; }
.panic pre { margin: 0; font: inherit; font-size: 1.2rem; white-space: pre-wrap; }
.panic span { animation: show 1ms steps(1) calc(var(--i) * 250ms) both; }
.cur { animation: blink 1s steps(1) infinite; }
@keyframes show { from { visibility: hidden; } to { visibility: visible; } }
@keyframes blink { 50% { visibility: hidden; } }
.ns { padding: 16px; }

@media (max-width: 560px) {
  .body { grid-template-columns: 1fr; }
  .rings { display: grid; grid-template-columns: repeat(3, 1fr); }
  .rings li { padding: 0 2px; font-size: .85rem; text-align: center; white-space: nowrap; border-bottom: 0; border-right: 1px dashed #333; height: var(--row); }
  .rings li:nth-child(-n+3) { border-bottom: 1px dashed #333; }
  #f { flex-wrap: wrap; } input { flex-basis: 100%; } .ps { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.rings li[data-on] { background: #1c1c1c; font-weight: bold; outline: 2px solid #fff; outline-offset: -2px; }
