:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --canvas: #0a1020;
  --surface: #121b30;
  --surface-raised: #18243c;
  --glass: #141f36c7;
  --glass-overlay: #131d34ec;
  --border: #a9c1ff28;
  --text: #eff4ff;
  --text-muted: #b0bed9;
  --accent: #a9baff;
  --accent-soft: #8199ff24;
  --ok: #8ce2bb;
  --warn: #f4cd8e;
  --bad: #ffadc2;
  --shadow: 0 10px 28px #02061539, inset 0 1px #d3e1ff0c;
  --frost: blur(16px) saturate(135%);
  --ease-out: cubic-bezier(.2, .72, .26, 1);
  background: var(--canvas);
  color: var(--text);
}

* { box-sizing: border-box; }
body {
  min-width: 320px; min-height: 100vh; margin: 0;
  background: radial-gradient(ellipse at 83% 3%, #27386891, transparent 58%),
              radial-gradient(ellipse at 22% 94%, #1a445369, transparent 51%), var(--canvas);
  background-attachment: fixed;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 0; font-size: 1.16rem; letter-spacing: -.03em; }

.icon {
  display: inline-block; width: 1.05rem; height: 1.05rem; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.brand { display: inline-flex; align-items: center; gap: .65rem; color: inherit; font-size: 1.05rem; font-weight: 780; letter-spacing: -.025em; text-decoration: none; }
.brand small { display: block; margin-top: .22rem; color: #a9b8d4; font-size: .55rem; font-weight: 720; letter-spacing: .13em; }
.brand-mark { display: block; border-radius: .6rem; }
.environment { display: inline-flex; align-items: center; gap: .5rem; color: #b9c8e0; font-size: .69rem; font-weight: 650; }
.status-dot { width: .42rem; height: .42rem; flex: 0 0 auto; border-radius: 50%; background: #8caaff; box-shadow: 0 0 0 3px #8caaff22; }

.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1.8rem;
  margin-bottom: 1.25rem; padding: clamp(1.4rem, 3.8vw, 2.6rem);
  border: 1px solid #91adff40; border-radius: 1rem; color: #f7f9ff; box-shadow: var(--shadow);
  background:
    radial-gradient(circle, #b6c9ff28 1px, transparent 1.4px) 0 0 / 19px 19px,
    radial-gradient(ellipse at 94% 15%, #4b529e87, transparent 63%),
    linear-gradient(120deg, #172546, #1e305e);
}
.eyebrow { margin: 0 0 .45rem; color: var(--accent); font-size: .66rem; font-weight: 800; letter-spacing: .12em; }
.hero .eyebrow { color: #c2d2ff; }
.hero h1 { margin: 0 0 .6rem; font-size: clamp(2.45rem, 4.9vw, 4rem); font-weight: 780; line-height: 1.02; letter-spacing: -.067em; }
.hero-copy { max-width: 43ch; margin: 0; color: #d1dcf0; font-size: .95rem; line-height: 1.62; }
.hero-flow { position: relative; display: flex; align-items: stretch; gap: .7rem; padding: 0; margin: 0; list-style: none; }
.hero-flow::before { position: absolute; content: ''; left: 1rem; right: 1rem; top: 50%; height: 1px; background: linear-gradient(90deg, #8daaff55, #c7d5ff, #8daaff55); }
.hero-flow li {
  z-index: 0; display: grid; gap: .22rem; min-width: 5.2rem; padding: .75rem;
  border: 1px solid #b1c2ff4d; border-radius: .65rem; background: #18274dd9; box-shadow: 0 6px 20px #080e2b5c;
  backdrop-filter: blur(8px); animation: surface-in .38s var(--ease-out) backwards;
}
.hero-flow li:nth-child(2) { animation-delay: 65ms; }
.hero-flow li:nth-child(3) { animation-delay: 130ms; }
.hero-flow .icon { width: 1.4rem; height: 1.4rem; margin-bottom: .25rem; color: #b8ccff; }
.hero-flow span { font-size: .78rem; font-weight: 750; }
.hero-flow small { color: #c1d0ec; font-size: .68rem; }

.upload-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, .39fr); gap: 1.2rem; align-items: start; }
.upload-main { display: grid; gap: 1.1rem; min-width: 0; }
.console-card, .batch-card, .upload-guide {
  min-width: 0; border: 1px solid var(--border); border-radius: .9rem;
  background: var(--glass); backdrop-filter: var(--frost); box-shadow: var(--shadow);
}
.batch-card, .result-card { animation: surface-in .28s var(--ease-out) backwards; }
.batch-card:not(:has(#timeline:not([hidden]), #status-region:not([hidden]), #result:not([hidden]))) { display: none; }
.console-heading, .sign-in-panel, .upload-grid, .status-region, .result-card, .upload-guide { padding: clamp(1rem, 2.2vw, 1.4rem); }
.console-heading { display: flex; align-items: center; justify-content: space-between; gap: .8rem; border-bottom: 1px solid var(--border); }
.sign-in-panel, .sign-in-copy { display: flex; align-items: center; gap: .75rem; }
.sign-in-panel { justify-content: space-between; flex-wrap: wrap; }
.sign-in-copy { min-width: 0; color: var(--accent); }
.sign-in-copy p { margin: 0; color: var(--text-muted); line-height: 1.5; font-size: .88rem; }
.guide-icon { display: grid; width: 2.1rem; height: 2.1rem; place-items: center; margin-bottom: .75rem; border-radius: .55rem; color: var(--accent); background: var(--accent-soft); }
.upload-guide > p { margin: .45rem 0 0; color: var(--text-muted); font-size: .84rem; line-height: 1.55; }
.schema-list { padding: 0; margin: .75rem 0 1rem; list-style: none; }
.schema-list li { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: .25rem .5rem; padding: .56rem 0; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: .76rem; }
.schema-list code { padding: .2rem .38rem; border-radius: .33rem; background: var(--surface-raised); color: #d4dfff; font-size: .75rem; }
.guide-note { display: flex; align-items: flex-start; gap: .5rem; padding: .7rem; border-radius: .55rem; background: var(--accent-soft); color: var(--accent); }
.guide-note p { margin: 0; color: var(--text-muted); font-size: .77rem; line-height: 1.5; }
.guide-trigger { width: 100%; margin-top: .85rem; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.6rem; border: 1px solid transparent; border-radius: .56rem; padding: .55rem .82rem; font-size: .83rem; font-weight: 730; text-align: center; text-decoration: none; transition: background .15s ease, border-color .15s ease, transform .16s var(--ease-out); }
.button:not(:disabled):active { transform: scale(.98); }
.button-primary { background: var(--accent); color: #101a34; box-shadow: 0 3px 14px #9bafff2a; }
.button-primary:not(:disabled):hover { background: #c6d1ff; }
.button-secondary { background: var(--accent-soft); color: #d1dcff; }
.button-secondary:hover { background: #8199ff3c; }
.button-ghost { border-color: var(--border); background: #23334c5c; color: var(--text); }
.button-ghost:hover { border-color: #a9baff6b; background: var(--accent-soft); }
.sample-link { flex: 0 0 auto; }

.upload-grid { display: grid; gap: .9rem; }
.dropzone {
  display: grid; min-height: 9.4rem; min-width: 0; align-content: center; justify-items: center; gap: .32rem; padding: .85rem;
  border: 1px dashed #a9baff69; border-radius: .7rem; background: #0d182dcc;
  text-align: center; cursor: pointer; transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.dropzone:is(:hover, :focus-within, .is-dragging) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 24px #8199ff13; }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.dropzone:has(input:disabled) { cursor: wait; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-icon { display: grid; width: 2.55rem; height: 2.55rem; place-items: center; margin-bottom: .15rem; border: 1px solid var(--border); border-radius: .68rem; background: var(--accent-soft); color: var(--accent); transition: transform .2s var(--ease-out); }
.dropzone:is(:hover, .is-dragging) .upload-icon { transform: translateY(-3px); }
.upload-icon .icon { width: 1.35rem; height: 1.35rem; }
.dropzone-title { font-size: .92rem; font-weight: 740; }
.dropzone-copy, .upload-action p, .downloads p, .curation-panel p { margin: 0; color: var(--text-muted); font-size: .8rem; line-height: 1.5; }
.selected-file { max-width: 100%; overflow-wrap: anywhere; color: var(--accent); font-size: .8rem; font-weight: 680; }
.selected-file.is-invalid { color: var(--bad); }
.upload-action { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .7rem; }
.upload-action p { display: inline-flex; align-items: center; gap: .35rem; }
.upload-action .icon { width: .86rem; height: .86rem; }

.status-region { display: flex; align-items: center; gap: .65rem; border-top: 1px solid var(--border); }
.status-region p { flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: .85rem; font-weight: 630; line-height: 1.5; }
.status-icon { width: .5rem; height: .5rem; flex: 0 0 auto; border-radius: 50%; background: var(--accent); }
.status-region.is-processing .status-icon { animation: pulse 1.3s infinite ease-in-out; }
.status-region.is-error .status-icon { background: var(--bad); }
.status-region.is-paused .status-icon { background: var(--warn); }
.status-region.is-complete .status-icon { background: var(--ok); }
@keyframes pulse { 50% { transform: scale(.72); opacity: .55; } }
@keyframes surface-in { from { opacity: 0; transform: translateY(6px); } }

.result-card { border-top: 1px solid var(--border); background: #101a2dd9; border-radius: 0 0 .9rem .9rem; }
.result-heading { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: .65rem; margin-bottom: .95rem; }
.batch-id { max-width: 100%; overflow-wrap: anywhere; border: 1px solid var(--border); border-radius: .42rem; padding: .32rem .5rem; color: var(--text-muted); background: var(--surface-raised); font: .68rem ui-monospace, Consolas, monospace; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.metrics article { padding: clamp(.55rem, 1.45vw, .9rem); border: 1px solid var(--border); border-radius: .62rem; background: var(--surface-raised); }
.metrics span { display: block; margin-bottom: .23rem; color: var(--text-muted); font-size: .74rem; font-weight: 650; }
.metrics strong { font-size: clamp(1.12rem, 2.4vw, 1.8rem); letter-spacing: -.04em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.metrics .metric-valid { border-color: #8ce2bb42; background: #5ecca518; }
.metrics .metric-invalid { border-color: #ffadc242; background: #ef8da918; }
.metric-valid strong { color: var(--ok); }
.metric-invalid strong { color: var(--bad); }
.result-meta { display: flex; flex-wrap: wrap; gap: .35rem .85rem; margin: .85rem 0; overflow-wrap: anywhere; color: var(--text-muted); font-size: .76rem; }
.downloads, .curation-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem; padding-top: .85rem; border-top: 1px solid var(--border); }
.downloads h3, .curation-panel h3 { margin: 0 0 .24rem; font-size: .9rem; }
.download-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.curation-panel { margin-top: .95rem; }
.curation-panel[data-state="done"] h3 { color: var(--ok); }
.curation-panel[data-state="failed"] h3 { color: var(--bad); }

@media (max-width: 1050px) and (min-width: 901px), (max-width: 710px) {
  .upload-workspace { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hero { grid-template-columns: 1fr; gap: 1rem; }
  .hero-flow li { flex: 1; min-width: 0; }
  .console-heading { flex-wrap: wrap; }
  .status-region { flex-wrap: wrap; }
  .download-actions, .upload-action .button { width: 100%; }
  .download-actions .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
