/* ============================================================
   RivenKey — visual identity
   Instrument brass on night-sky indigo; engraved-plate panels;
   a fine coordinate-graticule ground. Fraunces / Work Sans /
   IBM Plex Mono. Light and dark themes are token-driven.
   ============================================================ */

/* ---- Typefaces (self-hosted to satisfy font-src 'self') ---- */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 720;
  font-display: swap;
  src: url("fonts/fraunces-roman-variable.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 300 620;
  font-display: swap;
  src: url("fonts/fraunces-italic-variable.woff2") format("woff2");
}
@font-face {
  font-family: "Work Sans";
  font-style: normal;
  font-weight: 300 720;
  font-display: swap;
  src: url("fonts/work-sans-variable.woff2") format("woff2");
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/plex-mono-500.woff2") format("woff2");
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/plex-mono-600.woff2") format("woff2");
}

/* ---- Tokens ---- */
:root {
  color-scheme: dark;

  /* night-sky neutrals, warmed slightly toward brass */
  --ink: #0a1020;
  --ink-deep: #070c18;
  --panel: #101a2e;
  --panel-raised: #16233a;
  --panel-inset: #0b1424;
  --plate-edge: #24344f;

  --hairline: rgba(196, 168, 120, 0.16);
  --hairline-strong: rgba(210, 178, 122, 0.34);
  --graticule: rgba(150, 170, 205, 0.05);

  --text: #eef2f8;
  --text-dim: #c3cddd;
  --muted: #8794ab;
  --faint: #5d6a82;

  /* single accent: instrument brass */
  --brass: #d29a52;
  --brass-bright: #f0b96f;
  --brass-deep: #3a2c14;
  --brass-wash: rgba(210, 154, 82, 0.09);
  --brass-line: rgba(210, 154, 82, 0.28);

  --danger: #d76156;
  --danger-bright: #f0897e;
  --danger-wash: rgba(215, 97, 86, 0.1);

  --sans: "Work Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --mono: "Plex Mono", "SFMono-Regular", Consolas, monospace;

  --plate-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 26px 60px -28px rgba(0, 0, 0, 0.7);
  --radius: 4px;

  --edge-x: clamp(20px, 5vw, 60px);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    /* aged-chart paper, warm and desaturated */
    --ink: #ece5d6;
    --ink-deep: #e3daca;
    --panel: #f6f1e6;
    --panel-raised: #fdfaf3;
    --panel-inset: #efe8d8;
    --plate-edge: #d8ccb2;

    --hairline: rgba(70, 52, 24, 0.16);
    --hairline-strong: rgba(70, 52, 24, 0.32);
    --graticule: rgba(80, 66, 40, 0.06);

    --text: #241d12;
    --text-dim: #443a28;
    --muted: #6f6650;
    --faint: #9a8f76;

    --brass: #9a6a1c;
    --brass-bright: #b5822c;
    --brass-deep: #f0e4cc;
    --brass-wash: rgba(154, 106, 28, 0.08);
    --brass-line: rgba(154, 106, 28, 0.32);

    --danger: #b0362b;
    --danger-bright: #c24a3d;
    --danger-wash: rgba(176, 54, 43, 0.09);

    --plate-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 22px 48px -30px rgba(60, 45, 20, 0.4);
  }
}

/* explicit toggles must win over the media query in both directions */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #0a1020; --ink-deep: #070c18; --panel: #101a2e; --panel-raised: #16233a;
  --panel-inset: #0b1424; --plate-edge: #24344f;
  --hairline: rgba(196, 168, 120, 0.16); --hairline-strong: rgba(210, 178, 122, 0.34);
  --graticule: rgba(150, 170, 205, 0.05);
  --text: #eef2f8; --text-dim: #c3cddd; --muted: #8794ab; --faint: #5d6a82;
  --brass: #d29a52; --brass-bright: #f0b96f; --brass-deep: #3a2c14;
  --brass-wash: rgba(210, 154, 82, 0.09); --brass-line: rgba(210, 154, 82, 0.28);
  --danger: #d76156; --danger-bright: #f0897e; --danger-wash: rgba(215, 97, 86, 0.1);
  --plate-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 26px 60px -28px rgba(0, 0, 0, 0.7);
}
:root[data-theme="light"] {
  color-scheme: light;
  --ink: #ece5d6; --ink-deep: #e3daca; --panel: #f6f1e6; --panel-raised: #fdfaf3;
  --panel-inset: #efe8d8; --plate-edge: #d8ccb2;
  --hairline: rgba(70, 52, 24, 0.16); --hairline-strong: rgba(70, 52, 24, 0.32);
  --graticule: rgba(80, 66, 40, 0.06);
  --text: #241d12; --text-dim: #443a28; --muted: #6f6650; --faint: #9a8f76;
  --brass: #9a6a1c; --brass-bright: #b5822c; --brass-deep: #f0e4cc;
  --brass-wash: rgba(154, 106, 28, 0.08); --brass-line: rgba(154, 106, 28, 0.32);
  --danger: #b0362b; --danger-bright: #c24a3d; --danger-wash: rgba(176, 54, 43, 0.09);
  --plate-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 22px 48px -30px rgba(60, 45, 20, 0.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, textarea, input { font: inherit; }
button { color: inherit; }
button, .drop-zone { -webkit-tap-highlight-color: transparent; }

::selection { background: var(--brass); color: var(--ink-deep); }

:focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---- Coordinate graticule ground ---- */
.chart-ground {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(var(--graticule) 1px, transparent 1px),
    linear-gradient(90deg, var(--graticule) 1px, transparent 1px),
    radial-gradient(1100px 640px at 78% -8%, var(--brass-wash), transparent 60%),
    radial-gradient(900px 700px at 0% 108%, var(--brass-wash), transparent 62%);
  background-size: 72px 72px, 72px 72px, 100% 100%, 100% 100%;
}

/* ---- Shared typographic devices ---- */
.eyebrow, .step-label {
  color: var(--brass);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; }

/* ---- Header ---- */
.site-header {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px var(--edge-x) 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--hairline);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.brand > span:last-child > span { font-style: italic; color: var(--brass); }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--brass-line);
  border-radius: 50%;
  background: var(--brass-wash);
}
.brand-mark svg { width: 24px; fill: none; stroke: var(--brass); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark svg path:first-child { fill: var(--brass-wash); }

.privacy-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 14px;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  background: var(--panel);
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 0 0 var(--brass-line);
  animation: sweep 2.6s ease-out infinite;
}
@keyframes sweep {
  0% { box-shadow: 0 0 0 0 var(--brass-line); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

main { width: 100%; }

/* ---- Hero: asymmetric almanac spread ---- */
.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) var(--edge-x) clamp(56px, 8vw, 104px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
}
.hero-copy { max-width: 34ch; }
.hero .eyebrow { display: block; margin-bottom: 22px; }
.hero h1 {
  margin: 0 0 24px;
  font-size: clamp(46px, 6.4vw, 82px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.hero h1 span { font-style: italic; font-weight: 400; color: var(--brass); }
.hero-copy > p {
  margin: 0;
  max-width: 44ch;
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1.7;
}
.trust-row {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.trust-row span { display: inline-flex; gap: 8px; align-items: center; }
.trust-row svg { width: 15px; height: 15px; color: var(--brass); }

/* ---- Hero figure: secret-split diagram ---- */
.hero-figure { margin: 0; justify-self: center; max-width: 420px; width: 100%; }
.split-diagram { width: 100%; height: auto; overflow: visible; }
.split-diagram .share-line {
  fill: none;
  stroke: var(--brass-line);
  stroke-width: 1.4;
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
  animation: draw-line 0.9s ease-out forwards;
}
.split-diagram .share-line:nth-of-type(2) { animation-delay: 0.08s; }
.split-diagram .share-line:nth-of-type(3) { animation-delay: 0.16s; }
.split-diagram .share-line:nth-of-type(4) { animation-delay: 0.24s; }
.split-diagram .share-line:nth-of-type(5) { animation-delay: 0.32s; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
.split-diagram .share-node {
  fill: var(--panel);
  stroke: var(--brass);
  stroke-width: 2;
  opacity: 0;
  animation: node-in 0.4s ease-out forwards;
}
.split-diagram .share-node { animation-delay: 0.5s; }
.split-diagram .share-node:nth-of-type(2) { animation-delay: 0.58s; }
.split-diagram .share-node:nth-of-type(3) { animation-delay: 0.66s; }
.split-diagram .share-node:nth-of-type(4) { animation-delay: 0.74s; }
.split-diagram .share-node:nth-of-type(5) { animation-delay: 0.82s; }
@keyframes node-in { from { opacity: 0; } to { opacity: 1; } }
.split-diagram .secret-core { fill: var(--brass-wash); stroke: var(--brass); stroke-width: 2; }
.split-diagram .secret-glyph { fill: var(--brass); }
.split-diagram .secret-glyph-line { fill: none; stroke: var(--brass); stroke-width: 2; stroke-linecap: round; }
.hero-figure figcaption {
  margin-top: 18px;
  padding-left: 14px;
  border-left: 1px solid var(--hairline-strong);
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  line-height: 1.5;
}

/* ---- Engraved plate: the workspace ---- */
.workspace {
  max-width: 1000px;
  margin: 0 auto;
  border: 1px solid var(--plate-edge);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--plate-shadow);
  overflow: hidden;
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--hairline);
  background: var(--panel-inset);
}
.tab {
  position: relative;
  border: 0;
  background: transparent;
  padding: 22px 30px;
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.tab:first-child { border-right: 1px solid var(--hairline); }
.tab::after {
  content: "";
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: transparent;
}
.tab:hover { color: var(--text-dim); }
.tab.active { color: var(--text); background: var(--panel); }
.tab.active::after { background: var(--brass); }
.tab-number {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: 0.05em;
}
.tab.active .tab-number { color: var(--brass); }

.panel { animation: fade-in 0.32s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.form-section {
  padding: clamp(28px, 4vw, 46px) clamp(24px, 4vw, 48px) clamp(24px, 3.4vw, 40px);
  border-bottom: 1px solid var(--hairline);
}
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.section-heading h2 {
  margin: 8px 0 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.character-count, .share-counter {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.character-count strong, .share-counter strong {
  color: var(--text-dim);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  padding: 18px 19px;
  outline: none;
  background: var(--panel-inset);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  caret-color: var(--brass);
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea::placeholder { color: var(--faint); }
textarea:focus {
  border-color: var(--brass-line);
  box-shadow: 0 0 0 3px var(--brass-wash);
}
.field-note {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 12px;
}
.field-note svg { width: 14px; color: var(--brass); }

/* ---- Parameters ---- */
.parameter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 48px); }
.parameter-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.parameter-title label { color: var(--text-dim); font-size: 13px; font-weight: 600; }
.parameter-title output {
  min-width: 44px; height: 36px;
  display: grid; place-items: center;
  background: var(--brass-deep);
  border: 1px solid var(--brass-line);
  border-radius: var(--radius);
  color: var(--brass-bright);
  font-family: var(--mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
input[type="range"] {
  width: 100%; height: 2px;
  margin: 24px 0 9px;
  appearance: none;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brass) var(--fill, 30%), var(--plate-edge) var(--fill, 30%));
  outline: 0;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px; height: 18px;
  border: 3px solid var(--brass);
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--brass-wash);
  cursor: pointer;
  transition: transform 0.12s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border: 3px solid var(--brass);
  border-radius: 50%;
  background: var(--panel);
  cursor: pointer;
}
.range-labels {
  display: flex; justify-content: space-between;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.rule-summary {
  display: flex; align-items: center; gap: 15px;
  margin-top: 34px;
  padding: 16px 18px;
  border: 1px solid var(--brass-line);
  border-radius: var(--radius);
  background: var(--brass-wash);
}
.rule-icon {
  width: 36px; height: 36px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--brass-line);
  color: var(--brass);
}
.rule-icon svg { width: 18px; }
.rule-summary p { margin: 0; color: var(--text-dim); font-size: 13px; line-height: 1.55; }
.rule-summary strong { color: var(--brass-bright); font-variant-numeric: tabular-nums; }

/* ---- Form actions ---- */
.form-actions {
  min-height: 92px;
  padding: 22px clamp(24px, 4vw, 48px);
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.form-actions p { display: flex; align-items: center; gap: 9px; margin: 0; color: var(--muted); font-size: 12px; }
.form-actions p svg { width: 15px; color: var(--brass); }

button { border: 0; }
.primary-button, .secondary-button, .ghost-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 11px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.primary-button {
  min-width: 232px;
  padding: 15px 22px;
  background: var(--brass);
  color: var(--ink-deep);
  box-shadow: 0 8px 22px -12px var(--brass);
}
.primary-button:hover { background: var(--brass-bright); transform: translateY(-1px); }
.primary-button svg { width: 16px; }
.primary-button:disabled { opacity: 0.55; cursor: wait; transform: none; }

/* ---- Encrypt result ---- */
.result-view { animation: fade-in 0.32s ease; }
.success-banner {
  padding: clamp(28px, 4vw, 46px) clamp(24px, 4vw, 48px);
  display: flex; align-items: flex-start; gap: 19px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(105deg, var(--brass-wash), transparent 60%);
}
.success-icon {
  width: 48px; height: 48px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--brass-bright);
  border: 1px solid var(--brass-line);
  background: var(--brass-wash);
}
.success-icon svg { width: 22px; }
.success-banner h2 { margin: 8px 0 8px; font-size: 26px; letter-spacing: -0.01em; }
.success-banner p { margin: 0; color: var(--muted); font-size: 13px; }

.download-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 14px;
  padding: clamp(24px, 3.4vw, 38px) clamp(24px, 4vw, 48px) 20px;
}
.download-card {
  min-height: 142px;
  padding: 22px;
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--panel-inset);
}
.download-card.featured {
  flex-wrap: wrap;
  border-color: var(--brass-line);
  background: var(--brass-wash);
}
.file-mark {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--radius);
  border: 1px solid var(--brass-line);
  background: var(--brass-wash);
  color: var(--brass);
}
.file-mark.subtle { border-color: var(--hairline); background: transparent; color: var(--muted); }
.file-mark svg { width: 20px; }
.download-copy { min-width: 0; flex: 1; }
.download-copy span {
  color: var(--brass);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.download-copy h3 {
  margin: 6px 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text);
  font-size: 16px;
}
.download-copy p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.secondary-button {
  width: 100%;
  padding: 13px;
  background: transparent;
  border: 1px solid var(--brass-line);
  color: var(--brass-bright);
}
.secondary-button:hover { background: var(--brass-wash); }
.secondary-button svg { width: 15px; }
.icon-button {
  width: 40px; height: 40px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.icon-button:hover { color: var(--brass); border-color: var(--brass-line); }
.icon-button svg { width: 16px; }

.shares-heading {
  padding: 14px clamp(24px, 4vw, 48px) 16px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
}
.shares-heading h3 { margin: 6px 0 0; font-size: 19px; }
.text-button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s;
}
.text-button:hover { color: var(--brass); }
.text-button svg { width: 14px; }

.shares-list {
  margin: 0 clamp(24px, 4vw, 48px) 34px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.share-item {
  padding: 13px 15px;
  display: flex; align-items: center; gap: 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--panel-inset);
  transition: border-color 0.15s;
}
.share-item:hover { border-color: var(--brass-line); }
.share-index {
  width: 30px; height: 30px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--brass-line);
  background: var(--brass-wash);
  color: var(--brass);
  font-family: var(--mono);
  font-size: 11px;
}
.share-meta { min-width: 0; flex: 1; }
.share-meta strong { display: block; color: var(--text-dim); font-size: 13px; font-weight: 600; }
.share-meta span {
  display: block; margin-top: 3px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}
.share-item .icon-button { width: 32px; height: 32px; }

/* ---- Secure / Visible mode toggle ---- */
.mode-toggle {
  margin: clamp(24px, 3.4vw, 34px) clamp(24px, 4vw, 48px) 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--panel-inset);
}
.mode-option {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.mode-option:hover { color: var(--text-dim); }
.mode-option svg { width: 20px; flex: 0 0 auto; }
.mode-copy { display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.mode-copy strong {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.mode-copy { font-size: 12px; }
.mode-option.active {
  border-color: var(--brass-line);
  background: var(--brass-wash);
  color: var(--text-dim);
}
.mode-option.active svg { color: var(--brass); }
.mode-option.active .mode-copy strong { color: var(--brass-bright); }

.secure-view, .visible-view { animation: fade-in 0.28s ease; }

/* ---- Visible mode: on-screen reveal ---- */
.visible-view { padding: clamp(20px, 3vw, 30px) clamp(24px, 4vw, 48px) clamp(12px, 2vw, 20px); }
.reveal-warning {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 18px;
  margin-bottom: 26px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: var(--danger-wash);
}
.reveal-warning svg { width: 20px; flex: 0 0 auto; color: var(--danger-bright); margin-top: 1px; }
.reveal-warning p { margin: 0; color: var(--text-dim); font-size: 13px; line-height: 1.55; }
.reveal-warning strong { color: var(--danger-bright); font-weight: 600; }

.reveal-shares { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.reveal-block { border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.reveal-block + .reveal-block { margin-top: 0; }
.reveal-head {
  padding: 13px 17px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--panel-inset);
}
.reveal-head h3 { margin: 4px 0 0; font-size: 17px; }
.reveal-body {
  max-height: 220px;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  background: var(--panel-inset);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
}
.reveal-copy { flex: 0 0 auto; }

.result-actions {
  padding: 22px clamp(24px, 4vw, 48px);
  display: flex; justify-content: center;
  border-top: 1px solid var(--hairline);
}
.ghost-button { padding: 12px 18px; background: transparent; color: var(--muted); }
.ghost-button:hover { color: var(--text); background: var(--brass-wash); }
.ghost-button svg { width: 15px; }

/* ---- Decrypt inputs ---- */
.content-toggle { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.content-toggle [aria-pressed="true"] { color: var(--brass); border-color: var(--brass); background: var(--brass-wash); }
.selected-images { padding: 0; list-style: none; }
.selected-images li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.selected-images li > span { overflow-wrap: anywhere; font-size: 13px; }
.selected-images li > div { display: flex; gap: 12px; flex-shrink: 0; }
.selected-images button { min-width: 28px; min-height: 32px; }
.selected-images button:disabled { opacity: 0.35; cursor: default; }
.recovered-images-section { margin: clamp(28px, 4vw, 38px) clamp(24px, 4vw, 48px); }
.recovered-images { display: grid; gap: 24px; }
.recovered-image { padding: 20px; border: 1px solid var(--hairline); border-radius: var(--radius); min-width: 0; }
.recovered-image h3 { margin: 0 0 18px; overflow-wrap: anywhere; font-size: 16px; }
.recovered-image img { display: block; max-width: 100%; height: auto; margin: 0 auto 20px; background: white; }
.recovered-image a { display: inline-flex; text-decoration: none; }
.drop-zone:focus-within { outline: 2px solid var(--brass); outline-offset: 3px; }
.drop-zone {
  position: relative;
  min-height: 130px;
  padding: 24px;
  display: flex; align-items: center; justify-content: center; gap: 17px;
  border: 1px dashed var(--brass-line);
  border-radius: var(--radius);
  background: var(--brass-wash);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--brass); background: var(--brass-wash); border-style: solid; }
.drop-zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-zone > svg { width: 30px; color: var(--brass); }
.drop-zone p { margin: 0; }
.drop-zone strong, .drop-zone span { display: block; }
.drop-zone strong { color: var(--text-dim); font-size: 14px; font-weight: 600; }
.drop-zone span { margin-top: 6px; color: var(--muted); font-size: 11px; }
.drop-zone.compact { min-height: 104px; }

.or-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.or-divider::before, .or-divider::after { content: ""; height: 1px; flex: 1; background: var(--hairline); }
.code-input { font-family: var(--mono); font-size: 11px; }

.loaded-shares { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.loaded-share {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
}
.loaded-share button { padding: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; }
.loaded-share button:hover { color: var(--danger-bright); }

.recovered-message {
  margin: clamp(28px, 4vw, 38px) clamp(24px, 4vw, 48px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}
.recovered-heading {
  padding: 13px 18px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--hairline);
  background: var(--panel-inset);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.recovered-message pre {
  max-height: 440px;
  margin: 0;
  padding: 22px;
  overflow: auto;
  color: var(--text-dim);
  background: var(--panel-inset);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- How it works: almanac table ---- */
.how-it-works {
  max-width: 1100px;
  margin: clamp(90px, 12vw, 140px) auto clamp(96px, 12vw, 140px);
  padding: 0 var(--edge-x);
}
.section-intro h2 {
  margin: 12px 0 44px;
  font-size: clamp(30px, 4.4vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.section-intro h2 em { font-style: italic; color: var(--brass); }
.process-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--hairline-strong);
  border-bottom: 1px solid var(--hairline-strong);
}
.process-grid article {
  position: relative;
  padding: 34px 28px 34px;
  border-right: 1px solid var(--hairline);
}
.process-grid article:last-child { border-right: 0; }
.process-grid article > span {
  position: absolute; top: 22px; right: 22px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}
.process-grid article > svg { width: 26px; color: var(--brass); }
.process-grid h3 { margin: 24px 0 11px; font-size: 20px; }
.process-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

/* ---- Footer ---- */
footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px var(--edge-x) 52px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  border-top: 1px solid var(--hairline);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.brand.small { font-size: 17px; }
.brand.small .brand-mark { width: 27px; height: 27px; }
.brand.small svg { width: 18px; }
footer p { margin: 0; font-style: italic; font-family: var(--serif); font-size: 13px; color: var(--muted); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  z-index: 20;
  left: 50%; bottom: 28px;
  padding: 13px 18px;
  border: 1px solid var(--brass-line);
  border-radius: var(--radius);
  background: var(--panel-raised);
  color: var(--text);
  box-shadow: var(--plate-shadow);
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--danger); color: var(--danger-bright); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 880px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .hero-copy { max-width: none; }
  .hero-figure { grid-row: 1; max-width: 300px; justify-self: start; }
}

@media (max-width: 720px) {
  .workspace { margin: 0 16px; }
  .download-grid { grid-template-columns: 1fr; }
  .process-grid { grid-template-columns: 1fr 1fr; }
  .process-grid article:nth-child(2) { border-right: 0; }
  .process-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--hairline); }
}

@media (max-width: 520px) {
  .site-header { padding: 20px 18px 16px; }
  .privacy-pill { font-size: 0; gap: 0; padding: 9px; }
  .privacy-pill .pulse-dot { width: 8px; height: 8px; }
  .hero-figure { align-self: center; justify-self: center; }
  .trust-row { gap: 8px 16px; }
  .tab { padding: 18px 16px; font-size: 15px; }
  .tab-number { display: none; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .character-count { display: none; }
  .parameter-grid, .shares-list { grid-template-columns: 1fr; gap: 26px; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions p { justify-content: center; }
  .primary-button { width: 100%; }
  .success-banner { flex-direction: column; }
  .mode-toggle { grid-template-columns: 1fr; }
  .download-card { min-height: auto; }
  .process-grid { grid-template-columns: 1fr; }
  .process-grid article,
  .process-grid article:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--hairline); }
  .process-grid article:last-child { border-bottom: 0; }
  footer { flex-direction: column; align-items: flex-start; }
}

/* ---- Motion preferences ---- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .split-diagram .share-line { stroke-dashoffset: 0; }
  .split-diagram .share-node { opacity: 1; }
}
