/* himeru — "technical" identity (StyleSeed lock: STYLESEED.md)
   dark tonal ramp · sharp radii · single teal accent · mono for secrets/data
   CSP: style-src 'self' — this file is the only stylesheet; system fonts only. */

:root {
  color-scheme: light dark;
  /* light (default): same technical identity on a cool light base */
  --bg: #f5f7fa;          /* page */
  --panel: #ffffff;       /* tonal step 1 */
  --raised: #eef1f5;      /* tonal step 2 */
  --line: #dde3ea;        /* hairline */
  --line-strong: #c6cfda;
  --text: #16202b;
  --text-2: #5b6879;
  --text-3: #5f6d82;
  --accent: #0f766e;
  --accent-hover: #0c5f58;
  --accent-ink: #ffffff;  /* text on accent */
  --accent-dim: rgba(15, 118, 110, .06);
  --accent-line: rgba(15, 118, 110, .30);
  --danger: #b91c1c;
  --danger-dim: rgba(185, 28, 28, .05);
  --danger-line: rgba(185, 28, 28, .30);
  --ph: #94a3b8;          /* placeholder hint text */
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --r-panel: 6px; --r-ctl: 4px; --r-in: 3px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14;
    --panel: #11161d;
    --raised: #171e27;
    --line: #232c38;
    --line-strong: #2e3947;
    --text: #e7ecf2;
    --text-2: #97a3b4;
    --text-3: #7e8a9a;
    --accent: #2dd4bf;
    --accent-hover: #46e2cf;
    --accent-ink: #04241f;
    --accent-dim: rgba(45, 212, 191, .09);
    --accent-line: rgba(45, 212, 191, .28);
    --danger: #f87171;
    --danger-dim: rgba(248, 113, 113, .08);
    --danger-line: rgba(248, 113, 113, .30);
    --ph: #5f6c7d;
  }
}

body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
       background: var(--bg); color: var(--text);
       max-width: 560px; margin: 48px auto; padding: 0 20px;
       font-size: 15px; line-height: 1.55; }
body.wide { max-width: 860px; }

::selection { background: rgba(45, 212, 191, .28); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, textarea, a { transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
@media (prefers-reduced-motion: reduce) {
  button, input, textarea, a { transition: none; }
}

h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; margin: 26px 0 6px; }
h2 { font-family: var(--mono); font-size: 12px; font-weight: 600; text-transform: uppercase;
     letter-spacing: .08em; color: var(--text-2); margin: 30px 0 10px; }
p.intro { color: var(--text-2); margin: 6px 0 18px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--raised);
       border: 1px solid var(--line); padding: 2px 5px; border-radius: var(--r-in);
       word-break: break-all; }

/* instrument panels: every form is a labeled tonal panel */
form, #auth { background: var(--panel); border: 1px solid var(--line);
              border-radius: var(--r-panel); padding: 18px 18px 20px; margin-top: 14px; }
body.wide #auth { max-width: 480px; margin-left: auto; margin-right: auto; margin-top: 40px; }

label { display: block; margin-top: 14px; font-family: var(--mono); font-size: 11.5px;
        font-weight: 500; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); }
.filelabel { margin-top: 14px; }
.hint { color: var(--text-3); font-size: 12px; margin-top: 4px; }

textarea, input[type=text], input[type=email], input[type=number], input[type=datetime-local], input[type=password] {
  width: 100%; box-sizing: border-box; margin-top: 6px; padding: 9px 10px; font-size: 15px;
  color: var(--text); background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl); }
textarea { min-height: 120px; resize: vertical; }
textarea, input[type=password], input[readonly] { font-family: var(--mono); font-size: 14px; }
textarea::placeholder, input::placeholder { color: var(--ph); }
textarea:focus, input:focus { border-color: var(--accent); outline: none; }
textarea:focus-visible, input:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--accent); }
input[type=file] { width: 100%; box-sizing: border-box; margin-top: 8px; font-size: 13px;
  font-family: var(--mono); color: var(--text-2); }
input[type=file]::file-selector-button { font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-2); background: var(--raised); border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl); padding: 5px 10px; margin-right: 10px; cursor: pointer; }
input[type=file]::file-selector-button:hover { color: var(--text); border-color: var(--accent); }
input[type=number] { font-family: var(--mono); font-variant-numeric: tabular-nums; }

button { margin-top: 16px; width: 100%; padding: 11px 16px; font-size: 15px; font-weight: 600;
         font-family: inherit; border: 0; border-radius: var(--r-ctl);
         background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button:hover { background: var(--accent-hover); }
button:disabled { background: var(--raised); color: var(--text-3); cursor: not-allowed; }

.ok { background: var(--accent-dim); border: 1px solid var(--accent-line);
      padding: 14px 16px; border-radius: var(--r-panel); margin-top: 14px; }
.err { color: var(--danger); background: var(--danger-dim); border-left: 2px solid var(--danger);
       padding: 8px 10px; margin-top: 12px; font-family: var(--mono); font-size: 13px; }
.cf { margin-top: 16px; }
footer { margin-top: 28px; color: var(--text-3); font-size: 12px; }

/* chrome: brand header, language switcher, trust note, footer */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
          padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
a.brand { color: inherit; }
a.brand:hover { color: inherit; text-decoration: none; }
.brand img { width: 32px; height: 32px; flex: 0 0 auto; }
.brand .name { font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.brand .tagline { color: var(--text-3); font-size: 12px; line-height: 1.3; }
.langsw { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.langsw button { width: auto; margin: 0; padding: 3px 7px; font-family: var(--mono);
  font-size: 11px; letter-spacing: .05em; background: none; color: var(--text-3);
  border: 0; border-radius: var(--r-ctl); cursor: pointer; }
.langsw button:hover { color: var(--text-2); background: var(--raised); }
.langsw button.active { color: var(--accent); font-weight: 700; }

.trust { display: flex; gap: 10px; align-items: flex-start; margin-top: 22px; padding: 12px 14px;
  background: var(--accent-dim); border: 1px solid var(--accent-line); border-radius: var(--r-panel); }
.trust svg { width: 22px; height: 22px; flex: 0 0 auto; color: var(--accent); margin-top: 1px; }
.trust.danger { background: var(--danger-dim); border-color: var(--danger-line); }
.trust.danger svg { color: var(--danger); }
.trust .why { font-weight: 600; font-size: 14px; margin: 0 0 2px; }
.trust .body { color: var(--text-2); font-size: 13px; margin: 0; }
.brandfoot { margin-top: 26px; color: var(--text-3); font-size: 12px;
  font-family: var(--mono); display: flex; align-items: center; gap: 6px; }
.brandfoot svg { width: 13px; height: 13px; }
.brandfoot .version { margin-left: auto; }
.brandfoot .version:empty { display: none; }

/* revealed secret: quiet hover copy control inside the text box (#8) */
.secretbox { position: relative; margin-top: 8px; }
.secretbox textarea { margin-top: 0; display: block; }
.secretbox .copybtn { position: absolute; top: 8px; right: 8px; width: auto; margin: 0;
  padding: 4px 9px; font-size: 14px; line-height: 1.2; font-family: var(--mono); font-weight: 500;
  background: var(--panel); color: var(--text-2); border: 1px solid var(--line);
  border-radius: var(--r-ctl); opacity: 0; pointer-events: none; transition: opacity .12s ease; }
.secretbox:hover .copybtn, .secretbox:focus-within .copybtn { opacity: 1; pointer-events: auto; }
.secretbox .copybtn:hover { color: var(--accent); background: var(--accent-dim);
  border-color: var(--accent-line); }

/* admin + inbox */
.tagline { color: var(--text-3); font-size: 12px; font-weight: 400; }
#created, #s_created { margin-top: 14px; }
#s_text { min-height: 90px; }
.tabs { display: flex; gap: 4px; align-items: center; border-bottom: 1px solid var(--line); margin: 6px 0 16px; }
.tabs button { width: auto; margin: 0 0 -1px; background: none; color: var(--text-2); border: 0;
  border-bottom: 2px solid transparent; border-radius: 0; padding: 9px 13px; font-size: 14px; font-weight: 500; }
.tabs button:hover { color: var(--text); background: none; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .logout { margin-left: auto; font-size: 12px; font-family: var(--mono); color: var(--text-3); }

.keymode { margin-top: 6px; }
.keymode .opt { font-family: inherit; font-size: 14px; font-weight: 400; text-transform: none;
  letter-spacing: 0; color: var(--text); display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.keymode .opt input { width: auto; margin: 3px 0 0; accent-color: var(--accent); }
.pkout { margin-top: 10px; font-size: 13px; color: var(--text-2); }

/* QR card (#25): scanners expect dark-on-light, so this stays a white card
   with a real quiet zone regardless of light/dark theme. */
.qrbox { margin-top: 10px; width: fit-content; display: flex; flex-direction: column; align-items: center;
  gap: 8px; background: #ffffff; border: 1px solid var(--line); border-radius: var(--r-panel);
  padding: 14px; }
.qrbox-img { width: 100%; max-width: 180px; }
.qrbox-img svg { display: block; width: 100%; height: auto; }
.qrbox code { background: none; border: 0; padding: 0; color: #16202b; font-size: 12px; }

table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px;
        font-variant-numeric: tabular-nums; }
tr:has(+ .reveal-row) > td { border-bottom: 0; }
th { font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase;
     letter-spacing: .07em; color: var(--text-3); }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td a { font-family: var(--mono); font-size: 12.5px; }
.row-actions button { width: auto; margin: 0; padding: 5px 10px; font-size: 12.5px; font-weight: 500;
  background: none; color: var(--danger); border: 1px solid var(--danger-line); border-radius: var(--r-ctl); }
.row-actions button:hover { background: var(--danger-dim); }

/* admin: mail-client layout (sidebar nav + inbox list + reading pane) */
.mail { display: flex; gap: 22px; align-items: flex-start; margin-top: 16px; }
.mailnav { flex: 0 0 150px; display: flex; flex-direction: column; gap: 2px; }
.mailnav button { width: 100%; margin: 0; text-align: left; background: none; color: var(--text-2);
  border: 0; border-left: 2px solid transparent; border-radius: 0 var(--r-ctl) var(--r-ctl) 0;
  padding: 8px 12px; font-size: 14px; font-weight: 500; }
.mailnav button:hover { background: var(--raised); color: var(--text); }
.mailnav button.active { color: var(--accent); border-left-color: var(--accent);
  background: var(--accent-dim); font-weight: 600; }
.mailnav .count { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-left: 6px; }
.mailnav .logout { margin: 14px 0 0 14px; font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.mailmain { flex: 1; min-width: 0; }
.mailmain h2:first-child, .mailbar h2 { margin-top: 6px; }
.mailbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.msglist { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel);
  overflow: hidden; margin-top: 10px; }
.msg { display: flex; gap: 12px; align-items: baseline; padding: 10px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.msg:last-child { border-bottom: 0; }
.msg:hover { background: var(--raised); }
.msg.active { background: var(--accent-dim); }
.msg .m-subj { font-weight: 600; flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.msg .m-when { font-family: var(--mono); font-size: 12px; color: var(--text-3); flex: 0 0 auto; }
.msgdetail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel);
  padding: 14px 16px; margin-top: 14px; }
.msgdetail .actions { margin-top: 10px; display: flex; gap: 8px; }
@media (max-width: 640px) {
  .mail { flex-direction: column; }
  .mailnav { flex-direction: row; width: 100%; }
  .mailnav button { width: auto; border-left: 0; border-bottom: 2px solid transparent; border-radius: 0; }
  .mailnav button.active { border-left: 0; border-bottom-color: var(--accent); }
  .mailnav .logout { margin: 0 0 0 auto; align-self: center; }
}

/* unified operator nav shell (#33): fixed left sidebar (>=768px) + fixed
   bottom tab bar (<768px), both driven by the same [data-nav] buttons so
   app.js only has one selector to keep in sync. app.js toggles
   body.shell-active while the shell (not the login card) is showing, so it
   can go full-width without touching body.wide anywhere else (how-it-works
   still relies on the 860px cap, and the login card still centers via the
   existing body.wide #auth rule above). */
body.wide.shell-active { max-width: none; margin: 0; padding: 0; }

.opnav, .opbottombar { display: none; }

.opnav-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px;
  border-bottom: 1px solid var(--line); color: inherit; }
.opnav-brand:hover { color: inherit; text-decoration: none; }
.opnav-brand img { width: 28px; height: 28px; flex: 0 0 auto; }
.opnav-brand span { font-weight: 650; font-size: 16px; letter-spacing: -.01em; }

.opnav-items { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 10px; overflow-y: auto; }
.opnav-item { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0; text-align: left;
  background: none; color: var(--text-2); border: 0; border-radius: var(--r-ctl);
  padding: 9px 12px; font-size: 14px; font-weight: 500; }
.opnav-item:hover { background: var(--raised); color: var(--text); }
.opnav-item.active { color: var(--accent); background: var(--accent-dim); font-weight: 600; }
.opnav-icon { width: 18px; height: 18px; flex: 0 0 auto; }

.opnav-foot { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.opnav-foot .langsw { justify-content: flex-start; }
.opnav-logout { font-size: 13px; color: var(--text-2); }
.opnav-logout:hover { color: var(--danger); text-decoration: none; }
.opnav-foot .version { font-family: var(--mono); font-size: 11px; color: var(--text-3); }

.opmain { max-width: 720px; margin: 0 auto; padding: 32px 20px 20px; }

@media (min-width: 768px) {
  .opnav { display: flex; flex-direction: column; position: fixed; top: 0; left: 0;
    width: 240px; height: 100vh; background: var(--panel); border-right: 1px solid var(--line); z-index: 20; }
  .opmain { margin-left: 240px; }
}

@media (max-width: 767.98px) {
  .opbottombar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0); }
  .opbottom-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    width: auto; margin: 0; padding: 8px 4px 10px; background: none; border: 0;
    color: var(--text-3); font-size: 10.5px; font-weight: 500; }
  .opbottom-item.active { color: var(--accent); font-weight: 700; }
  .opbottom-icon { width: 20px; height: 20px; }
  body.shell-active .opmain { padding-bottom: 76px; }
}

/* small button variants (ghost/accent/danger) — used by JS-built table actions */
button.ghost, button.accent, button.danger { width: auto; margin: 0; padding: 5px 10px;
  font-size: 12.5px; font-weight: 500; background: none; border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl); color: var(--text-2); }
button.ghost:hover { background: var(--raised); color: var(--text); }
button.accent { color: var(--accent); border-color: var(--accent-line); }
button.accent:hover { background: var(--accent-dim); }
button.danger { color: var(--danger); border-color: var(--danger-line); }
button.danger:hover { background: var(--danger-dim); }

/* prominent "Delete from server" CTA after a reveal (#44) — theme-safe:
   danger-tinted by default, inverts to filled danger on hover. */
button.danger-cta { width: 100%; margin-top: 12px; padding: 10px 14px; font-size: 14px;
  font-weight: 600; background: var(--danger-dim); color: var(--danger);
  border: 1px solid var(--danger); border-radius: var(--r-ctl); }
button.danger-cta:hover { background: var(--danger); color: var(--panel); }
button.danger-cta:disabled { opacity: .55; cursor: not-allowed; }

/* how-it-works explainer (/how-it-works/) — the step animation is content
   (illustrating the dataflow), page chrome stays still per the lock. */
.hiw { margin-top: 18px; }

/* the hero stage: a 16:9 "video" frame the diagram sits inside, with viewfinder
   corner brackets and a bottom scrubber — cinematic chrome, still theme tokens */
.hiw-stage { position: relative; aspect-ratio: 16 / 9; box-sizing: border-box;
  background: radial-gradient(120% 140% at 50% 0%, var(--raised), var(--bg));
  border: 1px solid var(--line); border-radius: var(--r-panel);
  padding: 18px 22px 32px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; }
.hiw-stage::before, .hiw-stage::after { content: ''; position: absolute;
  width: 20px; height: 20px; border: 2px solid var(--line-strong); opacity: .55; }
.hiw-stage::before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.hiw-stage::after { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }
.hiw-diagram { display: grid; grid-template-columns: 1fr 30px 1fr 30px 1fr 30px 1fr;
  gap: 8px; align-items: stretch; }
.hiw-station { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: 12px 10px 10px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color .3s ease, background-color .3s ease; }
.hiw-stlabel { font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }
.hiw-icon { width: 26px; height: 26px; color: var(--text-2); flex: 0 0 auto; }
.hiw-status { font-family: var(--mono); font-size: 10.5px; color: var(--text-3);
  margin-top: auto; }
.hiw-slot { position: relative; width: 100%; min-height: 34px; }
.hiw-chip, .hiw-sent, .hiw-gone { position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -38%); opacity: 0;
  transition: opacity .5s ease, transform .5s ease; white-space: nowrap; }
.hiw-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px;
  border-radius: var(--r-ctl); font-family: var(--mono); font-size: 12px; }
.hiw-chip code { background: none; border: 0; padding: 0; font-size: 12px; }
.hiw-chip.plain { background: var(--bg); border: 1px dashed var(--line-strong); color: var(--text); }
.hiw-chip.sealed { background: var(--accent-dim); border: 1px solid var(--accent-line);
  color: var(--accent); }
.hiw-chip.sealed svg { width: 13px; height: 13px; }
.hiw-sent, .hiw-gone { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.hiw-arrow { position: relative; align-self: center; height: 2px; width: 100%;
  background: var(--line-strong); transition: background-color .3s ease; }
.hiw-arrow::after { content: ''; position: absolute; right: -1px; top: -3px;
  border-left: 6px solid var(--line-strong); border-top: 4px solid transparent;
  border-bottom: 4px solid transparent; transition: border-left-color .3s ease; }
.hiw-dot { position: absolute; top: -2px; left: 0; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent); opacity: 0; }
@keyframes hiw-flow { from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(22px); opacity: 1; } }
@keyframes hiw-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* step choreography (all driven by the container's data-step) */
.hiw[data-step="0"] .st-sender, .hiw[data-step="1"] .st-edge,
.hiw[data-step="2"] .st-r2, .hiw[data-step="3"] .st-operator,
.hiw[data-step="4"] .st-operator { border-color: var(--accent); background: var(--accent-dim); }
.hiw[data-step="0"] .st-sender .hiw-icon, .hiw[data-step="1"] .st-edge .hiw-icon,
.hiw[data-step="2"] .st-r2 .hiw-icon, .hiw[data-step="3"] .st-operator .hiw-icon,
.hiw[data-step="4"] .st-operator .hiw-icon { color: var(--accent); }
.hiw[data-step="0"] .st-sender .hiw-chip.plain,
.hiw[data-step="1"] .st-edge .hiw-chip.sealed,
.hiw[data-step="2"] .st-r2 .hiw-chip.sealed,
.hiw[data-step="3"] .st-r2 .hiw-chip.sealed,
.hiw[data-step="4"] .st-operator .hiw-chip.plain,
.hiw[data-step="4"] .st-r2 .hiw-gone,
.hiw:not([data-step="0"]) .st-sender .hiw-sent {
  opacity: 1; transform: translate(-50%, -50%); }
.hiw[data-step="1"] .a1, .hiw[data-step="2"] .a2,
.hiw[data-step="4"] .a3 { background: var(--accent); }
.hiw[data-step="1"] .a1::after, .hiw[data-step="2"] .a2::after,
.hiw[data-step="4"] .a3::after { border-left-color: var(--accent); }
.hiw[data-step="1"] .a1 .hiw-dot, .hiw[data-step="2"] .a2 .hiw-dot,
.hiw[data-step="4"] .a3 .hiw-dot { animation: hiw-flow 1.1s ease-in-out infinite; }
.hiw[data-step="3"] .st-operator .hiw-key { animation: hiw-pulse 1.6s ease-in-out infinite; }

/* fx layer: a document travelling station to station (left tracks the
   station centers below), and a flicker of ciphertext digits riding with it
   while it is sealed. Purely CSS, driven off data-step like everything else. */
.hiw-fx { position: absolute; inset: 18px 22px 32px; pointer-events: none; }
.fx-doc { position: absolute; bottom: 4px; left: 12%; width: 20px; height: 20px;
  color: var(--accent); transform: translateX(-50%);
  transition: left .8s cubic-bezier(.4, 0, .2, 1); }
.fx-cipher { position: absolute; top: 0; left: 12%; transform: translateX(-50%);
  display: flex; gap: 2px; font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--accent); opacity: 0;
  transition: left .8s cubic-bezier(.4, 0, .2, 1), opacity .3s ease; }
.fx-cipher span { display: inline-block; animation: hiw-digit-jitter 1.6s ease-in-out infinite; }
.fx-cipher span:nth-child(1) { animation-delay: 0s; }
.fx-cipher span:nth-child(2) { animation-delay: .08s; }
.fx-cipher span:nth-child(3) { animation-delay: .16s; }
.fx-cipher span:nth-child(4) { animation-delay: .24s; }
.fx-cipher span:nth-child(5) { animation-delay: .32s; }
.fx-cipher span:nth-child(6) { animation-delay: .4s; }
.fx-cipher span:nth-child(7) { animation-delay: .48s; }
.fx-cipher span:nth-child(8) { animation-delay: .56s; }
@keyframes hiw-digit-jitter { 0%, 100% { transform: translateY(0); opacity: .5; }
  50% { transform: translateY(-3px); opacity: 1; } }
@keyframes hiw-seal-flash { 0% { transform: translateX(-50%) scale(1) rotate(0); }
  40% { transform: translateX(-50%) scale(1.35) rotate(-8deg); }
  100% { transform: translateX(-50%) scale(1) rotate(0); } }
@keyframes hiw-arrive-pop { 0% { transform: translateX(-50%) scale(.6); opacity: .4; }
  60% { transform: translateX(-50%) scale(1.25); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; } }
.hiw[data-step="0"] .fx-doc { left: 12%; }
.hiw[data-step="1"] .fx-doc { left: 37%; animation: hiw-seal-flash .6s ease; }
.hiw[data-step="2"] .fx-doc, .hiw[data-step="3"] .fx-doc { left: 62%; }
.hiw[data-step="4"] .fx-doc { left: 87%; animation: hiw-arrive-pop .6s ease; }
.hiw[data-step="0"] .fx-cipher, .hiw[data-step="4"] .fx-cipher { opacity: 0; }
.hiw[data-step="1"] .fx-cipher { left: 37%; opacity: 1; }
.hiw[data-step="2"] .fx-cipher, .hiw[data-step="3"] .fx-cipher { left: 62%; opacity: 1; }

/* bottom scrubber: a YouTube-style progress bar, filled up to the current step */
.hiw-timeline { position: absolute; left: 22px; right: 22px; bottom: 12px;
  display: flex; gap: 3px; }
.hiw-timeline .seg { flex: 1; height: 3px; border-radius: 2px;
  background: var(--line-strong); transition: background-color .3s ease; }
.hiw[data-step="0"] .hiw-timeline .seg:nth-child(-n+1),
.hiw[data-step="1"] .hiw-timeline .seg:nth-child(-n+2),
.hiw[data-step="2"] .hiw-timeline .seg:nth-child(-n+3),
.hiw[data-step="3"] .hiw-timeline .seg:nth-child(-n+4),
.hiw[data-step="4"] .hiw-timeline .seg:nth-child(-n+5) { background: var(--accent); }
.hiw-time { font-family: var(--mono); font-size: 11px; color: var(--text-3);
  font-variant-numeric: tabular-nums; }

.hiw-controls { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.hiw-dots { display: flex; gap: 4px; }
.hiw-dots button { width: auto; margin: 0; padding: 4px 8px; font-family: var(--mono);
  font-size: 11px; font-weight: 500; letter-spacing: .05em; background: none;
  color: var(--text-3); border: 1px solid var(--line); border-radius: var(--r-ctl);
  cursor: pointer; }
.hiw-dots button:hover { color: var(--text); border-color: var(--line-strong); background: var(--raised); }
.hiw-dots button.active { color: var(--accent); border-color: var(--accent-line);
  background: var(--accent-dim); font-weight: 700; }
.hiw-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.hiw-nav button { min-width: 84px; }
.hiw-nav button:disabled { color: var(--text-3); border-color: var(--line);
  background: none; cursor: not-allowed; opacity: .55; }

.hiw-step { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: 14px 16px; margin-top: 12px; min-height: 96px; }
.hiw-step h3 { font-size: 16px; font-weight: 650; margin: 0 0 6px; letter-spacing: -.01em; }
.hiw-step p { margin: 0; color: var(--text-2); font-size: 14px; }

.hiw-attacker { background: var(--raised); border: 1px dashed var(--line-strong);
  border-radius: var(--r-panel); padding: 12px 16px 14px; margin-top: 10px; min-height: 66px; }
.hiw-atk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hiw-atk-label { font-family: var(--mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.hiw-verdict { font-family: var(--mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px;
  border-radius: var(--r-ctl); border: 1px solid var(--line-strong);
  color: var(--text-2); background: var(--panel); }
.hiw-verdict[data-kind="sealed"] { color: var(--accent); border-color: var(--accent-line);
  background: var(--accent-dim); }
.hiw-attacker p { margin: 8px 0 0; color: var(--text-2); font-size: 13.5px; }

.hiw-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hiw-panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: 14px 16px 16px; }
.hiw-panel h3 { font-size: 15.5px; font-weight: 650; margin: 6px 0 6px; letter-spacing: -.01em; }
.hiw-panel p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.hiw-cando { margin-top: 10px; display: flex; flex-direction: column; gap: 3px;
  font-family: var(--mono); font-size: 12px; }
.hiw-cando .yes { color: var(--accent); }
.hiw-cando .no { color: var(--text-3); }
.hiw-drainnote { margin-top: 10px; }

.hiw-tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: 2px 14px 10px; }
.hiw-table td:first-child { font-weight: 600; }
.hiw-table td { color: var(--text-2); font-size: 13.5px; }
.hiw-table td:first-child { color: var(--text); }

@media (max-width: 720px) {
  .hiw-stage { aspect-ratio: auto; padding-bottom: 26px; }
  .hiw-fx { display: none; }
  .hiw-diagram { grid-template-columns: 1fr; }
  .hiw-arrow { width: 2px; height: 26px; justify-self: center; }
  .hiw-arrow::after { right: auto; top: auto; bottom: -1px; left: -3px;
    border-top: 6px solid var(--line-strong); border-left: 4px solid transparent;
    border-right: 4px solid transparent; border-bottom: 0; }
  .hiw[data-step="1"] .a1::after, .hiw[data-step="2"] .a2::after,
  .hiw[data-step="4"] .a3::after { border-top-color: var(--accent); border-left-color: transparent; }
  .hiw-dot { top: 0; left: -2px; }
  @keyframes hiw-flow { from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(18px); opacity: 1; } }
  .hiw-keys { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .hiw-station, .hiw-chip, .hiw-sent, .hiw-gone, .hiw-arrow, .hiw-arrow::after,
  .fx-doc, .fx-cipher { transition: none; }
  .hiw-dot, .hiw[data-step="3"] .st-operator .hiw-key { animation: none; }
  .hiw[data-step="1"] .a1 .hiw-dot, .hiw[data-step="2"] .a2 .hiw-dot,
  .hiw[data-step="4"] .a3 .hiw-dot { opacity: 1; transform: translateX(11px); }
  .hiw[data-step] .fx-doc, .hiw[data-step] .fx-cipher span { animation: none !important; }
}

/* Staging ribbon (#67) — yellow bar injected by _middleware.js on the staging
   instance only, so it's never mistaken for production. Amber reads the same in
   light and dark, so it needs no theme override. */
.staging-ribbon {
  position: sticky; top: 0; z-index: 1000;
  background: #f5c518; color: #1a1300;
  font-weight: 700; font-size: 13px; letter-spacing: .02em;
  text-align: center; padding: 6px 12px;
  border-bottom: 1px solid #c99a06;
}

/* "Protected by Turnstile" note under the submit button (#68) — reassurance
   that the invisible anti-bot check is active. */
.cf-note { text-align: center; margin-top: 10px; }

/* "What is a passkey?" disclosure on setup (#64). */
.explainer { margin: 14px 0; font-size: 14px; }
.explainer > summary {
  cursor: pointer; color: var(--accent); font-weight: 600;
  list-style: none; padding: 2px 0;
}
.explainer > summary::-webkit-details-marker { display: none; }
.explainer > summary::before { content: "＋ "; font-weight: 400; }
.explainer[open] > summary::before { content: "－ "; }
.explainer > p { color: var(--text-2); margin-top: 8px; line-height: 1.5; }
