:root {
  --bg: #0b0e12;
  --bg-soft: #11161d;
  --panel: #141b23;
  --panel-raised: #19222c;
  --line: #25313d;
  --line-bright: #3a4a5c;
  --text: #e8eef5;
  --muted: #8996a5;
  --accent: #ff5d73;
  --accent-soft: rgba(255, 93, 115, 0.14);
  --accent-2: #48d1b6;
  --accent-3: #ffd166;
  --radius: 4px;
  --shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
  --mono: "SFMono-Regular", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-3);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 9px 15px;
  background: var(--accent);
  color: #15090c;
  border: 1px solid #000;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  transform: translateY(calc(-100% - 20px));
  transition: transform 0.15s;
}

.skip-link:focus {
  transform: translateY(0);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 82% -10%, rgba(72, 209, 182, 0.1), transparent 42%),
    radial-gradient(circle at 8% 6%, rgba(255, 93, 115, 0.09), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.035;
  background: repeating-linear-gradient(
    to bottom,
    #fff 0,
    #fff 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

code,
pre {
  font-family: var(--mono);
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px clamp(20px, 4vw, 48px) 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 27, 35, 0.9), rgba(11, 14, 18, 0.65));
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.16em;
  line-height: 1.15;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 11px);
  gap: 3px;
  padding: 7px;
  border: 1px solid var(--line-bright);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.brand-mark i {
  width: 11px;
  height: 11px;
  background: var(--accent);
}

.brand-mark i:nth-child(2) {
  background: var(--accent-3);
}

.brand-mark i:nth-child(3) {
  background: var(--accent-2);
}

.brand-mark i:nth-child(4) {
  background: #4d7cff;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.badge {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 5px 9px;
  border: 1px solid var(--line-bright);
  color: var(--muted);
  background: var(--bg-soft);
}

.badge.ok {
  color: var(--accent-2);
  border-color: rgba(72, 209, 182, 0.5);
}

.badge.error {
  color: var(--accent);
  border-color: rgba(255, 93, 115, 0.5);
}

.ghost-link {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.ghost-link:hover {
  color: var(--text);
}

/* ---------- intro ---------- */

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  max-width: 1440px;
  margin: 0 auto;
  padding: 34px clamp(16px, 4vw, 40px) 0;
}

.eyebrow {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.28em;
  color: var(--accent-3);
}

.intro-copy h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3.4vw, 38px);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.intro-copy > p:last-child {
  margin: 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 13px;
}

.intro-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
  min-width: min(100%, 460px);
}

.intro-points li {
  display: grid;
  gap: 1px;
  padding: 10px 13px;
  background: var(--panel);
}

.intro-points b {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent-2);
  font-weight: 500;
}

.intro-points span {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 344px minmax(0, 1fr);
  gap: 22px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 40px) 10px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.controls {
  padding: 8px 18px 20px;
}

.control-section {
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
  display: grid;
  gap: 10px;
}

.control-section h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.control-section h2 span {
  color: var(--accent);
  border: 1px solid rgba(255, 93, 115, 0.35);
  padding: 1px 5px;
  font-size: 10px;
}

/* ---------- inputs ---------- */

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 10px;
  border: 1px dashed var(--line-bright);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%) 0 0 / 12px 12px,
    var(--bg-soft);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s;
  overflow: hidden;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background-color: var(--accent-soft);
}

.dropzone-inner {
  display: grid;
  gap: 2px;
}

.dropzone-inner strong {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.05em;
}

.dropzone-inner span {
  color: var(--muted);
  font-size: 11.5px;
}

.dropzone.has-image {
  min-height: 140px;
  border-style: solid;
}

.dropzone.has-image .dropzone-inner {
  position: absolute;
  inset: auto 0 0;
  padding: 18px 6px 5px;
  background: linear-gradient(180deg, transparent, rgba(11, 14, 18, 0.9));
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.15s;
}

.dropzone.has-image:hover .dropzone-inner {
  opacity: 1;
}

#sourceThumb {
  max-width: 100%;
  max-height: 170px;
  image-rendering: pixelated;
  display: block;
}

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

.row .secondary {
  flex: none;
  white-space: nowrap;
}

.file-meta {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.field > span {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.field b {
  color: var(--accent-3);
  font-family: var(--mono);
  font-weight: 500;
}

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

input[type="number"],
select {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12.5px;
  outline: none;
}

input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
  text-overflow: ellipsis;
}

input[type="range"] {
  width: 100%;
  appearance: none;
  height: 6px;
  border-radius: 0;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-3) 100%);
  outline: none;
  cursor: pointer;
  border: 1px solid #000;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 20px;
  background: var(--text);
  border: 2px solid #000;
  cursor: ew-resize;
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 18px;
  border-radius: 0;
  background: var(--text);
  border: 2px solid #000;
  cursor: ew-resize;
}

input[type="range"]:disabled {
  filter: grayscale(1) brightness(0.55);
  cursor: not-allowed;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line-bright);
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius);
}

.icon-btn[aria-pressed="true"] {
  color: var(--accent-2);
  border-color: rgba(72, 209, 182, 0.55);
}

.lock-icon {
  width: 12px;
  height: 10px;
  border: 2px solid currentColor;
  position: relative;
  margin-top: 4px;
}

.lock-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -7px;
  width: 6px;
  height: 6px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.icon-btn[aria-pressed="false"] .lock-icon::before {
  transform: rotate(24deg) translate(2px, -1px);
  transform-origin: bottom left;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}

.switch-row input {
  appearance: none;
  width: 34px;
  height: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--line-bright);
  position: relative;
  cursor: pointer;
  flex: none;
}

.switch-row input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--muted);
  transition: transform 0.15s, background-color 0.15s;
}

.switch-row input:checked {
  border-color: var(--accent-2);
}

.switch-row input:checked::after {
  transform: translateX(16px);
  background: var(--accent-2);
}

.preset-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
}

.preset-row button {
  height: 25px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  cursor: pointer;
}

.preset-row button:hover {
  color: var(--text);
  border-color: var(--line-bright);
}

.preset-row button.active {
  color: #0b0e12;
  background: var(--accent-3);
  border-color: var(--accent-3);
}

.style-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.style-presets button {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  text-align: left;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.style-presets button b {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.style-presets button small {
  color: var(--muted);
  font-size: 10px;
}

.style-presets button:hover {
  border-color: var(--line-bright);
  background: var(--panel-raised);
}

.style-presets button.active {
  border-color: var(--accent-3);
  background: rgba(255, 209, 102, 0.1);
}

.style-presets button.active b {
  color: var(--accent-3);
}

.range-field > span {
  display: flex;
  justify-content: space-between;
}

.hint {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

/* ---------- buttons ---------- */

.primary,
.secondary {
  font-family: var(--mono);
  cursor: pointer;
  border-radius: var(--radius);
  transition: transform 0.1s, box-shadow 0.1s, background-color 0.15s;
}

.primary {
  width: 100%;
  margin-top: 18px;
  height: 42px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #15090c;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  box-shadow: 4px 4px 0 #000;
}

.primary:hover:not(:disabled) {
  background: #ff7b8c;
}

.primary:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 #000;
}

.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary {
  height: 30px;
  padding: 0 11px;
  font-size: 11px;
  color: var(--text);
  background: var(--panel-raised);
  border: 1px solid var(--line-bright);
}

.secondary:hover:not(:disabled) {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.primary.busy {
  color: transparent;
  position: relative;
  pointer-events: none;
}

.primary.busy::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 3px solid rgba(0, 0, 0, 0.3);
  border-top-color: #000;
  animation: spin 0.7s steps(8) infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status {
  min-height: 18px;
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.status.error {
  color: var(--accent);
}

.status.success {
  color: var(--accent-2);
}

/* ---------- action dock ---------- */

.action-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  border-top: 1px solid var(--line-bright);
  background: rgba(11, 14, 18, 0.93);
  backdrop-filter: blur(12px);
  box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.45);
  padding: 10px clamp(16px, 4vw, 40px) calc(10px + env(safe-area-inset-bottom));
}

.action-dock-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.action-dock .status {
  min-height: 0;
  margin: 0;
  max-width: 72ch;
  font-size: 11.5px;
}

.action-dock .primary {
  width: auto;
  min-width: 248px;
  height: 46px;
  margin: 0;
  padding: 0 28px;
  flex: none;
  font-size: 14px;
  letter-spacing: 0.14em;
  box-shadow: 4px 4px 0 #000, 0 0 0 1px rgba(255, 93, 115, 0.28);
}

/* ---------- stage ---------- */

.stage {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tabs {
  display: flex;
  gap: 2px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 3px;
}

.tab {
  border: 0;
  padding: 7px 13px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tab:disabled:hover {
  color: var(--muted);
}

.tab.active {
  background: var(--panel-raised);
  color: var(--accent-3);
  box-shadow: inset 0 -2px 0 var(--accent-3);
}

.stage-actions {
  display: flex;
  gap: 8px;
}

.canvas-area {
  position: relative;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stale-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  padding: 6px 10px;
  color: #15090c;
  background: var(--accent-3);
  border: 1px solid #000;
  border-radius: var(--radius);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.stale-badge:hover {
  background: #ffe08f;
}

.stage-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(11, 14, 18, 0.72);
  backdrop-filter: blur(3px);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s steps(8) infinite;
}

.checkerboard {
  display: grid;
  place-items: center;
  min-height: clamp(280px, 52vh, 620px);
  max-height: 68vh;
  padding: 16px;
  background-color: #1a2028;
  background-image:
    linear-gradient(45deg, #202833 25%, transparent 25%),
    linear-gradient(-45deg, #202833 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #202833 75%),
    linear-gradient(-45deg, transparent 75%, #202833 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  overflow: auto;
}

#previewImage {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.55));
  background-color: transparent;
}

.placeholder {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.placeholder strong {
  color: var(--text);
  font-family: var(--mono);
  letter-spacing: 0.08em;
  font-size: 12px;
}

.placeholder-pixels {
  display: grid;
  grid-template-columns: repeat(3, 12px);
  gap: 3px;
  margin-bottom: 6px;
}

.placeholder-pixels i {
  width: 12px;
  height: 12px;
  background: #2a3644;
  animation: pulse 1.8s infinite steps(2);
}

.placeholder-pixels i:nth-child(2n) {
  animation-delay: 0.3s;
}

.placeholder-pixels i:nth-child(3n) {
  background: #35465a;
  animation-delay: 0.6s;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

.readouts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.readout {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 9px 12px;
  display: grid;
  gap: 1px;
}

.readout span {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.readout b {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--accent-2);
}

.palette-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 13px 15px 15px;
}

.palette-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.palette-panel h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.palette-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#paletteCount {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent-3);
}

.copy-btn {
  height: 26px;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text);
  background: var(--panel-raised);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  cursor: pointer;
}

.copy-btn:hover:not(:disabled) {
  color: var(--accent-2);
  border-color: var(--accent-2);
}

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

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.7);
  background-image:
    linear-gradient(45deg, #444 25%, transparent 25%),
    linear-gradient(-45deg, #444 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #444 75%),
    linear-gradient(-45deg, transparent 75%, #444 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  cursor: copy;
}

.swatch:hover {
  z-index: 1;
  box-shadow: 0 0 0 2px var(--accent-3);
}

.swatch.copied {
  box-shadow: 0 0 0 2px var(--accent-2);
}

.swatch i {
  position: absolute;
  inset: 0;
  display: block;
}

.swatch-empty {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

/* ---------- docs ---------- */

.docs {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 30px;
  max-width: 1440px;
  margin: 34px auto 0;
  padding: 26px clamp(16px, 4vw, 40px) 34px;
  border-top: 1px solid var(--line);
}

.docs h2 {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-3);
  margin: 0 0 10px;
}

.tips,
.faq {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
  counter-reset: tip;
}

.tips li,
.faq li {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 9px 12px;
  background: var(--panel);
  font-size: 11.5px;
}

.tips li {
  counter-increment: tip;
}

.tips li b::before {
  content: counter(tip, decimal-leading-zero) " ";
  color: var(--accent);
  font-family: var(--mono);
  margin-right: 4px;
}

.tips li b,
.faq li b {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-2);
  font-weight: 500;
}

.tips li span,
.faq li span {
  color: var(--muted);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding: 16px clamp(16px, 4vw, 40px) 24px;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
}

/* ---------- responsive ---------- */

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .docs {
    grid-template-columns: 1fr;
  }

  .readouts {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 620px) {
  body {
    padding-bottom: calc(132px + env(safe-area-inset-bottom));
  }

  .topbar {
    padding: 14px 16px;
    gap: 10px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .brand p {
    display: none;
  }

  .stage-head {
    align-items: stretch;
  }

  .stage-actions {
    justify-content: flex-end;
  }

  .checkerboard {
    min-height: 240px;
    padding: 8px;
  }

  .preset-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .intro {
    padding-top: 24px;
  }

  .intro-points {
    min-width: 100%;
  }

  .tips li,
  .faq li {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .action-dock-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .action-dock .status {
    text-align: center;
    font-size: 10.5px;
  }

  .action-dock .primary {
    width: 100%;
    min-width: 0;
  }
}
