:root {
  --ink: #2a2118;
  --paper: #fffdf8;
  --line: #d9d0c0;
  --red: #b42318;
  --gold: #e2b657;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #efe6d4; color: var(--ink); }
body { font-family: "Iowan Old Style", Georgia, Palatino, serif; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.sheet {
  max-width: 720px;
  margin: 12px auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 10px 0 rgba(42, 33, 24, 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.top, .modes, .field, .actions { display: flex; gap: 8px; align-items: center; }
.top { justify-content: space-between; }
.mark { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: 0.02em; }
.sub, .legal, .stats, .qlabel, .msg, .summary { margin: 0; }
.sub, .stats, .qlabel { font-family: system-ui, sans-serif; font-size: 12px; color: #6d6256; }
.stamp {
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid var(--red); color: var(--red);
  display: grid; place-items: center;
  font-weight: 700; font-size: 22px;
  transform: rotate(8deg);
}
.legal { font-family: system-ui, sans-serif; font-size: 12px; line-height: 1.4; background: #fff6ea; border-left: 3px solid var(--gold); padding: 6px 8px; }
.modes { justify-content: flex-end; }
.modes button, .actions button, .field button, .again {
  font-family: system-ui, sans-serif;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
}
.modes button[aria-pressed="true"], .go { background: var(--ink); color: #fffdf8; border-color: var(--ink); }
.score { margin: 0; font-size: 28px; line-height: 1; }
.pips { display: flex; gap: 6px; }
.pip { width: 16px; height: 16px; border-radius: 4px; background: #f0e7d8; border: 1px solid var(--line); }
.pip.now { background: var(--gold); }
.pip.high { background: #2f7d4a; }
.pip.mid { background: #d9892b; }
.pip.miss { background: #c9c1b4; }
.prompt { margin: 0; font-size: clamp(24px, 4vw, 34px); line-height: 1.15; }
.timer { display: flex; align-items: center; gap: 8px; }
.clock { font-family: system-ui, sans-serif; font-weight: 700; min-width: 3ch; }
.track { flex: 1; height: 8px; border-radius: 999px; background: #f0e7d8; overflow: hidden; }
.barfill { display: block; height: 100%; width: 100%; background: var(--red); }
.field input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  font-family: system-ui, sans-serif;
}
label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ask { position: relative; }
.msg { min-height: 1.3em; font-family: system-ui, sans-serif; font-size: 14px; }
.msg.bad { color: var(--red); }
.log { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-family: system-ui, sans-serif; font-size: 13px; }
.log li { background: #fff6ea; border-radius: 8px; padding: 4px 8px; }
.result { display: flex; flex-direction: column; gap: 8px; background: #fff6ea; border-radius: 14px; padding: 12px; }
.result[hidden] { display: none; }
.band { margin: 0; font-size: 32px; line-height: 1.05; }
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 8px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  resize: vertical;
}
.shake { animation: shake .35s linear; }
@keyframes shake {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
@media (prefers-reduced-motion: reduce) {
  .shake { animation: none; }
}
