/* TokenPeek — Light terminal restrained (CRT chrome kept; no full-page black wash) */
:root {
  /* Light terminal paper — phosphor accents; keep CRT sidebar + JWT stack + prompt */
  --bg: #eef3ef;
  --panel: #ffffff;
  --panel-2: #e6eee8;
  --line: #c5d4c8;
  --line-strong: #9db5a5;
  --phosphor: #0f8a4a;           /* readable green on light */
  --phosphor-bright: #3dff8a;    /* selected chrome / fills */
  --phosphor-dim: #1fa85a;
  --phosphor-soft: rgba(15, 138, 74, 0.12);
  --warn: #a07a10;
  --danger: #c43c3c;
  --text: #14241a;
  --muted: #4a6a55;
  --well: #f4faf6;               /* input / output wells */
  --radius: 2px;
  --page-max: 72rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --text-base: 1rem;
  --text-sm: 0.875rem;
  --text-xs: 0.8125rem;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  padding-bottom: var(--safe-b);
}
html[lang^="zh"] body { line-height: 1.65; }
body.term::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(15, 138, 74, 0.03) 3px,
    rgba(15, 138, 74, 0.03) 4px
  );
  opacity: 0.7;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--phosphor); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--phosphor-dim); }
code, kbd {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--panel-2);
  color: var(--phosphor);
  padding: 0.1em 0.35em;
  border-radius: 0;
  border: 1px solid var(--line);
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--phosphor-bright); color: #041006; padding: 0.5rem 0.75rem;
  font-family: var(--mono);
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.term-shell {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: calc(0.75rem + var(--safe-t)) 1rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 100vh;
}

/* Topbar — flat CRT chrome */
.mast {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.35rem 0 0.65rem;
  border-bottom: 1px solid var(--line);
}
.brand a {
  display: flex; align-items: center; gap: 0.55rem;
  text-decoration: none; color: inherit;
}
.brand-mark {
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 0;
}
.brand-name {
  font-family: var(--mono); font-weight: 700; font-size: 1.05rem;
  letter-spacing: -0.02em; white-space: nowrap; color: var(--phosphor);
}
.brand small { display: block; color: var(--muted); font-size: var(--text-xs); font-family: var(--mono); font-weight: 500; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  font-family: var(--mono); font-size: var(--text-sm); font-weight: 550;
  line-height: 1.2; padding: 0.45rem 0.7rem; min-height: 40px;
  border-radius: var(--radius); border: 1px solid transparent;
  background: transparent; color: var(--text); cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--phosphor-soft); color: var(--phosphor); }
.btn:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 2px; }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { color: var(--phosphor); }
.btn-primary {
  background: var(--phosphor-bright); color: #041006; border-color: var(--phosphor-bright); font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.04); background: var(--phosphor-bright); color: #041006; }
.btn-secondary {
  background: var(--panel); border-color: var(--line-strong); color: var(--text);
}
.btn-secondary:hover { border-color: var(--phosphor-dim); color: var(--phosphor); }
.lang-switch { display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lang-btn { min-width: 44px; border-radius: 0; min-height: 40px; }
.lang-btn[aria-pressed="true"] { background: var(--phosphor-soft); color: var(--phosphor); font-weight: 700; }

/* Header XOR — beat .btn cascade */
.nav-toggle,
.btn.nav-toggle { display: none; }
.nav-guides {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem;
}
.nav-guides a {
  font-family: var(--mono); font-size: var(--text-sm); color: var(--muted); text-decoration: none;
  padding: 0.4rem 0.55rem; border-radius: var(--radius); min-height: 40px;
  display: inline-flex; align-items: center;
}
.nav-guides a:hover { color: var(--phosphor); background: var(--phosphor-soft); }
@media (min-width: 900px) {
  .nav-toggle,
  .btn.nav-toggle { display: none !important; }
  .nav-guides { display: flex !important; position: static; }
}
@media (max-width: 899px) {
  .nav-toggle,
  .btn.nav-toggle { display: inline-flex !important; }
  .nav-guides {
    display: none; position: absolute; right: 1rem; top: 3.5rem; z-index: 40;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(20, 36, 26, 0.14); padding: 0.35rem; min-width: 12rem;
  }
  .nav-guides.is-open { display: flex; }
  .nav-guides a { padding: 0.55rem 0.7rem; }
  .mast { position: relative; }
}
.top-converter-short { display: none; }
@media (max-width: 430px) {
  .top-converter-full { display: none; }
  .top-converter-short { display: inline; }
}

.title-row {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 0.5rem 1rem;
}
.title-row h1 {
  margin: 0; font-family: var(--mono);
  font-size: clamp(1.25rem, 2vw, 1.5rem); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.25; color: var(--phosphor);
}
.title-row .lead {
  margin: 0.25rem 0 0; color: var(--muted); font-size: var(--text-base); max-width: 44rem;
}
.session-chip {
  font-family: var(--mono); font-size: var(--text-xs); color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.35rem 0.7rem; white-space: nowrap;
}
.trust-comment {
  margin: 0; font-family: var(--mono); font-size: var(--text-sm); color: var(--muted);
}
.trust-comment .hash { color: var(--phosphor-dim); }

/* —— CRT workbench: sidebar + stage —— */
.crt-bench {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  min-height: 28rem;
}
.crt-sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel-2);
  padding: 0.5rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.crt-sidebar .side-label {
  font-family: var(--mono); font-size: var(--text-xs); color: var(--muted);
  padding: 0.35rem 0.55rem 0.5rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.tool-btn {
  display: flex; align-items: center; gap: 0.45rem;
  width: 100%; text-align: left;
  font-family: var(--mono); font-size: var(--text-sm);
  padding: 0.55rem 0.6rem; min-height: 44px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--muted); cursor: pointer;
}
.tool-btn:hover { color: var(--text); background: rgba(15,138,74,0.08); }
.tool-btn[aria-selected="true"] {
  color: var(--phosphor); background: var(--phosphor-soft);
  border-color: var(--phosphor-dim);
}
.tool-btn .glyph { opacity: 0.7; width: 1.1rem; text-align: center; }
.crt-stage {
  padding: 0.85rem 1rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  min-width: 0;
}
@media (max-width: 760px) {
  .crt-bench { grid-template-columns: 1fr; }
  .crt-sidebar {
    border-right: 0; border-bottom: 1px solid var(--line);
    flex-direction: row; flex-wrap: wrap; gap: 0.25rem; padding: 0.45rem;
  }
  .crt-sidebar .side-label { width: 100%; padding: 0.15rem 0.35rem 0.25rem; }
  .tool-btn { width: auto; flex: 1 1 auto; justify-content: center; }
}

/* Command prompt */
.prompt-row {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--line-strong); background: var(--well);
  border-radius: var(--radius);
}
.prompt-prefix {
  font-family: var(--mono); color: var(--phosphor);
  padding: 0.65rem 0.55rem 0.65rem 0.7rem;
  border-right: 1px solid var(--line);
  user-select: none; display: flex; align-items: flex-start;
}
.prompt-input {
  flex: 1; min-width: 0; resize: vertical; min-height: 5.5rem;
  font-family: var(--mono); font-size: 0.9375rem; line-height: 1.5;
  color: var(--text); background: transparent; border: 0;
  padding: 0.65rem 0.75rem; outline: none;
}
.prompt-input:focus { box-shadow: inset 0 0 0 1px var(--phosphor-dim); }
.prompt-input::placeholder { color: #7a9a82; }
.toolbar-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
}
.field-inline {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--mono); font-size: var(--text-sm); color: var(--muted);
}
.field-inline select, .field-inline input[type="text"] {
  font-family: var(--mono); font-size: var(--text-sm);
  background: var(--well); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 0.35rem 0.45rem; min-height: 36px;
}
.note-warn {
  font-family: var(--mono); font-size: var(--text-sm);
  color: var(--warn); margin: 0;
  padding: 0.45rem 0.55rem;
  border: 1px dashed var(--line-strong); background: rgba(232, 197, 71, 0.06);
}

/* JWT luminous stack */
.jwt-stack { display: flex; flex-direction: column; gap: 0.55rem; }
.jwt-panel {
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(15,138,74,0.08), transparent 40%), var(--well);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(61,255,138,0.04), inset 0 1px 0 rgba(61,255,138,0.08);
}
.jwt-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: var(--text-xs);
  color: var(--phosphor-dim); text-transform: uppercase; letter-spacing: 0.05em;
}
.jwt-panel-head .copy-mini {
  font-size: var(--text-xs); min-height: 32px; padding: 0.25rem 0.45rem;
}
.jwt-panel pre {
  margin: 0; padding: 0.65rem 0.75rem;
  font-family: var(--mono); font-size: 0.875rem; line-height: 1.55;
  color: var(--phosphor); white-space: pre-wrap; word-break: break-word;
  max-height: 14rem; overflow: auto;
}
.jwt-panel.sig pre { color: var(--muted); font-size: 0.8125rem; }
.out-block {
  border: 1px solid var(--line-strong); background: var(--well); border-radius: var(--radius);
}
.out-block-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.4rem 0.65rem; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: var(--text-xs); color: var(--phosphor-dim);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.out-block pre, .out-block .hash-lines {
  margin: 0; padding: 0.65rem 0.75rem;
  font-family: var(--mono); font-size: 0.875rem; line-height: 1.55;
  color: var(--phosphor); white-space: pre-wrap; word-break: break-all;
  min-height: 3rem;
}
.hash-lines div { margin-bottom: 0.45rem; }
.hash-lines .algo { color: var(--muted); margin-right: 0.5rem; }
.uuid-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
}
.uuid-value {
  flex: 1 1 16rem; font-family: var(--mono); font-size: 1rem;
  color: var(--phosphor); background: var(--well);
  border: 1px solid var(--line-strong); padding: 0.65rem 0.75rem;
  border-radius: var(--radius); word-break: break-all;
}
.err-line {
  font-family: var(--mono); font-size: var(--text-sm); color: var(--danger); margin: 0;
}
.hidden { display: none !important; }

/* SEO / reading */
.seo-block, .legal-page, .article {
  max-width: 48rem;
}
.seo-block h2, .legal-page h1, .legal-page h2, .article h1, .article h2 {
  font-family: var(--mono); color: var(--phosphor); letter-spacing: -0.02em;
}
.seo-copy p, .seo-copy li, .legal-page p, .article p, .faq-a {
  font-size: var(--text-base); color: var(--text);
}
.faq details {
  border: 1px solid var(--line); padding: 0.55rem 0.75rem; margin-bottom: 0.4rem;
  background: var(--panel);
}
.faq summary { cursor: pointer; font-weight: 600; color: var(--phosphor); font-family: var(--mono); }
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.65rem;
}
.mini-card {
  border: 1px solid var(--line); background: var(--panel); padding: 0.75rem;
  border-radius: var(--radius); text-decoration: none; color: inherit;
}
.mini-card:hover { border-color: var(--phosphor-dim); }
.mini-card h3 { margin: 0 0 0.25rem; font-family: var(--mono); font-size: 0.95rem; color: var(--phosphor); }
.mini-card p { margin: 0; color: var(--muted); font-size: var(--text-sm); }

/* Footer — balanced 3-column (NOT left-stacked empty-right) */
.site-footer {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(12rem, 1.2fr) minmax(10rem, 1fr) minmax(12rem, 1.1fr);
  gap: 1.25rem 1.75rem;
  align-items: start;
}
.footer-col h4 {
  margin: 0 0 0.55rem;
  font-family: var(--mono); font-size: var(--text-xs);
  color: var(--phosphor-dim); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.footer-col p {
  margin: 0 0 0.45rem; color: var(--muted); font-size: var(--text-sm);
  font-family: var(--mono); line-height: 1.55;
}
.footer-col ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.footer-col a {
  font-family: var(--mono); font-size: var(--text-sm); color: var(--muted);
  text-decoration: none;
}
.footer-col a:hover { color: var(--phosphor); }
.footer-meta {
  margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem;
  font-family: var(--mono); font-size: var(--text-xs); color: var(--muted);
}
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.1rem; }
}

.wrap {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: calc(0.75rem + var(--safe-t)) 1rem 2.5rem;
  min-height: 100vh;
  display: flex; flex-direction: column; gap: 0.85rem;
}
.proof details { font-size: var(--text-sm); color: var(--muted); }
.proof summary { cursor: pointer; font-family: var(--mono); color: var(--phosphor-dim); }

@media (prefers-reduced-motion: reduce) {
  body.term::before { display: none; }
  * { transition: none !important; }
}

/* UX-OPT-2026-10-20 */
.limit-note {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--muted, #64748b);
  max-width: 36rem;
}
.limit-note strong { color: var(--ink, #0f172a); font-weight: 600; }
.ux-banner {
  display: none;
  margin: 0.75rem 0;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.4;
  border: 1px solid transparent;
}
.ux-banner.is-on { display: block; }
.ux-banner.is-ok {
  background: color-mix(in srgb, #10b981 12%, transparent);
  border-color: color-mix(in srgb, #10b981 35%, transparent);
  color: var(--ink, #065f46);
}
.ux-banner.is-err {
  background: color-mix(in srgb, #ef4444 10%, transparent);
  border-color: color-mix(in srgb, #ef4444 30%, transparent);
  color: var(--ink, #991b1b);
}
.ux-banner .ux-banner-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.45rem; }
.drop-sample-prominent,
.dropzone .drop-sample,
.drop-actions .drop-ghost,
.dropzone .sample-link,
.drop-strip .drop-ghost {
  font-weight: 600 !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}
body {
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}
@media (max-width: 480px) {
  body { padding-bottom: max(var(--sc-fb-pad, 72px), env(safe-area-inset-bottom)); }
  .batch-bar, #batchBar, .action-bar {
    padding-right: 4.25rem; /* leave room for feedback FAB */
  }
  .tool-stage, .paste-stage, .desk, .crt-bench, .studio, main {
    overflow-x: clip;
  }
}
