/* Securinets Workshops — theme stylesheet.
   Direction "Pass": dark first, brand red as the only accent, event-pass shapes.
   Tokens live on :root; light mode follows the system unless the user picks one. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------ tokens */
:root {
  color-scheme: dark;
  --bg: #0A0A0A;
  --surface: #141414;
  --surface-2: #1C1C1C;
  --line: #2A2A2A;
  --line-strong: #666666;
  --text: #F5F5F5;
  --muted: #A3A3A3;
  --red: #E80032;
  --red-press: #C4002A;
  --red-text: #FF4D6D;
  --on-red: #FFFFFF;
  --mark: #FFFFFF;
  --ascii: rgba(255, 255, 255, 0.2);
  --scrim: rgba(0, 0, 0, 0.74);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --gut: 48px;
  --max: 1344px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF;
  --surface: #F5F3F1;
  --surface-2: #ECE8E4;
  --line: #E2DDD8;
  --line-strong: #8A847E;
  --text: #0A0A0A;
  --muted: #5E5A56;
  --red-text: #C8002B;
  --mark: #E80032;
  --ascii: rgba(10, 10, 10, 0.13);
  --scrim: rgba(250, 248, 246, 0.84);
  --shadow: 0 24px 60px rgba(10, 10, 10, 0.12);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #FFFFFF;
    --surface: #F5F3F1;
    --surface-2: #ECE8E4;
    --line: #E2DDD8;
    --line-strong: #8A847E;
    --text: #0A0A0A;
    --muted: #5E5A56;
    --red-text: #C8002B;
    --mark: #E80032;
    --ascii: rgba(10, 10, 10, 0.13);
    --scrim: rgba(250, 248, 246, 0.84);
    --shadow: 0 24px 60px rgba(10, 10, 10, 0.12);
  }
}

/* ------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
main { flex: 1 0 auto; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.035em; line-height: 1; text-wrap: balance; }
p { text-wrap: pretty; }
code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--surface-2); padding: 1px 6px; }
pre { background: var(--surface-2); padding: 14px 16px; overflow-x: auto; }
pre code { background: none; padding: 0; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red-text); outline-offset: 3px; }
[hidden] { display: none !important; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--red); color: #fff; padding: 10px 14px; font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gut); }
.label {
  font: 600 12px/1.25 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.label strong, .label b { color: var(--text); font-weight: 700; }
.red { color: var(--red); }
.red-text { color: var(--red-text); }
.muted { color: var(--muted); }
.prose { max-width: 68ch; }
.prose > * + * { margin-top: .9em; }
.prose a { color: var(--red-text); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .3em; }
.prose h2, .prose h3 { margin-top: 1.4em; }

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }

/* ------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.2) blur(6px);
  backdrop-filter: saturate(1.2) blur(6px);
}
.top .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font: 700 14px var(--display); letter-spacing: .08em; text-transform: uppercase; justify-self: start; }
.brand svg { width: 34px; height: 22px; fill: var(--mark); flex: none; }
.brand span { color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 4px; }
.nav a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none;
  transition: color .15s;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"]::before { content: ""; width: 6px; height: 6px; background: var(--red); }
.me { justify-self: end; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  background: none; border: 1px solid var(--line-strong); color: var(--text);
  transition: border-color .15s, background-color .15s;
}
.icon-btn:hover { border-color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: block; }
:root[data-theme="light"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .i-moon { display: none; }
}

.user { position: relative; }
.user-btn {
  display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 0 4px 0 12px;
  background: none; border: 1px solid var(--line-strong); font: 500 13px var(--mono);
  transition: border-color .15s;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { border-color: var(--text); }
.avatar {
  width: 28px; height: 28px; display: inline-grid; place-items: center; flex: none;
  background: var(--red); color: #fff; font: 700 11px var(--display); letter-spacing: .02em; text-transform: uppercase;
}
.user-btn .caret { width: 10px; height: 10px; margin-right: 6px; transition: transform .15s; }
.user-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 30;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  padding: 6px; display: grid;
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .12s, transform .12s var(--ease);
}
.menu.open { opacity: 1; transform: none; pointer-events: auto; }
.menu .menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .menu-head strong { display: block; font: 600 15px var(--display); letter-spacing: -.01em; }
.menu .menu-head span { font-size: 13px; color: var(--muted); word-break: break-all; }
.menu a, .menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; font-size: 14px; text-decoration: none; background: none; border: 0; text-align: left; width: 100%;
}
.menu a:hover, .menu button:hover, .menu a:focus-visible { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .only-mobile { display: none; }
.auth-links { display: flex; align-items: center; gap: 8px; }
.auth-links a:not(.btn) { font-size: 14px; font-weight: 500; text-decoration: none; padding: 8px 10px; }

/* ------------------------------------------------------------ footer */
.foot { border-top: 1px solid var(--line); margin-top: 40px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; padding-top: 20px; padding-bottom: 22px; }
.foot-brand { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.foot-brand svg { width: 28px; height: 18px; fill: var(--red); }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14px; }
.foot nav a { color: var(--muted); text-decoration: none; }
.foot nav a:hover { color: var(--text); }

/* ----------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 48px; padding: 0 18px;
  font: 600 15px var(--font); text-decoration: none; white-space: nowrap;
  background: transparent; color: var(--text); border: 1px solid var(--line-strong);
  transition: background-color .15s, color .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn .arr { transition: transform .2s var(--ease); }
.btn:hover .arr { transform: translateX(3px); }
.btn-solid { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn-solid:hover { background: var(--red-press); border-color: var(--red-press); }
.btn-paper { background: #fff; border-color: #fff; color: #0A0A0A; }
.btn-paper:hover { background: #0A0A0A; border-color: #0A0A0A; color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; font-weight: 600; color: var(--text); }
.link-btn:hover { color: var(--red-text); }

/* ------------------------------------------------------------ forms */
.field { display: grid; gap: 8px; }
.field + .field { margin-top: 20px; }
.field label, .field .field-label { font: 600 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field small { font-size: 13px; color: var(--muted); }
.input, .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  width: 100%; min-height: 52px; padding: 0 16px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 0;
  font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { padding: 12px 16px; min-height: 120px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 1px var(--red);
}
.field input[aria-invalid="true"] { border-color: var(--red-text); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 18px; height: 18px; accent-color: var(--red); margin-top: 3px; }
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 15px;
}
.alert + .alert { margin-top: 8px; }
.alert::before { content: ""; width: 4px; align-self: stretch; background: var(--muted); flex: none; }
.alert-error::before { background: var(--red); }
.alert-error { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }
.alert-ok::before { background: var(--text); }
.alerts { display: grid; gap: 8px; margin-bottom: 24px; }

/* ------------------------------------------------------- page heads */
.page-head { padding: 32px 0 22px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(30px, 4vw, 42px); font-weight: 700; margin: 8px 0 10px; }
.page-head p:not(.label) { color: var(--muted); font-size: 16px; max-width: 58ch; }

/* ----------------------------------------------------------- landing */
.hero-land { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); isolation: isolate; }
.hero-land .wrap { padding-top: 48px; padding-bottom: 40px; position: relative; }
.hero-land h1 { font-size: clamp(32px, 4.4vw, 48px); line-height: 1.05; letter-spacing: -.035em; margin: 0 0 12px; }
.hero-land .lede { font-size: 17px; max-width: 56ch; color: var(--muted); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-top: 24px; }
.hero-cta .link-btn { font-size: 15px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.steps li { list-style: none; padding: 20px 24px 22px 0; }
.steps li + li { border-left: 1px solid var(--line); padding-left: 24px; }
.steps .n { font: 700 13px var(--mono); color: var(--red-text); letter-spacing: .1em; }
.steps h2 { font-size: 19px; margin: 8px 0 6px; letter-spacing: -.02em; }
.steps p { color: var(--muted); font-size: 15px; max-width: 34ch; }
.steps-wrap { padding-left: 0; }
.programme { padding-top: 32px; padding-bottom: 0; }
.programme-head { display: flex; flex-wrap: wrap; gap: 12px 40px; align-items: end; justify-content: space-between; margin-bottom: 20px; }
.programme-head h2 { font-size: 26px; }
.prog-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 20px; align-items: baseline; padding: 14px 0; border-top: 1px solid var(--line); }
.prog-row:last-child { border-bottom: 1px solid var(--line); }
.prog-row h3 { font-size: 19px; letter-spacing: -.02em; }
.prog-row .label { white-space: nowrap; }

/* -------------------------------------------------------------- auth */
.auth { display: flex; justify-content: center; }
.auth-main { padding: 48px var(--gut) 24px; width: 100%; display: flex; justify-content: center; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 34px; margin: 0 0 8px; }
.auth-card .sub { color: var(--muted); margin-bottom: 24px; }
.auth-card form .btn-solid { margin-top: 24px; }
.auth-foot { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
.auth-foot a { color: var(--text); font-weight: 600; }
.auth-foot a:hover { color: var(--red-text); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 76px !important; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px; }
.pw-toggle:hover { color: var(--text); }

/* --------------------------------------------------------- dashboard */
.hero-dash { position: relative; border-bottom: 1px solid var(--line); isolation: isolate; overflow: hidden; }
.hero-dash .wrap { padding-top: 32px; padding-bottom: 24px; }
.hero-dash h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1; letter-spacing: -.035em; margin: 0 0 10px; }
.hero-dash p:not(.label) { font-size: 16px; max-width: 60ch; color: var(--muted); }
.tally { display: inline-flex; margin-top: 20px; border: 1px solid var(--line); background: var(--bg); }
.tally div { padding: 12px 22px; border-right: 1px solid var(--line); font-size: 15px; }
.tally div:last-child { border-right: 0; }
.tally b { font: 700 24px var(--display); letter-spacing: -.02em; margin-right: 8px; }

.passes { display: grid; gap: 16px; padding-top: 24px; }
.pass { display: grid; grid-template-columns: minmax(0, 1fr) 340px; background: var(--surface); border: 1px solid var(--line); position: relative; transition: border-color .2s; }
.pass:hover { border-color: var(--line-strong); }
.pass.is-hidden { opacity: .72; }
.pass-body { padding: 24px 32px 22px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pass-code { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.pass-code .id { font: 700 13px var(--mono); letter-spacing: .08em; color: var(--text); }
.pass h2 { font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -.03em; max-width: 30ch; }
.pass h2 a { transition: color .15s; }
.pass h2 a:hover { color: var(--red-text); }
.pass-body > p { color: var(--muted); max-width: 62ch; }
.meta { display: flex; flex-wrap: wrap; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.meta div { padding: 10px 32px 0 0; margin-right: 32px; border-right: 1px solid var(--line); }
.meta div:last-child { border-right: 0; margin-right: 0; }
.meta dd { font: 600 17px var(--display); margin-top: 4px; margin-left: 0; }
.pass-cover { position: absolute; }

.stub { border-left: 2px dashed var(--line-strong); padding: 22px 26px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.stub::before, .stub::after {
  content: ""; position: absolute; left: -15px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line);
}
.stub::before { top: -15px; clip-path: inset(50% 0 0 0); }
.stub::after { bottom: -15px; clip-path: inset(0 0 50% 0); }
.stub .mk { width: 72px; height: 47px; }
.locked .stub .mk { fill: none; stroke: var(--muted); stroke-width: 1.4; }
.unlocked .stub { background: var(--red); color: var(--on-red); border-left-color: rgba(255, 255, 255, .55); }
.unlocked .stub .mk { fill: #fff; }
.unlocked .stub .label { color: #fff; }
.stub .count { font: 700 42px/.9 var(--display); letter-spacing: -.04em; }
.stub .count small { font: 500 15px var(--font); letter-spacing: 0; margin-left: 6px; }
.stub > p { font-size: 14px; color: var(--muted); }
.stub .btn { margin-top: auto; }
.stub-form { margin: 0; }
.stub > .stub-form.push { margin-top: auto; }
.stub .stub-cancel { font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.stub .stub-cancel:hover { color: var(--red-text); }
.prog-row .label { text-align: right; line-height: 1.6; }
.segs { display: flex; gap: 4px; }
.segs i { flex: 1; height: 6px; background: var(--line-strong); }
.segs i.on { background: var(--red); }
.unlocked .stub .segs i { background: rgba(255, 255, 255, .32); }
.unlocked .stub .segs i.on { background: #fff; }
.empty { border: 1px dashed var(--line-strong); padding: 48px 32px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--text); font-size: 28px; margin-bottom: 10px; }
.empty a { color: var(--text); font-weight: 600; }
.empty a:hover { color: var(--red-text); }

/* key dialog */
.keydlg {
  margin: auto;
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
}
.keydlg::backdrop { background: var(--scrim); }
.keydlg[open] { animation: dlg-in .18s var(--ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.keydlg form { padding: 36px 40px 30px; display: grid; gap: 16px; }
.keydlg .dlg-top { display: flex; justify-content: space-between; align-items: flex-start; }
.fillmark { position: relative; width: 120px; height: 78px; }
.fillmark svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.fillmark .o { fill: none; stroke: var(--muted); stroke-width: 1.4; }
.fillmark .f { fill: var(--red); clip-path: inset(100% 0 0 0); transition: clip-path .38s var(--ease); }
.keydlg.opening .fillmark .f { clip-path: inset(0 0 0 0); }
.keydlg h2 { font-size: 34px; letter-spacing: -.03em; }
.keydlg .key-input {
  width: 100%; height: 60px; padding: 0 18px; background: var(--bg); border: 1px solid var(--line-strong);
  font: 500 22px var(--mono); letter-spacing: .08em; color: var(--text);
}
.keydlg .key-input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.keydlg .key-input[aria-invalid="true"] { border-color: var(--red-text); }
.keydlg .fine { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.keydlg .msg { min-height: 22px; font-size: 15px; font-weight: 500; }
.keydlg .msg.err { color: var(--red-text); }
.keydlg .msg.ok { color: var(--text); }
.shake { animation: shake .28s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ------------------------------------------------------ workspace */
.band { padding-top: 24px; padding-bottom: 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: end; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.band h1 { font-size: clamp(28px, 3.6vw, 42px); line-height: 1; letter-spacing: -.035em; margin: 8px 0 12px; max-width: 28ch; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.score { border: 1px solid var(--line); padding: 18px 22px; min-width: 280px; display: grid; gap: 10px; background: var(--bg); }
.score .count { font: 700 34px/.9 var(--display); letter-spacing: -.04em; }
.score .count small { font: 500 14px var(--font); color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.score .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.score .row a { font-size: 13px; font-weight: 600; }
.score .row a:hover { color: var(--red-text); }
.rail { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rail .wrap { display: flex; }
.rail a {
  display: flex; align-items: baseline; gap: 10px; padding: 13px 24px 11px;
  font: 600 17px var(--display); letter-spacing: -.02em; color: var(--muted); text-decoration: none;
  border-right: 1px solid var(--line); border-top: 3px solid transparent; margin-top: -1px;
  transition: color .15s, background-color .15s;
}
.rail a:first-child { border-left: 1px solid var(--line); }
.rail a:hover { color: var(--text); }
.rail a span { font: 500 12px var(--mono); letter-spacing: 0; }
.rail a[aria-current="page"] { color: var(--text); background: var(--surface); border-top-color: var(--red); }
.rail em { font-style: normal; }
.rail .short { display: none; }

/* presentation */
.deck-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0; min-height: 60vh; }
.decks { border-right: 1px solid var(--line); padding: 24px 24px 24px 0; }
.decks ol { list-style: none; padding: 0; }
.decks a {
  display: grid; grid-template-columns: 34px 1fr; gap: 4px 10px; padding: 14px 12px; text-decoration: none;
  border-bottom: 1px solid var(--line); position: relative; transition: background-color .15s;
}
.decks a:hover { background: var(--surface); }
.decks a[aria-current="true"] { background: var(--surface); }
.decks a[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--red); }
.decks .dk-i { font: 500 12px var(--mono); color: var(--muted); padding-top: 4px; }
.decks .dk-t { font: 600 17px var(--display); letter-spacing: -.01em; }
.decks .dk-d { grid-column: 2; font-size: 13px; color: var(--muted); }
.viewer { padding: 24px 0 24px 32px; display: grid; gap: 14px; align-content: start; }
.screen { position: relative; aspect-ratio: 16 / 10; background: #000; border: 1px solid var(--line); overflow: hidden; }
.screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #1a1a1a; }
.screen:fullscreen { aspect-ratio: auto; border: 0; }
.screen.pdf { aspect-ratio: var(--ratio, 16 / 10); display: grid; place-items: center; touch-action: pan-y; user-select: none; }
.screen .slide { display: block; max-width: 100%; max-height: 100%; }
.slide-status { position: absolute; left: 0; right: 0; top: 50%; text-align: center; transform: translateY(-50%); }
.slide-hit { position: absolute; top: 0; bottom: 0; width: 28%; background: none; border: 0; padding: 0; }
.slide-hit.prev { left: 0; cursor: w-resize; }
.slide-hit.next { right: 0; cursor: e-resize; }
.slide-hit:disabled { cursor: default; }
.slide-nav { display: flex; align-items: center; justify-content: center; gap: 16px; }
.slide-nav .label { min-width: 70px; text-align: center; }
.viewer-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.viewer-bar h2 { font-size: 26px; letter-spacing: -.03em; }
.viewer-bar .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer-note { color: var(--muted); font-size: 15px; }
kbd { border: 1px solid var(--line-strong); padding: 0 6px; font-size: 12px; }

/* tasks */
.split { display: grid; grid-template-columns: 440px minmax(0, 1fr); min-height: 560px; }
.tlist { border-right: 1px solid var(--line); padding: 20px 0; }
.tlist .warn { padding: 0 24px 14px 0; font-size: 13px; color: var(--muted); }
.tlist ol { list-style: none; padding: 0; }
.t {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 18px; gap: 12px; align-items: center;
  padding: 16px 24px 16px 0; border-bottom: 1px solid var(--line); text-decoration: none; position: relative;
  transition: background-color .15s, padding-left .2s var(--ease);
}
.t:hover { background: var(--surface); }
.t .i { font: 500 12px var(--mono); color: var(--muted); padding-left: 12px; }
.t .n { font: 600 17px var(--display); letter-spacing: -.01em; min-width: 0; }
.t .n small { display: block; font: 400 13px var(--font); color: var(--muted); letter-spacing: 0; }
.t .p { font: 600 14px var(--mono); }
.t .d { width: 12px; height: 12px; border: 1.5px solid var(--line-strong); border-radius: 50%; transition: background-color .2s, border-color .2s; }
.t.solved .d { background: var(--red); border-color: var(--red); }
.t.solved .n { color: var(--muted); }
.t[aria-current="true"] { background: var(--surface); }
.t[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--red); }
.detail { padding: 24px 0 32px 40px; min-width: 0; }
.detail-back { display: none; }
.task { display: flex; flex-direction: column; gap: 16px; }
.task-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
.task h2 { font-size: clamp(24px, 2.8vw, 34px); letter-spacing: -.03em; }
.task .solved-flag { display: inline-flex; align-items: center; gap: 8px; background: var(--red); color: #fff; padding: 4px 10px; font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; width: max-content; }
.task-desc { font-size: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font: 500 12px var(--mono); border: 1px solid var(--line-strong); padding: 3px 8px; }
.block { display: grid; gap: 10px; }
.files { display: flex; flex-wrap: wrap; gap: 10px; }
.file {
  display: inline-flex; gap: 10px; align-items: center; border: 1px solid var(--line-strong); padding: 10px 14px;
  font: 500 14px var(--mono); text-decoration: none; transition: border-color .15s, background-color .15s; max-width: 100%;
}
.file:hover { border-color: var(--text); background: var(--surface); }
.file small { color: var(--muted); }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn { display: block; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; word-break: break-all; }
.hint { border: 1px solid var(--line); }
.hint + .hint { margin-top: 8px; }
.hint summary, .hint .hint-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 16px; font-weight: 600; cursor: pointer; list-style: none; }
.hint summary::-webkit-details-marker { display: none; }
.hint summary::after { content: "+"; font: 500 18px var(--mono); color: var(--muted); }
.hint[open] summary::after { content: "–"; }
.hint .hint-body { padding: 0 16px 14px; color: var(--muted); }
.hint em { font-style: normal; font: 500 13px var(--font); color: var(--muted); }
.hint .hint-row .actions { display: flex; gap: 8px; align-items: center; }
.helps { list-style: none; padding: 0; display: grid; gap: 6px; }
.helps a { display: flex; gap: 10px; align-items: baseline; text-decoration: none; padding: 8px 0; border-bottom: 1px solid var(--line); }
.helps a:hover { color: var(--red-text); }
.flag { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; max-width: 680px; }
.flag input, .flag select { height: 54px; background: var(--bg); border: 1px solid var(--line-strong); padding: 0 16px; font: 16px var(--mono); color: var(--text); width: 100%; }
.flag input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.flag .btn { min-height: 54px; }
.flag-result { min-height: 24px; font-weight: 600; }
.flag-result.correct { display: flex; gap: 10px; align-items: center; background: var(--red); color: #fff; padding: 12px 16px; max-width: 680px; }
.flag-result.wrong { color: var(--red-text); }
.flag-result.neutral { color: var(--muted); }
.attempts { font-size: 13px; color: var(--muted); }
.skeleton { display: grid; gap: 14px; }
.skeleton i { display: block; height: 16px; background: var(--surface-2); animation: pulse 1.2s ease-in-out infinite; }
.skeleton i:first-child { height: 48px; width: 60%; }
@keyframes pulse { 50% { opacity: .5; } }

/* resources */
.res-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px 32px; padding: 22px 0 14px; }
.res-head p:not(.label) { color: var(--muted); max-width: 60ch; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); background: none; font: 500 13px var(--mono); letter-spacing: .04em; text-decoration: none;
  transition: border-color .15s, background-color .15s, color .15s;
}
.chip:hover { border-color: var(--text); }
.chip[aria-pressed="true"], .chip[aria-current="page"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { color: var(--muted); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: .7; }
.res-list { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.res { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 6px 32px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: start; }
.res h3 { font-size: 19px; letter-spacing: -.02em; }
.res h3 a { transition: color .15s; }
.res h3 a:hover { color: var(--red-text); }
.res p { color: var(--muted); margin-top: 6px; max-width: 64ch; }
.res .where { font: 500 13px var(--mono); color: var(--muted); white-space: nowrap; padding-top: 6px; }
.res .for { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.res .for a { font: 500 12px var(--mono); border: 1px solid var(--line-strong); padding: 3px 8px; text-decoration: none; }
.res .for a:hover { border-color: var(--red); color: var(--red-text); }
.res.is-hidden { opacity: .6; }

/* solutions */
.sol-list { list-style: none; padding: 0; border-top: 1px solid var(--line); margin-bottom: 48px; }
.sol-list > li { border-bottom: 1px solid var(--line); }
.sol summary, .sol-none { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 0; }
.sol summary { cursor: pointer; list-style: none; }
.sol summary::-webkit-details-marker { display: none; }
.sol summary::after { content: "+"; font: 500 20px var(--mono); color: var(--muted); padding-right: 12px; }
.sol[open] summary::after { content: "–"; }
.sol summary:hover .n { color: var(--red-text); }
.sol .i { font: 500 12px var(--mono); color: var(--muted); padding-left: 12px; }
.sol .n { font: 600 19px var(--display); letter-spacing: -.02em; min-width: 0; transition: color .15s; }
.sol .n small { display: block; font: 400 13px var(--font); color: var(--muted); letter-spacing: 0; }
.sol-none .n { color: var(--muted); }
.sol-none .label { padding-right: 12px; }
.sol-body { padding: 4px 12px 24px 56px; font-size: 16px; }
.sol-body h1, .sol-body h2, .sol-body h3 { font-size: 20px; letter-spacing: -.02em; }
.sol-body img { max-width: 100%; height: auto; }
.sol-body table { border-collapse: collapse; display: block; overflow-x: auto; }
.sol-body th, .sol-body td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.sol-body blockquote { border-left: 3px solid var(--line-strong); padding-left: 14px; color: var(--muted); }

/* leaderboard */
.board { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.board li { display: grid; grid-template-columns: 64px minmax(0, 1fr) 180px 110px; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); position: relative; }
.board .rank { font: 700 22px var(--display); letter-spacing: -.03em; color: var(--muted); padding-left: 16px; }
.board li:first-child .rank { color: var(--red); }
.board .who { font: 600 18px var(--display); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .pts { font: 700 22px var(--display); text-align: right; padding-right: 16px; }
.board .pts small { font: 500 12px var(--mono); color: var(--muted); margin-left: 4px; }
.board li.is-me { background: var(--surface); }
.board li.is-me::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--red); }
.board-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; }

/* profile */
.profile-head { display: flex; flex-wrap: wrap; gap: 20px 28px; align-items: center; padding: 28px 0 22px; border-bottom: 1px solid var(--line); }
.profile-head .avatar { width: 64px; height: 64px; font-size: 24px; }
.profile-head h1 { font-size: clamp(28px, 3.6vw, 40px); }
.profile-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.pw-list { display: grid; gap: 16px; padding-top: 20px; }
.pw { border: 1px solid var(--line); background: var(--surface); }
.pw-top { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; padding: 24px 28px; border-bottom: 1px solid var(--line); align-items: end; }
.pw-top h2 { font-size: 30px; letter-spacing: -.035em; margin-top: 8px; }
.pw-top h2 a { text-decoration: none; }
.pw-top .count { font: 700 34px var(--display); letter-spacing: -.03em; }
.pw-top .count small { font: 500 14px var(--font); color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.pw-tasks { list-style: none; padding: 8px 28px 16px; columns: 2; column-gap: 40px; }
.pw-tasks li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.pw-tasks .i { font: 500 12px var(--mono); color: var(--muted); }
.pw-tasks .s { font: 500 12px var(--mono); color: var(--muted); white-space: nowrap; }
.pw-tasks li.ok .s { color: var(--red-text); }
.pw-tasks li:not(.ok) .nm { color: var(--muted); }

/* settings */
.settings { display: grid; grid-template-columns: 280px minmax(0, 560px); gap: 40px; padding-top: 24px; }
.settings aside p:not(.label) { color: var(--muted); font-size: 15px; margin-top: 10px; }
.settings fieldset { border: 0; padding: 0; }
.settings fieldset + fieldset { margin-top: 48px; }
.settings legend { font: 700 22px var(--display); letter-spacing: -.02em; margin-bottom: 18px; padding: 0; }

/* notifications / pages / errors */
.notes-list { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.notes-list li { padding: 24px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; }
.notes-list h2 { font-size: 24px; margin-bottom: 8px; }
.error-page { padding: 48px 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 48px; align-items: center; }
.error-page .code { font: 700 clamp(56px, 8vw, 96px)/.8 var(--display); letter-spacing: -.06em; color: var(--red); }
.error-page h1 { font-size: clamp(26px, 3vw, 36px); margin-bottom: 10px; }
.error-page p { color: var(--muted); max-width: 48ch; margin-bottom: 28px; }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface); border: 1px solid var(--line-strong); border-left: 4px solid var(--red); padding: 14px 16px; box-shadow: var(--shadow); animation: dlg-in .2s var(--ease); }
.toast strong { display: block; font-family: var(--display); font-size: 17px; margin-bottom: 4px; }
.toast p { font-size: 14px; color: var(--muted); }

/* --------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .split { grid-template-columns: 360px minmax(0, 1fr); }
  .deck-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .pass { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 860px) {
  :root { --gut: 24px; }
  .band { grid-template-columns: 1fr; gap: 20px; }
  .score { min-width: 0; }
  .auth-main { padding-top: 28px; }
  .settings { grid-template-columns: 1fr; gap: 16px; }
  .steps { grid-template-columns: 1fr; }
  .steps li, .steps li + li { border-left: 0; padding: 20px 0; border-top: 1px solid var(--line); }
  .pw-tasks { columns: 1; }
  .pw-top { grid-template-columns: 1fr; }
  .error-page { grid-template-columns: 1fr; gap: 16px; padding: 56px 0; }
}
@media (max-width: 720px) {
  :root { --gut: 16px; }
  body { font-size: 16px; }
  .top .wrap { grid-template-columns: 1fr auto; height: 56px; }
  .nav { display: none; }
  .brand span { display: none; }
  .user-btn .uname { display: none; }
  .user-btn { padding: 0 4px; }
  .menu .only-mobile { display: flex; }
  .menu hr.only-mobile { display: block; }
  .top .wrap > span:empty { display: none; }
  .auth-links { gap: 6px; }
  .auth-links a:not(.btn) { padding: 8px 6px; }
  .hero-land .wrap { padding-top: 28px; padding-bottom: 28px; }
  .prog-row { grid-template-columns: 1fr; gap: 6px; }
  .prog-row .label { text-align: left; }
  .hero-dash .wrap { padding-top: 24px; padding-bottom: 20px; }
  .tally { display: flex; width: 100%; margin-top: 24px; }
  .tally div { flex: 1; padding: 10px 12px; font-size: 13px; }
  .tally b { display: block; font-size: 20px; }
  .passes { padding-top: 20px; gap: 18px; }
  .pass { grid-template-columns: 1fr; }
  .pass-body { padding: 20px 18px 18px; gap: 10px; }
  .meta div { padding-right: 18px; margin-right: 18px; }
  .stub { border-left: 0; border-top: 2px dashed var(--line-strong); padding: 20px 18px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px 16px; }
  .unlocked .stub { border-top-color: rgba(255, 255, 255, .55); }
  .stub::before, .stub::after { top: -15px; bottom: auto; }
  .stub::before { left: -15px; clip-path: inset(0 0 0 50%); }
  .stub::after { left: auto; right: -15px; clip-path: inset(0 50% 0 0); }
  .stub .mk { width: 64px; height: 42px; grid-row: span 2; }
  .stub .count { font-size: 40px; }
  .stub .segs, .stub .btn, .stub > p, .stub .stub-form { grid-column: 1 / -1; }
  .keydlg { margin: auto auto 0; width: 100vw; max-width: 100vw; border-left: 0; border-right: 0; border-bottom: 0; }
  .keydlg form { padding: 24px 18px 22px; }
  .keydlg h2 { font-size: 28px; }
  .fillmark { width: 80px; height: 52px; }
  .band { padding-top: 20px; padding-bottom: 18px; }
  .score { padding: 14px 16px; }
  .score .count { font-size: 34px; }
  .rail .wrap { padding: 0; }
  .rail a { flex: 1; justify-content: center; padding: 14px 8px 12px; font-size: 16px; white-space: nowrap; }
  .rail a:first-child { border-left: 0; }
  .rail a:last-child { border-right: 0; }
  .rail .long { display: none; }
  .rail .short { display: inline; }
  .rail-4 .wrap { overflow-x: auto; }
  .rail-4 a { padding-left: 6px; padding-right: 6px; gap: 6px; font-size: 15px; }
  .sol-body { padding-left: 12px; }
  .sol summary, .sol-none { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .deck-layout { grid-template-columns: 1fr; }
  .decks { border-right: 0; padding: 16px 0 0; }
  .decks ol { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
  .decks li { flex: none; }
  .decks a { border: 1px solid var(--line); grid-template-columns: auto auto; }
  .decks .dk-d { display: none; }
  .viewer { padding: 16px 0 0; }
  .split { grid-template-columns: 1fr; min-height: 0; }
  .tlist { border-right: 0; padding-top: 16px; }
  .t { padding-right: 0; }
  .has-task .tlist { display: none; }
  .split:not(.has-task) .detail { display: none; }
  .detail { padding: 18px 0 28px; }
  .detail-back { display: inline-flex; margin-bottom: 14px; }
  .flag { grid-template-columns: 1fr; }
  .res { grid-template-columns: 1fr; gap: 6px; padding: 18px 0; }
  .res .where { padding-top: 0; }
  .board li { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .board .bar { display: none; }
  .board .rank { font-size: 20px; padding-left: 10px; }
  .board .pts { padding-right: 10px; font-size: 18px; }
  .profile-head .avatar { width: 52px; height: 52px; font-size: 20px; }
  .profile-head .actions { margin-left: 0; width: 100%; }
  .pw-top { padding: 18px; }
  .pw-tasks { padding: 4px 18px 12px; }
  .notes-list li { grid-template-columns: 1fr; gap: 6px; }
  .auth-card h1 { font-size: 30px; }
  .foot { margin-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  @view-transition { navigation: none; }
}
