:root { --bg: #0b0e13; --panel: #131820; --panel-2: #1a2029; --line: #262e3a; --text: #e6e9ee; --muted: #8b95a5; --accent: #5bc0eb; color-scheme: dark; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand h1 { font-size: 16px; margin: 0; }
.subtitle { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.slider { display: flex; gap: 6px; align-items: center; }
.slider input { width: 90px; accent-color: var(--accent); }
.btn { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.btn-accent { background: var(--accent); color: #041018; border-color: var(--accent); font-weight: 600; }
.cases { display: flex; gap: 8px; padding: 8px 16px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.case-btn { flex: none; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.case-btn img { width: 120px; height: 90px; object-fit: cover; border-radius: 4px; display: block; }
.case-btn[aria-pressed="true"] { border-color: var(--accent); }
.layout { flex: 1; display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 12px; padding: 12px 16px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; overflow: auto; font-size: 13px; min-height: 0; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; background: var(--bg); padding: 3px; border-radius: 8px; border: 1px solid var(--line); }
.tabs button { flex: 1; background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 6px; padding: 6px 4px; font: inherit; font-size: 13px; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--panel-2); border-color: var(--line); color: var(--accent); }
.hint { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 2px 0 8px; }
.fine { color: var(--muted); font-size: 11px; line-height: 1.45; }
.status { font-style: italic; margin-top: 12px; }
.toggle { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; cursor: pointer; }
.toggle input { accent-color: var(--accent); margin: 0; }
.lm { display: flex; gap: 8px; align-items: center; width: 100%; background: none; border: 0; border-radius: 6px; color: var(--text); font: inherit; text-align: left; padding: 4px; cursor: pointer; }
.lm:hover, .lm.selected { background: var(--panel-2); }
.lm .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lm.tentative .dot { background: none !important; border: 2px dashed var(--muted); width: 8px; height: 8px; }
.lm small { display: block; color: var(--muted); font-style: italic; font-size: 11px; }
.card { margin-top: 10px; padding: 10px; border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 0 8px 8px 0; }
.card-name { font-weight: 700; font-size: 15px; }
.card-latin { color: var(--muted); font-style: italic; font-size: 12px; }
.card p { margin: 6px 0 0; line-height: 1.5; }
#quiz-progress { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.q-main { font-size: 16px; font-weight: 600; }
.q-sub { color: var(--muted); font-size: 12px; margin: 4px 0 10px; }
#quiz-feedback { margin: 8px 0; line-height: 1.45; }
#quiz-feedback.ok { color: #8fe0a8; }
#quiz-feedback.bad { color: #ffb3bd; }
#vhs-steps { padding-left: 18px; margin: 0 0 8px; line-height: 1.6; }
#vhs-steps li.done { color: var(--muted); text-decoration: line-through; }
#vhs-steps li.now { color: var(--accent); font-weight: 600; }
#vhs-result { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); margin-bottom: 8px; }
#vhs-result .big { font-size: 22px; font-weight: 700; }
.field { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.field select { flex: 1; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.viewer { position: relative; background: #000; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 480px; touch-action: none; }
.viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#ov-canvas { cursor: crosshair; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.loading[hidden] { display: none; }
.tip { position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none; background: rgba(8,12,18,0.94); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 13px; max-width: 260px; }
.tip b { display: block; }
.tip i { color: var(--muted); font-size: 12px; }
.tip[hidden] { display: none; }
.foot { padding: 8px 16px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.foot a { color: var(--accent); }
/* ---- Read ------------------------------------------------------------ */
.wide { width: 100%; margin: 6px 0; }
#read-submit:disabled { opacity: 0.45; cursor: not-allowed; }
.read-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 6px; background: var(--bg); }
.read-row.selected { outline: 1px solid var(--accent); }
.read-name { display: flex; gap: 8px; align-items: center; background: none; border: 0; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 0 0 6px; }
.read-name .dot { width: 10px; height: 10px; border-radius: 50%; }
.verdicts, .signs { display: flex; flex-wrap: wrap; gap: 4px; }
.verdict, .sign { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.verdict[aria-pressed="true"], .sign[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: #10222c; }
.verdict.answer { box-shadow: 0 0 0 2px #3fae6a inset; }
.signs { margin-top: 6px; align-items: center; }
.signs-label { font-size: 11px; color: var(--muted); }
.read-result { margin-top: 8px; padding: 8px; border-radius: 6px; font-size: 12px; line-height: 1.45; }
.read-result p { margin: 4px 0 0; }
.read-result.ok { background: #16301f; border: 1px solid #2c6a45; }
.read-result.bad { background: #3a1f24; border: 1px solid #7a2f3a; }
.read-result.warn { background: #33280f; border: 1px solid #7a5a1f; }
.read-result.open { background: var(--panel-2); border: 1px solid var(--line); }
.read-head { font-weight: 700; }
#read-summary { margin: 8px 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.keyed { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.keyed legend { font-size: 11px; color: var(--muted); padding: 0 4px; }
.keyed textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px; font: inherit; font-size: 12px; resize: vertical; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(60vh, 1fr); }
  .panel { max-height: 340px; min-height: 220px; }
  .viewer { min-height: 60vh; }
  .slider input { width: 70px; }
}

/* [hidden] must beat the flex rules above. */
.signs[hidden], .read-result[hidden], #read-summary[hidden] { display: none !important; }
