:root {
  color-scheme: dark;
  --ink: #eef8f7;
  --muted: #8ba4a8;
  --muted-strong: #b6cbcc;
  --bg: #07131f;
  --bg-deep: #040c14;
  --panel: rgba(10, 29, 40, 0.92);
  --panel-soft: rgba(14, 40, 51, 0.72);
  --line: rgba(130, 199, 202, 0.22);
  --line-bright: rgba(106, 240, 226, 0.58);
  --cyan: #64e8dc;
  --cyan-strong: #2ed2d2;
  --lime: #cbf36c;
  --orange: #ffb36b;
  --danger: #ff938d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}



* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -10%, rgba(34, 106, 121, 0.3), transparent 32rem),
    radial-gradient(circle at 90% 20%, rgba(21, 80, 91, 0.2), transparent 28rem),
    var(--bg);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.code-block:focus-visible,
a:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 3px;
}

a {
  color: inherit;
}

.app-shell {
  width: min(calc(100% - 32px), 1280px);
  margin: 0 auto;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header {
  min-height: 78px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.08em;
}

.brand > span:last-child {
  display: grid;
  line-height: 1.05;
}

.brand strong {
  font-size: 0.9rem;
  font-weight: 800;
}

.brand small {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.55rem;
  letter-spacing: 0.18em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--bg-deep);
  background: var(--cyan);
  border-radius: 10px 2px 10px 2px;
  font-size: 1.05rem;
  font-weight: 900;
  box-shadow: 0 0 24px rgba(100, 232, 220, 0.28);
}

.header-note,
.section-explain,
.microcopy,
.mode-tab small,
.preview-meta,
.preview-legend,
.site-footer,
.hero-facts,
.hero-art figcaption {
  color: var(--muted);
}

.header-note {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.4rem;
  vertical-align: 1px;
  background: var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--lime);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  align-items: center;
  gap: clamp(2rem, 7vw, 7rem);
  min-height: 520px;
  padding: clamp(3.5rem, 9vw, 7.5rem) 0 clamp(3rem, 7vw, 6rem);
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--cyan);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.2em;
}

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

h1,
h2 {
  letter-spacing: -0.045em;
}

h1 {
  max-width: 9ch;
  margin-bottom: 1.5rem;
  font-size: clamp(3.4rem, 7.2vw, 6.8rem);
  line-height: 0.9;
}

h1 em {
  color: var(--lime);
  font-style: normal;
}

.hero-lede {
  max-width: 30rem;
  margin-bottom: 2rem;
  color: var(--muted-strong);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.8;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.2rem;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

.hero-facts span {
  white-space: nowrap;
}

.hero-facts b {
  margin-right: 0.35rem;
  color: var(--lime);
  font-size: 0.62rem;
}

.hero-art {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px 4px 28px 4px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: rotate(1deg);
}

.hero-art::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(120deg, rgba(8, 29, 38, 0.25), transparent 44%, rgba(203, 243, 108, 0.12));
  mix-blend-mode: screen;
}

.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1672 / 941;
  object-fit: cover;
}

.hero-art figcaption {
  position: absolute;
  right: 1rem;
  bottom: 0.75rem;
  z-index: 1;
  max-width: 18rem;
  font-size: 0.6rem;
  text-align: right;
}

.lab-section,
.output-section {
  padding: clamp(2.5rem, 6vw, 5.5rem) 0;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  line-height: 1;
}

.section-explain {
  max-width: 22rem;
  margin: 0 0 0.15rem;
  font-size: 0.78rem;
  line-height: 1.65;
  text-align: right;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  background: var(--line);
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 68px;
  padding: 0.85rem 1.2rem;
  color: var(--muted);
  text-align: left;
  background: var(--panel-soft);
  border: 0;
}

.mode-tab:hover,
.mode-tab.is-active {
  color: var(--ink);
  background: rgba(24, 66, 75, 0.9);
}

.mode-tab.is-active {
  box-shadow: inset 0 -3px 0 var(--cyan);
}

.mode-tab strong,
.mode-tab small {
  display: block;
}

.mode-tab strong {
  font-size: 0.94rem;
}

.mode-tab small {
  margin-top: 0.25rem;
  font-size: 0.66rem;
}

.mode-number {
  color: var(--lime);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
  gap: 1.25rem;
  align-items: start;
}

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

.panel {
  min-width: 0;
  border-radius: 18px 3px 18px 3px;
}

.control-panel {
  padding: clamp(1rem, 2.5vw, 1.6rem);
}

.panel-heading {
  margin-bottom: 1.25rem;
}

.panel-heading .eyebrow {
  margin-bottom: 0.55rem;
}

.preset-row {
  padding: 0.9rem;
  border: 1px solid var(--line);
  background: rgba(5, 17, 26, 0.62);
}

.preset-row > label {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--muted-strong);
  font-size: 0.75rem;
  font-weight: 700;
}

.preset-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

.microcopy {
  margin: 0.6rem 0 0;
  font-size: 0.64rem;
  line-height: 1.5;
}

form {
  margin-top: 1.4rem;
}

.control-group {
  padding: 1rem 0 0.2rem;
  border-top: 1px solid var(--line);
}

.group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  color: var(--cyan);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.group-title small {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.field-grid {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.field-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-wide {
  grid-column: 1 / -1;
}

.field label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 1.2rem;
  margin-bottom: 0.35rem;
  color: var(--muted-strong);
  font-size: 0.7rem;
  font-weight: 700;
}

.field label span {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.7rem;
  color: var(--ink);
  font-size: 16px;
  background: rgba(4, 13, 21, 0.75);
  border: 1px solid var(--line);
  border-radius: 7px;
}

input:hover,
select:hover {
  border-color: rgba(100, 232, 220, 0.5);
}

select {
  appearance: none;
  padding-right: 2.2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--cyan) 50%), linear-gradient(135deg, var(--cyan) 50%, transparent 50%);
  background-position: calc(100% - 14px) 19px, calc(100% - 9px) 19px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(255, 147, 141, 0.12);
}

.field-error {
  display: block;
  min-height: 1.05rem;
  margin-top: 0.3rem;
  color: var(--danger);
  font-size: 0.63rem;
  line-height: 1.4;
}

.field-error[hidden] {
  display: block;
  visibility: hidden;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.65rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: var(--bg-deep);
  background: var(--cyan);
}

.button-primary:hover {
  background: #8df6ea;
}

.button-secondary {
  color: var(--cyan);
  background: rgba(100, 232, 220, 0.08);
  border-color: rgba(100, 232, 220, 0.42);
}

.button-secondary:hover {
  background: rgba(100, 232, 220, 0.16);
}

.button-quiet {
  color: var(--muted-strong);
  background: transparent;
  border-color: var(--line);
}

.button-quiet:hover {
  color: var(--ink);
  border-color: var(--line-bright);
}

.action-status {
  flex-basis: 100%;
  min-height: 1.1rem;
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.action-status[data-kind="success"] {
  color: var(--lime);
}

.action-status[data-kind="error"] {
  color: var(--danger);
}

.preview-panel {
  min-height: 100%;
  padding: clamp(1rem, 2.5vw, 1.6rem);
}

.preview-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.preview-meta {
  display: grid;
  gap: 0.2rem;
  font-size: 0.62rem;
  text-align: right;
}

.preview-meta b {
  color: var(--lime);
  font-size: 0.72rem;
}

.preview-viewport {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1rem;
  border: 1px solid rgba(100, 232, 220, 0.24);
  background-color: rgba(4, 14, 22, 0.9);
  background-image: linear-gradient(rgba(100, 232, 220, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(100, 232, 220, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  border-radius: 10px;
}

.preview-canvas {
  box-sizing: content-box;
  width: 768px;
  max-width: none;
  min-height: 246px;
  padding: 1rem;
}

.preview-layout {
  width: 100%;
  min-height: 214px;
  padding: 0;
  border: 0;
  outline: 1px dashed rgba(203, 243, 108, 0.55);
  background: rgba(23, 77, 83, 0.3);
}

.preview-item {
  display: flex;
  min-height: 72px;
  flex-direction: column;
  justify-content: center;
  padding: 0.9rem;
  overflow: hidden;
  color: var(--ink);
  background: linear-gradient(145deg, rgba(50, 150, 150, 0.82), rgba(21, 61, 72, 0.92));
  border: 1px solid rgba(100, 232, 220, 0.54);
  border-radius: 6px 2px 6px 2px;
  box-shadow: inset 0 0 22px rgba(100, 232, 220, 0.08);
}

.preview-item:nth-child(3n) {
  background: linear-gradient(145deg, rgba(111, 129, 54, 0.84), rgba(42, 72, 42, 0.95));
  border-color: rgba(203, 243, 108, 0.54);
}

.preview-item strong,
.preview-item small,
.item-index {
  display: block;
}

.item-index {
  margin-bottom: 0.3rem;
  color: var(--lime);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.preview-item strong {
  font-size: 0.77rem;
}

.preview-item small {
  margin-top: 0.25rem;
  color: rgba(238, 248, 247, 0.64);
  font-size: 0.58rem;
}

.overflow-notice {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  color: var(--orange);
  font-size: 0.68rem;
  background: rgba(255, 179, 107, 0.08);
  border: 1px solid rgba(255, 179, 107, 0.3);
  border-radius: 6px;
}

.preview-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.2rem;
  margin-top: 1rem;
  font-size: 0.61rem;
}

.legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.35rem;
  border-radius: 50%;
}

.legend-dot.cyan {
  background: var(--cyan);
}

.legend-dot.lime {
  background: var(--lime);
}

.legend-note {
  margin-left: auto;
}

.output-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding: 1rem;
}

.code-block {
  min-width: 0;
  max-height: 300px;
  margin: 0;
  padding: 1.1rem;
  overflow: auto;
  color: #d9fbf3;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.7;
  white-space: pre;
  background: rgba(3, 12, 19, 0.95);
  border: 1px solid rgba(100, 232, 220, 0.2);
  border-radius: 8px;
}

.output-actions {
  display: grid;
  gap: 0.55rem;
  min-width: 148px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  padding: clamp(2.5rem, 5vw, 4rem) 0;
}

.info-card {
  min-width: 0;
  padding: 1.25rem;
  border-radius: 12px 2px 12px 2px;
}

.info-card h2 {
  margin-bottom: 1rem;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.info-card p,
.info-card li {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.75;
}

.info-card p:last-child {
  margin-bottom: 0;
}

.info-card ol {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding-left: 1.1rem;
}

.info-card li {
  padding-left: 0.3rem;
}

.info-card li::marker {
  color: var(--lime);
  font-weight: 800;
}

.info-card li b,
.info-card li span {
  display: block;
}

.info-card li b {
  color: var(--muted-strong);
  font-size: 0.7rem;
}

.info-card li span {
  font-size: 0.65rem;
}

.info-card .article-index-link {
  margin-top: 1rem;
  font-size: 0.72rem;
}

.article-index-link a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 0.35rem;
  color: var(--cyan);
  text-underline-offset: 0.2em;
}

.site-footer {
  padding: 1.4rem 0 2.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
}

@media (max-width: 980px) {
  .hero {
    gap: 2rem;
  }

  .workbench {
    grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  }

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

@media (max-width: 760px) {
  .site-header {
    min-height: 68px;
  }

  .header-note {
    font-size: 0.6rem;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 3.5rem;
  }

  h1 {
    max-width: none;
  }

  .hero-art {
    max-width: 42rem;
    transform: rotate(0.5deg);
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.8rem;
  }

  .section-explain {
    margin-bottom: 0;
    text-align: left;
  }

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

  .preview-panel {
    order: -1;
  }

  .output-card {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 430px) {
  .app-shell {
    width: min(calc(100% - 24px), 1280px);
  }

  .header-note {
    max-width: 8rem;
    line-height: 1.3;
    text-align: right;
  }

  .hero {
    padding-top: 2.8rem;
  }

  h1 {
    font-size: clamp(3rem, 16vw, 4.6rem);
  }

  .hero-facts {
    display: grid;
    gap: 0.55rem;
  }

  .mode-tab {
    min-height: 62px;
    padding: 0.7rem;
  }

  .mode-number {
    display: none;
  }

  .control-panel,
  .preview-panel {
    padding: 0.9rem;
  }

  .field-grid.two-up {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .preset-actions,
  .output-actions {
    grid-template-columns: 1fr;
  }

  .form-actions .button-primary {
    flex: 1 0 100%;
  }

  .preview-viewport {
    padding: 0.55rem;
  }

  .preview-canvas {
    padding: 0.55rem;
  }

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

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.3rem;
  }
}

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

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

.hero h1 { word-break: auto-phrase; }
.hero-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 16px 0; padding-left: 1.25rem; }
.hero-steps li { padding-left: 2px; line-height: 1.45; }
.hero-cta { display: inline-flex; width: max-content; text-decoration: none; }

@media (max-width: 640px) {
  .hero { gap: 16px; padding-block: 20px 24px; }
  .hero h1 { font-size: clamp(1.65rem, 7.5vw, 2.4rem); line-height: 1.15; }
  .hero-lede { margin: 10px 0; font-size: .94rem; line-height: 1.5; }
  .hero-steps { grid-template-columns: 1fr; gap: 4px; margin: 8px 0 12px; }
  .hero-steps li { font-size: .88rem; }
  .hero-art { display: none; }
  .lab-section > .section-heading { gap: 8px; margin-bottom: 14px; }
  .lab-section > .section-heading .eyebrow { display: none; }
  .lab-section > .section-heading h2 { font-size: clamp(1.4rem, 6vw, 1.85rem); line-height: 1.15; }
  .lab-section > .section-heading .section-explain { margin-block: 0; font-size: .92rem; line-height: 1.5; }
}

/* stage A desktop compression */
@media (min-width: 761px) {
  .hero { min-height: 0; gap: clamp(24px, 4vw, 48px); padding: 28px 0 34px; }
  .hero h1 { font-size: clamp(2.2rem, 4vw, 3.5rem); line-height: 1.08; }
  .hero-lede { margin: 12px 0; font-size: 1rem; line-height: 1.5; }
  .hero-art img { max-height: 300px; }
  .hero-steps { gap: 7px; margin: 10px 0; font-size: .9rem; }
}
