/* 精品化层：保持既有交互不变，只重构作品的视觉焦点与信息节奏。 */
:root {
  --bg: #0b0907;
  --bg-elev: #15110d;
  --panel: #17130f;
  --border: #373026;
  --gold: #d2aa3a;
  --gold-dim: #927526;
  --sand: #eadbc2;
  --sand-dim: #b6a184;
  --turquoise: #3f9e98;
  --ink: #f1e7d7;
  --muted: #a8957c;
  --radius: 2px;
}

html {
  background: var(--bg);
}

button,
.hero-case,
.motif-card,
.adv-block,
.panel,
.canvas-frame,
.call-card {
  border-radius: 2px;
}

.hero-gate {
  max-width: 1320px;
  min-height: 100svh;
  grid-template-columns: minmax(520px, 1.12fr) minmax(430px, .88fr);
  gap: clamp(38px, 5vw, 76px);
  padding: clamp(34px, 5vw, 72px);
}

.hero-loom {
  position: relative;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(210,170,58,.08), transparent 42%),
    #0e0b08;
  border-color: rgba(210,170,58,.28);
  box-shadow:
    0 46px 110px rgba(0,0,0,.48),
    inset 0 0 0 1px rgba(255,240,210,.035);
}

.hero-loom::before,
.hero-loom::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.hero-loom::before {
  inset: 7px;
  border: 1px solid rgba(210,170,58,.16);
}

.hero-loom::after {
  left: 18px;
  right: 18px;
  bottom: 18px;
  height: 34%;
  background: linear-gradient(transparent, rgba(0,0,0,.42));
}

.hero-eyebrow {
  margin-bottom: 18px;
  color: #b99a57;
  letter-spacing: .22em;
}

.hero-copy h1 {
  margin-left: -.04em;
  color: #f1dfbd;
  font-size: clamp(2.65rem, 5.4vw, 4.2rem);
  line-height: 1.12;
  letter-spacing: .1em;
}

.hero-tag {
  max-width: 15em;
  margin-top: 26px;
  color: #e5cfaa;
  font-size: clamp(1.2rem, 2.2vw, 1.72rem);
  line-height: 1.7;
}

.hero-desc {
  margin-top: 13px;
  color: #ae9c83;
  line-height: 1.85;
}

.hero-wall {
  gap: 11px;
  margin: 26px 0 24px;
}

.hero-case {
  padding: 5px;
  border-color: rgba(210,170,58,.15);
  background: rgba(21,17,13,.72);
  box-shadow: none;
}

.hero-case:hover {
  border-color: rgba(210,170,58,.65);
  transform: translateY(-3px);
}

.hero-case span {
  margin-top: 8px;
  color: #c7b79f;
  letter-spacing: .05em;
}

.hero-cta {
  min-height: 54px;
  border-radius: 1px;
  background: #c9a02d;
  color: #160f05;
  box-shadow: 0 14px 34px rgba(201,160,45,.15);
}

.app {
  max-width: 1320px;
  padding-top: 24px;
}

.hero-compact {
  margin-bottom: 22px;
  padding: 10px 0 17px;
  border-bottom-color: rgba(210,170,58,.2);
}

.hero-compact h1 {
  color: #ead7b5;
  font-size: 1.25rem;
  letter-spacing: .16em;
}

.hero-compact .sub {
  color: #8d775d;
  letter-spacing: .28em;
}

.layout {
  grid-template-columns: 328px minmax(0, 1fr);
  gap: 24px;
}

.ctrl {
  position: sticky;
  top: 18px;
  max-height: calc(100svh - 36px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #5c4b32 transparent;
  background: rgba(20,16,12,.92);
  box-shadow: 0 22px 58px rgba(0,0,0,.18);
}

.panel {
  border-color: rgba(210,170,58,.18);
  padding: 20px;
}

.panel h2 {
  margin-bottom: 15px;
  padding-bottom: 9px;
  color: #c4a14c;
  font-size: .88rem;
  letter-spacing: .26em;
}

.motif-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 300px;
}

.motif-card {
  min-height: 70px;
  padding: 10px;
  background: #11100d;
  border-color: #302a22;
}

.motif-card strong {
  color: #dfc07a;
  font-size: .84rem;
}

.motif-card span {
  font-size: .68rem;
}

.motif-card.active {
  background: linear-gradient(135deg, rgba(210,170,58,.15), rgba(63,158,152,.06));
  border-color: #c9a43c;
}

.adv-block,
.aigc-honest {
  background: rgba(11,9,7,.45);
  border-color: rgba(210,170,58,.14);
}

.aigc-honest {
  padding: 14px;
}

.btn-row {
  gap: 7px;
}

button {
  border-radius: 2px;
  letter-spacing: .055em;
}

.btn-primary {
  background: #c9a02d;
  color: #171006;
}

.btn-ghost {
  background: #16120e;
}

.btn-accent {
  background: rgba(63,158,152,.14);
  border-color: rgba(63,158,152,.5);
}

.stage-wrap {
  gap: 13px;
}

.pattern-panel {
  border: 0;
  background: transparent;
  padding: 0;
  overflow: visible;
}

.canvas-frame {
  min-height: 704px;
  padding: 28px;
  border: 1px solid rgba(210,170,58,.24);
  background:
    radial-gradient(circle at 50% 45%, rgba(63,158,152,.08), transparent 38%),
    linear-gradient(135deg, rgba(210,170,58,.04), transparent 45%),
    #080706;
  box-shadow:
    0 34px 90px rgba(0,0,0,.36),
    inset 0 0 0 7px rgba(210,170,58,.025);
}

.canvas-frame::before {
  inset: 13px;
  background:
    linear-gradient(90deg, rgba(210,170,58,.1) 1px, transparent 1px),
    linear-gradient(rgba(210,170,58,.1) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: .22;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.canvas-frame::after {
  content: "LIVE CANVAS  /  PARAMETRIC TEXTILE";
  position: absolute;
  top: 17px;
  left: 25px;
  color: rgba(223,192,122,.48);
  font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .16em;
  pointer-events: none;
}

#patternCanvas {
  max-width: 760px;
  box-shadow: 0 0 0 1px rgba(210,170,58,.28), 0 28px 80px rgba(0,0,0,.55);
}

.overlay-toggles {
  padding: 12px 14px;
  border: 1px solid rgba(210,170,58,.16);
  border-top: 0;
  background: rgba(15,12,9,.88);
}

.ov-btn {
  min-height: 30px;
  border-radius: 1px;
}

.meta-bar {
  padding: 11px 14px;
  background: linear-gradient(90deg, rgba(210,170,58,.09), rgba(63,158,152,.06));
  border: 1px solid rgba(210,170,58,.16);
  color: #a99578;
}

.meta-bar strong {
  color: #e8cf9d;
}

.algo-panel {
  margin-top: 2px;
  background: rgba(20,16,12,.88);
}

.algo-head {
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(210,170,58,.12);
}

.algo-col {
  min-height: 126px;
  border-color: rgba(210,170,58,.12);
}

.algo-seed {
  color: #ead8b7;
}

.gallery {
  background: rgba(20,16,12,.78);
}

.gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid rgba(210,170,58,.13);
}

@media (max-width: 1050px) {
  .hero-gate {
    grid-template-columns: minmax(0, 1fr);
    max-width: 900px;
  }
  .layout {
    grid-template-columns: 300px minmax(0, 1fr);
  }
  .canvas-frame {
    min-height: 560px;
  }
}

@media (max-width: 860px) {
  .app {
    padding-top: 16px;
  }
  .ctrl {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .canvas-frame {
    min-height: 0;
    padding: 18px;
  }
  .canvas-frame::after {
    top: 10px;
    left: 15px;
    font-size: 8px;
  }
  #patternCanvas {
    max-width: 100%;
  }
}

@media (max-width: 560px) {
  .hero-gate {
    padding: 28px 20px 36px;
    gap: 30px;
  }
  .hero-copy h1 {
    font-size: 2.45rem;
  }
  .hero-tag {
    margin-top: 18px;
  }
  .hero-wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .layout {
    gap: 14px;
  }
  .motif-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ================================================================
   2026-10-22 · 最后一轮展陈收束
   目标：画布优先、控制分层、记录像证据，而非卡片式控制台。
   ================================================================ */

:root {
  --hairline: rgba(220, 184, 100, .16);
  --hairline-strong: rgba(220, 184, 100, .32);
  --ink-soft: #b9a78b;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Menlo, monospace;
}

body {
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(216, 177, 93, .022) 1px, transparent 1px),
    linear-gradient(rgba(216, 177, 93, .022) 1px, transparent 1px),
    radial-gradient(ellipse 68% 45% at 44% -8%, rgba(210, 170, 58, .12), transparent 62%),
    radial-gradient(ellipse 46% 42% at 106% 72%, rgba(63, 158, 152, .075), transparent 72%),
    #0b0907;
  background-size: 32px 32px, 32px 32px, auto, auto, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .26;
  background-image: repeating-linear-gradient(
    103deg,
    transparent 0 7px,
    rgba(255, 244, 218, .014) 7px 8px
  );
  mix-blend-mode: soft-light;
}

.hero-gate,
.app {
  position: relative;
  z-index: 1;
}

.hero-gate {
  max-width: 1540px;
  grid-template-columns: minmax(0, 1.12fr) minmax(430px, .88fr);
  gap: clamp(42px, 6vw, 94px);
  padding: clamp(34px, 4.2vw, 68px);
}

.hero-loom {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: clamp(18px, 2.2vw, 30px);
  border-color: var(--hairline-strong);
  background:
    linear-gradient(90deg, transparent 49.88%, rgba(210, 170, 58, .08) 50%, transparent 50.12%),
    linear-gradient(transparent 49.88%, rgba(210, 170, 58, .08) 50%, transparent 50.12%),
    radial-gradient(circle at 50% 50%, rgba(63, 158, 152, .08), transparent 58%),
    #0b0907;
  box-shadow:
    0 52px 120px rgba(0, 0, 0, .52),
    0 0 0 1px rgba(255, 239, 202, .025) inset;
}

.hero-loom canvas {
  width: 100%;
  max-width: 760px;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #b99a57;
  font-family: var(--mono);
  letter-spacing: .18em;
}

.hero-eyebrow::before {
  content: "01";
  color: #e4c476;
}

.hero-eyebrow::after {
  content: "";
  width: 46px;
  height: 1px;
  background: var(--hairline-strong);
}

.hero-copy {
  position: relative;
}

.hero-copy::after {
  content: "MOTIF / SYSTEM / TEXTILE";
  position: absolute;
  right: 0;
  bottom: 4px;
  color: rgba(210, 170, 58, .24);
  font: 9px/1 var(--mono);
  letter-spacing: .18em;
  writing-mode: vertical-rl;
}

.hero-wall {
  gap: 8px;
}

.hero-case {
  position: relative;
  padding: 5px;
  border-color: rgba(210, 170, 58, .12);
  background: rgba(14, 11, 8, .52);
}

.hero-case::after {
  content: "VIEW";
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 3px 5px;
  background: rgba(4, 3, 2, .72);
  color: #d3b66f;
  font: 8px/1 var(--mono);
  letter-spacing: .12em;
  opacity: 0;
  transition: opacity .18s ease;
}

.hero-case:hover::after,
.hero-case:focus-visible::after {
  opacity: 1;
}

.hero-case span {
  padding: 0 4px 2px;
  font-size: .69rem;
}

.app {
  max-width: 1520px;
  padding: 22px 30px 64px;
}

.hero-compact {
  position: relative;
  margin-bottom: 24px;
  padding: 10px 0 18px;
  border-bottom-color: var(--hairline);
}

.hero-compact > div {
  position: relative;
  padding-left: 76px;
}

.lab-index {
  position: absolute;
  left: 0;
  top: 6px;
  color: #9c8352;
  font: 9px/1.4 var(--mono);
  letter-spacing: .12em;
}

.hero-compact h1 {
  line-height: 1.2;
}

.hero-compact::after {
  content: "CULTURAL MOTIF × PARAMETRIC WEAVE";
  position: absolute;
  right: 0;
  bottom: -7px;
  padding-left: 10px;
  background: #0b0907;
  color: rgba(220, 184, 100, .42);
  font: 8px/1 var(--mono);
  letter-spacing: .14em;
}

.layout {
  grid-template-columns: 342px minmax(0, 1fr);
  gap: clamp(20px, 2vw, 30px);
  align-items: start;
}

.ctrl {
  position: relative;
  top: auto;
  max-height: none;
  padding: 18px;
  overflow: visible;
  border-top: 2px solid #b38c34;
  background:
    linear-gradient(180deg, rgba(210, 170, 58, .055), transparent 120px),
    rgba(19, 15, 11, .94);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .22);
}

.ctrl::-webkit-scrollbar {
  width: 4px;
}

.ctrl::-webkit-scrollbar-thumb {
  background: #59472d;
}

.side-heading {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.side-index,
.algo-index {
  color: #9f895d;
  font: 9px/1.3 var(--mono);
  letter-spacing: .16em;
}

.side-heading h2 {
  margin: 3px 0 0;
  padding: 0;
  border: 0;
  color: #dfc481;
  font-size: 1rem;
  letter-spacing: .22em;
}

.side-heading p {
  color: #8f7f6b;
  font-size: .7rem;
  line-height: 1.6;
  letter-spacing: .03em;
}

.motif-cards {
  counter-reset: motif;
  gap: 0;
  max-height: 264px;
  margin-bottom: 16px;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.motif-card {
  counter-increment: motif;
  position: relative;
  min-height: 61px;
  padding: 10px 9px 9px 36px;
  border: 0;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: rgba(11, 9, 7, .4);
}

.motif-card:nth-child(2n) {
  border-right: 0;
}

.motif-card::before {
  content: "0" counter(motif);
  position: absolute;
  left: 9px;
  top: 12px;
  color: #77664b;
  font: 9px/1 var(--mono);
  letter-spacing: .06em;
}

.motif-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: transparent;
}

.motif-card strong {
  margin-bottom: 3px;
  color: #dac18b;
  font-size: .79rem;
  letter-spacing: .04em;
}

.motif-card span {
  display: -webkit-box;
  overflow: hidden;
  color: #817564;
  font-size: .64rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.motif-card:hover,
.motif-card.active {
  background:
    linear-gradient(90deg, rgba(210, 170, 58, .12), rgba(210, 170, 58, .025)),
    rgba(11, 9, 7, .5);
}

.motif-card:hover::after,
.motif-card.active::after {
  background: #d1a849;
}

.motif-card:focus-visible {
  z-index: 2;
}

.adv-block {
  margin: 10px 0;
  padding: 0;
  overflow: hidden;
  border-color: var(--hairline);
  background: rgba(8, 7, 5, .32);
}

.adv-block summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 39px;
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid transparent;
  color: #cabd9f;
  font-size: .76rem;
  letter-spacing: .1em;
  list-style: none;
}

.adv-block summary::-webkit-details-marker {
  display: none;
}

.adv-block summary::before {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1px solid #c4a458;
  border-bottom: 1px solid #c4a458;
  transform: rotate(45deg);
  transition: transform .18s ease;
}

.adv-block[open] summary {
  border-bottom-color: var(--hairline);
}

.adv-block[open] summary::before {
  transform: translateY(3px) rotate(225deg);
}

.adv-body {
  padding: 11px 12px 13px;
}

.control-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 35px;
}

.control-row + .control-row {
  border-top: 1px solid rgba(220, 184, 100, .08);
}

.control-row label {
  margin: 0;
  color: #b8a98f;
  font-size: .69rem;
  letter-spacing: .04em;
  white-space: nowrap;
}

.control-row label .val {
  float: none;
  margin-left: 5px;
  color: #e4c36c;
  font-family: var(--mono);
}

.control-row .range-wrap {
  margin: 0;
  padding: 0;
}

.range-wrap input[type="range"] {
  height: 3px;
  background: linear-gradient(90deg, #8f7026, #d6af45 70%, #332a1f 70%);
}

.range-wrap input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  border-width: 1px;
  background: #0e0b08;
  box-shadow: 0 0 0 2px rgba(210, 170, 58, .36);
}

.palette-label,
.block-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 6px;
  color: #b8a98f;
  font-size: .69rem;
  letter-spacing: .05em;
}

.block-label span {
  color: #6f614e;
  font: 8px/1 var(--mono);
  letter-spacing: .1em;
}

.mineral-swatches {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.swatch-item {
  min-width: 0;
}

.swatch-item span {
  color: #8d7e69;
  font-size: .62rem;
}

.ctrl input[type="color"] {
  width: 100%;
  height: 29px;
  padding: 3px;
  border-radius: 1px;
  background: #100d09;
}

.preset-row {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 5px !important;
}

.preset-row button,
.composition-row button {
  min-height: 34px;
  padding: 7px 8px;
  background: rgba(19, 15, 11, .76);
  font-size: .71rem;
}

.composition-row {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 5px !important;
  margin-bottom: 14px !important;
}

.aigc-honest {
  position: relative;
  margin: 14px 0 16px;
  padding: 14px 0 14px 15px;
  border: 0;
  border-left: 1px solid rgba(63, 158, 152, .5);
  background: linear-gradient(90deg, rgba(63, 158, 152, .065), transparent 78%);
}

.aigc-honest::before {
  content: "02 / SEMANTIC COMPILER";
  display: block;
  margin-bottom: 8px;
  color: #659e9a;
  font: 8px/1.3 var(--mono);
  letter-spacing: .13em;
}

.aigc-honest h2 {
  margin-bottom: 7px;
  padding: 0;
  border: 0;
  color: #a8d0cb;
  font-size: .88rem;
  letter-spacing: .12em;
}

.aigc-note {
  line-height: 1.65;
}

.aigc-honest input[type="text"] {
  border-radius: 0;
  background: rgba(7, 6, 5, .7);
  font-size: .74rem;
}

.aigc-honest .btn-ghost {
  min-height: 32px;
  padding: 6px 11px;
}

.action-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.action-row button {
  min-height: 39px;
  padding: 8px 9px;
  font-size: .73rem;
}

.action-row #btnRandom,
.action-row #btnRerender {
  grid-column: span 1;
}

.action-row #btnExportCard {
  grid-column: 1 / -1;
  min-height: 46px;
  background: linear-gradient(90deg, #b58d2a, #d0a73a);
  color: #161006;
  font-weight: 700;
}

.action-row #btnExport2048,
.action-row #btnSave,
.action-row #btnDirector,
.action-row #btnHelp {
  border-color: rgba(220, 184, 100, .2);
  background: rgba(14, 11, 8, .74);
}

.hint {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid rgba(220, 184, 100, .1);
  color: #7f715e;
  font-size: .66rem;
}

.stage-wrap {
  gap: 12px;
}

.stage-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  padding: 0 2px;
  color: #806d50;
  font: 9px/1 var(--mono);
  letter-spacing: .13em;
}

.stage-kicker span:first-child {
  color: #bba26e;
}

.canvas-frame {
  width: min(100%, calc(100svh - 150px));
  min-height: 0;
  margin-inline: auto;
  padding: clamp(18px, 2.3vw, 30px);
  border-color: rgba(220, 184, 100, .28);
  background:
    linear-gradient(90deg, transparent 49.94%, rgba(63, 158, 152, .065) 50%, transparent 50.06%),
    linear-gradient(transparent 49.94%, rgba(63, 158, 152, .065) 50%, transparent 50.06%),
    radial-gradient(circle at 50% 46%, rgba(63, 158, 152, .075), transparent 43%),
    #070605;
  box-shadow:
    0 38px 86px rgba(0, 0, 0, .38),
    inset 0 0 0 1px rgba(255, 239, 205, .025);
}

.canvas-frame::before {
  inset: 11px;
  opacity: .18;
  mask-image: radial-gradient(circle at center, black 30%, transparent 96%);
}

.canvas-frame::after {
  content: "WARP / WEFT / MIRROR";
  top: 15px;
  left: 22px;
  color: rgba(232, 196, 117, .42);
}

#patternCanvas {
  width: 100%;
  max-width: 100%;
  box-shadow:
    0 0 0 1px rgba(222, 184, 97, .32),
    0 26px 74px rgba(0, 0, 0, .58);
}

.overlay-toggles {
  justify-content: center;
  padding: 10px 14px;
  border-color: var(--hairline);
  background: rgba(12, 9, 7, .78);
}

.ov-btn {
  min-height: 27px;
  padding: 4px 12px;
  border-color: rgba(220, 184, 100, .16);
  color: #917f66;
  font-family: var(--mono);
  font-size: .64rem;
}

.ov-btn.active {
  background: #cba341;
  color: #130e06;
}

.meta-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-color: var(--hairline);
  background: rgba(13, 10, 7, .7);
  font-size: .68rem;
}

.meta-bar > span {
  min-width: 0;
  padding: 10px 13px;
}

.meta-bar > span + span {
  border-left: 1px solid var(--hairline);
}

.meta-bar strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #e3ca94;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.algo-panel {
  position: relative;
  overflow: hidden;
  padding: 0;
  border-color: var(--hairline-strong);
  border-top: 2px solid #b58d2f;
  background: rgba(15, 12, 9, .84);
}

.algo-panel::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 33.333%;
  width: 1px;
  background: rgba(220, 184, 100, .08);
  pointer-events: none;
}

.algo-head {
  margin: 0;
  padding: 15px 18px 13px;
  border-bottom: 1px solid var(--hairline);
}

.algo-head h2 {
  margin: 3px 0 0;
  padding: 0;
  border: 0;
  color: #dfc485;
  font-size: .94rem;
  letter-spacing: .2em;
}

.algo-method {
  color: #776956;
  font-family: var(--mono);
  font-size: .57rem;
  letter-spacing: .08em;
}

.algo-cols {
  grid-template-columns: minmax(0, .68fr) minmax(0, 1.35fr) minmax(0, 1.1fr);
  gap: 0;
}

.algo-col {
  min-height: 144px;
  padding: 16px 18px;
  border: 0;
  border-right: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
}

.algo-col:last-child {
  border-right: 0;
}

.algo-col h3 {
  margin-bottom: 11px;
  color: #8c795b;
  font: 8px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.algo-seed {
  margin-top: 4px;
  color: #f0dba9;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -.025em;
}

.algo-fine {
  max-width: 25em;
  line-height: 1.6;
}

.algo-json {
  color: #aa9a82;
  font-size: .63rem;
  line-height: 1.62;
}

.algo-rules {
  counter-reset: rule;
}

.algo-rules li {
  counter-increment: rule;
  position: relative;
  margin: 0;
  padding: 7px 0 7px 18px;
  border-left: 0;
  border-bottom: 1px solid rgba(220, 184, 100, .08);
  color: #cfc0a7;
  font-size: .72rem;
}

.algo-rules li::before {
  content: "0" counter(rule);
  position: absolute;
  left: 0;
  color: #7b694d;
  font: 8px/1.8 var(--mono);
}

.algo-verify {
  margin: 0;
  padding: 12px 18px;
  border-top: 1px solid var(--hairline);
  background: rgba(7, 6, 5, .35);
}

.algo-verify .btn-accent {
  min-height: 34px;
  padding: 6px 12px;
  border-color: rgba(63, 158, 152, .38);
  font-size: .71rem;
}

.gallery {
  padding: 17px 18px;
  background:
    linear-gradient(90deg, rgba(210, 170, 58, .035), transparent 60%),
    rgba(16, 12, 9, .72);
}

.gallery-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline);
}

.gallery-head h2 {
  margin: 0;
  padding: 0;
  border: 0;
  color: #cbb785;
}

.gallery-count {
  color: #75aaa5;
  font-family: var(--mono);
  font-size: .64rem;
}

.gallery-lead {
  margin-top: 10px;
}

.gallery-empty {
  border: 0;
  border-left: 1px solid #9a7835;
  border-radius: 0;
  background: linear-gradient(90deg, rgba(210, 170, 58, .05), transparent);
}

.footer {
  border-top-color: var(--hairline);
}

.help-card {
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(210, 170, 58, .06), transparent 120px),
    #17130f;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 318px minmax(0, 1fr);
  }

  .hero-gate {
    gap: 44px;
    padding-inline: 42px;
  }
}

@media (max-width: 1050px) {
  .hero-gate {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .algo-cols {
    grid-template-columns: 1fr;
  }

  .algo-panel::before {
    display: none;
  }

  .algo-col {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
  }

  .algo-col:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 860px) {
  .app {
    padding: 16px 18px 48px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .canvas-frame {
    width: 100%;
    min-height: 0;
    padding: 18px;
  }

  .ctrl {
    padding: 16px;
  }

  .meta-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .hero-gate {
    padding: 28px 20px 38px;
    gap: 30px;
  }

  .hero-loom {
    width: 100%;
    max-width: 360px;
    min-width: 0;
    margin-inline: auto;
    padding: 15px;
  }

  .hero-copy {
    display: flex;
    flex-direction: column;
  }

  .hero-copy h1 {
    font-size: clamp(2.35rem, 12vw, 3rem);
  }

  .hero-tag {
    margin-top: 17px;
    font-size: 1.22rem;
  }

  .hero-desc {
    font-size: .83rem;
    line-height: 1.72;
  }

  .hero-cta {
    order: 2;
    margin: 22px 0 18px;
  }

  .hero-wall {
    order: 3;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin: 0;
  }

  .hero-case {
    padding: 3px;
  }

  .hero-case span {
    margin-top: 4px;
    padding: 0;
    font-size: .58rem;
    letter-spacing: 0;
  }

  .hero-case::after {
    display: none;
  }

  .hero-copy::after {
    display: none;
  }

  .hero-compact {
    align-items: flex-start;
  }

  .hero-compact > div {
    padding-left: 0;
  }

  .lab-index {
    position: static;
    display: block;
    margin-bottom: 7px;
  }

  .hero-compact::after {
    display: none;
  }

  .stage-kicker {
    padding-inline: 1px;
    font-size: 8px;
  }

  .canvas-frame {
    padding: 11px;
  }

  .canvas-frame::before {
    inset: 6px;
  }

  .canvas-frame::after {
    top: 9px;
    left: 13px;
    font-size: 7px;
  }

  .overlay-toggles {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 9px 10px;
    scrollbar-width: none;
  }

  .overlay-toggles::-webkit-scrollbar {
    display: none;
  }

  .ov-btn {
    flex: 0 0 auto;
    min-height: 29px;
  }

  .meta-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-bar > span {
    padding: 9px 11px;
  }

  .meta-bar > span:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--hairline);
    border-left: 0;
  }

  .side-heading {
    margin-bottom: 12px;
  }

  .motif-cards {
    display: flex;
    gap: 0;
    max-height: none;
    margin-right: -16px;
    margin-left: -16px;
    padding: 0 16px;
    overflow-x: auto;
    border-right: 0;
    border-left: 0;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .motif-cards::-webkit-scrollbar {
    display: none;
  }

  .motif-card {
    flex: 0 0 156px;
    min-height: 67px;
    border-right: 1px solid var(--hairline);
    scroll-snap-align: start;
  }

  .motif-card:nth-child(2n) {
    border-right: 1px solid var(--hairline);
  }

  .control-row {
    grid-template-columns: 84px minmax(0, 1fr);
    min-height: 39px;
  }

  .algo-head {
    align-items: flex-end;
    padding: 14px 14px 12px;
  }

  .algo-method {
    max-width: 11em;
    text-align: right;
    white-space: normal;
  }

  .algo-col {
    padding: 14px;
  }

  .algo-verify {
    padding: 12px 14px;
  }

  .gallery {
    padding: 15px 14px;
  }
}

@media (hover: hover) {
  .canvas-frame:hover {
    border-color: rgba(220, 184, 100, .4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-case::after,
  .motif-card::before {
    transition: none;
  }
}

/* ================================================================
   2026-10-22 · refined v4.0 / crisp evidence grid
   Canonical final layer. Earlier sections remain as historical styling;
   this block resolves the canvas/overlay mismatch and desktop cascade.
   ================================================================ */

:root {
  --canvas-px: 640px;
  --canvas-frame-px: 700px;
  --evidence-column-px: var(--canvas-frame-px);
  --frame-pad: 28px;
}

/* Hero uses the same native-pixel discipline as the workbench canvas. */
.hero-loom {
  width: min(100%, var(--canvas-frame-px));
  max-width: var(--canvas-frame-px);
  margin-inline: auto;
  padding: var(--frame-pad);
}

.hero-loom canvas {
  width: min(100%, var(--canvas-px)) !important;
  max-width: var(--canvas-px);
  height: auto;
  margin-inline: auto;
}

/* The two-column shell stays predictable while the evidence column owns
   a fixed optical centre at 1440, 1536 and 1920. */
.app {
  max-width: 1540px;
}

.layout {
  grid-template-columns: 342px var(--evidence-column-px);
  gap: clamp(24px, 2vw, 30px);
  align-items: start;
  justify-content: center;
  width: min(100%, calc(342px + var(--evidence-column-px) + 30px));
  margin-inline: auto;
}

.layout .stage-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: max-content;
  gap: 14px;
  width: min(100%, var(--evidence-column-px));
  min-width: 0;
  justify-self: center;
}

.pattern-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  width: 100%;
  min-width: 0;
}

.stage-kicker,
.canvas-frame,
.overlay-toggles {
  width: min(100%, var(--canvas-frame-px));
  margin-inline: auto;
}

/* The frame itself is sized from a 640px canvas plus its border/gutter.
   No desktop rule may make the bitmap wider than its intrinsic width. */
.canvas-frame {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  padding: var(--frame-pad);
  overflow: hidden;
}

.canvas-stack {
  position: relative;
  width: min(100%, var(--canvas-px));
  max-width: var(--canvas-px);
  aspect-ratio: 1;
  margin-inline: auto;
  isolation: isolate;
}

#patternCanvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: var(--canvas-px);
  max-height: var(--canvas-px);
  margin: 0;
  border-radius: 1px;
  image-rendering: auto;
}

/* Overlay now shares the canvas coordinate box rather than the padded frame. */
.algo-overlay {
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.overlay-svg {
  width: 100%;
  height: 100%;
}

.overlay-toggles {
  margin-top: 0;
}

.meta-bar,
.algo-panel,
.gallery {
  width: 100%;
  min-width: 0;
}

/* Keep the three-column record on one grid and prevent long JSON from
   forcing the centre or right column to different optical widths. */
.algo-cols {
  display: grid;
  grid-template-columns:
    minmax(0, .72fr)
    minmax(0, 1.3fr)
    minmax(0, 1.18fr);
  align-items: stretch;
}

.algo-col {
  min-width: 0;
}

.meta-bar > span {
  display: grid;
  align-content: center;
}

/* Remove the fractional scaling used on reveal pulses; it softened the
   canvas for the duration of every interaction. Shadows carry the cue. */
.canvas-frame.pulse {
  transform: none;
}

.canvas-frame.pop {
  animation: motifPopV4 .34s ease;
}

@keyframes motifPopV4 {
  from {
    opacity: .72;
    box-shadow:
      0 0 0 1px rgba(210, 170, 58, .18),
      0 22px 56px rgba(0, 0, 0, .32);
  }
  to {
    opacity: 1;
    box-shadow:
      0 0 0 1px rgba(210, 170, 58, .28),
      0 34px 86px rgba(0, 0, 0, .38);
  }
}

/* At the narrow desktop boundary the rail narrows before the stage does. */
@media (max-width: 1180px) and (min-width: 861px) {
  .layout {
    grid-template-columns: 310px var(--evidence-column-px);
    gap: 24px;
    width: min(100%, calc(310px + var(--evidence-column-px) + 24px));
  }

  .stage-wrap {
    width: 100%;
  }
}

@media (max-width: 860px) {
  :root {
    --frame-pad: 18px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .stage-wrap {
    width: 100%;
    justify-self: stretch;
  }

  .stage-kicker,
  .canvas-frame,
  .overlay-toggles {
    width: 100%;
  }

  .canvas-frame {
    padding: var(--frame-pad);
  }

  .algo-cols {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  :root {
    --frame-pad: 11px;
  }

  .hero-loom {
    width: min(100%, 360px);
    padding: 15px;
  }

  .canvas-frame {
    padding: var(--frame-pad);
  }
}

@media (prefers-reduced-motion: reduce) {
  .canvas-frame.pop {
    animation: none !important;
  }
}
