/* Developer Tool / IDE palette (ui-ux-pro-max): OLED dark + Swiss.
   JetBrains Mono for code, IBM Plex Sans for UI. Green is the one primary action.
   Catalog border #475569 is 2.1:1 on the card; --line is #64748B (3.3:1).
   ponytail: hover/press only — no GSAP scroll reveal. Ceiling: nothing animates
   on entrance. Upgrade path: a reduced-motion-gated fade if this becomes multi-page. */

:root {
  color-scheme: dark;
  --bg: #0f172a;
  --card: #1b2336;
  --header: #1e293b;
  --muted-bg: #272f42;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --line: #64748b;
  --accent: #22c55e;
  --on-accent: #0f172a;
  --bad: #fca5a5;
  --bad-bg: #3a2020;
  --ok: #86efac;
  --ok-bg: #13281f;
  --write: #fdba74;
  --write-bg: #2a1c14;
  --local: #7dd3fc;
  --local-bg: #1e293b;
  --slip: #0f172a;
  --focus: #ffffff;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --dur: 180ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --shadow: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

html { overflow-x: clip; }

body {
  min-height: 100dvh;
  background:
    radial-gradient(720px 220px at 0% 0%, rgba(34, 197, 94, 0.07), transparent 62%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}

html {
  scroll-padding-top: 12px;
  scroll-padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

a { color: var(--accent); text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection { background: var(--accent); color: var(--on-accent); }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 30;
  background: var(--ink);
  color: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
}

.skip:focus { top: 12px; }

.top {
  background: var(--header);
  border-bottom: 1px solid var(--line);
  padding: 16px 0 18px;
}

.top-row,
main,
.recipes,
.foot {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.top-row { display: grid; gap: 8px; }

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-wrap: balance;
}

.lede {
  margin: 0;
  max-width: 68ch;
  color: var(--soft);
  text-wrap: pretty;
}

main {
  margin-top: 16px;
  display: grid;
  gap: 16px;
}

.rail, .composer, .result, .recipes {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
}

.rail { padding: 12px; }

.rail-title {
  margin: 0 4px 8px;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.cmds {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.group {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cmd, .preset, .seg button, .btn, .recipe, .ghost {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 44px;
  padding: 8px 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.cmd {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  background: var(--muted-bg);
  border-color: var(--line);
  padding: 8px 4px;
}

.cmd-label { white-space: nowrap; }

.mark {
  display: none;
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--accent);
}

.cmd[aria-pressed="true"] {
  background: var(--header);
  color: var(--ink);
  border-color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.composer, .result { padding: 16px; }

.summary { margin: 0 0 12px; color: var(--soft); }

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.preset {
  border-color: var(--line);
  background: var(--muted-bg);
  font-size: 14px;
  font-weight: 500;
}

.preset[aria-pressed="true"] {
  background: var(--header);
  color: var(--ink);
  border-color: var(--accent);
}

.grid { display: grid; gap: 12px; }

label.field, .field { display: grid; gap: 6px; }

.lbl {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type="text"], input:not([type]), textarea, select {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

textarea { min-height: 88px; resize: vertical; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }

.seg button {
  border-color: var(--line);
  background: var(--muted-bg);
  min-height: 44px;
  flex: 1 1 auto;
}

.seg button[aria-pressed="true"] {
  background: var(--header);
  color: var(--ink);
  border-color: var(--accent);
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 44px;
  padding: 8px 0;
}

.check input {
  width: 24px;
  height: 24px;
  min-width: 24px;
  margin-top: 0;
  accent-color: var(--accent);
  flex: none;
}

.hint { color: var(--muted); font-size: 14px; }

.result { display: grid; gap: 12px; align-content: start; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid var(--accent);
}

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.pill.bad {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: var(--bad);
}

.slip {
  margin: 0;
  background: var(--slip);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tok-cmd { color: var(--ok); }
.tok-flag { color: var(--local); }
.tok-str { color: #fde68a; }

.row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kbd {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  min-height: 28px;
}

.btn {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
  font-weight: 600;
  min-width: 7.5rem;
}

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  font-weight: 500;
}

.ghost {
  border-color: var(--line);
  color: var(--soft);
  background: var(--muted-bg);
  min-height: 44px;
  padding: 8px 12px;
  flex: none;
}

.alerts { margin: 0; padding-left: 18px; }

.alerts li { margin: 4px 0; }

.alerts.bad { color: var(--bad); }
.alerts.warn { color: var(--write); }

.kicker {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.note { margin: 0; color: var(--soft); font-size: 14px; }

.policy {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
}

.policy-icon { width: 20px; height: 20px; flex: none; margin-top: 1px; }

.policy.read { background: var(--ok-bg); border-left-color: var(--accent); color: var(--ok); }
.policy.write { background: var(--write-bg); border-left-color: var(--write); color: var(--write); }
.policy.local { background: var(--local-bg); border-left-color: var(--local); color: var(--local); }

.policy h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: inherit;
}

.policy p { margin: 0; color: var(--ink); font-size: 14px; }

.recipes { margin-top: 16px; margin-bottom: 8px; padding: 16px; }

.recipes-head { display: grid; gap: 12px; }

.recipes h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.35rem;
  font-weight: 600;
}

.pin { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }

.pin-label { display: grid; gap: 6px; flex: 1 1 220px; }

.status { margin: 8px 0 0; color: var(--soft); font-size: 14px; }

.status:empty { display: none; }

.recipe-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.recipe-list:empty { display: none; }

.recipe-list li { display: flex; gap: 8px; align-items: stretch; }

.recipe {
  flex: 1;
  min-width: 0;
  text-align: left;
  border-color: var(--line);
  background: var(--bg);
  border-radius: 8px;
  min-height: 52px;
}

.recipe strong { font-weight: 600; }

.recipe small {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.empty-wrap {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
  margin-top: 12px;
  padding: 20px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.empty-wrap:has(#recipe-empty[hidden]) { display: none; }

.empty-icon { width: 36px; height: 36px; color: var(--muted); }

.empty { margin: 0; max-width: 52ch; color: var(--soft); }

.foot {
  margin-top: 8px;
  margin-bottom: 24px;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
}

.foot a { color: var(--accent); }

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--header);
  border-top: 1px solid var(--line);
}

.dock-status { flex: none; }

.dock-line {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.3;
  color: var(--soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock .btn { flex: none; min-width: 0; }

.skel, .skel-field {
  display: block;
  height: 44px;
  border-radius: 8px;
  background: var(--muted-bg);
}

.skel-field { height: 64px; margin-top: 12px; }

.noscript {
  width: min(1120px, calc(100% - 32px));
  margin: 12px auto;
  color: var(--soft);
}

@media (min-width: 720px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .field, .check { grid-column: 1 / -1; }
  .field-pair { grid-column: auto; }
}

@media (min-width: 768px) {
  body { padding-bottom: 0; }
  html { scroll-padding-bottom: 16px; }
  .dock { display: none; }
  .cmds { grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); }
  .top-row,
  main,
  .recipes,
  .foot,
  .noscript { width: min(1120px, calc(100% - 48px)); }
  main { grid-template-columns: 1fr 1fr; align-items: start; }
  .rail { grid-column: 1 / -1; }
}

@media (min-width: 1024px) {
  .top { padding: 20px 0; }
  .top-row {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    align-items: end;
    gap: 16px 40px;
  }
  main {
    grid-template-columns: 200px minmax(0, 1fr) minmax(300px, 360px);
    padding-top: 4px;
  }
  .rail { grid-column: auto; }
  .result { position: sticky; top: 16px; }
  .cmds { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .group {
    position: static;
    width: auto;
    height: auto;
    margin: 12px 4px 2px;
    overflow: visible;
    clip: auto;
    white-space: normal;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .group:first-child { margin-top: 0; }
  .cmd {
    justify-content: space-between;
    text-align: left;
    background: transparent;
    border-color: transparent;
    padding: 8px 12px;
  }
  .cmd:hover, .preset:hover, .seg button:hover, .recipe:hover, .ghost:hover, .btn-quiet:hover {
    background: var(--muted-bg);
  }
  .cmd[aria-pressed="true"],
  .cmd[aria-pressed="true"]:hover {
    background: var(--header);
    border-color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
  }
  .cmd[aria-pressed="true"] .mark { display: inline-flex; }
  .recipes-head { grid-template-columns: 1fr auto; align-items: end; }
}

@media (prefers-reduced-motion: no-preference) {
  .cmd, .preset, .seg button, .btn, .recipe, .ghost, .slip {
    transition:
      background-color var(--dur) var(--ease),
      color var(--dur) var(--ease),
      border-color var(--dur) var(--ease),
      box-shadow var(--dur) var(--ease),
      transform 100ms var(--ease);
  }
  .cmd:active, .preset:active, .seg button:active, .btn:active, .recipe:active, .ghost:active {
    transform: scale(0.98);
  }
  .slip.is-fresh { animation: fresh 240ms var(--ease); }
}

@keyframes fresh {
  from { box-shadow: inset 3px 0 0 var(--accent); }
  to { box-shadow: inset 3px 0 0 transparent; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (hover: hover) {
  .btn:not(.btn-quiet):hover { filter: brightness(1.06); }
}

@media (hover: hover) and (max-width: 1023px) {
  .cmd:hover, .preset:hover, .seg button:hover, .recipe:hover, .ghost:hover, .btn-quiet:hover {
    background: var(--header);
  }
  .cmd[aria-pressed="true"]:hover { background: var(--header); }
}

@media (prefers-contrast: more) {
  :root { --line: #cbd5e1; --muted: #e2e8f0; }
}

@media (forced-colors: active) {
  .pill, .btn, .cmd[aria-pressed="true"], .preset[aria-pressed="true"] {
    border: 1px solid CanvasText;
  }
}
