@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;600&family=Manrope:wght@400;500;600;700&family=Sora:wght@500;600;700&display=swap");

:root {
  --ink: #10182d;
  --muted: #667389;
  --blue: #145eff;
  --blue-dark: #0a46cb;
  --mint: #17cbaa;
  --violet: #875df6;
  --coral: #ff7a5c;
  --panel: rgba(255, 255, 255, 0.92);
  --line: rgba(16, 24, 45, 0.1);
  --soft-line: rgba(16, 24, 45, 0.065);
  --shadow: 0 28px 75px rgba(16, 24, 45, 0.11);
  --focus: 0 0 0 4px rgba(20, 94, 255, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 4%, rgba(23, 203, 170, 0.15), transparent 28%),
    radial-gradient(circle at 92% 5%, rgba(20, 94, 255, 0.18), transparent 31%),
    radial-gradient(circle at 45% 88%, rgba(135, 93, 246, 0.09), transparent 34%),
    #f4f7fb;
  font-family: "Manrope", "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
label,
select,
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.is-hidden {
  display: none !important;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.52;
  background-image:
    linear-gradient(rgba(16, 24, 45, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 24, 45, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.8) 55%, transparent 100%);
}

.page {
  width: min(1420px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 84px;
}

.hero {
  margin-bottom: 30px;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 48px;
}

.home-link {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.home-link::before {
  content: "\2190";
  margin-right: 10px;
  color: var(--blue);
  font-family: "IBM Plex Mono", monospace;
}

.home-link:hover {
  color: var(--blue);
}

.privacy-pill,
.smart-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px;
  border: 1px solid rgba(23, 203, 170, 0.25);
  border-radius: 999px;
  color: #087765;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.privacy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 5px rgba(23, 203, 170, 0.13);
}

.hero-copy {
  max-width: 940px;
}

.eyebrow,
.step {
  margin: 0 0 10px;
  color: var(--blue);
  font: 600 0.72rem/1.2 "IBM Plex Mono", monospace;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font: 700 clamp(3rem, 7.2vw, 6.6rem)/0.94 "Sora", sans-serif;
  letter-spacing: -0.065em;
  background: linear-gradient(102deg, #1158f0 2%, #7d62ef 43%, #15bd9e 88%);
  -webkit-background-clip: text;
  color: transparent;
}

.lead {
  max-width: 800px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.17rem);
  line-height: 1.7;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 25px;
}

.hero-points span {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #445168;
  background: rgba(255, 255, 255, 0.58);
  font: 600 0.68rem "IBM Plex Mono", monospace;
  letter-spacing: 0.025em;
}

.step-rail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
}

.step-rail span {
  position: relative;
  padding: 14px 18px;
  color: var(--muted);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.step-rail span + span {
  border-left: 1px solid var(--line);
}

.step-rail b {
  margin-right: 8px;
  color: var(--blue);
  font: 600 0.7rem "IBM Plex Mono", monospace;
}

.step-rail .is-active {
  color: var(--ink);
  background: rgba(20, 94, 255, 0.055);
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(380px, 0.72fr);
  gap: 20px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.preview-panel {
  min-width: 0;
  padding: 26px;
}

.panel-head,
.section-head,
.output-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-head {
  margin-bottom: 20px;
}

.panel-head h2,
.section-head h2,
.output-head h2,
.how-it-works h2 {
  margin: 0;
  font: 600 1.42rem/1.2 "Sora", sans-serif;
  letter-spacing: -0.03em;
}

.text-button {
  padding: 5px;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.pattern-picker {
  min-height: 590px;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(20, 94, 255, 0.15);
  border-radius: 22px;
  background:
    radial-gradient(circle at 10% 0%, rgba(20, 94, 255, 0.08), transparent 32%),
    radial-gradient(circle at 96% 14%, rgba(23, 203, 170, 0.08), transparent 28%),
    #f8faff;
}

.pattern-picker-copy {
  display: grid;
  gap: 5px;
}

.pattern-picker-copy .step {
  margin: 0;
}

.pattern-picker-copy strong {
  font: 600 clamp(1.1rem, 2vw, 1.4rem)/1.2 "Sora", sans-serif;
  letter-spacing: -0.025em;
}

.pattern-picker-copy span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

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

.preset-grid button {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 6px 6px 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font: 700 0.66rem/1.2 "Inter", sans-serif;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(31, 48, 80, 0.045);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.preset-grid button:hover,
.preset-grid button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(20, 94, 255, 0.5);
  outline: none;
  box-shadow: 0 9px 20px rgba(20, 94, 255, 0.12);
}

.preset-grid canvas {
  width: 100%;
  aspect-ratio: 3 / 2;
  display: block;
  border-radius: 7px;
  background: #e8edf7;
}

.dropzone {
  min-height: 590px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 38px;
  border: 1.5px dashed rgba(20, 94, 255, 0.32);
  border-radius: 22px;
  outline: none;
  background:
    linear-gradient(145deg, rgba(20, 94, 255, 0.055), rgba(23, 203, 170, 0.055)),
    repeating-linear-gradient(45deg, transparent 0 18px, rgba(20, 94, 255, 0.016) 18px 19px);
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragging {
  transform: translateY(-2px);
  border-color: var(--blue);
  background-color: rgba(20, 94, 255, 0.035);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone strong {
  margin-top: 10px;
  font: 600 clamp(1.2rem, 2vw, 1.55rem) "Sora", sans-serif;
  letter-spacing: -0.025em;
}

.dropzone p {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
  font-size: 0.89rem;
  line-height: 1.6;
}

.dropzone small {
  margin-top: 4px;
  color: #718096;
  font-size: 0.74rem;
}

.upload-mark {
  width: 86px;
  height: 86px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 9px;
  transform: rotate(-7deg);
  border-radius: 25px;
  background: linear-gradient(135deg, #0e58f4, #8661ed 52%, #18c3a4);
  box-shadow: 0 24px 44px rgba(20, 94, 255, 0.26);
}

.upload-mark span {
  display: block;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.upload-mark span:nth-child(1) { transform: translateY(4px); opacity: 0.55; }
.upload-mark span:nth-child(2) { transform: translateY(-3px); opacity: 0.78; }
.upload-mark span:nth-child(3) { transform: translateY(1px); opacity: 0.68; }
.upload-mark span:nth-child(4) { transform: translateY(-6px); }

.secondary,
.view-actions button,
.segmented button,
.piece-download {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.secondary {
  margin-top: 8px;
  padding: 11px 18px;
  color: var(--blue);
}

.preview-workspace {
  min-width: 0;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  background: #edf1f7;
}

.segmented button {
  padding: 8px 12px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.76rem;
}

.segmented button.is-active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 5px 14px rgba(16, 24, 45, 0.09);
}

.view-actions {
  display: flex;
  gap: 6px;
}

.view-actions button {
  min-width: 38px;
  padding: 8px 10px;
  color: #4f5d73;
  font-size: 0.69rem;
}

.view-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.canvas-shell {
  position: relative;
  min-height: 540px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  background:
    radial-gradient(circle at 22% 8%, rgba(119, 99, 255, 0.25), transparent 30%),
    radial-gradient(circle at 86% 15%, rgba(23, 203, 170, 0.16), transparent 27%),
    linear-gradient(155deg, #17233e, #0c1325 65%, #121b30);
  touch-action: none;
  cursor: grab;
}

.canvas-shell.is-3d-view {
  background:
    radial-gradient(circle at 18% 6%, rgba(82, 109, 255, 0.32), transparent 32%),
    radial-gradient(circle at 84% 18%, rgba(38, 222, 186, 0.18), transparent 30%),
    linear-gradient(155deg, #101d38, #070e1d 70%, #0d172d);
}

.canvas-shell:active {
  cursor: grabbing;
}

#preview-canvas {
  width: 100%;
  height: 540px;
  display: block;
}

.relief-viewer {
  position: absolute;
  inset: 0;
  z-index: 1;
  min-width: 0;
  min-height: 100%;
  overflow: hidden;
}

.relief-webgl-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

.relief-webgl-canvas:active {
  cursor: grabbing;
}

.viewer-corner {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.66);
  background: rgba(5, 12, 26, 0.58);
  backdrop-filter: blur(10px);
  font: 500 0.6rem "IBM Plex Mono", monospace;
  pointer-events: none;
}

.viewer-corner b {
  padding: 3px 5px;
  border-radius: 5px;
  color: #88f4d9;
  background: rgba(55, 220, 181, 0.11);
  font-size: 0.55rem;
  letter-spacing: 0.07em;
}

.viewer-actions {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  display: flex;
  gap: 6px;
}

.viewer-actions button {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(5, 12, 26, 0.62);
  backdrop-filter: blur(10px);
  font: 600 0.6rem "IBM Plex Mono", monospace;
  cursor: pointer;
}

.viewer-actions button:hover {
  color: #fff;
  border-color: rgba(125, 233, 211, 0.42);
  background: rgba(16, 31, 56, 0.82);
}

.canvas-badge {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(6, 12, 25, 0.56);
  backdrop-filter: blur(8px);
  z-index: 3;
  max-width: calc(100% - 310px);
  overflow: hidden;
  font: 500 0.65rem "IBM Plex Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-shell.is-3d-view .canvas-badge {
  right: 14px;
  bottom: 58px;
  max-width: calc(100% - 28px);
}

.processing-cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 15px;
  color: white;
  background: rgba(7, 13, 27, 0.72);
  backdrop-filter: blur(6px);
  font-size: 0.85rem;
  z-index: 6;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.depth-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.depth-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.depth-legend span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  color: #48566c;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.depth-legend i {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 3px;
}

.legend-low { background: #202d4c; }
.legend-high { background: linear-gradient(135deg, #7c63f4, #20d0ad); }

.ar-card {
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(35, 185, 159, 0.22);
  border-radius: 16px;
  background:
    radial-gradient(circle at 3% 0%, rgba(31, 209, 173, 0.14), transparent 28%),
    linear-gradient(135deg, rgba(244, 252, 250, 0.95), rgba(246, 249, 255, 0.95));
}

.ar-mark {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #1166ec, #765fe6 54%, #16bfa3);
  box-shadow: 0 12px 24px rgba(45, 92, 197, 0.2);
  font: 700 0.72rem "IBM Plex Mono", monospace;
}

.ar-mark i {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  transform: rotate(30deg) skewY(-10deg);
  border-radius: 7px;
}

.ar-mark span {
  position: relative;
  z-index: 1;
}

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

.ar-copy strong {
  color: #1b2b45;
  font-size: 0.78rem;
}

.ar-copy span,
.ar-copy small {
  color: #68788f;
  font-size: 0.65rem;
  line-height: 1.45;
}

.ar-copy small {
  color: #36756b;
  font-family: "IBM Plex Mono", monospace;
}

.ar-copy small.is-error {
  color: #b42318;
}

.ar-placement {
  display: grid;
  gap: 5px;
  color: #68788f;
  font-size: 0.6rem;
}

.ar-placement select {
  min-width: 112px;
  padding: 9px 30px 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #273952;
  background-color: #fff;
  font: 600 0.68rem "Sora", sans-serif;
}

.ar-prepare,
.ar-launch {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 13px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #155fff, #795fe9);
  box-shadow: 0 10px 22px rgba(49, 85, 202, 0.2);
  font: 700 0.67rem "Sora", sans-serif;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.ar-prepare:disabled {
  cursor: wait;
  opacity: 0.62;
}

.ar-launch img {
  width: 19px;
  height: 19px;
  border-radius: 5px;
}

.canvas-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
}

.canvas-shell:fullscreen #preview-canvas,
.canvas-shell:fullscreen .relief-viewer {
  width: 100%;
  height: 100%;
}

.model-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(248, 250, 253, 0.8);
}

.model-stats div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 13px 15px;
}

.model-stats div + div {
  border-left: 1px solid var(--line);
}

.model-stats span {
  color: var(--muted);
  font-size: 0.67rem;
}

.model-stats strong {
  overflow: hidden;
  color: #26344c;
  font: 600 0.74rem "IBM Plex Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.controls-panel {
  position: sticky;
  top: 16px;
  overflow: hidden;
}

.control-section {
  padding: 24px;
}

.control-section + .control-section {
  border-top: 1px solid var(--line);
}

.section-head {
  margin-bottom: 20px;
}

.split-head {
  align-items: center;
}

.smart-pill {
  padding: 6px 9px;
  font-size: 0.66rem;
}

.shape-fieldset {
  min-width: 0;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.shape-fieldset legend,
.field-label {
  display: block;
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 700;
}

.shape-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.shape-grid label {
  min-width: 0;
  cursor: pointer;
}

.shape-grid input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.shape-grid label > span {
  min-height: 66px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 8px 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(248, 250, 253, 0.75);
  font-size: 0.65rem;
  font-weight: 700;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.shape-grid input:checked + span {
  transform: translateY(-1px);
  border-color: rgba(20, 94, 255, 0.42);
  color: var(--blue);
  background: rgba(20, 94, 255, 0.065);
  box-shadow: 0 7px 16px rgba(20, 94, 255, 0.09);
}

.shape-grid input:focus-visible + span {
  box-shadow: var(--focus);
}

.shape-help {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.45;
}

.shape {
  width: 18px;
  height: 18px;
  display: block;
  color: currentColor;
  background: currentColor;
}

.shape.circle { border-radius: 50%; }
.shape.natural {
  border-radius: 4px;
  background: linear-gradient(135deg, currentColor 0 18%, transparent 18% 30%, currentColor 30% 48%, transparent 48% 59%, currentColor 59% 100%);
  transform: skewY(-10deg);
}
.shape.square { border-radius: 3px; }
.shape.triangle { clip-path: polygon(50% 3%, 98% 94%, 2% 94%); }
.shape.pentagon { clip-path: polygon(50% 0, 98% 35%, 80% 96%, 20% 96%, 2% 35%); }
.shape.pentagon-flow {
  clip-path: polygon(50% 0, 98% 35%, 80% 96%, 20% 96%, 2% 35%);
  background: linear-gradient(135deg, currentColor 0 44%, transparent 45% 55%, currentColor 56% 100%);
  transform: rotate(18deg);
}
.shape.shard {
  clip-path: polygon(4% 20%, 78% 0, 100% 39%, 64% 100%, 18% 78%);
  transform: rotate(-12deg) skewX(-8deg);
}
.shape.shard-burst {
  clip-path: polygon(0 30%, 73% 0, 100% 42%, 58% 100%, 16% 72%);
  background: linear-gradient(145deg, currentColor 0 47%, transparent 48% 57%, currentColor 58% 100%);
  transform: rotate(31deg) scaleX(1.14);
}
.shape.hexagon { clip-path: polygon(25% 7%, 75% 7%, 100% 50%, 75% 93%, 25% 93%, 0 50%); }
.shape.hexagon-v2 {
  clip-path: polygon(25% 7%, 75% 7%, 100% 50%, 75% 93%, 25% 93%, 0 50%);
  background: linear-gradient(135deg, currentColor 0 45%, transparent 46% 55%, currentColor 56% 100%);
}
.shape.waves { height: 11px; border-radius: 50% 50% 35% 35%; transform: skewY(-18deg); background: linear-gradient(180deg, currentColor 0 30%, transparent 30% 55%, currentColor 55% 82%, transparent 82%); }
.shape.star { clip-path: polygon(50% 0, 61% 34%, 98% 35%, 68% 56%, 79% 93%, 50% 71%, 21% 93%, 32% 56%, 2% 35%, 39% 34%); }
.shape.spike { clip-path: polygon(50% 0, 82% 100%, 18% 100%); }

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin-bottom: 18px;
}

.field > span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

select,
.unit-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
}

select {
  padding: 12px 36px 12px 13px;
  cursor: pointer;
}

.field-pair,
.dimension-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.piece-dimension-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dimension-help {
  margin: -5px 0 18px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.range-field output {
  color: var(--blue);
  font: 600 0.73rem "IBM Plex Mono", monospace;
}

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

.unit-input {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  overflow: hidden;
}

.unit-input input {
  min-width: 0;
  width: 100%;
  padding: 11px 4px 11px 12px;
  border: 0;
  outline: none;
  color: var(--ink);
  background: transparent;
}

.unit-input:focus-within {
  border-color: rgba(20, 94, 255, 0.5);
  box-shadow: var(--focus);
}

.unit-input b {
  padding: 0 11px;
  color: var(--muted);
  font: 600 0.66rem "IBM Plex Mono", monospace;
}

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: -2px 0 2px;
  color: #3d4b62;
  cursor: pointer;
}

.check-field.compact {
  margin: -6px 0 19px;
}

.pattern-fieldset {
  min-width: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.pattern-fieldset legend {
  display: block;
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.pattern-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.pattern-mode-option {
  min-width: 0;
  cursor: pointer;
}

.pattern-mode-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.pattern-mode-option > span {
  min-height: 39px;
  display: grid;
  place-items: center;
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(248, 250, 253, 0.75);
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.pattern-mode-option input:checked + span {
  transform: translateY(-1px);
  border-color: rgba(20, 94, 255, 0.42);
  color: var(--blue);
  background: rgba(20, 94, 255, 0.065);
  box-shadow: 0 7px 16px rgba(20, 94, 255, 0.09);
}

.pattern-mode-option input:focus-visible + span {
  box-shadow: var(--focus);
}

.pattern-fieldset > small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.5;
}

.pattern-fieldset[disabled] .pattern-mode-option {
  cursor: not-allowed;
}

.check-field input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--blue);
}

.check-field span {
  display: grid;
  gap: 2px;
}

.check-field strong {
  font-size: 0.78rem;
}

.check-field small {
  color: var(--muted);
  font-size: 0.67rem;
}

[disabled] {
  cursor: not-allowed !important;
}

fieldset[disabled],
select:disabled,
input:disabled {
  opacity: 0.52;
}

.seam-controls {
  margin-top: 2px;
}

.split-summary {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 13px;
  align-items: center;
  padding: 13px;
  border: 1px solid rgba(23, 203, 170, 0.2);
  border-radius: 14px;
  background: rgba(23, 203, 170, 0.06);
}

.split-summary p {
  display: grid;
  gap: 4px;
  margin: 0;
}

.split-summary strong {
  color: #174d46;
  font-size: 0.78rem;
}

.split-summary span {
  color: #5b7774;
  font-size: 0.65rem;
  line-height: 1.4;
}

.split-icon {
  width: 48px;
  height: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 4px;
  border-radius: 9px;
  background: #d9f5ee;
}

.split-icon i {
  border-radius: 3px;
  background: linear-gradient(145deg, var(--blue), var(--mint));
}

.split-icon i:nth-child(2),
.split-icon i:nth-child(3) { opacity: 0.68; }
.split-icon i:nth-child(4) { opacity: 0.45; }

.export-section {
  background: linear-gradient(150deg, rgba(20, 94, 255, 0.035), rgba(135, 93, 246, 0.045));
}

.primary {
  min-height: 47px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 13px 18px;
  border: 0;
  border-radius: 13px;
  color: white;
  background: linear-gradient(112deg, var(--blue), var(--violet) 57%, #24bfa5);
  box-shadow: 0 15px 28px rgba(20, 94, 255, 0.21);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 19px 34px rgba(20, 94, 255, 0.25);
}

.primary:disabled {
  filter: grayscale(0.38);
  opacity: 0.48;
  box-shadow: none;
}

#build-button {
  width: 100%;
}

.build-progress {
  display: grid;
  gap: 8px;
  margin-top: 15px;
}

.build-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.68rem;
}

.build-progress strong {
  color: var(--blue);
  font-family: "IBM Plex Mono", monospace;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(16, 24, 45, 0.09);
}

.progress-track i {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--mint));
  transition: width 0.2s ease;
}

.control-status {
  margin: 12px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.68rem;
  line-height: 1.45;
}

.control-status.is-error {
  color: #b42318;
  font-weight: 700;
}

.output-panel {
  margin-top: 20px;
  padding: 28px;
}

.output-head {
  align-items: center;
  margin-bottom: 24px;
}

.output-head p:not(.step) {
  max-width: 700px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.55;
}

.download-all {
  white-space: nowrap;
}

.assembly-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.3fr);
  gap: 20px;
}

.assembly-map-wrap {
  position: relative;
  min-height: 420px;
  padding: 18px;
  overflow: hidden;
  border-radius: 19px;
  background:
    radial-gradient(circle at 20% 15%, rgba(135, 93, 246, 0.24), transparent 33%),
    linear-gradient(150deg, #15213c, #0d1528);
}

#assembly-canvas {
  width: 100%;
  height: 350px;
  display: block;
}

.map-caption {
  position: absolute;
  right: 18px;
  bottom: 16px;
  left: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.68rem;
}

.map-caption strong {
  color: white;
  font: 600 0.68rem "IBM Plex Mono", monospace;
}

.piece-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  align-content: start;
}

.piece-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(249, 251, 254, 0.88);
}

.piece-index {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: white;
  background: var(--piece-color, var(--blue));
  font: 600 0.68rem "IBM Plex Mono", monospace;
}

.piece-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.piece-copy strong,
.piece-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.piece-copy strong {
  font-size: 0.75rem;
}

.piece-copy span {
  color: var(--muted);
  font: 500 0.6rem "IBM Plex Mono", monospace;
}

.piece-download {
  padding: 8px 9px;
  color: var(--blue);
  font-size: 0.66rem;
}

.assembly-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 13px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(23, 203, 170, 0.18);
  border-radius: 13px;
  color: #365f59;
  background: rgba(23, 203, 170, 0.06);
}

.assembly-note strong {
  font-size: 0.74rem;
}

.assembly-note p {
  margin: 0;
  color: #5c7471;
  font-size: 0.72rem;
  line-height: 1.5;
}

.how-it-works {
  display: grid;
  grid-template-columns: 0.45fr 1.55fr;
  gap: 30px;
  margin-top: 22px;
  padding: 29px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
}

.how-it-works ol {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.how-it-works li {
  display: grid;
  grid-template-columns: 29px 1fr;
  gap: 10px;
}

.how-it-works li > b {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--blue);
  background: rgba(20, 94, 255, 0.09);
  font: 600 0.68rem "IBM Plex Mono", monospace;
}

.how-it-works li span {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.how-it-works li strong {
  color: var(--ink);
  font-size: 0.78rem;
}

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

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

  .controls-panel {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: stretch;
  }

  .control-section + .control-section {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

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

@media (max-width: 880px) {
  .page {
    width: min(100% - 24px, 720px);
    padding-top: 27px;
  }

  .hero-top {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 36px;
  }

  .step-rail span {
    padding: 11px 8px;
    font-size: 0.68rem;
  }

  .step-rail b {
    display: block;
    margin: 0 0 3px;
  }

  .controls-panel {
    grid-template-columns: 1fr;
  }

  .control-section + .control-section {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .shape-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dropzone {
    min-height: 460px;
  }

  .pattern-picker {
    min-height: 460px;
  }

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

  .canvas-shell,
  #preview-canvas {
    min-height: 430px;
    height: 430px;
  }

  .ar-card {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .ar-placement,
  .ar-prepare,
  .ar-launch {
    grid-column: 2;
    width: 100%;
  }

  .assembly-layout,
  .how-it-works {
    grid-template-columns: 1fr;
  }

  .how-it-works ol {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 590px) {
  .page {
    width: min(100% - 16px, 520px);
  }

  .privacy-pill {
    white-space: normal;
  }

  .hero-points {
    gap: 7px;
  }

  .preview-panel,
  .control-section,
  .output-panel {
    padding: 18px;
  }

  .pattern-picker {
    padding: 14px;
  }

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

  .preview-toolbar,
  .output-head {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented,
  .view-actions {
    width: 100%;
  }

  .segmented button,
  .view-actions button {
    flex: 1;
  }

  .canvas-shell,
  #preview-canvas {
    min-height: 360px;
    height: 360px;
  }

  .viewer-actions {
    right: 12px;
    bottom: 12px;
    left: 12px;
    overflow-x: auto;
  }

  .viewer-actions button {
    flex: 1 0 auto;
  }

  .canvas-badge {
    right: 12px;
    bottom: 56px;
    left: 12px;
    max-width: none;
  }

  .viewer-corner {
    top: 12px;
    left: 12px;
  }

  .ar-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 11px;
    padding: 12px;
  }

  .ar-mark {
    width: 42px;
    height: 42px;
  }

  .depth-legend span:nth-child(2) {
    display: none;
  }

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

  .model-stats div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .model-stats div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .field-pair,
  .dimension-grid,
  .piece-dimension-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .piece-list {
    grid-template-columns: 1fr;
  }

  .assembly-map-wrap {
    min-height: 340px;
  }

  #assembly-canvas {
    height: 280px;
  }

  .assembly-note {
    grid-template-columns: 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;
  }
}
