/* WebCheck — 「DIGITAL TWIN」 theme.
   Built after the Blksmiith album sleeve: shrink-wrapped plastic over a desaturated
   grey-green ground, near-black ink, heavy Helvetica caps with a registered mark, a
   katakana subtitle and a part number. Breakcore trimmings: scanlines, hazard tape,
   doubled "twin" type, dither edges. Colour is rationed — the only saturated things
   on screen are states you must not miss. */

:root {
  --bg: #0a0b0a;             /* the silhouette black */
  --panel: #101210;
  --panel-2: #171a16;
  --line: #262a24;
  --line-2: #343a30;
  --text: #c9cfc1;           /* the plastic grey-green */
  --muted: #838b7c;
  --accent: #b7c1a8;         /* sheen on the wrap: used as ink-on-light */
  --accent-2: #cdd6bf;
  --good: #8ba86f;
  --warn: #c8a12f;
  --bad: #d2452c;           /* fills, borders, hazard tape */
  --bad-ink: #f2907c;       /* the same red as small text, lifted to stay readable */
  --radius: 2px;             /* packaging, not app chrome */
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: "Helvetica Neue", Helvetica, Arial, "Segoe UI", system-ui, sans-serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--display);
  letter-spacing: .01em;
}

/* The wrap: film grain plus the creases of a plastic sleeve, over everything. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background-image: var(--grain);
  background-size: 200px 200px;
  opacity: .05;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 99; pointer-events: none;
  background:
    repeating-linear-gradient(114deg, transparent 0 70px, rgba(226,232,214,.016) 70px 71px, transparent 71px 190px),
    repeating-linear-gradient(69deg, transparent 0 110px, rgba(226,232,214,.013) 110px 111px, transparent 111px 260px),
    repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
}

[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
::selection { background: var(--accent); color: var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--line-2); }

.boot {
  display: grid; place-items: center; height: 100vh; color: var(--muted);
  font: 11px var(--mono); text-transform: uppercase; letter-spacing: .3em;
}

/* Type used for anything that behaves like packaging print. */
.stamp, .card-label, .out-label, .panel-head h2, .tile-label, .bottom-tabs button,
.nav-btn, .seg button, .pill, .tag, table.grid th {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .14em;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--radius); cursor: pointer;
  background: transparent; border: 1px solid var(--line-2); color: var(--text);
  white-space: nowrap; font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .12em;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); background: var(--panel-2); }
.btn:active:not(:disabled) { transform: translate(1px, 1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.small { padding: 4px 9px; font-size: 11px; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--line-2); }
/* Ink on plastic: the sleeve's own contrast, inverted out of the page. */
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0a0b0a; font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.btn.run { border-color: var(--line-2); color: var(--text); }
.btn.run:hover:not(:disabled) { border-color: var(--good); color: #cbe0b4; background: rgba(139,168,111,.1); }
.btn kbd {
  font: 10px var(--mono); padding: 1px 4px; border: 1px solid currentColor;
  border-radius: 1px; opacity: .5; letter-spacing: 0;
}
.spin {
  width: 12px; height: 12px; border-radius: 0;
  border: 2px solid currentColor; border-right-color: transparent; border-bottom-color: transparent;
  animation: spin .6s steps(8, end) infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes jitter {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(1px, -1px); }
  60% { transform: translate(-1px, 0); }
  80% { transform: translate(1px, 1px); }
}

/* ---------- brand ---------- */
.brand {
  display: flex; align-items: center; gap: 9px;
  font: 800 17px/1 var(--display); letter-spacing: -.03em; text-transform: uppercase;
}
.brand::after { content: "®"; font-size: 9px; align-self: flex-start; margin-left: -4px; opacity: .75; }
.brand.big { font-size: 46px; justify-content: flex-start; gap: 12px; }
.brand.big::after { font-size: 16px; margin-top: 4px; }
.logo {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 0;
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 700;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
}
.brand.big .logo { width: 40px; height: 40px; font-size: 24px; }
.brand:hover .logo { animation: jitter .25s steps(2, end) 2; }
/* The twin: the wordmark's own echo, one step behind. */
.brand.big { text-shadow: 3px 0 0 rgba(183,193,168,.16), -2px 0 0 rgba(10,11,10,.9); }

.stamp {
  font-size: 10px; color: var(--muted);
}
.jp { font-size: 11px; color: var(--muted); letter-spacing: .18em; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 430px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 28px 26px;
  position: relative;
}
/* Corner brackets, the 「」 of the sleeve. */
.auth-card::before, .auth-card::after {
  content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid var(--accent); opacity: .5;
}
.auth-card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.auth-card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.tagline { color: var(--muted); margin: 14px 0 20px; font-size: 12.5px; line-height: 1.5; }
.seg {
  display: grid; grid-template-columns: 1fr 1fr; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 2px; margin-bottom: 18px;
}
.seg button {
  border: 0; background: transparent; padding: 8px; border-radius: 0; cursor: pointer;
  color: var(--muted); font-size: 11px;
}
.seg button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
#auth-form label, label.block, .field-row label {
  display: block; margin-bottom: 12px; color: var(--muted);
  font: 10px var(--mono); text-transform: uppercase; letter-spacing: .16em;
}
#auth-form input {
  display: block; width: 100%; margin-top: 6px; padding: 10px 11px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  font: 13px var(--mono); letter-spacing: 0;
}
#auth-form input:focus, textarea:focus, input:focus, select:focus {
  outline: 1px solid var(--accent); outline-offset: 0; border-color: var(--accent);
}
.hint { color: var(--muted); font-size: 11px; margin: -4px 0 12px; }
.hint:empty { display: none; }
.hint.center { text-align: left; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.form-error {
  background: rgba(210,69,44,.1); border: 1px solid rgba(210,69,44,.45); color: #ffb3a6;
  padding: 9px 11px; border-radius: var(--radius); margin-bottom: 12px; font: 12px var(--mono);
}

/* ---------- app shell ---------- */
.app { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 0 14px; height: 46px; flex: none;
  background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 2;
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 14px);
  opacity: .25;
}
.user { display: flex; align-items: center; gap: 8px; font: 11px var(--mono); letter-spacing: .1em; }
.avatar {
  width: 24px; height: 24px; border-radius: 0; display: inline-grid; place-items: center;
  background: var(--text); color: var(--bg); font: 700 11px var(--mono); text-transform: uppercase;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 70% 100%, 0 100%);
}
.save-state { font: 10px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }
.save-state.error { color: var(--bad-ink); }

.layout {
  flex: 1; min-height: 0; display: grid;
  /* Widths live in custom properties so the splitters can move them. */
  grid-template-columns: var(--w-lectures, 258px) 5px minmax(0, 1fr) 5px var(--w-check, 390px);
}

/* ---------- splitters ---------- */
.splitter {
  background: var(--bg); position: relative; touch-action: none; z-index: 3;
  border: 0; padding: 0;
}
.splitter.col { cursor: col-resize; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.splitter.row { cursor: row-resize; height: 5px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); flex: none; }
/* The grip: a short run of dashes, like the tick marks on the sleeve. */
.splitter::after {
  content: ""; position: absolute; background: var(--line-2);
  transition: background .12s;
}
.splitter.col::after {
  width: 1px; height: 26px; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: repeating-linear-gradient(180deg, var(--line-2) 0 3px, transparent 3px 6px);
}
.splitter.row::after {
  height: 1px; width: 26px; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: repeating-linear-gradient(90deg, var(--line-2) 0 3px, transparent 3px 6px);
}
.splitter:hover::after, .splitter:focus-visible::after, .splitter.dragging::after {
  background: var(--accent);
}
.splitter:hover, .splitter.dragging { background: var(--panel-2); }
.splitter:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
/* While dragging, nothing else should take the pointer or select text. */
body.resizing { user-select: none; }
body.resizing iframe, body.resizing .editor { pointer-events: none; }
body.resizing.col-resizing { cursor: col-resize; }
body.resizing.row-resizing { cursor: row-resize; }
.panel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.panel.lectures { border-right: 1px solid var(--line); }
.panel.check { border-left: 1px solid var(--line); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.panel-head h2 { margin: 0; font-size: 10px; color: var(--muted); }
/* 「 」 around every section title. */
.panel-head h2::before { content: "\FF62"; color: var(--accent); opacity: .6; margin-right: 2px; }
.panel-head h2::after { content: "\FF63"; color: var(--accent); opacity: .6; margin-left: 2px; }
.count {
  display: inline-block; min-width: 17px; padding: 0 5px; border-radius: 0; text-align: center;
  background: var(--line); color: var(--text); font: 700 10px var(--mono); letter-spacing: 0;
}
.count:empty { display: none; }
.count.bad { background: var(--bad); color: #fff; }
.dot { display: inline-block; width: 5px; height: 5px; background: var(--accent); vertical-align: middle; }

/* ---------- lectures ---------- */
.dropzone {
  margin: 12px; padding: 16px 12px; border: 1px dashed var(--line-2); border-radius: var(--radius);
  text-align: center; color: var(--muted); font-size: 11px; display: grid; gap: 5px;
  transition: border-color .15s, background .15s;
}
.dropzone b { color: var(--text); font: 700 12px var(--mono); text-transform: uppercase; letter-spacing: .12em; display: block; }
.dropzone.over, .panel.lectures.over .dropzone { border-color: var(--accent); background: rgba(183,193,168,.07); }
.lecture-list { list-style: none; margin: 0; padding: 0 8px 12px; overflow: auto; flex: 1; }
.lecture {
  display: grid; grid-template-columns: 26px minmax(0,1fr) auto; gap: 9px; align-items: center;
  padding: 8px 6px; border-radius: var(--radius); border-left: 2px solid transparent;
}
.lecture:hover { background: var(--panel-2); border-left-color: var(--accent); }
.lecture .pdf {
  width: 26px; height: 30px; border-radius: 0; background: var(--bg); border: 1px solid var(--line-2);
  color: var(--muted); font: 700 8px var(--mono); display: grid; place-items: center; letter-spacing: .1em;
  clip-path: polygon(0 0, 100% 0, 100% 76%, 76% 100%, 0 100%);
}
.lecture a { color: var(--text); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.lecture a:hover { color: var(--accent); text-decoration: underline; }
.lecture .meta { font: 10px var(--mono); color: var(--muted); letter-spacing: .06em; }
.lecture .meta .warn-text { color: var(--warn); }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  width: 24px; height: 24px; border-radius: 0; font-size: 15px; line-height: 1;
}
.icon-btn:hover { background: var(--bad); color: #fff; }
.lecture.pending { opacity: .55; }

/* ---------- workbench ---------- */
.workbench { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.toolbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.file-tab {
  font: 11px var(--mono); padding: 5px 10px; border-radius: 0; letter-spacing: .1em;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text);
}
.lang-select select {
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text);
  border-radius: 0; padding: 5px 8px; cursor: pointer;
  font: 11px var(--mono); text-transform: uppercase; letter-spacing: .12em;
}
.lang-select select:hover { border-color: var(--accent); }
#toolchain { font: 10px var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.editor { flex: 1 1 auto; min-height: 80px; position: relative; background: #0a0b0a; }
.editor textarea.fallback {
  position: absolute; inset: 0; width: 100%; height: 100%; resize: none; border: 0;
  padding: 12px; background: #0a0b0a; color: var(--text); font: 14px/1.55 var(--mono); tab-size: 4; outline: none;
}
.bottom {
  flex: 0 0 var(--h-bottom, 38%); min-height: 88px; display: flex; flex-direction: column;
  background: var(--panel);
}
.bottom-tabs { display: flex; gap: 0; padding: 0 6px; border-bottom: 1px solid var(--line); flex: none; background: var(--bg); }
.bottom-tabs button {
  border: 0; background: transparent; padding: 9px 13px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 6px; font-size: 10px;
}
.bottom-tabs button:hover { color: var(--text); }
.bottom-tabs button.active { color: var(--text); border-bottom-color: var(--accent); background: var(--panel-2); }
.tab-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px; }
.tab-body[data-body="input"] { padding: 0; display: flex; }
#stdin { flex: 1; resize: none; border: 0; padding: 12px 14px; background: var(--bg); font: 13px/1.55 var(--mono); }
.run-status {
  display: flex; align-items: flex-start; gap: 9px; padding: 9px 11px; border-radius: var(--radius);
  margin-bottom: 10px; background: var(--panel-2); white-space: pre-wrap; border-left: 3px solid var(--line-2);
  font-size: 13px;
}
.run-status.idle { background: transparent; padding: 0; color: var(--muted); border: 0; font: 11px var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.run-status.ok { background: rgba(139,168,111,.1); color: #c3d9a8; border-left-color: var(--good); }
.run-status.bad { background: rgba(210,69,44,.1); color: #ffb3a6; border-left-color: var(--bad); }
.run-status.warn { background: rgba(200,161,47,.1); color: #ecd08a; border-left-color: var(--warn); }
.run-status .time { margin-left: auto; color: var(--muted); font: 10px var(--mono); white-space: nowrap; }
.out-block + .out-block { margin-top: 12px; }
.out-label { font-size: 10px; color: var(--muted); margin-bottom: 5px; }
.out-label::before { content: "// "; opacity: .6; }
pre {
  margin: 0; padding: 11px 12px; border-radius: var(--radius); background: var(--bg);
  border: 1px solid var(--line); font: 12.5px/1.55 var(--mono);
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
}
pre .empty { color: var(--muted); font-style: normal; opacity: .7; }

.problem-list { list-style: none; margin: 0; padding: 0; }
.problem-list li {
  display: grid; grid-template-columns: 16px auto minmax(0,1fr); gap: 9px; align-items: baseline;
  padding: 7px 8px; border-radius: 0; cursor: pointer; font-size: 13px; border-left: 2px solid transparent;
}
.problem-list li:hover { background: var(--panel-2); border-left-color: var(--accent); }
.problem-list .where { font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.problem-list .empty { color: var(--muted); cursor: default; display: block; font: 11px var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.sev { font-weight: 700; }
.sev.error { color: var(--bad-ink); } .sev.warning { color: var(--warn); } .sev.info { color: var(--accent); }

/* ---------- check panel ---------- */
.check-body { overflow: auto; flex: 1; padding: 14px; }
.check-intro h3 { margin: 0 0 8px; font: 800 17px/1.15 var(--display); text-transform: uppercase; letter-spacing: -.02em; }
.check-intro p { color: var(--muted); margin: 0 0 10px; font-size: 12.5px; }
.legend { display: grid; gap: 7px; margin: 14px 0 16px; font-size: 12px; }
.legend span { display: flex; gap: 8px; align-items: center; }
.pill {
  display: inline-block; padding: 2px 7px; border-radius: 0; font-size: 9px; font-weight: 700;
  border: 1px solid currentColor;
}
.pill.good { background: rgba(139,168,111,.12); color: var(--good); }
.pill.warn { background: rgba(200,161,47,.12); color: var(--warn); }
.pill.bad { background: rgba(210,69,44,.14); color: var(--bad-ink); border-color: var(--bad); }

.checking { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 44px 10px; color: var(--muted); }
.checking .spin { width: 26px; height: 26px; border-width: 3px; color: var(--accent); }
.checking b { color: var(--text); font: 700 12px var(--mono); text-transform: uppercase; letter-spacing: .12em; }

.verdict { border-radius: var(--radius); padding: 14px; margin-bottom: 12px; border: 1px solid; position: relative; overflow: hidden; }
.verdict.pass { background: rgba(139,168,111,.08); border-color: rgba(139,168,111,.45); }
.verdict.warn { background: rgba(200,161,47,.08); border-color: rgba(200,161,47,.45); }
.verdict.fail { background: rgba(210,69,44,.08); border-color: rgba(210,69,44,.5); }
/* Hazard tape along the top of a failing verdict. */
.verdict.fail::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: repeating-linear-gradient(45deg, var(--bad) 0 8px, transparent 8px 16px);
  opacity: .8;
}
.verdict h3 {
  margin: 0 0 4px; font: 800 16px var(--display); text-transform: uppercase; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 9px;
}
.verdict.pass h3 { color: #c3d9a8; } .verdict.warn h3 { color: #ecd08a; } .verdict.fail h3 { color: #ffb3a6; }
.verdict p { margin: 7px 0 0; font-size: 12.5px; }
.stats { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.stale {
  font: 11px var(--mono); color: var(--warn); background: rgba(200,161,47,.07);
  border: 1px dashed rgba(200,161,47,.45); padding: 7px 10px; border-radius: 0; margin-bottom: 12px;
}
.group { margin-bottom: 12px; }
.group > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 9px;
  padding: 7px 0; font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .12em;
  border-bottom: 1px solid var(--line);
}
.group > summary::-webkit-details-marker { display: none; }
.group > summary::before { content: "+"; color: var(--accent); font-weight: 700; }
.group[open] > summary::before { content: "−"; }
.items { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; }
.item {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--line-2);
  border-radius: 0; padding: 9px 11px;
}
.item.not_covered { border-left-color: var(--bad); }
.item.warn { border-left-color: var(--warn); }
.item.covered { border-left-color: var(--good); }
.item .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.item .name { font: 700 12.5px var(--mono); word-break: break-word; }
.item .cat { font: 9px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }
.item .reason { margin: 5px 0 0; font-size: 12.5px; }
.item .ref { margin: 5px 0 0; font: 11px var(--mono); color: var(--muted); }
.item .lines { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.line-link {
  border: 1px solid var(--line-2); background: var(--bg); border-radius: 0; cursor: pointer;
  font: 10px var(--mono); padding: 2px 6px; color: var(--muted); letter-spacing: .06em;
}
.line-link:hover { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.check-foot { font: 10px/1.6 var(--mono); color: var(--muted); margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--line); }
.check-error {
  background: rgba(210,69,44,.08); border: 1px solid rgba(210,69,44,.45);
  color: #ffc4ba; border-radius: 0; padding: 12px; white-space: pre-wrap; font: 12px/1.55 var(--mono);
}

/* ---------- top navigation ---------- */
.nav { display: flex; gap: 0; margin-left: 16px; }
.nav-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 6px 12px; border-radius: 0; font-size: 10px;
}
.nav-btn:hover { color: var(--text); animation: jitter .2s steps(2, end) 1; }
.nav-btn.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.plan-badge {
  padding: 3px 8px; border-radius: 0; font: 700 9px var(--mono); text-transform: uppercase; letter-spacing: .14em;
  background: transparent; border: 1px solid var(--line-2); color: var(--muted);
}
.plan-badge.pro { border-color: var(--good); color: #c3d9a8; background: rgba(139,168,111,.1); }
.plan-badge.expired { border-color: var(--bad); color: #ffb3a6; background: rgba(210,69,44,.1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- account and admin pages ---------- */
.page { overflow: auto; height: 100%; background: var(--bg); }
.page-body { max-width: 1120px; margin: 0 auto; padding: 28px 22px 60px; }
.page-head { margin-bottom: 22px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.page-head h1 {
  margin: 0 0 6px; font: 800 34px/1 var(--display); text-transform: uppercase; letter-spacing: -.035em;
  text-shadow: 2px 0 0 rgba(183,193,168,.14);
}
.page-head h1::after { content: "®"; font-size: 11px; vertical-align: super; opacity: .6; margin-left: 3px; }
.page-head p { margin: 0; font: 11px var(--mono); color: var(--muted); letter-spacing: .08em; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.wide { margin-top: 12px; }
.card-label { color: var(--muted); font-size: 9px; margin-bottom: 10px; }
.card-label::before { content: "["; opacity: .6; }
.card-label::after { content: "]"; opacity: .6; }
.card-value { font: 800 26px/1 var(--display); text-transform: uppercase; letter-spacing: -.03em; margin-bottom: 8px; }
.card.plan.pro { border-color: rgba(139,168,111,.5); }
.card.plan.expired { border-color: rgba(210,69,44,.5); }

dl.rows { margin: 10px 0 0; font-size: 12.5px; }
dl.rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px dashed var(--line); }
dl.rows > div:first-child { border-top: 0; }
dl.rows dt { color: var(--muted); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .12em; }
dl.rows dd { margin: 0; text-align: right; font: 12px var(--mono); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; margin-bottom: 20px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 13px; display: flex; flex-direction: column; gap: 3px;
}
.tile.warn { border-color: rgba(200,161,47,.5); background: rgba(200,161,47,.06); }
.tile-value { font: 800 22px/1 var(--display); letter-spacing: -.03em; }
.tile-label { color: var(--muted); font-size: 9px; }

.admin-tabs { display: flex; gap: 0; width: fit-content; margin-bottom: 14px; }
.admin-tabs button { padding: 8px 18px; }
.admin-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.admin-toolbar input, .admin-toolbar select {
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text);
  border-radius: 0; padding: 6px 10px; min-width: 170px; font: 12px var(--mono);
}

table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th, table.grid td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { color: var(--muted); font-weight: 500; font-size: 9px; background: var(--panel); }
table.grid th[data-sort] { cursor: pointer; user-select: none; }
table.grid th[data-sort]:hover { color: var(--accent); }
table.grid td.num, table.grid th.num { text-align: right; font-family: var(--mono); }
table.grid.clickable tbody tr { cursor: pointer; }
table.grid.clickable tbody tr:hover { background: var(--panel-2); }
table.grid tbody tr.selected { background: rgba(183,193,168,.09); box-shadow: inset 2px 0 0 var(--accent); }
table.grid tbody tr.inactive td { opacity: .45; }
table.grid tbody tr.row-warn td { background: rgba(200,161,47,.06); }
table.grid code { font: 11px var(--mono); color: var(--muted); }

.tag { font-size: 8px; padding: 2px 6px; border-radius: 0; border: 1px solid var(--line-2); color: var(--muted); }
.tag.admin { border-color: var(--accent); color: var(--accent); }
.tag.bad { border-color: var(--bad); color: #ffb3a6; }

.detail { margin-top: 16px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); padding: 16px; position: relative; }
.detail::before {
  content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 10px, transparent 10px 20px); opacity: .4;
}
.detail-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-head h2 { margin: 0; font: 800 20px var(--display); text-transform: uppercase; letter-spacing: -.02em; }
.detail-head .muted { font: 10px var(--mono); letter-spacing: .08em; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px; }
.detail .card { background: var(--panel-2); }
.field-row { display: flex; gap: 10px; }
.field-row select, .field-row input, label.block input {
  display: block; width: 100%; margin-top: 5px; background: var(--bg);
  border: 1px solid var(--line-2); color: var(--text); border-radius: 0; padding: 6px 8px;
  font: 12px var(--mono); letter-spacing: 0;
}
.actions { display: flex; flex-wrap: wrap; gap: 5px; }
.btn.danger { border-color: var(--bad); color: #ffb3a6; }
.btn.danger:hover:not(:disabled) {
  color: #fff; border-color: var(--bad);
  background: repeating-linear-gradient(45deg, rgba(210,69,44,.5) 0 7px, rgba(210,69,44,.2) 7px 14px);
}
ul.plain { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
ul.plain li { padding: 5px 0; border-bottom: 1px dashed var(--line); }
ul.plain li:last-child { border-bottom: 0; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 120; max-width: min(400px, calc(100vw - 32px)); }
.toast {
  background: var(--panel); border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  padding: 10px 12px; border-radius: 0; box-shadow: 0 10px 30px rgba(0,0,0,.6);
  font: 12px/1.5 var(--mono); animation: jitter .18s steps(2, end) 1;
}
.toast.bad { border-left-color: var(--bad); color: #ffc4ba; }
.toast.warn { border-left-color: var(--warn); color: #ecd08a; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 226px minmax(0, 1fr) 330px; }
  .btn kbd { display: none; }
}
@media (max-width: 900px) {
  .app { height: auto; min-height: 100vh; }
  .layout { display: flex; flex-direction: column; }
  .splitter { display: none; }
  .bottom { flex: none; }
  .panel.lectures, .panel.check { border: 0; border-bottom: 1px solid var(--line); }
  .lecture-list { max-height: 220px; }
  .editor { flex: none; height: 55vh; }
  .bottom { flex: none; height: 300px; }
  .check-body { overflow: visible; }
  .topbar .save-state { display: none; }
  .page-head h1 { font-size: 26px; }
  .brand.big { font-size: 34px; }
}
@media (max-width: 520px) {
  .toolbar .muted { display: none; }
  .toolbar .btn { padding: 7px 10px; }
  .user #username { display: none; }
  .nav { margin-left: 4px; }
  .nav-btn { padding: 6px 8px; }
}

/* Breakcore is optional; motion sickness is not. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Upload quota line under the dropzone, and the file-kind badge. */
.quota-line { font: 9px var(--mono); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.quota-line:empty { display: none; }
.lecture .pdf.docx, .lecture .pdf.doc { border-color: var(--accent); color: var(--accent); }

/* Tier tweaker. */
.tier-note { margin-top: 0; }
.tier-actions { margin-top: 12px; }
.tier-form { margin-top: 14px; border-color: var(--line-2); }
.tier-form .field-row { flex-wrap: wrap; }
.tier-form .field-row label { flex: 1 1 140px; }
label.inline {
  display: flex; align-items: center; gap: 8px; margin: 6px 0 10px;
  font: 10px var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--muted);
}
label.inline input { width: auto; margin: 0; accent-color: var(--accent); }

/* Cookie consent on the registration form. More specific than "#auth-form label",
   which styles the other fields as small uppercase captions. */
#auth-form label.consent {
  display: flex; align-items: flex-start; gap: 9px; margin: 2px 0 14px;
  font: 12px/1.5 var(--display); text-transform: none; letter-spacing: 0; color: var(--text);
  cursor: pointer;
}
#auth-form label.consent input {
  width: auto; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--accent);
}
#auth-form label.consent a { color: var(--accent); }
.legal { margin: 12px 0 0; text-align: left; font: 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.legal a { color: var(--muted); }
.legal a:hover { color: var(--accent); }

/* The standalone cookie policy page. */
.policy { max-width: 880px; margin: 0 auto; padding: 32px 18px 60px; }
.policy > .brand { display: inline-flex; margin-bottom: 26px; color: var(--text); text-decoration: none; }
.policy .card { margin-top: 12px; }
.policy .card p { margin: 0; line-height: 1.6; }
.policy .card p + p { margin-top: 8px; }
.policy dl.rows > div { display: grid; grid-template-columns: 110px 1fr; }
.policy dl.rows dd { text-align: left; font: 13px/1.55 var(--display); }
.policy ul.plain li { line-height: 1.55; }
.policy code { font: 12px var(--mono); color: var(--accent); }
.table-scroll { overflow-x: auto; }
.policy table.grid td:first-child { white-space: nowrap; }
.policy-foot { margin-top: 22px; font: 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 600px) {
  .policy dl.rows > div { grid-template-columns: 1fr; }
}
