:root {
    color-scheme: dark;
    --bg: #020814;
    --bg-raised: #071322;
    --surface: rgba(12, 28, 45, 0.62);
    --surface-strong: rgba(10, 24, 40, 0.82);
    --surface-soft: rgba(255, 255, 255, 0.035);
    --stroke: rgba(172, 220, 239, 0.13);
    --stroke-strong: rgba(0, 240, 255, 0.34);
    --text: #f2fbff;
    --text-muted: #90a6ba;
    --text-dim: #5d748a;
    --cyan: #00F0FF;
    --cyan-soft: rgba(0, 240, 255, 0.12);
    --violet: #a795ff;
    --green: #6bffbf;
    --red: #ff7b8d;
    --font-display: "Exo 2", "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", Consolas, monospace;
    --radius: 16px;
    --shadow-glass: 0 18px 55px rgba(0, 0, 0, 0.21), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body {
    min-height: 100dvh;
    margin: 0;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 14px;
    line-height: 1.55;
    background:
        radial-gradient(ellipse at 53% -22%, rgba(11, 79, 112, 0.24), transparent 48%),
        linear-gradient(135deg, #020814 0%, #06101d 48%, #030a16 100%);
    overflow-x: hidden;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, label:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 3px; }
button:disabled { opacity: .5; cursor: not-allowed !important; transform: none !important; }
svg { width: 100%; height: 100%; display: block; }
::selection { background: rgba(0, 240, 255, .28); color: #fff; }

.ambient { position: fixed; pointer-events: none; z-index: -1; border-radius: 50%; filter: blur(75px); opacity: .18; }
.ambient-cyan { width: 360px; height: 360px; top: 23%; left: -230px; background: #00d9f5; }
.ambient-violet { width: 410px; height: 410px; top: 46%; right: -310px; background: #6545ff; opacity: .14; }

.topbar {
    height: 82px;
    padding: 0 clamp(22px, 3.6vw, 58px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(2, 8, 20, .79);
    border-bottom: 1px solid rgba(180, 228, 246, .1);
    backdrop-filter: blur(24px) saturate(135%);
    -webkit-backdrop-filter: blur(24px) saturate(135%);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; flex-shrink: 0; }
.brand-mark { width: 42px; height: 42px; padding: 7px; display: grid; place-items: center; color: var(--cyan); background: linear-gradient(145deg, rgba(0, 240, 255, .12), rgba(167, 149, 255, .08)); border: 1px solid rgba(0, 240, 255, .27); border-radius: 13px; box-shadow: 0 0 22px rgba(0, 240, 255, .09), inset 0 0 14px rgba(0, 240, 255, .035); }
.brand-copy { display: flex; flex-direction: column; gap: 1px; line-height: 1.1; }
.brand-copy strong { font-size: 17px; letter-spacing: .12em; font-weight: 800; }
.brand-copy strong span { color: var(--cyan); }
.brand-copy small { color: var(--text-dim); font: 8px/1.4 var(--font-mono); letter-spacing: .12em; margin-top: 4px; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: clamp(12px, 2.1vw, 30px); min-width: 0; }
.course-chip { display: inline-flex; align-items: center; gap: 8px; color: #a6bacb; font: 10px/1.4 var(--font-mono); letter-spacing: .065em; white-space: nowrap; }
.chip-dot { width: 6px; height: 6px; background: var(--cyan); box-shadow: 0 0 10px rgba(0, 240, 255, .7); border-radius: 50%; }
.chip-divider { color: #496176; }
.system-status { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(107, 255, 191, .16); padding: 7px 10px; border-radius: 999px; color: var(--green); background: rgba(107, 255, 191, .04); white-space: nowrap; font: 9px/1.2 var(--font-mono); letter-spacing: .05em; }
.status-dot { width: 6px; height: 6px; background: currentColor; border-radius: 50%; box-shadow: 0 0 9px currentColor; }
.system-status.is-working { color: var(--cyan); border-color: rgba(0, 240, 255, .24); background: rgba(0, 240, 255, .05); }
.system-status.is-working .status-dot { animation: pulse 1s infinite; }
.system-status.is-error { color: var(--red); border-color: rgba(255, 123, 141, .22); background: rgba(255, 123, 141, .05); }

.app-shell { width: min(100%, 1680px); margin: 0 auto; padding: 30px clamp(18px, 3vw, 48px) 24px; display: grid; grid-template-columns: 286px minmax(0, 1fr); align-items: start; gap: 22px; }
.glass-panel { background: linear-gradient(135deg, rgba(18, 38, 59, .76), rgba(7, 19, 34, .69)); border: 1px solid var(--stroke); box-shadow: var(--shadow-glass); backdrop-filter: blur(22px) saturate(130%); -webkit-backdrop-filter: blur(22px) saturate(130%); }
.source-panel { padding: 20px; border-radius: 20px; position: sticky; top: 104px; overflow: hidden; }
.source-panel::before, .comparison-panel::before, .settings-panel::before, .analysis-panel::before { content: ""; position: absolute; top: 0; left: 16%; right: 16%; height: 1px; background: linear-gradient(90deg, transparent, rgba(0, 240, 255, .42), transparent); pointer-events: none; }
.panel-head, .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.source-panel-head { margin-bottom: 22px; }
.eyebrow { display: block; color: #66869e; font: 9px/1.45 var(--font-mono); letter-spacing: .13em; }
.panel-head h2, .section-heading h2 { margin: 5px 0 0; font-size: 19px; line-height: 1.2; font-weight: 600; letter-spacing: -.025em; }
.icon-chip { display: grid; place-items: center; width: 37px; height: 37px; padding: 9px; color: var(--cyan); background: rgba(0, 240, 255, .055); border: 1px solid rgba(0, 240, 255, .16); border-radius: 11px; }
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; color: #94a9bb; font: 9px/1.5 var(--font-mono); letter-spacing: .08em; }
.field-label span { color: #506a80; }
.search-field { display: flex; align-items: center; gap: 9px; height: 39px; padding: 0 11px; border: 1px solid rgba(166, 207, 230, .12); border-radius: 10px; background: rgba(1, 8, 17, .35); transition: border-color .2s, background .2s; }
.search-field:focus-within { border-color: rgba(0, 240, 255, .5); background: rgba(0, 240, 255, .035); }
.search-field svg { flex: 0 0 16px; width: 16px; height: 16px; color: #68849a; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); font-size: 12px; background: transparent; }
.search-field input::placeholder { color: #50667a; }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }
.sample-list { display: flex; flex-direction: column; gap: 7px; max-height: 380px; overflow-y: auto; overflow-x: hidden; padding: 10px 2px 2px 0; scrollbar-width: thin; scrollbar-color: rgba(0, 240, 255, .28) transparent; }
.sample-list::-webkit-scrollbar { width: 4px; }
.sample-list::-webkit-scrollbar-thumb { border-radius: 6px; background: rgba(0, 240, 255, .25); }
.sample-item { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; width: 100%; padding: 8px 9px; border-radius: 12px; border: 1px solid transparent; color: var(--text); text-align: left; background: transparent; cursor: pointer; transition: background .2s, border-color .2s, transform .2s; animation: slideIn .34s both; animation-delay: var(--item-delay, 0ms); }
.sample-item:hover { background: rgba(255, 255, 255, .04); border-color: rgba(185, 226, 246, .11); transform: translateX(2px); }
.sample-item.is-active { background: linear-gradient(105deg, rgba(0, 240, 255, .095), rgba(0, 240, 255, .025)); border-color: rgba(0, 240, 255, .36); box-shadow: inset 2px 0 0 var(--cyan), 0 0 22px rgba(0, 240, 255, .035); }
.sample-thumb { flex: 0 0 51px; width: 51px; height: 48px; object-fit: cover; border-radius: 8px; background: #07121f; border: 1px solid rgba(173, 219, 239, .1); }
.sample-copy { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.sample-copy strong { font-size: 11px; font-weight: 600; color: #ccdae7; line-height: 1.25; }
.sample-copy small { font: 8px/1.3 var(--font-mono); color: #637d92; }
.sample-check { display: grid; place-items: center; flex: 0 0 16px; width: 16px; height: 16px; opacity: 0; color: var(--cyan); transition: opacity .15s; }
.sample-check svg { width: 15px; height: 15px; }
.sample-item.is-active .sample-check { opacity: 1; }
.skeleton-row { height: 63px; border-radius: 12px; background: linear-gradient(100deg, rgba(255,255,255,.025) 20%, rgba(255,255,255,.065) 38%, rgba(255,255,255,.025) 58%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
.empty-library { padding: 18px 10px; color: var(--text-muted); font-size: 11px; text-align: center; }
.empty-library code { font: 10px var(--font-mono); color: var(--cyan); }
.source-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: #516b80; font: 8px var(--font-mono); letter-spacing: .1em; }
.source-divider::before, .source-divider::after { content: ""; height: 1px; flex: 1; background: rgba(157, 203, 226, .12); }
.upload-zone { border: 1px dashed rgba(123, 176, 204, .27); border-radius: 14px; background: rgba(1, 8, 17, .25); transition: border-color .2s, background .2s, box-shadow .2s; }
.upload-zone:hover, .upload-zone.is-dragging { border-color: rgba(0, 240, 255, .65); background: rgba(0, 240, 255, .045); box-shadow: inset 0 0 24px rgba(0, 240, 255, .025); }
.upload-zone.is-uploading { opacity: .65; pointer-events: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.upload-content { cursor: pointer; min-height: 150px; padding: 18px 10px 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.upload-icon-wrap { display: grid; place-items: center; width: 40px; height: 40px; padding: 10px; margin-bottom: 11px; color: var(--cyan); border: 1px solid rgba(0, 240, 255, .21); background: rgba(0, 240, 255, .075); border-radius: 12px; }
.upload-content strong { font-size: 11px; font-weight: 600; color: #d9e8f3; }
.upload-content > span:not(.upload-icon-wrap) { color: #718ba0; font-size: 10px; }
.upload-content u { color: var(--cyan); text-underline-offset: 3px; text-decoration-color: rgba(0, 240, 255, .4); }
.upload-content small { margin-top: 11px; color: #51687c; font: 8px/1.5 var(--font-mono); }
.sidebar-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 17px; padding: 11px 10px; background: rgba(0, 240, 255, .035); border: 1px solid rgba(0, 240, 255, .1); border-radius: 10px; }
.note-icon { flex: 0 0 14px; width: 14px; height: 14px; color: var(--cyan); margin-top: 1px; }
.sidebar-note p { margin: 0; color: #7993a8; font-size: 10px; line-height: 1.5; }

.workspace { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 9px 4px 2px; }
.hero-copy { min-width: 0; max-width: 690px; }
.hero-eyebrow { display: flex; align-items: center; gap: 9px; color: #7e9eb4; }
.eyebrow-line { height: 1px; width: 25px; background: var(--cyan); box-shadow: 0 0 10px rgba(0, 240, 255, .8); }
.hero-copy h1 { margin: 11px 0 12px; font-size: clamp(30px, 3vw, 43px); line-height: 1.04; font-weight: 700; letter-spacing: -.038em; }
.hero-copy h1 span { color: var(--cyan); text-shadow: 0 0 36px rgba(0, 240, 255, .18); }
.hero-copy p { max-width: 600px; margin: 0; color: #8ba2b7; font-size: 12px; line-height: 1.75; }
.algorithm-card { position: relative; isolation: isolate; overflow: hidden; flex: 0 0 305px; min-height: 119px; border-radius: 17px; padding: 18px; display: flex; align-items: center; gap: 15px; }
.algorithm-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 16% 50%, rgba(0, 240, 255, .1), transparent 45%); }
.algorithm-glyph { flex: 0 0 66px; width: 66px; height: 66px; color: var(--cyan); filter: drop-shadow(0 0 13px rgba(0, 240, 255, .13)); }
.algorithm-card-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.algorithm-card-copy > span { font: 8px var(--font-mono); color: #658096; letter-spacing: .1em; }
.algorithm-card-copy strong { color: #e8f8ff; font-size: 12px; letter-spacing: .035em; white-space: nowrap; }
.algorithm-card-copy small { color: #617c91; font: 8px/1.5 var(--font-mono); }
.algorithm-state { display: inline-flex; align-items: center; gap: 6px; position: absolute; right: 14px; top: 12px; color: #718d9d; font: 7px var(--font-mono); letter-spacing: .07em; }
.algorithm-state span { width: 5px; height: 5px; background: var(--green); border-radius: 50%; box-shadow: 0 0 8px rgba(107, 255, 191, .8); }
.algorithm-orbit { position: absolute; border-radius: 50%; border: 1px solid rgba(0, 240, 255, .07); pointer-events: none; z-index: -1; }
.orbit-one { width: 170px; height: 170px; right: -65px; bottom: -115px; }
.orbit-two { width: 115px; height: 115px; right: -38px; bottom: -88px; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.metric-card { position: relative; min-width: 0; min-height: 95px; padding: 14px 15px 12px; border-radius: 13px; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; top: 0; right: 18px; width: 34px; height: 1px; background: rgba(0, 240, 255, .36); }
.metric-label { display: block; margin-bottom: 8px; color: #728da2; font: 8px/1.3 var(--font-mono); letter-spacing: .08em; white-space: nowrap; }
.metric-card > strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #effaff; font-size: 19px; font-weight: 600; line-height: 1.3; letter-spacing: -.02em; }
.metric-card > strong em { color: var(--cyan); font: 10px var(--font-mono); font-style: normal; }
.metric-card > small { display: block; margin-top: 4px; color: #526d82; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-state > strong { color: var(--green); font: 12px/1.8 var(--font-mono); letter-spacing: .02em; }

.comparison-panel { position: relative; padding: 20px; border-radius: 18px; overflow: hidden; }
.section-heading { margin-bottom: 16px; }
.section-heading h2 { font-size: 18px; }
.comparison-actions { display: flex; align-items: center; gap: 10px; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(107, 255, 191, .16); background: rgba(107, 255, 191, .035); border-radius: 999px; padding: 6px 9px; color: #75dcb4; font: 8px/1.2 var(--font-mono); letter-spacing: .06em; }
.live-badge span { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 7px rgba(107, 255, 191, .75); }
.icon-button { display: grid; place-items: center; width: 31px; height: 31px; padding: 8px; color: #7894a8; border: 1px solid rgba(175, 220, 240, .13); background: rgba(255, 255, 255, .025); border-radius: 9px; cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.icon-button:hover { color: var(--cyan); border-color: rgba(0, 240, 255, .35); background: rgba(0, 240, 255, .07); }
.comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.image-card { min-width: 0; overflow: hidden; background: rgba(2, 9, 18, .34); border: 1px solid rgba(158, 207, 231, .13); border-radius: 14px; }
.image-card-heading { min-height: 61px; padding: 12px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(158, 207, 231, .1); background: rgba(255, 255, 255, .018); }
.image-card-heading > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.image-index { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; background: rgba(167, 149, 255, .08); border: 1px solid rgba(167, 149, 255, .2); color: var(--violet); font: 10px var(--font-mono); }
.result-index { background: rgba(0, 240, 255, .07); border-color: rgba(0, 240, 255, .22); color: var(--cyan); }
.image-card-heading strong { display: block; color: #dcebf5; font-size: 11px; line-height: 1.2; font-weight: 600; }
.image-card-heading small { display: block; max-width: 220px; margin-top: 4px; color: #617c92; font: 8px/1.4 var(--font-mono); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.image-mode { flex-shrink: 0; padding: 5px 7px; color: #899db0; background: rgba(255, 255, 255, .035); border: 1px solid rgba(164, 210, 231, .1); border-radius: 6px; font: 7px var(--font-mono); letter-spacing: .045em; }
.output-mode { color: var(--cyan); border-color: rgba(0, 240, 255, .17); background: rgba(0, 240, 255, .045); }
.image-stage { position: relative; display: grid; place-items: center; min-height: 230px; height: clamp(230px, 24vw, 310px); padding: 16px; overflow: auto; background-color: rgba(1, 7, 15, .46); background-image: linear-gradient(rgba(106, 144, 169, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(106, 144, 169, .035) 1px, transparent 1px); background-size: 22px 22px; }
.image-stage img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.image-stage img[hidden] { display: none; }
.image-empty { min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11px; color: #526d82; font-size: 10px; text-align: center; }
.image-empty[hidden] { display: none; }
.empty-glyph { width: 42px; height: 42px; padding: 11px; color: #41647b; border: 1px solid rgba(115, 171, 202, .16); background: rgba(115, 171, 202, .035); border-radius: 12px; }
.output-stage { background-color: rgba(1, 7, 15, .58); }
.output-stage img { image-rendering: pixelated; }
.image-card-footer { height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px; color: #647e92; background: rgba(255, 255, 255, .018); border-top: 1px solid rgba(158, 207, 231, .08); font: 8px var(--font-mono); }
.image-card-footer > span:first-child { display: flex; align-items: center; gap: 6px; }
.tiny-dot { width: 5px; height: 5px; display: inline-block; border-radius: 50%; background: var(--violet); }
.cyan-dot { background: var(--cyan); box-shadow: 0 0 6px rgba(0, 240, 255, .55); }
.comparison-footnote { display: flex; align-items: center; gap: 9px; margin-top: 12px; padding: 10px 12px; border-radius: 9px; background: rgba(0, 240, 255, .035); border: 1px solid rgba(0, 240, 255, .1); }
.info-symbol { flex: 0 0 16px; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; color: var(--cyan); border: 1px solid rgba(0, 240, 255, .34); font: 10px var(--font-mono); }
.comparison-footnote p { flex: 1; min-width: 0; margin: 0; color: #7d9aaf; font-size: 10px; }
.footnote-code { flex-shrink: 0; color: #6d899f; font: 8px var(--font-mono); white-space: nowrap; }

.control-grid { display: grid; grid-template-columns: minmax(0, 1.03fr) minmax(0, .97fr); gap: 13px; }
.settings-panel, .analysis-panel { min-width: 0; position: relative; padding: 19px 20px; border-radius: 16px; overflow: hidden; }
.compact-heading { margin-bottom: 18px; }
.compact-heading h2 { font-size: 16px; }
.parameter-count, .chart-label { color: #637f94; font: 8px var(--font-mono); letter-spacing: .055em; white-space: nowrap; }
.parameter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.parameter-control { min-width: 0; }
.parameter-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.parameter-label-row label { color: #cfe0ec; font-size: 11px; font-weight: 600; }
.parameter-label-row output { color: var(--cyan); font: 10px var(--font-mono); border: 1px solid rgba(0, 240, 255, .22); background: rgba(0, 240, 255, .055); border-radius: 6px; padding: 3px 6px; }
.parameter-control input[type="range"] { display: block; width: 100%; height: 4px; appearance: none; -webkit-appearance: none; margin: 0; border-radius: 99px; outline: none; background: linear-gradient(90deg, rgba(0, 240, 255, .85), rgba(0, 240, 255, .2)); cursor: pointer; }
.parameter-control input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #d9fcff; border: 3px solid var(--cyan); box-shadow: 0 0 0 4px rgba(0, 240, 255, .08), 0 0 12px rgba(0, 240, 255, .25); }
.parameter-control input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #d9fcff; border: 3px solid var(--cyan); box-shadow: 0 0 0 4px rgba(0, 240, 255, .08); }
.range-ends { margin-top: 7px; display: flex; align-items: center; justify-content: space-between; color: #59758a; font: 8px var(--font-mono); }
.parameter-control p { min-height: 29px; margin: 8px 0 0; color: #718a9f; font-size: 9px; line-height: 1.45; }
.denoise-toggle { margin-top: 16px; padding: 11px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid rgba(154, 207, 232, .1); border-bottom: 1px solid rgba(154, 207, 232, .1); cursor: pointer; }
.toggle-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.toggle-copy strong { color: #b6cbda; font-size: 10px; font-weight: 600; }
.toggle-copy small { color: #5e788e; font-size: 9px; }
.switch { position: relative; flex: 0 0 36px; width: 36px; height: 20px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 2; }
.switch-track { position: absolute; inset: 0; border: 1px solid rgba(146, 179, 199, .22); border-radius: 99px; background: rgba(255, 255, 255, .08); transition: background .2s, border-color .2s; }
.switch-track::after { content: ""; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px; border-radius: 50%; background: #7690a5; transition: transform .2s, background .2s; }
.switch input:checked + .switch-track { background: rgba(0, 240, 255, .17); border-color: rgba(0, 240, 255, .48); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--cyan); box-shadow: 0 0 9px rgba(0, 240, 255, .55); }
.settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; }
.settings-footer > span { color: #6c879b; font: 9px var(--font-mono); }
.button-primary, .button-secondary { min-height: 39px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; font-size: 10px; font-weight: 700; cursor: pointer; transition: transform .2s, filter .2s, border-color .2s, background .2s; white-space: nowrap; }
.button-primary { color: #001117; border: 1px solid rgba(0, 240, 255, .65); background: linear-gradient(130deg, #3cf5ff, #00d5ea); box-shadow: 0 5px 20px rgba(0, 240, 255, .12); }
.button-primary svg { width: 14px; height: 14px; }
.button-primary:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 8px 26px rgba(0, 240, 255, .18); }
.button-primary:active:not(:disabled) { transform: translateY(0); }
.button-primary.is-loading svg { animation: spin 1s linear infinite; }
.button-secondary { color: var(--cyan); background: rgba(0, 240, 255, .055); border: 1px solid rgba(0, 240, 255, .24); }
.button-secondary svg { width: 15px; height: 15px; }
.button-secondary:hover:not(:disabled) { background: rgba(0, 240, 255, .1); border-color: rgba(0, 240, 255, .45); }

.histogram-wrap { width: 100%; margin-top: 5px; padding-top: 7px; }
.histogram-wrap canvas { display: block; width: 100%; height: 150px; }
.histogram-axis { margin-top: 2px; display: flex; justify-content: space-between; color: #587387; font: 8px var(--font-mono); }
.distribution-legend { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(154, 207, 232, .1); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #839bae; font-size: 9px; }
.distribution-legend > span:first-child { display: flex; align-items: center; gap: 7px; }
.legend-square { display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--cyan); box-shadow: 0 0 8px rgba(0, 240, 255, .36); }
.distribution-legend > span:last-child { color: #627f95; font: 8px var(--font-mono); white-space: nowrap; }
.distribution-note { margin-top: 9px; color: #5d788d; font-size: 9px; line-height: 1.5; }

.result-summary { padding: 15px 18px; display: flex; align-items: center; gap: clamp(18px, 3vw, 42px); border-radius: 15px; }
.summary-title { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.summary-icon { width: 34px; height: 34px; flex: 0 0 34px; padding: 8px; color: var(--cyan); border: 1px solid rgba(0, 240, 255, .18); border-radius: 10px; background: rgba(0, 240, 255, .06); }
.summary-title > div { display: flex; flex-direction: column; gap: 2px; }
.summary-title .eyebrow { font-size: 7px; }
.summary-title strong { font-size: 10px; font-weight: 600; white-space: nowrap; }
.composition-metric { flex: 1; min-width: 90px; }
.composition-label { margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #8da6ba; font-size: 9px; }
.composition-label strong { color: #dcecf5; font: 10px var(--font-mono); }
.composition-track { height: 4px; border-radius: 99px; overflow: hidden; background: rgba(153, 194, 218, .13); }
.composition-track span { display: block; height: 100%; border-radius: inherit; transition: width .35s ease; }
.white-bar { background: #f5fbff; box-shadow: 0 0 10px rgba(245, 251, 255, .3); }
.black-bar { background: var(--cyan); box-shadow: 0 0 10px rgba(0, 240, 255, .32); }
.summary-spacer { display: none; }
.app-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 4px 0; color: #40596e; font: 8px/1.4 var(--font-mono); letter-spacing: .06em; }
.app-footer b { padding: 0 5px; color: var(--cyan); font-size: 6px; }
.app-footer > span:last-child { display: flex; align-items: center; gap: 10px; }
.app-footer i { color: #647f92; font-style: normal; }
.toast { position: fixed; right: 24px; bottom: 23px; z-index: 500; display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100vw - 32px)); padding: 12px 15px; color: #dcebf5; border: 1px solid rgba(0, 240, 255, .2); border-radius: 12px; background: rgba(7, 22, 37, .94); box-shadow: 0 16px 40px rgba(0, 0, 0, .35); backdrop-filter: blur(18px); font-size: 11px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .22s, transform .22s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-mark { width: 7px; height: 7px; flex: 0 0 7px; background: var(--cyan); border-radius: 50%; box-shadow: 0 0 8px rgba(0, 240, 255, .6); }
.toast.is-error { border-color: rgba(255, 123, 141, .3); }
.toast.is-error .toast-mark { background: var(--red); box-shadow: 0 0 8px rgba(255, 123, 141, .45); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 1600px) {
    .app-shell { grid-template-columns: 300px minmax(0, 1fr); }
    .image-stage { height: 330px; }
}
@media (max-width: 1240px) {
    .app-shell { grid-template-columns: 254px minmax(0, 1fr); gap: 16px; padding-inline: 20px; }
    .source-panel { padding: 16px; }
    .algorithm-card { flex-basis: 250px; padding: 15px; gap: 10px; }
    .algorithm-glyph { flex-basis: 52px; width: 52px; height: 52px; }
    .algorithm-card-copy strong { font-size: 10px; }
    .metrics-grid { gap: 8px; }
    .metric-card { padding-inline: 11px; }
    .metric-card > strong { font-size: 16px; }
    .comparison-panel { padding: 16px; }
    .image-stage { min-height: 210px; height: clamp(210px, 23vw, 275px); }
    .control-grid { grid-template-columns: 1fr; }
    .analysis-panel { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); column-gap: 22px; align-items: center; }
    .analysis-panel .section-heading { grid-column: 1 / -1; }
    .histogram-wrap { margin-top: 0; }
    .distribution-legend, .distribution-note { align-self: center; }
}
@media (max-width: 980px) {
    .topbar { height: 72px; padding-inline: 20px; }
    .course-chip { display: none; }
    .app-shell { grid-template-columns: 1fr; max-width: 860px; padding-top: 23px; }
    .source-panel { position: static; }
    .source-panel-head { margin-bottom: 15px; }
    .sample-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 300px; }
    .upload-content { min-height: 115px; }
    .hero-row { padding-top: 2px; }
    .image-stage { height: clamp(230px, 33vw, 330px); }
    .control-grid { grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr); }
    .analysis-panel { display: block; }
    .histogram-wrap { margin-top: 5px; }
    .distribution-legend, .distribution-note { align-self: auto; }
}
@media (max-width: 700px) {
    .topbar { padding-inline: 15px; height: 67px; }
    .brand-mark { width: 36px; height: 36px; padding: 6px; }
    .brand-copy strong { font-size: 14px; }
    .brand-copy small { font-size: 7px; }
    .system-status { padding: 7px 8px; gap: 6px; font-size: 8px; }
    .app-shell { padding: 17px 12px 18px; gap: 15px; }
    .source-panel { padding: 14px; border-radius: 16px; }
    .sample-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
    .sample-item { gap: 7px; padding: 7px 6px; }
    .sample-thumb { flex-basis: 39px; width: 39px; height: 40px; }
    .sample-copy strong { font-size: 10px; }
    .sample-copy small { font-size: 7px; }
    .sample-check { display: none; }
    .hero-row { flex-direction: column; align-items: stretch; gap: 15px; }
    .hero-copy h1 { font-size: clamp(31px, 9vw, 42px); }
    .hero-copy p { font-size: 11px; }
    .algorithm-card { width: 100%; min-height: 98px; flex: 0 1 auto; }
    .algorithm-glyph { flex-basis: 57px; width: 57px; height: 57px; }
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-card { min-height: 85px; }
    .metric-card > strong { font-size: 16px; }
    .comparison-panel { padding: 13px; border-radius: 15px; }
    .section-heading h2 { font-size: 16px; }
    .eyebrow { font-size: 8px; }
    .live-badge { padding: 6px 7px; font-size: 7px; }
    .comparison-actions { gap: 6px; }
    .comparison-grid { grid-template-columns: 1fr; }
    .image-stage { height: clamp(220px, 68vw, 320px); min-height: 220px; }
    .comparison-footnote { align-items: flex-start; }
    .footnote-code { display: none; }
    .control-grid { grid-template-columns: 1fr; }
    .settings-panel, .analysis-panel { padding: 15px; }
    .parameter-grid { gap: 12px; }
    .settings-footer { align-items: stretch; flex-direction: column; }
    .settings-footer > span { order: 2; }
    .button-primary { min-height: 43px; }
    .result-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 18px; padding: 15px; }
    .summary-title { grid-column: 1 / -1; }
    .summary-spacer { display: none; }
    .button-secondary { grid-column: 1 / -1; width: 100%; }
    .app-footer { align-items: flex-start; flex-direction: column; font-size: 7px; }
    .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media (max-width: 390px) {
    .system-status { max-width: 118px; overflow: hidden; text-overflow: ellipsis; }
    .sample-list { grid-template-columns: 1fr; }
    .sample-thumb { flex-basis: 48px; width: 48px; height: 45px; }
    .parameter-grid { grid-template-columns: 1fr; }
    .parameter-control p { min-height: 0; }
    .chart-label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
