.lab-page {
  --lab-border: #d3c4d9;
  --lab-accent: #64447a;
  --lab-ink: #322642;
  --lab-paper: #fcf8f2;
  --lab-result: #f0e9f2;
}

.lab-hero-showcase {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #a68bb1;
  border-radius: .6rem;
  background: #392b45;
}

.lab-mode-preview {
  --preview-paper: #e8d9ef;
  --preview-ink: #402b51;
  --preview-accent: #a78bb8;
  position: relative;
  min-height: clamp(9rem, 19vw, 14rem);
  display: grid;
  align-items: end;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(1rem, 4vw, 2rem);
  background: var(--preview-paper);
  color: var(--preview-ink);
}

.lab-mode-preview::before,
.lab-mode-preview::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 63%;
  aspect-ratio: 1;
  top: -55%;
  right: -9%;
  border: 1px solid var(--preview-accent);
  border-radius: 50%;
  box-shadow: 0 0 0 .95rem var(--preview-paper), 0 0 0 1rem var(--preview-accent), 0 0 0 2rem var(--preview-paper), 0 0 0 2.05rem var(--preview-accent);
}

.lab-mode-preview::after {
  top: auto;
  bottom: -123%;
  right: 59%;
}

.lab-mode-preview[data-theme="matrix"] { --preview-paper:#202d29; --preview-ink:#cbeeda; --preview-accent:#599775; }
.lab-mode-preview[data-theme="kawaii"] { --preview-paper:#f4dce9; --preview-ink:#6d3256; --preview-accent:#c283a7; }
.lab-mode-preview[data-theme="corporate"] { --preview-paper:#dfe8ef; --preview-ink:#2b4662; --preview-accent:#829bb9; }
.lab-mode-preview[data-theme="neon"] { --preview-paper:#2e2345; --preview-ink:#efcef8; --preview-accent:#b36fd3; }

.lab-mode-preview h2 {
  width: fit-content;
  max-width: 12ch;
  margin: 0;
  padding: .12em .17em;
  background: var(--preview-paper);
  font-size: clamp(1.95rem, 4.1vw, 3.7rem);
  line-height: .96;
}

.lab-mode-controls { padding: .95rem 1rem .7rem; }
.lab-mode-controls p { margin: 0 0 .5rem; }

.lab-button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
}

.lab-control {
  font: inherit;
  font-size: .9rem;
  font-weight: 680;
  min-height: 44px;
  max-width: 100%;
  padding: .48rem .7rem;
  border: 1px solid #ae96ba;
  border-radius: .4rem;
  background: #f5edf6;
  color: #442d54;
}

.lab-control:is(:hover, :active) {
  background: #e9daee;
  color: #362348;
}

.lab-control--primary,
.lab-mode-controls .lab-control[aria-pressed="true"] {
  border-color: var(--lab-accent);
  background: var(--lab-accent);
  color: #fff;
}

.lab-control--primary:is(:hover, :active),
.lab-mode-controls .lab-control[aria-pressed="true"]:hover {
  background: #4a315c;
  color: #fff;
}

.lab-mode-controls .lab-status { margin-top: .55rem; color: #ead9f2; }

.lab-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(.85rem, 2.55vw, 1.65rem);
}

.lab-card {
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.75rem);
  border: 1px solid var(--lab-border);
  border-radius: .55rem;
  background: var(--lab-paper);
}

.lab-card--wide { grid-column: 1 / -1; }
.lab-card h3 { margin: 0 0 .5rem; font-size: clamp(1.6rem, 3.35vw, 2.6rem); line-height: 1.05; }
.lab-card > p { margin: 0 0 .85rem; }

.lab-fields,
.lab-shop-grid {
  display: grid;
  gap: .7rem;
}

.lab-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: .85rem; }
.lab-fields label,
.lab-console-form label {
  display: grid;
  gap: .25rem;
  min-width: 0;
  font-size: .86rem;
  font-weight: 680;
}

.lab-fields select,
.lab-console-form input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .38rem .48rem;
  border: 1px solid #aa96b1;
  border-radius: .35rem;
  background: #fffaf5;
  color: var(--lab-ink);
  font: inherit;
  font-weight: 500;
}

.lab-card .lab-result {
  margin: .85rem 0 0;
  padding: .75rem;
  border-radius: .35rem;
  background: var(--lab-result);
  color: var(--lab-ink);
  white-space: pre-line;
}

.lab-status { margin: .65rem 0 0; font-size: .87rem; }
.lab-card .lab-status { margin-top: .65rem; }

.lab-comparison {
  --lab-split: 50%;
  display: grid;
  min-height: 11rem;
  overflow: hidden;
  border: 1px solid var(--lab-border);
  border-radius: .42rem;
}

.lab-comparison-layer {
  grid-area: 1 / 1;
  display: grid;
  align-content: center;
  justify-items: start;
  padding: clamp(.75rem, 3vw, 1.15rem);
  background: #e9e6e4;
  color: #292734;
}

.lab-comparison-layer strong { font: 660 clamp(1.45rem, 3.5vw, 2.35rem)/1.13 HaasA-Inter, sans-serif; }
.lab-comparison-layer p { margin: .15rem 0 .45rem; font-size: .86rem; }
.lab-comparison-layer span { padding: .25rem .42rem; border: 1px solid currentColor; font-size: .76rem; }
.lab-comparison-designed {
  clip-path: inset(0 calc(100% - var(--lab-split)) 0 0);
  background: #49365d;
  color: #fff6f1;
}
.lab-comparison-designed strong { font: 400 clamp(1.65rem, 4.25vw, 3rem)/1 HaasAStudySerif, Georgia, serif; }
.lab-comparison-designed span { border-radius: .4rem; background: #ebd7ef; color: #3a2846; }
.lab-range-label { display: flex; justify-content: space-between; gap: .3rem; margin-top: .65rem; font-size: .86rem; font-weight: 650; }
#baRange { width: 100%; min-height: 30px; accent-color: var(--lab-accent); }

.lab-shop-grid { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: start; gap: clamp(.85rem, 2.5vw, 1.65rem); }
.lab-product-preview {
  display: grid;
  place-items: center;
  min-height: 12rem;
  padding: 1rem;
  border-radius: .42rem;
  background: #eee4f1;
}

.lab-hoodie {
  --fabric: #32303a;
  display: grid;
  place-items: center;
  width: min(100%, 16rem);
  aspect-ratio: 1.4;
  clip-path: polygon(21% 20%, 39% 15%, 42% 3%, 58% 3%, 61% 15%, 79% 20%, 98% 62%, 79% 70%, 73% 49%, 73% 96%, 27% 96%, 27% 49%, 21% 70%, 2% 62%);
  background: linear-gradient(110deg, #ffffff19, transparent 40%, #00000029), var(--fabric);
  color: #fff8f1;
  font-weight: 760;
  font-size: clamp(.7rem, 2.2vw, .95rem);
  text-align: center;
}

.lab-hoodie[data-color="gruen"] { --fabric: #2b585b; }
.lab-hoodie[data-color="pink"] { --fabric: #773658; }
.lab-hoodie[data-color="blau"] { --fabric: #304880; }
.lab-shop-price { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .45rem; }
.lab-shop-price strong { white-space: nowrap; }
.lab-card .lab-shop-price { margin-bottom: .65rem; }

.lab-output-list {
  max-height: 13rem;
  overflow: auto;
  margin: .65rem 0 0;
  padding: .38rem .65rem;
  border: 1px solid var(--lab-border);
  border-radius: .35rem;
  background: #f7eff5;
  list-style: none;
  font-size: .85rem;
}
.lab-output-list li { padding: .32rem 0; overflow-wrap: anywhere; }
.lab-output-list li + li { border-top: 1px solid var(--lab-border); }

.lab-flow {
  display: grid;
  gap: .4rem;
  padding: 0;
  margin: .65rem 0 .85rem;
  list-style-position: inside;
  font-size: .88rem;
}

.lab-flow li {
  padding: .38rem .55rem;
  border: 1px solid var(--lab-border);
  border-radius: .38rem;
  background: #f7eff5;
}

.lab-flow li.is-done { border-color: #9c83aa; }
.lab-flow li[aria-current="step"] { border-color: #563a6a; background: #563a6a; color: #fff; }

.lab-console { padding: .85rem; border-radius: .42rem; background: #2b2034; color: #f8eef9; }
.lab-console a { color: #f0d7fa; }
#consoleOutput {
  min-height: 5rem;
  max-height: 13rem;
  overflow: auto;
  margin-bottom: .75rem;
  font: .9rem/1.5 ui-monospace, monospace;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
#consoleOutput p { margin: .3rem 0; }
.lab-console-form { display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: end; gap: .6rem; }
.lab-console-form button { min-width: 6rem; }

.lab-game-art {
  position: relative;
  height: clamp(7rem, 17vw, 12rem);
  isolation: isolate;
  overflow: hidden;
  border-radius: .5rem .5rem 0 0;
  background: #392b49;
}
.lab-game-art::before,
.lab-game-art::after { content: ""; position: absolute; }
.lab-game-art--runner::before {
  width: 110%;
  height: 75%;
  left: -5%;
  bottom: -29%;
  border: 1px solid #c2add2;
  background: repeating-linear-gradient(90deg, transparent 0 3.35rem, #8b719f 3.35rem 3.42rem);
  transform: rotate(-12deg);
}
.lab-game-art--runner::after {
  width: 1.1rem;
  aspect-ratio: 1;
  top: 33%;
  left: 36%;
  background: #f1d7f0;
  transform: rotate(-12deg);
  box-shadow: 4.7rem 2.5rem 0 -.16rem #d3b7e0, 8rem 1.8rem 0 -.22rem #aa8ebd;
}
.lab-game-art--orbit { background: #e9def0; }
.lab-game-art--orbit::before {
  right: 15%;
  top: -8%;
  width: 44%;
  aspect-ratio: 1;
  border: 1px solid #8e739f;
  border-radius: 50%;
  box-shadow: 0 0 0 1.2rem #e9def0, 0 0 0 1.25rem #bba8c7;
}
.lab-game-art--orbit::after {
  width: 2rem;
  height: 3.2rem;
  top: 41%;
  right: 39%;
  clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
  transform: rotate(38deg);
  background: #65487b;
}

@media (max-width: 820px) {
  .lab-tools, .lab-shop-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 550px) {
  .lab-fields { grid-template-columns: minmax(0, 1fr); }
  .lab-console-form { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .lab-console-form label { width: 100%; }
}
