@font-face {
  font-family: "Bungee";
  src: url("/assets/fonts/Bungee-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Archivo Black";
  src: url("/assets/fonts/ArchivoBlack-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Bangers";
  src: url("/assets/fonts/Bangers-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Changa One";
  src: url("/assets/fonts/ChangaOne-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Bebas Neue";
  src: url("/assets/fonts/BebasNeue-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/assets/fonts/Poppins-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/assets/fonts/Poppins-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/assets/fonts/Poppins-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/assets/fonts/Poppins-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/assets/fonts/Poppins-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

:root {
  --paper: #f3f0e8;
  --paper-deep: #e8e3d8;
  --surface: #fbf9f3;
  --surface-2: #f6f2e9;
  --ink: #181816;
  --ink-soft: #3b3a33;
  --muted: #817c6d;
  --muted-2: #a49e8e;
  --line: #e1dbce;
  --line-strong: #cbc4b4;
  --acid: #dcff4f;
  --acid-deep: #c9ef3b;
  --orange: #ff5b35;
  --blue: #2f6bff;
  --good: #1fa971;
  --danger: #cf3f25;
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(30, 27, 20, 0.05), 0 4px 16px rgba(30, 27, 20, 0.04);
  --shadow: 0 18px 48px rgba(34, 30, 20, 0.12), 0 2px 8px rgba(34, 30, 20, 0.06);
  --font-ui: "Poppins", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-display: "Bungee", "Poppins", "Microsoft YaHei", sans-serif;
  --panel-w: 430px;
  --topbar-h: 74px;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
button:disabled {
  cursor: not-allowed;
}
a {
  color: inherit;
}
svg {
  display: block;
}
::selection {
  background: var(--acid);
  color: var(--ink);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ——————————————————————————————— shell */
.app-shell {
  height: 100dvh;
  min-height: 620px;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 0 26px 0 22px;
  background: rgba(251, 249, 243, 0.94);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 30;
  backdrop-filter: blur(14px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--ink);
  color: var(--acid);
  display: grid;
  place-items: center;
  padding: 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.brand-mark svg {
  width: 100%;
  height: 100%;
}
.brand-word {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}
.brand-word strong {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.02em;
  font-weight: 400;
}
.brand-word small {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--muted);
  font-weight: 600;
}
.topbar-center {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.topbar-center i {
  width: 1px;
  height: 13px;
  background: var(--line-strong);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(31, 169, 113, 0.12);
  flex: 0 0 auto;
  animation: livePulse 2.4s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(31, 169, 113, 0.1); }
  50% { box-shadow: 0 0 0 6px rgba(31, 169, 113, 0.04); }
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.server-pill {
  height: 36px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}
.server-pill svg {
  width: 15px;
  height: 15px;
  color: var(--good);
}
.server-pill:hover {
  border-color: var(--line-strong);
  background: #fffdf7;
}
.server-pill:active {
  transform: translateY(1px);
}
.printer-pill {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf7;
  padding: 0 12px 0 13px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
.printer-pill:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.printer-pill:active {
  transform: translateY(1px);
}
.printer-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
  transition: background 0.2s ease;
}
.printer-pill.online .printer-status-dot {
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(31, 169, 113, 0.12);
}
.printer-pill.busy .printer-status-dot {
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 91, 53, 0.12);
}
.printer-pill-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.printer-pill-label b {
  font-size: 10.5px;
  font-weight: 600;
}
.printer-pill-label small {
  font-size: 8.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.printer-pill .chev {
  width: 12px;
  height: 12px;
  color: var(--muted);
  margin-left: 2px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--ink-soft);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.icon-btn svg {
  width: 17px;
  height: 17px;
}

/* ——————————————————————————————— studio */
.studio {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
}

/* ——————————————————————————————— stage */
.stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(72% 58% at 58% 40%, #fbf8f0 0%, rgba(251, 248, 240, 0) 70%),
    radial-gradient(90% 90% at 72% 12%, #f8f5ec 0%, rgba(248, 245, 236, 0) 58%),
    linear-gradient(138deg, #f6f2e9 0%, #efeadf 54%, #e7e1d5 100%);
}
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(40, 36, 26, 0.13) 0.65px, transparent 0.65px);
  background-size: 24px 24px;
  mask-image: radial-gradient(70% 80% at 52% 58%, #000 0%, transparent 78%);
  opacity: 0.42;
  pointer-events: none;
  z-index: 0;
}
.stage-paper-grain {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.22;
  pointer-events: none;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}
#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  outline: none;
  touch-action: none;
}
.stage-copy {
  position: absolute;
  z-index: 3;
  top: 38px;
  left: 42px;
  pointer-events: none;
  max-width: 430px;
}
.eyebrow {
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.17em;
  color: var(--muted);
}
.eyebrow i {
  width: 22px;
  height: 1px;
  background: var(--line-strong);
}
.eyebrow span:first-child {
  color: var(--ink);
}
.stage-copy h1 {
  margin: 0;
  font-size: clamp(40px, 4.6vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.055em;
  font-weight: 600;
  color: var(--ink);
}
.stage-copy h1 em {
  font-style: normal;
  position: relative;
  display: inline-block;
}
.stage-copy h1 em::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -2%;
  right: -1%;
  bottom: 7%;
  height: 19%;
  background: var(--acid);
  transform: rotate(-1.4deg);
  border-radius: 2px;
}
.stage-sub {
  margin: 16px 0 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.stage-tools {
  position: absolute;
  z-index: 4;
  top: 30px;
  right: 30px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tool-pill {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(55, 48, 36, 0.13);
  background: rgba(255, 253, 247, 0.72);
  backdrop-filter: blur(12px);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-soft);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.tool-pill:hover {
  background: rgba(255, 253, 247, 0.95);
  border-color: rgba(55, 48, 36, 0.26);
}
.tool-pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.tool-pill svg {
  width: 16px;
  height: 16px;
}
.tool-pill .chev {
  width: 11px;
  height: 11px;
  margin-left: 1px;
  opacity: 0.55;
}
.tool-icon {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(55, 48, 36, 0.13);
  border-radius: 50%;
  background: rgba(255, 253, 247, 0.72);
  display: grid;
  place-items: center;
  backdrop-filter: blur(12px);
  transition: background 0.2s ease, transform 0.2s ease;
}
.tool-icon:hover {
  background: #fffdf7;
}
.tool-icon:active {
  transform: scale(0.94);
}
.tool-icon svg {
  width: 17px;
  height: 17px;
}
.view-menu-wrap {
  position: relative;
}
.view-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 176px;
  padding: 6px;
  background: rgba(255, 253, 247, 0.97);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  z-index: 30;
  animation: popIn 0.16s ease-out;
}
.view-popover button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 11px;
  text-align: left;
}
.view-popover button:hover {
  background: var(--surface-2);
}
kbd {
  font-family: var(--font-ui);
  font-size: 8.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.dim-hud {
  position: absolute;
  z-index: 3;
  left: 42px;
  bottom: 106px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  pointer-events: none;
}
.dim-label,
.mini-label {
  font-size: 8px;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--muted);
}
.dim-value {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.dim-unit {
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.stage-footer {
  position: absolute;
  z-index: 3;
  left: 42px;
  right: 32px;
  bottom: 27px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  pointer-events: none;
}
.material-readout {
  display: flex;
  align-items: center;
  gap: 11px;
  pointer-events: auto;
}
.material-swatch {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 4px 12px rgba(20, 18, 12, 0.16);
  flex: 0 0 auto;
}
.material-readout > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.material-readout strong {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.material-divider {
  width: 1px;
  height: 25px;
  background: var(--line-strong);
  margin: 0 4px;
}
.orbit-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 9.5px;
  color: var(--muted);
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.orbit-hint svg {
  width: 16px;
  height: 16px;
  opacity: 0.65;
}
.orbit-hint.hidden {
  opacity: 0;
}
.stage-badge {
  position: absolute;
  z-index: 3;
  right: 32px;
  top: 99px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--muted);
  pointer-events: none;
}
.stage-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--acid-deep);
  box-shadow: 0 0 0 3px rgba(201, 239, 59, 0.16);
}
.viewer-loading {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  height: 33px;
  padding: 0 13px;
  background: rgba(24, 24, 22, 0.86);
  color: #fff;
  border-radius: 999px;
  font-size: 9.5px;
  letter-spacing: 0.03em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(10px);
}
.viewer-loading.visible {
  opacity: 1;
}
.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--acid);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.viewer-error {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  max-width: 320px;
  text-align: center;
}
.viewer-error strong {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
}
.viewer-error p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

/* ——————————————————————————————— panel */
.panel {
  background: var(--surface);
  border-left: 1px solid var(--line);
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  box-shadow: -10px 0 40px rgba(34, 30, 20, 0.025);
}
.panel-head {
  flex: 0 0 auto;
  padding: 23px 26px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.panel-kicker {
  margin: 0 0 6px;
  font-size: 8px;
  letter-spacing: 0.17em;
  font-weight: 600;
  color: var(--muted);
}
.panel-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--muted);
  padding: 5px 0;
  white-space: nowrap;
}
.text-btn:hover {
  color: var(--ink);
}
.text-btn svg {
  width: 13px;
  height: 13px;
}
.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 26px 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.panel-scroll::-webkit-scrollbar {
  width: 5px;
}
.panel-scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
}
.control-section {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.control-section.first {
  border-top: 0;
  padding-top: 6px;
}
.section-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
}
.section-num {
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 22px;
  height: 17px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.section-heading h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-meta {
  margin-left: auto;
  font-size: 8.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.section-desc {
  margin: -5px 0 14px;
  font-size: 9.5px;
  line-height: 1.6;
  color: var(--muted);
}
.name-field {
  position: relative;
  margin-top: 2px;
}
.name-field input {
  width: 100%;
  height: 59px;
  padding: 0 38px 0 0;
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: 33px;
  line-height: 1;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}
.name-field input::placeholder {
  color: var(--muted-2);
  opacity: 0.55;
}
.name-field input:focus {
  border-bottom-color: var(--blue);
}
.name-field.invalid input {
  border-bottom-color: var(--danger);
}
.clear-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.name-field:hover .clear-btn,
.name-field input:focus + .clear-btn {
  opacity: 1;
  pointer-events: auto;
}
.clear-btn:hover {
  color: var(--ink);
}
.clear-btn svg {
  width: 12px;
  height: 12px;
}
.field-hint {
  margin: 9px 0 0;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.field-hint b {
  color: var(--ink-soft);
  font-weight: 600;
}
.example-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 13px;
}
.example-row > span {
  font-size: 8.5px;
  color: var(--muted-2);
  margin-right: 3px;
}
.example-row button {
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.4);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.example-row button:hover {
  border-color: var(--ink);
  background: #fff;
}
.font-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.font-card {
  position: relative;
  min-height: 82px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
  border-radius: var(--radius-sm);
  padding: 11px 12px 10px;
  text-align: left;
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.font-card:hover {
  border-color: var(--line-strong);
  background: #fffdf8;
}
.font-card.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.font-card.active .font-note {
  color: rgba(255, 255, 255, 0.55);
}
.fontAa {
  display: block;
  font-size: 28px;
  line-height: 1;
  margin-bottom: 8px;
  height: 26px;
  letter-spacing: -0.02em;
}
.font-name {
  display: block;
  font-size: 8.5px;
  font-weight: 600;
  font-family: var(--font-ui);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.font-note {
  display: block;
  margin-top: 2px;
  font-size: 8px;
  font-family: var(--font-ui);
  color: var(--muted);
  letter-spacing: 0.01em;
}
.font-card .check {
  position: absolute;
  right: 9px;
  top: 9px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--acid);
  display: none;
  place-items: center;
}
.font-card.active .check {
  display: grid;
}
.font-card .check svg {
  width: 8px;
  height: 8px;
  color: var(--ink);
}
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 8px;
}
.control-row:first-of-type {
  margin-top: 0;
}
.control-row label {
  font-size: 10.5px;
  color: var(--ink-soft);
}
.control-row output {
  font-size: 10px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
}
.range {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  outline: none;
  cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--ink) 0%, var(--ink) var(--fill), var(--line) var(--fill), var(--line) 100%);
}
.range::-moz-range-track {
  height: 4px;
  border-radius: 99px;
  background: var(--line);
}
.range::-moz-range-progress {
  height: 4px;
  border-radius: 99px;
  background: var(--ink);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: #fffdf8;
  border: 2px solid var(--ink);
  box-shadow: 0 1px 4px rgba(20, 18, 12, 0.14);
  transition: transform 0.15s ease, background 0.15s ease;
}
.range:hover::-webkit-slider-thumb {
  transform: scale(1.12);
  background: var(--acid);
}
.range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fffdf8;
  border: 2px solid var(--ink);
}
.range:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.range-scale {
  display: flex;
  justify-content: space-between;
  font-size: 7.5px;
  color: var(--muted-2);
  margin-top: -2px;
  letter-spacing: 0.02em;
}
.sub-label {
  font-size: 9px;
  color: var(--muted);
  margin: 18px 0 8px;
  letter-spacing: 0.03em;
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.segmented button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 9px 10px;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.segmented button:hover {
  border-color: var(--line-strong);
  background: #fffdf8;
}
.segmented button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}
.segmented button > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.segmented b {
  font-size: 10px;
  font-weight: 500;
}
.segmented small {
  font-size: 8px;
  color: var(--muted);
  font-weight: 400;
}
.segmented button.active small {
  color: rgba(255, 255, 255, 0.55);
}
.seg-icon {
  width: 22px;
  height: 22px;
  border: 1.4px solid var(--muted);
  border-radius: 5px;
  flex: 0 0 auto;
  position: relative;
}
.segmented button.active .seg-icon {
  border-color: var(--acid);
}
.hug-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 6px;
  height: 9px;
  border: 1.4px solid currentColor;
  border-radius: 3px;
  opacity: 0.6;
}
.plate-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 4px;
  bottom: 4px;
  background: currentColor;
  opacity: 0.45;
  border-radius: 2px;
}
.switch-group {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 8.5px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.01em;
}
.switch {
  position: relative;
  display: inline-flex;
  width: 37px;
  height: 21px;
  flex: 0 0 auto;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.switch-track {
  width: 37px;
  height: 21px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.2s ease;
  pointer-events: none;
  position: relative;
}
.switch-track::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  left: 3px;
  top: 3px;
  box-shadow: 0 1px 3px rgba(20, 18, 12, 0.2);
  transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.3, 1.2);
}
.switch input:checked + .switch-track {
  background: var(--ink);
}
.switch input:checked + .switch-track::after {
  transform: translateX(16px);
  background: var(--acid);
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.height-visual {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 30px;
  margin: 0 0 15px;
  padding: 0 1px;
}
.height-visual .bar {
  flex: 1;
  border-radius: 3px 3px 1px 1px;
  background: var(--ink);
  transition: height 0.25s ease, background 0.25s ease;
}
.height-visual .bar-a {
  height: 26px;
  background: var(--ink);
}
.height-visual .bar-b {
  height: 15px;
  background: var(--line-strong);
}
.height-visual.disabled .bar-a {
  height: 19px;
  background: var(--line-strong);
}
.height-visual.disabled .bar-b {
  height: 19px;
}
.ring-settings {
  transition: opacity 0.2s ease;
}
.ring-settings.disabled {
  opacity: 0.35;
  pointer-events: none;
}
.ring-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.segmented.compact {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.segmented.compact button {
  min-height: 25px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  font-size: 9px;
  display: grid;
  place-items: center;
}
.segmented.compact button:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: transparent;
}
.segmented.compact button.active {
  background: #fffdf8;
  color: var(--ink);
  border: 0;
  box-shadow: 0 1px 3px rgba(20, 18, 12, 0.12);
}
.ring-note {
  font-size: 8.5px;
  color: var(--muted);
}
.mini-range .control-row {
  margin-top: 12px;
}
.color-section {
  padding-bottom: 24px;
}
.color-block {
  margin-top: 15px;
  transition: opacity 0.2s ease;
}
.color-block.disabled {
  opacity: 0.35;
  pointer-events: none;
}
.color-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.color-code {
  font-size: 8px;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.swatch-strip {
  display: flex;
  gap: 7px;
}
.swatch {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--swatch);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.swatch:hover {
  transform: translateY(-1px) scale(1.06);
}
.swatch.active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink), inset 0 0 0 2px rgba(255, 255, 255, 0.16);
}
.swatch.active::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  mix-blend-mode: difference;
  opacity: 0.9;
}
.swatch.custom {
  background: conic-gradient(from 0deg, #ff5b35, #e8ff52, #63e6be, #2f6bff, #a45cff, #ff9ec4, #ff5b35);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  overflow: hidden;
}
.swatch.custom input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.advanced {
  border-top: 1px solid var(--line);
  padding: 17px 0;
}
.advanced summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10.5px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.advanced summary::-webkit-details-marker {
  display: none;
}
.advanced summary > span:first-child {
  font-weight: 500;
}
.advanced summary > span:nth-child(2) {
  font-size: 8.5px;
  color: var(--muted);
}
.advanced summary svg {
  width: 13px;
  height: 13px;
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.2s ease;
}
.advanced[open] summary svg {
  transform: rotate(180deg);
}
.advanced-body {
  padding-top: 13px;
}
.micro-note {
  margin: 9px 0 0;
  font-size: 8px;
  line-height: 1.55;
  color: var(--muted);
}
.reference-note {
  position: relative;
  margin: 12px 0 8px;
  padding: 14px 14px 13px 39px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 8.5px;
  line-height: 1.65;
  color: var(--muted);
}
.reference-note .ref-mark {
  position: absolute;
  left: 14px;
  top: 12px;
  font-size: 13px;
  color: var(--ink);
}
.reference-note p {
  margin: 0;
}
.reference-note b {
  color: var(--ink-soft);
  font-weight: 500;
}
.reference-note a {
  display: inline-block;
  margin-top: 7px;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
}
.reference-note a:hover {
  border-bottom-color: var(--ink);
}
.panel-actions {
  flex: 0 0 auto;
  padding: 14px 26px 18px;
  border-top: 1px solid var(--line);
  background: linear-gradient(to bottom, rgba(251, 249, 243, 0.8), var(--surface) 38%);
  box-shadow: 0 -12px 24px rgba(251, 249, 243, 0.7);
}
.delivery-note {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .02em;
}
.summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 8.5px;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.summary-weight {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.summary-weight i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--acid-deep);
  display: inline-block;
}
.summary-weight b {
  color: var(--ink);
  font-weight: 500;
}
.summary-size {
  font-variant-numeric: tabular-nums;
}
.action-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.btn {
  height: 51px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}
.btn:active {
  transform: translateY(1px) scale(0.995);
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn.primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 20px rgba(24, 24, 22, 0.18);
  position: relative;
  overflow: hidden;
}
.btn.primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--acid);
  transform: translateY(101%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn.primary:hover:not(:disabled)::before {
  transform: translateY(0);
}
.btn.primary > * {
  position: relative;
  z-index: 1;
}
.btn.primary:hover:not(:disabled) {
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(24, 24, 22, 0.16);
}
.btn.primary svg {
  color: var(--acid);
  transition: color 0.18s ease;
}
.btn.primary:hover:not(:disabled) svg {
  color: var(--ink);
}
.btn.primary:disabled {
  opacity: 1;
  background: #ded8cb;
  color: #6f695d;
  box-shadow: none;
}
.btn.primary:disabled::before {
  display: none;
}
.btn.primary:disabled svg {
  color: #6f695d;
}
.btn.ghost:disabled {
  opacity: 0.45;
  background: transparent;
}
.modal-open {
  overflow: hidden;
}
.btn.ghost {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.btn.ghost:hover {
  background: #fffdf8;
  border-color: var(--line-strong);
}
.btn.outline {
  background: transparent;
  border: 1px solid var(--line-strong);
}
.btn.outline:hover {
  border-color: var(--ink);
}
.btn.small {
  height: 38px;
  font-size: 9.5px;
  border-radius: 8px;
  padding: 0 14px;
}
#openPrintBtn {
  flex: 1.6;
}
.export-wrap {
  position: relative;
  flex: 0.8;
  min-width: 82px;
}
.export-wrap .btn {
  width: 100%;
}
.export-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 242px;
  padding: 6px;
  background: rgba(255, 253, 247, 0.98);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 40;
  animation: popIn 0.16s ease-out;
  backdrop-filter: blur(16px);
}
.export-popover button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px;
  border-radius: 8px;
  text-align: left;
}
.export-popover button:hover {
  background: var(--surface-2);
}
.file-icon {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  flex: 0 0 auto;
}
.export-popover b {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
}
.export-popover small {
  display: block;
  margin-top: 1px;
  font-size: 8px;
  color: var(--muted);
}

/* ——————————————————————————————— drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 22, 17, 0.38);
  backdrop-filter: blur(4px);
  z-index: 80;
  animation: fadeIn 0.22s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.drawer {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(520px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 70px rgba(24, 22, 17, 0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform 0.34s cubic-bezier(0.32, 0.72, 0.24, 1);
}
.drawer.open {
  transform: translateX(0);
}
.drawer-head {
  flex: 0 0 auto;
  padding: 24px 24px 19px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.drawer-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.035em;
  font-weight: 600;
}
.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 24px 30px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.drawer-body::-webkit-scrollbar {
  width: 5px;
}
.drawer-body::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
}
.drawer-section {
  padding: 22px 0 24px;
  border-bottom: 1px solid var(--line);
}
.drawer-section:last-of-type {
  border-bottom: 0;
}
.drawer-section-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 15px;
}
.drawer-step {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--acid);
  display: grid;
  place-items: center;
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  flex: 0 0 auto;
  margin-top: 1px;
}
.drawer-section-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.drawer-section-head p {
  margin: 3px 0 0;
  font-size: 8.5px;
  color: var(--muted);
  line-height: 1.5;
}
.mini-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 8.5px;
  color: var(--ink-soft);
  background: #fffdf8;
  white-space: nowrap;
  transition: border-color 0.15s ease;
}
.mini-btn:hover {
  border-color: var(--line-strong);
}
.radar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  position: relative;
}
.radar-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px solid var(--good);
  border-radius: 50%;
  opacity: 0.35;
}
.mini-btn.scanning .radar-dot {
  animation: scanPulse 1s ease-in-out infinite;
}
@keyframes scanPulse {
  50% { box-shadow: 0 0 0 6px rgba(31, 169, 113, 0.12); }
}
.discovered-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.discovered-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  text-align: left;
}
.discovered-item:hover {
  border-color: var(--ink);
  background: #fffdf8;
}
.discovered-item b {
  font-size: 9px;
  font-weight: 500;
  display: block;
}
.discovered-item small {
  font-size: 7.5px;
  color: var(--muted);
  display: block;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}
.discovered-item .dev-ip {
  margin-left: auto;
  font-size: 8.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.field-grid {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  gap: 9px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 11px;
}
.field > span {
  font-size: 8.5px;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.field > span em {
  font-style: normal;
  font-size: 7.5px;
  color: var(--muted-2);
  margin-left: 5px;
}
.field input,
.field select {
  height: 39px;
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 7px;
  padding: 0 10px;
  font-size: 10.5px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.field input:focus,
.field select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(24, 24, 22, 0.05);
}
.field input::placeholder {
  color: var(--muted-2);
}
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 17px, calc(100% - 8px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.password-field {
  position: relative;
}
.password-field input {
  width: 100%;
  padding-right: 40px;
}
.eye-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--muted);
}
.eye-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.eye-btn svg {
  width: 16px;
  height: 16px;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 2px;
}
.connection-note {
  font-size: 7.5px;
  color: var(--muted-2);
  line-height: 1.5;
}
.printer-card {
  margin-top: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 13px;
  animation: fadeUp 0.25s ease;
}
.printer-card-top {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}
.printer-avatar {
  width: 33px;
  height: 33px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--acid);
  display: grid;
  place-items: center;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.printer-card-top > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.printer-card-top b {
  font-size: 10px;
  font-weight: 500;
}
.printer-card-top small {
  font-size: 8px;
  color: var(--muted);
}
.status-badge {
  margin-left: auto;
  font-size: 7.5px;
  font-weight: 500;
  color: var(--good);
  background: rgba(31, 169, 113, 0.09);
  border: 1px solid rgba(31, 169, 113, 0.18);
  border-radius: 999px;
  padding: 3px 8px;
}
.status-badge.offline {
  color: var(--danger);
  background: rgba(207, 63, 37, 0.07);
  border-color: rgba(207, 63, 37, 0.18);
}
.status-badge.warn {
  color: #a16b00;
  background: rgba(255, 176, 32, 0.1);
  border-color: rgba(255, 176, 32, 0.25);
}
.printer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 7px;
  padding: 11px 0;
}
.printer-stats div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.printer-stats span {
  font-size: 7px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.printer-stats b {
  font-size: 9px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.ams-trays {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.ams-tray {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 4px;
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 999px;
  font-size: 7.5px;
  color: var(--ink-soft);
}
.ams-tray i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.printer-warning {
  margin: 10px 0 0;
  font-size: 8px;
  line-height: 1.55;
  color: #976200;
  background: rgba(255, 176, 32, 0.08);
  border: 1px solid rgba(255, 176, 32, 0.2);
  border-radius: 6px;
  padding: 7px 8px;
}
.material-map {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fffdf8;
}
.material-map-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
}
.material-map-row + .material-map-row {
  border-top: 1px solid var(--line);
}
.material-map-row.disabled {
  opacity: 0.35;
}
.map-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--swatch);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
  flex: 0 0 auto;
}
.map-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.map-label b {
  font-size: 9px;
  font-weight: 500;
}
.map-label small {
  font-size: 7.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.material-map-row select {
  margin-left: auto;
  width: 72px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: var(--surface-2);
  padding: 0 22px 0 9px;
  font-size: 8.5px;
  background-position: calc(100% - 11px) 13px, calc(100% - 7px) 13px;
}
.check-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  font-size: 9px;
  color: var(--ink-soft);
  line-height: 1.5;
  cursor: pointer;
}
.check-line input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.check-box {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: #fffdf8;
  flex: 0 0 auto;
  position: relative;
  margin-top: 0.5px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.check-line input:checked + .check-box {
  background: var(--ink);
  border-color: var(--ink);
}
.check-line input:checked + .check-box::after {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 1.5px;
  width: 3.5px;
  height: 7px;
  border: solid var(--acid);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(42deg);
}
.check-line.safety {
  font-size: 8.5px;
  margin-top: 13px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.slicer-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.slicer-status .status-ico {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 10px;
  flex: 0 0 auto;
}
.slicer-status.ok .status-ico {
  background: var(--acid);
}
.slicer-status.warn .status-ico {
  background: #ffe5a8;
  color: #8f6500;
}
.slicer-status > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.slicer-status b {
  font-size: 8.5px;
  font-weight: 500;
}
.slicer-status small {
  font-size: 7.5px;
  color: var(--muted);
  line-height: 1.45;
}
.slicer-status a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  margin-left: 2px;
  text-decoration: none;
}
.drawer-advanced {
  margin-top: 13px;
  padding-bottom: 0;
}
.print-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  background: var(--surface-2);
}
.print-summary div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.print-summary span {
  font-size: 7.5px;
  color: var(--muted);
}
.print-summary b {
  font-size: 9.5px;
  font-weight: 500;
}
.drawer-foot {
  flex: 0 0 auto;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 14px;
}
.drawer-foot .btn {
  flex: 0 0 215px;
  height: 46px;
}
.drawer-foot-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 8px;
  color: var(--muted);
  line-height: 1.4;
}
.job-progress {
  margin: 20px 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  background: var(--surface-2);
}
.job-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.job-head h3 {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 600;
}
.job-percent {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.progress-track {
  height: 5px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
  margin: 12px 0 10px;
}
.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--ink);
  transition: width 0.45s ease;
}
.job-steps {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 7.5px;
  color: var(--muted-2);
}
.job-steps span.active {
  color: var(--ink);
  font-weight: 500;
}
.job-steps span.done {
  color: var(--good);
}
.job-steps i {
  width: 14px;
  height: 1px;
  background: var(--line-strong);
}
.job-log {
  margin-top: 10px;
  max-height: 97px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 7.5px;
  line-height: 1.5;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.job-log span::before {
  content: "›";
  margin-right: 5px;
  color: var(--muted-2);
}
.job-log span.error {
  color: var(--danger);
}
.job-error {
  margin-top: 13px;
  border: 1px solid rgba(207, 63, 37, 0.22);
  background: rgba(207, 63, 37, 0.045);
  border-radius: 9px;
  padding: 11px;
}
.job-error strong {
  display: block;
  color: var(--danger);
  font-size: 10px;
  font-weight: 600;
}
.job-error p {
  margin: 5px 0 0;
  font-size: 8px;
  line-height: 1.55;
}
.job-error-hint {
  color: var(--muted);
}
.job-error-actions {
  display: flex;
  gap: 7px;
  margin-top: 10px;
}
.job-error-actions .btn {
  flex: 1;
}
.job-success {
  text-align: center;
  padding: 8px 4px 3px;
}
.success-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--acid);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 19px;
  margin: 2px auto 9px;
}
.job-success h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.job-success p {
  margin: 6px auto 0;
  max-width: 300px;
  font-size: 8.5px;
  line-height: 1.6;
  color: var(--muted);
}
.job-success-actions {
  display: flex;
  gap: 7px;
  justify-content: center;
  margin-top: 12px;
}
.job-success-actions .btn {
  flex: 1;
  display: inline-flex;
  text-decoration: none;
}

/* ——————————————————————————————— help & toast */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(24, 22, 17, 0.4);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.help-modal {
  width: min(720px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 120px rgba(20, 18, 12, 0.3);
  padding: 26px;
  animation: modalIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.help-modal header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.help-modal h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.04em;
  font-weight: 600;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 20px 0;
}
.help-step {
  background: var(--surface);
  padding: 16px;
}
.help-step > span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 18px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--acid);
  font-size: 7.5px;
  margin-bottom: 12px;
}
.help-step h3 {
  margin: 0 0 5px;
  font-size: 11px;
  font-weight: 600;
}
.help-step p {
  margin: 0;
  font-size: 8.5px;
  line-height: 1.65;
  color: var(--muted);
}
.help-checklist {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
}
.help-checklist h3 {
  margin: 0 0 9px;
  font-size: 10px;
  font-weight: 600;
}
.help-checklist ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 16px;
}
.help-checklist li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8.5px;
  color: var(--muted);
}
.help-checklist li span {
  color: var(--good);
  font-weight: 700;
}
.help-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 19px;
}
.help-foot > span {
  font-size: 8px;
  color: var(--muted);
  line-height: 1.5;
}
.help-foot .btn {
  flex: 0 0 130px;
  height: 40px;
}
.toast-stack {
  position: fixed;
  z-index: 200;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--ink);
  color: #fff;
  border-radius: 9px;
  padding: 11px 14px;
  font-size: 9px;
  box-shadow: 0 12px 30px rgba(20, 18, 12, 0.28);
  animation: toastIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-width: 340px;
  line-height: 1.5;
}
.toast::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--acid);
  flex: 0 0 auto;
}
.toast.error::before {
  background: var(--orange);
}
.toast.success::before {
  background: var(--acid);
}
.toast.out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ——————————————————————————————— responsive */
@media (max-width: 1240px) {
  :root { --panel-w: 392px; }
  .topbar-center { display: none; }
  .stage-copy { left: 32px; top: 32px; }
  .stage-copy h1 { font-size: clamp(36px, 4.4vw, 50px); }
  .stage-tools { right: 22px; top: 24px; }
  .stage-footer, .dim-hud { left: 32px; }
  .stage-footer { right: 24px; }
  .server-pill { display: none; }
}
@media (max-width: 1180px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }
  .app-shell {
    height: auto;
    min-height: 100dvh;
  }
  .topbar {
    position: sticky;
    top: 0;
    height: 64px;
    flex-basis: 64px;
    padding: 0 15px;
  }
  .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
  .brand-word strong { font-size: 16px; }
  .brand-word small { font-size: 7.5px; }
  .printer-pill-label small { display: none; }
  .printer-pill { height: 34px; padding: 0 9px; }
  .printer-pill .chev { display: none; }
  .printer-pill-label b { font-size: 9px; }
  .icon-btn { width: 34px; height: 34px; }
  .studio {
    display: block;
    min-height: 0;
  }
  .stage {
    height: 54dvh;
    min-height: 370px;
  }
  .stage-copy {
    top: 24px;
    left: 22px;
    max-width: 330px;
  }
  .stage-copy h1 { font-size: 38px; }
  .stage-sub { font-size: 9.5px; margin-top: 11px; max-width: 260px; }
  .eyebrow { margin-bottom: 11px; font-size: 8px; }
  .stage-tools { top: 18px; right: 16px; gap: 5px; }
  .tool-pill { height: 31px; padding: 0 9px; font-size: 8.5px; }
  .tool-icon { width: 31px; height: 31px; }
  .stage-badge { display: none; }
  .stage-footer { left: 22px; right: 18px; bottom: 18px; }
  .dim-hud { left: 22px; bottom: 80px; }
  .material-divider, .material-tech { display: none; }
  .orbit-hint { font-size: 8px; }
  .orbit-hint svg { width: 14px; height: 14px; }
  .viewer-loading { bottom: 18px; }
  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 22px 22px 0 0;
    margin-top: -16px;
    position: relative;
    z-index: 10;
    box-shadow: 0 -12px 40px rgba(34, 30, 20, 0.07);
  }
  .panel-head { padding: 20px 20px 14px; }
  .panel-head h2 { font-size: 18px; }
  .panel-scroll { overflow: visible; padding: 0 20px 26px; }
  .panel-actions {
    position: sticky;
    bottom: 0;
    z-index: 12;
    padding: 12px 20px max(14px, env(safe-area-inset-bottom));
    background: rgba(251, 249, 243, 0.96);
    backdrop-filter: blur(12px);
  }
  .font-grid { gap: 7px; }
  .drawer { width: 100vw; }
  .drawer-head { padding: 19px 18px 15px; }
  .drawer-head h2 { font-size: 19px; }
  .drawer-body { padding: 0 18px 24px; }
  .drawer-foot { padding: 12px 18px max(14px, env(safe-area-inset-bottom)); }
  .drawer-foot .btn { flex: 1; }
  .drawer-foot-note { display: none; }
  .toast-stack { right: 14px; left: 14px; bottom: 14px; align-items: stretch; }
  .toast { max-width: none; }
  .help-modal { padding: 20px; border-radius: 18px; }
  .help-grid { grid-template-columns: 1fr; }
  .help-checklist ul { grid-template-columns: 1fr; }
  .help-foot { flex-direction: column; align-items: stretch; }
  .help-foot .btn { flex: 0 0 auto; }
}
@media (max-width: 540px) {
  .stage { height: 50dvh; min-height: 335px; }
  .stage-copy h1 { font-size: 32px; }
  .stage-copy h1 br { display: none; }
  .stage-sub { display: none; }
  .eyebrow { margin-bottom: 8px; }
  .stage-copy { max-width: 220px; }
  .stage-copy h1 em::after { bottom: 3%; height: 17%; }
  .stage-tools .tool-pill span { display: none; }
  .stage-tools .tool-pill { width: 32px; padding: 0; justify-content: center; }
  .stage-tools .tool-pill .chev { display: none; }
  .view-menu-wrap .tool-pill span { display: none; }
  .dim-hud { bottom: 72px; }
  .dim-value { font-size: 13px; }
  .stage-footer { bottom: 14px; }
  .material-swatch { width: 24px; height: 24px; }
  .material-readout strong { font-size: 8.5px; }
  .orbit-hint span { display: none; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .drawer-section-head { flex-wrap: wrap; }
  .mini-btn { margin-left: 33px; }
  .drawer-foot .btn { font-size: 10px; }
  .action-row .btn { font-size: 9.5px; }
  .btn { height: 47px; }
  .panel-actions { padding-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
