/* EPOK80 application chrome — "Warm Ember" system.
 *
 * One visual system: warm near-black surfaces, a single red accent used like
 * punctuation, phosphor green reserved for the terminal canvas and earned
 * states. The panel canvas styling lives in the generated panels/<slug>.css
 * files, lifted from the trainers — nothing here restyles the grid.
 *
 * Contrast note: every foreground/background pair below is chosen to clear
 * WCAG 2.0 AA (4.5:1 for body text, 3:1 for large text), because Section 508
 * requires it and a training tool that fails accessibility is not adoptable.
 */

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk-var.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-SemiBold.woff2") format("woff2");
  font-weight: 600; font-display: swap;
}

:root {
  /* warm near-black elevation ladder */
  --bg:        #0a0908;
  --bg-1:      #121110;
  --surface:   #1a1714;
  --surface-2: #221e1a;
  --surface-3: #2b2621;
  --line:      #322c26;
  --line-sub:  #241f1b;
  --line-strong:#423a32;
  --line-hi:   #3a332b;
  --well:      #0d0c0a;
  /* warm text */
  --ink:       #f0ede8;   /* on --bg: ~15:1 */
  --ink-dim:   #b2aba1;   /* on --bg: ~8:1  */
  --ink-low:   #837c71;
  /* accent: red owns brand + action */
  --red:       #e5484d;
  --red-hov:   #ec5d5e;
  --red-txt:   #ff9592;   /* on --bg: ~8:1 */
  --vermilion: #db4a2b;
  --ember:     #f76b15;
  --red-glow:  rgba(229, 72, 77, 0.42);
  --red-line:  rgba(229, 72, 77, 0.30);
  /* green: terminal + earned/success only */
  --accent:    #45d67f;   /* kept name: earned/pass states across the app */
  --warn:      #f0c674;
  --err:       #ff8a7a;
  --radius:    10px;
  --sans: "Space Grotesk", "Segoe UI Variable Display", "Segoe UI",
          ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Film grain: an inline-SVG data-URI on a fixed overlay. Dithers gradient
 * banding on the warm blacks and is the cheapest depth cue there is. */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 90;
  opacity: 0.05;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* !important is deliberate. This is a visibility utility and it must beat any
 * layout rule, including an ID selector. It previously lost to
 * `#view-login { display: grid }` - specificity 100 versus 20 - so hiding the
 * login view did nothing: the card stayed painted at min-height 100vh on top of
 * the active view, and a successful login looked like a failed one. */
.view.hidden { display: none !important; }

/* Boot state. All views start hidden; app.js reveals one after whoami answers.
 * Until then, a still red sun on the bare background - a moment of brand, not
 * a login form that then vanishes. :has() hides it the instant any view shows. */
.boot {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
  z-index: 80;
}
.boot-sun {
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--ember), var(--vermilion) 60%, #6e1414);
  box-shadow: 0 0 22px 4px var(--red-glow);
  animation: boot-pulse 1.2s ease-in-out infinite;
}
@keyframes boot-pulse { 50% { box-shadow: 0 0 34px 8px var(--red-glow); } }
body:has(.view:not(.hidden)) .boot { display: none; }

/* ------------------------------------------------------------- login card */

/* A class, not an ID. An ID selector for layout outranks every state class,
 * which is how the bug above happened. */
.view-centered {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
/* one glow source per view: a red bloom bleeding in from the top edge */
.view-centered::before {
  content: "";
  position: absolute; inset: -30% -30% 40% -30%;
  pointer-events: none;
  background: radial-gradient(46% 44% at 50% 0%, var(--red-glow), transparent 70%);
}

.card {
  position: relative;
  width: 100%;
  max-width: 26rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px 34px 32px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
/* the red sun mark above the wordmark */
.card::before {
  content: "";
  display: block;
  width: 14px; height: 14px;
  border-radius: 50%;
  margin-bottom: 18px;
  background: radial-gradient(circle at 34% 30%, var(--ember), var(--vermilion) 60%, #6e1414);
  box-shadow: 0 0 18px 3px var(--red-glow);
}

.brand {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 6px 0 26px;
  color: var(--ink-dim);
  font-size: 0.94rem;
}

label {
  display: block;
  margin: 16px 0 6px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-low);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  background: var(--well);
  color: var(--ink);
  border: 1px solid var(--line-hi);
  border-radius: 8px;
  font: inherit;
  font-family: var(--mono);
  font-size: 0.95rem;
}
input[type="text"]:hover, input[type="password"]:hover { border-color: var(--line-strong); }

input:focus-visible, button:focus-visible, select:focus-visible,
a:focus-visible, .term:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--red-glow);
}

button[type="submit"] {
  width: 100%;
  margin-top: 22px;
  padding: 12px 14px;
  background: var(--red);
  color: #fff;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
button[type="submit"]:hover {
  background: var(--red-hov);
  box-shadow: 0 0 26px -6px var(--red-glow);
}
button[type="submit"]:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

.msg { min-height: 1.4em; margin: 12px 0 0; font-size: 0.88rem; }
.msg.err { color: var(--err); }
.msg.ok  { color: var(--accent); }

.hint, .fineprint {
  color: var(--ink-low);
  font-size: 0.83rem;
  line-height: 1.55;
}
.hint { margin: 12px 0 0; }
.fineprint { margin-top: 24px; }

/* ----------------------------------------------------------------- topbar */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  background: rgba(10, 9, 8, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-sub);
}
.spacer { flex: 1; }
.brand-sm {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 600; letter-spacing: 0.01em; font-size: 1.02rem;
}
.brand-sm::before {
  content: "";
  width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--ember), var(--vermilion) 60%, #6e1414);
  box-shadow: 0 0 12px 2px var(--red-glow);
}
.who { color: var(--ink-low); font-size: 0.85rem; }

/* site navigation in the dashboard topbar - same four destinations as the
 * .sitenav strip on every /ops page, so the map is identical everywhere */
.topnav { display: flex; gap: 2px; margin-left: 14px; }
.topnav a {
  color: var(--ink-dim); text-decoration: none;
  font-size: 0.86rem; font-weight: 500;
  padding: 6px 11px; border-radius: 7px; line-height: 1; white-space: nowrap;
}
.topnav a:hover { color: var(--ink); background: var(--surface); }
.topnav a.on {
  color: var(--red-txt); background: rgba(229,72,77,.10);
  box-shadow: inset 0 -2px 0 var(--red);
}
@media (max-width: 640px) { .topnav a { padding: 6px 7px; font-size: 0.8rem; } }

.linkish {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.linkish:hover { color: var(--ink); border-color: var(--line-strong); }

.pill {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--ink-dim);
  border: 1px solid var(--line);
}
.pill.warn { background: #2d2410; color: var(--warn); border-color: #4a3d18; }
.pill.done { background: #12301f; color: var(--accent); border-color: #235c39; }

/* ------------------------------------------------------------------- body */

.wrap { max-width: 1060px; margin: 0 auto; padding: 30px 22px 90px; }

h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
h2.mt {
  margin-top: 52px;
  padding-top: 22px;
  border-top: 1px solid var(--line-sub);
}
.lede { margin: 0 0 22px; color: var(--ink-dim); font-size: 0.93rem; max-width: 68ch; }

/* dashboard hero strip */
.hero {
  position: relative;
  padding: 34px 0 40px;
}
.hero::before {
  content: "";
  position: absolute; inset: -110px -40vw 0 -40vw;
  pointer-events: none;
  background: radial-gradient(50% 42% at 74% -16%, var(--red-glow), transparent 68%);
}
.kicker {
  position: relative;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red-txt);
  margin: 0 0 14px;
}
.hero h1, .hero-h {
  position: relative;
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 22ch;
}
.hero .lede { position: relative; margin-top: 14px; }

/* ops tool cards (static links on the dashboard) */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}
.dcard {
  display: flex; flex-direction: column; gap: 9px;
  background: linear-gradient(180deg, #1d1a16, var(--surface) 55%);
  border: 1px solid var(--line-hi);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 34px rgba(0,0,0,.38);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--ink);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.dcard:hover {
  transform: translateY(-2px);
  border-color: var(--red-line);
  box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 6px 40px -14px var(--red-glow);
}
.dcard .d-ico {
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--mono); font-weight: 600; font-size: 0.9rem;
  color: var(--red-txt);
}
.dcard .d-title { font-weight: 600; font-size: 1.02rem; }
.dcard .d-sum { color: var(--ink-dim); font-size: 0.87rem; flex: 1; }
.dcard .d-go {
  padding-top: 10px;
  border-top: 1px solid var(--line-sub);
  color: var(--red-txt); font-weight: 600; font-size: 0.84rem;
}

.modules { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.modules button {
  width: 100%;
  text-align: left;
  background: linear-gradient(180deg, #1d1a16, var(--surface) 55%);
  border: 1px solid var(--line-hi);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 34px rgba(0,0,0,.38);
  border-radius: var(--radius);
  padding: 17px 19px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.modules button:hover {
  transform: translateY(-2px);
  border-color: var(--red-line);
  background: var(--surface-2);
  box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 6px 40px -14px var(--red-glow);
}
.modules .m-title { font-weight: 600; }
.modules .m-sum   { color: var(--ink-dim); font-size: 0.88rem; margin-top: 4px; }
.modules .m-count {
  color: var(--red-txt);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  margin-top: 10px;
}

.keys {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-low);
}
.keys b { color: var(--ink); }

.panelnav { margin-top: 18px; display: flex; align-items: center; gap: 10px; }
.panelnav label { margin: 0; }
.panelnav select {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  font: inherit;
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* the 3270 bezel: chrome around the terminal, never inside it. The .screen
 * grid and its generated panel css are untouched — this frames them. */
.bezel {
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.bezel-chrome {
  display: flex; align-items: center; gap: 9px;
  padding: 2px 6px 11px;
  font-family: var(--mono);
  font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-low);
}
.bezel-chrome .bdot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line-strong);
}
.bezel-chrome .blive { margin-left: auto; color: var(--accent); }
.bezel .term { border-radius: 8px; overflow: hidden; }

/* ------------------------------------------------------------ progress list */

.progress { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

.progress li {
  background: linear-gradient(180deg, #1d1a16, var(--surface) 55%);
  border: 1px solid var(--line-hi);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 34px rgba(0,0,0,.38);
}

.p-head { display: flex; align-items: baseline; gap: 12px; }
.p-name { font-weight: 600; }
.p-level {
  margin-left: auto;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 3px 10px;
}
.p-level.earned { color: var(--red-txt); border-color: var(--red-line); }

.p-bar {
  margin: 12px 0 9px;
  height: 7px;
  background: var(--well);
  border: 1px solid var(--line-sub);
  border-radius: 99px;
  overflow: hidden;
}
.p-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--vermilion), var(--red)); box-shadow: 0 0 10px var(--red-glow); }

.p-desc { color: var(--ink-dim); font-size: 0.86rem; line-height: 1.5; }

.p-cap {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line-sub);
  color: var(--warn);
  font-size: 0.79rem;
  line-height: 1.5;
}

/* ================================================================= editor
 *
 * The ruler, the zone shading and the text must agree on where a column is, so
 * all THREE layers - .ed-ruler, .ed-zones and .ed-input - set the same font
 * stack, the same font-size and the same left origin. Omitting the font on the
 * zone layer is not cosmetic: ch resolves against the inherited font. Zone
 * widths are in ch units, which for a monospace font is exactly one character
 * advance. Changing the font here without changing it in all three places
 * would make the editor lie about columns - the one thing it exists to get
 * right.
 */

.wrap.wide { max-width: 1180px; }

.linkish.big { padding: 10px 18px; font-size: 0.92rem; }

.ed { --ed-font: "IBM Plex Mono", "Cascadia Mono", Consolas, "DejaVu Sans Mono",
                 monospace;
      --ed-size: 14px;
      --ed-line: 21px;
      --ed-pad: 12px; }

.ed-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  background: var(--surface); border: 1px solid var(--line);
  border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
}
.ed-lang { font-weight: 600; font-size: 0.88rem; }
.ed-status, .ed-pos {
  font-family: var(--ed-font); font-size: 0.78rem; color: var(--ink-dim);
}
.ed-status { margin-left: auto; }
.ed-status.has-error, .ed-pos.has-error { color: var(--err); }

.ed-btn {
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  border-radius: 8px; padding: 6px 13px; font: inherit; font-size: 0.85rem;
  cursor: pointer;
}
.ed-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.ed-btn.primary {
  background: var(--red); color: #fff; border-color: var(--red);
  font-weight: 600;
}
.ed-btn.primary:hover { background: var(--red-hov); }
.ed-btn:disabled { opacity: 0.5; cursor: default; }

.ed-hint {
  margin: 0; padding: 8px 12px;
  background: #2d2410; color: var(--warn);
  border: 1px solid #4a3d18; border-bottom: 0;
  font-size: 0.83rem;
}

.ed-surface {
  position: relative;
  background: #06080a;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow-x: auto;
}

.ed-ruler, .ed-input {
  font-family: var(--ed-font);
  font-size: var(--ed-size);
  line-height: var(--ed-line);
  padding: 0 var(--ed-pad);
  margin: 0;
  white-space: pre;
  letter-spacing: 0;
  tab-size: 4;
}

.ed-ruler {
  color: #5c554b;
  border-bottom: 1px solid var(--line);
  padding-top: 6px; padding-bottom: 2px;
  user-select: none;
  position: relative; z-index: 3;
}

.ed-zones {
  position: absolute;
  top: calc(var(--ed-line) + 8px);   /* below the ruler */
  bottom: 0;
  left: var(--ed-pad);
  pointer-events: none;
  z-index: 1;

  /* CRITICAL: zone widths are expressed in ch, and ch is font-relative. Without
   * these three lines this layer inherits the body sans-serif, one ch becomes a
   * different width from one character of code, and every band drifts
   * cumulatively - Area A renders 8-12 instead of 8-11 and everything after it
   * slides. The editor then lies about columns, which is the single thing it
   * exists to get right. The editor gate measures this. */
  font-family: var(--ed-font);
  font-size: var(--ed-size);
  line-height: var(--ed-line);
}
.ed-zone { position: absolute; top: 0; bottom: 0; display: block; }
.ed-edge {
  position: absolute; top: 0; bottom: 0; width: 0;
  border-left: 1px dashed #7a5a2a;
}

/* Zone tints are deliberately low-contrast: they must not fight the text they
 * sit behind. Information is carried by the legend and the diagnostics, never by
 * colour alone - Section 508 requires that, and it is also just clearer.
 * Palette is warm-only: greys, ambers, embers, greens — no blues. */
.zone-sequence   { background: rgba(130, 125, 118, 0.10); }
.zone-indicator  { background: rgba(230, 180, 80,  0.16); }
.zone-area_a     { background: rgba(247, 107, 21,  0.13); }
.zone-area_b     { background: rgba(69,  214, 127, 0.08); }
.zone-ignored    { background: rgba(255, 110, 90,  0.13); }
.zone-identifier { background: rgba(247, 107, 21,  0.13); }
.zone-name       { background: rgba(240, 198, 116, 0.14); }
.zone-content    { background: rgba(69,  214, 127, 0.08); }
.zone-continue   { background: rgba(230, 180, 80,  0.20); }

.ed-input {
  position: relative; z-index: 2;
  display: block;
  width: max-content; min-width: 100%;
  min-height: calc(var(--ed-line) * 18);
  background: transparent;
  color: #e8e2d6;
  border: 0; outline: none; resize: vertical;
  caret-color: var(--red);
  overflow-x: hidden;
  padding-top: 4px; padding-bottom: 10px;
}

.ed-legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  margin: 10px 0 0;
  font-family: var(--ed-font); font-size: 0.74rem; color: var(--ink-dim);
}
.ed-zone-key { display: inline-flex; align-items: center; gap: 6px; }
.ed-zone-key i {
  width: 22px; height: 10px; display: inline-block;
  border: 1px solid var(--line);
}

/* ----------------------------------------------------------- diagnostics */

.ed-verdict { margin-top: 16px; }
.ed-verdict.pass, .ed-verdict.fail {
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid;
}
.ed-verdict.pass { background: #10291b; border-color: #245c3a; }
.ed-verdict.fail { background: #2b1512; border-color: #5c2a24; }
.v-head { font-weight: 600; margin-bottom: 4px; }
.ed-verdict.pass .v-head { color: var(--accent); }
.ed-verdict.fail .v-head { color: var(--err); }
.v-text { font-size: 0.88rem; }
.v-line {
  margin-top: 6px; font-family: var(--ed-font); font-size: 0.78rem;
  color: var(--ink-dim);
}

.ed-diags { margin-top: 16px; }
.ed-clean { color: var(--accent); font-size: 0.88rem; }

.ed-diag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ed-diag-list li {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px; padding: 10px 12px;
}
.ed-diag-list li.sev-error   { border-left-color: var(--err); }
.ed-diag-list li.sev-warning { border-left-color: var(--warn); }
.ed-diag-list li.sev-info    { border-left-color: var(--ink-low); }

.d-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.d-sev {
  font-family: var(--ed-font); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 2px 7px; border-radius: 99px;
  border: 1px solid var(--line);
}
.d-sev.sev-error   { color: var(--err);    border-color: #5c2a24; }
.d-sev.sev-warning { color: var(--warn);   border-color: #4a3d18; }
.d-sev.sev-info    { color: var(--ink-dim); border-color: var(--line-strong); }

.d-rule { font-family: var(--ed-font); font-size: 0.76rem; color: var(--ink-dim); }
.d-jump {
  margin-left: auto; background: none; border: 1px solid var(--line);
  color: var(--ink-dim); border-radius: 6px; padding: 2px 8px;
  font-family: var(--ed-font); font-size: 0.74rem; cursor: pointer;
}
.d-jump:hover { color: var(--red-txt); border-color: var(--red-line); }

.d-msg { margin-top: 7px; font-size: 0.9rem; }
.d-ev, .d-fix { margin-top: 6px; font-size: 0.83rem; color: var(--ink-dim); }
.d-label {
  display: inline-block; min-width: 68px;
  font-family: var(--ed-font); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-low);
}
.d-ev code {
  font-family: var(--ed-font); font-size: 0.8rem; color: #e2dccf;
  background: var(--bg); padding: 1px 5px; border-radius: 4px;
}

/* ================================================================ authoring */

.au { display: grid; gap: 18px; }

.au-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.au-card h3 { margin: 0 0 4px; font-size: 1.02rem; font-weight: 600; }
.au-card h4 {
  margin: 0 0 6px; font-family: var(--mono); font-size: 0.72rem;
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-low);
}
.au-hint { margin: 0 0 14px; color: var(--ink-dim); font-size: 0.84rem;
           line-height: 1.55; }

.au-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.au-list { list-style: none; margin: 0; padding: 0; }
.au-list li {
  font-family: var(--mono); font-size: 0.76rem;
  color: var(--ink-dim); padding: 2px 0;
}
.au-mono { font-family: var(--mono);
           font-size: 0.78rem; color: var(--red-txt); margin: 0; }

.au-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.au-in {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 11px; font: inherit; font-size: 0.88rem;
  min-width: 9rem;
}
.au-in.short { min-width: 6.5rem; max-width: 9rem; }
.au-in.wide  { flex: 1 1 16rem; }
.au-in.mono, .mono { font-family: var(--mono); }

.au-code {
  width: 100%; min-height: 190px; margin: 12px 0;
  background: #06080a; color: #e8e2d6;
  border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--mono); font-size: 13px;
  line-height: 20px; padding: 10px 12px;
  white-space: pre; overflow-x: auto; resize: vertical;
}

.au-msg { font-size: 0.83rem; color: var(--ink-dim); }
.au-msg.ok   { color: var(--accent); }
.au-msg.err  { color: var(--err); }
.au-msg.warn { color: var(--warn); }

.au-langs { display: grid; gap: 6px; margin-bottom: 14px; }
.au-lang {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.85rem; padding: 7px 9px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
.au-lang code { min-width: 4.5rem; color: var(--red-txt); font-size: 0.8rem;
                font-family: var(--mono); }
.au-tags { margin-left: auto; display: flex; gap: 6px; }
.tag {
  font-family: var(--mono);
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--ink-dim);
}
.tag.ok   { color: var(--accent); border-color: #245c3a; }
.tag.warn { color: var(--warn);   border-color: #4a3d18; }

.au-findings { display: grid; gap: 6px; margin-top: 12px; }
.au-finding {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.84rem; cursor: pointer;
}
.au-finding code { font-size: 0.76rem; color: var(--ink-dim); min-width: 10rem;
                   font-family: var(--mono); }
.au-fmsg { color: var(--ink-dim); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===== mobile ===== */
/* Phone width: the topbar must never widen the page. The nav becomes its own
 * horizontally scrollable row; the handle is dropped (the Sign out button and
 * the dashboard itself already tell you who you are). */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px 10px; }
  .topbar .who { display: none; }
  .topnav {
    order: 10; flex-basis: 100%; margin-left: 0;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { flex: none; }
  .linkish { padding: 6px 10px; font-size: 0.82rem; }
  .pill { font-size: 0.62rem; padding: 3px 7px; }
  .wrap, .wrap.wide { padding: 18px 14px 70px; }
  .hero { padding: 18px 0 26px; }
  .hero h1, .hero-h { font-size: 1.7rem; }
  h2.mt { margin-top: 36px; padding-top: 16px; }
  .dcard { padding: 16px; }
  .modules button { padding: 14px 15px; }
  .progress li { padding: 13px 14px; }
  .p-head { flex-wrap: wrap; gap: 6px 10px; }
  .p-level { margin-left: 0; }
  /* terminal chrome: thinner frame so the canvas gets the width */
  .bezel { padding: 6px; border-radius: 10px; }
  .bezel-chrome { padding: 2px 4px 7px; font-size: 0.6rem; }
  .keys { font-size: 0.7rem; line-height: 1.7; }
  .panelnav { flex-wrap: wrap; }
  .panelnav select { max-width: 100%; }
  /* editor: the bar wraps; the code surface scrolls sideways on its own */
  .ed-bar { flex-wrap: wrap; gap: 8px; }
  .ed-status { margin-left: 0; flex-basis: 100%; }
  .ed-surface { max-width: 100%; }
  .ed-legend { gap: 6px 12px; }
  .card { padding: 26px 20px 24px; }
}
/* every scrolling row on touch: no bounce past the page */
html, body { overflow-x: hidden; }
