/* ==========================================================================
   ApkUnify — design system
   A precise, technical identity built around the idea of many package
   fragments being registered and fused into one file.
   ========================================================================== */

:root {
  color-scheme: light;

  /* surfaces */
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;

  /* ink */
  --ink: #101318;
  --ink-2: #343a45;
  --muted: #596170;

  /* strokes */
  --line: #e3e5ea;
  --line-strong: #cfd3db;

  /* brand */
  --accent: #3046e8;
  --accent-ink: #ffffff;
  --accent-soft: #eef0fe;
  --accent-border: rgba(48, 70, 232, 0.2);

  /* semantic */
  --success: #0b7a53;
  --success-soft: #e9f7f0;
  --success-border: rgba(11, 122, 83, 0.2);
  --danger: #b92b2b;
  --danger-soft: #fdf0ef;
  --danger-border: rgba(185, 43, 43, 0.2);

  /* log panel */
  --terminal-bg: #0c0e13;
  --terminal-text: #c6ccd8;
  --terminal-time: #7d8596;

  /* elevation */
  --shadow-sm: 0 1px 2px rgba(16, 19, 24, 0.05);
  --shadow-card: 0 1px 0 rgba(16, 19, 24, 0.04), 0 28px 64px -32px rgba(16, 19, 24, 0.28);
  --focus: rgba(48, 70, 232, 0.24);

  /* geometry */
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 11px;
  --radius-sm: 8px;
  --shell: 1160px;
  --gutter: 28px;

  /* type */
  --font-sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  /* hero illustration */
  --art-plate-top: #ffffff;
  --art-plate-bottom: #eef0f4;
  --art-stroke: #d5d9e1;
  --art-grid: rgba(16, 19, 24, 0.055);
  --art-ink: #101318;
  --art-label: #767e8d;
  --art-accent: #3a4ff0;
  --art-result-fill: #eef0fe;
  --art-check: #ffffff;
  --art-shadow: rgba(16, 19, 24, 0.12);
}

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

  --bg: #0b0c0f;
  --surface: #121419;
  --surface-2: #161920;
  --surface-3: #1c2028;

  --ink: #f2f4f7;
  --ink-2: #ced3dc;
  --muted: #9aa2b1;

  --line: #23262e;
  --line-strong: #343944;

  --accent: #8892ff;
  --accent-ink: #0b0c0f;
  --accent-soft: rgba(136, 146, 255, 0.12);
  --accent-border: rgba(136, 146, 255, 0.28);

  --success: #5fd6a4;
  --success-soft: rgba(95, 214, 164, 0.1);
  --success-border: rgba(95, 214, 164, 0.24);
  --danger: #ff8a80;
  --danger-soft: rgba(255, 138, 128, 0.1);
  --danger-border: rgba(255, 138, 128, 0.24);

  --terminal-bg: #08090c;
  --terminal-text: #c6ccd8;
  --terminal-time: #7d8596;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03), 0 36px 80px -36px rgba(0, 0, 0, 0.8);
  --focus: rgba(136, 146, 255, 0.3);

  --art-plate-top: #1b1f27;
  --art-plate-bottom: #14171d;
  --art-stroke: #2e333d;
  --art-grid: rgba(255, 255, 255, 0.05);
  --art-ink: #eef0f4;
  --art-label: #8a92a2;
  --art-accent: #8892ff;
  --art-result-fill: rgba(136, 146, 255, 0.09);
  --art-check: #0b0c0f;
  --art-shadow: rgba(0, 0, 0, 0.55);
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

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

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

svg {
  display: block;
}

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

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

.hidden {
  display: none !important;
}

.no-wrap {
  white-space: nowrap;
}

/* Avoid orphaned last lines in helper copy. */
.result-sub {
  text-wrap: balance;
}

.input-note,
.result-note,
.error-msg,
.error-tip,
.process-hint,
.pipeline-body span,
.limits dd {
  text-wrap: pretty;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: top 160ms ease;
}

.skip-link:focus-visible {
  top: 12px;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.shell {
  width: min(var(--shell), 100% - var(--gutter) * 2);
  margin-inline: auto;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .site-header {
    background: var(--bg);
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.brand-mark {
  display: block;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

[data-theme="dark"] .brand-mark {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.brand-name {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 16%, transparent);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.theme-toggle:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--muted);
}

.icon-sun,
.icon-moon {
  display: none;
}

[data-theme="light"] .icon-moon,
[data-theme="dark"] .icon-sun {
  display: block;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.page-main {
  flex: 1 0 auto;
  padding-top: 58px;
  padding-bottom: 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: 40px clamp(32px, 5vw, 76px);
}

.hero-copy {
  min-width: 0;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  padding: 5px 11px 5px 9px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.hero-kicker::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hero-title {
  font-size: clamp(2.5rem, 1.4rem + 4.4vw, 4.15rem);
  font-weight: 640;
  line-height: 1.06;
  letter-spacing: -0.038em;
  text-wrap: balance;
}

.hero-lede {
  max-width: 32em;
  margin-top: 22px;
  font-size: 17.5px;
  line-height: 1.72;
  color: var(--ink-2);
  text-wrap: pretty;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 26px;
  font-size: 14px;
  color: var(--ink-2);
}

.hero-facts li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;}

.hero-facts svg {
  color: var(--accent);
  flex-shrink: 0;
}

.hero-art {
  min-width: 0;
}

.assembly {
  width: 100%;
  height: auto;
  overflow: visible;
}

.art-label,
.assembly text {
  font-family: var(--font-mono);
}

.assembly .diagram-label {
  fill: var(--art-label);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.assembly .source-text {
  fill: var(--art-ink);
  font-size: 14px;
}

.assembly .plate {
  fill: url(#plateFill);
  stroke: var(--art-stroke);
  stroke-width: 1.2;
}

.assembly .node {
  fill: var(--art-accent);
}

.assembly .diagram-line {
  fill: none;
  stroke: var(--art-accent);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.assembly .result-plate {
  fill: var(--art-result-fill);
  stroke: var(--art-accent);
  stroke-width: 1.5;
}

.assembly .result-rule {
  stroke: var(--art-accent);
  stroke-width: 1;
  opacity: 0.25;
}

.assembly .result-title {
  fill: var(--art-ink);
  font-size: 17px;
  font-weight: 600;
}

.assembly .result-sub-label {
  fill: var(--art-label);
  font-size: 12px;
  letter-spacing: 0.05em;
}

.assembly .check-disc {
  fill: var(--art-accent);
}

.assembly .check-mark {
  fill: none;
  stroke: var(--art-check);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assembly .art-grid path {
  stroke: var(--art-grid);
  stroke-width: 1;
}

.assembly .diagram-ticks {
  fill: none;
  stroke: var(--art-stroke);
  stroke-width: 1;
}

.assembly .plate-stop-top {
  stop-color: var(--art-plate-top);
}

.assembly .plate-stop-bottom {
  stop-color: var(--art-plate-bottom);
}

#plateShadow feDropShadow {
  flood-color: var(--art-shadow);
}

.art-result {
  transform-origin: 409px 203px;
}

/* One orchestrated entrance: the fragments register into place. */
@media (prefers-reduced-motion: no-preference) {
  .art-sources .source {
    opacity: 0;
    animation: plate-in 520ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .source.s1 { animation-delay: 60ms; }
  .source.s2 { animation-delay: 130ms; }
  .source.s3 { animation-delay: 200ms; }
  .source.s4 { animation-delay: 270ms; }

  .art-bus,
  .art-arrow {
    opacity: 0;
    animation: fade-in 420ms ease-out 420ms both;
  }

  .art-result,
  .art-ticks {
    opacity: 0;
    animation: settle 560ms cubic-bezier(0.2, 0.7, 0.2, 1) 520ms both;
  }
}

@keyframes plate-in {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================================================
   Converter / workbench
   ========================================================================== */

.converter {
  margin-top: 54px;
}

.workbench {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.view-input {
  padding: 24px;
  animation: view-in 260ms ease-out both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Drop zone */

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 30px 26px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.dropzone:hover {
  border-color: var(--accent-border);
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface-2));
}

.dropzone.drag-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.crop {
  position: absolute;
  width: 15px;
  height: 15px;
  border: 0 solid var(--accent);
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.crop-tl { top: 9px; left: 9px; border-top-width: 1.5px; border-left-width: 1.5px; border-top-left-radius: 2px; }
.crop-tr { top: 9px; right: 9px; border-top-width: 1.5px; border-right-width: 1.5px; border-top-right-radius: 2px; }
.crop-bl { bottom: 9px; left: 9px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-bottom-left-radius: 2px; }
.crop-br { bottom: 9px; right: 9px; border-bottom-width: 1.5px; border-right-width: 1.5px; border-bottom-right-radius: 2px; }

.dropzone:hover .crop,
.dropzone.drag-active .crop {
  opacity: 1;
}

.dz-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.dropzone.drag-active .dz-icon {
  border-color: var(--accent-border);
}

.dz-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dz-copy strong {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.dz-copy span {
  font-size: 14px;
  color: var(--muted);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease,
    box-shadow 160ms ease, transform 160ms ease;
}

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

.btn-primary {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 19, 24, 0.16);
}

.btn-primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
}

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

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

.btn-quiet {
  color: var(--ink-2);
  background: var(--surface-2);
  border-color: var(--line);
}

.btn-quiet:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-lg {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 11px;
  font-size: 15px;
}

.btn-xs {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: progress;
  transform: none;
}

/* Input options + note */

.input-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px 44px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.options {
  flex: 0 0 auto;
}

.options summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
}

.options summary::-webkit-details-marker {
  display: none;
}

.options summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
}

.options[open] summary::before {
  content: "−";
}

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

.options-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 400px;
  max-width: 100%;
  margin-top: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  color: var(--muted);
}

.field input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input::placeholder {
  color: var(--muted);
}

.field input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.input-note {
  flex: 0 1 460px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--muted);
}

.noscript {
  margin-top: 16px;
  padding: 11px 14px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.6;
}

/* ==========================================================================
   Processing
   ========================================================================== */

.view-processing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  min-height: 468px;
  animation: view-in 260ms ease-out both;
}

.view-main {
  min-width: 0;
  padding: 42px 40px;
}

.view-processing .view-main {
  display: flex;
  flex-direction: column;
}

.process-body {
  margin-block: auto;
  padding-block: 24px;
}

.view-rail {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border-left: 1px solid var(--line);
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.rail-head h2 {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.rail-note {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.rail-action {
  padding: 4px 9px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.rail-action:hover {
  color: var(--danger);
  border-color: var(--danger-border);
}

.process-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 11px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.file-chip svg {
  flex-shrink: 0;
  color: var(--muted);
}

.file-chip-name {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

.file-chip-size {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;}

.process-flag {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.process-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--ink-2);
}

.spinner {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 760ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.process-percent {
  margin: 16px 0 20px;
  font-size: clamp(68px, 8.4vw, 108px);
  font-weight: 600;
  line-height: 0.88;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 999px;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 320ms ease;
}

.process-hint {
  margin-top: 18px;
  max-width: 40em;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

/* Terminal */

.terminal-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 18px;
  color: var(--terminal-text);
  background: var(--terminal-bg);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.72;
  scrollbar-width: thin;
  scrollbar-color: #3a4150 transparent;
}

.terminal-content:empty::before {
  content: "等待任务…";
  color: #4b5262;
}

.terminal-content::-webkit-scrollbar {
  width: 8px;
}

.terminal-content::-webkit-scrollbar-thumb {
  background: #3a4150;
  border-radius: 999px;
}

.term-line {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  padding: 1px 0;
}

.term-time {
  flex-shrink: 0;
  color: var(--terminal-time);
}

.term-tag {
  flex-shrink: 0;
  font-weight: 700;
}

.tag-info { color: #7dd3fc; }
.tag-stage { color: #c4b5fd; }
.tag-success { color: #86efac; }
.tag-warn { color: #fcd34d; }
.tag-error { color: #fca5a5; }

.term-text {
  min-width: 0;
  word-break: break-word;
}

/* ==========================================================================
   Result
   ========================================================================== */

.view-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 396px;
  min-height: 560px;
  animation: view-in 260ms ease-out both;
}

.result-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.success-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 4px 10px;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}

.result-package {
  max-width: 100%;
  margin-top: 4px;
  font-size: clamp(23px, 2.3vw, 29px);
  font-weight: 640;
  line-height: 1.18;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.result-version {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  min-height: 1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;}

.result-sub {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

.result-size {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 30px 0 22px;
}

.result-size-value {
  font-size: clamp(50px, 5.8vw, 66px);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.result-size-label {
  font-size: 13.5px;
  color: var(--muted);
}

.result-size-label span {
  display: block;
  font-size: 13px;
  white-space: nowrap;
}

.result-size-label > span > span {
  display: inline;
  color: var(--ink-2);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
  padding: 12px 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 2px 14px;
  border-left: 1px solid var(--line);
}

.stat:first-child {
  border-left: 0;
}

.stat-label {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
}

.stat-value {
  font-size: 15.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.stat-sub {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.output-name {
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.result-actions .btn-primary {
  min-width: 208px;
}

.hash-details {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.hash-details summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 14px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
}

.hash-details summary::-webkit-details-marker {
  display: none;
}

.hash-details summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
}

.hash-details[open] summary::before {
  content: "−";
}

.hash-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 12px;
}

.hash-row code {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
;
}

.copy-btn {
  flex-shrink: 0;
  padding: 0 12px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.copy-btn:hover,
.copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent-border);
}

.result-note {
  margin-top: 18px;
  max-width: 46em;
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--muted);
}

/* Result rail */

.rail-foot {
  margin-top: auto;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
}

.rail-foot p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.detail-tabs {
  display: flex;
  gap: 22px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}

.detail-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
  white-space: nowrap;
}

.detail-tab span {
  padding: 1px 6px;
  color: var(--muted);
  background: var(--surface-3);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

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

.detail-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.detail-tab.is-active span {
  color: var(--accent);
  background: var(--accent-soft);
}

.detail-panels {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.detail-panel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 22px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.detail-panel.is-active {
  display: block;
}

.detail-panel[data-detail-panel="logs"] {
  padding: 0;
}

.terminal-inline {
  height: 100%;
  background: var(--terminal-bg);
}

.split-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0 11px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}

.split-toolbar-text {
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.split-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.split-group {
  border-top: 1px solid var(--line);
}

.split-group:first-of-type {
  border-top: 0;
}

.split-group-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 0;
  font-size: 13.5px;
  color: var(--ink-2);
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.split-group-summary::-webkit-details-marker {
  display: none;
}

.split-group-summary::before {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin-right: 1px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}

.split-group[open] .split-group-summary::before {
  transform: rotate(45deg);
}

.split-group-summary:hover {
  color: var(--ink);
}

.split-group-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.split-group-count {
  flex-shrink: 0;
  margin-left: auto;
  padding: 1px 6px;
  color: var(--muted);
  background: var(--surface-3);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.split-group-body > .split-row:first-child {
  border-top: 0;
}

.split-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.split-row:last-child {
  border-bottom: 0;
}

.split-badge {
  flex-shrink: 0;
  min-width: 38px;
  padding: 2px 5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.split-body {
  flex: 1 1 auto;
  min-width: 0;
}

.split-name {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.split-meta {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;}

.split-download {
  flex-shrink: 0;
  align-self: center;
  padding: 3px 8px;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent-border);
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
  white-space: nowrap;}

.split-download:hover {
  color: var(--accent-ink);
  background: var(--accent);
}

.split-disabled {
  flex-shrink: 0;
  align-self: center;
  color: var(--muted);
  font-size: 12.5px;
}

.file-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-2);
}

.file-stat-row:first-child {
  padding-top: 2px;
}

.file-stat-row b {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.panel-title {
  margin: 20px 0 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.file-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

.file-path {
  min-width: 0;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.file-size {
  flex-shrink: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;}

.empty-row {
  padding: 34px 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}

/* ==========================================================================
   Error
   ========================================================================== */

.view-error {
  padding: 64px 40px;
  animation: view-in 260ms ease-out both;
}

.error-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-lg);
  transition: border-color 180ms ease, background 180ms ease;
}

.view-error.drag-active .error-card {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  padding: 26px;
  border-radius: var(--radius-lg);
}

.error-mark {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: 12px;
}

.error-body {
  flex: 1 1 auto;
  min-width: 0;
}

.error-title {
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 640;
  letter-spacing: -0.02em;
}

.error-msg {
  margin-bottom: 10px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.error-tip {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

.error-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  align-self: stretch;
  justify-content: center;
  min-width: 156px;
}

.error-actions .btn {
  width: 100%;
}

/* ==========================================================================
   Notes
   ========================================================================== */

.notes {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: 40px clamp(40px, 6vw, 88px);
  margin-top: 64px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}

.notes-title {
  margin-bottom: 14px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.pipeline li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.pipeline li:last-child {
  padding-bottom: 0;
}

.pipeline-step {
  padding-top: 2px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
  white-space: nowrap;}

.pipeline-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pipeline-body strong {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.pipeline-body span {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
}

.limits .limit {
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.limits .limit:last-child {
  padding-bottom: 0;
}

.limits dt {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.limits dd {
  margin-top: 3px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  flex: 0 0 auto;
  margin-top: 64px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding-top: 24px;
  padding-bottom: 32px;
  font-size: 13px;
  color: var(--muted);
}

/* ==========================================================================
   View switching
   ========================================================================== */

body:not([data-view="input"]) .hero,
body:not([data-view="input"]) .notes {
  display: none;
}

body:not([data-view="input"]) .page-main {
  padding-top: 30px;
}

body:not([data-view="input"]) .converter {
  margin-top: 0;
}

@media (min-width: 921px) {
  body:not([data-view="input"]) .page-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 28px;
    padding-bottom: 28px;
  }

  body:not([data-view="input"]) .converter {
    width: min(var(--shell), 100% - var(--gutter) * 2);
    margin-inline: auto;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1080px) {
  .hero {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 32px;
  }

  .view-processing {
    grid-template-columns: minmax(0, 1fr) 340px;
  }

  .view-result {
    grid-template-columns: minmax(0, 1fr) 360px;
  }

  .view-main {
    padding: 34px 30px;
  }
}

@media (max-width: 920px) {
  .page-main {
    padding-top: 36px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .hero-art {
    max-width: 520px;
    margin-inline: auto;
    width: 100%;
  }

  .converter {
    margin-top: 40px;
  }

  .view-processing,
  .view-result {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .view-rail {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .rail-log {
    min-height: 300px;
  }

  .terminal-content {
    max-height: 340px;
  }

  .detail-panels {
    min-height: 260px;
  }

  .detail-panel {
    max-height: 380px;
  }

  .notes {
    grid-template-columns: minmax(0, 1fr);
    gap: 44px;
    margin-top: 48px;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 18px;
  }

  .header-inner {
    height: 58px;
  }

  .status-note {
    display: none;
  }

  .brand-name {
    font-size: 16px;
  }

  .page-main {
    padding-top: 30px;
  }

  .hero {
    gap: 32px;
  }

  .hero-kicker {
    margin-bottom: 16px;
  }

  .hero-title {
    font-size: clamp(2.1rem, 8.2vw, 2.7rem);
    letter-spacing: -0.03em;
  }

  .hero-lede {
    margin-top: 18px;
    font-size: 16px;
  }

  .hero-facts {
    gap: 8px 18px;
    margin-top: 22px;
    font-size: 14px;
  }

  .hero-art {
    display: none;
  }

  .view-input {
    padding: 16px;
  }

  .dropzone {
    flex-wrap: wrap;
    padding: 22px 18px;
    gap: 14px;
  }

  .dz-icon {
    width: 44px;
    height: 44px;
  }

  .dz-copy {
    flex-basis: calc(100% - 64px);
  }

  .dz-copy strong {
    font-size: 16px;
  }

  .dz-copy span {
    font-size: 13px;
  }

  .dropzone .btn {
    width: 100%;
  }

  .input-foot {
    flex-direction: column;
    gap: 16px;
  }

  .input-note {
    flex: 0 0 auto;
    padding-left: 0;
    border-left: 0;
    max-width: none;
  }

  .view-main {
    padding: 26px 20px;
  }

  .process-stage {
    margin-top: 44px;
  }

  .process-percent {
    font-size: 74px;
  }

  .view-error {
    padding: 24px 16px;
  }

  .error-card {
    flex-direction: column;
    gap: 16px;
  }

  .error-actions {
    flex-direction: row;
    width: 100%;
    min-width: 0;
    align-self: auto;
  }

  .result-stats {
    grid-template-columns: 1fr 1fr;
    padding: 6px 2px;
  }

  .stat {
    padding: 9px 13px;
  }

  .stat:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
    margin-top: 4px;
    padding-top: 12px;
  }

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

  .result-actions {
    flex-direction: column;
  }

  .result-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .result-size-value {
    font-size: 54px;
  }

  .detail-tabs {
    gap: 18px;
    padding: 0 18px;
  }

  .detail-panel {
    padding: 14px 18px 18px;
  }

  .rail-head {
    padding: 15px 18px;
  }

  .notes {
    margin-top: 40px;
    padding-top: 30px;
  }

  .site-footer {
    margin-top: 44px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-top: 20px;
    padding-bottom: 26px;
  }
}

/* Very narrow phones: stack the drop zone so the instruction line never breaks mid-phrase. */
@media (max-width: 380px) {
  .dropzone {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .dz-copy {
    flex-basis: auto;
    width: 100%;
  }

  .dz-copy strong,
  .dz-copy span {
    line-height: 1.45;
  }

  .result-package {
    font-size: 22px;
  }
}

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