:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --panel: #ffffff;
  --panel-border: #e2e8f0;
  --text: #1a1523;
  --muted: #56506b;            /* 7.6:1 on white — was #6b6478 at 5.65:1, which read washed out */
  --accent: #5b3df0;
  --accent-dim: #4a2fd6;
  --accent-soft: #f1edff;
  --accent-line: #dcd2ff;
  --warm: #c47a12;             /* decorative fills only: 3.4:1, meets the non-text AA bar */
  --warm-text: #8f5606;        /* warm TEXT needs 4.5:1; this is 6.0:1 */
  --success: #12692f;          /* 6.8:1 */
  --error: #c81e1e;            /* 5.7:1 */
  --link: #5b3df0;
  --ink: #1a1523;
  --ink-hover: #2e2440;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); }

/* ============================================================
   Site header — shared by every page
   ============================================================ */
nav.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 2rem);
  padding: 0.85rem clamp(1rem, 3vw, 1.75rem);
  border-bottom: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  transition: box-shadow .25s ease;
}
nav.site-nav.scrolled { box-shadow: 0 1px 0 var(--panel-border), 0 10px 30px rgba(15,23,42,0.07); }

nav.site-nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
nav.site-nav .brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 9.5px;
  background: linear-gradient(140deg, #6b4dff 0%, var(--accent) 45%, #3f27c4 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.34),
    inset 0 0 0 1px rgba(255,255,255,0.10),
    0 3px 12px rgba(91,61,240,0.34);
  transition: transform .25s cubic-bezier(.2,.7,.3,1), box-shadow .25s ease;
}
nav.site-nav .brand:hover .brand-mark {
  transform: rotate(-18deg);          /* it is a dial — let it turn */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.34),
    inset 0 0 0 1px rgba(255,255,255,0.14),
    0 5px 18px rgba(91,61,240,0.42);
}
nav.site-nav .brand-mark svg { width: 1.22rem; height: 1.22rem; }

.brand-name { white-space: nowrap; letter-spacing: -0.025em; }
/* "The" steps back so "Cipher Master" carries the name */
.brand-name .the {
  font-weight: 500;
  color: var(--muted);
  margin-right: 0.32em;
  letter-spacing: 0;
}
@media (prefers-reduced-motion: reduce) {
  nav.site-nav .brand:hover .brand-mark { transform: none; }
}

/* centre links; margin-right:auto pushes the auth cluster to the far edge */
nav.site-nav .links {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 1.6rem);
  margin-right: auto;
}
nav.site-nav .links a {
  position: relative;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.89rem;
  font-weight: 500;
  padding: 0.3rem 0;
  white-space: nowrap;
  transition: color .16s ease;
}
nav.site-nav .links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -0.15rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform .18s cubic-bezier(.2,.7,.3,1);
}
nav.site-nav .links a:hover { color: var(--text); }
nav.site-nav .links a:hover::after, nav.site-nav .links a.active::after { transform: scaleX(1); }
nav.site-nav .links a.active { color: var(--text); font-weight: 600; }
/* when a page has no centre links, this keeps the auth cluster hard right */
nav.site-nav .links:empty { margin-right: auto; }

nav.site-nav .auth-area { display: flex; align-items: center; gap: 0.7rem; flex-shrink: 0; }
nav.site-nav .auth-area > span { display: flex; align-items: center; gap: 0.7rem; }
nav.site-nav .auth-area .nav-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.89rem;
  white-space: nowrap;
}
nav.site-nav .auth-area .nav-link:hover { color: var(--text); }
nav.site-nav .auth-area .btn { margin: 0; padding: 0.5rem 1rem; font-size: 0.88rem; }
nav.site-nav .auth-area button.secondary { margin: 0; padding: 0.45rem 0.85rem; font-size: 0.85rem; }

/* signed-in identity chip */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.7rem 0.25rem 0.25rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--bg-subtle);
  max-width: 15rem;
}
.user-chip .avatar {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-chip .user-email {
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 820px) {
  nav.site-nav .links { display: none; }
}
@media (max-width: 600px) {
  nav.site-nav { gap: 0.6rem; }
  .user-chip { padding: 0.2rem; border: none; background: none; }
  .user-chip .user-email { display: none; }
  nav.site-nav .brand-name { display: none; }
  nav.site-nav .auth-area .nav-link { display: none; }
}

main.page {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
}

h1 { font-size: 1.8rem; margin: 0 0 0.5rem; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; font-weight: 700; }
p.lead { color: var(--muted); margin: 0 0 1.5rem; font-size: 1.02rem; }

.card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
a.card { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
a.card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card h2 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}
.card-grid .card { margin-bottom: 0; }

label { display: block; font-size: 0.83rem; font-weight: 600; color: var(--muted); margin: 1rem 0 0.35rem; }
label:first-child { margin-top: 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
select, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  font-family: var(--font);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea { font-family: var(--mono); resize: vertical; min-height: 5rem; }

button, .btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 0.7rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  margin-top: 1rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 1px 2px rgba(26,21,35,0.06);
  transition: transform 0.18s cubic-bezier(.2,.7,.3,1), box-shadow 0.18s ease, filter 0.18s ease;
}
button::after, .btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.35) 45%, transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.55s ease;
}
button:hover::after, .btn:hover::after { transform: translateX(120%); }
button:hover, .btn:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 10px 24px rgba(91,61,240,0.28); filter: brightness(1.04); }
button:active, .btn:active { transform: translateY(0); }
button svg, .btn svg { width: 1rem; height: 1rem; stroke: currentColor; flex-shrink: 0; transition: transform 0.18s ease; }
button:hover svg.arrow, .btn:hover svg.arrow { transform: translateX(3px); }
button.secondary, .btn.secondary {
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--panel-border);
}
button.secondary:hover, .btn.secondary:hover {
  box-shadow: inset 0 0 0 1px var(--text);
  filter: none;
}
button.secondary::after, .btn.secondary::after { display: none; }
button.big, .btn.big {
  padding: 0.95rem 1.8rem;
  font-size: 1.05rem;
  border-radius: 11px;
}

.result-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  /* Never inherit. This box also renders inside the dark hero, where the
     inherited colour is near-white and would make the text invisible. */
  color: var(--text);
  font-family: var(--mono);
  word-break: break-word;
  white-space: pre-wrap;
}

.msg { margin-top: 0.75rem; font-size: 0.9rem; font-weight: 500; }
.msg.ok { color: var(--success); }
.msg.err { color: var(--error); }

.share-link {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.share-link input { flex: 1; min-width: 0; }

/* ============================================================
   Site footer — shared by every page
   ============================================================ */
footer.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--panel-border);
  background: var(--bg-subtle);
}
footer.site-footer .footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3rem) clamp(1rem, 3vw, 1.75rem) 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
}
footer.site-footer .footer-brand { min-width: 0; }
footer.site-footer .footer-brand .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
footer.site-footer .footer-brand .brand-mark {
  width: 1.7rem; height: 1.7rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
footer.site-footer .footer-brand .brand-mark svg { width: 1.1rem; height: 1.1rem; }
footer.site-footer .footer-brand .brand-mark {
  background: linear-gradient(140deg, #6b4dff 0%, var(--accent) 45%, #3f27c4 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), inset 0 0 0 1px rgba(255,255,255,0.08);
}
footer.site-footer .footer-brand p {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.89rem;
  line-height: 1.6;
  max-width: 30ch;
}
footer.site-footer .footer-col { min-width: 0; }
footer.site-footer .footer-col h4 {
  margin: 0 0 0.85rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
footer.site-footer .footer-col a {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-size: 0.91rem;
  padding: 0.28rem 0;
  transition: color .15s ease;
}
footer.site-footer .footer-col a:hover { color: var(--accent); }
footer.site-footer .footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.1rem clamp(1rem, 3vw, 1.75rem) 1.75rem;
  border-top: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
footer.site-footer .copyright { color: var(--muted); font-size: 0.82rem; }
footer.site-footer .footer-note {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
}
@media (max-width: 700px) {
  footer.site-footer .footer-inner { grid-template-columns: 1fr 1fr; }
  footer.site-footer .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  footer.site-footer .footer-inner { grid-template-columns: 1fr; }
}

.hidden { display: none !important; }

/* ---------- wide layout (landing / hub) ---------- */
main.page.wide { max-width: 1100px; }

/* ============================================================
   Landing page (index.html) — all "lp-" scoped.
   .eyebrow and .reveal live in this block but are ALSO used by
   hub.html — keep them if this block is ever rewritten again.
   ============================================================ */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-dim);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 0.35rem 0.9rem 0.35rem 0.7rem;
  margin-bottom: 1.25rem;
}
.eyebrow svg { width: 0.9rem; height: 0.9rem; stroke: var(--accent-dim); }

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .55s cubic-bezier(.2,.7,.3,1), transform .55s cubic-bezier(.2,.7,.3,1);
  transition-delay: calc(var(--i, 0) * 60ms);
}
.reveal.visible { opacity: 1; transform: none; }

/* ============================================================
   Tokens + shared primitives
   ============================================================ */
main.page.lp {
  --ink: #0b0a12;
  --ink-2: #14111f;
  --on-dark: #f7f6fb;
  --on-dark-dim: #b3accd;      /* 8.0:1 on the near-black hero */
  --on-dark-rule: rgba(255,255,255,0.11);
  --rule: var(--panel-border);
  --gap: clamp(1rem, 2.4vw, 1.5rem);
  --bleed: clamp(1.15rem, 4vw, 2.75rem);   /* inner padding of dark panels */
  --section: clamp(3.5rem, 8vw, 6.5rem);   /* vertical rhythm between sections */
  padding-top: clamp(1.5rem, 3.5vw, 2.5rem);
  padding-left: clamp(0.85rem, 3vw, 1.5rem);
  padding-right: clamp(0.85rem, 3vw, 1.5rem);
  padding-bottom: clamp(2rem, 4vw, 3rem);
}

/* small uppercase monospace label — the page's accent voice */
.lp-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin: 0 0 1.1rem;
}
.lp-kicker.on-dark { color: #a99cf5; }

.lp-section { margin-bottom: var(--section); }

/* Section header: title left, supporting note right. Deliberately NOT centered. */
.lp-head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1rem, 4vw, 3.5rem);
  align-items: end;
  padding-bottom: 1.5rem;
  margin-bottom: 2.25rem;
  border-bottom: 1px solid var(--rule);
}
.lp-head h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3.2vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.028em;
  line-height: 1.12;
  text-wrap: balance;
}
.lp-head p {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 38ch;
}

/* ============================================================
   HERO
   ============================================================ */
.lp-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--ink);
  color: var(--on-dark);
  border-radius: clamp(14px, 2vw, 22px);
  padding: clamp(2.25rem, 5.5vw, 4.25rem) var(--bleed);
  margin-bottom: 1rem;
}
/* fine dot field, faded out toward the bottom */
.lp-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: radial-gradient(rgba(255,255,255,0.14) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 80% 60% at 30% 0%, #000 10%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 30% 0%, #000 10%, transparent 75%);
}
.lp-hero-glow {
  position: absolute;
  z-index: -1;
  top: -45%;
  right: -10%;
  width: min(680px, 90%);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(108,79,255,0.42) 0%, rgba(74,214,196,0.10) 45%, transparent 70%);
  filter: blur(10px);
  transform: translate(calc(var(--mx, 0) * 1px), calc(var(--my, 0) * 1px));
  transition: transform .6s cubic-bezier(.2,.7,.3,1);
  pointer-events: none;
}

.lp-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: center;
}
.lp-hero-copy { min-width: 0; }

.lp-hero h1 {
  margin: 0 0 1.15rem;
  font-size: clamp(2.15rem, 5.4vw, 3.6rem);
  line-height: 1.03;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: var(--on-dark);
  text-wrap: balance;
}
.lp-hero h1 .quiet { color: var(--on-dark-dim); font-weight: 700; }
.scramble { font-variant-ligatures: none; }

.lp-lede {
  margin: 0 0 2rem;
  font-size: clamp(1.04rem, 1.4vw, 1.15rem);
  line-height: 1.7;
  color: var(--on-dark-dim);
  max-width: 46ch;
}

.lp-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; }
.lp-actions .btn { margin-top: 0; }
.lp-hero .btn.secondary {
  background: transparent;
  color: var(--on-dark);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.26);
}
.lp-hero .btn.secondary:hover {
  background: rgba(255,255,255,0.07);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}
/* The hero is dark, so a link here cannot use the default --link purple —
   it lands at low contrast on near-black. Same tone as .lp-kicker.on-dark. */
.lp-fineprint a { color: #a99cf5; text-underline-offset: 2px; }
.lp-fineprint {
  margin: 1.4rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  color: var(--on-dark-dim);
}

/* ---------- demo panel: styled like a real tool, not a marketing card ---------- */
.lp-panel {
  min-width: 0;
  background: var(--panel);
  /* Light surface inside the dark hero: reset .lp-hero's on-dark colour here,
     at the boundary, so no descendant can inherit near-white onto white. */
  color: var(--text);
  border-radius: 13px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.42);
  overflow: hidden;
}
.lp-panel-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.95rem;
  background: var(--bg-subtle);
  color: var(--text);
  border-bottom: 1px solid var(--rule);
}
.lp-panel-bar .lp-live {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(21,128,61,0.5);
  animation: lpPulse 2.4s infinite;
  flex-shrink: 0;
}
@keyframes lpPulse { 70% { box-shadow: 0 0 0 6px rgba(21,128,61,0); } 100% { box-shadow: 0 0 0 0 rgba(21,128,61,0); } }
.lp-panel-bar .t {
  font-family: var(--mono);
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.lp-panel-body { padding: 1.15rem 1.15rem 1.35rem; }
.lp-panel-body label { margin-top: 1rem; }
.lp-panel-body label:first-child { margin-top: 0; }
.lp-panel-body textarea { min-height: 4.5rem; }

/* The demo's payoff. It gets a labelled header and an accent surface so the
   ciphertext reads as *output* rather than as another empty field. */
.lp-out { margin-top: 1.15rem; }
.lp-out-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  min-height: 1.55rem;
}
.lp-out-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.lp-out-cipher {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--accent-dim);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
  border-radius: 5px;
  padding: 0.14rem 0.44rem;
  white-space: nowrap;
}
.lp-out-cipher:empty { display: none; }
.lp-copy {
  margin: 0 0 0 auto;
  padding: 0.2rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--rule);
  border-radius: 6px;
}
.lp-copy::after { display: none; }
.lp-copy:hover {
  transform: none;
  filter: none;
  color: var(--accent-dim);
  box-shadow: inset 0 0 0 1px var(--accent-line);
  background: var(--accent-soft);
}
.lp-copy[hidden] { display: none; }

.lp-panel-body .lp-out .result-box {
  margin-top: 0;
  max-height: 8.5rem;
  overflow: auto;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.045em;
  line-height: 1.6;
}
/* Resting state, before anything has been encoded. Kept at the same
   specificity race as the rule above so the muted italic actually wins. */
.lp-panel-body .lp-out .result-box.empty {
  background: var(--bg-subtle);
  border-color: var(--panel-border);
  color: var(--muted);
  font-family: var(--font);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

.lp-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; }
.lp-chips button {
  margin-top: 0;
  padding: 0.28rem 0.7rem;
  font-family: var(--mono);
  font-size: 0.73rem;
  font-weight: 500;
  background: var(--bg-subtle);
  color: var(--muted);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--rule);
}
.lp-chips button::after { display: none; }
.lp-chips button:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--text); transform: none; filter: none; }
.lp-panel .btn-row { margin-top: 1.15rem; }
.lp-panel .btn-row button { flex: 1 1 auto; }

/* ============================================================
   Transformation strip — plaintext turning into ciphertext.
   Specific to this product; replaces a generic stats band.
   ============================================================ */
.lp-strip {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.75rem);
  flex-wrap: wrap;
  padding: 1.15rem var(--bleed);
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--panel);
  margin-bottom: var(--section);
}
.lp-strip .lp-strip-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.lp-strip .lp-strip-io {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 2vw, 1.25rem);
  flex: 1 1 22rem;
  min-width: 0;
  font-family: var(--mono);
  font-size: clamp(0.78rem, 1.5vw, 0.95rem);
}
.lp-strip .from { color: var(--muted); }
.lp-strip .to { color: var(--text); font-weight: 600; }
.lp-strip .from, .lp-strip .to { min-width: 0; overflow-wrap: anywhere; }
.lp-strip .arrow-glyph { color: var(--accent); flex-shrink: 0; }

/* ============================================================
   How it works — a flow, not three numbered boxes
   ============================================================ */
.lp-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2.5rem);
}
.lp-flow-step { min-width: 0; padding-top: 1.1rem; border-top: 2px solid var(--text); }
.lp-flow-step:nth-child(2) { border-top-color: var(--accent); }
.lp-flow-step:nth-child(3) { border-top-color: var(--accent-line); }
.lp-flow-step .n {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.lp-flow-step h3 {
  margin: 0 0 0.45rem;
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.lp-flow-step p { margin: 0; color: var(--muted); font-size: 0.96rem; line-height: 1.7; }

/* ============================================================
   Features — an editorial list with hairlines, no icon-card grid
   ============================================================ */
.lp-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(2rem, 5vw, 4.5rem);
}
.lp-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  gap: 0.9rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--rule);
}
/* drop the trailing rule on the last item of each column */
.lp-item:nth-last-child(-n+2) { border-bottom: none; }
.lp-item .icon { padding-top: 0.15rem; }
.lp-item .icon svg { width: 1.15rem; height: 1.15rem; stroke: var(--accent); }
.lp-item h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.012em;
}
.lp-item p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.65; }

/* ============================================================
   Cipher reference — real, verified examples
   ============================================================ */
.lp-table { border-top: 1px solid var(--rule); }
.lp-row {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr) minmax(0, 15rem) 5.5rem;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  align-items: center;
  padding: 1.05rem 0.35rem;
  border-bottom: 1px solid var(--rule);
  transition: background .18s ease;
}
.lp-row:hover { background: var(--bg-subtle); }
.lp-row .name { font-weight: 700; letter-spacing: -0.012em; min-width: 0; }
.lp-row .desc { color: var(--muted); font-size: 0.94rem; line-height: 1.6; min-width: 0; }
.lp-row .ex {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 0;
  overflow-wrap: anywhere;
}
.lp-row .ex b { color: var(--text); font-weight: 600; }
.lp-row .ex i { color: var(--accent); font-style: normal; padding: 0 0.3rem; }
.lp-tag {
  justify-self: start;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem;
  border-radius: 5px;
  white-space: nowrap;
}
.lp-tag.key { color: var(--accent-dim); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.lp-tag.nokey { color: var(--muted); background: var(--bg-subtle); border: 1px solid var(--rule); }

/* ============================================================
   Closing CTA
   ============================================================ */
.lp-cta {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--ink);
  color: var(--on-dark);
  border-radius: clamp(14px, 2vw, 22px);
  padding: clamp(2.5rem, 6vw, 4rem) var(--bleed);
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}
.lp-cta::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -20% -60% 30%;
  height: 150%;
  background: radial-gradient(ellipse at 50% 50%, rgba(108,79,255,0.4), transparent 65%);
}
.lp-cta h2 {
  margin: 0 0 0.55rem;
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.032em;
  line-height: 1.1;
  color: var(--on-dark);
  text-wrap: balance;
}
.lp-cta p { margin: 0; color: var(--on-dark-dim); font-size: 0.98rem; line-height: 1.6; max-width: 44ch; }
.lp-cta .btn { margin-top: 0; white-space: nowrap; }

/* ============================================================
   Responsive — checked at 1100 / 960 / 820 / 700 / 560 / 380
   ============================================================ */
@media (max-width: 960px) {
  .lp-hero-inner { grid-template-columns: 1fr; gap: 2.25rem; }
  .lp-lede { max-width: 54ch; }
  /* 3 tracks: name | desc | tag on row 1, example spanning row 2.
     Both the example and the tag are placed explicitly — the example spans the
     full width and appears before the tag in the DOM, so auto-placement would
     otherwise push the tag down onto a row of its own. */
  .lp-row { grid-template-columns: 7.5rem minmax(0, 1fr) 4.75rem; }
  .lp-row .ex { grid-column: 1 / -1; grid-row: 2; padding-top: 0.15rem; }
  .lp-row .lp-tag { grid-column: 3; grid-row: 1; }
}
@media (max-width: 820px) {
  .lp-head { grid-template-columns: 1fr; align-items: start; gap: 0.85rem; }
  .lp-head p { max-width: 60ch; }
  .lp-flow { grid-template-columns: 1fr; gap: 0; }
  .lp-flow-step { border-top: none; border-left: 2px solid var(--rule); padding: 0.15rem 0 1.5rem 1.1rem; }
  .lp-flow-step:last-child { padding-bottom: 0; }
  .lp-list { grid-template-columns: 1fr; }
  .lp-item:nth-last-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .lp-item:last-child { border-bottom: none; }
  .lp-cta { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  /* 2 tracks: name | tag on row 1, then desc and example stacked beneath. */
  .lp-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.35rem; padding: 1.15rem 0.15rem; }
  .lp-row .lp-tag { grid-column: 2; grid-row: 1; }
  .lp-row .desc { grid-column: 1 / -1; grid-row: 2; }
  .lp-row .ex { grid-column: 1 / -1; grid-row: 3; }
  .lp-strip { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .lp-strip .lp-strip-io { flex-wrap: wrap; }
  .lp-panel .btn-row button { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .lp-hero-glow { transition: none; }
  .lp-panel-bar .lp-live { animation: none; }
  .lp-row, button, .btn, a.card { transition: none; }
}

/* ============================================================
   Cipher Master workspace (hub.html)
   Sidebar + content shell, and every control inside it.
   ============================================================ */

main.page.ws {
  max-width: 1240px;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(0.85rem, 3vw, 1.75rem) clamp(2rem, 4vw, 3rem);
}

.ws-layout {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2.25rem);
  align-items: start;
}

/* ---------------- sidebar ---------------- */
.ws-side { position: sticky; top: 5rem; min-width: 0; }
.ws-greet {
  padding: 0 0.65rem 1rem;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 0.85rem;
}
.ws-greet .hi { display: block; font-size: 0.95rem; font-weight: 700; letter-spacing: -0.015em; }
.ws-greet .sub {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/*
   Ten destinations is too many for a flat list to stay readable, so they are
   grouped: what you do to text, what you do to a cipher you cannot read, and
   the game side. The group labels use the site's monospace accent voice.
*/
.ws-nav { display: flex; flex-direction: column; gap: 0.1rem; }
.ws-nav-label {
  padding: 0 0.75rem;
  margin: 1.15rem 0 0.4rem;
  font-family: var(--mono);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.ws-nav button {
  position: relative;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem 0.55rem 0.75rem;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.895rem;
  font-weight: 500;
  letter-spacing: -0.004em;
  text-align: left;
  box-shadow: none;
  overflow: visible;
  transition: background .15s ease, color .15s ease;
}
.ws-nav button::after { display: none; }
/* The active marker is a rail rather than a filled pill: it reads as position
   in a list instead of as a button that is switched on. */
.ws-nav button::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  transform: translateY(-50%);
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  transition: height .18s cubic-bezier(.2,.7,.3,1);
}
.ws-nav button.active::before { height: 1.4rem; }
.ws-nav button .t {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-nav button > svg {
  width: 1.02rem;
  height: 1.02rem;
  stroke: currentColor;
  flex-shrink: 0;
  opacity: 0.85;
  transition: stroke .15s ease, opacity .15s ease;
}
.ws-nav button:hover {
  background: var(--bg-subtle);
  color: var(--text);
  transform: none;
  filter: none;
  box-shadow: none;
}
.ws-nav button:hover > svg { opacity: 1; }
.ws-nav button.active {
  background: var(--bg-subtle);
  color: var(--text);
  font-weight: 650;
}
/* only the leading icon takes the accent -- not the trailing padlock */
.ws-nav button.active > svg:first-child { stroke: var(--accent); opacity: 1; }
.ws-nav button:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent-line);
}
.ws-nav .badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--warm);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--bg);
}

/* ---------------- content ---------------- */
.ws-main { min-width: 0; }
.ws-section { display: none; }
.ws-section.active { display: block; animation: wsFade .22s ease; }
@keyframes wsFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ws-head { margin-bottom: 1.5rem; }
.ws-head h1 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.028em;
}
.ws-head p { margin: 0; color: var(--muted); font-size: 0.94rem; line-height: 1.6; max-width: 62ch; }

.ws-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: clamp(1.1rem, 2.4vw, 1.65rem);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}
.ws-panel:last-child { margin-bottom: 0; }
.ws-panel > h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.ws-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 0.85rem;
}
.ws-panel-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.015em; }

.muted-note { color: var(--muted); font-size: 0.93rem; line-height: 1.65; }
.opt { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.cipher-note { margin: 0.8rem 0 0; font-size: 0.85rem; color: var(--muted); line-height: 1.55; }
.cipher-note:empty { display: none; }

/* ---------------- overview tiles ---------------- */
.ws-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.ws-tile {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.ws-tile .k {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.ws-tile .v {
  display: block;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.ws-tile .v.sm { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.ws-tile .v.ok { color: var(--success); }
.ws-tile .v.wait { color: var(--warm-text); }

.ws-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.85rem; }
.ws-quick button {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 1.05rem 1.15rem;
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--panel-border);
  transition: box-shadow .18s ease, transform .18s ease;
}
.ws-quick button::after { display: none; }
.ws-quick button:hover {
  box-shadow: inset 0 0 0 1px var(--accent), var(--shadow-md);
  transform: translateY(-2px);
  filter: none;
}
.ws-quick button .t { font-weight: 700; font-size: 0.95rem; letter-spacing: -0.01em; }
.ws-quick button .d { font-weight: 400; font-size: 0.83rem; color: var(--muted); line-height: 1.5; }

/* ---------------- form rows ---------------- */
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.field-grow { flex: 1 1 15rem; min-width: 0; }
.field-row label { margin-top: 0; }

.box-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.75rem; margin-bottom: 0.35rem; min-height: 1.5rem;
}
.box-head label { margin: 0; }
.char-count { font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.btn-row { display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center; margin-top: 1.15rem; }
.btn-row button, .btn-row .btn { margin-top: 0; }
.icon-btn { padding-left: 0.85rem; padding-right: 0.95rem; }
.icon-btn.tiny {
  margin-top: 0; padding: 0.28rem 0.65rem; font-size: 0.76rem; border-radius: 7px;
}
.icon-btn.tiny svg { width: 0.82rem; height: 0.82rem; }
.share-link { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.share-link input { flex: 1; min-width: 0; }
.share-link button, .share-link .btn { margin-top: 0; }

.kbd-hint { font-family: var(--mono); font-size: 0.73rem; color: var(--muted); margin-left: auto; }

/* input / output columns */
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.15rem; margin-top: 1.15rem; }
.io-grid textarea { margin: 0; min-height: 10.5rem; }
.io-grid .result-box { margin-top: 0; min-height: 10.5rem; font-size: 0.9rem; }
.result-box.empty { color: var(--muted); font-family: var(--font); font-style: italic; }

/* ---------------- daily ---------------- */
.daily-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem;
}
.daily-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.015em; }
#dailyCard textarea { margin-top: 0; }

.success-card { border-color: var(--accent-line); background: var(--accent-soft); }
.success-card h2 { margin-top: 0; }
.success-card input { background: #fff; }

/* ---------------- solver ---------------- */
.solve-list { margin-top: 1rem; border-top: 1px solid var(--panel-border); }
.solve-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.7rem 0.35rem;
  border-bottom: 1px solid var(--panel-border);
}
.solve-row:hover { background: var(--bg-subtle); }
.solve-row.best { background: var(--accent-soft); }
.solve-row .lbl {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 600;
  color: var(--muted); letter-spacing: 0.04em; white-space: nowrap;
}
.solve-row.best .lbl { color: var(--accent-dim); }
.solve-row .cand {
  font-family: var(--mono); font-size: 0.84rem; min-width: 0;
  overflow-wrap: anywhere; line-height: 1.5;
}
.solve-row .use { margin: 0; padding: 0.3rem 0.7rem; font-size: 0.76rem; }
.solve-badge {
  font-family: var(--mono); font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-dim); background: #fff;
  border: 1px solid var(--accent-line);
  border-radius: 5px; padding: 0.15rem 0.45rem; white-space: nowrap;
}

/* ---------------- letter-frequency chart ---------------- */
.freq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(1.9rem, 1fr));
  gap: 0.3rem;
  margin-top: 1rem;
  align-items: end;
}
.freq-col { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; min-width: 0; }
/* fixed-height track so every bar shares a baseline and the English marker
   can be positioned absolutely against the same scale */
.freq-track {
  position: relative;
  width: 100%;
  height: 60px;
  display: flex;
  align-items: flex-end;
}
.freq-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
}
/* where English would put this letter */
.freq-expected {
  position: absolute;
  left: -1px; right: -1px;
  height: 0;
  border-top: 2px dotted var(--warm);
  opacity: 0.85;
}
.freq-col .l { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); text-transform: uppercase; }
.freq-col .c { font-family: var(--mono); font-size: 0.62rem; color: var(--muted); }
.freq-col.hot .freq-bar { background: linear-gradient(180deg, var(--warm), #9c6009); }

/* ---------------- key-length spectrum ---------------- */
.spectrum {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0.4rem;
  align-items: end;
  height: 150px;
  margin-top: 1rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--panel-border);
}
.spectrum .ref {
  position: absolute;
  left: 0; right: 0;
  height: 0;
  border-top: 1px dashed var(--panel-border);
  pointer-events: none;
}
.spectrum .ref.eng { border-top-color: var(--success); }
.spectrum .ref.rnd { border-top-color: var(--muted); }
.spec-col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.spec-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--accent-line);
  transition: background .18s ease;
}
.spec-col.peak .spec-bar { background: linear-gradient(180deg, var(--accent), var(--accent-dim)); }
.spec-col .l {
  position: absolute;
  bottom: -1.15rem;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--muted);
}
.spec-col.peak .l { color: var(--accent-dim); font-weight: 700; }
.spectrum-legend {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.spectrum-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.spectrum-legend .sw { width: 1.1rem; height: 0; border-top: 2px dashed var(--muted); display: inline-block; }
.spectrum-legend .sw.eng { border-top-color: var(--success); }

/* ---------------- auto-detect cards ---------------- */
.detect-card {
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--muted);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-top: 0.75rem;
  background: var(--bg-subtle);
}
.detect-card.conf-high { border-left-color: var(--success); }
.detect-card.conf-medium { border-left-color: var(--warm); }
.detect-card.conf-low { border-left-color: var(--muted); }
.detect-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.35rem;
}
.detect-name { font-weight: 700; letter-spacing: -0.015em; }
.detect-conf {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}
.detect-card .muted-note { margin: 0; font-size: 0.87rem; }
.detect-detail {
  margin: 0.5rem 0 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ---------------- n-gram chips ---------------- */
.gram-head {
  margin: 1.1rem 0 0.5rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.gram-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.gram {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: var(--panel);
  font-family: var(--mono);
  font-size: 0.8rem;
}
.gram b { font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.gram i { font-style: normal; font-size: 0.7rem; color: var(--muted); }

.muted-note code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg-subtle);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
}

/* ---------------- my games ---------------- */
.puzzle-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 0.95rem 0; border-bottom: 1px solid var(--panel-border); flex-wrap: wrap;
}
.puzzle-row:last-child { border-bottom: none; }
.puzzle-row .puzzle-title { font-weight: 600; letter-spacing: -0.01em; }
.puzzle-row .puzzle-meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.15rem; }
.row-actions { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.row-actions button, .row-actions .btn { margin-top: 0; padding: 0.42rem 0.8rem; font-size: 0.82rem; }

.stat-pill {
  display: inline-flex; gap: 0.4rem;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
  color: var(--accent-dim); background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px; padding: 0.22rem 0.65rem; white-space: nowrap;
}

.empty-state { text-align: center; padding: 2.25rem 1rem; }
.empty-state h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.empty-state .muted-note { margin: 0 0 0.75rem; }

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  .ws-layout { grid-template-columns: 1fr; }
  .ws-side { position: static; }
  .ws-greet { display: none; }
  /* sidebar becomes a horizontally scrollable tab bar */
  .ws-nav {
    flex-direction: row;
    gap: 0.15rem;
    overflow-x: auto;
    padding-bottom: 0;
    border-bottom: 1px solid var(--panel-border);
    scrollbar-width: thin;
  }
  /* Group headings cannot sit in a horizontal row; the list is short enough to
     scan when scrolling, so they are dropped rather than crammed in sideways. */
  .ws-nav-label { display: none; }
  .ws-nav button {
    width: auto;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.55rem 0.7rem;
    border-radius: 8px 8px 0 0;
  }
  /* the rail becomes an underline, which is what a tab bar wants */
  .ws-nav button::before {
    left: 0.45rem;
    right: 0.45rem;
    top: auto;
    bottom: 0;
    width: auto;
    height: 2px;
    transform: none;
    border-radius: 2px 2px 0 0;
    transition: opacity .18s ease;
    opacity: 0;
  }
  .ws-nav button.active::before { height: 2px; opacity: 1; }
  .ws-nav button.active { background: transparent; }
  .ws-nav .badge-dot { box-shadow: none; }
}
@media (max-width: 760px) {
  .io-grid { grid-template-columns: 1fr; }
  .io-grid .result-box, .io-grid textarea { min-height: 7.5rem; }
}
@media (max-width: 560px) {
  .solve-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.3rem; }
  .solve-row .lbl { grid-column: 1; grid-row: 1; }
  .solve-row .use { grid-column: 2; grid-row: 1; }
  .solve-row .cand { grid-column: 1 / -1; grid-row: 2; }
  .btn-row button { flex: 1 1 auto; }
  .kbd-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ws-section.active { animation: none; }
  .ws-quick button, .ws-nav button, .solve-row { transition: none; }
}

/* ============================================================
   Guest mode — reduced workspace for visitors with no account
   ============================================================ */

/* padlock on the sidebar items a guest can't reach */
.ws-nav button.locked { color: var(--muted); opacity: 0.85; }
.ws-nav button.locked:hover { opacity: 1; }
/* Shown only when the nav item is locked, which only happens in guest mode.
   Driven by CSS because `hidden` does not work on an <svg> from JS. */
.lock-mark { display: none; }
.ws-nav button.locked .lock-mark { display: inline-block; }
.lock-mark {
  width: 0.85rem;
  height: 0.85rem;
  stroke: currentColor;
  flex-shrink: 0;
  opacity: 0.7;
}

/* the "this needs an account" panel that replaces a gated section */
.ws-lock {
  background: var(--panel);
  border: 1px dashed var(--accent-line);
  border-radius: 14px;
  padding: clamp(1.75rem, 4vw, 2.75rem) clamp(1.25rem, 3vw, 2rem);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.ws-lock-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  margin-bottom: 1rem;
}
.ws-lock-icon svg { width: 1.35rem; height: 1.35rem; stroke: var(--accent-dim); }
.ws-lock h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.018em;
}
.ws-lock .muted-note { margin: 0 auto; max-width: 46ch; }
.ws-lock .btn-row { justify-content: center; }

.ws-guest-intro { border: 1px solid var(--accent-line); background: var(--accent-soft); }
.ws-guest-intro .ws-quick button { background: var(--panel); }

/* guest identity chip in the header */
.user-chip.guest .avatar { background: linear-gradient(135deg, #6f687f, #56506b); }
.user-chip.guest .user-email { font-weight: 600; }

/* "or continue as a guest" block on the login / signup pages */
.alt-action {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--panel-border);
  text-align: center;
}
.alt-action .or {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.85rem;
}
.alt-action button { margin-top: 0; }
.alt-action .muted-note {
  margin: 0.85rem auto 0;
  max-width: 40ch;
  font-size: 0.84rem;
}

/* ============================================================
   Spectrograph — drawing canvas and recovered spectrogram
   ============================================================ */
.canvas-wrap {
  position: relative;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  line-height: 0;              /* kill the inline-element gap under the canvas */
}
.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  /* the canvas is a drawing surface, not a page element: never let a drag
     select text or scroll the page instead of painting */
  touch-action: none;
  cursor: crosshair;
}
.canvas-wrap.result canvas { cursor: default; }
.canvas-wrap.result { margin-top: 1rem; }

/* faint pitch/time guides, drawn over the canvas so they cost no audio */
.canvas-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 12.5% 25%;
}
.canvas-wrap.result::after { display: none; }

.tool-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.tool-row button { margin-top: 0; padding: 0.45rem 0.9rem; font-size: 0.85rem; }
.tool-row button.active {
  background: var(--accent-soft);
  color: var(--accent-dim);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
}
.inline-field input[type="range"] { width: 7rem; accent-color: var(--accent); }
.inline-field select { width: auto; padding: 0.4rem 0.6rem; font-size: 0.85rem; }

/* a file input styled as a button, with the real input hidden inside the label */
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

@media (max-width: 560px) {
  .inline-field input[type="range"] { width: 5rem; }
  .tool-row { gap: 0.5rem; }
}

/* ---------- landing: toolkit cards ---------- */
/* Guest callout. The workbench is the part that genuinely needs no account,
   so the offer sits here rather than in the hero. */
.lp-guest {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: clamp(1.2rem, 2.6vw, 1.7rem) clamp(1.3rem, 3vw, 1.9rem);
  margin-bottom: clamp(1.25rem, 2.5vw, 1.75rem);
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid var(--accent-line);
  border-radius: 16px;
}
.lp-guest h3 {
  margin: 0 0 0.3rem;
  font-size: 1.06rem;
  font-weight: 750;
  letter-spacing: -0.015em;
}
.lp-guest p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.65; max-width: 60ch; }
.lp-guest .lp-guest-cta { display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem; }
.lp-guest .lp-guest-cta .btn, .lp-guest .lp-guest-cta button { margin-top: 0; white-space: nowrap; }
.lp-guest .lp-guest-note {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
}
.lp-guest .lp-guest-note a { color: var(--accent-dim); }

/* Deliberately asymmetric: the flagship tool gets a tall column and room to
   show its real output; the other two stack beside it. */
.lp-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(1rem, 2.5vw, 1.5rem);
  align-items: start;
}
.lp-tool {
  min-width: 0;
  padding: 1.6rem 1.5rem;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .2s cubic-bezier(.2,.7,.3,1), box-shadow .2s ease, border-color .2s ease;
}
.lp-tool.wide { grid-row: span 2; }
.lp-tool:hover {
  transform: translateY(-3px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-md);
}
.lp-tool .n {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dim);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 0.24rem 0.7rem;
  margin-bottom: 1rem;
}
.lp-tool h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.25;
}
.lp-tool p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.7; }

/* ---- the real output each tool produces, rendered inside its card ---- */
.lp-demo { margin-top: 1.25rem; }
.lp-demo-cap {
  display: block;
  margin-top: 0.7rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.lp-demo-cap b { color: var(--accent-dim); font-weight: 700; }

/* crack: the ciphertext, then shifts ranked by how English each decode reads */
.cr-cipher {
  display: block;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.55rem;
  border-radius: 7px;
  background: var(--ink);
  color: var(--on-dark, #f7f6fb);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}
.cr-row {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) 2.6rem;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.72rem;
}
.cr-row .s { color: var(--muted); font-size: 0.66rem; }
.cr-row .t { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-row .b { height: 4px; border-radius: 999px; background: var(--panel-border); overflow: hidden; }
.cr-row .b i { display: block; height: 100%; background: var(--panel-border); }
.cr-row.best { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.cr-row.best .s { color: var(--accent-dim); font-weight: 700; }
.cr-row.best .t { color: var(--text); font-weight: 700; }
.cr-row.best .b i { background: var(--accent); }

/* analyse: measured letter frequency, with the English expectation marked */
.fq-chart {
  display: grid;
  grid-template-columns: repeat(26, minmax(0, 1fr));
  align-items: end;
  gap: 2px;
  height: 5.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
}
.fq { position: relative; height: 100%; display: flex; align-items: flex-end; }
.fq b {
  display: block;
  width: 100%;
  height: var(--h);
  min-height: 1px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  opacity: 0.85;
}
/* the tick is where English would put this letter — the gap is the story */
.fq::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: var(--e);
  height: 1px;
  background: var(--warm);
}
.fq i {
  position: absolute;
  left: 0; right: 0; bottom: -1rem;
  font-family: var(--mono);
  font-size: 0.55rem;
  font-style: normal;
  text-align: center;
  color: var(--muted);
}

/* spectrograph: a picture recovered from audio */
.sg-frame {
  padding: 0.5rem;
  border-radius: 9px;
  background: var(--ink);
  /* dark surface on a light page: anything placed in here later needs this,
     or it inherits --text and renders dark on dark */
  color: var(--on-dark, #f7f6fb);
  overflow: hidden;
}
.sg { display: block; width: 100%; height: 5.5rem; fill: #a99cf5; }

@media (max-width: 900px) {
  .lp-tools { grid-template-columns: 1fr; }
  .lp-tool.wide { grid-row: auto; }
  .lp-guest { grid-template-columns: 1fr; }
  .lp-guest .lp-guest-cta { align-items: stretch; }
}
/* 26 letter labels stop fitting long before the bars do; the caption below
   still explains what the chart shows, so drop the labels rather than crush them. */
@media (max-width: 520px) {
  .fq i { display: none; }
  .fq-chart { padding-bottom: 0; }
}

/* ============================================================
   Landing: motion and depth
   Every animation here is switched off under prefers-reduced-motion
   at the bottom of this block.
   ============================================================ */

/* slow drifting colour behind the hero, under the dot grid */
.lp-aurora {
  position: absolute;
  inset: -25%;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(38% 48% at 22% 28%, rgba(108,79,255,0.34), transparent 62%),
    radial-gradient(34% 44% at 78% 18%, rgba(74,214,196,0.15), transparent 62%),
    radial-gradient(44% 40% at 62% 82%, rgba(91,61,240,0.24), transparent 62%);
  filter: blur(34px);
  animation: auroraDrift 26s ease-in-out infinite alternate;
}
@keyframes auroraDrift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1); }
  50%  { transform: translate3d(2%, 2%, 0) scale(1.07); }
  100% { transform: translate3d(-1%, 1.5%, 0) scale(1.03); }
}

/* an oversized cipher disc turning slowly in the corner — the product's own
   iconography used as ornament rather than a generic blob */
.lp-disc {
  position: absolute;
  right: -6%;
  bottom: -32%;
  width: min(430px, 58%);
  height: auto;
  z-index: -2;
  color: #fff;
  opacity: 0.07;
  pointer-events: none;
  animation: discSpin 90s linear infinite;
}
@keyframes discSpin { to { transform: rotate(360deg); } }

/* section rules draw themselves in as the heading arrives */
.lp-head {
  position: relative;
  border-bottom: none;
}
.lp-head::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--rule);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .9s cubic-bezier(.2,.7,.3,1) .1s;
}
.lp-head.visible::after { transform: scaleX(1); }

/* feature icons react to the pointer */
.lp-item .icon svg { transition: transform .3s cubic-bezier(.2,.7,.3,1); }
.lp-item:hover .icon svg { transform: rotate(-14deg) scale(1.14); }

/* toolkit cards get an accent bar that grows on hover */
.lp-tool { position: relative; overflow: hidden; }
.lp-tool::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), #4ad6c4);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .4s cubic-bezier(.2,.7,.3,1);
}
.lp-tool:hover::before { transform: scaleX(1); }

/* cipher rows slide in one after another, and mark the row under the pointer */
.lp-table.visible .lp-row {
  animation: rowIn .5s cubic-bezier(.2,.7,.3,1) backwards;
}
.lp-table.visible .lp-row:nth-child(1) { animation-delay: .05s; }
.lp-table.visible .lp-row:nth-child(2) { animation-delay: .11s; }
.lp-table.visible .lp-row:nth-child(3) { animation-delay: .17s; }
.lp-table.visible .lp-row:nth-child(4) { animation-delay: .23s; }
.lp-table.visible .lp-row:nth-child(5) { animation-delay: .29s; }
.lp-table.visible .lp-row:nth-child(6) { animation-delay: .35s; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.lp-row { position: relative; }
.lp-row::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform .22s ease;
}
.lp-row:hover::before { transform: scaleY(1); }
.scramble-out { color: var(--text); font-weight: 600; }

/* the demo panel lifts very slightly, so the hero does not feel static */
.lp-panel { animation: panelFloat 9s ease-in-out infinite alternate; }
@keyframes panelFloat { from { transform: translateY(0); } to { transform: translateY(-7px); } }

/* the closing CTA pulses its glow gently */
.lp-cta::before { animation: ctaPulse 7s ease-in-out infinite alternate; }
@keyframes ctaPulse { from { opacity: .75; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .lp-aurora, .lp-disc, .lp-panel, .lp-cta::before { animation: none; }
  .lp-head::after { transition: none; transform: scaleX(1); }
  .lp-table.visible .lp-row { animation: none; }
  .lp-item:hover .icon svg { transform: none; }
}

/* ============================================================
   Auto-Solve — progress, the interactive key grid, Kasiski
   ============================================================ */
.nav-new {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dim);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
}

/* progress while the model loads and the search runs */
.auto-load { margin-top: 1rem; }
.auto-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  box-shadow: inset 0 0 0 1px var(--panel-border);
  overflow: hidden;
}
.auto-bar i {
  display: block;
  height: 100%;
  width: 2%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dim) 100%);
  transition: width .3s ease;
}
.auto-stat {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
}

/*
   The key grid. Each cell is one ciphertext letter, what it currently reads as,
   how often it occurs, and a pin. Auto-fitting rather than a fixed column count
   so it stays usable from a phone to a wide monitor.
*/
.keygrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.45rem;
  margin-top: 1rem;
}
.keycell {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  background: var(--panel);
  position: relative;
}
.keycell.pinned { border-color: var(--accent); background: var(--accent-soft); }
/* a letter that never occurs in this ciphertext cannot be checked, so say so */
.keycell.unused { opacity: 0.5; }
.keycell .kc-from {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}
.keycell .kc-arrow { color: var(--muted); font-size: 0.8rem; }
.keycell .kc-to {
  width: auto;
  min-width: 3.2rem;
  padding: 0.2rem 0.3rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
}
/* occurrence count as a hairline under the cell — information without clutter */
.keycell .kc-freq {
  position: absolute;
  left: 0.5rem; right: 0.5rem; bottom: 2px;
  height: 2px;
  border-radius: 999px;
  background: var(--panel-border);
  overflow: hidden;
}
.keycell .kc-freq::before {
  content: "";
  display: block;
  height: 100%;
  width: var(--w, 0%);
  background: var(--accent);
  opacity: 0.55;
}
.keycell .kc-pin {
  margin: 0;
  padding: 0.16rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--panel-border);
  border-radius: 5px;
}
.keycell .kc-pin::after { display: none; }
.keycell .kc-pin:hover {
  transform: none; filter: none;
  color: var(--accent-dim);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.keycell.pinned .kc-pin {
  color: #fff;
  background: var(--accent);
  box-shadow: none;
}

/* rows in "other cipher families" */
.solve-row .sr-label {
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
}
.solve-row .sr-detail {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}
.solve-row .sr-text {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.solve-row .sr-score {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
}
#autoOtherList .solve-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
}

/* Kasiski: votes per candidate key length, then the repeats behind them */
.kas-votes {
  display: grid;
  grid-template-columns: repeat(19, minmax(0, 1fr));
  align-items: end;
  gap: 3px;
  height: 5rem;
  margin: 1rem 0 1.4rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--panel-border);
}
.kas-col { position: relative; height: 100%; display: flex; align-items: flex-end; }
.kas-col b {
  display: block;
  width: 100%;
  height: var(--h);
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--panel-border);
}
.kas-col.best b { background: var(--accent); }
.kas-col i {
  position: absolute;
  left: 0; right: 0; bottom: -1.05rem;
  font-family: var(--mono);
  font-size: 0.58rem;
  font-style: normal;
  text-align: center;
  color: var(--muted);
}
.kas-col.best i { color: var(--accent-dim); font-weight: 700; }
.kas-reps { margin-top: 0.25rem; }
.kas-row {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--panel-border);
  font-size: 0.82rem;
}
.kas-row:first-child { border-top: none; }
.kas-row code {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent-dim);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
}
.kas-row span { color: var(--muted); font-family: var(--mono); font-size: 0.74rem; }

@media (max-width: 560px) {
  .keygrid { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
  #autoOtherList .solve-row { grid-template-columns: minmax(0, 1fr) auto; }
  #autoOtherList .solve-row .sr-text { grid-column: 1 / -1; }
  .kas-votes { grid-template-columns: repeat(19, minmax(0, 1fr)); gap: 2px; }
  .kas-col i { font-size: 0.5rem; }
}

/* ============================================================
   Daily challenge — gate, arena, clock, toolbelt, result
   ============================================================ */
.daily-gate { text-align: left; }
.daily-gate h2 {
  margin: 0.35rem 0 0.3rem;
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}
.gate-sub {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--accent-dim);
}
.gate-list {
  margin: 0.9rem 0 1.2rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}
.gate-list li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}
/* the run is ordered, so number it rather than bulleting it */
.gate-run { counter-reset: gaterun; }
.gate-run li { padding-left: 1.6rem; }
.gate-run li::before {
  counter-increment: gaterun;
  content: counter(gaterun);
  top: 0;
  width: auto; height: auto;
  border-radius: 0;
  background: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-dim);
}
.gate-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.55em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.gate-list b { color: var(--text); font-weight: 650; }
.gate-fine {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
}

/* --- the round itself --- */
.arena-top { position: relative; }
.arena-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}
.arena-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.arena-clock { text-align: right; line-height: 1; }
/* tabular-nums so the clock does not jitter as the digits change */
.arena-time {
  display: block;
  font-family: var(--mono);
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.arena-clock-label {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.arena-cipher {
  font-size: 0.95rem;
  line-height: 1.85;
  letter-spacing: 0.09em;
  background: var(--ink);
  color: var(--on-dark, #f7f6fb);
  border-color: transparent;
  user-select: all;          /* one click selects the whole ciphertext */
}

/* --- toolbelt --- */
.belt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding-bottom: 0.55rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
}
.belt-tabs button {
  margin: 0;
  padding: 0.38rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  box-shadow: none;
}
.belt-tabs button::after { display: none; }
.belt-tabs button:hover {
  transform: none; filter: none;
  background: var(--bg-subtle);
  color: var(--text);
  box-shadow: none;
}
.belt-tabs button.active {
  background: var(--accent-soft);
  color: var(--accent-dim);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.belt-panel > .muted-note:first-child { margin-top: 0; }
#beltQuick .solve-row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
}
#beltQuick .sr-text { font-family: var(--mono); font-size: 0.78rem; }
#beltNotes { min-height: 9rem; }

/* --- solved --- */
.daily-done { text-align: center; }
.done-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem; height: 3rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--success);
  margin-bottom: 0.6rem;
}
.done-tick svg { width: 1.5rem; height: 1.5rem; }
.daily-done h2 { margin: 0 0 0.2rem; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.done-time {
  margin: 0.2rem 0 0.6rem;
  font-family: var(--mono);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-dim);
  line-height: 1;
}
.done-time:empty { display: none; }
.daily-done .muted-note { max-width: 46ch; margin-left: auto; margin-right: auto; }
.done-history { margin-top: 1.5rem; text-align: left; max-width: 22rem; margin-inline: auto; }
.done-history h3 {
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.done-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.55rem;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
}
.done-row.best {
  background: var(--accent-soft);
  color: var(--accent-dim);
  font-weight: 700;
}

@media (max-width: 560px) {
  .arena-head { flex-direction: column-reverse; align-items: flex-start; }
  .arena-clock { text-align: left; }
  #beltQuick .solve-row { grid-template-columns: minmax(0, 1fr) auto; }
  #beltQuick .sr-text { grid-column: 1 / -1; }
}

/* ---- daily run: the checkpoint track ---- */
.ckpt-track {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  list-style: none;
  margin: 1.1rem 0 0;
  padding: 0;
}
.ckpt-step {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  background: var(--bg-subtle);
  box-shadow: inset 0 0 0 1px var(--panel-border);
}
.ckpt-step .ckpt-n {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem; height: 1.35rem;
  flex-shrink: 0;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--panel-border);
  color: var(--muted);
}
.ckpt-step .ckpt-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* the one you are on */
.ckpt-step.now {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.ckpt-step.now .ckpt-n { background: var(--accent); color: #fff; }
.ckpt-step.now .ckpt-name { color: var(--accent-dim); font-weight: 700; }
/* finished ones stay readable and can be reopened */
.ckpt-step.done { cursor: pointer; }
.ckpt-step.done .ckpt-n { background: var(--success); color: #fff; }
.ckpt-step.done .ckpt-name { color: var(--text); }
.ckpt-step.done:hover { box-shadow: inset 0 0 0 1px var(--accent-line); }
.ckpt-step.done:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
/* the ones still to come are deliberately quiet */
.ckpt-step.todo { opacity: 0.65; }

.ckpt-panel .sg-frame { margin: 0.9rem 0 0.2rem; }
#signalCanvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
#signalAnswer {
  font-family: var(--mono);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  max-width: 22rem;
}

@media (max-width: 640px) {
  /* three labelled steps will not fit; keep the numbers and drop the names */
  .ckpt-track { gap: 0.3rem; }
  .ckpt-step { flex: 0 0 auto; padding: 0.5rem 0.6rem; }
  .ckpt-step.now { flex: 1 1 auto; }
  .ckpt-step:not(.now) .ckpt-name { display: none; }
}

/* graduated hints: a nudge first, the answer only if you insist */
.ckpt-hint {
  margin-top: 0.7rem;
  border-top: 1px solid var(--panel-border);
  padding-top: 0.6rem;
}
.ckpt-hint + .ckpt-hint { border-top: none; padding-top: 0.2rem; margin-top: 0.2rem; }
.ckpt-hint summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  list-style: none;
}
.ckpt-hint summary::-webkit-details-marker { display: none; }
.ckpt-hint summary::before { content: "+ "; color: var(--accent); font-weight: 700; }
.ckpt-hint[open] summary::before { content: "\2212 "; }
.ckpt-hint summary:hover { color: var(--accent-dim); }
.ckpt-hint p {
  margin: 0.5rem 0 0.2rem;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--muted);
}
#signalRead {
  font-family: var(--mono);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  max-width: 22rem;
}
