:root {
  color-scheme: dark;
  --ink: #eef4f7;
  --muted: #91a3ac;
  --bg: #071014;
  --panel: #0d191e;
  --line: rgba(184, 215, 226, .15);
  --accent: #e5ff4f;
  --cyan: #56d9dc;
  --coral: #ff795e;
  --error: #ff8c78;
  --radius: 20px;
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); min-width: 320px; }
button, input { font: inherit; }
a { color: inherit; }

.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; background: var(--accent); color: #111; padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { top: 16px; }

.hero { position: relative; overflow: hidden; min-height: 520px; padding: 0 clamp(24px, 6vw, 96px) 56px; background: radial-gradient(circle at 78% 20%, rgba(86,217,220,.16), transparent 30%), linear-gradient(135deg, #0a181e 0%, #071014 68%); border-bottom: 1px solid var(--line); }
.hero::after { content: ""; position: absolute; right: -110px; top: 70px; width: 520px; height: 300px; border: 1px solid rgba(229,255,79,.24); transform: rotate(-17deg); border-radius: 50%; box-shadow: 0 0 100px rgba(86,217,220,.08); pointer-events: none; }
.lab-nav { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); position: relative; z-index: 1; }
.lab-mark { display: flex; gap: 10px; align-items: center; font-weight: 800; letter-spacing: .13em; text-decoration: none; font-size: 13px; }
.mark-dot { width: 11px; height: 11px; background: var(--accent); border-radius: 50%; box-shadow: 13px 0 0 var(--cyan); margin-right: 13px; }
.nav-right { display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
.nav-actions { display: flex; align-items: center; gap: 22px; }
.nav-link { color: var(--muted); text-decoration: none; font-size: 13px; border-bottom: 1px solid currentColor; padding-bottom: 3px; }
.nav-link-primary { color: var(--ink); }
.authbar { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.authbar[hidden] { display: none; }
.cfms-login { display: flex; align-items: center; gap: 6px; }
.cfms-login[hidden] { display: none; }
.authbar input { width: 128px; padding: 5px 7px; border: 1px solid rgba(184,215,226,.32); border-radius: 5px; font-size: 12px; background: rgba(255,255,255,.07); color: var(--ink); }
.authbar input::placeholder { color: var(--muted); }
.authbar input:focus { outline: 1px solid rgba(229,255,79,.55); border-color: rgba(229,255,79,.55); }
.cfms-auth-button { border: 1px solid rgba(229,255,79,.42); border-radius: 6px; padding: 5px 11px; background: rgba(229,255,79,.1); color: var(--accent); font-size: 11px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.cfms-auth-button:hover:not(:disabled) { background: rgba(229,255,79,.2); }
.cfms-auth-button:disabled { opacity: .45; cursor: progress; }
.cfms-auth-button[hidden] { display: none; }
.pill { padding: 4px 10px; border-radius: 12px; background: rgba(255,255,255,.15); color: var(--muted); font-size: 11px; white-space: nowrap; }
.pill[hidden] { display: none; }
.pill[data-state="connected"] { color: var(--accent); background: rgba(229,255,79,.1); }
.pill[data-state="error"] { color: #ffc0b3; background: rgba(255,121,94,.14); }
.hero-copy { position: relative; z-index: 1; width: min(780px, 100%); padding: 70px 0 48px; }
.eyebrow, .section-index { margin: 0 0 15px; color: var(--accent); letter-spacing: .18em; font-size: 11px; font-weight: 800; }
h1 { margin: 0; font-size: clamp(28px, 5.7vw, 72px); line-height: 1.04; letter-spacing: -.055em; font-weight: 820; word-break: keep-all; }
.hero-title-line { white-space: nowrap; }
.hero-title-outline { color: transparent; -webkit-text-stroke: 1px rgba(238,244,247,.7); }
.lede { max-width: 690px; color: #b8c6cc; font-size: clamp(16px, 2vw, 19px); line-height: 1.75; margin: 28px 0 0; word-break: keep-all; }
.pipeline { position: relative; z-index: 1; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pipeline li { min-height: 92px; padding: 17px 20px; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; align-content: center; border-right: 1px solid var(--line); transition: background .25s, color .25s; }
.pipeline li:last-child { border: 0; }
.pipeline li > span { grid-row: 1 / 3; color: var(--cyan); font: 700 12px/1 ui-monospace, monospace; padding-top: 3px; }
.pipeline strong { font-size: 14px; }
.pipeline small { color: var(--muted); font-size: 11px; }
.pipeline li.is-active { background: var(--accent); color: #101614; }
.pipeline li.is-active > span, .pipeline li.is-active small { color: #364220; }
.pipeline li.is-done > span { color: var(--accent); }

.workspace { display: grid; grid-template-columns: minmax(300px, 410px) minmax(0, 1fr); min-height: 760px; }
.control-panel { padding: 58px clamp(24px, 4vw, 56px); border-right: 1px solid var(--line); background: #091318; }
.section-heading h2, .viewer-header h2, .results-heading h2 { margin: 0; font-size: clamp(25px, 3vw, 36px); letter-spacing: -.035em; }
.drop-zone { margin-top: 34px; min-height: 260px; border: 1px dashed rgba(184,215,226,.36); border-radius: var(--radius); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 28px; cursor: pointer; background: linear-gradient(145deg, rgba(86,217,220,.06), transparent 55%); transition: border-color .2s, background .2s, transform .2s; }
.drop-zone:hover, .drop-zone.is-dragging, .drop-zone:focus-within { border-color: var(--accent); background: rgba(229,255,79,.055); transform: translateY(-2px); }
.drop-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #101614; font-size: 29px; margin-bottom: 20px; }
.drop-title { font-size: 17px; font-weight: 750; }
.drop-copy { color: var(--muted); font-size: 12px; margin-top: 7px; }
.format-row { display: flex; gap: 7px; margin-top: 24px; }
.format-row b { font: 700 10px/1 ui-monospace, monospace; color: var(--cyan); border: 1px solid rgba(86,217,220,.25); border-radius: 5px; padding: 6px 7px; }
.file-summary { margin-top: 14px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 13px; background: #112027; border: 1px solid var(--line); border-radius: 12px; }
.file-summary[hidden] { display: none; }
.file-badge { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 9px; background: var(--cyan); color: #082024; font: 900 11px/1 ui-monospace, monospace; }
.file-summary strong, .file-summary span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-summary strong { font-size: 13px; }
.file-summary span { color: var(--muted); font-size: 11px; margin-top: 4px; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }
.quality-field { border: 0; padding: 0; margin: 30px 0 0; display: grid; gap: 9px; }
.quality-field legend { font-size: 12px; font-weight: 750; margin-bottom: 10px; }
.quality-option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.quality-option:has(input:checked) { border-color: rgba(229,255,79,.55); background: rgba(229,255,79,.05); }
.quality-option input { accent-color: var(--accent); }
.quality-option span, .quality-option strong, .quality-option small { display: block; }
.quality-option strong { font-size: 13px; }
.quality-option small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.analyze-button { width: 100%; border: 0; border-radius: 12px; padding: 17px 20px; margin-top: 22px; display: flex; justify-content: space-between; background: var(--accent); color: #101614; font-weight: 800; cursor: pointer; transition: filter .2s, transform .2s; }
.analyze-button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.analyze-button:disabled { cursor: not-allowed; opacity: .28; }
.privacy-note { color: var(--muted); font-size: 10px; line-height: 1.5; text-align: center; }
.status { padding: 12px 13px; border-radius: 9px; background: rgba(86,217,220,.09); color: var(--cyan); font-size: 12px; line-height: 1.5; }
.status[hidden] { display: none; }
.status.is-error { color: var(--error); background: rgba(255,121,94,.09); }

.viewer-panel { position: relative; min-width: 0; padding: 58px clamp(20px, 4vw, 58px); background: radial-gradient(circle at 50% 30%, #13252c 0, #0a1419 64%); }
.viewer-header { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 26px; }
.viewer-tools { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.viewer-hint { color: var(--muted); font-size: 11px; }
.support-toggle { display: flex; align-items: center; gap: 7px; color: #dce6e9; font-size: 11px; cursor: pointer; user-select: none; }
.support-toggle input { width: 15px; height: 15px; margin: 0; accent-color: var(--coral); }
.viewer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; height: 570px; }
.viewport-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(5,12,15,.62); }
.viewport-card.featured { border-color: rgba(229,255,79,.32); }
.viewport-label { position: absolute; z-index: 2; left: 16px; top: 15px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; pointer-events: none; }
.label-dot { width: 7px; height: 7px; border-radius: 50%; }
.label-dot.original { background: var(--cyan); }
.label-dot.optimal { background: var(--accent); }
.support-summary { position: absolute; z-index: 2; right: 16px; top: 15px; color: #ffc0b3; font: 700 10px/1 ui-monospace, monospace; pointer-events: none; }
.viewport { width: 100%; height: 100%; }
.viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.build-axis { position: absolute; z-index: 2; left: 16px; bottom: 14px; color: var(--muted); font: 10px/1 ui-monospace, monospace; pointer-events: none; }
.build-axis span { color: var(--accent); font-size: 15px; }
.support-legend { display: flex; align-items: center; gap: 8px; margin: 12px 2px 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.support-legend span { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 2px; background: var(--coral); box-shadow: 0 0 12px rgba(255,121,94,.45); }
.viewer-empty { position: absolute; inset: 150px 20px 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); pointer-events: none; }
.viewer-empty[hidden] { display: none; }
.viewer-empty p { font-size: 13px; line-height: 1.7; }
.empty-object { position: relative; width: 75px; height: 75px; margin-bottom: 18px; transform: rotate(30deg) skew(-4deg); }
.empty-object span { position: absolute; border: 1px solid rgba(86,217,220,.4); width: 52px; height: 52px; }
.empty-object span:nth-child(1) { left: 0; top: 10px; }
.empty-object span:nth-child(2) { left: 16px; top: 0; border-color: rgba(229,255,79,.4); }
.empty-object span:nth-child(3) { left: 12px; top: 20px; border-color: rgba(255,121,94,.35); }

.results { padding: 76px clamp(24px, 6vw, 96px); background: #edf1ec; color: #111a1d; }
.results[hidden] { display: none; }
.results .section-index { color: #526f09; }
.results-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.results-heading > p { max-width: 460px; margin: 0; color: #657075; font-size: 13px; line-height: 1.6; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 38px; border: 1px solid #cbd4ce; border-radius: 16px; overflow: hidden; }
.metric-grid article { padding: 25px; min-height: 150px; display: flex; flex-direction: column; border-right: 1px solid #cbd4ce; }
.metric-grid article:last-child { border: 0; }
.metric-grid span { color: #687379; font-size: 11px; font-weight: 700; }
.metric-grid strong { margin-top: auto; font-size: clamp(23px, 3vw, 36px); letter-spacing: -.04em; }
.metric-grid small { color: #7c888d; font-size: 10px; margin-top: 3px; }
.candidate-section { margin-top: 44px; }
.candidate-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.candidate-title-row h3 { margin: 0; font-size: 16px; }
.candidate-title-row span { color: #6e787c; font-size: 11px; }
.landscape-layout { display: grid; grid-template-columns: minmax(0, 1fr) 254px; gap: 26px; align-items: start; }
.landscape-figure { margin: 0; min-width: 0; }
.landscape-side { min-width: 0; }
.landscape-table-scroll { overflow-x: auto; }
.landscape-plot { position: relative; }
.landscape-svg { display: block; width: 100%; max-width: 780px; height: auto; touch-action: none; }
.landscape-dot { stroke: rgba(17,26,29,.22); stroke-width: .5; }
.landscape-marker { fill: none; stroke: #1f2a2e; stroke-width: 1.6; }
.landscape-marker.is-best { stroke: #465700; stroke-width: 2.6; }
.landscape-marker.is-selected { fill: rgba(70,87,0,.3); }
.landscape-star { fill: #08306b; stroke: #f7f8f5; stroke-width: 1; }
.landscape-tick { font: 10px/1 ui-monospace, monospace; fill: #697478; }
.landscape-axis-title { font: 700 11px/1 Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif; fill: #4b565a; }
.landscape-legend { font: 11px/1 Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif; fill: #59666b; }
.landscape-figure figcaption { margin-top: 10px; max-width: 640px; color: #6e787c; font-size: 11px; line-height: 1.6; word-break: keep-all; }
.landscape-tooltip { position: absolute; z-index: 3; transform: translate(12px, -50%); display: grid; gap: 2px; padding: 7px 9px; border-radius: 8px; background: #111a1d; color: #eef4f7; font-size: 11px; line-height: 1.4; white-space: nowrap; pointer-events: none; box-shadow: 0 6px 18px rgba(17,26,29,.25); }
.landscape-tooltip[hidden] { display: none; }
.landscape-side h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: .04em; }
.landscape-side h4 + .landscape-table-scroll { margin-bottom: 22px; }
.landscape-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.landscape-table th { text-align: right; padding: 0 0 6px; color: #697478; font-weight: 700; border-bottom: 1px solid #cbd4ce; }
.landscape-table th:first-child { text-align: left; }
.landscape-table td { text-align: right; padding: 6px 0; border-bottom: 1px solid #dde3dd; font-variant-numeric: tabular-nums; }
.landscape-table td:first-child { text-align: left; }
.landscape-table tr.is-selected td { background: rgba(229,255,79,.45); }
.landscape-select { border: 1px solid #cbd4ce; border-radius: 6px; padding: 2px 8px; background: rgba(255,255,255,.6); color: inherit; font: 700 10px/1.6 ui-monospace, monospace; cursor: pointer; }
.landscape-select:hover { border-color: #596c0c; background: var(--accent); }
.landscape-table tr.is-best .landscape-select { color: #465700; border-color: #a8b878; }
.method-note { border-top: 1px solid #cbd4ce; margin-top: 42px; padding-top: 20px; }
.method-note summary { font-weight: 750; font-size: 13px; cursor: pointer; }
.method-note p { max-width: 900px; color: #59666b; line-height: 1.75; font-size: 13px; }
footer { min-height: 84px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 24px clamp(24px, 6vw, 96px); color: var(--muted); font-size: 10px; border-top: 1px solid var(--line); }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .viewer-grid { height: 510px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-grid article:nth-child(2) { border-right: 0; }
  .metric-grid article:nth-child(-n+2) { border-bottom: 1px solid #cbd4ce; }
  .landscape-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .hero { padding-inline: 20px; }
  .lab-mark { font-size: 11px; }
  .nav-right { gap: 10px; }
  .nav-actions { gap: 12px; }
  .nav-link { font-size: 11px; }
  .authbar { gap: 6px; }
  .authbar input { width: 104px; }
  .pill { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
  .hero-copy { padding-top: 52px; }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
  .pipeline li:nth-child(2) { border-right: 0; }
  .pipeline li:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .control-panel, .viewer-panel { padding: 42px 20px; }
  .viewer-header { align-items: start; }
  .viewer-tools { align-items: flex-end; flex-direction: column; gap: 8px; }
  .viewer-grid { grid-template-columns: 1fr; height: 760px; }
  .viewer-empty { inset: 150px 20px 45px; }
  .results { padding: 58px 20px; }
  .results-heading { display: block; }
  .results-heading > p { margin-top: 15px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid article { min-height: 125px; padding: 18px; }
  .candidate-title-row { display: block; }
  .candidate-title-row span { display: block; margin-top: 6px; }
  .landscape-layout { grid-template-columns: 1fr; gap: 20px; }
  footer { display: block; line-height: 1.7; }
  footer span { display: block; }
}

@media (max-width: 880px) {
  .lab-nav { height: auto; min-height: 76px; padding: 12px 0; align-items: flex-start; }
  .nav-right { align-items: flex-end; flex-direction: column; gap: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
