/* 1Format — application stylesheet. No framework, no external fonts. */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-soft: #dbeafe;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --fail: #dc2626;
  --fail-soft: #fee2e2;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px -12px rgba(15, 23, 42, .15);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --surface: #111a2e; --surface-2: #17223a; --text: #e5e9f2; --text-2: #a7b1c6; --text-3: #6b778f;
    --line: #23304a; --brand: #4f8cff; --brand-2: #3b78f0; --brand-soft: #1b2d54;
    --ok-soft: #10331f; --warn-soft: #3a2a08; --fail-soft: #3d1414;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.55; font-size: 16px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.container { width: min(1080px, 100% - 32px); margin-inline: auto; }
.container.narrow { width: min(680px, 100% - 32px); }
.muted { color: var(--text-3); }
.visually-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* Header / footer */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.25rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.site-nav { display: flex; gap: 6px; align-items: center; }
.site-nav a, .link-button { color: var(--text-2); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.site-nav a:hover, .link-button:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.link-button { background: none; border: 0; font: inherit; cursor: pointer; }
.inline-form { display: inline; }
.site-footer { border-top: 1px solid var(--line); margin-top: 72px; padding: 32px 0 40px; color: var(--text-2); font-size: .92rem; }
.footer-inner { display: grid; gap: 10px; }
.footer-nav { display: flex; gap: 18px; }
.footer-privacy { margin: 0; }
.footer-copy { margin: 0; color: var(--text-3); }

/* Hero */
.hero { padding: 56px 0 28px; text-align: center; }
.hero-compact { padding: 40px 0 16px; }
.eyebrow { margin: 0 0 10px; color: var(--brand); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .78rem; }
.hero-title { margin: 0; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.1; letter-spacing: -.02em; font-weight: 800; }
.hero-lead { margin: 16px auto 0; max-width: 620px; color: var(--text-2); font-size: 1.1rem; }
.hero-steps { margin: 18px 0 0; color: var(--text-3); font-size: .95rem; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }

/* Converter */
.converter { margin-top: 28px; }
.stage[hidden] { display: none !important; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 56px 24px; border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; text-align: center; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand); outline: none; }
.dropzone.is-dragover { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.005); }
.dropzone-icon { width: 56px; height: 56px; color: var(--brand); margin-bottom: 4px; }
.dropzone-title { margin: 0; font-size: 1.35rem; font-weight: 700; }
.dropzone-or { margin: 0; color: var(--text-3); }
.dropzone-hint { margin: 14px 0 0; color: var(--text-3); font-size: .9rem; }
.noscript-actions { margin-top: 12px; text-align: center; }
.stage-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.stage-filename { margin: 0; font-weight: 600; word-break: break-word; }
.stage-meta { margin: 2px 0 0; color: var(--text-2); font-size: .95rem; }
.stage-status { margin: 12px 0 8px; color: var(--text-2); }
.stage-hint { margin: 14px 0 0; color: var(--text-3); font-size: .9rem; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 22px; }
.file-summary { display: flex; align-items: center; gap: 14px; }
.file-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; height: 40px; padding: 0 10px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-2); font-weight: 800; font-size: .85rem; letter-spacing: .04em; }
.format-picker { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: end; margin-top: 24px; padding: 20px; background: var(--surface-2); border-radius: var(--radius-sm); }
.format-label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; margin-bottom: 6px; }
.format-value { display: block; font-size: 1.6rem; font-weight: 800; line-height: 46px; }
.format-arrow { font-size: 1.8rem; color: var(--text-3); padding-bottom: 6px; }
.format-select { width: 100%; height: 46px; font: inherit; font-weight: 700; font-size: 1.05rem; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.format-note { margin: 14px 0 0; padding: 12px 14px; background: var(--warn-soft); color: #7c4a03; border-radius: var(--radius-sm); font-size: .93rem; }
@media (prefers-color-scheme: dark) { .format-note { color: #fcd34d; } }
.advanced { margin-top: 16px; }
.advanced summary { cursor: pointer; color: var(--text-2); font-weight: 500; }
.advanced-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 12px; }
.advanced-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--text-2); }
.advanced-grid label[hidden] { display: none; }
.advanced-grid input[type=number] { height: 38px; font: inherit; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.advanced-grid .checkbox { flex-direction: row; align-items: center; gap: 8px; align-self: end; height: 38px; }
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-bar { height: 100%; background: var(--brand); border-radius: 999px; transition: width .2s; }
.progress-indeterminate .progress-bar { width: 35%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.stage-done, .stage-error, .error-page { text-align: center; }
.stage-done .stage-actions, .stage-error .stage-actions { justify-content: center; }
.done-check { margin: 0 auto 10px; width: 56px; height: 56px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 1.7rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.done-title, .error-title { margin: 0 0 12px; font-size: 1.5rem; }
.error-icon { margin: 0 auto 10px; width: 56px; height: 56px; border-radius: 50%; background: var(--fail-soft); color: var(--fail); font-size: 1.7rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.error-message { color: var(--text-2); margin: 0; }
.privacy-line { margin: 16px 0 0; text-align: center; color: var(--text-2); font-size: .92rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: background .15s, transform .05s; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-lg { height: 50px; padding: 0 26px; font-size: 1.05rem; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -6px rgba(37, 99, 235, .6); }
.btn-primary:hover { background: var(--brand-2); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Sections */
.section-title { font-size: 1.25rem; margin: 40px 0 8px; letter-spacing: -.01em; }
.section-desc { margin: 0 0 16px; color: var(--text-2); }
.section-more { margin-top: 12px; }
.popular { text-align: center; }
.chip-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: .9rem; }
.chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.chip-list-sm { justify-content: flex-start; }
.chip-list-sm .chip { padding: 5px 10px; font-size: .8rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 48px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature h3 { margin: 0 0 6px; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--text-2); }
.steps { padding-left: 22px; color: var(--text-2); }
.steps li { margin-bottom: 8px; }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); margin: 16px 0; }
.notice-warn { background: var(--warn-soft); color: #7c4a03; }
.notice-error { background: var(--fail-soft); color: var(--fail); }
.notice-ok { background: var(--ok-soft); color: var(--ok); }
.prose { max-width: 760px; }
.prose h2 { margin-top: 36px; font-size: 1.3rem; }
.prose ul { color: var(--text-2); }

/* Formats page */
.format-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.format-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.format-card-title { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.format-card-desc { color: var(--text-2); margin: 10px 0 4px; font-size: .95rem; }
.format-card-ext { color: var(--text-3); font-size: .82rem; margin: 0 0 12px; }
.format-card-label { margin: 0 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; }

/* Errors */
.error-page { padding: 72px 0; }
.error-code { color: var(--text-3); font-weight: 700; margin: 0; }
.debug-panel { text-align: left; margin-top: 32px; }
.debug-panel pre { overflow: auto; background: var(--surface-2); padding: 16px; border-radius: var(--radius-sm); font-size: .8rem; }

/* Admin */
.admin { padding-top: 32px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-login { max-width: 400px; padding-top: 60px; }
.login-form { display: grid; gap: 10px; margin-top: 20px; }
.login-form input { height: 44px; font: inherit; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 4px; }
.stat-label { color: var(--text-3); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-value { font-size: 1.7rem; font-weight: 800; }
.stat-value.ok { color: var(--ok); }
.stat-value.fail { color: var(--fail); }
.stat-inline { margin-right: 12px; }
.admin-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .95rem; }
.table th { color: var(--text-3); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-group th { background: var(--surface-2); color: var(--text); text-transform: none; font-size: .95rem; letter-spacing: 0; }
.diag-name { width: 260px; font-weight: 500; }
.diag-summary { display: flex; gap: 8px; margin: 16px 0; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-fail { background: var(--fail-soft); color: var(--fail); }

/* Responsive */
@media (max-width: 640px) {
  .header-inner { height: 56px; }
  .brand-name { font-size: 1.1rem; }
  .site-nav a { padding: 6px 8px; font-size: .95rem; }
  .hero { padding: 36px 0 20px; }
  .dropzone { padding: 40px 16px; }
  .stage-card { padding: 20px; }
  .format-picker { grid-template-columns: 1fr; }
  .format-arrow { display: none; }
  .stage-actions .btn { width: 100%; }
  .diag-name { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Inline text button (e.g. "delete them now") and disabled download state */
.link-inline { padding: 0; font-size: inherit; color: var(--brand); text-decoration: underline; }
.link-inline:hover { background: none; color: var(--brand-2); }
.btn-disabled { opacity: .5; pointer-events: none; }
