/* ==========================================================================
   SRNet ×4 — Local AI Super-Resolution Studio
   Hand-written stylesheet (no build step required).
   ========================================================================== */

:root {
    --bg: #06060a;
    --bg-soft: #0b0b12;
    --panel: rgba(255, 255, 255, 0.028);
    --panel-strong: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.075);
    --line-strong: rgba(255, 255, 255, 0.14);
    --ink: #f5f5f8;
    --muted: #8d8d9e;
    --faint: #5d5d6e;
    --violet: #8b5cf6;
    --violet-deep: #6d3ff0;
    --cyan: #22d3ee;
    --lime: #a3e635;
    --amber: #fbbf24;
    --rose: #fb7185;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 24px 60px -22px rgba(0, 0, 0, 0.9);
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Outfit", var(--font);
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    margin: 0;
    line-height: 1.12;
    letter-spacing: -0.02em;
}

p {
    margin: 0;
}

img {
    user-select: none;
    -webkit-user-drag: none;
}

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

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

::selection {
    background: rgba(139, 92, 246, 0.35);
}

/* --------------------------------------------------------------- ambience */

.stage-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.stage-glow::before,
.stage-glow::after {
    content: "";
    position: absolute;
    width: 62vw;
    height: 62vw;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
}

.stage-glow::before {
    top: -28vw;
    left: -16vw;
    background: radial-gradient(circle, rgba(109, 63, 240, 0.5), transparent 68%);
}

.stage-glow::after {
    top: -34vw;
    right: -20vw;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.26), transparent 68%);
}

.grid-veil {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
}

/* ------------------------------------------------------------- structure */

.shell {
    position: relative;
    z-index: 1;
    width: min(1500px, 100% - 40px);
    margin-inline: auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(18px);
    background: linear-gradient(to bottom, rgba(6, 6, 10, 0.92), rgba(6, 6, 10, 0.55));
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 0;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(120% 120% at 20% 0%, rgba(255, 255, 255, 0.4), transparent 45%),
        linear-gradient(140deg, var(--violet) 10%, var(--violet-deep) 55%, #3b1d8f 100%);
    box-shadow: 0 10px 30px -12px rgba(139, 92, 246, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 15px;
    letter-spacing: -0.04em;
    color: #fff;
    flex: none;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-text strong {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.brand-text span {
    font-size: 11px;
    color: var(--faint);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 600;
}

.topbar-spacer {
    flex: 1;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel);
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.pill svg {
    width: 14px;
    height: 14px;
    flex: none;
}

.pill strong {
    color: var(--ink);
    font-weight: 650;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--faint);
    flex: none;
    transition: background 0.3s, box-shadow 0.3s;
}

.dot.is-live {
    background: var(--lime);
    box-shadow: 0 0 0 3px rgba(163, 230, 53, 0.16);
}

.dot.is-warn {
    background: var(--amber);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.16);
}

.dot.is-busy {
    background: var(--cyan);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16);
    animation: pulse 1.4s ease-in-out infinite;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.back-link:hover {
    color: var(--ink);
    background: var(--panel);
    border-color: var(--line);
}

.back-link svg {
    width: 14px;
    height: 14px;
}

/* ------------------------------------------------------------ page intro */

.hero {
    padding: 46px 0 30px;
    display: grid;
    gap: 22px;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    align-items: end;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--violet);
    font-weight: 600;
    margin-bottom: 16px;
}

.eyebrow::before {
    content: "";
    width: 26px;
    height: 1px;
    background: linear-gradient(90deg, var(--violet), transparent);
}

.hero h1 {
    font-size: clamp(40px, 6.4vw, 74px);
    font-weight: 800;
}

.hero h1 em {
    font-style: normal;
    background: linear-gradient(100deg, #fff 6%, var(--violet) 42%, var(--cyan) 88%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-lead {
    color: var(--muted);
    font-size: 16px;
    max-width: 60ch;
    margin-top: 18px;
}

.hero-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.spec {
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 14px;
    padding: 13px 15px;
}

.spec span {
    display: block;
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 5px;
}

.spec strong {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ------------------------------------------------------------- app layout */

.studio {
    display: grid;
    grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    padding-bottom: 30px;
}

.rail {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 84px;
}

.card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-head h2 {
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    font-family: var(--font);
    font-weight: 650;
}

.card-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.card-note {
    padding: 13px 18px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--faint);
    line-height: 1.6;
}

/* ---------------------------------------------------------------- dropzone */

.dropzone {
    position: relative;
    border: 1.5px dashed rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(139, 92, 246, 0.09), transparent 60%),
        rgba(255, 255, 255, 0.012);
    padding: 26px 18px;
    text-align: center;
    transition: border-color 0.22s, background 0.22s, transform 0.22s;
    overflow: hidden;
}

.dropzone:hover,
.dropzone.is-over {
    border-color: rgba(139, 92, 246, 0.65);
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(139, 92, 246, 0.2), transparent 62%),
        rgba(255, 255, 255, 0.03);
}

.dropzone.is-over {
    transform: scale(1.012);
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 13px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(139, 92, 246, 0.14);
    border: 1px solid rgba(139, 92, 246, 0.32);
    color: var(--violet);
}

.dropzone-icon svg {
    width: 21px;
    height: 21px;
}

.dropzone strong {
    display: block;
    font-size: 14px;
    font-weight: 650;
    margin-bottom: 4px;
}

.dropzone small {
    color: var(--faint);
    font-size: 11.5px;
    line-height: 1.6;
    display: block;
}

/* ------------------------------------------------------------------ strip */

.row {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

.samples {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.sample {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1;
    background: #0e0e15;
    padding: 0;
    transition: border-color 0.2s, transform 0.2s;
}

.sample img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0.82;
    transition: opacity 0.2s, transform 0.4s;
}

.sample span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px 7px 5px;
    font-size: 9.5px;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
    text-align: left;
}

.sample:hover {
    border-color: rgba(139, 92, 246, 0.55);
    transform: translateY(-2px);
}

.sample:hover img {
    opacity: 1;
    transform: scale(1.05);
}

/* ---------------------------------------------------------------- controls */

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

.field > label,
.field-label {
    font-size: 10px;
    font-family: var(--mono);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
    font-weight: 600;
}

.segmented {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    border-radius: 11px;
}

.segmented button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 650;
    padding: 8px 6px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.segmented button:hover {
    color: var(--ink);
}

.segmented button[aria-pressed="true"] {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.9), rgba(109, 63, 240, 0.85));
    color: #fff;
    box-shadow: 0 6px 18px -10px rgba(139, 92, 246, 1);
}

.select {
    position: relative;
}

.select select {
    width: 100%;
    appearance: none;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 11px 34px 11px 13px;
    font-size: 12.5px;
    font-weight: 550;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.select select:hover,
.select select:focus {
    border-color: rgba(139, 92, 246, 0.55);
    background: rgba(255, 255, 255, 0.055);
}

.select select option {
    background: #12121a;
    color: var(--ink);
}

.select::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 1.6px solid var(--faint);
    border-bottom: 1.6px solid var(--faint);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--violet-deep);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    cursor: ew-resize;
}

input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--violet-deep);
    cursor: ew-resize;
}

output {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    min-width: 46px;
    text-align: right;
}

.switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
}

.switch-text strong {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
}

.switch-text small {
    color: var(--faint);
    font-size: 11px;
    line-height: 1.5;
    display: block;
    margin-top: 2px;
}

.switch input {
    appearance: none;
    -webkit-appearance: none;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    position: relative;
    transition: background 0.22s;
    flex: none;
    cursor: pointer;
    margin: 0;
}

.switch input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.22s;
}

.switch input:checked {
    background: linear-gradient(90deg, var(--violet-deep), var(--violet));
}

.switch input:checked::after {
    transform: translateX(18px);
}

/* ----------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 650;
    font-size: 13px;
    padding: 12px 16px;
    transition: transform 0.18s, background 0.2s, border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.btn-primary {
    background: linear-gradient(180deg, var(--violet), var(--violet-deep));
    color: #fff;
    box-shadow: 0 14px 30px -16px rgba(139, 92, 246, 1);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px -16px rgba(139, 92, 246, 1);
}

.btn-primary:disabled,
.btn:disabled {
    opacity: 0.34;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--line);
    color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.085);
    border-color: var(--line-strong);
}

.btn-quiet {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
    padding: 9px 12px;
    font-size: 12px;
}

.btn-quiet:hover:not(:disabled) {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.05);
}

.btn-wide {
    width: 100%;
}

.btn-sm {
    padding: 9px 12px;
    font-size: 12px;
    border-radius: 10px;
}

.row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

/* ---------------------------------------------------------------- progress */

.progress {
    height: 5px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.progress i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--violet), var(--cyan));
    transition: width 0.35s ease;
}

.status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11.5px;
    color: var(--muted);
    min-height: 18px;
}

.status-line b {
    color: var(--ink);
    font-weight: 600;
}

.mono {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------- stats */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.stat {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 11px 12px;
    min-width: 0;
}

.stat span {
    display: block;
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 4px;
}

.stat strong {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat.is-accent strong {
    color: var(--cyan);
}

.stat.is-good strong {
    color: var(--lime);
}

/* ---------------------------------------------------------------- viewport */

.viewport {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #0a0a11, #07070c);
    box-shadow: var(--shadow);
    min-height: 620px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.viewport-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.014);
}

.viewport-bar .spacer {
    flex: 1;
}

.viewport-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    position: relative;
    min-height: 0;
}

.state {
    width: 100%;
    max-width: 680px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.state h3 {
    font-size: 25px;
    font-weight: 700;
}

.state p {
    color: var(--muted);
    font-size: 14px;
    max-width: 52ch;
}

.state-icon {
    width: 66px;
    height: 66px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: radial-gradient(120% 120% at 30% 0%, rgba(139, 92, 246, 0.32), transparent 70%);
    color: #d9ccff;
}

.state-icon svg {
    width: 28px;
    height: 28px;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    text-align: left;
}

.step {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 13px;
    padding: 13px;
    font-size: 12px;
    color: var(--muted);
}

.step b {
    display: block;
    color: var(--ink);
    font-size: 12.5px;
    margin-bottom: 4px;
    font-weight: 650;
}

.step em {
    font-family: var(--mono);
    font-style: normal;
    font-size: 10px;
    color: var(--violet);
    letter-spacing: 0.1em;
}

/* preview + result */

.preview-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
}

.preview-frame {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    background: #05050a;
    max-width: 100%;
    box-shadow: 0 30px 60px -35px rgba(0, 0, 0, 1);
}

.preview-frame img {
    display: block;
    max-width: 100%;
    max-height: 460px;
    object-fit: contain;
}

.preview-frame .frame-tag {
    position: absolute;
    left: 12px;
    top: 12px;
    padding: 5px 9px;
    border-radius: 7px;
    background: rgba(6, 6, 10, 0.74);
    border: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted);
    backdrop-filter: blur(8px);
}

/* processing */

.processing {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}

.tile-stage {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #05050a;
    width: 100%;
    display: grid;
    place-items: center;
    min-height: 260px;
}

.tile-stage img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    opacity: 0.42;
    filter: saturate(0.85);
}

.tile-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.tile-cell {
    position: absolute;
    border: 1px solid rgba(139, 92, 246, 0.22);
    background: rgba(139, 92, 246, 0.05);
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.tile-cell.is-done {
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.4);
}

.scanline {
    position: absolute;
    left: 0;
    right: 0;
    height: 90px;
    background: linear-gradient(180deg, transparent, rgba(139, 92, 246, 0.22), transparent);
    animation: scan 2.6s linear infinite;
}

/* A/B compare */

.compare {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.compare-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--muted);
}

.legend {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.legend i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: block;
}

.legend.is-a i {
    background: #71717a;
}

.legend.is-b i {
    background: var(--cyan);
}

.compare-stage {
    position: relative;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    background: #04040a
        repeating-conic-gradient(#0d0d14 0% 25%, #111119 0% 50%) 50% / 22px 22px;
    aspect-ratio: 16 / 10;
    max-height: min(74vh, 880px);
    cursor: ew-resize;
    touch-action: none;
    user-select: none;
}

.compare-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.compare-layer img,
.compare-layer canvas,
.compare-layer .zoom-pan > * {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
    display: block;
    image-rendering: auto;
}

.zoom-pan {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    transform-origin: 50% 50%;
    will-change: transform;
}

.compare-layer.is-b {
    clip-path: inset(0 0 0 50%);
}

.compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, rgba(34, 211, 238, 0), var(--cyan), rgba(34, 211, 238, 0));
    left: 50%;
    transform: translateX(-1px);
    pointer-events: none;
    box-shadow: 0 0 22px rgba(34, 211, 238, 0.6);
}

.compare-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 42px;
    height: 42px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(8, 8, 14, 0.86);
    border: 1px solid rgba(34, 211, 238, 0.6);
    color: var(--cyan);
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

.compare-knob svg {
    width: 17px;
    height: 17px;
}

.compare-tag {
    position: absolute;
    bottom: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(6, 6, 10, 0.78);
    border: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 10px;
    color: var(--ink);
    backdrop-filter: blur(8px);
    pointer-events: none;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.compare-tag.is-a {
    left: 12px;
}

.compare-tag.is-b {
    right: 12px;
    border-color: rgba(34, 211, 238, 0.4);
    color: var(--cyan);
}

.zoom-tools {
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.icon-btn:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--line-strong);
}

.icon-btn svg {
    width: 15px;
    height: 15px;
}

.zoom-readout {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    min-width: 52px;
    text-align: center;
}

/* ------------------------------------------------------- model-not-present */

.model-gate {
    width: 100%;
    max-width: 720px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.model-gate h3 {
    font-size: 25px;
}

.model-gate > p {
    color: var(--muted);
    font-size: 14px;
}

.code-line {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px dashed rgba(139, 92, 246, 0.42);
    background: rgba(139, 92, 246, 0.07);
    border-radius: 12px;
    padding: 12px 14px;
    font-family: var(--mono);
    font-size: 12px;
    color: #d7cbff;
    overflow-x: auto;
}

.code-line b {
    color: var(--cyan);
    font-weight: 600;
}

/* ------------------------------------------------------------------ toasts */

.toasts {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-width: min(360px, calc(100vw - 36px));
}

.toast {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid var(--line-strong);
    background: rgba(12, 12, 19, 0.94);
    backdrop-filter: blur(14px);
    border-radius: 13px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    font-size: 12.5px;
    color: var(--ink);
    animation: toast-in 0.3s ease both;
}

.toast i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--violet);
    margin-top: 6px;
    flex: none;
}

.toast.is-warn i {
    background: var(--amber);
}

.toast.is-good i {
    background: var(--lime);
}

.toast.is-bad i {
    background: var(--rose);
}

.toast small {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    margin-top: 2px;
    line-height: 1.5;
}

/* ------------------------------------------------------------------ footer */

.foot {
    padding: 34px 0 60px;
    color: var(--faint);
    font-size: 12px;
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: center;
    border-top: 1px solid var(--line);
    margin-top: 18px;
}

.foot a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.foot a:hover {
    color: var(--ink);
    border-color: var(--line-strong);
}

.kbd {
    font-family: var(--mono);
    font-size: 10px;
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 1px 5px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
}

/* -------------------------------------------------------------- animations */

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.45;
    }
}

@keyframes scan {
    0% {
        top: -90px;
    }

    100% {
        top: 100%;
    }
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes float-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.state,
.model-gate,
.compare,
.processing {
    animation: float-in 0.4s ease both;
}

.dragging-page::after {
    content: "Drop an image — or the .onnx model — to load it";
    position: fixed;
    inset: 18px;
    z-index: 80;
    border-radius: 22px;
    border: 2px dashed rgba(139, 92, 246, 0.7);
    background: rgba(10, 8, 22, 0.82);
    backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: clamp(18px, 3vw, 30px);
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    pointer-events: none;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
    .studio {
        grid-template-columns: 1fr;
    }

    .rail {
        position: static;
    }

    .hero {
        grid-template-columns: 1fr;
        padding-top: 34px;
    }

    .viewport {
        min-height: 520px;
    }
}

@media (max-width: 620px) {
    .shell {
        width: min(1500px, 100% - 24px);
    }

    .hero h1 {
        font-size: clamp(34px, 11vw, 46px);
    }

    .steps {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .viewport-body {
        padding: 14px;
    }

    .compare-stage {
        max-height: 62vh;
    }

    .topbar-inner {
        gap: 10px;
    }

    .pill.is-optional {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* -------------------------------------------------------------- model facts */
.facts-card > summary {
    cursor: pointer;
    list-style: none;
    border-bottom: 0;
}

.facts-card > summary::-webkit-details-marker {
    display: none;
}

.facts-card[open] > summary {
    border-bottom: 1px solid var(--line);
}

.facts-hint {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
    white-space: nowrap;
}

.facts-hint::after {
    content: " ▾";
}

.facts-card[open] .facts-hint::after {
    content: " ▴";
}

.facts {
    margin: 0;
    display: grid;
    gap: 12px;
}

.facts dt {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--violet);
    margin-bottom: 3px;
}

.facts dd {
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--muted);
}

.facts code,
.field-label small {
    font-family: var(--mono);
    font-size: 10px;
}

.facts code {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 4px;
    border-radius: 4px;
}

.field-label small {
    text-transform: none;
    letter-spacing: 0.04em;
    color: var(--faint);
}
