/* Sketchit — warm desk chrome, tonal elevation only, 3px radius constant */

:root {
  color-scheme: dark;

  --ground: #1a1815;
  --surface: #24211c;
  --surface-2: #2e2a23;
  --surface-3: #383329;
  --ink: #e8e2d4;
  --ink-2: #9b9484;
  --ink-3: #6e675a;
  --rule: #3a352c;
  --rule-2: #4a4438;
  --accent: #d96c2b;
  --accent-ink: #1a1815;
  --accent-soft: rgba(217, 108, 43, 0.22);
  --danger: #c4483a;
  --danger-soft: rgba(196, 72, 58, 0.18);
  --onion-prev: #d9503f;
  --onion-next: #4fae8f;
  --gen: #7a93a8;
  --gen-soft: rgba(122, 147, 168, 0.16);
  --fixed: #5b8ab5;

  --radius: 3px;
  --topbar-h: 46px;
  --rail-w: 48px;
  --inspector-w: 208px;
  --deck-h: 168px;
  --status-h: 26px;

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --intra: 6px;
  --component: 10px;
  --inter: 14px;
}

* { box-sizing: border-box; }

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

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  caret-color: var(--accent);
}

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

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

button, input, select {
  font: inherit;
  color: inherit;
}

/* the UA [hidden] rule does not apply to SVG elements */
svg[hidden] { display: none; }

#app {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr var(--deck-h) var(--status-h);
  height: 100vh;
  min-width: 860px;
}

/* ── Top bar ─────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: var(--component);
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-right: 6px;
}

.brand-mark {
  width: 11px;
  height: 11px;
  background: var(--accent);
  border-radius: 1px;
  align-self: center;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.brand-name {
  font-weight: 640;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-spacer { flex: 1; }

/* ── Buttons ─────────────────────────────────────────── */

.btn {
  appearance: none;
  border: 1px solid var(--rule-2);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 90ms ease-out, transform 90ms ease-out;
  white-space: nowrap;
}

.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) {
  transform: scale(0.97);
  background: var(--ground);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-icon {
  padding: 5px 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-wide { width: 100%; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  letter-spacing: 0.01em;
  padding: 6px 14px;
}

.btn-primary:hover:not(:disabled) { background: #e67a36; border-color: #e67a36; }
.btn-primary:active:not(:disabled) { background: #c45f22; transform: scale(0.97); }
.btn-primary:disabled {
  background: var(--surface-2);
  border-color: var(--rule-2);
  color: var(--ink-3);
  opacity: 1;
}

.btn-primary.is-busy {
  background: var(--surface-3);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  color: #e8a49b;
  border-color: rgba(196, 72, 58, 0.45);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-soft);
  color: #f0b7ae;
}

.btn-danger:active:not(:disabled) { background: rgba(196, 72, 58, 0.3); }

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 4px;
}

/* ── Main layout ─────────────────────────────────────── */

.main {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr var(--inspector-w);
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  background: var(--ground);
}

/* ── Left tool rail ──────────────────────────────────── */

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--intra);
  padding: 10px 0;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-2) transparent;
}

.rail-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.rail-stack { padding: 0 6px; }

.rail-sep {
  width: 22px;
  height: 1px;
  background: var(--rule);
  margin: 4px 0;
}

.rail-spacer { flex: 1; }

.tool {
  appearance: none;
  width: 34px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 90ms ease-out, color 90ms ease-out, transform 90ms ease-out;
}

.tool:hover { background: var(--surface-2); color: var(--ink); }
.tool:active { transform: scale(0.94); background: var(--ground); }

.tool.is-active {
  background: var(--surface-3);
  border-color: var(--accent);
  color: var(--accent);
}

.tool-danger { color: var(--ink-3); }
.tool-danger:hover { color: #e8a49b; background: var(--danger-soft); }

.tool-play {
  width: 40px;
  background: var(--surface-2);
  border-color: var(--rule-2);
  color: var(--ink);
}

.tool-play.is-playing {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.tips {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
}
.tip { width: 18px; height: 18px; }
.tip svg { width: 12px; height: 12px; }

.size-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 18px;
  height: 74px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Colour chip + in-page picker ────────────────────── */

.ink-group { position: relative; }

.color-chip {
  appearance: none;
  width: 30px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--chip, #2a2620);
  cursor: pointer;
}
.color-chip:hover { border-color: var(--ink-3); }
.color-chip[aria-expanded="true"] { border-color: var(--accent); }

.color-pop {
  position: fixed;
  z-index: 60;
  width: 176px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
}
.color-pop[hidden] { display: none; }

.sv {
  position: relative;
  height: 104px;
  border-radius: 2px;
  border: 1px solid var(--rule-2);
  cursor: crosshair;
  touch-action: none;
  background: #f00;
}
.sv-white, .sv-black {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  pointer-events: none;
}
.sv-white { background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0)); }
.sv-black { background: linear-gradient(to top, #000, rgba(0, 0, 0, 0)); }

.sv-dot, .hue-dot {
  position: absolute;
  border: 2px solid #faf6ee;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.sv-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.hue {
  position: relative;
  height: 14px;
  margin-top: 8px;
  border-radius: 2px;
  border: 1px solid var(--rule-2);
  cursor: pointer;
  touch-action: none;
  background: linear-gradient(90deg, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}
.hue-dot {
  width: 10px;
  height: 18px;
  top: 50%;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.pop-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.hex-input {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  color: var(--ink);
}
.hex-input:focus { outline: 1px solid var(--accent); outline-offset: -1px; }

.swatches {
  display: grid;
  grid-template-columns: repeat(2, 12px);
  gap: 3px;
  justify-content: center;
}

.swatch {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 1px;
  padding: 0;
  cursor: pointer;
  transition: transform 90ms ease-out;
}

.swatch:hover { transform: scale(1.18); }
.swatch:active { transform: scale(0.92); }
.swatch.is-active { outline: 1px solid var(--accent); outline-offset: 1px; }

/* ── Stage ───────────────────────────────────────────── */

.stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 10px 16px 8px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(217, 108, 43, 0.045), transparent 70%),
    var(--ground);
}

.stage-scroll {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  overflow: auto;
  width: 100%;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-2) transparent;
}

.stage {
  position: relative;
  line-height: 0;
  width: fit-content;
  margin: auto;
  flex: none;
  border: 1px solid var(--rule-2);
  background: #faf6ee;
}

.stage canvas {
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.stage canvas[data-tool="move"] { cursor: grab; }
.stage canvas[data-tool="move"]:active { cursor: grabbing; }
.stage canvas[data-tool="eraser"] { cursor: cell; }
.stage canvas[data-tool="fill"] { cursor: crosshair; }
.stage canvas[data-tool="eyedropper"] { cursor: crosshair; }
.stage canvas[data-tool="line"],
.stage canvas[data-tool="rect"],
.stage canvas[data-tool="ellipse"] { cursor: crosshair; }

.pegbar {
  position: absolute;
  top: -7px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 96px;
  pointer-events: none;
}

.pegbar span {
  width: 22px;
  height: 7px;
  background: var(--surface-2);
  border: 1px solid var(--rule-2);
  border-bottom: none;
  border-radius: 2px 2px 0 0;
}

.pegbar span:nth-child(2) {
  width: 10px;
}

.stage-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
  text-align: center;
  padding: 20px;
}

.stage-hint[hidden] { display: none; }

.stage-hint-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: rgba(42, 38, 32, 0.42);
  letter-spacing: 0.01em;
}

.stage-hint-sub {
  margin: 0;
  font-size: 12px;
  color: rgba(42, 38, 32, 0.32);
}

.stage-hint kbd, .help-body kbd, .keys-list kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: rgba(42, 38, 32, 0.1);
  border: 1px solid rgba(42, 38, 32, 0.22);
  border-radius: 2px;
  padding: 0 4px;
}

.keys-list kbd {
  background: var(--surface-2);
  border-color: var(--rule-2);
  color: var(--ink-2);
}

.stage-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-3);
  flex: none;
  min-height: 24px;
}

.stage-meta .dot { opacity: 0.5; }

.meta-spacer { flex: 1; }

.zoom-cluster {
  display: flex;
  align-items: center;
  gap: 3px;
}

.meta-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--radius);
  padding: 3px 7px;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 90ms ease-out, color 90ms ease-out, transform 90ms ease-out;
}

.meta-btn:hover { background: var(--surface-2); color: var(--ink); }
.meta-btn:active { transform: scale(0.94); background: var(--surface); }

.meta-zoom {
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border-color: var(--rule);
  background: var(--surface);
}

.meta-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.meta-sep {
  width: 1px;
  height: 14px;
  background: var(--rule);
  margin: 0 4px;
}

.meta-hint {
  margin-left: 6px;
  font-size: 10.5px;
  color: var(--ink-3);
  opacity: 0.85;
  white-space: nowrap;
}

.meta-hint kbd {
  font-family: var(--font-mono);
  font-size: 0.95em;
  background: var(--surface-2);
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  padding: 0 3px;
}

/* ── Inspector ───────────────────────────────────────── */

.inspector {
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--rule);
  padding: 0 0 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-2) transparent;
}

.panel {
  padding: 12px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: var(--component);
}

.panel-quiet { border-bottom: none; }

.panel-title {
  margin: 0;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.micro-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.field { display: flex; flex-direction: column; gap: 5px; }

.field-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px;
  align-items: center;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.num-input {
  width: 52px;
  background: var(--ground);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  padding: 4px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.num-narrow { width: 58px; }

.num-input:hover { border-color: var(--rule-2); }
.num-input:focus-visible { border-color: var(--accent); }

input[type="range"] {
  accent-color: var(--accent);
  cursor: pointer;
  width: 100%;
}

select {
  background: var(--ground);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  padding: 5px 6px;
  font-size: 12px;
  cursor: pointer;
  width: 100%;
}

select:hover { background: var(--surface-2); }

.hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-3);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-track {
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: var(--ground);
  border: 1px solid var(--rule-2);
  position: relative;
  transition: background 120ms ease-out, border-color 120ms ease-out;
  flex: none;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: transform 120ms ease-out, background 120ms ease-out;
}

.switch input:checked + .switch-track {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(12px);
  background: var(--accent);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch-text {
  font-size: 11px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.switch-text i { font-style: normal; }

.onion-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.onion-prev { background: var(--onion-prev); }
.onion-next { background: var(--onion-next); }

.tally {
  margin: 4px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}

.tally > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px dotted var(--rule);
  padding-bottom: 2px;
}

.tally dt {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.tally dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.keys-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-3);
}

.keys-list li {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

/* ── Deck: transport + exposure sheet ────────────────── */

.deck {
  display: grid;
  grid-template-rows: 38px 1fr;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  min-height: 0;
}

.transport {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  border-bottom: 1px solid var(--rule);
}

.transport .tool { width: 28px; height: 26px; }

.loop-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  user-select: none;
}

.loop-toggle input {
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
  cursor: pointer;
}

.scrubber {
  flex: 1;
  margin: 0 10px;
  height: 18px;
}

.transport-num {
  font-size: 11px;
  color: var(--ink-2);
  min-width: 64px;
  text-align: right;
}

/* ── Exposure sheet (signature) ──────────────────────── */

.xsheet {
  display: grid;
  grid-template-columns: 34px 1fr;
  min-height: 0;
}

.xsheet-gutter {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8px;
  border-right: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-3);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.14em;
}

.xsheet-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-2) transparent;
}

.xsheet-strip {
  display: flex;
  gap: 3px;
  padding: 6px 10px 8px;
  width: max-content;
  min-width: 100%;
}

.cell {
  position: relative;
  width: 58px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  border-radius: var(--radius);
  transition: transform 90ms ease-out;
}

.cell:active { transform: scale(0.96); }

.cell-tab {
  height: 5px;
  border-radius: 1px;
  background: var(--gen);
  opacity: 0.85;
}

.cell[data-kind="key"] .cell-tab {
  background: var(--accent);
  opacity: 1;
}

.cell[data-kind="fixed"] .cell-tab {
  background: var(--fixed);
  opacity: 1;
}

.cell[data-kind="generated"] .cell-tab {
  background: repeating-linear-gradient(
    90deg,
    var(--gen) 0 4px,
    transparent 4px 7px
  );
}

.cell-thumb {
  height: 48px;
  border: 1px solid var(--rule);
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  line-height: 0;
}

.cell[data-kind="key"] .cell-thumb { border-color: rgba(217, 108, 43, 0.55); }
.cell[data-kind="fixed"] .cell-thumb { border-color: rgba(91, 138, 181, 0.6); }
.cell[data-kind="generated"] .cell-thumb { border-color: var(--rule); }

.cell-thumb canvas {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.92;
}

.cell.is-selected .cell-thumb {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

.cell-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.cell-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.cell.is-selected .cell-num { color: var(--accent); }

.cell-kind {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.cell[data-kind="key"] .cell-kind { color: var(--accent); }
.cell[data-kind="fixed"] .cell-kind { color: var(--fixed); }
.cell[data-kind="generated"] .cell-kind { color: var(--gen); }

.cell:hover .cell-thumb { border-color: var(--ink-3); }

.playhead {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--accent);
  pointer-events: none;
  left: 0;
  transform: translateX(10px);
  z-index: 2;
}

.playhead::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -3px;
  width: 8px;
  height: 4px;
  background: var(--accent);
  border-radius: 1px;
}

/* ── Status bar ──────────────────────────────────────── */

.statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--ground);
  border-top: 1px solid var(--rule);
  font-size: 11.5px;
  color: var(--ink-2);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}

.statusbar.is-accent .status-dot { background: var(--accent); }
.statusbar.is-accent { color: var(--ink); }
.statusbar.is-warn .status-dot { background: var(--danger); }
.statusbar.is-warn { color: #e8a49b; }

/* ── Help dialog ─────────────────────────────────────── */

.help-dialog {
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  max-width: 480px;
  width: calc(100vw - 48px);
  box-shadow: none;
}

.help-dialog::backdrop { background: rgba(12, 10, 8, 0.72); }

.help-card { margin: 0; }

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
}

.help-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.help-body {
  padding: 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
}

.help-body h3 {
  margin: 14px 0 4px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.help-body p { margin: 4px 0; }
.help-body b { color: var(--ink); font-weight: 600; }

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

.help-steps li { margin-bottom: 4px; }

.help-body ul {
  margin: 4px 0;
  padding-left: 18px;
}

.help-body li { margin-bottom: 3px; }

/* ── Scrollbars ──────────────────────────────────────── */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--rule-2);
  border-radius: 4px;
  border: 2px solid var(--surface);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ── Narrow fallback ─────────────────────────────────── */

@media (max-width: 1080px) {
  :root { --inspector-w: 184px; }
  .brand-sub { display: none; }
}
