:root {
  --bg: #180406;
  --panel: rgba(44, 10, 14, 0.88);
  --panel-soft: rgba(67, 14, 20, 0.9);
  --panel-strong: #120204;
  --line: rgba(255, 190, 190, 0.12);
  --text: #fff4f1;
  --muted: #e5b9b4;
  --accent: #ff694e;
  --accent-strong: #ff2e2e;
  --accent-soft: rgba(255, 94, 70, 0.16);
  --success: #89f1be;
  --danger: #ff9b93;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  --radius: 18px;
  --radius-sm: 12px;
  --mono: "Cascadia Mono", "Consolas", monospace;
  --sans: "Bahnschrift", "Segoe UI", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 77, 77, 0.28), transparent 24%),
    radial-gradient(circle at 80% 10%, rgba(255, 132, 77, 0.18), transparent 18%),
    linear-gradient(160deg, #190406 0%, #26070b 34%, #100204 100%);
}

body[data-busy] {
  cursor: progress;
}

body[data-authenticated="0"] .app-shell {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 105, 78, 0.2), transparent 34%),
    rgba(12, 2, 4, 0.74);
  backdrop-filter: blur(12px);
}

body[data-authenticated="1"] .auth-overlay {
  display: none;
}

.auth-card {
  display: grid;
  gap: 16px;
  width: min(420px, calc(100vw - 32px));
  padding: 26px;
  border: 1px solid rgba(255, 210, 190, 0.18);
  border-radius: 8px;
  background: rgba(26, 5, 8, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

.auth-card h1 {
  margin: 0;
}

.account-pill small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10500;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(12, 2, 4, 0.68);
  backdrop-filter: blur(10px);
}

.modal-overlay.is-visible {
  display: grid;
}

.modal-card {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 210, 190, 0.18);
  border-radius: 8px;
  background: rgba(26, 5, 8, 0.97);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

.machine-test-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.machine-test-output {
  width: 100%;
  min-height: 420px;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 0.88rem;
}

.about-card {
  width: min(720px, calc(100vw - 32px));
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.cut55-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.cut55-panel {
  min-height: calc(100vh - 190px);
}

.cut55-filters {
  margin: 18px 0;
}

.cut55-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.cut55-card {
  overflow: hidden;
  border: 1px solid rgba(255, 210, 190, 0.14);
  border-radius: 8px;
  background: rgba(18, 4, 6, 0.7);
}

.cut55-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: #fff7f2;
  background: rgba(146, 20, 34, 0.9);
}

.cut55-scroll {
  overflow-x: auto;
}

.cut55-card table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 0.86rem;
}

.cut55-card th,
.cut55-card td {
  padding: 7px 8px;
  border: 1px solid rgba(255, 210, 190, 0.12);
  text-align: right;
}

.cut55-card th {
  color: #ffd6ca;
  background: rgba(255, 255, 255, 0.05);
}

.cut55-card td {
  color: #fff4f1;
}

.cut55-speed-button {
  min-width: 86px;
  padding: 6px 8px;
  border: 1px solid rgba(137, 241, 190, 0.38);
  border-radius: 8px;
  color: #dfffea;
  background: rgba(137, 241, 190, 0.08);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.cut55-speed-button:hover {
  background: rgba(137, 241, 190, 0.18);
}

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

#accountPlanBadge {
  color: var(--success);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.is-locked {
  opacity: 0.45;
}

.button-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10020;
  max-width: min(280px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid rgba(255, 210, 190, 0.18);
  border-radius: 8px;
  color: #fff7f2;
  background: rgba(20, 4, 6, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
  font-size: 0.82rem;
  line-height: 1.28;
  opacity: 0;
  pointer-events: none;
  transition: opacity 80ms ease;
}

.button-tooltip.is-visible {
  opacity: 1;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 100, 78, 0.16), transparent 34%),
    rgba(10, 2, 4, 0.56);
  backdrop-filter: blur(10px);
}

.busy-overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}

.busy-card {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 22px;
  width: min(520px, calc(100vw - 40px));
  padding: 26px 28px;
  border-radius: 28px;
  border: 1px solid rgba(255, 186, 186, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 93, 70, 0.14), rgba(255, 170, 88, 0.06)),
    rgba(28, 6, 9, 0.94);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.busy-copy {
  display: grid;
  gap: 8px;
}

.busy-title {
  font-size: clamp(1.08rem, 1vw + 0.9rem, 1.45rem);
  letter-spacing: 0.03em;
}

.busy-message {
  margin: 0;
  color: rgba(255, 221, 214, 0.86);
  line-height: 1.5;
}

.busy-optimizer-visual {
  display: none;
  gap: 10px;
  width: min(100%, 430px);
  margin-top: 8px;
}

.busy-overlay[data-busy-kind="optimizer"] .busy-card {
  width: min(700px, calc(100vw - 40px));
  align-items: flex-start;
}

.busy-overlay[data-busy-kind="optimizer"] .busy-copy {
  flex: 1 1 auto;
}

.busy-overlay[data-busy-kind="optimizer"] .busy-optimizer-visual {
  display: grid;
}

.busy-optimizer-sheet {
  position: relative;
  height: 156px;
  overflow: hidden;
  border: 1px solid rgba(255, 181, 156, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    rgba(12, 3, 6, 0.82);
  background-size: 24px 24px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.busy-optimizer-sheet::after {
  content: "";
  position: absolute;
  inset: 14px 16px;
  border: 1px dashed rgba(255, 154, 70, 0.44);
  border-radius: 6px;
}

.busy-optimizer-scan {
  position: absolute;
  z-index: 2;
  top: 12px;
  bottom: 12px;
  left: 18px;
  width: 2px;
  border-radius: 999px;
  background: rgba(137, 241, 190, 0.86);
  box-shadow:
    0 0 12px rgba(137, 241, 190, 0.52),
    0 0 28px rgba(137, 241, 190, 0.18);
  animation: busyOptimizerScan 2.8s linear infinite;
}

.busy-optimizer-part {
  position: absolute;
  z-index: 1;
  border: 2px solid rgba(255, 107, 87, 0.96);
  border-radius: 6px;
  background: rgba(255, 107, 87, 0.13);
  box-shadow: 0 0 14px rgba(255, 107, 87, 0.22);
}

.busy-optimizer-part--a {
  left: 28px;
  top: 26px;
  width: 78px;
  height: 44px;
  animation: busyOptimizerPartA 4.4s ease-in-out infinite;
}

.busy-optimizer-part--b {
  left: 116px;
  top: 24px;
  width: 54px;
  height: 76px;
  border-color: rgba(255, 159, 67, 0.96);
  background: rgba(255, 159, 67, 0.13);
  animation: busyOptimizerPartB 4.4s ease-in-out infinite;
}

.busy-optimizer-part--c {
  left: 184px;
  top: 32px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border-color: rgba(123, 211, 137, 0.96);
  background: rgba(123, 211, 137, 0.13);
  animation: busyOptimizerPartC 4.4s ease-in-out infinite;
}

.busy-optimizer-part--c::after {
  content: "";
  position: absolute;
  inset: 19px;
  border: 2px solid rgba(123, 211, 137, 0.72);
  border-radius: 50%;
}

.busy-optimizer-part--d {
  left: 268px;
  top: 30px;
  width: 76px;
  height: 38px;
  border-color: rgba(94, 200, 255, 0.96);
  background: rgba(94, 200, 255, 0.12);
  animation: busyOptimizerPartD 4.4s ease-in-out infinite;
}

.busy-optimizer-part--e {
  left: 268px;
  top: 80px;
  width: 96px;
  height: 42px;
  border-color: rgba(255, 209, 102, 0.96);
  background: rgba(255, 209, 102, 0.12);
  animation: busyOptimizerPartE 4.4s ease-in-out infinite;
}

.busy-optimizer-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.busy-optimizer-steps span {
  min-height: 24px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 210, 190, 0.16);
  border-radius: 6px;
  color: rgba(255, 236, 228, 0.8);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.78rem;
  line-height: 1;
  animation: busyOptimizerStepPulse 4.4s ease-in-out infinite;
}

.busy-optimizer-steps span:nth-child(2) {
  animation-delay: 0.7s;
}

.busy-optimizer-steps span:nth-child(3) {
  animation-delay: 1.4s;
}

.busy-hourglass {
  position: relative;
  flex: 0 0 84px;
  width: 84px;
  height: 104px;
  border-radius: 24px;
  border: 2px solid rgba(255, 204, 189, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)),
    rgba(15, 4, 6, 0.84);
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 12px 28px rgba(0, 0, 0, 0.24);
  animation: busyHourglassTilt 2.2s ease-in-out infinite;
}

.busy-hourglass::before,
.busy-hourglass::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 24px solid transparent;
  border-right: 24px solid transparent;
}

.busy-hourglass::before {
  top: 14px;
  border-bottom: 28px solid rgba(255, 187, 112, 0.88);
  animation: busyTopSand 2.2s ease-in-out infinite;
}

.busy-hourglass::after {
  bottom: 14px;
  border-top: 30px solid rgba(255, 114, 78, 0.9);
  animation: busyBottomSand 2.2s ease-in-out infinite;
}

.busy-hourglass__neck {
  position: absolute;
  left: 50%;
  top: 18px;
  width: 8px;
  height: 68px;
  transform: translateX(-50%);
}

.busy-hourglass__neck::before,
.busy-hourglass__neck::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
}

.busy-hourglass__neck::before {
  top: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 224, 171, 0.9) 28%, transparent 70%);
  animation: busySandStream 2.2s linear infinite;
}

.busy-hourglass__neck::after {
  top: 31px;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, rgba(255, 224, 171, 0.96), rgba(255, 120, 72, 0.42));
  animation: busySandDrop 2.2s ease-in-out infinite;
}

.busy-torch-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.busy-torch {
  position: absolute;
  top: 0;
  left: 0;
  width: 92px;
  height: 32px;
  transform-origin: 20px 16px;
  filter:
    drop-shadow(0 0 12px rgba(255, 85, 62, 0.55))
    drop-shadow(0 0 22px rgba(255, 151, 71, 0.28));
  animation: busyTorchCruise 8.8s linear infinite;
}

.busy-torch__handle,
.busy-torch__nozzle,
.busy-torch__flame,
.busy-torch__spark {
  position: absolute;
  display: block;
}

.busy-torch__handle {
  top: 11px;
  left: 6px;
  width: 34px;
  height: 10px;
  border-radius: 999px 12px 12px 999px;
  background: linear-gradient(180deg, #5c6068, #21252d);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.busy-torch__nozzle {
  top: 9px;
  left: 34px;
  width: 22px;
  height: 14px;
  border-radius: 6px 10px 10px 6px;
  background: linear-gradient(180deg, #9fa5af, #4f5660);
}

.busy-torch__flame {
  top: 5px;
  left: 52px;
  width: 28px;
  height: 22px;
  border-radius: 60% 40% 60% 35%;
  background:
    radial-gradient(circle at 30% 50%, rgba(255, 245, 196, 0.95), transparent 22%),
    radial-gradient(circle at 52% 48%, rgba(255, 162, 78, 0.95), transparent 48%),
    radial-gradient(circle at 76% 48%, rgba(255, 64, 52, 0.9), transparent 72%);
  transform-origin: 10px 11px;
  animation: busyFlameFlicker 0.34s ease-in-out infinite alternate;
}

.busy-torch__flame::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 18px;
  width: 20px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 126, 72, 0.85), rgba(255, 53, 53, 0));
  filter: blur(1px);
}

.busy-torch__spark {
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 246, 190, 0.96), rgba(255, 82, 61, 0.1));
  transform-origin: left center;
}

.busy-torch__spark--1 {
  top: 6px;
  left: 66px;
  animation: busySparkTrail1 0.55s linear infinite;
}

.busy-torch__spark--2 {
  top: 15px;
  left: 70px;
  animation: busySparkTrail2 0.65s linear infinite;
}

.busy-torch__spark--3 {
  top: 22px;
  left: 64px;
  animation: busySparkTrail3 0.72s linear infinite;
}

@keyframes busyHourglassTilt {
  0%,
  100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

@keyframes busyTopSand {
  0%,
  14% {
    transform: translateX(-50%) scaleY(1);
    opacity: 0.96;
  }
  70%,
  100% {
    transform: translateX(-50%) scaleY(0.2);
    opacity: 0.2;
  }
}

@keyframes busyBottomSand {
  0%,
  14% {
    transform: translateX(-50%) scaleY(0.32);
    opacity: 0.35;
  }
  70%,
  100% {
    transform: translateX(-50%) scaleY(1);
    opacity: 0.96;
  }
}

@keyframes busySandStream {
  0%,
  10%,
  100% {
    opacity: 0;
    transform: translateX(-50%) scaleY(0.2);
  }
  18%,
  82% {
    opacity: 1;
    transform: translateX(-50%) scaleY(1);
  }
}

@keyframes busySandDrop {
  0%,
  18% {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px) scale(0.4);
  }
  44% {
    opacity: 1;
    transform: translateX(-50%) translateY(8px) scale(1);
  }
  84%,
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(26px) scale(0.2);
  }
}

@keyframes busyTorchCruise {
  0% {
    transform: translate(-12vw, 18vh) rotate(10deg);
  }
  22% {
    transform: translate(76vw, 18vh) rotate(-7deg);
  }
  48% {
    transform: translate(78vw, 72vh) rotate(174deg);
  }
  74% {
    transform: translate(10vw, 68vh) rotate(188deg);
  }
  100% {
    transform: translate(-12vw, 18vh) rotate(370deg);
  }
}

@keyframes busyFlameFlicker {
  0% {
    transform: scaleX(0.92) scaleY(0.94) rotate(-4deg);
  }
  100% {
    transform: scaleX(1.08) scaleY(1.06) rotate(3deg);
  }
}

@keyframes busySparkTrail1 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scaleX(0.4);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(20px, -9px) scaleX(1.4);
  }
}

@keyframes busySparkTrail2 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scaleX(0.35);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(26px, -2px) scaleX(1.6);
  }
}

@keyframes busySparkTrail3 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scaleX(0.35);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(23px, 7px) scaleX(1.45);
  }
}

@keyframes busyOptimizerScan {
  0% {
    transform: translateX(0);
    opacity: 0.28;
  }
  12%,
  88% {
    opacity: 1;
  }
  100% {
    transform: translateX(360px);
    opacity: 0.28;
  }
}

@keyframes busyOptimizerPartA {
  0%,
  12% {
    transform: translate(-76px, -22px) rotate(-12deg);
    opacity: 0.28;
  }
  46%,
  100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
}

@keyframes busyOptimizerPartB {
  0%,
  20% {
    transform: translate(86px, -34px) rotate(90deg);
    opacity: 0.28;
  }
  54%,
  100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
}

@keyframes busyOptimizerPartC {
  0%,
  28% {
    transform: translate(-28px, 86px) scale(0.86);
    opacity: 0.28;
  }
  62%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
}

@keyframes busyOptimizerPartD {
  0%,
  36% {
    transform: translate(94px, 62px) rotate(-8deg);
    opacity: 0.28;
  }
  70%,
  100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
}

@keyframes busyOptimizerPartE {
  0%,
  44% {
    transform: translate(-120px, 44px) rotate(6deg);
    opacity: 0.28;
  }
  78%,
  100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
}

@keyframes busyOptimizerStepPulse {
  0%,
  24%,
  100% {
    border-color: rgba(255, 210, 190, 0.16);
    color: rgba(255, 236, 228, 0.72);
    background: rgba(255, 255, 255, 0.045);
  }
  8% {
    border-color: rgba(137, 241, 190, 0.56);
    color: rgba(255, 255, 255, 0.96);
    background: rgba(137, 241, 190, 0.12);
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1820px, calc(100vw - 24px));
  margin: 12px auto;
  padding: 14px;
}

.forge-theme {
  position: relative;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: calc(var(--radius) + 6px);
  background:
    linear-gradient(145deg, rgba(255, 138, 61, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(18, 24, 29, 0.92);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 126, 126, 0.14);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 83, 83, 0.24), transparent 30%),
    radial-gradient(circle at 100% 0%, rgba(255, 163, 90, 0.16), transparent 26%),
    linear-gradient(180deg, rgba(53, 11, 16, 0.92), rgba(29, 6, 9, 0.94));
}

.hero::after {
  display: none;
}

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

.hero-torch-rig {
  --hero-torch-scale: 0.58;
  position: relative;
  flex: 0 0 230px;
  width: 230px;
  height: 70px;
  margin-left: -2px;
  z-index: 1 !important;
  pointer-events: none;
  opacity: 0.98;
  overflow: visible;
}

.hero-torch-rig::before {
  content: "";
  position: absolute;
  left: 32px;
  top: 8px;
  width: 180px;
  height: 58px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 72% 48%, rgba(255, 112, 76, 0.24), transparent 28%),
    radial-gradient(circle at 58% 50%, rgba(255, 183, 109, 0.15), transparent 46%),
    radial-gradient(circle at 40% 55%, rgba(255, 255, 255, 0.05), transparent 58%);
  filter: blur(8px);
}

.hero-torch {
  position: absolute;
  left: 0;
  top: -34px;
  width: 390px;
  height: 132px;
  transform-origin: 82px 76px;
  transform: scale(var(--hero-torch-scale)) rotate(-8deg);
  filter:
    drop-shadow(0 18px 28px rgba(0, 0, 0, 0.46))
    drop-shadow(0 0 14px rgba(255, 82, 61, 0.42))
    drop-shadow(0 0 30px rgba(255, 149, 70, 0.18));
  animation: heroTorchFloatTitle 4.6s ease-in-out infinite;
}

.hero-torch__cable,
.hero-torch__back,
.hero-torch__grip,
.hero-torch__trigger,
.hero-torch__barrel,
.hero-torch__collar,
.hero-torch__nozzle,
.hero-torch__glow,
.hero-torch__spark {
  position: absolute;
  display: block;
}

.hero-torch__cable {
  left: -18px;
  top: 74px;
  width: 128px;
  height: 22px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(74, 80, 90, 0.95), rgba(23, 26, 32, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -2px 4px rgba(0, 0, 0, 0.34);
  transform: rotate(6deg);
}

.hero-torch__back {
  left: 64px;
  top: 42px;
  width: 62px;
  height: 50px;
  border-radius: 28px 22px 20px 28px;
  background:
    linear-gradient(180deg, #707985, #272d36 68%, #181d24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset -8px -8px 14px rgba(0, 0, 0, 0.26);
}

.hero-torch__grip {
  left: 88px;
  top: 26px;
  width: 94px;
  height: 72px;
  border-radius: 26px 18px 18px 28px;
  background:
    linear-gradient(180deg, #6d7681, #2a3038 48%, #161b22 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset -10px -10px 16px rgba(0, 0, 0, 0.34),
    0 8px 16px rgba(0, 0, 0, 0.22);
}

.hero-torch__grip::before {
  content: "";
  position: absolute;
  inset: 10px 12px;
  border-radius: 18px 12px 12px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.01)),
    linear-gradient(90deg, rgba(32, 37, 45, 0.92), rgba(12, 14, 18, 0.94));
}

.hero-torch__trigger {
  left: 122px;
  top: 64px;
  width: 16px;
  height: 28px;
  border-radius: 12px 12px 14px 14px;
  background: linear-gradient(180deg, #ff874d, #c9412f);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 10px rgba(255, 96, 61, 0.22);
}

.hero-torch__barrel {
  left: 160px;
  top: 34px;
  width: 116px;
  height: 54px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, #b0b7c0 0%, #6c7581 42%, #404852 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -8px 12px rgba(0, 0, 0, 0.18);
}

.hero-torch__barrel::before {
  content: "";
  position: absolute;
  inset: 8px 14px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(40, 46, 54, 0.1));
}

.hero-torch__collar {
  left: 248px;
  top: 32px;
  width: 32px;
  height: 58px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #7a828d, #353c45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -6px 10px rgba(0, 0, 0, 0.18);
}

.hero-torch__nozzle {
  left: 272px;
  top: 39px;
  width: 48px;
  height: 42px;
  border-radius: 10px 18px 18px 10px;
  background:
    linear-gradient(180deg, #c9ced4 0%, #8c949e 36%, #515963 72%, #262d35 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 6px 10px rgba(0, 0, 0, 0.16);
}

.hero-torch__nozzle::before {
  content: "";
  position: absolute;
  right: -12px;
  top: 8px;
  width: 18px;
  height: 26px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, #e0b889, #8b6449 58%, #503524 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 233, 0.2),
    0 0 8px rgba(255, 167, 97, 0.14);
}

.hero-torch__glow {
  right: 0;
  top: 34px;
  width: 94px;
  height: 58px;
  border-radius: 58% 42% 60% 34%;
  background:
    radial-gradient(circle at 20% 48%, rgba(255, 247, 210, 0.98), transparent 18%),
    radial-gradient(circle at 42% 50%, rgba(255, 186, 86, 0.98), transparent 42%),
    radial-gradient(circle at 76% 48%, rgba(255, 70, 54, 0.94), transparent 72%);
  filter: blur(0.3px);
  transform-origin: 10px 28px;
  animation: heroTorchFlame 0.42s ease-in-out infinite alternate;
}

.hero-torch__glow::before {
  content: "";
  position: absolute;
  inset: 10px 6px 14px 26px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 145, 74, 0.92), rgba(255, 55, 55, 0));
  filter: blur(3px);
}

.hero-torch__spark {
  width: 26px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 245, 190, 1), rgba(255, 96, 61, 0.08));
  transform-origin: left center;
  filter: blur(0.1px);
}

.hero-torch__spark--1 {
  right: -4px;
  top: 42px;
  animation: heroTorchSpark1 0.72s linear infinite;
}

.hero-torch__spark--2 {
  right: 6px;
  top: 58px;
  animation: heroTorchSpark2 0.84s linear infinite;
}

.hero-torch__spark--3 {
  right: 12px;
  top: 72px;
  animation: heroTorchSpark3 0.92s linear infinite;
}

.hero-torch__spark--4 {
  right: 20px;
  top: 48px;
  animation: heroTorchSpark4 0.78s linear infinite;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-watermark {
  flex: 0 0 220px;
  width: 220px;
  height: 110px;
  background: url("LOGO FORGE2M.jpg") no-repeat center / contain;
  opacity: 0.14;
  filter: grayscale(1) brightness(1.45) contrast(0.95);
  transform: rotate(-6deg);
  pointer-events: none;
}

.topbar-copy {
  max-width: 920px;
}

.title-torch-row {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 70px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2vw, 2.8rem);
  line-height: 1.08;
}

.subtitle {
  margin: 10px 0 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 1rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: end;
}

.header-meta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-select {
  display: grid;
  gap: 6px;
  min-width: 180px;
  color: var(--muted);
  font-size: 0.86rem;
}

.tabbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  background: rgba(30, 8, 11, 0.72);
  box-shadow: var(--shadow);
}

.tab-button {
  min-height: 48px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 120ms ease;
}

.tab-button.is-active {
  background: linear-gradient(135deg, rgba(255, 105, 78, 0.96), rgba(255, 46, 46, 0.96));
  color: #21090a;
  border-color: transparent;
}

.tab-panels {
  display: block;
}

.tab-panel {
  display: none;
}

@media (max-width: 720px) {
  .busy-card {
    gap: 16px;
    padding: 20px;
  }

  .busy-hourglass {
    flex-basis: 66px;
    width: 66px;
    height: 82px;
  }

  .busy-overlay[data-busy-kind="optimizer"] .busy-card {
    align-items: stretch;
  }

  .busy-optimizer-sheet {
    height: 128px;
  }

  .busy-optimizer-part--a {
    left: 18px;
    top: 22px;
    width: 58px;
    height: 34px;
  }

  .busy-optimizer-part--b {
    left: 86px;
    top: 20px;
    width: 42px;
    height: 58px;
  }

  .busy-optimizer-part--c {
    left: 138px;
    top: 26px;
    width: 50px;
    height: 50px;
  }

  .busy-optimizer-part--d {
    left: 200px;
    top: 24px;
    width: 58px;
    height: 30px;
  }

  .busy-optimizer-part--e {
    left: 200px;
    top: 68px;
    width: 76px;
    height: 34px;
  }

  .busy-hourglass::before,
  .busy-hourglass::after {
    border-left-width: 18px;
    border-right-width: 18px;
  }

  .busy-torch {
    animation-duration: 7.2s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .busy-overlay,
  .busy-hourglass,
  .busy-hourglass::before,
  .busy-hourglass::after,
  .busy-hourglass__neck::before,
  .busy-hourglass__neck::after,
  .busy-torch,
  .busy-torch__flame,
  .busy-torch__spark,
  .busy-optimizer-scan,
  .busy-optimizer-part,
  .busy-optimizer-steps span,
  .hero-torch,
  .hero-torch__glow,
  .hero-torch__spark {
    animation: none !important;
    transition: none !important;
  }
}

.tab-panel.is-active {
  display: block;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 340px) minmax(480px, 1fr) minmax(320px, 390px);
  gap: 14px;
  align-items: start;
}

.dxf-workspace {
  margin-top: 0;
}

.config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.optimizer-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.optimizer-sidebar {
  min-width: 0;
}

.optimizer-main-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.optimizer-preview-panel {
  min-height: calc(100vh - 245px);
}

.optimizer-loaded-panel {
  margin-bottom: 0;
}

.optimizer-preview-frame,
#optimizerSvg {
  min-height: 760px;
  height: 760px;
}

#optimizerSvg {
  display: block;
  width: 100%;
  touch-action: none;
  cursor: default;
}

#optimizerSvg.is-panning,
#previewSvg.is-panning {
  cursor: grabbing;
}

.simulation-tab {
  display: block;
}

.simulation-panel {
  min-height: calc(100vh - 245px);
}

.camera-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.camera-sidebar {
  display: grid;
  gap: 14px;
}

.camera-view-panel {
  min-height: calc(100vh - 245px);
}

.camera-stage {
  min-height: 760px;
  height: 760px;
  cursor: default;
}

.camera-stage.is-pick-origin {
  cursor: crosshair;
}

.camera-stage video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.38);
}

.camera-crosshair {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.camera-crosshair::before,
.camera-crosshair::after {
  content: "";
  position: absolute;
  background: rgba(124, 243, 200, 0.42);
  box-shadow: 0 0 10px rgba(124, 243, 200, 0.18);
}

.camera-crosshair::before {
  left: 50%;
  top: 16px;
  bottom: 16px;
  width: 1px;
  transform: translateX(-50%);
}

.camera-crosshair::after {
  top: 50%;
  left: 16px;
  right: 16px;
  height: 1px;
  transform: translateY(-50%);
}

.camera-origin-marker {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(13, 7, 8, 0.95);
  background: #6fffd2;
  box-shadow: 0 0 0 4px rgba(111, 255, 210, 0.18);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.sidebar,
.queue-panel,
.canvas-area {
  min-height: 300px;
}

.panel {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 208, 208, 0.08);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(40, 9, 13, 0.92);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 1rem;
  letter-spacing: 0.03em;
}

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

.panel-head h2 {
  margin: 0;
}

.panel-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.panel-subsection {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-subsection h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

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

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

.quote-stats article {
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.03);
}

.quote-stats span,
.recent-project span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.quote-stats strong,
.recent-project strong {
  display: block;
  margin-top: 4px;
}

.preflight-panel,
.license-details {
  display: grid;
  gap: 8px;
}

.preflight-list,
.license-feature-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.preflight-item,
.license-feature {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.86rem;
}

.license-feature span,
.license-feature small {
  display: block;
}

.license-feature small {
  margin-top: 4px;
  color: var(--muted);
}

.preflight-item.is-ok,
.license-feature.is-on {
  border-color: rgba(137, 241, 190, 0.32);
  color: var(--text);
}

.license-feature.is-beta {
  border-color: rgba(94, 200, 255, 0.32);
  color: var(--text);
}

.preflight-item.is-warning,
.license-feature.is-off {
  border-color: rgba(255, 209, 102, 0.3);
}

.panel-actions.compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.license-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.license-section-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.license-mode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.recent-projects {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.recent-project {
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.stat-card {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.stat-card strong,
.stat-card span {
  display: block;
}

.stat-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-text,
.help-text {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.slider-field {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.z-grid {
  margin-top: 12px;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 210, 210, 0.1);
  border-radius: 12px;
  background: rgba(17, 4, 6, 0.78);
  color: var(--text);
  padding: 11px 12px;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(255, 138, 61, 0.65);
  box-shadow: 0 0 0 3px rgba(255, 138, 61, 0.18);
}

textarea {
  min-height: 280px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.45;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--text);
}

.toggle input {
  width: auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background-color 120ms ease,
    color 120ms ease;
  text-decoration: none;
  user-select: none;
}

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

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #2a0908;
  font-weight: 700;
}

.button.secondary,
.button.ghost {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.1);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.06);
}

.button.ghost {
  background: transparent;
}

.button.is-active {
  border-color: rgba(255, 138, 61, 0.6);
  background: var(--accent-soft);
  color: #ffd1b1;
}

.file-input {
  position: relative;
  overflow: hidden;
}

.file-input input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.canvas-area {
  padding: 18px;
  border: 1px solid rgba(255, 214, 214, 0.08);
  border-radius: calc(var(--radius) + 2px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(31, 7, 10, 0.94);
  box-shadow: var(--shadow);
}

.canvas-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 14px;
}

.canvas-tool-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border: 1px solid rgba(255, 214, 214, 0.08);
  border-radius: 8px;
  background: rgba(10, 14, 18, 0.36);
}

.canvas-tool-group-main {
  background: rgba(255, 105, 78, 0.09);
}

.canvas-tool-label {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding-right: 7px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.canvas-tool-group .button {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.preview-frame {
  position: relative;
  min-height: 720px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 226, 226, 0.08);
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(255, 85, 85, 0.14), transparent 24%),
    linear-gradient(180deg, rgba(17, 4, 6, 0.95), rgba(12, 3, 5, 0.95));
  background-size: 34px 34px, 34px 34px, auto, auto;
}

#previewSvg {
  display: block;
  width: 100%;
  height: 720px;
  touch-action: none;
  cursor: default;
}

#simCanvas2d,
#simCanvas3d {
  cursor: default;
  touch-action: none;
}

#simCanvas2d.is-panning,
#simCanvas3d.is-panning {
  cursor: grabbing;
}

.preview-empty {
  position: absolute;
  inset: 22px;
  display: grid;
  place-items: center;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(10, 14, 18, 0.6);
}

.preview-empty.hidden,
.hidden {
  display: none;
}

.warning-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  color: #ffd3cc;
  background: rgba(180, 52, 40, 0.18);
  border: 1px solid rgba(255, 143, 135, 0.28);
  line-height: 1.45;
}

.warning-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.color-legend {
  display: grid;
  gap: 10px;
}

.legend-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

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

.swatch {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  flex: 0 0 auto;
}

.legend-text,
.selected-line {
  min-width: 0;
}

.legend-text strong,
.selected-line strong {
  display: block;
}

.legend-text span,
.selected-line span,
.queue-meta {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.queue-list {
  margin: 0;
  padding-left: 24px;
  display: grid;
  gap: 10px;
}

.queue-item {
  padding: 10px 12px 10px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.queue-item.is-selected {
  border-color: rgba(255, 138, 61, 0.45);
  background: rgba(255, 138, 61, 0.12);
}

.queue-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.queue-title {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}

.queue-title button {
  padding: 0;
  background: none;
  border: 0;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

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

.queue-actions button {
  width: 34px;
  height: 34px;
  padding: 0;
}

.sim-tabs {
  display: flex;
  gap: 8px;
}

.sim-tabs #sim2dBtn,
.sim-tabs #sim3dBtn {
  display: none;
}

.sim-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.sim-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sim-top-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.62fr) minmax(0, 1.38fr);
  gap: 10px;
  align-items: stretch;
  margin-top: 14px;
}

.sim-top-grid .sim-controls {
  margin: 0;
}

.sim-controls-wide {
  align-items: stretch;
  padding: 10px;
  border: 1px solid rgba(255, 220, 220, 0.08);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(19, 6, 8, 0.86);
}

.sim-readout {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 0;
}

.sim-readout-card {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 220, 220, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(19, 6, 8, 0.86);
}

.sim-time-card {
  border-color: rgba(137, 241, 190, 0.22);
  background:
    linear-gradient(180deg, rgba(137, 241, 190, 0.08), rgba(255, 255, 255, 0.01)),
    rgba(19, 6, 8, 0.9);
}

.sim-readout-card span,
.sim-readout-card strong {
  display: block;
}

.sim-readout-card span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sim-readout-card strong {
  font-family: var(--mono);
  font-size: 0.92rem;
}

.sim-readout-card-wide {
  grid-column: span 2;
}

.sim-frame {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)),
    rgba(10, 14, 18, 0.9);
}

.sim-view-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 220, 220, 0.08);
  border-radius: 12px;
  background: rgba(8, 12, 16, 0.72);
}

.sim-frame.is-playing .sim-view-panel {
  background: rgba(8, 12, 16, 0.62);
}

.sim-view-title {
  padding: 8px 10px;
  color: var(--success);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sim-frame canvas {
  display: block;
  width: 100%;
  height: 300px;
}

.sim-frame-xl canvas {
  height: min(62vh, 760px);
}

.result-panel {
  margin-top: 14px;
}

.result-panel textarea {
  min-height: 220px;
}

.inline-field {
  min-width: 220px;
  flex: 1 1 280px;
  margin-top: 0;
}

.config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.config-list {
  display: grid;
  gap: 10px;
}

.optimizer-list {
  display: grid;
  gap: 10px;
}

.optimizer-variants {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.optimizer-variants.hidden {
  display: none;
}

.optimizer-variants-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.optimizer-variants-head strong {
  color: var(--text);
}

.optimizer-variants-head span {
  color: var(--muted);
  font-size: 0.86rem;
}

.optimizer-variant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.optimizer-variant-card {
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 178px;
  padding: 8px;
  border: 1px solid rgba(255, 210, 190, 0.16);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
}

.optimizer-variant-card:hover,
.optimizer-variant-card.is-active {
  border-color: rgba(255, 111, 84, 0.86);
  background: rgba(255, 111, 84, 0.12);
}

.optimizer-variant-preview {
  display: block;
  height: 104px;
  overflow: hidden;
  border-radius: 6px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    rgba(9, 2, 5, 0.72);
  background-size: 18px 18px;
}

.optimizer-variant-preview svg {
  display: block;
  width: 100%;
  height: 100%;
}

.optimizer-variant-copy {
  display: grid;
  gap: 3px;
}

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

.optimizer-variant-copy span {
  color: rgba(255, 236, 228, 0.88);
  font-size: 0.82rem;
}

.optimizer-variant-copy em {
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
}

.optimizer-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 225, 225, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.optimizer-item-main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.optimizer-item-copy {
  min-width: 0;
}

.optimizer-item-copy strong,
.optimizer-item-copy span {
  display: block;
}

.optimizer-item-copy span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.optimizer-item-detail {
  opacity: 0.82;
  font-size: 0.79rem;
}

.optimizer-item-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.optimizer-item-actions label {
  display: grid;
  gap: 6px;
  min-width: 104px;
  flex: 1 1 104px;
  color: var(--muted);
  font-size: 0.86rem;
}

.config-item {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 225, 225, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.config-item.is-active {
  border-color: rgba(255, 138, 61, 0.42);
  background: rgba(255, 138, 61, 0.12);
}

.config-item strong,
.config-item span {
  display: block;
}

.config-item span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.badge-neutral {
  color: #fff1ed;
  background: rgba(255, 255, 255, 0.08);
}

.badge {
  min-width: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  text-align: center;
  font-weight: 700;
  color: #1a120d;
  background: linear-gradient(135deg, #ffc98d, #ff8a3d);
}

.selected-info {
  display: grid;
  gap: 12px;
}

.selected-card {
  display: grid;
  gap: 12px;
}

.selected-editor {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.selected-editor label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

.selected-editor textarea {
  min-height: 92px;
  resize: vertical;
}

.selected-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-list {
  display: grid;
  gap: 8px;
}

.tab-list.is-empty {
  gap: 0;
}

.tab-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 220, 220, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.tab-chip span {
  color: var(--text);
  font-size: 0.9rem;
}

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

.meta-grid article {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.meta-grid strong {
  font-family: var(--mono);
  font-size: 0.92rem;
}

.empty-state {
  color: var(--muted);
}

.contour-path {
  fill: rgba(255, 255, 255, 0.02);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  transition: opacity 120ms ease;
  pointer-events: none;
}

.contour-path:hover {
  opacity: 0.92;
}

.contour-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: stroke;
  cursor: pointer;
}

.contour-group.is-text-contour .contour-hit,
.contour-group.is-text-contour .contour-path {
  cursor: move;
}

.pan-surface {
  fill: transparent;
  pointer-events: all;
}

.contour-path.is-queued {
  stroke-width: 2.2;
  filter: drop-shadow(0 0 8px rgba(255, 138, 61, 0.2));
}

.contour-path.is-selected {
  stroke: #ffd7ba !important;
  stroke-width: 3;
}

.stock-outline {
  fill: rgba(126, 224, 181, 0.04);
  stroke: rgba(126, 224, 181, 0.6);
  stroke-width: 1.2;
  stroke-dasharray: 10 6;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.dimension-annotation {
  pointer-events: none;
}

.dimension-line,
.dimension-tick {
  stroke: rgba(255, 210, 182, 0.88);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.dimension-label {
  fill: #fff4ef;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(20, 6, 8, 0.92);
  stroke-linejoin: round;
}

.dimension-label-side {
  text-anchor: start;
}

.home-marker line,
.home-marker circle,
.machine-axis-overlay line,
.machine-axis-overlay circle,
.machine-axis-overlay ellipse,
.machine-axis-overlay polygon,
.machine-axis-overlay rect,
.path-marker,
.tab-marker line,
.tab-marker circle {
  vector-effect: non-scaling-stroke;
}

.home-marker line {
  stroke: var(--success);
  stroke-width: 1.4;
}

.home-marker circle {
  fill: none;
  stroke: var(--success);
  stroke-width: 1.4;
}

.path-marker.start {
  fill: var(--success);
}

.path-marker.end {
  fill: var(--danger);
}

.path-direction line {
  stroke: #ffd166;
  stroke-width: 2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.path-direction polygon {
  fill: #ffd166;
  stroke: rgba(41, 18, 5, 0.8);
  stroke-width: 0.7;
  vector-effect: non-scaling-stroke;
}

.path-direction text {
  fill: #ffd166;
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(20, 6, 8, 0.92);
  stroke-width: 3;
  stroke-linejoin: round;
  pointer-events: none;
}

.tab-marker line {
  stroke: #ffd166;
  stroke-width: 3.2;
  stroke-linecap: round;
}

.tab-marker circle {
  fill: #ffd166;
  stroke: rgba(41, 18, 5, 0.92);
  stroke-width: 1.2;
}

.order-badge .badge-shell {
  fill: rgba(255, 138, 61, 0.92);
  stroke: rgba(15, 6, 8, 0.98);
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
}

.order-badge text {
  fill: #fffaf8;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(17, 22, 26, 0.96);
  stroke-width: 2.2;
  stroke-linejoin: round;
  pointer-events: none;
}

.order-badge line {
  stroke: rgba(255, 201, 141, 0.92);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.order-badge,
.home-marker,
.machine-axis-overlay,
.path-marker,
.tab-marker {
  pointer-events: none;
}

.machine-axis-shadow {
  fill: rgba(0, 0, 0, 0.26);
}

.machine-axis-plate {
  fill: rgba(26, 8, 11, 0.7);
  stroke: rgba(255, 239, 229, 0.22);
  stroke-width: 1.1;
}

.machine-axis-line {
  stroke-width: 1.9;
  stroke-linecap: round;
}

.machine-axis-line-x,
.machine-axis-head-x,
.machine-axis-text-x text {
  stroke: rgba(255, 175, 128, 0.96);
  fill: rgba(255, 175, 128, 0.96);
}

.machine-axis-line-y,
.machine-axis-head-y,
.machine-axis-text-y text {
  stroke: rgba(124, 243, 200, 0.98);
  fill: rgba(124, 243, 200, 0.98);
}

.machine-axis-origin-halo {
  fill: rgba(124, 243, 200, 0.22);
}

.machine-axis-origin {
  fill: #8af8d5;
  stroke: rgba(22, 8, 10, 0.96);
  stroke-width: 1.2;
}

.machine-axis-origin-core {
  fill: #fffaf7;
}

.machine-axis-text text {
  fill: #fff7f2;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(20, 6, 8, 0.92);
  stroke-width: 3;
}

.machine-axis-text-x text {
  fill: rgba(255, 190, 153, 0.98);
}

.machine-axis-text-y text {
  fill: rgba(171, 255, 226, 0.98);
}

.text-block-overlay {
  cursor: move;
  pointer-events: all;
}

.text-block-box,
.text-block-origin,
.text-block-resize {
  vector-effect: non-scaling-stroke;
}

.text-block-box {
  fill: rgba(255, 105, 78, 0.04);
  stroke: rgba(255, 188, 151, 0.72);
  stroke-width: 1.2;
  stroke-dasharray: 8 5;
}

.text-block-origin {
  fill: rgba(255, 209, 177, 0.98);
  stroke: rgba(34, 8, 10, 0.94);
  stroke-width: 1.2;
}

.text-block-resize {
  fill: rgba(126, 224, 181, 0.92);
  stroke: rgba(7, 34, 24, 0.94);
  stroke-width: 1.2;
  cursor: nwse-resize;
}

.text-block-label {
  fill: #ffd9c5;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.03em;
  paint-order: stroke;
  stroke: rgba(24, 6, 8, 0.9);
  stroke-width: 2.2;
  stroke-linejoin: round;
  pointer-events: none;
}

#previewSvg.is-dragging-text {
  cursor: move;
}

#previewSvg.is-resizing-text {
  cursor: nwse-resize;
}

.optimizer-sheet,
.optimizer-pack-box,
.optimizer-pack-path,
.optimizer-variant-sheet,
.optimizer-variant-box,
.optimizer-variant-path {
  vector-effect: non-scaling-stroke;
}

.optimizer-sheet {
  fill: rgba(255, 180, 120, 0.04);
  stroke: rgba(255, 180, 120, 0.6);
  stroke-width: 1.4;
  stroke-dasharray: 12 8;
}

.optimizer-sheet-inner {
  fill: none;
  stroke: rgba(255, 248, 241, 0.34);
  stroke-width: 1.1;
  stroke-dasharray: 8 7;
  vector-effect: non-scaling-stroke;
}

.optimizer-pack-box {
  fill: none;
  stroke-width: 1.2;
  stroke-dasharray: 7 5;
}

.optimizer-pack-path {
  fill: none;
  stroke-width: 1.6;
}

.optimizer-variant-sheet {
  fill: rgba(255, 180, 120, 0.035);
  stroke: rgba(255, 180, 120, 0.46);
  stroke-width: 1.2;
  stroke-dasharray: 10 7;
}

.optimizer-variant-box {
  fill: none;
  stroke-width: 1;
  stroke-dasharray: 6 4;
  opacity: 0.7;
}

.optimizer-variant-path {
  fill: none;
  stroke-width: 1.7;
}

.optimizer-pack-hit-area {
  fill: rgba(255, 255, 255, 0.001);
  stroke: none;
  pointer-events: all;
}

.optimizer-pack-label {
  fill: rgba(255, 244, 241, 0.92);
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.optimizer-pack {
  cursor: grab;
}

.optimizer-pack.is-selected .optimizer-pack-box {
  stroke-width: 2.6;
  filter:
    drop-shadow(0 0 10px rgba(255, 207, 171, 0.34))
    drop-shadow(0 0 18px rgba(255, 138, 61, 0.22));
}

.optimizer-pack.is-selected .optimizer-pack-path {
  stroke-width: 2.1;
}

.optimizer-pack.is-dragging {
  cursor: grabbing;
}

.optimizer-pack.is-dragging .optimizer-pack-box,
.optimizer-pack.is-dragging .optimizer-pack-path {
  filter: drop-shadow(0 0 10px rgba(255, 138, 61, 0.28));
}

.optimizer-pack-rotation {
  fill: rgba(255, 233, 220, 0.96);
  font-size: 8px;
  font-weight: 700;
  text-anchor: end;
  dominant-baseline: hanging;
  paint-order: stroke;
  stroke: rgba(24, 7, 9, 0.92);
  stroke-width: 2;
  pointer-events: none;
}

.optimizer-pack-controls {
  opacity: 0.98;
}

.optimizer-pack-control {
  cursor: pointer;
}

.optimizer-pack-control-disc {
  fill: rgba(46, 11, 16, 0.92);
  stroke: rgba(255, 186, 137, 0.96);
  stroke-width: 1.3;
  vector-effect: non-scaling-stroke;
  filter:
    drop-shadow(0 0 8px rgba(255, 141, 72, 0.2))
    drop-shadow(0 0 16px rgba(0, 0, 0, 0.28));
}

.optimizer-pack-control:hover .optimizer-pack-control-disc {
  fill: rgba(112, 24, 26, 0.96);
  stroke: rgba(255, 216, 182, 1);
}

.optimizer-pack-control-label {
  fill: rgba(255, 245, 240, 0.98);
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: rgba(24, 7, 9, 0.88);
  stroke-width: 1.6;
  pointer-events: none;
}

@media (max-width: 1360px) {
  .optimizer-layout,
  .camera-layout,
  .workspace {
    grid-template-columns: 1fr;
  }

  .sim-top-grid {
    grid-template-columns: 1fr;
  }

  .config-layout {
    grid-template-columns: 1fr;
  }

  .optimizer-preview-frame,
  #optimizerSvg,
  .camera-stage,
  .preview-frame,
  #previewSvg {
    min-height: 560px;
    height: 560px;
  }

  .hero-torch-rig {
    --hero-torch-scale: 0.5;
    flex-basis: 198px;
    width: 198px;
    height: 62px;
    opacity: 0.78;
  }
}

@media (max-width: 800px) {
  .app-shell {
    width: min(100vw, calc(100vw - 10px));
    margin: 5px auto;
    padding: 5px;
  }

  .topbar {
    padding: 18px;
  }

  .hero-brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero::after {
    width: min(58vw, 360px);
    inset: 8px -24px auto auto;
    opacity: 0.06;
  }

  .hero-torch-rig {
    display: none;
  }

  .stats-grid,
  .form-grid.compact,
  .meta-grid,
  .quote-stats,
  .sim-readout,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .sim-readout-card-wide {
    grid-column: span 1;
  }

  .topbar-actions,
  .canvas-toolbar {
    width: 100%;
  }

  .canvas-tool-group {
    width: 100%;
  }

  .canvas-tool-label {
    min-width: 92px;
  }

  .header-meta {
    width: 100%;
  }

  .optimizer-item-actions,
  .topbar-actions .button,
  .canvas-toolbar .button,
  .config-actions .button {
    flex: 1 1 180px;
  }

  .optimizer-preview-frame,
  #optimizerSvg,
  .camera-stage,
  .preview-frame,
  #previewSvg {
    min-height: 420px;
    height: 420px;
  }
}

@keyframes heroTorchFloat {
  0%,
  100% {
    transform: rotate(-8deg) translateY(0);
  }
  50% {
    transform: rotate(-5deg) translateY(-4px);
  }
}

@keyframes heroTorchFloatTitle {
  0%,
  100% {
    transform: scale(var(--hero-torch-scale)) rotate(-8deg) translateY(0);
  }
  50% {
    transform: scale(var(--hero-torch-scale)) rotate(-5deg) translateY(-4px);
  }
}

@keyframes heroTorchFlame {
  0% {
    transform: scaleX(0.94) scaleY(0.94) rotate(-3deg);
  }
  100% {
    transform: scaleX(1.08) scaleY(1.06) rotate(4deg);
  }
}

@keyframes heroTorchSpark1 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scaleX(0.4) rotate(-10deg);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(58px, -18px) scaleX(1.3) rotate(-14deg);
  }
}

@keyframes heroTorchSpark2 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scaleX(0.42) rotate(6deg);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(66px, 8px) scaleX(1.2) rotate(12deg);
  }
}

@keyframes heroTorchSpark3 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scaleX(0.36) rotate(14deg);
  }
  16% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(62px, 22px) scaleX(1.1) rotate(18deg);
  }
}

@keyframes heroTorchSpark4 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scaleX(0.28) rotate(-18deg);
  }
  22% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(50px, -28px) scaleX(1.15) rotate(-22deg);
  }
}
