/* styles.css — one screen, one input, one card of controls. */

:root {
  --bg: #f7f7f5; --panel: #ffffff; --ink: #16181d; --muted: #646b78;
  --line: #e2e3e0; --accent: #1f5c4d; --accent-ink: #ffffff;
  --chip: #eef1ee; --warn: #8a4b12; --err: #a12a1f; --ok: #1f5c4d;
  --radius: 10px;
}
:root[data-theme="dark"] {
  --bg: #14161a; --panel: #1c1f25; --ink: #e9ecef; --muted: #9aa3b2;
  --line: #2b3038; --accent: #6fd3b4; --accent-ink: #10221c;
  --chip: #262b33; --warn: #e0a35d; --err: #ef8d80; --ok: #6fd3b4;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; }

/* ------------------------------------------------------------------ header */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand { font-weight: 650; text-decoration: none; color: var(--ink); letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.credits { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.btn-primary {
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent;
  border-radius: var(--radius); padding: 10px 16px; font: inherit; font-weight: 600;
  cursor: pointer;
}
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 7px 12px; font: inherit; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); }
.icon-btn {
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; width: 30px; height: 30px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn.small { width: 24px; height: 24px; font-size: 12px; }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; }
.linkbtn {
  background: none; border: none; padding: 0; font: inherit; color: var(--accent);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.link { color: var(--accent); font-size: 13px; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sep { color: var(--muted); margin: 0 6px; }

/* -------------------------------------------------------------------- ask */
.wrap { max-width: 780px; margin: 0 auto; padding: 40px 20px 64px; }
.ask h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.02em; }
.lede { margin: 0 0 18px; color: var(--muted); font-size: 16px; }
.askform { display: flex; gap: 8px; }
.q {
  flex: 1; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--ink); font: inherit;
}
.q:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.hint { margin: 10px 0 0; font-size: 13px; }

/* ------------------------------------------------------------------- zones */
.zone {
  margin-top: 28px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 20px;
}
.zonehead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.zonehead h2 { font-size: 17px; margin: 0 0 4px; }
.exports { display: flex; gap: 8px; }
.askback {
  margin: 10px 0 0; padding: 10px 12px; border-left: 3px solid var(--warn);
  background: var(--chip); border-radius: 0 8px 8px 0; font-size: 14px;
}

/* --------------------------------------------------------------- the plan */
.steps { list-style: none; margin: 14px 0 0; padding: 0; }
.step { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.step.off { opacity: .45; }
.step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-name { font-weight: 600; }
.toggle {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.step.off .toggle { background: transparent; color: transparent; border-color: var(--line); }
.chip {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--chip);
  color: var(--muted); white-space: nowrap;
}
.chip.regime { color: var(--ink); }
.chip.cite { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.moves { margin-left: auto; display: flex; gap: 4px; }
.why { margin: 8px 0 0; font-size: 14px; }
.needs { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.needs-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  background: var(--chip); padding: 2px 6px; border-radius: 4px; margin-right: 4px;
}
.alt { margin: 8px 0 0; font-size: 13px; }
.alt-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin-right: 6px;
}
.alt-why { color: var(--muted); }
.skipped { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.skipped-head { font-size: 13px; margin: 0 0 6px; color: var(--muted); font-weight: 600; }
.skiplist { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.planbar { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.planbar .muted { font-size: 13px; }

/* ---------------------------------------------------------------- progress */
.progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pstages { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; flex-wrap: wrap; }
.pstage {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--chip); color: var(--muted);
}
.pstage.on { color: var(--ink); }
.pstage.done { background: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------------------------ memo */
.recovered {
  margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--warn);
  background: var(--chip); border-radius: 0 8px 8px 0; font-size: 13px;
}
.memo-sec { margin-top: 18px; }
.memo-sec:first-child { margin-top: 8px; }
.memo-h { font-size: 15px; margin: 0 0 6px; }
.memo-p { margin: 0 0 8px; }
.memo-list { margin: 0 0 8px; padding-left: 20px; }
.out code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
  background: var(--chip); padding: 1px 5px; border-radius: 4px;
}

/* --------------------------------------------------------------- history */
.hist { list-style: none; margin: 10px 0 0; padding: 0; }
.hist-row { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.hist-row:last-child { border-bottom: none; }
.hist-row .muted { font-size: 12px; }

/* ----------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--ok);
  border-radius: 10px; padding: 10px 16px; font-size: 14px; max-width: 90vw;
  box-shadow: 0 8px 26px rgba(0,0,0,.14);
}
.toast.err { border-left-color: var(--err); }

/* ------------------------------------------------------------------ foot */
.foot {
  max-width: 780px; margin: 0 auto; padding: 24px 20px 56px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.foot p { margin: 0 0 8px; }

/* ------------------------------------------------------------ docs pages */
.doc { max-width: 860px; margin: 0 auto; padding: 32px 20px 72px; }
.doc h1 { font-size: 26px; }
.doc h2 { font-size: 18px; margin-top: 32px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--panel); }
.tokenbox {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
  background: var(--chip); padding: 10px 12px; border-radius: 8px; word-break: break-all;
}
.langbar { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 10px; }
.langbtn {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.langbtn.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.codeblock pre {
  background: var(--chip); padding: 12px 14px; border-radius: 8px; overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; margin: 0;
}
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 7px 8px; vertical-align: top; }

@media (max-width: 620px) {
  .askform { flex-direction: column; }
  .wrap { padding-top: 28px; }
  .ask h1 { font-size: 25px; }
}
