/* Refrakt prototype — Rhinoplasty simulator */

:root {
  --bg: #f4f1ec;
  --bg-2: #ebe7e0;
  --bg-card: #fbfaf7;
  --ink: #1a1815;
  --ink-2: #3d3833;
  --ink-3: #7a736a;
  --ink-4: #aea69a;
  --hairline: #d9d3c8;
  --hairline-2: #c8c1b3;
  --accent: #1a1815;
  --warn: #b85a2a;
  --ok: #4a6b3f;
  --serif: "Instrument Serif", "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }

.app {
  display: grid;
  grid-template-rows: 56px 1fr 36px;
  height: 100vh;
}

/* ===== TOP BAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg);
}
.brand {
  display: flex; align-items: center; gap: 14px;
}
.brand-mark {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.01em;
}
.brand-mark em { font-style: italic; }
.brand-divider {
  width: 1px; height: 18px; background: var(--hairline-2);
}
.brand-context {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.session-meta {
  display: flex; gap: 22px; align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.session-meta .v { color: var(--ink); }
.session-meta .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); display: inline-block; margin-right: 6px;
  box-shadow: 0 0 0 3px rgba(74,107,63,0.15);
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }
.btn {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 14px;
  border: 1px solid var(--hairline-2);
  background: transparent;
  color: var(--ink-2);
  transition: all 0.15s;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-2); }
.btn-primary:disabled {
  background: transparent; color: var(--ink-4); border-color: var(--hairline);
  cursor: not-allowed;
}
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { border-color: var(--hairline-2); }

/* ===== MAIN GRID ===== */
.workspace {
  display: grid;
  grid-template-columns: 340px 1fr 340px;
  overflow: hidden;
}
.panel {
  overflow-y: auto;
  background: var(--bg);
}
.panel.left { border-right: 1px solid var(--hairline); }
.panel.right { border-left: 1px solid var(--hairline); }

.panel-section {
  padding: 20px 22px;
  border-bottom: 1px solid var(--hairline);
}
.panel-section:last-child { border-bottom: none; }

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
}
.section-label .num {
  color: var(--ink-4);
  margin-right: 8px;
}
.section-title {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 4px;
}
.section-title em { font-style: italic; }

/* ===== CANVAS ===== */
.canvas-wrap {
  position: relative;
  background: var(--bg-2);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.canvas-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg);
}
.canvas-tabs { display: flex; gap: 0; }
.canvas-tab {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 14px;
  color: var(--ink-3);
  border: 1px solid var(--hairline);
  border-right: none;
  background: transparent;
}
.canvas-tab:last-child { border-right: 1px solid var(--hairline); }
.canvas-tab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.canvas-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  overflow: hidden;
}

.face-frame {
  position: relative;
  width: min(520px, 70%);
  aspect-ratio: 3/4;
  background: var(--bg-card);
  border: 1px solid var(--hairline-2);
  overflow: hidden;
}
.face-frame.split { display: grid; grid-template-columns: 1fr 1fr; }
.face-frame.split > div { position: relative; }
.face-frame.split > div + div { border-left: 1px solid var(--hairline-2); }

.face-placeholder {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(60,55,50,0.04) 14px 15px);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.face-corner {
  position: absolute;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 12px;
}
.face-corner.tl { top: 0; left: 0; }
.face-corner.tr { top: 0; right: 0; text-align: right; }
.face-corner.bl { bottom: 0; left: 0; }
.face-corner.br { bottom: 0; right: 0; text-align: right; }

.face-corner .big {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-transform: none;
  line-height: 1;
  margin-top: 2px;
}

/* Real photo inside the face-frame */
.canvas-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

/* Face SVG placeholder (unused — kept for any legacy callers) */
.face-portrait {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.face-portrait svg {
  width: 78%;
  height: 78%;
  opacity: 0.85;
}

/* Landmarks overlay */
.landmark-dot {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  outline: 1px solid rgba(20,15,10,0.6);
  transform: translate(-50%,-50%);
}
.warp-vector {
  position: absolute;
  stroke: var(--warn);
  fill: none;
  pointer-events: none;
}
.heal-mask {
  position: absolute;
  background: rgba(184, 90, 42, 0.15);
  border: 1px dashed var(--warn);
  border-radius: 50%;
}

/* Before/after split slider */
.split-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 0 0 1px rgba(20,15,10,0.4);
  pointer-events: none;
}
.split-handle::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--ink);
  transform: translate(-50%,-50%);
}
.split-label {
  position: absolute;
  top: 14px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--bg);
  padding: 4px 8px;
  border: 1px solid var(--hairline-2);
}

.canvas-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--hairline);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.canvas-footer .right { display: flex; gap: 18px; }
.canvas-footer .right span b { color: var(--ink); font-weight: 500; }

/* Overlay toggles row */
.overlay-toggles {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px;
  background: var(--bg);
  padding: 6px;
  border: 1px solid var(--hairline-2);
}
.overlay-toggles button {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 10px;
  color: var(--ink-3);
  border: 1px solid transparent;
}
.overlay-toggles button.on {
  background: var(--ink);
  color: var(--bg);
}

/* ===== UPLOAD ===== */
.dropzone {
  border: 1px dashed var(--hairline-2);
  background: var(--bg-card);
  padding: 22px 18px;
  text-align: center;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.dropzone:hover { border-color: var(--ink-2); }
.dropzone .icon {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.dropzone .hint {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 6px 0 10px;
}
.dropzone-actions { display: flex; gap: 6px; justify-content: center; }

.detection {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  margin-bottom: 8px;
}
.detection .label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.detection .value {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
}
.detection .meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}

.samples {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.sample {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  position: relative;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s;
}
.sample:hover { border-color: var(--ink); }
.sample.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
.sample svg { width: 60%; height: 60%; opacity: 0.65; }
.sample .tag {
  position: absolute; bottom: 3px; left: 4px;
  font-family: var(--mono); font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  text-transform: uppercase;
}

/* ===== PRESET CHIPS ===== */
.preset-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 14px;
}
.chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 10px;
  border: 1px solid var(--hairline-2);
  color: var(--ink-3);
  background: transparent;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip.active {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}

/* ===== SLIDERS ===== */
.slider-block {
  margin-bottom: 16px;
  position: relative;
}
.slider-block:last-child { margin-bottom: 0; }
.slider-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.slider-name {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  display: flex; align-items: center; gap: 6px;
}
.slider-name .info {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid var(--hairline-2);
  font-family: var(--serif);
  font-style: italic;
  font-size: 10px;
  color: var(--ink-3);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: help;
}
.slider-value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}
.slider-value .unit { color: var(--ink-3); margin-left: 2px; }
.slider-track {
  position: relative;
  height: 22px;
  display: flex; align-items: center;
}
.slider-rail {
  width: 100%;
  height: 1px;
  background: var(--hairline-2);
  position: relative;
}
.slider-range {
  position: absolute;
  top: -3px; height: 7px;
  background: rgba(74,107,63,0.18);
  border-left: 1px solid var(--ok);
  border-right: 1px solid var(--ok);
}
.slider-fill {
  position: absolute;
  height: 1px; top: 0;
  background: var(--ink);
}
.slider-thumb {
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--ink);
  transform: translate(-50%, -50%);
  top: 50%;
  cursor: grab;
}
.slider-thumb.warn { border-color: var(--warn); }
.slider-meta {
  display: flex; justify-content: space-between;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-4);
  letter-spacing: 0.1em;
  margin-top: 4px;
}
.slider-meta .harmony { color: var(--ok); }
.slider-meta .harmony.warn { color: var(--warn); }

.guardrail {
  display: flex; gap: 8px; align-items: flex-start;
  background: rgba(184, 90, 42, 0.08);
  border-left: 2px solid var(--warn);
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-2);
  line-height: 1.4;
}
.guardrail .icon {
  font-family: var(--serif); font-style: italic;
  color: var(--warn);
  flex-shrink: 0;
}

/* ===== HEAL BUTTON ===== */
.heal-bar {
  padding: 16px 22px;
  background: var(--bg-card);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.heal-cta {
  width: 100%;
  background: var(--ink);
  color: var(--bg);
  padding: 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  display: flex; align-items: center; justify-content: space-between;
}
.heal-cta:hover { background: var(--ink-2); }
.heal-cta:disabled {
  background: transparent;
  color: var(--ink-4);
  border-color: var(--hairline-2);
  cursor: not-allowed;
}
.heal-cta .est {
  font-size: 9px; letter-spacing: 0.14em;
  opacity: 0.65;
}
.heal-options {
  margin-top: 12px;
}
.heal-options summary {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  padding: 6px 0;
  list-style: none;
  display: flex; justify-content: space-between;
}
.heal-options summary::-webkit-details-marker { display: none; }
.heal-options summary::after {
  content: "+"; font-family: var(--serif); font-size: 16px; line-height: 0.6;
}
.heal-options[open] summary::after { content: "−"; }
.heal-options .opts { padding-top: 8px; }

/* ===== RESULTS ===== */
.result-tray {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  position: relative;
  overflow: hidden;
}
.result-card.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
.result-thumb {
  aspect-ratio: 3/4;
  background: var(--bg-2);
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.result-thumb svg { width: 60%; opacity: 0.7; }
.result-card.original .result-thumb { background: var(--bg-2); }
.result-meta {
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex; justify-content: space-between;
  border-top: 1px solid var(--hairline);
}
.result-meta b { color: var(--ink); font-weight: 500; }
.result-actions {
  position: absolute; top: 6px; right: 6px;
  display: flex; gap: 3px;
  opacity: 0; transition: opacity 0.15s;
}
.result-card:hover .result-actions { opacity: 1; }
.result-actions button {
  width: 22px; height: 22px;
  background: var(--bg);
  border: 1px solid var(--hairline-2);
  font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}
.result-actions button.pinned { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.result-badge {
  position: absolute; top: 6px; left: 6px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 6px;
  border: 1px solid var(--hairline-2);
  color: var(--ink-3);
}
.result-badge.pinned { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ===== HISTORY ===== */
.history-list { display: flex; flex-direction: column; gap: 1px; }
.history-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.history-row .time {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  padding-top: 2px;
}
.history-row .desc { color: var(--ink-2); }
.history-row .desc small {
  display: block; color: var(--ink-3); font-size: 10px; margin-top: 2px;
  font-family: var(--mono); letter-spacing: 0.06em;
}
.history-row .badge {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 5px;
  border: 1px solid var(--hairline-2);
  color: var(--ink-3);
  align-self: center;
}

/* ===== ANATOMY ===== */
.anatomy {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
}
.anatomy div {
  background: var(--bg-card);
  padding: 8px 10px;
  font-size: 11px;
}
.anatomy div span {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 2px;
}

/* ===== FOOTER ===== */
.bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-top: 1px solid var(--hairline);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}
.bottombar .left { display: flex; gap: 16px; align-items: center; }
.bottombar em {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--ink-2);
  text-transform: none;
}

/* ===== CONSENT ===== */
.consent-overlay {
  position: fixed; inset: 0;
  background: rgba(26,24,21,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.consent {
  background: var(--bg);
  max-width: 520px;
  padding: 36px 40px;
  border: 1px solid var(--ink);
}
.consent h2 {
  font-family: var(--serif);
  font-size: 32px;
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin-bottom: 14px;
}
.consent h2 em { font-style: italic; }
.consent p { color: var(--ink-2); margin-bottom: 10px; }
.consent ul {
  list-style: none;
  margin: 16px 0 22px;
  border-top: 1px solid var(--hairline);
}
.consent li {
  border-bottom: 1px solid var(--hairline);
  padding: 10px 0;
  font-size: 12px;
  display: grid; grid-template-columns: 18px 1fr;
  gap: 10px;
  color: var(--ink-2);
}
.consent li span {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}
.consent-actions { display: flex; gap: 8px; }

/* ===== HEAL MODAL ===== */
.heal-progress-overlay {
  position: absolute;
  inset: 0;
  background: rgba(244,241,236,0.92);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  z-index: 5;
}
.heal-progress {
  text-align: center;
  max-width: 340px;
}
.heal-progress .stage {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.heal-progress .title {
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 18px;
}
.heal-progress .title em { font-style: italic; }
.heal-progress .bar {
  width: 100%; height: 2px;
  background: var(--hairline);
  position: relative;
  margin-bottom: 12px;
}
.heal-progress .bar div {
  position: absolute; top: 0; left: 0; height: 100%;
  background: var(--ink);
}
.heal-progress .steps {
  display: flex; justify-content: space-between;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.heal-progress .steps .done { color: var(--ink); }
.heal-progress .steps .active { color: var(--warn); }

/* ===== TOOLTIP ===== */
.tip-anchor { position: relative; }
.tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 12px;
  width: 240px;
  font-size: 11px;
  line-height: 1.45;
  z-index: 10;
  font-family: var(--sans);
  letter-spacing: 0;
  text-transform: none;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
}
.tip::after {
  content: "";
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ink);
}
.slider-name:hover .tip,
.tip-anchor:hover .tip { opacity: 1; }
.tip .label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 4px;
}

/* small utility */
.row-between { display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--ink-3); }
.mono-tiny {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.divider {
  height: 1px; background: var(--hairline); margin: 14px 0;
}

/* scrollbars */
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb { background: var(--hairline-2); }

/* --- feedback-fixes: 4-category param accordion + preview controls --- */
.param-cat { border-top: 1px solid var(--hairline); }
.param-cat:first-child { border-top: none; }
.param-cat-head { display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: 0; padding: 12px 0; cursor: pointer; color: var(--ink); font: inherit; text-align: left; }
.param-cat-head .caret { transition: transform .15s; font-size: 10px; color: var(--ink-3); }
.param-cat-head .caret.open { transform: rotate(90deg); }
.param-cat-name { flex: 1; font-weight: 600; font-size: 12px; }
.param-cat-count { font-size: 10px; color: var(--ink-3); font-family: var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.param-cat-body { padding: 4px 0 12px; }
.slider-block.preview { opacity: .5; pointer-events: none; }
.slider-track.preview .slider-rail { background: repeating-linear-gradient(90deg, var(--hairline) 0 6px, transparent 6px 12px); }
.slider-thumb.preview { background: var(--ink-3); }
.preview-tag { margin-left: 6px; font-size: 9px; font-family: var(--mono); text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-3); border: 1px solid var(--hairline); border-radius: 4px; padding: 0 4px; }

/* compact "coming soon" row for params without a live warp axis */
.param-preview { display: flex; align-items: center; justify-content: space-between;
  padding: 7px 2px; border-bottom: 1px solid var(--hairline); }
.param-preview:last-child { border-bottom: none; }
.param-preview-name { font-size: 11.5px; color: var(--ink-4); }
.param-preview-tag { font-size: 8.5px; font-family: var(--mono); text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-4); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 1px 7px; }

/* step rail */
.step-rail { display: flex; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--hairline);
  overflow-x: auto; background: var(--bg-card); }
.step-pill { display: flex; align-items: center; gap: 8px; border: 1px solid var(--hairline);
  background: transparent; border-radius: 999px; padding: 6px 12px; cursor: pointer; color: var(--ink-3);
  font: inherit; font-size: 12px; white-space: nowrap; }
.step-pill.active { color: var(--ink); border-color: var(--ink); background: var(--bg-2); }
.step-pill.disabled { opacity: .4; cursor: not-allowed; }
.step-pill .step-n { font-family: var(--mono); font-size: 10px; opacity: .7; }
.step-body { flex: 1; min-height: 0; overflow: auto; }

/* intake */
.intake { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 32px; max-width: 900px; margin: 0 auto; }
.intake-hint { margin-top: 16px; color: var(--ink-3); }

/* analysis */
.analysis { display: grid; grid-template-columns: minmax(280px, 460px) 1fr; gap: 24px; padding: 24px; }
.an-stage { position: relative; align-self: start; }
.an-img { width: 100%; display: block; border-radius: 10px; }
.an-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.an-svg .nasal-line { fill: none; stroke: var(--warn); stroke-width: 1.4; opacity: .85; }
.an-svg .nasal-pt { fill: #fff; stroke: var(--warn); stroke-width: 1.2; }
.an-cards { display: grid; gap: 14px; align-content: start; }
.an-card { background: var(--bg-card); border: 1px solid var(--hairline); border-radius: 12px; padding: 14px 16px; }
.an-card h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.an-row { display: flex; justify-content: space-between; align-items: baseline; padding: 3px 0;
  font-size: 13px; color: var(--ink-2); }
.an-v { font-variant-numeric: tabular-nums; color: var(--ink); }
.tagdot { font-size: 9px; padding: 1px 5px; border-radius: 4px; margin-left: 6px; }
.tagdot.green { background: rgba(46,160,90,.18); color: #2e8a52; }
.tagdot.amber { background: rgba(201,138,26,.18); color: #9a6a14; }
.tagdot.red   { background: rgba(200,60,60,.18);  color: #b03a3a; }
.tagdot.est   { background: rgba(140,140,140,.18); color: #777; }
.conf-flag { color: var(--warn); font-weight: 600; cursor: help; margin-left: 4px; }
.an-card.report ul { margin: 2px 0 10px; padding-left: 18px; line-height: 1.6; font-size: 13px; }
.an-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-top: 8px; font-weight: 600; }
.an-sub.summary { color: #2e8a52; } .an-sub.opportunity { color: #9a6a14; } .an-sub.constraint { color: #b03a3a; }

/* placeholder + final */
.placeholder-step { display: flex; align-items: center; justify-content: center; height: 100%; padding: 60px; }
.ph-inner { max-width: 460px; text-align: center; }
.ph-kicker { color: var(--ink-3); margin-bottom: 10px; }
.ph-inner h2 { font-family: var(--serif); font-style: italic; font-size: 32px; margin: 0 0 12px; color: var(--ink); }
.ph-inner p { color: var(--ink-2); line-height: 1.6; }
.final-step { display: grid; grid-template-columns: 1fr 320px; gap: 16px; padding: 16px; height: 100%; }
.final-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.final-card { border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; cursor: pointer; }
.final-card.active { border-color: var(--ink); }
.final-card img { width: 100%; display: block; }
.final-meta { display: flex; justify-content: space-between; padding: 6px 8px; font-size: 11px; }

/* step-shell wraps rail+body into the single grid middle row */
.step-shell { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.step-body .workspace { height: 100%; }
.step-body .final-step { height: 100%; }

/* analysis: view banner + N/A (view-gated) metrics */
.an-viewbanner { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; margin-bottom: 2px;
  background: var(--bg-card); border: 1px solid var(--hairline); border-radius: 12px; }
.an-viewtag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink); background: var(--bg-2); border-radius: 6px; padding: 2px 8px; }
.an-viewnote { font-size: 12px; color: var(--ink-3); }
.an-row.na { opacity: .55; }
.an-row.na span:first-child { color: var(--ink-3); }
.tagdot.na { background: rgba(140,140,140,.14); color: #888; font-style: normal; }

/* ── analysis hero (annotated face) ────────────────────────────────────────── */
.analysis { display: flex; flex-direction: column; gap: 16px; padding: 20px; max-width: 1120px; margin: 0 auto; }
.an-hero { width: 100%; background: #11100e; border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden; }
.an-svg-wrap { position: relative; width: 100%; }
.an-hero .an-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.an-svg .contour { fill: none; stroke: rgba(255,255,255,.5); stroke-width: 1; }
.an-svg .wguide { stroke: rgba(255,255,255,.32); stroke-width: .8; stroke-dasharray: 3 3; }
.an-svg .anchor-dot { fill: rgba(255,255,255,.85); }
.an-svg .leader { fill: none; stroke: rgba(255,255,255,.4); stroke-width: .8; }
.an-svg .leader-end { fill: rgba(255,255,255,.7); }
.an-svg .pill-bg { fill: rgba(250,249,247,.95); stroke: rgba(0,0,0,.08); stroke-width: .5; }
.an-svg .pill-name { fill: #1a1815; font: 600 12px Inter, system-ui, sans-serif; }
.an-svg .pill-val { fill: #7a736a; font: 11px "JetBrains Mono", ui-monospace, monospace; }
.an-svg .pill-tag.green { fill: rgba(46,160,90,.16); }
.an-svg .pill-tag.amber { fill: rgba(201,138,26,.18); }
.an-svg .pill-tag.red   { fill: rgba(200,60,60,.16); }
.an-svg .pill-tag.est   { fill: rgba(140,140,140,.18); }
.an-svg .pill-tagtext { font: 600 10px "JetBrains Mono", ui-monospace, monospace; letter-spacing: .03em; }
.an-svg .pill-tagtext.green { fill: #2e8a52; } .an-svg .pill-tagtext.amber { fill: #9a6a14; }
.an-svg .pill-tagtext.red { fill: #b03a3a; } .an-svg .pill-tagtext.est { fill: #777; }
.an-svg .score-badge rect { fill: rgba(17,16,14,.84); stroke: rgba(255,255,255,.12); }
.an-svg .score-num { fill: #fff; font: 600 18px Inter, system-ui, sans-serif; }
.an-svg .score-band { fill: rgba(255,255,255,.6); font: 10px "JetBrains Mono", ui-monospace, monospace; letter-spacing: .08em; }
.an-svg .view-badge rect { fill: rgba(250,249,247,.9); }
.an-svg .view-badge text { fill: #1a1815; font: 600 10px "JetBrains Mono", ui-monospace, monospace; letter-spacing: .06em; }
.an-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.an-continue { justify-self: center; align-self: center; padding: 10px 22px; }

/* nose outline / silhouette */
.an-svg .nose-outline { fill: rgba(217,119,87,.10); stroke: #ff8c5a; stroke-width: 1.6; stroke-linejoin: round; }

/* ── Step 3 recommendation + Step 4 reference ─────────────────────────────── */
.recommend-step, .reference-step { padding: 8px 4px 40px; }
.recommend-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.profile-tag { color: var(--ink-3); border: 1px solid var(--hairline); padding: 3px 8px; border-radius: 2px; }

.flashcard-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.flashcard {
  position: relative; background: var(--bg-card); border: 1px solid var(--hairline);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.flashcard.natural { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.natural-badge {
  position: absolute; top: -1px; right: -1px; background: var(--ink); color: var(--bg-card);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 8px;
}
.fc-rank { color: var(--ink-4); }
.fc-preview, .vc-img {
  position: relative; aspect-ratio: 4/5; background: var(--bg-2); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.fc-preview img, .vc-img img { width: 100%; height: 100%; object-fit: cover; }
.fc-preview-ph { color: var(--ink-4); }
.fc-name { font-family: var(--serif); font-size: 20px; margin: 2px 0; }
.fc-chars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.fc-chars li { font-size: 12px; color: var(--ink-2); padding-left: 12px; position: relative; }
.fc-chars li::before { content: "·"; position: absolute; left: 2px; color: var(--ink-4); }
.fc-metrics-label { color: var(--ink-3); margin-bottom: 4px; }
.fc-metric-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.fc-metric-pill {
  font-family: var(--mono); font-size: 10px; color: var(--ink-2);
  background: var(--bg-2); border: 1px solid var(--hairline); padding: 2px 6px;
}
.fc-approx { color: var(--ink-3); font-style: italic; line-height: 1.5; }
.fc-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: auto; }
.score-chip {
  display: flex; flex-direction: column; gap: 1px; padding: 6px 8px;
  background: var(--bg-2); border: 1px solid var(--hairline);
}
.sc-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.sc-value { font-size: 14px; color: var(--ink); }
.score-chip.good { border-color: #5a8a4a; }
.score-chip.amber { border-color: #b8902a; }
.score-chip.red { border-color: var(--warn); }
.fc-actions { display: flex; flex-direction: column; gap: 6px; }

.ref-style-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.variant-grid { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 880px) { .variant-grid { grid-template-columns: 1fr; } }
.variant-col {
  background: var(--bg-card); border: 1px solid var(--hairline);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.vc-head { display: flex; align-items: baseline; justify-content: space-between; }
.vc-label { font-family: var(--serif); font-size: 18px; }
.vc-scale { color: var(--ink-3); }
.vc-photoreal {
  position: absolute; bottom: 6px; left: 6px; background: var(--ink); color: var(--bg-card);
  padding: 2px 6px; letter-spacing: 0.08em; text-transform: uppercase;
}
.vc-blurb { color: var(--ink-3); }
.an-svg .nasal-ov .nose-outline { fill: none; }
