/* VENDORED from the Pretzel repo by scripts/sync-pretzel.mjs - do not edit.
 * Source: styles.css. Fix it there, then re-run the sync.
 */
/* pretzel - styles */

:root {
  --bg: #0e0f13;
  --bg-2: #14161c;
  --bg-3: #191c23;
  --line: #262a34;
  --line-2: #333846;
  --ink: #e8eaf0;
  --ink-2: #a2a9b8;
  --ink-3: #6d7486;
  --accent: #c9a227;
  --accent-2: #e0b94a;
  --good: #3fb27f;
  --warn: #d8963c;
  --bad: #d95c5c;
  --radius: 10px;
  --rail-w: 328px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme="light"] {
  --bg: #f6f6f4;
  --bg-2: #ffffff;
  --bg-3: #f0f0ee;
  --line: #e0e0dc;
  --line-2: #cdcdc7;
  --ink: #1b1c20;
  --ink-2: #565a63;
  --ink-3: #8b909b;
  --accent: #9a7b12;
  --accent-2: #7c6210;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
code, .mono { font-family: var(--mono); }

/* ------------------------------------------------------------------ topbar -- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand .glyph { font-size: 19px; line-height: 1; }
.brand h1 {
  font-size: 17px;
  letter-spacing: -0.02em;
}
.tagline {
  color: var(--ink-3);
  font-size: 12px;
  border-left: 1px solid var(--line-2);
  padding-left: 9px;
}
.top-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.btn, .icon-btn, .sel {
  font: inherit;
  color: var(--ink);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 11px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover, .icon-btn:hover, .sel:hover { background: var(--line); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.icon-btn {
  width: 30px; height: 30px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
}
.icon-btn.on { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.sel { padding: 5px 8px; max-width: 260px; }
.sel-preset { max-width: 230px; color: var(--ink-2); }

/* --------------------------------------------------------------------- app -- */
.app {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 0;
}
/* One column, not a zeroed first one: the rail is display:none when closed,
   so it leaves the flow entirely and the stage auto-places into whatever
   column comes first. Against `0 1fr` that was the 0 - closing the rail
   collapsed the whole app to nothing rather than just the sidebar. */
body.rail-closed .app { grid-template-columns: 1fr; }
body.rail-closed .rail { display: none; }

/* -------------------------------------------------------------------- rail -- */
.rail {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rail-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.rail-head h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.rail-head p { margin: 4px 0 0; font-size: 12px; color: var(--ink-3); }
.rail-body { flex: 1 1 auto; overflow-y: auto; padding: 4px 0 20px; }
.rail-foot {
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  font-size: 11px;
  color: var(--ink-3);
}
.rail-foot p { margin: 0 0 5px; }
.rail-foot b { color: var(--ink-2); font-family: var(--mono); }

.sec { border-bottom: 1px solid var(--line); }
.sec > summary {
  list-style: none;
  cursor: pointer;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-2);
  user-select: none;
}
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary:hover { color: var(--ink); background: var(--bg-3); }
.caret {
  width: 7px; height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform .15s;
  opacity: .6;
}
.sec[open] .caret { transform: rotate(-135deg); }
.sec-blurb {
  margin: -2px 16px 10px;
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.4;
}

.ctl { padding: 7px 16px 9px; }
.ctl.hidden { display: none; }
.ctl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.ctl-head label { font-size: 12.5px; color: var(--ink-2); }
.ctl-out {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent-2);
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
}
.ctl-hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-3);
}
body.no-hints .ctl-hint, body.no-hints .sec-blurb { display: none; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: grab;
}
input[type="range"]:active { cursor: grabbing; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 3px;
  background: var(--line-2);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--bg-2);
  box-shadow: 0 0 0 1px var(--line-2);
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 3px; background: var(--line-2); }
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--bg-2);
}

.ctl select.sel { width: 100%; max-width: none; }

.ctl-toggle { padding-top: 10px; }
.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 32px; height: 18px;
  border-radius: 10px;
  background: var(--line-2);
  position: relative;
  transition: background .15s;
  flex: 0 0 auto;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg-2);
  transition: transform .15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch-label { font-size: 12.5px; color: var(--ink-2); }

.ctl-color input[type="color"] {
  width: 100%; height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}
.seed-row { display: flex; gap: 6px; }
.seed-row input[type="number"] {
  flex: 1 1 auto;
  font: inherit;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  min-width: 0;
}

/* ------------------------------------------------------------------- stage -- */
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  overflow-x: auto;
}
.tab {
  font: inherit;
  font-size: 13px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-3);
  padding: 10px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

.status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 2px;
  flex-wrap: wrap;
}
.stat-pill {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--ink-3);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
}
.stat-pill b { color: var(--ink); font-weight: 600; }
.stat-pill.ok b { color: var(--good); }
.stat-pill.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.stat-pill.warn b { color: var(--warn); }
.stat-note { font-size: 11px; color: var(--warn); }

.view { flex: 1 1 auto; overflow-y: auto; padding: 16px; min-height: 0; }

/* ---------------------------------------------------------------- swatches -- */
.strip {
  display: flex;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.strip-seg { flex: 1 1 0; }

.grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}
.swatch {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .12s, transform .12s;
}
.swatch:hover { border-color: var(--line-2); }
.swatch.is-locked { border-color: var(--accent); }

.chip {
  position: relative;
  display: block;
  width: 100%;
  height: 104px;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 10px;
  text-align: left;
}
.chip-idx {
  font-family: var(--mono);
  font-size: 11px;
  opacity: .62;
  display: block;
}
.chip-name {
  position: absolute;
  left: 10px; bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  opacity: .9;
}
.chip-lock { position: absolute; right: 10px; top: 8px; font-size: 11px; opacity: .8; }
.chip:hover .chip-idx { opacity: .95; }

.meta { padding: 8px 10px 10px; }
.meta-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.hex { font-size: 12.5px; letter-spacing: .01em; }
.meta-btns { display: flex; gap: 4px; }
.mini {
  font: inherit;
  font-size: 10.5px;
  color: var(--ink-3);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
}
.mini:hover { color: var(--ink); border-color: var(--line-2); }
.mini input[type="color"] {
  position: absolute; inset: 0;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}
.lch {
  display: flex;
  gap: 9px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.lch b { color: var(--ink-2); font-weight: 500; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.flag {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
}
.flag-lock { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.flag-clip { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.flag-near { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }

/* ---------------------------------------------------------------- analysis -- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stats-cvd { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
}
.stat-v { font-family: var(--mono); font-size: 22px; letter-spacing: -0.02em; }
.stat-l { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.stat-s { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.tone-good .stat-v { color: var(--good); }
.tone-warn .stat-v { color: var(--warn); }
.tone-bad .stat-v { color: var(--bad); }

.panels { display: grid; grid-template-columns: 1fr 320px; gap: 12px; }
@media (max-width: 1080px) { .panels { grid-template-columns: 1fr; } }
.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  min-width: 0;
}
.panels .panel { margin-bottom: 0; }
.panel h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  margin-bottom: 12px;
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}
.h-note { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink-3); opacity: .8; }
.hint { font-size: 12px; color: var(--ink-3); margin: -4px 0 10px; }

.plot { width: 100%; height: auto; display: block; }
.plot-sq { max-width: 320px; margin: 0 auto; }
.plot .ax { stroke: var(--line-2); stroke-width: 1; }
.plot .ring { fill: none; stroke: var(--line-2); stroke-width: 1; }
.plot .spoke { stroke-width: 1.5; opacity: .35; }
.plot .axt { fill: var(--ink-3); font-size: 10px; font-family: var(--mono); }
.plot .dot { stroke: var(--bg-2); stroke-width: 1.5; }
.plot .dotl { font-size: 9px; font-family: var(--mono); font-weight: 600; }

.matrix {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  gap: 2px;
  font-family: var(--mono);
  font-size: 9px;
}
.mcell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  color: rgba(255, 255, 255, .85);
  min-width: 0;
}
.mhead { background: var(--bg-3); }
.mdiag { background: var(--bg-3); opacity: .4; }
.mbad { outline: 1.5px solid var(--bad); outline-offset: -1.5px; color: #fff; font-weight: 700; }

.cvd-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.cvd-label { width: 120px; flex: 0 0 auto; font-size: 12px; color: var(--ink-2); }
.cvd-row .strip { flex: 1 1 auto; height: 26px; }

.ctable { width: 100%; border-collapse: collapse; font-size: 12px; }
.ctable th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 500;
  padding: 0 8px 6px;
}
.ctable td { padding: 4px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.ctable td:first-child { display: flex; align-items: center; gap: 7px; }
.dotc { width: 13px; height: 13px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.cell-l, .cell-d { border-radius: 4px; padding: 4px 9px; font-weight: 600; white-space: nowrap; }
.cbadge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
}
.cbadge.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.cbadge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.cbadge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }

/* -------------------------------------------------------------------- demo -- */
.pills { display: flex; flex-wrap: wrap; gap: 7px; }
.pill {
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 600;
}
.tcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 9px; }
.tcard {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid;
  border-radius: 8px;
  padding: 9px 11px;
}
.tdot { width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto; }
.tbody { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.tbody b { font-size: 12.5px; }
.tbody span { font-family: var(--mono); font-size: 10.5px; color: #00000090; }

.trows { display: flex; flex-direction: column; gap: 5px; }
.trow { display: grid; grid-template-columns: 22px repeat(4, 1fr); gap: 7px; align-items: stretch; }
.trow-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  padding: 0 10px 2px;
}
.trow-head span + span { padding-left: 10px; }
.tsw { border-radius: 4px; }
.ton {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
}
.tt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcr {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  flex: 0 0 auto;
  opacity: .72;
}
.tcr.pass { opacity: .82; }
.tcr.fail { opacity: .58; }

/* ------------------------------------------------------------------ export -- */
.export-head { display: flex; gap: 7px; margin-bottom: 10px; flex-wrap: wrap; }
.export-text {
  width: 100%;
  height: 380px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.export-sm { height: 92px; margin-bottom: 10px; }
.export-text:focus { outline: 1px solid var(--accent); }

/* ------------------------------------------------------------------- toast -- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 14px);
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s, transform .16s;
  z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: absolute; z-index: 30; width: var(--rail-w); height: calc(100% - 52px); bottom: 0; }
  body.rail-closed .rail { display: none; }
  .tagline { display: none; }
}
