:root {
  --bg: #14102b;
  --box-top: #2a3fa8;
  --box-bot: #141e5c;
  --edge: #f4f4ff;
  --ink: #f4f4ff;
  --gold: #f6c544;
  --good: #4ade80;
  --bad: #ff5a6e;
  --dim: #a8b2e8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); min-height: 100%; }
body {
  font-family: 'VT323', monospace;
  font-size: 22px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 880px; margin: 0 auto; padding: 8px 12px 24px; }
#stage { position: relative; width: 100%; aspect-ratio: 16 / 9; border: 4px solid var(--edge); border-radius: 6px; overflow: hidden; background: #000; box-shadow: 0 0 0 4px #000; }
#screen { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
#hud { position: absolute; inset: 6px 10px auto 10px; display: flex; justify-content: space-between; pointer-events: none; font-family: 'Press Start 2P', monospace; font-size: clamp(10px, 2.2vw, 16px); text-shadow: 2px 2px 0 #000; }
#hearts { color: var(--bad); letter-spacing: 2px; }
#score { color: var(--gold); }
#mute { position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; font-size: 18px; background: rgba(0,0,0,.5); color: #fff; border: 2px solid #fff; border-radius: 4px; cursor: pointer; }
#mute.off { opacity: .45; text-decoration: line-through; }

.box {
  margin-top: 12px;
  background: linear-gradient(180deg, var(--box-top), var(--box-bot));
  border: 4px solid var(--edge);
  border-radius: 8px;
  box-shadow: 0 0 0 4px #000, inset 0 0 0 2px #000;
  padding: 16px;
}
.hidden { display: none !important; }
h1, h2, .label, button, #qmeta, #overStats { font-family: 'Press Start 2P', monospace; }
h1 { font-size: clamp(30px, 8vw, 56px); text-align: center; color: var(--gold); line-height: 1.2; text-shadow: 4px 4px 0 #000; }
h2 { font-size: clamp(16px, 4vw, 24px); text-align: center; color: var(--gold); text-shadow: 3px 3px 0 #000; margin-bottom: 12px; }
.sub { text-align: center; font-size: 26px; margin: 8px 0 14px; }
.label { font-size: 11px; color: var(--dim); text-align: center; margin: 10px 0 8px; }
.keys { text-align: center; color: var(--dim); margin-top: 10px; font-size: 20px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

button { cursor: pointer; color: #fff; background: #000; border: 3px solid #fff; border-radius: 4px; padding: 10px 12px; font-size: 11px; }
button:hover, button:focus-visible { background: #2b2b2b; outline: none; }
button.big { display: block; width: 100%; max-width: 320px; margin: 14px auto 0; padding: 14px; font-size: 16px; background: #c0392b; border-color: var(--gold); color: var(--gold); }
button.big:hover { background: #e04a3a; }
button.small { font-size: 10px; }
#weeks { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#weeks button { font-size: 10px; padding: 9px 10px; }
#weeks button.on { background: var(--gold); color: #000; border-color: #fff; }

#qmeta { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--dim); }
#foe { color: var(--bad); text-align: right; }
#timer { height: 8px; border: 2px solid #fff; margin: 8px 0 10px; background: #000; }
#timerfill { height: 100%; width: 100%; background: var(--good); }
#prompt { font-size: clamp(24px, 4.4vw, 32px); line-height: 1.1; min-height: 2.2em; margin-bottom: 10px; }
#prompt .word { font-family: 'Press Start 2P', monospace; font-size: clamp(16px, 4vw, 26px); color: var(--gold); display: block; text-align: center; padding: 8px 0; }
#prompt .blank { color: var(--gold); }
#choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { #choices { grid-template-columns: 1fr; } }
.choice { text-align: left; font-family: 'VT323', monospace; font-size: 24px; line-height: 1; padding: 10px 12px; display: flex; gap: 10px; align-items: center; min-height: 54px; }
.choice .k { font-family: 'Press Start 2P', monospace; font-size: 11px; color: var(--gold); flex: none; }
.choice.right { background: #136b34; border-color: var(--good); }
.choice.wrong { background: #7a1626; border-color: var(--bad); }
.choice:disabled { cursor: default; }
#feedback { margin-top: 12px; font-size: 24px; line-height: 1.1; border-top: 2px dashed var(--dim); padding-top: 10px; }
#feedback b { color: var(--gold); }
#feedback .ex { color: var(--dim); display: block; margin-top: 6px; }
#feedback button { margin-top: 10px; display: block; margin-left: auto; }

#studyList { display: grid; gap: 10px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.card { background: rgba(0,0,0,.35); border: 2px solid var(--dim); border-radius: 4px; padding: 10px; }
.card .w { font-family: 'Press Start 2P', monospace; font-size: 13px; color: var(--gold); }
.card .p { color: var(--dim); font-size: 20px; }
.card .d { margin: 4px 0; }
.card .e { color: var(--dim); font-size: 20px; }
.wk { font-family: 'Press Start 2P', monospace; font-size: 11px; color: var(--bad); margin-top: 8px; }

#scoreList { list-style: none; font-family: 'Press Start 2P', monospace; font-size: 12px; line-height: 2; max-width: 380px; margin: 0 auto; }
#scoreList li { display: flex; justify-content: space-between; }
#scoreList li span:last-child { color: var(--gold); }
#overStats { text-align: center; font-size: 12px; line-height: 2; }
#nameEntry { text-align: center; }
#initials { font-family: 'Press Start 2P', monospace; font-size: 22px; width: 5.5em; text-align: center; text-transform: uppercase; background: #000; color: var(--gold); border: 3px solid #fff; padding: 8px; margin-right: 6px; }
#missedBox { margin-top: 12px; font-size: 22px; }
#missedBox b { color: var(--gold); }
#over .small { display: block; margin: 10px auto 0; }

/* Monster speech bubble (word in a battle sentence) */
#bubble { position: absolute; right: 3%; top: 13%; max-width: 58%; background: #fff; color: #14102b; border: 3px solid #000; border-radius: 6px; padding: 6px 10px; font-size: clamp(15px, 3vw, 24px); line-height: 1.05; box-shadow: 3px 3px 0 #000; animation: pop .18s steps(3); }
#bubble::after { content: ''; position: absolute; bottom: -12px; right: 22%; border: 6px solid transparent; border-top: 8px solid #000; }
#bubble b { color: #c0392b; text-transform: uppercase; }
#bubble .who { display: block; font-family: 'Press Start 2P', monospace; font-size: clamp(7px, 1.4vw, 10px); color: #6c4ab6; margin-bottom: 3px; }
@keyframes pop { from { transform: scale(.6); } to { transform: scale(1); } }
