:root {
  color-scheme: dark;
  --bg: #0b0b0b;
  --panel: #121212;
  --panel-2: #171717;
  --line: #2c2c2c;
  --text: #dedbd3;
  --strong: #ece8df;
  --muted: #999389;
  --gold: #e8a13f;
  --gold-word: #d8b76f;
  --gold-soft: #e7bd7a;
  --added: #1d2a1a;
  --added-text: #b9d8a8;
  --removed: #2d1716;
  --removed-text: #e6a89f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "Space Grotesk", system-ui, sans-serif;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, select {
  border: 1px solid #383838;
  background: #1b1b1b;
  color: #c9c9c9;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
}
button:hover { background: #242424; border-color: #676052; }
:is(button, a, input, select, textarea):focus-visible { outline: 2px solid #d7aa5c; outline-offset: 2px; }
.gold, .cta {
  background: var(--gold); border: 1px solid var(--gold); color: #17120b; font-weight: 600;
  border-radius: 6px; padding: 8px 14px; text-decoration: none; white-space: nowrap;
}
.gold:hover, .cta:hover { background: #f0b155; border-color: #f0b155; }
.quiet { background: transparent; border-color: transparent; color: var(--muted); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 22px; border-bottom: 1px solid var(--line); background: #0f0f0f;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--strong); text-decoration: none; font-weight: 600; }
.brand span { color: var(--muted); font-weight: 400; }
.mark { width: 18px; height: 18px; border-radius: 4px; background: #121212; box-shadow: inset 0 0 0 1px #3a3022; position: relative; }
.mark::after { content: ""; position: absolute; inset: 4px; background: var(--gold); clip-path: polygon(0 0, 25% 0, 25% 25%, 40% 25%, 40% 0, 60% 0, 60% 25%, 75% 25%, 75% 0, 100% 0, 100% 45%, 80% 45%, 80% 80%, 100% 80%, 100% 100%, 0 100%, 0 80%, 20% 80%, 20% 45%, 0 45%); }
.top-actions { display: flex; gap: 8px; align-items: center; }

.shell { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: 0; }
.guide { border-right: 1px solid var(--line); padding: 26px 24px; background: var(--panel); display: grid; gap: 14px; align-content: start; }
.kicker { margin: 0; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: #8c968f; }
.guide h1 { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 550; letter-spacing: -0.4px; color: var(--strong); text-wrap: balance; }
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 7px 0; color: var(--muted); font-size: 13px; }
.steps li::before { counter-increment: step; content: counter(step); width: 22px; height: 22px; border-radius: 50%; border: 1px solid #3a3a3a; display: grid; place-items: center; font-size: 11px; }
.steps li.done { color: #bdb8ad; }
.steps li.done::before { content: "✓"; border-color: #6b5530; color: var(--gold-word); }
.steps li.now { color: var(--strong); }
.steps li.now::before { border-color: var(--gold); color: var(--gold-soft); background: #1d1810; }
.step-now { border: 1px solid #3a3023; background: #17140f; border-radius: 8px; padding: 14px 16px; font-size: 13px; color: #d9d0bd; }
.step-now b { color: var(--strong); font-weight: 550; display: block; margin-bottom: 4px; }
.step-now .gold, .step-now .cta { display: inline-block; margin-top: 10px; }

.work { padding: 22px 26px; min-width: 0; display: grid; gap: 16px; align-content: start; }
.project-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.crumb { margin: 0; color: var(--muted); }
.crumb b { color: var(--strong); font-weight: 550; }
.line { margin: 2px 0 12px; font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 18px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 9px 0; font-size: 13px; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--gold-soft); border-color: #d7aa5c; }
.tabs button.pulse { color: var(--gold-soft); }

.files { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
.file-list { list-style: none; margin: 0; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); align-self: start; }
.file-list button { width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 10px; font-family: "JetBrains Mono", monospace; font-size: 12.5px; display: flex; justify-content: space-between; gap: 8px; }
.file-list button[aria-current="true"] { background: #1d1810; color: var(--gold-soft); }
.file-list .mod { color: var(--gold-word); font-family: "Space Grotesk", sans-serif; font-size: 11px; }
.editor { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; display: grid; }
.editor-head { display: flex; justify-content: space-between; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); font-size: 12px; }
.editor-head code { font-family: "JetBrains Mono", monospace; color: #c9bfae; }
.dirty { color: var(--gold-word); }
textarea { min-height: 280px; resize: vertical; border: 0; background: #0f0f0f; padding: 14px 16px; font: 13px/1.7 "JetBrains Mono", ui-monospace, monospace; color: #d4d0c6; }
textarea:focus-visible { outline: none; box-shadow: inset 0 0 0 1px #b68c4a, inset 0 0 18px rgba(215, 170, 92, 0.06); }
.save-row { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--panel-2); }
.save-row input { flex: 1; min-width: 0; border: 1px solid #393732; background: #101010; border-radius: 6px; padding: 8px 12px; }
.save-row input:focus-visible { outline: none; border-color: #b68c4a; box-shadow: 0 0 0 3px rgba(215, 170, 92, 0.09); }

.history { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); overflow: hidden; }
.history li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid #222; position: relative; }
.history li:first-child { border-top: 0; }
.history .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #6b5530; justify-self: center; }
.history li.current .dot { background: var(--gold); border-color: var(--gold); }
.history b { color: var(--strong); font-weight: 550; }
.history small { display: block; color: var(--muted); font-size: 12px; }
.history .acts { display: flex; gap: 8px; }
.history li.current .tag { color: var(--gold-word); font-size: 12px; }
.empty { color: var(--muted); margin: 0; }

.compare-head { display: flex; gap: 14px; flex-wrap: wrap; }
.compare-head label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.diff { border: 1px solid var(--line); border-radius: 8px; background: #0f0f0f; font: 12.5px/1.7 "JetBrains Mono", ui-monospace, monospace; overflow-x: auto; }
.diff div { padding: 0 14px; white-space: pre; display: grid; grid-template-columns: 22px 1fr; }
.diff .add { background: var(--added); color: var(--added-text); }
.diff .del { background: var(--removed); color: var(--removed-text); }
.diff .same { color: #8d897f; }
.diff .note { padding: 16px; color: var(--muted); font-family: "Space Grotesk", sans-serif; display: block; white-space: normal; }

.toast { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: 18px; background: #1d1810; border: 1px solid #6b5530; color: var(--strong); padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .guide { border-right: 0; border-bottom: 1px solid var(--line); }
  .files { grid-template-columns: 1fr; }
  .work { padding: 18px 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .tabs button.pulse { animation: glow 1.6s ease-in-out infinite; }
  @keyframes glow { 50% { color: #f4d39a; } }
}
