/* =========================================================================
   anony.ch — "Swiss Precision Privacy"
   International Typographic Style: hairlines, strict grid, mono numerals,
   one accent colour (Swiss red) and one verification colour (emerald).
   ========================================================================= */

:root {
  color-scheme: light;

  --paper: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --grid: #e2e8f0;
  --grid-strong: #cbd5e1;
  --red: #dc2626;
  --red-deep: #b91c1c;
  --red-wash: #fef2f2;
  --emerald: #10b981;
  --emerald-deep: #047857;
  --emerald-wash: #ecfdf5;
  --amber: #b45309;
  --amber-wash: #fffbeb;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', 'Noto Sans Arabic',
    'Noto Sans SC', 'Microsoft YaHei', 'Hiragino Sans', 'Yu Gothic UI', 'Noto Sans JP', 'Malgun Gothic',
    Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  --shell: 1180px;
  --rail: 48px;
  --radius: 2px;
  --shadow: 0 1px 1px rgba(15, 23, 42, 0.03), 0 18px 40px -28px rgba(15, 23, 42, 0.28);
  --drawer-h: 46px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme='dark'] {
  color-scheme: dark;

  --paper: #090d16;
  --surface: #111827;
  --surface-2: #0d1420;
  --ink: #e6ebf3;
  --ink-soft: #c7d2e0;
  --muted: #93a1b5;
  --muted-2: #64748b;
  --grid: #1f2937;
  --grid-strong: #334155;
  --red: #ef4444;
  --red-deep: #dc2626;
  --red-wash: #1b1013;
  --emerald: #34d399;
  --emerald-deep: #10b981;
  --emerald-wash: #06231a;
  --amber: #f59e0b;
  --amber-wash: #1c1508;

  --shadow: 0 1px 1px rgba(0, 0, 0, 0.4), 0 20px 50px -30px rgba(0, 0, 0, 0.9);
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* Mobile browsers paint a light overlay on every tap; on a dark page it reads
     as a white flash around the element that was touched. */
  -webkit-tap-highlight-color: transparent;
}

/* While the document is still settling nothing animates. The theme script in
   the head sets `preload`, and it is removed on the first frame after load —
   without this, body's colour transition replays the flash it was fixed to
   avoid (white → dark over 300 ms). The theme toggle animates normally. */
html.preload,
html.preload *,
html.preload *::before,
html.preload *::after {
  transition: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: 'ss01' 1, 'cv05' 1, 'cv11' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(var(--drawer-h) + 8px);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--red);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.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;
}

.mono {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  font-feature-settings: 'tnum' 1;
}

/* ------------------------------------------------------------ structure */

.shell {
  position: relative;
  max-width: var(--shell);
  margin: 0 auto;
  background: var(--surface);
  border-left: 1px solid var(--grid);
  border-right: 1px solid var(--grid);
  min-height: 100vh;
}

/* Swiss 4-column registration grid behind the hero */
.shell::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 620px;
  background-image: linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 25% 100%;
  opacity: 0.55;
  pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 92%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 92%);
}

.shell > * {
  position: relative;
}

/* ---------------------------------------------------------------- header */

.top {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 62px;
  padding: 0 var(--rail);
  border-bottom: 1px solid var(--grid);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 9px;
  height: 9px;
  background: var(--red);
  display: inline-block;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 14%, transparent);
}

.brand-sub {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-inline-start: 14px;
  border-inline-start: 1px solid var(--grid);
  margin-inline-start: 4px;
  line-height: 1.2;
}

.top-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* About sits in the header, where navigation belongs — not in the legal strip
   at the bottom of the page. */
.nav-link {
  font-size: 11.5px;
  line-height: 1;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 2px 6px;
  border-bottom: 1px solid transparent;
  transition: color 140ms var(--ease), border-color 140ms var(--ease);
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--red);
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--grid-strong);
  border-radius: var(--radius);
  padding: 8px 26px 8px 10px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 52%, calc(100% - 9px) 52%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.lang-select:hover {
  border-color: var(--ink);
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--grid-strong);
  border-radius: var(--radius);
  color: var(--ink-soft);
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* ------------------------------------------------------------------ hero */

.hero {
  padding: 64px var(--rail) 40px;
  max-width: 900px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 22px;
}

.eyebrow::after {
  content: '';
  width: 48px;
  height: 1px;
  background: var(--grid-strong);
  margin-left: 4px;
}

.dot-live {
  width: 6px;
  height: 6px;
  background: var(--red);
  display: inline-block;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 12%, transparent);
}

.hero h1 {
  font-size: clamp(30px, 4.6vw, 54px);
  line-height: 1.03;
  letter-spacing: -0.035em;
  font-weight: 600;
  max-width: 19ch;
  text-wrap: balance;
}

.lede {
  margin-top: 20px;
  max-width: 60ch;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.62;
}

/* ------------------------------------------------------------------ card */

.card {
  position: relative;
  margin: 0 var(--rail) 56px;
  border: 1px solid var(--grid);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* registration marks */
.card::before,
.card::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--surface);
  border: 1px solid var(--grid-strong);
  top: -3px;
  left: -3px;
  z-index: 2;
}

.card::after {
  left: auto;
  right: -3px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 24px;
  border-bottom: 1px solid var(--grid);
  background: var(--surface-2);
}

.step {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.step-num {
  font-size: 11px;
  font-weight: 500;
  color: var(--red);
  letter-spacing: 0.08em;
}

.step-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

#state-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.state .pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
  flex: none;
}

.state[data-tone='live'] .pulse {
  background: var(--red);
  animation: pulse 1.6s infinite;
}

.state[data-tone='ok'] .pulse {
  background: var(--emerald);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald) 16%, transparent);
}

.state[data-tone='warn'] .pulse {
  background: var(--amber);
}

.state[data-tone='error'] .pulse {
  background: var(--red);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 40%, transparent);
  }
  50% {
    opacity: 0.55;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 0%, transparent);
  }
}

.panel {
  padding: 28px 24px 30px;
}

.panel + .panel {
  border-top: 1px solid var(--grid);
}

/* -------------------------------------------------------------- dropzone */

.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 44px 24px;
  border: 1px dashed var(--grid-strong);
  background: var(--surface-2);
  text-align: center;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
  cursor: pointer;
}

.drop::before,
.drop::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid var(--grid-strong);
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
}

.drop::after {
  left: auto;
  top: auto;
  right: -1px;
  bottom: -1px;
  border: 1px solid var(--grid-strong);
  border-left: 0;
  border-top: 0;
}

.drop:hover,
.drop[data-drag='true'] {
  border-color: var(--red);
  background: var(--red-wash);
}

/* Once the batch is non-empty the panel collapses into a slim "add more" bar,
   so the list itself is what the eye lands on. */
.drop[data-compact='true'] {
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-style: solid;
  background: var(--surface);
}

.drop[data-compact='true'] .drop-icon {
  width: 16px;
  height: 16px;
  color: var(--muted-2);
}

.drop[data-compact='true'] .drop-title {
  font-size: 13px;
  font-weight: 500;
}

.drop[data-compact='true'] .drop-hint {
  margin-inline-start: auto;
  font-size: 11.5px;
  color: var(--muted-2);
}

.drop[data-compact='true'] .btn {
  display: none;
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.queue-item[data-fresh='true'] {
  animation: rowIn 0.26s var(--ease);
}

.drop:hover::before,
.drop:hover::after,
.drop[data-drag='true']::before,
.drop[data-drag='true']::after {
  border-color: var(--red);
}

.drop-icon {
  width: 34px;
  height: 34px;
  color: var(--muted);
}

.drop:hover .drop-icon {
  color: var(--red);
}

.drop-title {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.drop-hint {
  font-size: 13px;
  color: var(--muted);
}

.drop-note {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.drop-note + .drop-note {
  margin-top: 6px;
}

.drop-note--body {
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  max-width: 76ch;
}

/* --------------------------------------------------------- file summary */

.summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--grid);
  margin-bottom: 22px;
}

.summary-name {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
  gap: 10px;
}

.summary-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.summary-meta b {
  color: var(--ink-soft);
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 8px;
  border: 1px solid var(--grid-strong);
  color: var(--muted);
  white-space: nowrap;
}

.badge[data-tone='ok'] {
  border-color: color-mix(in srgb, var(--emerald) 45%, transparent);
  color: var(--emerald-deep);
  background: var(--emerald-wash);
}

.badge[data-tone='red'] {
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
  color: var(--red-deep);
  background: var(--red-wash);
}

.badge svg {
  width: 11px;
  height: 11px;
  flex: none;
}

/* ------------------------------------------------------------------ link */

.field-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  display: block;
}

.link-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.link-box {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--grid);
  color: var(--ink-soft);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
  user-select: all;
}

.link-box .frag {
  color: var(--red);
}

.fp {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--grid);
  background: var(--surface-2);
}

.fp-key {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.fp-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.fp-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  display: block;
  margin-bottom: 2px;
}

.waiting {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
}

.waiting .bar-track {
  flex: 1;
}

/* -------------------------------------------------------------- progress */

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.progress-pct {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  position: relative;
  height: 6px;
  background: var(--grid);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 0%;
  background: var(--red);
  transition: width 0.18s linear;
}

.bar-fill[data-tone='ok'] {
  background: var(--emerald);
}

.bar-ticks {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(90deg, var(--surface) 1px, transparent 1px);
  background-size: 10% 100%;
  mix-blend-mode: overlay;
  opacity: 0.35;
  pointer-events: none;
}

.bar-indeterminate {
  width: 32%;
  animation: indeterminate 1.5s var(--ease) infinite;
}

@keyframes indeterminate {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(330%);
  }
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--grid);
  margin-top: 24px;
}

.stat {
  padding: 14px 14px 0 0;
}

.stat + .stat {
  padding-inline-start: 14px;
  border-inline-start: 1px solid var(--grid);
}

.stat dt {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease),
    transform 0.16s var(--ease);
}

.btn:hover {
  background: var(--ink);
  color: var(--surface);
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.btn-primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn-primary:hover {
  background: var(--red-deep);
  border-color: var(--red-deep);
  color: #fff;
}

.btn-ghost {
  border-color: var(--grid-strong);
  color: var(--ink-soft);
}

.btn-ghost:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 11.5px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-soft);
  font-size: inherit;
  text-decoration: underline;
  text-decoration-color: var(--grid-strong);
  text-underline-offset: 3px;
}

.link-btn:hover {
  color: var(--red);
  text-decoration-color: var(--red);
}

/* ------------------------------------------------------------------- pro */

.pro {
  padding: 18px 24px 20px;
  border-top: 1px solid var(--grid);
  background: var(--surface-2);
}

.pro-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pro-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 7px;
  border: 1px solid var(--grid-strong);
  color: var(--muted);
}

.pro-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
}

.pro-flag {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.pro-body {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  max-width: 76ch;
}

.pro--note .pro-title {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.pro--note .pro-title::before {
  content: '';
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.pro-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 14px;
}

/* Keep-the-tab-open notice: the key lives only in this tab, so closing it ends
   the transfer. Deliberately visible on both sides, before and during. */
.keep {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0 2px;
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--amber) 34%, var(--grid));
  border-inline-start: 2px solid var(--amber);
  background: var(--amber-wash);
}

.keep-icon {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--amber);
  margin-top: 1px;
}

.keep-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.keep-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.keep-text strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.keep-text > span {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* which path the bytes are taking — a security claim, stated plainly */
.mode-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.mode-line::before {
  content: '';
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--amber, #d97706);
}

.mode-line[data-mode='stealth'] {
  color: var(--emerald);
}

.mode-line[data-mode='stealth']::before {
  background: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  color: var(--muted-2);
  cursor: not-allowed;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch .track {
  width: 30px;
  height: 16px;
  border: 1px solid var(--grid-strong);
  background: var(--grid);
  position: relative;
  flex: none;
}

.switch .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  background: var(--muted-2);
  transition: transform 140ms ease, background 140ms ease;
}

/* ------------------------------------------------ stealth switch (active) */

.switch.stealth-switch {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  margin: 16px 0 2px;
  padding: 12px 14px;
  border: 1px solid var(--grid);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.switch.stealth-switch:hover {
  border-color: var(--grid-strong);
}

.switch.stealth-switch .track {
  margin-top: 1px;
  cursor: pointer;
}

.switch.stealth-switch input:checked + .track {
  background: var(--emerald-soft, rgba(16, 185, 129, 0.16));
  border-color: var(--emerald);
}

.switch.stealth-switch input:checked + .track::after {
  transform: translateX(14px);
  background: var(--emerald);
}

.switch.stealth-switch input:focus-visible + .track {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.switch-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.switch-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0;
}

.switch-hint {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}


/* ----------------------------------------------------------- trust strip */

.trust {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--grid);
  border-bottom: 1px solid var(--grid);
  margin: 0 0 0;
}

.trust article {
  display: flex;
  gap: 18px;
  padding: 34px var(--rail) 38px var(--rail);
  border-inline-end: 1px solid var(--grid);
  min-height: 190px;
}

.trust article:last-child {
  border-inline-end: 0;
}

.trust-num {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  padding-top: 2px;
  transition: color 160ms var(--ease);
}

.trust article:hover .trust-num {
  color: var(--red);
}

.trust-text {
  min-width: 0;
}

.trust h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 9px;
}

.trust p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.65;
  max-width: 38ch;
}

.trust article[data-flash='true'] {
  animation: flash 1.4s var(--ease);
}

@keyframes flash {
  0% {
    background: var(--red-wash);
  }
  100% {
    background: transparent;
  }
}

/* ---------------------------------------------------------------- footer */

.foot {
  display: flex;
  flex-wrap: wrap;
  /* Centring, not baseline: the flag is an SVG with no text baseline, so a
     baseline-aligned row lifted "Swiss Made" above the rest of the line. */
  align-items: center;
  justify-content: space-between;
  gap: 12px 28px;
  padding: 26px var(--rail) 44px;
  font-size: 11.5px;
  color: var(--muted);
}

.foot-id {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
  min-width: 0;
}

/* The separator belongs to the text before it, not to the layout: a standalone
   "·" flex item ends up dangling at the end of a wrapped line. */
.foot-brand::after,
.foot-swiss::after {
  content: '·';
  color: var(--grid-strong);
  margin-inline-start: 10px;
}

.foot-note {
  min-width: 0;
}

.foot-brand {
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* The flag is drawn, not typed: an emoji flag renders as the letters "CH" on
   Windows and would look like a typo. */
.foot-swiss {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.foot-flag {
  display: inline-flex;
  width: 11px;
  height: 11px;
  flex: none;
}

.foot-flag svg {
  width: 100%;
  height: 100%;
  display: block;
}

.foot-verify {
  white-space: nowrap;
}

.foot-sep {
  color: var(--grid-strong);
}

.foot .link-btn {
  margin-inline-start: auto;
  font-size: 11.5px;
}

/* ----------------------------------------------------------- audit drawer */

.audit {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--surface);
  border-top: 1px solid var(--grid-strong);
  box-shadow: 0 -12px 40px -30px rgba(15, 23, 42, 0.5);
}

.audit-head {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: var(--drawer-h);
  padding: 0 var(--rail);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  text-align: left;
}

.audit-head:hover {
  background: var(--surface-2);
}

.audit-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.audit-count {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border: 1px solid var(--grid);
  background: var(--surface-2);
}

.audit-count[data-fresh='true'] {
  animation: countTick 0.7s var(--ease);
}

@keyframes countTick {
  0% {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
  }
  100% {
    background: var(--surface-2);
    border-color: var(--grid);
    color: var(--muted);
  }
}

.audit-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}

.chev {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  transform: rotate(-135deg) translateY(-1px);
  transition: transform 0.22s var(--ease);
}

.audit[data-open='true'] .chev {
  transform: rotate(45deg) translateY(-1px);
}

.audit-body {
  display: none;
  height: 0;
  overflow: hidden;
  border-top: 1px solid var(--grid);
  transition: height 0.24s var(--ease);
}

.audit[data-open='true'] .audit-body {
  display: flex;
  flex-direction: column;
  height: 260px;
}

.audit-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px var(--rail);
  border-bottom: 1px solid var(--grid);
  background: var(--surface-2);
}

.audit-hint-lg {
  font-size: 11.5px;
  color: var(--muted);
}

.audit-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.audit-actions button {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 9px;
  border: 1px solid var(--grid-strong);
  background: var(--surface);
  color: var(--muted);
}

.audit-actions button:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.audit-list {
  list-style: none;
  margin: 0;
  padding: 8px 0 12px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}

.audit-list:empty::after {
  content: attr(data-empty);
  display: block;
  padding: 18px var(--rail);
  font-size: 12px;
  color: var(--muted-2);
}

.audit-item {
  display: grid;
  grid-template-columns: 74px 14px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  padding: 5px var(--rail);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-soft);
  animation: logIn 0.24s var(--ease);
}

.audit-item:hover {
  background: var(--surface-2);
}

@keyframes logIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.audit-time {
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.audit-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted-2);
  align-self: center;
  transform: translateY(-1px);
}

.audit-item[data-level='ok'] .audit-dot {
  background: var(--emerald);
}
.audit-item[data-level='crypto'] .audit-dot {
  background: var(--ink-soft);
}
.audit-item[data-level='stripped'] .audit-dot {
  background: var(--red);
}
.audit-item[data-level='warn'] .audit-dot {
  background: var(--amber);
}
.audit-item[data-level='error'] .audit-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent);
}
.audit-item[data-level='error'] .audit-msg {
  color: var(--red-deep);
}
.audit-item[data-level='ok'] .audit-msg {
  color: var(--emerald-deep);
}

.audit-msg {
  overflow-wrap: anywhere;
}

/* ----------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
  backdrop-filter: blur(3px);
  animation: fade 0.18s var(--ease);
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--grid-strong);
  box-shadow: 0 30px 80px -30px rgba(15, 23, 42, 0.55);
  padding: 22px;
  animation: rise 0.22s var(--ease);
}

@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.modal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.modal-head h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.modal-close {
  background: none;
  border: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-close:hover {
  color: var(--red);
}

.modal-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}

.qr-frame {
  background: #fff;
  padding: 14px;
  border: 1px solid var(--grid);
  display: grid;
  place-items: center;
}

.qr-frame svg {
  width: 100%;
  height: auto;
  max-width: 300px;
  display: block;
}

.qr-url {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
  text-align: center;
}

/* ----------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--drawer-h) + 18px);
  transform: translateX(-50%) translateY(6px);
  z-index: 70;
  background: var(--ink);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 9px 14px;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  pointer-events: none;
}

.toast[data-show='true'] {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ------------------------------------------------------- mode tabs */

.tabs {
  display: flex;
  gap: 0;
  margin: -6px 0 20px;
  border-bottom: 1px solid var(--grid);
}

.tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 9px 16px 10px 0;
  margin-right: 18px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.tab[aria-selected='true'] {
  color: var(--ink);
  border-bottom-color: var(--red);
}

.tab:hover {
  color: var(--ink);
}

/* ------------------------------------------------------------- queue */

.queue {
  margin-top: 22px;
  border: 1px solid var(--grid);
  background: var(--surface);
}

.queue-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--grid);
  background: var(--surface-2);
}

.queue-head .field-label {
  margin: 0;
}

.queue-head .q-action {
  margin-inline-start: auto;
}

.queue-sum {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 264px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.queue-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--grid);
}

.queue-item:last-child {
  border-bottom: 0;
}

.q-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grid-strong);
}

.q-dot[data-state='ok'] {
  background: var(--emerald);
}

.q-dot[data-state='busy'] {
  background: var(--red);
  animation: pulse 1.4s infinite;
}

.q-dot[data-state='error'] {
  background: var(--red);
}

.q-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.q-size {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.q-action {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: var(--grid-strong);
  text-underline-offset: 3px;
}

.q-action:hover {
  color: var(--red);
  text-decoration-color: var(--red);
}

.q-remove {
  background: none;
  border: 0;
  color: var(--muted-2);
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}

.q-remove:hover {
  color: var(--red);
}

.queue-item[data-state='done'] .q-name {
  color: var(--muted);
}

.queue-list.read-only .q-remove {
  display: none;
}

.queue-empty {
  padding: 18px 12px;
  font-size: 12px;
  color: var(--muted-2);
}

/* -------------------------------------------------------- text mode */

.text-area {
  width: 100%;
  resize: vertical;
  min-height: 128px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  padding: 13px 14px;
  border: 1px solid var(--grid-strong);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: var(--radius);
}

.text-area:focus {
  outline: none;
  border-color: var(--ink);
}

.msg-box {
  margin-top: 18px;
  border: 1px solid var(--grid);
  background: var(--surface-2);
}

.msg-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--grid);
}

.msg-head .fp-label {
  margin: 0;
}

.msg-box pre {
  margin: 0;
  padding: 14px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
}

.countdown {
  margin-top: 10px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted-2);
}

.reconnect {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--amber);
}

.reconnect .dot-live {
  background: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 16%, transparent);
  animation: pulse 1.6s infinite;
}

.current-file {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------- utilities */

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stack-8 > * + * {
  margin-top: 8px;
}

.muted {
  color: var(--muted);
}

.error-box {
  border-inline-start: 2px solid var(--red);
  padding: 14px 16px;
  background: var(--red-wash);
}

.error-box h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.error-box p {
  font-size: 13px;
  color: var(--ink-soft);
}

.err-detail {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 980px) {
  :root {
    --rail: 28px;
  }
  /* Three commitments read better stacked than orphaned in a 2-column grid. */
  .trust {
    grid-template-columns: 1fr;
  }
  .trust article {
    border-inline-end: 0;
    border-bottom: 1px solid var(--grid);
    min-height: 0;
    padding: 26px var(--rail);
  }
  .trust article:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 720px) {
  :root {
    --rail: 20px;
  }

  .brand-sub {
    display: none;
  }

  .hero {
    padding: 40px var(--rail) 28px;
  }

  .eyebrow {
    align-items: flex-start;
  }

  .eyebrow::after {
    display: none;
  }

  .eyebrow .dot-live {
    margin-top: 5px;
  }

  .state {
    max-width: 56%;
  }

  .hero h1 {
    max-width: 100%;
  }

  .card-head {
    padding: 12px 16px;
  }

  .panel {
    padding: 20px 16px 24px;
  }

  .drop {
    padding: 32px 16px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat:nth-child(3),
  .stat:nth-child(4) {
    border-top: 1px solid var(--grid);
    margin-top: 12px;
  }

  .stat:nth-child(3) {
    border-left: 0;
    padding-left: 0;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .link-row {
    flex-direction: column;
  }

  .trust {
    grid-template-columns: 1fr;
  }

  .trust article {
    border-inline-end: 0;
    min-height: 0;
    padding: 20px var(--rail);
  }

  .foot .link-btn {
    margin-left: 0;
  }

  /* Stacked: the brand, the mark and the legal note each get their own line,
     and the separators would only be noise. */
  .foot-id {
    flex-direction: column;
    align-items: flex-start;
    row-gap: 5px;
  }

  .foot-brand::after,
  .foot-swiss::after {
    content: none;
  }

  .audit[data-open='true'] .audit-body {
    height: 220px;
  }

  .audit-hint {
    display: none;
  }

  .audit-item {
    grid-template-columns: 58px 12px minmax(0, 1fr);
    font-size: 10.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------------------------------------------- RTL */

/*
  The layout is written with logical properties where it matters, so Arabic only
  needs a few corrections: technical tokens (URLs, hashes, byte counters) must
  stay left-to-right, and the caps-lock micro labels must keep following the
  page direction.
*/
[dir='rtl'] .link-box,
[dir='rtl'] .fp-key,
[dir='rtl'] #done-hash,
[dir='rtl'] .qr-url,
[dir='rtl'] .audit-time,
[dir='rtl'] .q-size,
[dir='rtl'] .progress-pct,
[dir='rtl'] .stat dd {
  direction: ltr;
  unicode-bidi: isolate;
}

[dir='rtl'] .link-box,
[dir='rtl'] #done-hash,
[dir='rtl'] .qr-url,
[dir='rtl'] .stat dd {
  text-align: left;
}

/* Latin display type looks wrong next to Arabic script: drop the tracking. */
[dir='rtl'] .eyebrow,
[dir='rtl'] .field-label,
[dir='rtl'] .step-label,
[dir='rtl'] .brand-sub,
[dir='rtl'] .trust-num,
[dir='rtl'] .fp-label,
[dir='rtl'] .pro-badge,
[dir='rtl'] .pro-flag,
[dir='rtl'] .audit-title,
[dir='rtl'] .drop-note {
  letter-spacing: 0.02em;
  text-transform: none;
}
