/* Holographic Light, matching Signals (signals.lizheng.cc) so the two demos read as one portfolio. */
:root {
  --canvas: #f3f5fb;
  --surface: rgb(255 255 255 / .72);
  --ink: #0b1220;
  --ink-2: #353e52;
  --muted: #6e7891;
  --faint: #97a1b8;
  --line: #e1e7f2;
  --line-2: #c9d2e3;
  --blue: #4f7bff;
  --blue-600: #3b63f0;
  --violet: #8b5cf6;
  --cyan: #14c8e0;
  --normal: #3b63f0;
  --anomaly: #f0476b;
  --good: #10b981;
  --aurora: linear-gradient(120deg, var(--blue), var(--violet) 55%, var(--cyan));
  --shadow: 0 1px 0 rgb(255 255 255 / .9) inset, 0 14px 32px -16px rgb(40 60 140 / .28), 0 3px 8px -4px rgb(40 60 140 / .1);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "PingFang SC", sans-serif;
  font-feature-settings: "cv11", "ss01";
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box }
body { margin: 0; background: var(--canvas); min-height: 100vh }
::selection { background: rgb(79 123 255 / .2) }
a { color: var(--blue-600) }
button, select, input { font: inherit }
.tabular { font-variant-numeric: tabular-nums }

/* Backdrop */
.aurora-backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none }
.aurora-backdrop .blob { position: absolute; border-radius: 9999px; filter: blur(90px); opacity: .5; animation: drift 24s ease-in-out infinite alternate }
.blob-1 { width: 620px; height: 620px; background: #9db7ff; top: -240px; left: 20% }
.blob-2 { width: 520px; height: 520px; background: #d2bfff; top: 32%; right: -180px; animation-delay: -8s }
.blob-3 { width: 460px; height: 460px; background: #a5f0f8; bottom: -220px; left: 32%; animation-delay: -16s }
.dot-grid { position: absolute; inset: 0; background-image: radial-gradient(rgb(80 100 160 / .15) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(to bottom, #000, transparent 70%) }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.08) } }
@media (prefers-reduced-motion: reduce) { .aurora-backdrop .blob { animation: none } }

.glass { background: rgb(255 255 255 / .6); backdrop-filter: blur(24px) saturate(170%); -webkit-backdrop-filter: blur(24px) saturate(170%) }
.card { position: relative; background: var(--surface); backdrop-filter: blur(24px) saturate(170%); -webkit-backdrop-filter: blur(24px) saturate(170%); border: 1px solid rgb(255 255 255 / .7); border-radius: 20px; box-shadow: var(--shadow); padding: 24px }
.kicker { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--faint) }
.text-aurora { background-image: var(--aurora); -webkit-background-clip: text; background-clip: text; color: transparent }
.mark { width: 34px; height: 34px; border-radius: 11px; background: var(--aurora); display: grid; place-items: center; box-shadow: 0 6px 18px -4px rgb(79 123 255 / .6); flex: none }
.mark span { width: 11px; height: 11px; transform: rotate(45deg); border-radius: 3px; border: 2px solid #fff }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgb(255 255 255 / .6); box-shadow: 0 1px 0 rgb(120 135 170 / .12) }
.site-header .inner { max-width: 1320px; margin: auto; height: 64px; padding: 0 24px; display: flex; align-items: center; gap: 20px }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); min-width: 0 }
.brand b { display: block; font-size: 15px; letter-spacing: -.01em; white-space: nowrap }
.brand .kicker { display: block; font-size: 9.5px }
.projects { display: flex; gap: 4px; margin-left: 12px; padding: 4px; border-radius: 12px; background: rgb(238 242 250 / .7); border: 1px solid var(--line) }
.projects a { font-size: 13px; font-weight: 500; text-decoration: none; color: var(--ink-2); padding: 6px 12px; border-radius: 9px; white-space: nowrap }
.projects a:hover { background: rgb(255 255 255 / .7) }
.projects a[aria-current] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow) }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 10px }
.icon-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink-2); font-size: 13px; font-weight: 500; padding: 7px 10px; border-radius: 10px }
.icon-link:hover { background: rgb(255 255 255 / .7) }
.icon-link svg { width: 17px; height: 17px }
select { border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink); padding: 7px 10px; font-size: 13px }

main { position: relative; z-index: 1; max-width: 1320px; margin: auto; padding: 40px 24px 64px }
section + section { margin-top: 56px }

/* Hero */
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 32px; align-items: end; margin-bottom: 32px }
.hero h1 { font-size: clamp(32px, 4.2vw, 54px); line-height: 1.08; letter-spacing: -.035em; margin: 14px 0 16px; font-weight: 700 }
.hero p { margin: 0; font-size: 15px; line-height: 1.75; color: var(--muted); max-width: 640px }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px }
.stat { padding: 16px 18px }
.stat .value { display: block; margin-top: 8px; font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums }
.stat small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted) }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 18px }
.section-head h2 { font-size: 22px; letter-spacing: -.02em; margin: 8px 0 0 }
.section-head p { margin: 8px 0 0; font-size: 13.5px; line-height: 1.7; color: var(--muted); max-width: 760px }

/* Workspace */
.workspace { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start }
.step { margin-bottom: 14px }
aside h3 { font-size: 14px; margin: 0 0 12px }
.field { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 20px }
.field select { width: 100%; margin-top: 8px; padding: 10px }
.samples { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px }
.sample { position: relative; border: 1px solid var(--line); background: #fff; border-radius: 12px; overflow: hidden; padding: 0; cursor: pointer; color: inherit; text-align: left; transition: transform .15s, box-shadow .15s }
.sample:hover { transform: translateY(-1px); box-shadow: var(--shadow) }
.sample img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover }
.sample small { display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 500; padding: 5px 7px }
.sample small::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--normal) }
.sample[data-label=anomalous] small::before { background: var(--anomaly) }
.sample.selected { outline: 2px solid var(--blue); outline-offset: 1px }
.drop { display: block; border: 1.5px dashed var(--line-2); border-radius: 12px; text-align: center; padding: 18px 6px; font-size: 12.5px; cursor: pointer; background: rgb(255 255 255 / .5); color: var(--ink-2) }
.drop small { display: block; font-size: 11px; color: var(--faint); margin-top: 6px }
.drop.drag, .drop:hover { background: #eef3ff; border-color: var(--blue) }
.note { font-size: 11.5px; line-height: 1.65; color: var(--muted); margin: 12px 0 22px }
.primary { width: 100%; border: 0; border-radius: 12px; padding: 13px; color: #fff; font-weight: 600; cursor: pointer; background: var(--blue-600) linear-gradient(120deg, var(--blue), var(--violet)) }
.primary:not(:disabled):hover { filter: brightness(1.06) saturate(1.1); box-shadow: 0 8px 22px -8px rgb(79 123 255 / .65) }
button:disabled { opacity: .55; cursor: wait }
.check { display: flex; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 500; margin-top: 18px }
input[type=checkbox], input[type=range] { accent-color: var(--blue) }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; margin-bottom: 10px }
.secondary { background: #fff; border: 1px solid var(--line-2); border-radius: 9px; padding: 7px 11px; font-size: 12px; cursor: pointer; color: var(--ink-2) }
#status { font-size: 12px; line-height: 1.6; margin-top: 16px; color: var(--blue-600); min-height: 2.6em }

.result-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px }
.result-head h3 { font-size: 16px; margin: 0 }
.result-head span { font-size: 11.5px; color: var(--faint); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50% }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border-radius: 14px; overflow: hidden; background: var(--line); border: 1px solid var(--line); margin-bottom: 20px }
.metrics > div { background: rgb(255 255 255 / .85); padding: 14px 16px }
.metrics strong { display: block; margin-top: 6px; font-size: clamp(18px, 2vw, 24px); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em }
.metrics small.sub { display: block; margin-top: 4px; font-size: 11px; color: var(--muted) }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 14px }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor }
.pill.normal { background: #eef3ff; color: var(--normal) }
.pill.anomalous { background: #ffeef2; color: var(--anomaly) }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px }
figure { margin: 0; min-width: 0 }
figcaption { font-size: 12px; font-weight: 500; display: flex; justify-content: space-between; gap: 6px; padding-bottom: 7px; color: var(--ink-2) }
figcaption span + span { color: var(--faint); font-weight: 400; font-size: 11px; white-space: nowrap }
.image-wrap { position: relative; background: #eef2fa; border-radius: 12px; aspect-ratio: 1; display: flex; justify-content: center; align-items: center; overflow: hidden; border: 1px solid var(--line) }
canvas { width: 100%; height: 100%; display: block }
#original.clickable { cursor: crosshair }
#placeholder { position: absolute; color: var(--faint); font-size: 12px; text-align: center; padding: 10px }
.colorbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 11px; color: var(--muted); margin-top: 12px; font-variant-numeric: tabular-nums }
.colorbar span:last-child { flex-basis: 100% }
.colorbar i { flex: 1; height: 8px; border-radius: 99px; background: linear-gradient(90deg, #30123b, #4662d7, #36aaf9, #1ae4b6, #72fe5e, #c8ef34, #faba39, #f66b19, #ca2a04, #7a0403) }
.controls { margin-top: 16px }
.controls label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 500 }
.controls input { width: 100%; margin: 10px 0 4px }
.controls small { font-size: 11px; color: var(--muted) }
.comparison .pill { font-size: 12px; padding: 1px 8px }
.comparison { background: #eef3ff; border-radius: 12px; padding: 12px 14px; margin-top: 16px; font-size: 12.5px; line-height: 1.7; color: var(--ink-2) }

/* Distribution charts */
.chart-card { padding: 22px 24px 18px }
.chart-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px }
.chart-meta b { font-variant-numeric: tabular-nums }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-left: auto }
.legend span { display: inline-flex; align-items: center; gap: 6px }
.legend i { width: 9px; height: 9px; border-radius: 50% }
.strip { width: 100%; height: auto; display: block; overflow: visible }
.strip text { font-size: 11px; fill: var(--muted); font-family: inherit }
.strip .axis { stroke: var(--line-2) }
.strip .thr { stroke: var(--ink); stroke-dasharray: 4 4 }
.strip .zone { fill: rgb(240 71 107 / .06) }
.strip .you { stroke: var(--violet); stroke-width: 2 }
.strip .you-label { fill: var(--violet); font-weight: 600 }
.strip .row-label { fill: var(--ink-2); font-weight: 600; font-size: 12px }
.chart-note { font-size: 11.5px; color: var(--muted); line-height: 1.65; margin: 10px 0 0 }

/* SAM study */
.study { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px }
.study table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums }
.study th, .study td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--line) }
.study thead th { font-size: 11px; color: var(--muted); font-weight: 500 }
.study tbody th { font-weight: 500; color: var(--ink-2) }
.better { color: var(--good); font-weight: 650 }
.worse { color: var(--anomaly); font-weight: 650 }
.cases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px }
.case img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); background: #eef2fa }
.case .tri { display: grid; grid-template-columns: repeat(3, 1fr); font-size: 10.5px; color: var(--muted); text-align: center; margin: 6px 0 12px }
.case h3 { font-size: 15px; margin: 8px 0 6px }
.case p { font-size: 12.5px; line-height: 1.65; color: var(--muted); margin: 0 }
.scores { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 10px 0 0; font-variant-numeric: tabular-nums }
.scores .arrow { color: var(--faint) }
.tag { display: inline-block; font-size: 10.5px; font-weight: 600; border-radius: 6px; padding: 2px 7px; margin-right: 6px }
.tag.ok { background: #e7f8f1; color: #08875e }
.tag.bad { background: #ffeef2; color: #c8274b }

details.archive { margin-top: 20px }
details.archive summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--blue-600) }
.archive-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px }

footer { position: relative; z-index: 1; max-width: 1320px; margin: auto; padding: 0 24px 48px; font-size: 12px; line-height: 1.75; color: var(--muted) }
footer .card { display: grid; grid-template-columns: 1.2fr 2fr; gap: 28px }
footer h4 { font-size: 13px; color: var(--ink); margin: 0 0 6px }
footer p { margin: 0 0 6px }
.byline { display: flex; align-items: center; gap: 12px; margin-bottom: 10px }
.byline b { font-size: 15px; color: var(--ink) }
.links { display: flex; flex-wrap: wrap; gap: 6px 16px }

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, 1fr) }
  .hero { grid-template-columns: 1fr }
}
@media (max-width: 860px) {
  .workspace, .study, .archive-grid, footer .card { grid-template-columns: 1fr }
  .samples { grid-template-columns: repeat(6, 1fr) }
  .metrics { grid-template-columns: 1fr 1fr }
  .projects a.repo, .icon-link span { display: none }
  .cases { grid-template-columns: 1fr }
}
@media (max-width: 560px) {
  .site-header .inner { padding: 0 16px; gap: 10px }
  .brand .kicker { display: none }
  .projects { margin-left: 0 }
  .projects a { padding: 6px 8px; font-size: 12px }
  main { padding: 28px 16px 48px }
  footer { padding: 0 16px 40px }
  .card { padding: 18px; border-radius: 16px }
  .samples { grid-template-columns: repeat(3, 1fr) }
  .grid { gap: 10px }
  .hero-stats { grid-template-columns: repeat(3, 1fr); gap: 8px }
  .stat { padding: 12px }
  .stat .value { font-size: 20px }
  .section-head { flex-direction: column; align-items: start }
  .legend { margin-left: 0 }
}
@media (max-width: 420px) { .brand b { display: none } }
