:root {
  color-scheme: dark;
  --page: #0b0f11; --surface: #12181c; --surface-2: #171f24; --surface-3: #0d1316;
  --line: #2b353b; --line-strong: #3b484f; --text: #edf3f0; --muted: #96a5ad; --quiet: #66767f;
  --accent: #71d6a3; --accent-strong: #3ecf91; --accent-ink: #07150f;
  --blue: #67a8e4; --amber: #e4b35f; --red: #ef7a7f; --radius: 6px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body { margin: 0; color: var(--text); background: var(--page); letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.app-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 66px; padding: 10px max(24px, calc((100vw - 1240px) / 2)); border-bottom: 1px solid var(--line); background: rgba(11, 15, 17, .96); backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; color: var(--text); text-decoration: none; }
.brand-logo { width: 84px; height: 46px; flex: 0 0 auto; padding: 3px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: #0d1c1a; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.header-actions, .account { display: flex; align-items: center; gap: 14px; }
.nav-link, .account a { color: var(--muted); font-size: 13px; text-decoration: none; }
.nav-link:hover, .account a:hover { color: var(--text); }
.account img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.account span { font-size: 13px; font-weight: 700; }
.page-shell { width: min(1360px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 72px; }
.page-heading { max-width: 860px; margin: 0 0 22px; }
.page-heading h1 { margin: 6px 0 8px; font-size: 30px; line-height: 1.08; }
.page-heading p:not(.eyebrow) { max-width: 700px; margin: 0; color: var(--muted); line-height: 1.55; }
.eyebrow, .kicker { margin: 0; color: var(--accent); font: 700 11px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; }
.stats-panel { margin-bottom: 14px; padding: 15px 18px 12px; box-shadow: 0 14px 34px rgba(0, 0, 0, .12); }
.stats-panel .panel-heading { align-items: center; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.live-status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--muted) !important; font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.live-status svg { width: 13px; height: 13px; color: var(--accent); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { min-width: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); }
.stat-label { display: flex; align-items: center; gap: 7px; color: var(--quiet); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.stat-label svg { width: 14px; height: 14px; color: var(--accent); }
.stat strong { display: block; margin-top: 7px; color: var(--text); font-size: 22px; line-height: 1; }
.stats-chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: stretch; gap: 10px; height: 76px; margin-top: 9px; padding: 7px 8px 0; border-bottom: 1px solid var(--line); }
.stats-chart:empty, .stats-chart[hidden] { display: none; }
.chart-column { display: grid; grid-template-rows: auto 1fr auto; min-width: 0; gap: 5px; text-align: center; }
.chart-column strong { color: var(--muted); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.chart-track { display: flex; align-items: end; justify-content: center; min-height: 0; }
.chart-bar { width: min(34px, 75%); min-height: 4px; height: var(--bar-height); border-radius: 3px 3px 1px 1px; background: var(--accent-strong); }
.chart-column small { overflow: hidden; color: var(--quiet); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.stats-note { margin: 7px 0 0; color: var(--quiet); font-size: 11px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 16px; }
.workspace:has(.result-column > section:not([hidden])) { grid-template-columns: minmax(0, 1.3fr) minmax(360px, .7fr); justify-content: initial; }
.upload-column, .result-column { display: grid; gap: 16px; min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.upload-panel, .job-panel { padding: 20px; box-shadow: 0 18px 44px rgba(0, 0, 0, .12); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 16px; line-height: 1.3; }
.panel-heading > span { color: var(--quiet); font-size: 11px; }
.dropzone { display: grid; place-items: center; width: 100%; min-height: 210px; padding: 24px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 5px; background: var(--surface-3); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: #0d1914; transform: translateY(-1px); }
.dropzone svg { width: 48px; height: 48px; margin-bottom: 14px; padding: 11px; color: var(--accent); border: 1px solid #2f6952; border-radius: 50%; background: #10281d; }
.dropzone strong { color: var(--text); font-size: 16px; }
.dropzone span { margin-top: 5px; }
.dropzone small { margin-top: 16px; color: var(--quiet); }
.file-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 36px; align-items: center; gap: 12px; min-height: 74px; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-3); }
.file-row > svg { width: 28px; height: 28px; color: var(--accent); }
.file-row strong, .file-row span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row strong { font-size: 14px; }
.file-row span { margin-top: 4px; color: var(--muted); font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.repair-option { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 14px; padding: 13px; border: 1px solid #315744; border-radius: 5px; background: #0e1b16; }
.repair-icon { display: grid; place-items: center; width: 36px; height: 36px; color: var(--accent); border: 1px solid #347258; border-radius: 50%; background: #12281e; }
.repair-icon svg { width: 18px; height: 18px; }
.repair-option strong, .repair-option span, .repair-option small { display: block; }
.repair-option strong { font-size: 13px; }
.repair-option div > span { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.repair-option small { margin-top: 6px; color: var(--quiet); font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.repair-option .repair-state { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font: 700 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.repair-state svg { width: 13px; height: 13px; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; color: var(--muted); border: 1px solid transparent; border-radius: 3px; background: transparent; cursor: pointer; }
.icon-button:hover { color: var(--text); border-color: var(--line); background: var(--surface-2); }
.icon-button svg { width: 18px; height: 18px; }
.consent-row { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; margin: 16px 0; color: var(--muted); font-size: 13px; line-height: 1.45; cursor: pointer; }
.consent-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-strong); }
.button-row { display: flex; gap: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 4px; font-weight: 700; font-size: 13px; text-decoration: none; cursor: pointer; }
.button svg { width: 17px; height: 17px; }
.button.primary { color: var(--accent-ink); background: var(--accent); }
.button.primary:hover:not(:disabled) { background: #8ee2b7; }
.button.secondary { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.button.secondary:hover:not(:disabled) { border-color: #61717a; }
.button:disabled, .button[aria-disabled="true"] { opacity: .42; cursor: not-allowed; }
.button.compact { min-height: 34px; padding: 0 12px; }
.form-message { min-height: 18px; margin: 12px 0 0; color: var(--red); font-size: 12px; }
.form-message:empty { display: none; }
.site-header-fallback .fallback-nav { display: flex; }
.status-heading { align-items: flex-start; }
.status-heading h2 { font-size: 18px; }
.status-heading p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.state-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border: 1px solid currentColor; border-radius: 999px; font: 700 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.state-chip.uploading { color: var(--blue); background: #132334; }
.state-chip.validating { color: var(--amber); background: #2a2112; }
.state-chip.converting { color: #c697ea; background: #24182e; }
.state-chip.ready { color: var(--accent); background: #10281d; }
.state-chip.failed { color: var(--red); background: #31171a; }
.progress-line { height: 5px; overflow: hidden; border-radius: 2px; background: #090d0f; }
.progress-line span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .25s ease; }
.progress-caption { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.progress-caption strong { color: var(--accent); }
.job-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 18px 0 0; border-top: 1px solid var(--line); }
.job-meta div { min-width: 0; padding: 13px 10px 0 0; }
.job-meta dt { color: var(--quiet); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.job-meta dd { margin: 5px 0 0; overflow: hidden; color: var(--text); font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.console-panel { overflow: hidden; }
.console-panel .panel-heading { margin: 0; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.terminal { height: 260px; overflow: auto; padding: 14px 16px; color: #bcc9ce; background: #080c0e; font: 12px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; }
.terminal p { display: grid; grid-template-columns: 88px 88px minmax(0, 1fr); gap: 6px; margin: 0; }
.terminal time { color: #61717a; }
.terminal b { color: var(--blue); }
.terminal .validate { color: var(--amber); }
.terminal .converting { color: #c697ea; }
.terminal .done { color: var(--accent); }
.terminal .error { color: var(--red); }
.preview-panel { overflow: hidden; }
.preview-panel .panel-heading { margin: 0; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.avatar-viewport { width: 100%; aspect-ratio: 4 / 3; min-height: 320px; background: #0a0f12; }
.avatar-viewport canvas { display: block; width: 100%; height: 100%; }
.preview-panel > p { margin: 0; padding: 10px 14px; color: var(--quiet); border-top: 1px solid var(--line); font-size: 11px; }
.download-panel { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 18px; border-color: #347258; background: #102019; }
.download-panel > svg { width: 36px; height: 36px; color: var(--accent); }
.download-panel h2 { margin: 4px 0; font-size: 17px; }
.download-panel > div { min-width: 0; }
.download-panel p { margin: 0; }
.download-panel strong { display: block; max-width: 100%; overflow-wrap: anywhere; }
.download-panel p span { display: block; margin-top: 4px; color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.download-panel p small { display: block; margin-top: 8px; color: var(--accent); font-size: 11px; line-height: 1.4; }
.download-panel .button { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .result-column { grid-row: 2; }
  .site-header-fallback .fallback-nav { display: none; }
}
@media (max-width: 640px) {
  .app-header { align-items: flex-start; padding: 10px 14px; }
  .header-actions { justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
  .nav-link { display: none; }
  .account span { display: none; }
  .page-shell { width: calc(100% - 28px); padding-top: 20px; }
  .brand-logo { width: 62px; height: 38px; }
  .brand { gap: 8px; }
  .brand strong { font-size: 13px; }
  .brand small { font-size: 10px; }
  .page-heading { margin-top: 4px; }
  .stats-panel { padding: 15px 14px 12px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-chart { gap: 4px; padding-inline: 0; }
  .dropzone { min-height: 210px; }
  .job-meta { grid-template-columns: 1fr; }
  .button-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .repair-option { grid-template-columns: 36px minmax(0, 1fr); }
  .repair-option .repair-state { grid-column: 2; }
  .avatar-viewport { min-height: 280px; }
  .terminal p { grid-template-columns: 72px 76px minmax(0, 1fr); font-size: 10px; }
}
