/* ============================================================
   Block Blast Solver — global design system
   Dashboard, not a landing page. All colours live here.
   ============================================================ */
:root {
  --bg: #0E1116;
  --surface: #161B22;
  --text: #E8EDF3;
  --muted: #8B97A6;
  --primary: #3DDC97;
  --accent: #FFB020;
  --line: rgb(232 237 243 / .10);
  --grid-line: rgb(232 237 243 / .06);
  --radius: 12px;
  --piece-1: var(--primary);
  --piece-2: var(--accent);
  --piece-3: var(--text);
  --shadow: 0 18px 40px -24px rgb(0 0 0 / .9);
  --font-head: 'Space Grotesk', Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
}
h1 { font-size: clamp(40px, 5vw, 56px); }
h2 { font-size: 28px; }
h3 { font-size: 20px; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 160ms ease, transform 160ms ease;
}
a:hover { color: var(--text); }

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

.num, .pill, .stat, .step-num, .move-badge, .piece-label, .sample-count {
  font-variant-numeric: tabular-nums;
}

.muted { color: var(--muted); }
.eyebrow {
  font: 600 13px/1.2 var(--font-body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgb(255 176 32 / .12);
  border: 1px solid rgb(255 176 32 / .3);
  color: var(--accent);
  font: 600 12px/1.2 var(--font-body);
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---------- layout ---------- */
.wrap {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}
.section { padding: 40px 0; }
.grid-divider {
  height: 30px;
  margin: 8px 0;
  background:
    repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px calc(100% / 8)),
    repeating-linear-gradient(0deg, var(--grid-line) 0 1px, transparent 1px calc(100% / 8));
  border-block: 1px solid var(--line);
}

/* ---------- header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgb(14 17 22 / .92);
  backdrop-filter: none;
  border-bottom: 1px solid var(--line);
}
.head-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 56px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font: 700 17px/1 var(--font-head);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand .brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgb(61 220 151 / .5);
  background:
    linear-gradient(90deg, transparent 31%, var(--primary) 31% 36%, transparent 36%),
    linear-gradient(0deg, transparent 56%, var(--primary) 56% 62%, transparent 62%),
    rgb(61 220 151 / .1);
}
.brand span { color: var(--primary); }
.head-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}
.head-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
}
.head-nav a:hover { color: var(--text); background: rgb(232 237 243 / .04); }
.head-open {
  margin-left: 6px;
  border: 1px solid var(--line);
  color: var(--text) !important;
}
.head-open:hover { border-color: var(--primary); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: 600 15px/1 var(--font-body);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--primary);
  color: #0E1116;
  box-shadow: 0 10px 30px -16px rgb(61 220 151 / .7);
}
.btn-primary:hover { background: #59E3A8; color: #0E1116; }
.btn-ghost {
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 0 12px; font-size: 13px; }
.btn-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: 600 13px/1 var(--font-body);
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover { color: var(--text); }

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

/* ---------- cards / pills ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 20px; margin-right: auto; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font: 600 12px/1 var(--font-body);
  white-space: nowrap;
}
.pill.live { color: var(--primary); border-color: rgb(61 220 151 / .3); background: rgb(61 220 151 / .08); }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 45fr 55fr;
  gap: 40px;
  align-items: start;
  padding: 44px 0 36px;
}
/* Desktop swap: upload card moves to the left column. DOM order stays
   copy → upload so the mobile stack still starts with the H1. */
.hero .upload-card { order: -1; }
.hero-copy { padding-top: 8px; }
.hero h1 { margin-bottom: 12px; }
.lede {
  font-size: 20px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 34em;
}
.hero-points {
  display: grid;
  gap: 8px;
  margin: 20px 0 22px;
  padding: 0;
  list-style: none;
}
.hero-points li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 15px;
  color: var(--muted);
}
.hero-points li::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 9px;
  border-radius: 2px;
  background: var(--primary);
}
.hero-points strong { color: var(--text); font-weight: 600; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hero-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.hero-hint:hover { color: var(--text); }
.hero-guides {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.hero-guides:hover { color: var(--text); }

/* ---------- upload card ---------- */
.upload-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.dropzone {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1.5px dashed rgb(232 237 243 / .18);
  border-radius: 10px;
  background: rgb(14 17 22 / .5);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: rgb(61 220 151 / .05); }
.dropzone.loaded { border-style: solid; border-color: rgb(61 220 151 / .35); }
.dz-top { display: grid; gap: 2px; min-width: 0; }
.dz-kicker { font: 600 12px/1.2 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
#dzTitle { font: 600 17px/1.3 var(--font-head); color: var(--text); }
#dzSub { font-size: 13px; color: var(--muted); }
#fileInput { display: none; }

.sample-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 2px 8px;
  font-size: 13px;
  color: var(--muted);
}
.sample-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.sample-thumb {
  position: relative;
  display: block;
  padding: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
}
.sample-thumb:hover { border-color: var(--primary); transform: translateY(-1px); }
.sample-thumb img {
  display: block;
  width: 100%;
  height: 62px;
  object-fit: cover;
  object-position: top center;
}
.sample-thumb::after {
  content: attr(data-label);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 5px;
  background: rgb(14 17 22 / .82);
  color: var(--text);
  font: 600 11px/1.4 var(--font-body);
  text-align: left;
}

.preview-panel {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.preview-panel.has-image { display: block; }
#previewCanvas {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
}
#previewText {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.parse-fail {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgb(255 176 32 / .35);
  background: rgb(255 176 32 / .07);
  font-size: 13px;
  line-height: 1.5;
  color: #FFD48A;
}
.parse-fail[hidden] { display: none; }
.parse-fail strong { color: var(--accent); }

/* ---------- workspace ---------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
  padding: 24px 0 8px;
  scroll-margin-top: 70px;
}
.board-card { overflow: hidden; }
.board-shell { padding: 16px; }
.board-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 4px;
  width: 100%;
  height: 100%;
  padding: 8px;
  touch-action: none;
  border-radius: 14px;
}
.cell {
  display: block;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.cell:hover { border-color: rgb(61 220 151 / .45); }
.cell.filled {
  background: var(--c);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), inset 0 -3px 0 rgb(0 0 0 / .22);
}
.cell.hint { border-color: var(--pc); box-shadow: 0 0 0 2px var(--pc), 0 0 14px -4px var(--pc); }
.cell:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.move-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 4px;
  padding: 8px;
  pointer-events: none;
  z-index: 4;
}
.ghost {
  border-radius: 6px;
  pointer-events: none;
  background: var(--pc, var(--primary));
  border: 1px solid rgb(255 255 255 / .55);
  opacity: .26;
  box-shadow: 0 0 18px -6px var(--pc, var(--primary)), inset 0 1px 0 rgb(255 255 255 / .35);
  animation: ghostIn .45s cubic-bezier(.22, .9, .3, 1) both;
}
.ghost-2 { opacity: .16; }
.ghost-3 { opacity: .11; }
@keyframes ghostIn { from { transform: scale(.82); opacity: 0; } to { transform: none; } }

.move-badge {
  place-self: center;
  display: grid;
  place-items: center;
  width: clamp(22px, 3.3vw, 32px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--pc, var(--primary));
  color: var(--bg);
  font: 700 14px/1 var(--font-head);
  box-shadow: 0 6px 16px -6px rgb(0 0 0 / .8), 0 0 0 2px rgb(14 17 22 / .8);
  animation: badgeIn .4s cubic-bezier(.22, .9, .3, 1) both;
}
@keyframes badgeIn {
  0% { transform: scale(.2); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.sandbox-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 16px 4px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgb(255 176 32 / .34);
  background: rgb(255 176 32 / .07);
  font-size: 13px;
  color: #FFD48A;
}
.sandbox-bar[hidden] { display: none; }
.sandbox-bar .tag { background: var(--accent); color: var(--bg); border-color: transparent; }
.sandbox-bar .spacer { margin-left: auto; }

.board-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.legend { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.empty { background: var(--surface); border: 1px solid var(--line); }
.legend i.full { background: var(--primary); }
.legend i.plan { background: rgb(61 220 151 / .22); border: 1px dashed var(--primary); }
.board-foot .push { margin-left: auto; }

/* ---------- pieces panel ---------- */
.panel-card { padding-bottom: 6px; }
#pieces { display: grid; gap: 10px; padding: 14px 16px; }
.piece-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.piece-label { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--font-body); color: var(--muted); }
.piece-label .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--pc); }
.piece-grid {
  display: grid;
  grid-template-columns: repeat(5, 18px);
  grid-template-rows: repeat(5, 18px);
  gap: 2px;
  justify-content: center;
}
.piece-cell {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  cursor: pointer;
  min-width: 0;
  min-height: 0;
  transition: background 160ms ease, border-color 160ms ease;
}
.piece-cell.on { background: var(--pc); border-color: transparent; }
.piece-cell:hover { border-color: var(--pc); }
.piece-tools { display: flex; gap: 4px; }
.mini-btn {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}
.mini-btn:hover { color: var(--text); border-color: var(--primary); }

.panel-actions { display: grid; gap: 10px; padding: 4px 16px 14px; }
.hint { font-size: 12px; line-height: 1.5; color: var(--muted); }
.panel-actions .btn-link { justify-self: start; }

/* ---------- result ---------- */
.result-wrap { padding: 8px 0 32px; }
.result-card { padding: 18px; }
.result-card[hidden] { display: none; }
.result-head { display: flex; align-items: flex-start; gap: 12px; }
.result-head h2 { margin-top: 4px; margin-right: auto; }
.result-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.stat {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgb(232 237 243 / .03);
  color: var(--muted);
  font: 600 12px/1 var(--font-body);
}
.stat.amber { color: var(--accent); border-color: rgb(255 176 32 / .28); }
.stat.rose { color: #FF9AA6; border-color: rgb(255 122 144 / .28); }
.steps { list-style: none; display: grid; gap: 8px; margin: 12px 0 0; }
.step {
  display: grid;
  grid-template-columns: 30px auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.step-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--bg);
  font: 700 13px/1 var(--font-head);
}
.step-main { font-size: 15px; line-height: 1.5; }
.step-main strong { color: var(--pc, var(--text)); font-weight: 600; }
.mini-shape {
  display: grid;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgb(232 237 243 / .02);
}
.mini-shape span { width: 6px; height: 6px; border-radius: 1px; }
.mini-shape span.on { background: var(--pc); }
.step-meta { display: flex; gap: 6px; margin-top: 4px; }
.step-chip-small {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font: 600 11px/1 var(--font-body);
}
.step-chip-small.clear { color: var(--primary); border-color: rgb(61 220 151 / .3); }
.result-note { margin-top: 12px; font-size: 13px; color: var(--muted); }
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.result-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.result-foot .push { margin-left: auto; }

/* ---------- home copy ---------- */
.home-copy { padding: 36px 0 48px; }
.home-copy .copy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 36px;
}
.prose p { margin-bottom: 14px; color: var(--muted); }
.prose p strong { color: var(--text); font-weight: 600; }
.prose h2 { margin-bottom: 12px; }
.link-list { display: grid; gap: 2px; }
.link-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  transition: background 160ms ease, color 160ms ease;
}
.link-row:hover { background: rgb(232 237 243 / .03); color: var(--primary); }
.link-row .idx {
  flex: none;
  width: 26px;
  color: var(--muted);
  font: 600 13px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
}
.link-row .txt { min-width: 0; }
.link-row .txt strong { display: block; font: 600 15px/1.3 var(--font-body); }
.link-row .txt small { display: block; font-size: 12px; color: var(--muted); }
.link-row .arrow { margin-left: auto; color: var(--muted); }

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding: 34px 0 40px;
  background: var(--bg);
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 32px;
}
.foot-brand { font: 700 20px/1.2 var(--font-head); }
.foot-brand span { color: var(--primary); }
.foot-note { margin-top: 10px; font-size: 13px; color: var(--muted); max-width: 30em; }
.foot-share { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.foot-col h3 { margin-bottom: 8px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.foot-col nav { display: grid; gap: 2px; }
.foot-col a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 14px; }
.foot-col a:hover { color: var(--text); }
.foot-base {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.foot-base .push { margin-left: auto; }
.foot-base a { color: var(--muted); }
.foot-base a:hover { color: var(--text); }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 90;
  max-width: min(460px, calc(100% - 24px));
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   Content pages
   ============================================================ */
.page-head { padding: 40px 0 24px; }
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs span { opacity: .5; }
.page-head h1 { max-width: 20em; }
.page-lede { margin-top: 14px; max-width: 46em; font-size: 19px; line-height: 1.55; color: var(--muted); }
.lede-back { margin-top: 12px; font-size: 14px; }
.lede-back a { text-decoration: underline; text-underline-offset: 3px; }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 44px;
  padding-bottom: 48px;
  align-items: start;
}
.article { min-width: 0; }
.article h2 { margin: 34px 0 12px; }
.article h3 { margin: 22px 0 8px; }
.article p { margin-bottom: 14px; color: var(--muted); }
.article p strong, .article li strong { color: var(--text); font-weight: 600; }
.article ul, .article ol { margin: 0 0 16px 20px; padding: 0; color: var(--muted); }
.article li { margin-bottom: 8px; }
.article a { text-decoration: underline; text-underline-offset: 3px; }
.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 20px;
  font-size: 14px;
}
.article th, .article td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  color: var(--muted);
}
.article th { color: var(--text); font-weight: 600; }

.toc {
  position: sticky;
  top: 76px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.toc h2 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.toc nav { display: grid; gap: 2px; }
.toc a { display: flex; align-items: center; min-height: 40px; padding: 0 8px; border-radius: 6px; color: var(--muted); font-size: 14px; }
.toc a:hover { color: var(--text); background: rgb(232 237 243 / .03); }

.faq { margin-top: 34px; padding-top: 8px; border-top: 1px solid var(--line); }
.faq h2 { margin-top: 24px; }
.faq-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.faq-item h3 { margin: 0 0 6px; font-size: 17px; }
.faq-item p { margin: 0; }

.related { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.related h2 { font-size: 20px; margin-bottom: 12px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.related-card {
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 160ms ease, transform 160ms ease;
}
.related-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.related-card small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.related-card strong { display: block; font: 600 15px/1.35 var(--font-body); }

.cta-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 36px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid rgb(61 220 151 / .24);
  background: rgb(61 220 151 / .06);
}
.cta-band .txt { min-width: 0; margin-right: auto; }
.cta-band strong { display: block; font: 600 17px/1.3 var(--font-head); }
.cta-band span { font-size: 13px; color: var(--muted); }

/* guides index */
.guides-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-bottom: 48px;
}
.guide-card {
  display: flex;
  flex-direction: column;
  min-height: 200px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 160ms ease, transform 160ms ease;
}
.guide-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.guide-card .kicker { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.guide-card h2 {
  font-size: 20px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.guide-card p {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.guide-card .more { margin-top: auto; padding-top: 12px; color: var(--primary); font: 600 13px/1 var(--font-body); }
.guides-scope { padding: 4px 0 40px; max-width: 60em; font-size: 14px; line-height: 1.6; color: var(--muted); }

/* legal */
.legal-body { padding: 8px 0 48px; }
.legal-body .prose { max-width: 760px; }
.legal-body h2 { margin: 28px 0 10px; font-size: 22px; }
.legal-body p, .legal-body li { color: var(--muted); }
.legal-body ul { margin-left: 20px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 320px; }
  .article-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 28px; }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; }
  .hero .upload-card { order: 0; }
  .hero-copy { padding-top: 0; }
  .workspace { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; }
  .toc { position: static; order: 2; }
  .home-copy .copy-grid { grid-template-columns: 1fr; gap: 24px; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
  .guides-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .head-nav { gap: 0; }
  .head-nav a { display: none; }
  .head-nav .head-open { display: inline-flex; }
  .hero { padding: 18px 0 22px; }
  .lede { font-size: 17px; }
  .hero-points { display: none; }
  .hero-cta { margin-top: 4px; }
  .upload-card { padding: 10px; }
  .dropzone { padding: 12px; gap: 8px; }
  #dzTitle { font-size: 15px; }
  .sample-thumb img { height: 54px; }
  .board-shell { padding: 10px; }
  .board { gap: 3px; padding: 6px; }
  .move-overlay { gap: 3px; padding: 6px; }
  .piece-grid { grid-template-columns: repeat(5, 16px); grid-template-rows: repeat(5, 16px); }
  .step { grid-template-columns: 26px minmax(0, 1fr); padding: 9px 10px; }
  .mini-shape { display: none; }
  .result-card { padding: 14px; }
  .related-grid { grid-template-columns: 1fr; }
  .guides-grid { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; gap: 22px; }
  .foot-base .push { margin-left: 0; }
  .hero-cta .btn { flex: 1 1 auto; }
}

@media (max-width: 420px) {
  .wrap { width: calc(100% - 24px); }
  h1 { font-size: 38px; }
  .head-inner { min-height: 52px; gap: 10px; }
  .brand { font-size: 15px; }
  .sample-head { margin-top: 10px; }
  #previewCanvas { max-height: 180px; }
}

@media (max-width: 640px) {
  h1 { font-size: 36px; line-height: 1.1; letter-spacing: -0.02em; }
  .lede { font-size: 16px; line-height: 1.5; margin-top: 10px; }

  /* Flatten the hero so the upload card can sit directly under the lede,
     with the three points moved below it. Desktop order is unchanged. */
  .hero { display: flex; flex-direction: column; gap: 12px; align-items: stretch; padding: 12px 0 16px; }
  .hero-copy { display: contents; }
  .hero-copy h1 { order: 1; }
  .hero .lede { order: 2; }
  .hero-cta { order: 3; margin-top: 2px; }
  .hero .upload-card { order: 4; }
  .hero-points {
    display: grid;
    order: 5;
    gap: 6px;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
  .hero-points li { font-size: 13px; line-height: 1.45; }

  .head-open { min-height: 32px; padding: 6px 10px; font-size: 12.5px; }
  .upload-card .btn-primary { min-height: 48px; }
  .upload-card { padding: 12px; }
}

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