/* Hi-fi · Minimal
   Black and white with one green accent. Black header bar, a numbered step rail,
   big confident type, filled surfaces instead of outlined boxes, underlined fields,
   pill actions. Layout base comes from ../style.css; hifi.js adds the rail and icons. */
:root {
  --ink: #111111;
  --muted: #6b6b70;
  --line: #e4e4e7;
  --line-strong: #111111;
  --fill: #f4f4f5;
  --surface: #f4f4f5;
  --bg: #ffffff;
  --accent: #1d7a35;        /* text-safe green */
  --accent-bright: #86bc25; /* decorative green */
  --accent-soft: #eef6e2;
  --sim: #9a5b00;
  --sim-bg: transparent;
  --ok: #1d7a35;
  --radius: 0;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}

body { background: var(--bg); font-family: var(--sans); -webkit-font-smoothing: antialiased; letter-spacing: -0.011em; }
.mono { font-family: var(--sans); font-weight: 600; letter-spacing: .08em; font-size: 11px; }

/* ---------- Header: black bar ---------- */
.topbar {
  max-width: none; background: #000; color: #fff; padding: 0 max(40px, calc((100% - 1200px) / 2 + 40px));
  height: 60px; position: sticky; top: 0; z-index: 10;
}
.topbar .brand { order: -1; gap: 16px; }
.app-name { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; text-transform: none; display: inline-flex; align-items: center; gap: 10px; }
.app-name::before { content: ""; width: 12px; height: 12px; background: var(--accent-bright); }
.step-label { color: #a1a1a6; }
.sim-badge { order: 2; color: #ffb84d; border: 1px solid rgba(255,184,77,.6); border-radius: 999px; padding: 3px 10px; font-size: 10px; background: transparent; }
.progress { display: none; }

/* ---------- Shell: rail + content ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 64px; max-width: 1200px; width: 100%; margin: 0 auto; padding: 56px 40px 24px; flex: 1; }
.content { min-width: 0; }
main { padding: 0; max-width: none; }
.rail { position: sticky; top: 108px; align-self: start; }
.rail-title { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; }
.rail-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.rail-list li { display: flex; align-items: center; gap: 12px; padding: 11px 0 11px 18px; margin-left: -1px; border-left: 2px solid transparent; color: #9a9aa0; font-size: 14px; }
.rail-num { width: 24px; height: 24px; border-radius: 50%; border: 1px solid #c8c8cc; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.rail-check { width: 14px; height: 14px; display: none; stroke-width: 2.4; }
.rail-list li.current { border-left-color: var(--accent-bright); color: var(--ink); font-weight: 600; }
.rail-list li.current .rail-num { background: var(--ink); border-color: var(--ink); color: #fff; }
.rail-list li.done { color: var(--ink); }
.rail-list li.done .rail-num { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.rail-list li.done .n { display: none; }
.rail-list li.done .rail-check { display: block; }
.rail-note { font-size: 12px; color: var(--muted); margin: 24px 0 0; line-height: 1.5; }

/* ---------- Type ---------- */
h1 { font-family: var(--display); font-size: 52px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.04; margin: 0 0 14px; }
h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 18px; }
.sub { color: var(--muted); font-size: 19px; }
.step-head { margin-bottom: 40px; }
.link-btn { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 15px; margin-top: 14px; }
.link-btn::after { content: " →"; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Surfaces ---------- */
.grid-3, .grid-2 { gap: 16px; }
.card { background: var(--surface); border: 0; border-top: 3px solid transparent; padding: 28px; transition: border-color .2s, background .2s; }
.grid-3 .card, .grid-2 .card { min-height: 380px; }
.card.has-content { border-top-color: var(--accent-bright); background: #f0f0f1; }
.card-label { color: var(--muted); }
.ico-tile { width: 44px; height: 44px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 22px; transition: background .2s; }
.ico-tile .ico { width: 22px; height: 22px; }
.card.has-content .ico-tile { background: var(--accent); }

/* Underlined fields */
label, .field-label { font-size: 13px; font-weight: 600; color: var(--ink); margin-top: 20px; }
input[type="text"], textarea {
  background: transparent; border: 0; border-bottom: 1.5px solid #c8c8cc; border-radius: 0; padding: 10px 0; font-size: 17px;
  transition: border-color .15s;
}
textarea { background: #fff; border: 1.5px solid transparent; border-bottom-color: #c8c8cc; padding: 10px 12px; }
input[type="text"]:hover, textarea:hover { border-bottom-color: #8e8e93; }
input:focus, textarea:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1.5px 0 0 var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Buttons ---------- */
.btn { border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; font-weight: 600; padding: 13px 26px; transition: background .15s, color .15s, transform .1s; }
.btn:hover { background: var(--ink); color: #fff; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-primary::after { content: "  →"; white-space: pre; }
.btn-primary[aria-disabled="true"] { background: #d4d4d8; border-color: #d4d4d8; color: #fff; opacity: 1; }
.btn-primary[aria-disabled="true"]:hover { background: #d4d4d8; border-color: #d4d4d8; }
#backBtn { border-color: transparent; padding-left: 0; padding-right: 0; }
#backBtn:hover { background: transparent; color: var(--accent); }
#backBtn::before { content: "←  "; white-space: pre; }
.btn-small { padding: 8px 16px; font-size: 13px; }
.done-actions .btn-primary::after, .compare-card .btn-primary::after { content: ""; }

/* Chat */
.bubble { border-radius: 18px; padding: 10px 14px; }
.bubble.ai { background: #fff; border: 0; border-bottom-left-radius: 4px; }
.bubble.me { background: var(--ink); border-bottom-right-radius: 4px; }
.bubble .who { font-family: var(--sans); font-weight: 600; }
.chat-form input { background: #fff; padding: 10px 12px; }

/* Goal chips as tiles */
.chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.chip { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; background: #fff; border: 1.5px solid transparent; border-radius: 0; padding: 16px; font-weight: 600; font-size: 15px; text-align: left; transition: border-color .15s, background .15s; }
.chip:hover { border-color: #c8c8cc; }
.chip-ico { width: 22px; height: 22px; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.chip[aria-pressed="true"] .chip-ico { color: var(--accent-bright); }

/* Segmented control */
.toggle { border: 0; background: var(--fill); border-radius: 999px; padding: 4px; margin-bottom: 28px; }
.toggle-btn { background: transparent; border-radius: 999px; font-weight: 600; padding: 10px 22px; color: var(--muted); }
.toggle-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.mode-panel.selected { border-top-color: var(--ink); }
.mode-panel:not(.selected) { opacity: .45; }

/* ---------- Understanding: a clean list ---------- */
.ai-note { color: var(--sim); margin: -24px 0 28px; }
.sim-dot { background: #e08a00; }
.rows { gap: 0; border-top: 1px solid var(--ink); }
.u-row { border: 0; border-bottom: 1px solid var(--line); padding: 24px 0; grid-template-columns: 180px 1fr auto; gap: 28px; }
.u-row .mono { color: var(--ink); font-size: 12px; }
.u-row.edited .mono { color: var(--accent); }
.u-value { background: transparent; border: 0; padding: 0; font-size: 18px; line-height: 1.45; letter-spacing: -0.015em; }
.u-row textarea { font-size: 18px; }
.edited-tag { font-family: var(--sans); font-weight: 600; color: var(--accent); margin-top: 8px; }
.text-btn { color: var(--accent); text-decoration: none; font-weight: 600; }
.text-btn:hover { text-decoration: underline; }
.loading { font-family: var(--sans); font-size: 15px; }

/* ---------- Versions ---------- */
.versions-layout { grid-template-columns: 300px 1fr; gap: 28px; }
.v-item { background: var(--surface); border: 0; border-radius: 0; padding: 18px; transition: background .15s; }
.v-item:hover { background: #ebebed; }
.v-item[aria-current="true"] { background: var(--ink); color: #fff; }
.v-item[aria-current="true"] .mono, .v-item[aria-current="true"] .v-style { color: #a1a1a6; }
.v-preview { background: transparent; border: 0; padding: 0; font-size: 14px; }
.v-item[aria-current="true"] .v-preview { background: transparent; }
.rec-tag { background: var(--accent-bright); color: #000; border-radius: 0; padding: 3px 8px; font-family: var(--sans); font-weight: 700; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.v-item .mono { font-family: var(--sans); }
#moreVersions { border-radius: 0; border-style: dashed; border-color: #c8c8cc; }
#moreVersions:hover { background: var(--fill); color: var(--ink); }
.editor > .card-label { color: var(--ink); margin-bottom: 0; padding-bottom: 14px; border-bottom: 1px solid var(--ink); }
.part { border: 0; border-bottom: 1px solid var(--line); padding: 20px 0; margin: 0; }
.part-head label { font-family: var(--sans); font-weight: 600; font-size: 11px; color: var(--muted); }
.part textarea { background: transparent; border: 0; border-bottom: 1.5px solid transparent; padding: 4px 0; font-size: 17px; resize: none; }
.part textarea:hover { border-bottom-color: #c8c8cc; }
.part textarea:focus { background: transparent; border-bottom-color: var(--accent); }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.compare-card { background: var(--surface); border: 0; border-top: 3px solid transparent; padding: 22px; }
.compare-card.current { border-top-color: var(--ink); }
.compare-card pre { font-family: var(--sans); font-size: 15px; }

/* ---------- Done ---------- */
.step[data-step="6"] .step-head::before {
  content: ""; display: block; width: 56px; height: 56px; border-radius: 50%; margin-bottom: 24px;
  background: var(--accent-bright) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 26px no-repeat;
}
.final { background: var(--surface); border: 0; padding: 32px; max-width: 680px; }
.final-text { font-family: var(--sans); font-size: 18px; line-height: 1.55; }
.copy-ok { color: var(--accent); }

.footer-nav { max-width: none; padding: 40px 0 0; margin-top: 8px; }
.footnote, .ver-switch { max-width: 1200px; color: var(--muted); }
.ver-switch a[aria-current="page"] { color: var(--ink); }

/* ---------- Tablet / phone ---------- */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; gap: 0; padding-top: 0; }
  .rail { display: none; }
  .progress { display: block; width: 100%; max-width: none; height: 3px; background: var(--line); margin: 0; }
  .progress span { background: var(--accent-bright); }
  main { padding-top: 40px; }
}
@media (max-width: 860px) {
  .versions-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { height: auto; padding: 12px 16px; flex-wrap: wrap; row-gap: 4px; }
  .shell { padding: 0 16px 16px; }
  main { padding-top: 28px; }
  h1 { font-size: 34px; }
  .sub { font-size: 17px; }
  .card { padding: 22px; }
  .grid-3 .card, .grid-2 .card { min-height: 0; }
  .u-row { grid-template-columns: 1fr; gap: 6px; padding: 18px 0; }
  .footer-nav { width: auto; position: sticky; bottom: 0; background: rgba(255,255,255,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  #backBtn { flex: 0 0 auto; padding-right: 12px; }
}
