:root {
  --bg: #0c0e12;
  --panel: #14181e;
  --line: #2a313c;
  --ink: #e7ecf2;
  --muted: #8b95a3;
  --faint: #5d6774;
  --red: #f07167;
  --green: #3fb950;
  --amber: #e3b341;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}
body.fade { transition: opacity 120s linear; opacity: 0.15; }
.top, .tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: #10141a;
  border-bottom: 1px solid var(--line);
}
.top { height: 44px; }
.tabs { height: 46px; gap: 0; padding: 0; }
.mark { font-weight: 650; }
.sep { width: 1px; height: 16px; background: var(--line); }
.spacer { flex: 1; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.pill {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--muted);
}
.tab {
  height: 46px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  line-height: 1.15;
}
.tab small { display: block; font-size: 10px; color: var(--faint); font-weight: 400; }
.tab:not(.lock) { color: var(--amber); }
.tab:not(.lock) small { color: #8a7340; }
.tab.on { background: #161b22; }
.tab.lock,
.tab.lock.on { color: var(--faint); }
.tab.lock small { color: var(--faint); }
.lockmark { display: inline-block; width: 10px; height: 12px; margin-right: 6px; vertical-align: -1px; }
.lockmark svg, .pad svg { display: block; width: 100%; height: 100%; }
.stage { height: calc(100% - 90px); min-height: 520px; }
.gate, .work { height: 100%; }
.gate {
  display: grid;
  place-items: center;
  color: var(--muted);
}
.lockbox { text-align: center; }
.lockbox b { display: block; color: var(--muted); letter-spacing: 0.08em; font-size: 12px; margin-bottom: 8px; }
.pad { width: 18px; height: 21px; margin: 0 auto 10px; color: var(--faint); }
.work { display: flex; flex-direction: column; }
.bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
input, button.go, button.rewind {
  font: 13px var(--sans);
  border-radius: 4px;
}
input {
  flex: 1;
  background: #0e1318;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 8px 10px;
  font-family: var(--mono);
}
button.go, button.rewind {
  border: 0;
  padding: 8px 14px;
  cursor: pointer;
}
button.go { background: #1f6feb; color: white; }
button.go:disabled, button.rewind:disabled { opacity: 0.4; cursor: default; }
button.rewind {
  background: #1a7f37;
  color: white;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { filter: brightness(1.35); } }
.locked-code {
  margin: 12px 14px 0;
  border: 1px dashed #3a3428;
  color: #8a7340;
  padding: 10px 12px;
  font-size: 12px;
}
.tape {
  margin: 12px 14px;
  flex: 1;
  background: #0e1318;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  overflow: auto;
  white-space: pre-wrap;
}
.tape .fact { color: var(--ink); }
.tape .code {
  color: #c5ced8;
  margin: 6px 0 6px 14px;
  padding-left: 10px;
  border-left: 2px solid var(--line);
  white-space: pre;
}
.tape .beat { color: var(--muted); }
.tape .verdict { color: var(--ink); margin-top: 8px; }
.tape .bad { color: var(--red); }
.tape .ok { color: var(--green); }
.tape .live { color: var(--amber); margin-top: 8px; }
.tape .live i {
  display: inline-block;
  width: 7px;
  height: 12px;
  margin-left: 6px;
  background: var(--amber);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.scoreline { color: var(--amber); }
.grid {
  display: grid;
  grid-template-columns: 1.35fr 0.78fr;
  grid-template-rows: minmax(280px, 1fr) 160px;
  height: calc(100% - 52px);
}
.pane { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 0; overflow: auto; }
.pane:nth-child(2) { border-right: 0; }
.ph {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 12px; border-bottom: 1px solid #222831; font-size: 12.5px; }
th { color: var(--faint); font-size: 11px; }
tr.hit td { background: #2a1618; }
.r { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--red); }
.pos { color: var(--green); }
.kv td:first-child { color: var(--muted); width: 140px; }
.score {
  margin: 12px;
  border: 1px solid #5c2b28;
  background: #1c1213;
  border-radius: 6px;
  padding: 12px 14px;
}
.score .k { font-size: 11px; letter-spacing: 0.08em; color: var(--red); }
.score .n { margin-top: 4px; font-size: 28px; font-weight: 650; color: var(--green); }
.score .s { margin-top: 4px; color: var(--muted); font-size: 12px; }
.shelf { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.hitcard {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
}
.hitcard .toprow { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.hitcard .name { font-weight: 650; letter-spacing: 0.04em; }
.hitcard .when, .hitcard .klass, .hitcard .note { color: var(--muted); }
.hitcard .when { font-family: var(--mono); font-size: 12px; }
.hitcard .klass { margin-top: 4px; }
.hitcard .fig { margin-top: 10px; font-size: 22px; font-weight: 650; color: var(--green); font-variant-numeric: tabular-nums; }
.hitcard .note { margin-top: 4px; font-size: 12px; }
.hitcard .seq {
  margin-top: 12px;
  display: inline-block;
  background: #1a7f37;
  color: white;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  animation: pulse 1.2s ease-in-out infinite;
}
.hitcard.played { opacity: 0.45; cursor: default; }
.hitcard.played .seq { background: transparent; color: var(--faint); animation: none; padding: 0; }
.hitcard:disabled { cursor: default; }
button.quiet {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  padding: 4px 8px;
  font: inherit;
  cursor: pointer;
}
.logtape {
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 12px;
  color: #c5ced8;
  background: #0e1318;
  white-space: pre-wrap;
}
.veil {
  position: fixed;
  top: 90px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(6, 8, 12, 0.42);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 28px;
  z-index: 2;
}
body.seq .stage { filter: blur(7px); }
.bootbox {
  min-height: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  letter-spacing: 0.04em;
}
.spin {
  width: 34px;
  height: 34px;
  border: 2px solid #2a313c;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.logrun {
  min-height: 460px;
  max-height: calc(100vh - 140px);
  overflow: auto;
  background: #0e1318;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  padding: 16px 18px;
  color: #9aa6b4;
}
.logrun .ln.on { color: var(--amber); }
.logrun .ln.on::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 12px;
  margin-left: 6px;
  background: var(--amber);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}
.sheet {
  width: min(1100px, 100%);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  box-shadow: 0 20px 80px rgba(0,0,0,0.45);
}
.keyrow { display: flex; gap: 8px; }
.keyrow input { max-width: 280px; flex: none; }
.hidden { display: none; }
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #1c1213;
  border: 1px solid #5c2b28;
  color: var(--ink);
  padding: 12px 14px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
