/* AiVoid */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --fill: rgba(0, 0, 0, 0.05);
  --fill-strong: rgba(0, 0, 0, 0.09);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --line: rgba(0, 0, 0, 0.1);
  --line-soft: rgba(0, 0, 0, 0.06);
  --accent: #0071e3;
  --accent-hover: #0068d1;
  --accent-press: #005fc0;
  --link: #0066cc;
  --on-accent: #ffffff;
  --ai: #b64400;
  --ai-bg: rgba(255, 149, 0, 0.14);
  --ok: #1d7d36;
  --warn: #b3261e;
  --core: #000000;
  --core-edge: #1d1d1f;
  --ring: rgba(0, 0, 0, 0.12);
  --nav-bg: rgba(245, 245, 247, 0.78);
  --bar-bg: rgba(255, 255, 255, 0.8);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 28px rgba(0, 0, 0, 0.06);
  --shadow-bar: 0 -1px 0 rgba(0, 0, 0, 0.06), 0 -10px 30px rgba(0, 0, 0, 0.05);
  --focus: 0 0 0 4px rgba(0, 113, 227, 0.32);
  --select: rgba(0, 113, 227, 0.2);

  --radius-lg: 28px;
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(16px, 4vw, 40px);
  --max: 980px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #161617;
    --surface-2: #1d1d1f;
    --fill: rgba(255, 255, 255, 0.07);
    --fill-strong: rgba(255, 255, 255, 0.12);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --line: rgba(255, 255, 255, 0.14);
    --line-soft: rgba(255, 255, 255, 0.08);
    --accent: #0071e3;
    --accent-hover: #0068d1;
    --accent-press: #005fc0;
    --link: #2997ff;
    --ai: #ffa733;
    --ai-bg: rgba(255, 159, 10, 0.16);
    --ok: #30d158;
    --warn: #ff6961;
    --core: #000000;
    --core-edge: #f5f5f7;
    --ring: rgba(255, 255, 255, 0.16);
    --nav-bg: rgba(22, 22, 23, 0.72);
    --bar-bg: rgba(29, 29, 31, 0.78);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 28px rgba(0, 0, 0, 0.4);
    --shadow-bar: 0 -1px 0 rgba(255, 255, 255, 0.08), 0 -10px 30px rgba(0, 0, 0, 0.5);
    --focus: 0 0 0 4px rgba(41, 151, 255, 0.45);
    --select: rgba(41, 151, 255, 0.35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #161617;
  --surface-2: #1d1d1f;
  --fill: rgba(255, 255, 255, 0.07);
  --fill-strong: rgba(255, 255, 255, 0.12);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --line: rgba(255, 255, 255, 0.14);
  --line-soft: rgba(255, 255, 255, 0.08);
  --accent: #0071e3;
  --accent-hover: #0068d1;
  --accent-press: #005fc0;
  --link: #2997ff;
  --ai: #ffa733;
  --ai-bg: rgba(255, 159, 10, 0.16);
  --ok: #30d158;
  --warn: #ff6961;
  --core: #000000;
  --core-edge: #f5f5f7;
  --ring: rgba(255, 255, 255, 0.16);
  --nav-bg: rgba(22, 22, 23, 0.72);
  --bar-bg: rgba(29, 29, 31, 0.78);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 28px rgba(0, 0, 0, 0.4);
  --shadow-bar: 0 -1px 0 rgba(255, 255, 255, 0.08), 0 -10px 30px rgba(0, 0, 0, 0.5);
  --focus: 0 0 0 4px rgba(41, 151, 255, 0.45);
  --select: rgba(41, 151, 255, 0.35);
  color-scheme: dark;
}

/* base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--fill-strong) transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

::selection { background: var(--select); }

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

button { font: inherit; color: inherit; letter-spacing: inherit; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

:focus-visible { outline: none; box-shadow: var(--focus); }

[hidden] { display: none !important; }

.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(--mono); font-size: 0.88em; letter-spacing: 0; }

/* nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-soft);
  padding-top: env(safe-area-inset-top);
}

.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  height: 52px;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
  border-radius: 8px;
  min-height: 44px;
}

.brand-mark { width: 22px; height: 22px; }
.mk-ring { fill: none; stroke: var(--ring); stroke-width: 1.5; }
.mk-core { fill: var(--core); stroke: var(--core-edge); stroke-width: 1.5; }

.theme {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--fill);
  border-radius: 999px;
}

.theme button {
  width: 34px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.theme button:hover { color: var(--text); }

.theme button[aria-checked="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.theme svg .fill { fill: currentColor; stroke: none; }

/* layout */

main {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* hero */

.hero {
  text-align: center;
  padding: clamp(56px, 10vw, 112px) 0 clamp(36px, 5vw, 56px);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6.4vw, 4.5rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-wrap: balance;
  max-width: 15ch;
  margin: 0 auto;
}

.lede {
  margin: 22px auto 0;
  max-width: 40rem;
  color: var(--text-2);
  font-size: clamp(1.0625rem, 1.6vw, 1.3125rem);
  line-height: 1.45;
  letter-spacing: -0.016em;
  text-wrap: pretty;
}

/* buttons */

.btn {
  -webkit-appearance: none;
  text-decoration: none;
  appearance: none;
  border: 0;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 22px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.016em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease), opacity 0.2s;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-press); }

.btn-secondary { background: var(--fill); color: var(--text); }
.btn-secondary:hover { background: var(--fill-strong); }

.btn[disabled] { opacity: 0.45; cursor: default; transform: none; }

.btn .spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--link);
  font-size: 15px;
  padding: 10px 4px;
  min-height: 44px;
  cursor: pointer;
  border-radius: 8px;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 0.18em; }

.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--link);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.icon-btn:hover { background: var(--fill-strong); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[disabled] { opacity: 0.35; cursor: default; }

/* drop zone & the horizon */

.drop {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(40px, 6vw, 64px) 24px clamp(40px, 6vw, 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 28px;
  cursor: pointer;
  outline: 2px dashed transparent;
  outline-offset: -12px;
  transition: outline-color 0.3s var(--ease);
  isolation: isolate;
  overflow: hidden;
}

.drop.is-over { outline-color: var(--accent); }

.horizon {
  --size: 196px;
  position: relative;
  width: var(--size);
  height: var(--size);
  flex: none;
  display: grid;
  place-items: center;
}

.horizon .ring,
.horizon .core {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  transition: transform 0.7s var(--ease), border-color 0.4s var(--ease), opacity 0.4s var(--ease);
}

.horizon .r3 { width: 100%; height: 100%; border: 1px solid var(--line-soft); }
.horizon .r2 { width: 76%; height: 76%; border: 1px solid var(--line); }
.horizon .r1 { width: 56%; height: 56%; border: 1.5px solid var(--ring); }
.horizon .core {
  width: 38%;
  height: 38%;
  background: var(--core);
  box-shadow: inset 0 0 0 1.5px var(--core-edge), 0 10px 30px rgba(0, 0, 0, 0.22);
}

/* Pulled in: the rings fall toward the core while something hovers. */
.drop.is-over .r3, .veil.show .r3 { transform: scale(0.82); border-color: var(--accent); opacity: 0.5; }
.drop.is-over .r2, .veil.show .r2 { transform: scale(0.8); border-color: var(--accent); opacity: 0.75; }
.drop.is-over .r1, .veil.show .r1 { transform: scale(0.84); border-color: var(--accent); }
.drop.is-over .core, .veil.show .core { transform: scale(1.12); }

.horizon.swallow .ring { animation: swallow 0.9s var(--ease); }
.horizon.swallow .r2 { animation-delay: 0.05s; }
.horizon.swallow .r1 { animation-delay: 0.1s; }
.horizon.swallow .core { animation: gulp 0.9s var(--ease); }

@keyframes swallow {
  0% { transform: scale(1); opacity: 1; }
  35% { transform: scale(0.32); opacity: 0; }
  36% { transform: scale(1.2); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes gulp {
  0% { transform: scale(1); }
  30% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.drop-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.12;
}

.drop-sub { color: var(--text-2); margin-top: 6px; font-size: 15px; }

.drop-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Compact drop bar once files are in. */
body.has-files .hero { padding: clamp(36px, 6vw, 64px) 0 clamp(24px, 3vw, 32px); }
body.has-files .hero h1 { font-size: clamp(2rem, 4.4vw, 3rem); }
body.has-files .lede { display: none; }

body.has-files .drop {
  flex-direction: row;
  text-align: left;
  gap: 20px;
  padding: 20px 20px 20px 24px;
  border-radius: var(--radius);
}
body.has-files .drop .horizon { --size: 56px; }
body.has-files .drop .horizon .core { box-shadow: inset 0 0 0 1.5px var(--core-edge); }
body.has-files .drop-copy { flex: 1; min-width: 0; }
body.has-files .drop-title { font-size: 19px; letter-spacing: -0.02em; }
body.has-files .drop-sub { margin-top: 2px; font-size: 14px; }
body.has-files .drop-actions { flex-wrap: nowrap; }
body.has-files .drop .btn { min-height: 40px; padding: 0 18px; font-size: 15px; }

/* full-window veil while dragging */
.veil {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), visibility 0s 0.3s;
}
.veil.show { opacity: 1; visibility: visible; transition: opacity 0.3s var(--ease); }
.veil-inner { display: grid; justify-items: center; gap: 22px; }
.veil-inner p { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -0.028em; }
.horizon.big { --size: 260px; }

/* workspace */

.workspace { padding-top: clamp(40px, 6vw, 64px); }

.overview { margin-bottom: 24px; }
.overview h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.overview p { color: var(--text-2); margin-top: 6px; font-size: 17px; }
.overview .ai-count { color: var(--ai); font-weight: 600; }

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 14px;
}

.panel-head h2, .panel-head h3 { font-size: 22px; font-weight: 600; letter-spacing: -0.022em; line-height: 1.2; }
.panel-sub { color: var(--text-2); font-size: 15px; margin-top: 4px; max-width: 60ch; }

/* checkbox */
.check {
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
}
.check input {
  position: absolute;
  inset: -11px;
  width: 44px;
  height: 44px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.check .box {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  border: 1.5px solid var(--text-2);
  background: var(--surface);
  pointer-events: none;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.check .box::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0.4);
  opacity: 0;
  transition: transform 0.25s var(--ease), opacity 0.15s;
}
.check input:checked + .box,
.check input:indeterminate + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box::after { opacity: 1; transform: rotate(45deg) scale(1); }
.check input:indeterminate + .box::after {
  left: 5px; top: 9px; width: 9px; height: 0; border-width: 0 0 2px 0;
  transform: none; opacity: 1;
}
.check input:focus-visible + .box { box-shadow: var(--focus); }
.check input:active + .box { transform: scale(0.9); }

/* kinds */
.kind-list {
  list-style: none;
  margin: 0;
  padding: 0 12px 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 8px;
}

.kind-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  min-height: 56px;
  cursor: pointer;
  transition: background-color 0.2s var(--ease);
}
.kind-row:hover { background: var(--fill); }
.kind-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kind-label { font-size: 16px; font-weight: 500; letter-spacing: -0.012em; line-height: 1.3; }
.kind-sub { font-size: 13px; color: var(--text-2); letter-spacing: -0.005em; }

.tag-ai {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ai);
  background: var(--ai-bg);
  border-radius: 999px;
  padding: 3px 8px;
  line-height: 1.2;
}

/* files */
.file-list { list-style: none; margin: 0; padding: 0 0 6px; }

.file { border-top: 1px solid var(--line-soft); }
.file:first-child { border-top-color: transparent; }

.file-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 8px;
}

.file-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  background: none;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.2s var(--ease);
}
.file-toggle:hover { background: var(--fill); }
.file-toggle[disabled] { cursor: default; }
.file-toggle[disabled]:hover { background: none; }

.thumb {
  position: relative;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 11px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  display: grid;
  place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-fallback { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-2); }
.thumb img + .thumb-fallback { display: none; }

.file-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.file-name {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.014em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.file-meta .ok { color: var(--ok); font-weight: 500; }
.file-meta .bad { color: var(--warn); font-weight: 500; }
.file-meta .busy::before {
  content: "";
  display: inline-block;
  width: 9px; height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  border: 1.5px solid currentColor; border-right-color: transparent;
  vertical-align: -1px;
  animation: spin 0.8s linear infinite;
}

.chev {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text-2);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.4s var(--ease);
}
.file-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.file-toggle[disabled] .chev { visibility: hidden; }

.file-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease);
}
.file.open .file-body { grid-template-rows: 1fr; }
.file-body-inner { overflow: hidden; min-height: 0; }
.file.open .file-body-inner { padding-bottom: 14px; }

.sig-group { padding: 4px 16px 0 80px; }
.sig-group h4 {
  margin: 10px 0 2px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.005em;
}
.sig-list { list-style: none; margin: 0; padding: 0; }

.sig-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.2s var(--ease);
}
.sig-row:hover { background: var(--fill); }
.sig-row .check { margin-top: 1px; }
.sig-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sig-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sig-label { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.35; }
.sig-size { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sig-detail {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.sig-notes { margin: 2px 0 0; padding: 0; list-style: none; }
.sig-notes li { font-size: 13px; color: var(--text-2); line-height: 1.45; overflow-wrap: anywhere; }
.sig-notes li::before { content: "·"; margin-right: 6px; }

.sig-row.keep .sig-label { color: var(--text-2); }

.file-empty, .file-msg {
  padding: 4px 26px 4px 90px;
  font-size: 14px;
  color: var(--text-2);
}

.file-foot {
  display: flex;
  gap: 4px 18px;
  flex-wrap: wrap;
  padding: 6px 16px 0 90px;
}

/* notes */

.notes {
  padding: clamp(64px, 9vw, 104px) 0 clamp(40px, 6vw, 72px);
  border-top: 1px solid var(--line-soft);
  margin-top: clamp(56px, 8vw, 96px);
}
.notes h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: clamp(28px, 4vw, 44px);
}
.notes-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 36px 32px;
}
.notes-grid h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 8px; line-height: 1.3; }
.notes-grid p { font-size: 15px; color: var(--text-2); line-height: 1.5; letter-spacing: -0.01em; }

.foot {
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 20px var(--gutter) calc(28px + env(safe-area-inset-bottom));
  color: var(--text-2);
  font-size: 13px;
  border-top: 1px solid var(--line-soft);
}
.foot a { color: var(--text-2); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.foot a:hover { color: var(--text); }
body.has-files .foot { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }

/* action bar */

.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom));
  pointer-events: none;
  animation: rise 0.6s var(--ease);
}

.ab-inner {
  pointer-events: auto;
  max-width: calc(var(--max) - 2 * 24px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 10px 10px 22px;
  border-radius: 999px;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-bar), 0 0 0 1px var(--line-soft);
}

.ab-text {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.ab-text strong { color: var(--text); font-weight: 600; }

@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.file.enter { animation: rowIn 0.6s var(--ease) both; animation-delay: calc(var(--d, 0) * 45ms); }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* nav links */

.brand { margin-right: auto; }
.nav-inner { gap: 12px; }
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: -0.01em;
  transition: color 0.2s var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current="page"] { color: var(--text); font-weight: 500; }

/* landing motion */

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}
body:not(.has-files) .drop.has-canvas .horizon > * { visibility: hidden; }
body.has-files .hero-canvas { display: none; }

.hero h1 .word {
  display: inline-block;
  animation: wordIn 1s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms + 60ms);
}
.hero h1 .decode { white-space: nowrap; }
.hero .lede { animation: fadeUp 1s var(--ease) 0.45s both; }
.drop { animation: fadeUp 1.1s var(--ease) 0.6s both; }

@keyframes wordIn {
  from { opacity: 0; transform: translateY(0.35em); filter: blur(12px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* cleaning feedback on a row */
.file.cleaning .thumb::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 45%;
  top: -45%;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--link) 55%, transparent), transparent);
  animation: scan 0.9s linear infinite;
}
@keyframes scan { to { top: 100%; } }
.file-meta .ok { display: inline-block; animation: pop 0.5s var(--ease); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.icon-btn.done { color: var(--ok); }
.icon-btn.done svg { animation: pop 0.45s var(--ease); }

/* scroll reveals: content stays visible until the observer has run once */
.reveal {
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}
html.reveal-ready .reveal:not(.in) { opacity: 0; transform: translateY(18px); }

/* metrics page */

.m-head { padding: clamp(40px, 7vw, 80px) 0 24px; }
.m-head h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.m-head p { color: var(--text-2); margin-top: 12px; font-size: clamp(1.0625rem, 1.6vw, 1.25rem); max-width: 44rem; }
.m-badge {
  display: inline-block;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ai);
  background: var(--ai-bg);
  border-radius: 999px;
  padding: 4px 10px;
}

.m-bar {
  position: sticky;
  top: calc(53px + env(safe-area-inset-top));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding: 10px 0 14px;
  background: var(--bg);
}
.m-range-label { color: var(--text-2); font-size: 14px; font-variant-numeric: tabular-nums; }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--fill);
  border-radius: 999px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.seg.small button { height: 30px; font-size: 13px; padding: 0 12px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.stat { padding: 22px 24px 24px; border-left: 1px solid var(--line-soft); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-label { font-size: 15px; color: var(--text-2); }
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-top: 6px;
}
.stat-delta { margin-top: 6px; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 4px; min-height: 18px; }
.stat-delta svg { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stat-delta.up svg { color: var(--ok); }
.stat-delta.down svg { color: var(--warn); }

.chart-wrap { padding: 4px 24px 18px; }
.chart {
  position: relative;
  height: 220px;
  margin-left: 40px;
}
.chart-grid { position: absolute; inset: 0; pointer-events: none; }
.chart-grid div { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-soft); }
.chart-grid span {
  position: absolute;
  right: calc(100% + 8px);
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.bar-slot { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; min-width: 0; border-radius: 4px; outline: none; }
.bar {
  width: 100%;
  max-width: 24px;
  min-height: 2px;
  background: var(--link);
  border-radius: 4px 4px 0 0;
  transform-origin: bottom;
  animation: grow 0.8s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 12ms);
  transition: opacity 0.2s var(--ease);
}
.chart.dim .bar { opacity: 0.38; }
.chart.dim .bar-slot.hl .bar { opacity: 1; }
.bar-slot:hover .bar, .bar-slot:focus-visible .bar { opacity: 1; filter: brightness(1.15); }
.bar-slot:focus-visible { box-shadow: var(--focus); }
@keyframes grow { from { transform: scaleY(0); } to { transform: none; } }
.chart-x {
  display: flex;
  justify-content: space-between;
  margin: 8px 0 0 40px;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.tip {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--line-soft), 0 8px 24px rgba(0, 0, 0, 0.16);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tip b { font-weight: 600; }
.tip span { color: var(--text-2); }

.m-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.m-table th {
  text-align: right;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  padding: 8px 24px 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.m-table th:first-child, .m-table td:first-child { text-align: left; padding-left: 24px; }
.m-table td {
  text-align: right;
  padding: 11px 24px 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
.m-table tr:last-child td { border-bottom: 0; }
.m-table tbody tr { transition: background-color 0.2s var(--ease); }
.m-table tbody tr:hover { background: var(--fill); }
.m-country { display: flex; align-items: center; gap: 12px; min-width: 0; }
.m-code {
  flex: none;
  width: 28px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-2);
}
.m-share { width: 34%; }
.m-share-cell { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.m-share-track { flex: 1; max-width: 220px; height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.m-share-fill { height: 100%; background: var(--link); border-radius: 3px; transform-origin: left; animation: growX 0.9s var(--ease) both; }
@keyframes growX { from { transform: scaleX(0); } to { transform: none; } }
.m-share-pct { width: 44px; text-align: right; color: var(--text-2); font-size: 13px; }
.m-more { padding: 6px 24px 14px; }
.m-empty, .m-error { padding: 28px 24px 32px; color: var(--text-2); }
.m-note {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.6;
  max-width: 78ch;
  margin: 0 auto;
  padding: 12px 0 40px;
  text-align: center;
  text-wrap: balance;
}
details.m-data { padding: 0 24px 16px; }
details.m-data summary { cursor: pointer; color: var(--link); font-size: 14px; min-height: 44px; display: flex; align-items: center; width: max-content; border-radius: 8px; }
details.m-data .m-table td:first-child, details.m-data .m-table th:first-child { padding-left: 0; }
details.m-data .m-table td:last-child, details.m-data .m-table th:last-child { padding-right: 0; }

.loading .stat-value, .loading .m-table, .loading .chart { opacity: 0.45; transition: opacity 0.2s; }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 640px) {
  .nav-links a { padding: 0 8px; }
  .stat { padding: 16px 16px 18px; }
  .chart-wrap { padding: 4px 16px 14px; }
  .chart { height: 180px; margin-left: 34px; }
  .chart-x { margin-left: 34px; }
  .m-table th:first-child, .m-table td:first-child { padding-left: 16px; }
  .m-table td, .m-table th { padding-right: 16px; padding-left: 8px; }
  .m-share-col { display: none; }
  .m-more, details.m-data { padding-left: 16px; padding-right: 16px; }
  .panel-head { flex-wrap: wrap; }
}
@media (max-width: 430px) {
  .brand span { display: none; }
  .nav-inner { gap: 6px; }
}

/* source link and footer */

.nav-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 44px;
  color: var(--text-2);
  border-radius: 999px;
  transition: color 0.2s var(--ease);
}
.nav-icon:hover { color: var(--text); }
.nav-icon svg { width: 19px; height: 19px; fill: currentColor; }
.nav-links { align-items: center; }


.foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding-top: 40px;
  padding-left: 0;
  padding-right: 0;
  width: calc(100% - 2 * var(--gutter));
  max-width: calc(var(--max) - 2 * var(--gutter));
  font-size: 13px;
}
.foot .sli {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 12px;
  padding: 4px 8px;
}
.foot .sli img { width: 44px; height: auto; transition: transform 0.4s var(--ease); }
.foot .sli strong { color: var(--text); font-weight: 600; }
.foot .sli:hover img { transform: translateY(-2px); }
.foot .sli:hover strong { text-decoration: underline; text-underline-offset: 0.18em; }
.foot-links { display: flex; gap: 24px; justify-content: center; }
.foot-legal { font-size: 12px; color: var(--text-2); }

.noscript {
  max-width: var(--max);
  margin: 16px auto 0;
  padding: 12px var(--gutter);
  color: var(--warn);
  font-size: 15px;
}

.m-note a { color: var(--link); }

@media (max-width: 640px) {
}

/* first screen fits the viewport on desktop
   Spacing and the horizon scale with viewport height so the headline,
   intro and the drop target with its buttons are visible without scrolling. */

@media (min-width: 641px) {
  .hero { padding: clamp(28px, 5vh, 112px) 0 clamp(20px, 3.5vh, 56px); }
  .hero h1 { font-size: clamp(2.5rem, min(6.4vw, 8vh), 4.5rem); }
  .lede {
    margin-top: clamp(12px, 2.2vh, 22px);
    max-width: 52rem;
    font-size: clamp(1.0625rem, min(1.6vw, 2.6vh), 1.3125rem);
  }
  .drop {
    padding: clamp(24px, 4vh, 64px) 24px clamp(24px, 4vh, 56px);
    gap: clamp(16px, 2.6vh, 28px);
  }
  .horizon { --size: clamp(96px, 16vh, 196px); }
  .drop-title { font-size: clamp(1.5rem, min(3vw, 4.4vh), 2rem); }
}

/* responsive */

@media (max-width: 860px) {
  .notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .kind-list { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { text-align: left; }
  .hero h1 { margin: 0; }
  .lede { margin-left: 0; }
  .drop { padding: 36px 20px 28px; gap: 24px; }
  .horizon { --size: 160px; }
  .drop-actions { width: 100%; flex-direction: column; }
  .drop-actions .btn { width: 100%; }

  body.has-files .drop { padding: 14px 14px 14px 16px; gap: 14px; flex-wrap: wrap; }
  body.has-files .drop .horizon { --size: 44px; }
  body.has-files .drop-actions { flex-direction: row; width: 100%; }
  body.has-files .drop-actions .btn { flex: 1; }

  .panel-head { padding: 18px 16px 10px; }
  .kind-list { padding: 0 4px 8px; }
  .file-head { padding: 6px 8px 6px 2px; gap: 4px; }
  .file-toggle { gap: 12px; padding: 8px; }
  .thumb { width: 44px; height: 44px; border-radius: 10px; }
  .file-meta { white-space: normal; }
  .sig-group { padding: 0 8px 0 10px; }
  .file-empty, .file-msg { padding: 4px 18px; }
  .file-foot { padding: 6px 18px 0; }

  .notes-grid { grid-template-columns: 1fr; gap: 28px; }

  .actionbar { padding: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  .ab-inner { border-radius: 22px; padding: 10px 10px 10px 16px; gap: 12px; }
  .ab-text { font-size: 13px; }
  .ab-text span { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .btn .spin, .file-meta .busy::before { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}
