/* ============================================================
   AI HARP Platform — prototype styles
   ============================================================ */
:root {
  --bg: #0d1424;
  --bg-soft: #121b30;
  --panel: #ffffff;
  --panel-2: #f5f7fb;
  --ink: #1a2233;
  --ink-soft: #5b6678;
  --line: #e4e8f0;
  --brand: #2563eb;
  --brand-ink: #1d4ed8;
  --accent: #06b6d4;
  --paren: #34d399;     /* parenchyma overlay */
  --pelvis: #f59e0b;    /* renal pelvis overlay */
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #22c55e;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .10);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .06);
  --font: "Inter", "Noto Sans KR", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--panel-2);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.container { width: min(1180px, 92vw); margin: 0 auto; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
a { color: var(--brand-ink); text-decoration: none; }

/* ============ Header ============ */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 20, 36, .92);
  backdrop-filter: blur(8px);
  color: #eef2fb;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { color: var(--accent); display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; letter-spacing: .04em; }
.brand-text span { font-size: 11.5px; color: #9fb0cc; }
.header-nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.header-nav a { color: #c7d2e6; }
.header-nav a:hover { color: #fff; }
.badge-research {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: rgba(6,182,212,.14); color: #67e8f9; border: 1px solid rgba(6,182,212,.35);
}

/* ============ Hero ============ */
.hero {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  color: #eaf0fb; padding: 54px 0 64px;
}
.hero-eyebrow { color: #67e8f9; font-size: 12.5px; letter-spacing: .22em; font-weight: 600; margin: 0 0 14px; }
.hero h1 { font-size: clamp(24px, 3.2vw, 38px); margin: 0 0 18px; max-width: 22ch; font-weight: 800; }
.hero-sub { color: #b9c5dc; font-size: 16px; max-width: 70ch; margin: 0 0 22px; }
.hero-sub strong { color: #fff; font-weight: 600; }
.hero-disclaimer {
  font-size: 13.5px; color: #ffe8c2; background: rgba(245,158,11,.12);
  border: 1px solid rgba(245,158,11,.3); border-radius: 10px; padding: 12px 16px; max-width: 80ch;
}
.hero-disclaimer strong { color: #ffd591; }

/* ============ Stepper ============ */
.stepper-wrap { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 64px; z-index: 40; }
.stepper { list-style: none; display: flex; gap: 8px; margin: 0; padding: 14px 0; overflow-x: auto; }
.step { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 999px; color: var(--ink-soft); font-size: 14px; font-weight: 500; white-space: nowrap; flex: 1; justify-content: center; background: var(--panel-2); transition: .2s; }
.step .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #dde3ee; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.step.is-active { background: var(--brand); color: #fff; }
.step.is-active .num { background: #fff; color: var(--brand); }
.step.is-done { background: #e7f7ee; color: #15803d; }
.step.is-done .num { background: var(--ok); color: #fff; }

/* ============ App grid ============ */
.app-main { padding: 30px 0 50px; }
.app-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 22px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-input { padding: 6px 22px 22px; }
.panel-result { padding: 22px; min-height: 520px; display: flex; flex-direction: column; }

.block { padding: 18px 0; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: none; }
.block-title { display: flex; align-items: center; gap: 10px; font-size: 16px; margin: 0 0 6px; }
.step-chip { font-size: 12px; font-weight: 700; color: var(--brand); background: #e8efff; border-radius: 7px; padding: 3px 8px; letter-spacing: .04em; }
.block-desc { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 16px; }

/* ============ Dropzone ============ */
.dropzone {
  border: 2px dashed #cdd6e6; border-radius: 12px; padding: 26px 18px; text-align: center;
  cursor: pointer; transition: .18s; background: var(--panel-2);
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--brand); background: #f0f5ff; }
.dropzone:focus-visible { outline: 3px solid rgba(37,99,235,.35); outline-offset: 2px; }
.dz-icon { color: var(--brand); display: flex; justify-content: center; margin-bottom: 8px; }
.dz-main { margin: 0 0 4px; font-size: 14.5px; }
.dz-link { color: var(--brand-ink); font-weight: 600; text-decoration: underline; }
.dz-hint { margin: 0; font-size: 12px; color: var(--ink-soft); }

/* ============ Thumbnails ============ */
.thumb-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 9px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; background: #0c1220;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.is-active { border-color: var(--brand); }
.thumb .thumb-tag { position: absolute; left: 4px; top: 4px; font-size: 10px; background: rgba(0,0,0,.6); color: #fff; padding: 1px 5px; border-radius: 5px; }
.thumb .thumb-x { position: absolute; right: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.thumb .thumb-x:hover { background: var(--danger); }

/* ============ Fields ============ */
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 7px; }
.text-input, select.text-input { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-size: 14px; background: #fff; color: var(--ink); }
.text-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.ga-input { display: flex; align-items: center; gap: 6px; }
.ga-input input { width: 64px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-size: 14px; }
.ga-input span { color: var(--ink-soft); font-size: 13px; }

.seg-toggle { display: flex; gap: 6px; background: var(--panel-2); padding: 4px; border-radius: 10px; }
.seg-btn { flex: 1; padding: 9px 10px; border: none; background: transparent; border-radius: 7px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); cursor: pointer; transition: .15s; }
.seg-btn.is-active { background: #fff; color: var(--brand-ink); box-shadow: var(--shadow-sm); }

/* ============ Buttons ============ */
.btn { font: inherit; font-weight: 600; border-radius: 10px; cursor: pointer; border: 1px solid transparent; transition: .15s; }
.btn-primary { background: var(--brand); color: #fff; padding: 12px 18px; font-size: 15px; }
.btn-primary:hover:not(:disabled) { background: var(--brand-ink); }
.btn-primary:disabled { background: #c2cbdc; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); padding: 9px 14px; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-ink); }
.btn-sm { font-size: 13px; }
#loadSampleBtn { margin-top: 12px; }
.micro-note { font-size: 12px; color: var(--ink-soft); margin: 8px 0 0; text-align: center; }

/* ============ Result panel ============ */
.result-empty { margin: auto; text-align: center; color: var(--ink-soft); max-width: 34ch; }
.re-icon { color: #c3cde0; margin-bottom: 14px; }
.result-empty p { font-size: 14.5px; }

.result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.result-head h2 { font-size: 18px; margin: 0; }
.demo-tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: #b45309; background: #fef3c7; border: 1px solid #fcd34d; border-radius: 999px; padding: 4px 11px; }

/* viewer */
.viewer { margin: 0 0 18px; }
.viewer-canvas-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #0a0f1c; box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
#viewerCanvas { width: 100%; height: auto; display: block; }
.viewer-sidebadge { position: absolute; left: 12px; top: 12px; font-size: 12px; font-weight: 700; color: #fff; background: rgba(37,99,235,.85); padding: 5px 12px; border-radius: 999px; }
.viewer-cap { font-size: 12.5px; color: var(--ink-soft); margin: 10px 2px 8px; }
.legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-soft); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 13px; height: 13px; border-radius: 4px; display: inline-block; }
.sw-paren { background: var(--paren); }
.sw-pelvis { background: var(--pelvis); }
.overlay-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* metrics */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.metric { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.metric-label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; margin-bottom: 8px; }
.metric-value { font-size: 40px; font-weight: 800; letter-spacing: -.02em; color: var(--brand-ink); line-height: 1; }
.metric-sub { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }

.metric-gauge { display: flex; flex-direction: column; align-items: center; }
.gauge { position: relative; width: 100%; max-width: 200px; }
.gauge-svg { width: 100%; height: auto; display: block; }
.gauge-track { stroke: #e2e8f2; }
.gauge-fill { stroke: var(--ok); transition: stroke-dasharray .8s cubic-bezier(.22,1,.36,1), stroke .4s; }
.gauge-readout { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; }
.gauge-readout span { font-size: 34px; font-weight: 800; color: var(--ink); }
.gauge-readout small { font-size: 16px; color: var(--ink-soft); font-weight: 600; }
.risk-band { margin-top: 6px; font-size: 13px; font-weight: 700; padding: 5px 14px; border-radius: 999px; }
.risk-low { background: #dcfce7; color: #15803d; }
.risk-mid { background: #fef3c7; color: #b45309; }
.risk-high { background: #fee2e2; color: #b91c1c; }

/* secondary */
.result-secondary { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.kv { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 11px 14px; font-size: 13.5px; }
.kv span { color: var(--ink-soft); }
.kv strong { font-weight: 600; }

.result-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.result-foot { font-size: 11.5px; color: var(--ink-soft); margin: 0; padding-top: 12px; border-top: 1px solid var(--line); }

/* compare */
.compare { margin-top: 30px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.compare-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 14px; }
.compare-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.compare-card .cc-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #0a0f1c; display: block; }
.compare-card .cc-body { padding: 12px 14px; }
.compare-card .cc-side { font-size: 12px; font-weight: 700; color: var(--brand-ink); }
.compare-card .cc-harp { font-size: 24px; font-weight: 800; margin: 2px 0; }
.compare-card .cc-prob { font-size: 13px; color: var(--ink-soft); }

/* ============ About ============ */
.about { background: var(--panel); border-top: 1px solid var(--line); padding: 50px 0; }
.about h2 { font-size: 22px; margin: 0 0 24px; }
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.about-grid h3 { font-size: 15px; color: var(--brand-ink); margin: 0 0 8px; }
.about-grid p { font-size: 14px; color: var(--ink-soft); margin: 0; }
.about-grid strong { color: var(--ink); }

/* ============ Footer ============ */
.app-footer { background: var(--bg); color: #8fa0bd; padding: 22px 0; font-size: 12.5px; text-align: center; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .app-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 18px; }
  .metrics { grid-template-columns: 1fr; }
  .stepper-wrap { position: static; }
  .step .label { display: none; }
  .step { flex: 0 0 auto; padding: 8px 12px; }
}
@media (max-width: 560px) {
  .header-nav a { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .hero { padding: 36px 0 44px; }
}
