@font-face {
  font-family: "Space Grotesk";
  src: url("../assets/fonts/space-grotesk-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #07100e;
  --bg-deep: #040a08;
  --surface: #0d1815;
  --surface-2: #111e1a;
  --surface-3: #16251f;
  --panel: rgba(11, 22, 18, 0.94);
  --line: rgba(177, 226, 198, 0.12);
  --line-strong: rgba(177, 226, 198, 0.22);
  --text: #eff8f1;
  --muted: #8fa89a;
  --muted-2: #60796d;
  --mint: #62e4aa;
  --mint-bright: #9df8cf;
  --cyan: #7fe8f2;
  --amber: #f2c35d;
  --danger: #ff806f;
  --success: #55d99c;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
  --font: "Space Grotesk", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 46% -15%, rgba(43, 120, 87, 0.17), transparent 35%),
    linear-gradient(150deg, #08130f 0%, #050b09 68%);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
select,
input[type="range"],
input[type="color"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

svg {
  display: block;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: -60px;
  left: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #07100e;
  background: var(--mint-bright);
  font-weight: 700;
  transition: top 160ms ease;
}

.skip-link:focus {
  top: 12px;
}

.app-shell {
  display: grid;
  grid-template-rows: 70px minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

.topbar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  min-width: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 14, 11, 0.88);
  backdrop-filter: blur(24px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: max-content;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(119, 241, 183, 0.3);
  border-radius: 11px;
  color: var(--mint);
  background:
    linear-gradient(145deg, rgba(70, 194, 137, 0.17), rgba(29, 66, 51, 0.04)),
    #0d1c17;
  box-shadow: inset 0 0 18px rgba(95, 230, 168, 0.06), 0 9px 24px rgba(0, 0, 0, 0.25);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
  stroke-width: 1.9;
}

.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-product {
  font-size: 0.98rem;
  font-weight: 680;
  letter-spacing: -0.025em;
}

.brand-context {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.69rem;
  letter-spacing: 0.035em;
}

.topbar-center {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #dcebe0;
  background: rgba(17, 31, 26, 0.8);
  font-size: 0.75rem;
  white-space: nowrap;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(98, 228, 170, 0.09), 0 0 13px rgba(98, 228, 170, 0.44);
}

.topbar-divider {
  width: 1px;
  height: 14px;
  margin-inline: 2px;
  background: var(--line-strong);
}

.topbar-muted {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  transition: 150ms ease;
  transition-property: background-color, border-color, color, transform;
}

.button {
  gap: 8px;
  padding: 0 14px;
  font-size: 0.78rem;
  font-weight: 650;
}

.button svg {
  width: 16px;
  height: 16px;
}

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

.button-secondary,
.icon-button {
  border-color: var(--line);
  background: #101d19;
}

.button-secondary:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  background: #15251f;
}

.button-primary {
  color: #07130e;
  border-color: #72efb7;
  background: linear-gradient(180deg, #8af3c1 0%, #5edca4 100%);
  box-shadow: 0 8px 26px rgba(69, 213, 148, 0.18);
}

.button-primary:hover {
  background: linear-gradient(180deg, #a0f9d0 0%, #6fe9b1 100%);
}

.icon-button {
  width: 38px;
  padding: 0;
  color: var(--muted);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.workspace {
  display: grid;
  grid-template-columns: 246px minmax(460px, 1fr) 330px;
  min-width: 0;
  min-height: 0;
}

.panel,
.stage-panel {
  min-width: 0;
  min-height: 0;
}

.panel {
  background: var(--panel);
}

.library-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
}

.panel-scroll,
.inspector-scroll {
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(145, 189, 166, 0.2) transparent;
}

.panel-scroll::-webkit-scrollbar,
.inspector-scroll::-webkit-scrollbar {
  width: 6px;
}

.panel-scroll::-webkit-scrollbar-thumb,
.inspector-scroll::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: rgba(145, 189, 166, 0.18);
}

.panel-section {
  padding: 22px 17px;
  border-top: 1px solid var(--line);
}

.panel-section-first {
  border-top: 0;
}

.section-heading,
.subsection-heading,
.inspector-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading {
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: #76caa3;
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1,
h2 {
  margin-bottom: 0;
  font-weight: 620;
  letter-spacing: -0.035em;
}

h1 {
  font-size: 1.04rem;
}

h2 {
  font-size: 1rem;
}

.count-badge,
.live-badge {
  display: inline-grid;
  place-items: center;
  min-width: 29px;
  height: 23px;
  padding-inline: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(24, 42, 35, 0.68);
  font-family: var(--mono);
  font-size: 0.6rem;
}

.specimen-list {
  display: grid;
  gap: 7px;
}

.specimen-card {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  width: 100%;
  padding: 9px 9px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  transition: 150ms ease;
}

.specimen-card:hover {
  color: #dce9df;
  background: rgba(30, 53, 43, 0.48);
}

.specimen-card.is-active {
  color: var(--text);
  border-color: rgba(101, 230, 171, 0.28);
  background:
    linear-gradient(90deg, rgba(63, 182, 127, 0.14), rgba(17, 32, 26, 0.52)),
    #112019;
  box-shadow: inset 2px 0 0 var(--mint);
}

.specimen-copy {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.specimen-copy strong {
  overflow: hidden;
  font-size: 0.76rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.specimen-copy small {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 0.6rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-active .specimen-copy small {
  color: #83a895;
}

.specimen-index {
  align-self: start;
  padding-top: 3px;
  color: #4e6c5e;
  font-family: var(--mono);
  font-size: 0.51rem;
}

.specimen-visual {
  position: relative;
  display: block;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(130, 199, 164, 0.13);
  border-radius: 8px;
  background: radial-gradient(circle, rgba(63, 147, 105, 0.18), rgba(10, 20, 16, 0.1));
}

.specimen-visual i,
.specimen-visual b {
  position: absolute;
  display: block;
  box-sizing: border-box;
}

.specimen-bloom b {
  top: 17px;
  left: 17px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.specimen-bloom i {
  top: 7px;
  left: 17px;
  width: 8px;
  height: 13px;
  border-radius: 80% 80% 45% 45%;
  background: #68c891;
  transform-origin: 4px 14px;
}

.specimen-bloom i:nth-child(2) { transform: rotate(60deg); }
.specimen-bloom i:nth-child(3) { transform: rotate(120deg); }
.specimen-bloom i:nth-child(4) { transform: rotate(180deg); }
.specimen-bloom i:nth-child(5) { transform: rotate(240deg); }
.specimen-bloom i:nth-child(6) { transform: rotate(300deg); }

.specimen-fruit b,
.specimen-canopy b {
  left: 20px;
  bottom: 5px;
  width: 2px;
  height: 30px;
  border-radius: 2px;
  background: #5fb883;
}

.specimen-fruit i {
  width: 12px;
  height: 13px;
  border-radius: 47% 53% 55% 45%;
  background: #d5ae4f;
  box-shadow: inset -2px -2px rgba(68, 42, 14, 0.2);
}

.specimen-fruit i:nth-child(1) { top: 7px; left: 8px; }
.specimen-fruit i:nth-child(2) { top: 12px; right: 6px; transform: scale(.88); }
.specimen-fruit i:nth-child(3) { top: 21px; left: 13px; transform: scale(.78); }

.specimen-canopy i {
  width: 17px;
  height: 7px;
  border-radius: 80% 20% 80% 20%;
  background: #57ae7d;
}

.specimen-canopy i:nth-child(1) { top: 8px; left: 4px; transform: rotate(24deg); }
.specimen-canopy i:nth-child(2) { top: 13px; right: 3px; transform: scaleX(-1) rotate(24deg); }
.specimen-canopy i:nth-child(3) { top: 22px; left: 5px; transform: rotate(18deg); }
.specimen-canopy i:nth-child(4) { top: 27px; right: 4px; transform: scaleX(-1) rotate(18deg); }

.specimen-benchmark b {
  right: 4px;
  bottom: 4px;
  left: 4px;
  height: 4px;
  border-radius: 1px;
  background: #dae5de;
}

.specimen-benchmark i {
  bottom: 8px;
  width: 7px;
  height: 7px;
  border: 2px solid #73c797;
  border-radius: 50%;
}

.specimen-benchmark i::after {
  position: absolute;
  top: 6px;
  left: 1px;
  width: 1px;
  height: 10px;
  content: "";
  background: #5bac7d;
}

.specimen-benchmark i:nth-child(1) { left: 5px; transform: scale(.7); transform-origin: bottom; }
.specimen-benchmark i:nth-child(2) { left: 13px; transform: scale(.82); transform-origin: bottom; }
.specimen-benchmark i:nth-child(3) { left: 23px; transform: scale(.92); transform-origin: bottom; }
.specimen-benchmark i:nth-child(4) { right: 4px; }

.specimen-soybean b,
.specimen-potato b,
.specimen-tomato b {
  left: 20px;
  bottom: 4px;
  width: 2px;
  height: 33px;
  border-radius: 2px;
  background: #5fb883;
}

.specimen-soybean i {
  width: 13px;
  height: 7px;
  border-radius: 75% 25% 75% 25%;
  background: #63bb85;
}

.specimen-soybean i:nth-child(1) { top: 6px; left: 14px; transform: rotate(-78deg); }
.specimen-soybean i:nth-child(2) { top: 11px; left: 4px; transform: rotate(22deg); }
.specimen-soybean i:nth-child(3) { top: 11px; right: 3px; transform: scaleX(-1) rotate(22deg); }
.specimen-soybean i:nth-child(4) {
  top: 24px;
  right: 6px;
  width: 11px;
  height: 5px;
  border-radius: 60% 30% 60% 30%;
  background: #c6a64c;
  transform: rotate(70deg);
}

.specimen-potato i {
  width: 11px;
  height: 7px;
  border-radius: 70% 30% 70% 30%;
  background: #59ad79;
}

.specimen-potato i:nth-child(1) { top: 8px; left: 6px; transform: rotate(22deg); }
.specimen-potato i:nth-child(2) { top: 9px; right: 5px; transform: scaleX(-1) rotate(22deg); }
.specimen-potato i:nth-child(3) { top: 19px; left: 7px; transform: rotate(17deg) scale(.86); }
.specimen-potato i:nth-child(4) { top: 20px; right: 6px; transform: scaleX(-.86) rotate(17deg); }
.specimen-potato i:nth-child(5) {
  top: 4px;
  left: 18px;
  width: 7px;
  height: 7px;
  border: 2px solid #e6e8dc;
  border-radius: 50%;
  background: #d8b955;
}

.specimen-tomato i {
  width: 10px;
  height: 10px;
  border-radius: 48% 52% 55% 45%;
  background: #de7954;
  box-shadow: inset -2px -2px rgba(77, 23, 13, 0.2);
}

.specimen-tomato i:nth-child(1) { top: 9px; right: 5px; }
.specimen-tomato i:nth-child(2) { top: 19px; right: 10px; transform: scale(.88); }
.specimen-tomato i:nth-child(3) { top: 27px; right: 3px; transform: scale(.76); }
.specimen-tomato i:nth-child(4) {
  top: 11px;
  left: 3px;
  width: 15px;
  height: 7px;
  border-radius: 75% 25% 75% 25%;
  background: #5aae7a;
  box-shadow: none;
  transform: rotate(22deg);
}

.compact-heading {
  align-items: flex-end;
}

.auto-save-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-2);
  font-size: 0.51rem;
  white-space: nowrap;
}

.auto-save-label span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
}

.field-label,
.select-field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 550;
  letter-spacing: 0.015em;
}

.text-field-wrap {
  position: relative;
}

.text-field-wrap input,
.select-field select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #dfece3;
  background: #0a1511;
  font-size: 0.68rem;
}

.text-field-wrap input {
  padding: 0 45px 0 10px;
}

.text-field-wrap input:focus,
.select-field select:focus {
  border-color: rgba(98, 228, 170, 0.46);
}

.field-suffix {
  position: absolute;
  top: 50%;
  right: 9px;
  color: #587367;
  font-family: var(--mono);
  font-size: 0.5rem;
  transform: translateY(-50%);
}

.field-grid,
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.select-field select {
  padding: 0 25px 0 9px;
}

.full-field {
  display: block;
  margin-top: 12px;
}

.library-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 17px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(7, 15, 12, 0.86);
}

.privacy-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #70c99c;
}

.privacy-icon svg {
  width: 14px;
  height: 14px;
}

.library-footer > span:last-child {
  display: grid;
  gap: 2px;
}

.library-footer strong {
  color: #cfe0d5;
  font-size: 0.65rem;
  font-weight: 600;
}

.library-footer small {
  color: var(--muted-2);
  font-size: 0.55rem;
}

.stage-panel {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) 72px;
  overflow: hidden;
  background: #08110e;
}

.stage-toolbar {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 0 15px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 19, 15, 0.84);
}

.target-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.target-number {
  padding: 5px 7px;
  border: 1px solid rgba(96, 226, 170, 0.21);
  border-radius: 5px;
  color: var(--mint);
  background: rgba(52, 146, 103, 0.1);
  font-family: var(--mono);
  font-size: 0.57rem;
  white-space: nowrap;
}

.target-identity > span:last-child {
  display: grid;
  min-width: 0;
}

.target-identity strong {
  overflow: hidden;
  font-size: 0.73rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-identity small {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 0.55rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segmented-control {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #09130f;
}

.segmented-control button {
  display: grid;
  width: 31px;
  height: 29px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 5px;
  color: #607c6e;
  background: transparent;
}

.segmented-control button:hover {
  color: #b8d4c4;
}

.segmented-control button.is-active {
  color: var(--mint-bright);
  background: #1b3429;
  box-shadow: inset 0 0 0 1px rgba(104, 229, 173, 0.14);
}

.segmented-control svg {
  width: 15px;
  height: 15px;
}

.stage-tool-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.tool-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 31px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #6e887b;
  background: #0b1612;
  font-size: 0.58rem;
}

.tool-toggle:hover,
.tool-toggle.is-active {
  color: #c5e6d4;
  border-color: rgba(119, 209, 167, 0.23);
  background: #13241d;
}

.tool-toggle svg {
  width: 13px;
  height: 13px;
}

.viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 43%, rgba(40, 100, 74, 0.16), transparent 34%),
    linear-gradient(rgba(133, 204, 168, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(133, 204, 168, 0.025) 1px, transparent 1px),
    #07100d;
  background-size: auto, 30px 30px, 30px 30px, auto;
}

.viewport::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: "";
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 4, 2, 0.46) 100%);
}

#sceneCanvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: 0;
  touch-action: none;
}

.viewport-loading,
.viewport-error {
  position: absolute;
  z-index: 15;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
  background: #07100d;
  font-size: 0.7rem;
  transition: opacity 260ms ease;
}

.viewport-loading.is-complete {
  opacity: 0;
}

.viewport-loading[hidden],
.viewport-error[hidden] {
  display: none;
}

.loading-orbit {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(95, 228, 167, 0.2);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: orbit 900ms linear infinite;
  box-shadow: inset 0 0 15px rgba(74, 215, 151, 0.08);
}

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

.viewport-error {
  padding: 20px;
  color: #d9e7de;
  text-align: center;
}

.viewport-error span {
  max-width: 360px;
  color: var(--muted);
}

.axis-widget {
  position: absolute;
  z-index: 4;
  top: 17px;
  right: 17px;
  width: 58px;
  height: 58px;
  pointer-events: none;
  color: #708e80;
  font-family: var(--mono);
  font-size: 0.48rem;
}

.axis-widget i {
  position: absolute;
  top: 29px;
  left: 28px;
  width: 5px;
  height: 5px;
  border: 1px solid #749585;
  border-radius: 50%;
}

.axis-widget::before,
.axis-widget::after {
  position: absolute;
  top: 31px;
  left: 31px;
  width: 23px;
  height: 1px;
  content: "";
  transform-origin: left;
  background: #497064;
}

.axis-widget::after { transform: rotate(-150deg); }
.axis-widget .axis-z { position: absolute; top: 1px; left: 29px; color: var(--mint); }
.axis-widget .axis-x { position: absolute; right: 0; bottom: 19px; color: #ef8778; }
.axis-widget .axis-y { position: absolute; bottom: 5px; left: 2px; color: var(--cyan); }

.axis-widget .axis-z::after {
  position: absolute;
  top: 10px;
  left: 2px;
  width: 1px;
  height: 20px;
  content: "";
  background: #4b8a6c;
}

.dimension-hud {
  position: absolute;
  z-index: 5;
  top: 17px;
  left: 17px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(6, 14, 11, 0.74);
  backdrop-filter: blur(12px);
}

.dimension-hud[hidden] {
  display: none;
}

.dimension-hud span {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  border-left: 1px solid var(--line);
}

.dimension-hud span:first-child {
  border-left: 0;
}

.dimension-hud small {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.49rem;
}

.dimension-hud strong {
  color: #c2d7ca;
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 500;
}

.view-hint {
  position: absolute;
  z-index: 5;
  bottom: 18px;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #7b9588;
  background: rgba(6, 14, 11, 0.74);
  font-size: 0.56rem;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  transition: opacity 180ms ease;
}

.view-hint.is-hidden {
  opacity: 0;
}

.view-hint svg {
  width: 13px;
  height: 13px;
}

.bed-badge {
  position: absolute;
  z-index: 5;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 192px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 14, 11, 0.78);
  backdrop-filter: blur(13px);
}

.bed-icon {
  width: 23px;
  height: 23px;
  border: 1px solid #426c5b;
  border-radius: 3px;
  background:
    linear-gradient(rgba(100, 180, 142, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 180, 142, 0.12) 1px, transparent 1px);
  background-size: 5px 5px;
  transform: perspective(40px) rotateX(50deg) rotateZ(-12deg);
}

.bed-badge > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.bed-badge strong {
  font-size: 0.59rem;
  font-weight: 590;
}

.bed-badge small {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.49rem;
}

.fit-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  color: var(--success);
  font-size: 0.54rem;
}

.fit-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.fit-status.is-error {
  color: var(--danger);
}

.stage-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(120px, 1.2fr);
  border-top: 1px solid var(--line);
  background: rgba(8, 18, 14, 0.98);
}

.stage-metrics article {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px 12px;
  border-left: 1px solid var(--line);
}

.stage-metrics article:first-child {
  border-left: 0;
}

.stage-metrics article > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.stage-metrics small {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 0.5rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-metrics strong {
  overflow: hidden;
  color: #d6e8dc;
  font-family: var(--mono);
  font-size: 0.67rem;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-icon {
  position: relative;
  display: grid;
  flex: 0 0 29px;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #5fc492;
  background: #0e1d17;
}

.metric-icon-organ i {
  width: 15px;
  height: 9px;
  border: 1px solid currentColor;
  border-radius: 90% 10% 90% 10%;
  transform: rotate(-20deg);
}

.metric-icon-part i {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  transform: rotate(30deg);
}

.metric-icon-part i:nth-child(1) { top: 6px; left: 7px; }
.metric-icon-part i:nth-child(2) { top: 6px; right: 6px; }
.metric-icon-part i:nth-child(3) { bottom: 5px; left: 11px; }

.metric-icon-triangle::before {
  width: 0;
  height: 0;
  border-right: 8px solid transparent;
  border-bottom: 14px solid currentColor;
  border-left: 8px solid transparent;
  content: "";
  opacity: .8;
}

.metric-icon-volume i {
  width: 13px;
  height: 13px;
  border: 1px solid currentColor;
  transform: rotate(30deg) skewY(-14deg);
}

.confidence-card {
  background: linear-gradient(90deg, rgba(30, 76, 56, 0.12), transparent);
}

.confidence-ring {
  --confidence: 345deg;
  position: relative;
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--mint) var(--confidence), #1d3028 0);
}

.confidence-ring::before {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  content: "";
  background: #0d1b16;
}

.confidence-ring b {
  position: relative;
  z-index: 1;
  color: #c9ebd8;
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 600;
}

.inspector-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-left: 1px solid var(--line);
}

.inspector-heading {
  min-height: 66px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.live-badge {
  color: var(--mint);
  border-color: rgba(90, 224, 163, 0.22);
  background: rgba(63, 168, 120, 0.1);
}

.inspector-section {
  padding: 17px 16px;
  border-top: 1px solid var(--line);
}

.inspector-section:first-child {
  border-top: 0;
}

.subsection-heading {
  margin-bottom: 14px;
}

.subsection-heading > span {
  color: #c6d9cd;
  font-size: 0.67rem;
  font-weight: 610;
}

.subsection-heading small {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.48rem;
}

.subsection-heading button {
  padding: 0;
  border: 0;
  color: #79cfa5;
  background: none;
  font-size: 0.54rem;
}

.parameter-controls {
  display: grid;
  gap: 15px;
}

.parameter-row {
  display: grid;
  gap: 8px;
}

.parameter-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.parameter-label {
  color: #b1c7ba;
  font-size: 0.62rem;
}

.parameter-value {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.55rem;
}

.parameter-row input[type="range"] {
  --range-progress: 50%;
  width: 100%;
  height: 14px;
  margin: 0;
  appearance: none;
  background: transparent;
}

.parameter-row input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint) 0 var(--range-progress), #23372f var(--range-progress) 100%);
}

.parameter-row input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint) 0 var(--range-progress), #23372f var(--range-progress) 100%);
}

.parameter-row input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -5px;
  border: 2px solid #06110d;
  border-radius: 50%;
  appearance: none;
  background: var(--mint-bright);
  box-shadow: 0 0 0 1px rgba(120, 238, 188, 0.26), 0 0 9px rgba(80, 218, 157, 0.18);
}

.parameter-row input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 2px solid #06110d;
  border-radius: 50%;
  background: var(--mint-bright);
}

.parameter-hint {
  color: var(--muted-2);
  font-size: 0.52rem;
  line-height: 1.4;
}

.palette-list {
  display: grid;
  gap: 6px;
}

.palette-row {
  display: grid;
  grid-template-columns: 26px 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 18, 14, 0.68);
}

.palette-slot {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #789486;
  font-family: var(--mono);
  font-size: 0.48rem;
}

.palette-swatch {
  position: relative;
  display: block;
  width: 27px;
  height: 27px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: var(--swatch-color);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.palette-swatch input {
  position: absolute;
  inset: -8px;
  width: 44px;
  height: 44px;
  padding: 0;
  opacity: 0;
}

.palette-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.palette-copy strong {
  overflow: hidden;
  font-size: 0.58rem;
  font-weight: 590;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-copy small {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 0.48rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-row code {
  color: #607d6e;
  font-family: var(--mono);
  font-size: 0.46rem;
}

.side-band-control {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(101, 221, 167, 0.17);
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(37, 101, 73, 0.12), rgba(7, 16, 13, 0.8));
}

.side-band-heading {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.side-band-heading > span:last-child {
  display: grid;
  gap: 2px;
}

.side-band-heading strong {
  color: #d4e7dc;
  font-size: 0.61rem;
  font-weight: 610;
}

.side-band-heading small {
  color: var(--muted-2);
  font-size: 0.49rem;
  line-height: 1.35;
}

.side-band-icon {
  --band-color: #fcd62b;
  --lettering-color: #17171c;
  position: relative;
  display: block;
  width: 32px;
  height: 27px;
  border: 2px solid var(--band-color);
  border-top-color: rgba(244, 244, 240, 0.8);
  border-radius: 5px;
  background: rgba(244, 244, 240, 0.08);
  box-shadow: inset 0 -5px var(--band-color), 0 0 0 1px rgba(0, 0, 0, 0.28);
}

.side-band-icon i {
  position: absolute;
  right: 5px;
  bottom: 2px;
  width: 10px;
  height: 2px;
  border-radius: 1px;
  background: var(--lettering-color);
}

.side-band-control .full-field {
  margin-top: 10px;
}

.side-band-contrast {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  margin: 7px 0 0;
  color: #84bfa1;
  font-size: 0.49rem;
  line-height: 1.35;
}

.side-band-contrast::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 7px rgba(74, 200, 137, 0.35);
  content: "";
}

.side-band-contrast.is-warning {
  color: #d7ba79;
}

.side-band-contrast.is-warning::before {
  background: #e3b95d;
  box-shadow: 0 0 7px rgba(227, 185, 93, 0.3);
}

.assembly-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(99, 221, 164, 0.17);
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(64, 177, 126, 0.1), rgba(7, 18, 13, 0.7));
}

.assembly-symbol {
  position: relative;
  display: block;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(107, 225, 171, 0.2);
  border-radius: 8px;
  background: rgba(10, 28, 20, 0.84);
}

.assembly-symbol i,
.assembly-symbol b {
  position: absolute;
  top: 13px;
  width: 13px;
  height: 10px;
  border: 2px solid #66d99f;
}

.assembly-symbol i {
  left: 4px;
  border-right: 0;
  border-radius: 4px 0 0 4px;
}

.assembly-symbol b {
  right: 4px;
  border-left-color: #0a1c14;
  border-radius: 0 4px 4px 0;
  box-shadow: -4px 0 0 -2px #66d99f;
}

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

.assembly-copy strong {
  color: #cce1d4;
  font-size: 0.61rem;
  font-weight: 620;
}

.assembly-copy small {
  color: var(--muted);
  font-size: 0.5rem;
  line-height: 1.4;
}

.assembly-specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 9px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.assembly-specs div {
  display: grid;
  gap: 3px;
  padding: 8px 7px;
  border-left: 1px solid var(--line);
}

.assembly-specs div:first-child {
  border-left: 0;
}

.assembly-specs dt,
.assembly-specs dd {
  margin: 0;
}

.assembly-specs dt {
  color: var(--muted-2);
  font-size: 0.44rem;
  text-transform: uppercase;
}

.assembly-specs dd {
  overflow: hidden;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.49rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assembly-preview-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 34px;
  margin-top: 9px;
  border: 1px solid rgba(100, 220, 165, 0.2);
  border-radius: 8px;
  color: #8edbb5;
  background: rgba(49, 139, 99, 0.08);
  font-size: 0.54rem;
  font-weight: 620;
}

.assembly-preview-button:hover,
.assembly-preview-button.is-active {
  color: #07140e;
  border-color: #6ce7ad;
  background: linear-gradient(180deg, #8af3c1, #5edca4);
}

.assembly-preview-button svg {
  width: 14px;
  height: 14px;
}

.print-section .recipe-grid {
  margin-top: 0;
}

.strength-recipe {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(112, 231, 176, 0.2);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(55, 142, 100, 0.14), rgba(17, 43, 32, 0.08));
}

.strength-recipe-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(112, 231, 176, 0.36);
  border-radius: 7px;
  color: #72e8b2;
  background: rgba(65, 201, 141, 0.12);
  font-size: 0.72rem;
  font-weight: 760;
}

.strength-recipe strong,
.strength-recipe small {
  display: block;
}

.strength-recipe strong {
  color: #e2f2e9;
  font-size: 0.58rem;
}

.strength-recipe small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.48rem;
  line-height: 1.42;
}

.calibration-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(100, 220, 165, 0.16);
  border-radius: 8px;
  color: #dcebe2;
  background: rgba(38, 108, 78, 0.07);
  cursor: pointer;
}

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

.calibration-option-control {
  position: relative;
  width: 28px;
  height: 16px;
  border: 1px solid #365b4b;
  border-radius: 999px;
  background: #0a1511;
  transition: 150ms ease;
}

.calibration-option-control::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #71887d;
  content: "";
  transition: 150ms ease;
}

.calibration-option input:checked + .calibration-option-control {
  border-color: #61daa5;
  background: rgba(70, 196, 137, 0.26);
}

.calibration-option input:checked + .calibration-option-control::after {
  left: 14px;
  background: #70e7b0;
}

.calibration-option input:focus-visible + .calibration-option-control {
  outline: 2px solid rgba(112, 231, 176, 0.5);
  outline-offset: 2px;
}

.calibration-option strong,
.calibration-option small {
  display: block;
}

.calibration-option strong {
  font-size: 0.58rem;
}

.calibration-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.5rem;
  line-height: 1.35;
}

.validation-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.validation-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.validation-status {
  display: grid;
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  place-items: center;
  border: 1px solid rgba(83, 216, 153, 0.22);
  border-radius: 50%;
  color: var(--success);
  background: rgba(66, 182, 125, 0.08);
}

.validation-status svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.2;
}

.validation-item.is-warn .validation-status {
  color: var(--amber);
  border-color: rgba(242, 195, 93, 0.24);
  background: rgba(242, 195, 93, 0.08);
}

.validation-item.is-error .validation-status {
  color: var(--danger);
  border-color: rgba(255, 128, 111, 0.24);
  background: rgba(255, 128, 111, 0.08);
}

.validation-item > span:last-child {
  display: grid;
  gap: 2px;
}

.validation-item strong {
  color: #bcd1c4;
  font-size: 0.56rem;
  font-weight: 580;
}

.validation-item small {
  color: var(--muted-2);
  font-size: 0.49rem;
  line-height: 1.3;
}

.generate-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 65px;
  margin: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(117, 240, 184, 0.4);
  border-radius: 10px;
  color: #08130e;
  text-align: left;
  background: linear-gradient(135deg, #9bf6ca 0%, #5ddba3 100%);
  box-shadow: 0 13px 32px rgba(63, 203, 139, 0.16);
}

.generate-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.generate-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(6, 41, 25, 0.17);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
}

.generate-icon svg {
  width: 19px;
  height: 19px;
}

.generate-button > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.generate-button strong {
  font-size: 0.68rem;
  font-weight: 700;
}

.generate-button small {
  overflow: hidden;
  color: rgba(5, 41, 23, 0.68);
  font-size: 0.49rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button-arrow {
  width: 17px;
  height: 17px;
}

.is-busy {
  pointer-events: none;
}

.is-busy .generate-icon,
.button.is-busy svg {
  animation: orbit 850ms linear infinite;
}

dialog {
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

dialog::backdrop {
  background: rgba(1, 7, 4, 0.74);
  backdrop-filter: blur(10px);
}

.dialog-card {
  position: relative;
  width: min(660px, calc(100vw - 30px));
  max-height: min(840px, calc(100vh - 30px));
  padding: 28px;
  overflow: auto;
  border: 1px solid rgba(148, 213, 180, 0.2);
  border-radius: 16px;
  background:
    radial-gradient(circle at 94% 3%, rgba(82, 215, 151, 0.12), transparent 27%),
    #0b1612;
  box-shadow: 0 32px 110px rgba(0, 0, 0, 0.64);
}

.dialog-card-small {
  width: min(570px, calc(100vw - 30px));
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #101e19;
}

.dialog-close svg {
  width: 14px;
  height: 14px;
}

.dialog-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  color: var(--mint);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.export-cube {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgba(103, 227, 170, 0.26);
  border-radius: 8px;
  background: rgba(60, 178, 124, 0.1);
}

.export-cube svg {
  width: 17px;
  height: 17px;
}

.dialog-card h2 {
  max-width: 520px;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  font-weight: 560;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.dialog-lede {
  max-width: 560px;
  margin: 12px 0 20px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
}

.export-summary {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  margin-bottom: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #08120e;
}

.export-summary span {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-left: 1px solid var(--line);
}

.export-summary span:first-child {
  border-left: 0;
}

.export-summary small {
  color: var(--muted-2);
  font-size: 0.52rem;
}

.export-summary strong {
  overflow: hidden;
  color: #c9ddd0;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-options {
  display: grid;
  gap: 8px;
}

.export-option {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: inherit;
  text-align: left;
  background: #0d1b16;
  transition: 150ms ease;
}

.export-option:hover {
  border-color: rgba(113, 226, 174, 0.34);
  background: #12231c;
  transform: translateY(-1px);
}

.export-option-primary {
  border-color: rgba(98, 228, 170, 0.28);
  background: linear-gradient(90deg, rgba(44, 142, 96, 0.14), #0d1b16 70%);
}

.export-option-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--mint);
  background: #11241c;
}

.export-option-icon svg {
  width: 20px;
  height: 20px;
}

.export-option > span:nth-child(2) {
  display: grid;
  gap: 4px;
}

.export-option strong {
  font-size: 0.72rem;
  font-weight: 620;
}

.export-option small {
  color: var(--muted);
  font-size: 0.6rem;
  line-height: 1.38;
}

.recommended-badge,
.file-badge {
  align-self: start;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #6f9280;
  font-family: var(--mono);
  font-size: 0.46rem;
}

.recommended-badge {
  color: var(--mint);
  border-color: rgba(99, 224, 168, 0.23);
  background: rgba(70, 186, 132, 0.08);
}

.dialog-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  padding: 11px 12px;
  border: 1px solid rgba(242, 195, 93, 0.16);
  border-radius: 8px;
  color: #998b65;
  background: rgba(130, 93, 25, 0.06);
  font-size: 0.56rem;
  line-height: 1.45;
}

.dialog-note svg {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  color: var(--amber);
}

.preflight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.preflight-item {
  display: grid;
  align-content: start;
  min-height: 116px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0c1914;
}

.preflight-item > span {
  width: max-content;
  margin-bottom: 11px;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--success);
  background: rgba(79, 205, 143, 0.09);
  font-family: var(--mono);
  font-size: 0.48rem;
  text-transform: uppercase;
}

.preflight-item.is-warn > span { color: var(--amber); background: rgba(242, 195, 93, 0.08); }
.preflight-item.is-error > span { color: var(--danger); background: rgba(255, 128, 111, 0.08); }

.preflight-item strong {
  font-size: 0.68rem;
}

.preflight-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.42;
}

.preflight-note {
  margin: 14px 0 0;
  padding: 12px;
  border-left: 2px solid var(--mint);
  color: var(--muted);
  background: rgba(50, 137, 97, 0.06);
  font-size: 0.61rem;
  line-height: 1.5;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  padding: 12px;
  border: 1px solid rgba(94, 224, 165, 0.26);
  border-radius: 11px;
  opacity: 0;
  background: rgba(12, 27, 21, 0.96);
  box-shadow: var(--shadow);
  pointer-events: none;
  transform: translateY(15px);
  transition: 200ms ease;
  transition-property: opacity, transform;
  backdrop-filter: blur(18px);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  border-color: rgba(255, 128, 111, 0.3);
}

.toast-icon {
  display: grid;
  flex: 0 0 31px;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  color: var(--success);
  background: rgba(74, 200, 137, 0.1);
}

.is-error .toast-icon {
  color: var(--danger);
  background: rgba(255, 128, 111, 0.08);
}

.toast-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.toast > span:last-child {
  display: grid;
  gap: 3px;
}

.toast strong {
  font-size: 0.65rem;
}

.toast small {
  color: var(--muted);
  font-size: 0.55rem;
  line-height: 1.35;
}

/*
 * The native Studio shell contributes its own title, toolbar and status bar.
 * Make every remaining web workspace row explicitly shrinkable in that bounded
 * WKWebView, and keep the two side-panel bodies independently scrollable. This
 * class is injected only by the macOS app, so the standalone browser layout and
 * its mobile breakpoints remain unchanged.
 */
html.iphonotype-native-embed,
html.iphonotype-native-embed body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

html.iphonotype-native-embed .app-shell,
html.iphonotype-native-embed .workspace,
html.iphonotype-native-embed .library-panel,
html.iphonotype-native-embed .inspector-panel,
html.iphonotype-native-embed .panel-scroll,
html.iphonotype-native-embed .inspector-scroll {
  min-height: 0;
}

html.iphonotype-native-embed .app-shell,
html.iphonotype-native-embed .workspace {
  height: 100%;
}

html.iphonotype-native-embed .workspace,
html.iphonotype-native-embed .library-panel,
html.iphonotype-native-embed .inspector-panel {
  overflow: hidden;
}

html.iphonotype-native-embed .panel-scroll,
html.iphonotype-native-embed .inspector-scroll {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

html.iphonotype-native-embed .generate-button {
  position: relative;
  z-index: 5;
}

@media (max-height: 900px) and (min-width: 861px) {
  html.iphonotype-native-embed .app-shell {
    grid-template-rows: 58px minmax(0, 1fr);
  }

  html.iphonotype-native-embed .topbar {
    gap: 14px;
    padding-inline: 14px;
  }

  html.iphonotype-native-embed .brand-mark {
    width: 34px;
    height: 34px;
  }

  html.iphonotype-native-embed .stage-panel {
    grid-template-rows: 52px minmax(0, 1fr) 64px;
  }

  html.iphonotype-native-embed .inspector-heading {
    min-height: 56px;
    padding-block: 10px;
  }

  html.iphonotype-native-embed .generate-button {
    min-height: 56px;
    margin-block: 8px;
    padding-block: 8px;
  }

  html.iphonotype-native-embed .generate-icon {
    width: 31px;
    height: 31px;
  }
}

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 220px minmax(420px, 1fr) 305px;
  }

  .stage-tool-actions .tool-toggle {
    width: 31px;
    padding: 0;
    justify-content: center;
    font-size: 0;
  }

  .palette-row code {
    display: none;
  }

  .palette-row {
    grid-template-columns: 25px 28px minmax(0, 1fr);
  }
}

@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: 205px minmax(390px, 1fr) 280px;
  }

  .topbar-center {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .stage-toolbar {
    grid-template-columns: 1fr auto;
  }

  .segmented-control {
    order: 3;
  }

  .stage-tool-actions {
    display: none;
  }

  .stage-metrics {
    grid-template-columns: repeat(4, 1fr);
  }

  .confidence-card {
    display: none !important;
  }
}

@media (max-width: 860px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
  }

  .topbar {
    position: sticky;
    top: 0;
    height: 64px;
  }

  .button-secondary,
  .icon-button {
    display: none;
  }

  .workspace {
    display: grid;
    grid-template-columns: 1fr;
  }

  .library-panel,
  .inspector-panel {
    display: block;
    border: 0;
  }

  .library-panel {
    order: 2;
  }

  .stage-panel {
    order: 1;
    grid-template-rows: 52px minmax(460px, 64dvh) 64px;
  }

  .inspector-panel {
    order: 3;
  }

  .panel-scroll,
  .inspector-scroll {
    overflow: visible;
  }

  .panel-section,
  .inspector-section,
  .inspector-heading {
    padding-inline: 20px;
  }

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

  .library-footer {
    display: none;
  }

  .parameter-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
  }

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

  .generate-button {
    position: sticky;
    z-index: 20;
    bottom: 10px;
    margin: 14px 20px 22px;
  }
}

@media (max-width: 580px) {
  .topbar {
    padding-inline: 12px;
  }

  .brand-context {
    display: none;
  }

  .button-primary {
    padding-inline: 11px;
  }

  .button-primary svg {
    display: none;
  }

  .stage-panel {
    grid-template-rows: 52px minmax(390px, 58dvh) 58px;
  }

  .target-identity small,
  .target-number {
    display: none;
  }

  .dimension-hud {
    top: 10px;
    left: 10px;
  }

  .dimension-hud span {
    padding: 6px;
  }

  .axis-widget {
    top: 9px;
    right: 9px;
  }

  .bed-badge {
    right: 10px;
    bottom: 10px;
    min-width: auto;
  }

  .bed-badge > span:nth-child(2),
  .view-hint {
    display: none;
  }

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

  .stage-metrics article:nth-child(4) {
    display: none;
  }

  .stage-metrics article {
    padding: 8px;
  }

  .specimen-list,
  .palette-list,
  .parameter-controls,
  .preflight-grid {
    grid-template-columns: 1fr;
  }

  .field-grid,
  .recipe-grid {
    grid-template-columns: 1fr;
  }

  .export-summary {
    grid-template-columns: 1fr;
  }

  .export-summary span,
  .export-summary span:first-child {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .export-summary span:first-child {
    border-top: 0;
  }

  .dialog-card {
    padding: 22px 16px 18px;
  }

  .export-option {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .recommended-badge,
  .file-badge {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
