/* ═══════════════════════════════════════════════════════════════════════
   DESK ORGANIZER MAKER — "Workshop / Gridfinity" theme
   Warm charcoal chassis, workshop orange + lime, rounded modular-block
   motifs, baseplate-socket background. Rubik display + JetBrains Mono data.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #141416;
  --panel: #1d1e22;
  --panel2: #171719;
  --line: #2d2e33;
  --accent: #ff9538;
  --teal: #a3e635;
  --text: #eceae4;
  --mute: #a5a29a;
  --hint: #77746b;
  --font-display: 'Rubik', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'SF Mono', monospace;
  --gb-cell: 34px;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  margin: 0;
  padding: 0;
  /* Warm glow + gridfinity baseplate sockets tiled behind everything */
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(255, 149, 56, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(163, 230, 53, 0.04) 0%, transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='52' height='52'%3E%3Crect x='5' y='5' width='42' height='42' rx='10' fill='none' stroke='rgba(255,255,255,0.026)' stroke-width='1.5'/%3E%3C/svg%3E");
  background-attachment: fixed;
}

body.light-mode {
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(224, 117, 20, 0.05) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='52' height='52'%3E%3Crect x='5' y='5' width='42' height='42' rx='10' fill='none' stroke='rgba(0,0,0,0.045)' stroke-width='1.5'/%3E%3C/svg%3E");
}

button, input, select {
  font-family: var(--font-display);
}

input[type=number] {
  font-family: var(--font-mono);
}

/* ── Header ── */
header.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
}

.nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  flex: 1;
  align-items: center;
}

.nav a {
  color: var(--mute);
  text-decoration: none;
  transition: color 0.2s;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--text);
}

/* ── Layout ── */
.maker-wrap {
  /* body is a flex container (main.css) — definite width stops fit-content
     sizing from flooring at a stale min-content and overflowing phones */
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem;
}

.maker-header {
  width: 100%;
  margin-top: 84px;
  margin-bottom: 0;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1.25rem 1rem;
  box-sizing: border-box;
  border-bottom: 1px solid transparent;
  background-image: linear-gradient(var(--bg), var(--bg)), linear-gradient(90deg, rgba(255, 149, 56, 0.35) 0%, rgba(163, 230, 53, 0.2) 50%, transparent 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.app-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(255, 149, 56, 0.15) 0%, rgba(163, 230, 53, 0.05) 100%);
  border: 1px solid rgba(255, 149, 56, 0.3);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: 0 4px 20px rgba(255, 149, 56, 0.1);
}

.app-icon svg {
  width: 28px;
  height: 28px;
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.maker-header h1 {
  font-size: 1.65rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #fff 0%, #ffd9a8 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.version-badge {
  background: rgba(163, 230, 53, 0.15);
  color: var(--teal);
  border: 1px solid rgba(163, 230, 53, 0.3);
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.maker-header .sub {
  margin: 0;
  font-size: 0.9rem;
  color: var(--mute);
}

.maker-grid {
  display: grid;
  grid-template-columns: minmax(440px, 580px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width:960px) {
  .maker-grid {
    display: flex;
    flex-direction: column-reverse;
    max-width: 100%;
  }
  .controls-panel {
    max-height: none !important;
    overflow-y: visible !important;
    min-width: 0;
    max-width: 100%;
  }
  .canvas-panel {
    min-height: 45vh !important;
  }
}

/* Phone-width header: let the title row wrap instead of forcing page scroll */
@media (max-width: 480px) {
  .maker-header h1 { font-size: 1.35rem; }
  .title-row { flex-wrap: wrap; }
  .header-content { gap: 0.8rem; }
}

/* ── Freeform Canvas Workspace (matches vial rack) ── */
.ff-workspace {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #121215;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.4);
  overflow-x: auto;
  touch-action: none;
  /* Wide grids must scroll in here, not push their min-content width up
     through body's flex layout and force the whole page to overflow */
  contain: inline-size;
}

.ff-middle-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ff-btn-group {
  display: flex;
  gap: 4px;
}

.ff-btn-group.vertical {
  flex-direction: column;
}

.edge-btn {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--mute);
  border-radius: 4px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: all 0.1s;
  -webkit-user-select: none; user-select: none;
}

.edge-btn:hover {
  background: rgba(255, 149, 56, 0.2);
  color: var(--text);
  border-color: var(--accent);
}

.edge-btn:active {
  transform: scale(0.9);
}

/* ── Controls Panel ── */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scroll-behavior: smooth;
}

.controls-panel::-webkit-scrollbar {
  width: 5px;
}

.controls-panel::-webkit-scrollbar-track {
  background: transparent;
}

.controls-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 149, 56, 0.2);
  border-radius: 6px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 149, 56, 0.4);
}

/* ── Accordion Groups ── */
details.setting-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s;
  flex-shrink: 0;
}

details.setting-group:hover {
  border-color: rgba(255, 149, 56, 0.35);
  box-shadow: 0 2px 16px rgba(255, 149, 56, 0.06);
}

details.setting-group[open] {
  border-color: rgba(255, 149, 56, 0.28);
  background: var(--panel2);
  box-shadow: 0 4px 24px rgba(255, 149, 56, 0.08);
}

summary.group-header {
  padding: 1rem 1.2rem;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  -webkit-user-select: none; user-select: none;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  letter-spacing: -0.01em;
  transition: background 0.2s ease, color 0.15s;
}

summary.group-header:hover {
  background: rgba(255, 149, 56, 0.05);
}

details[open]>summary.group-header:hover {
  background: rgba(255, 149, 56, 0.07);
}

summary.group-header::-webkit-details-marker {
  display: none;
}

summary.group-header::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--panel2);
  border: 1px solid var(--line);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5L5 6.5L8 3.5' stroke='%23a5a29a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s;
}

details[open]>summary.group-header::after {
  transform: rotate(180deg);
  border-color: rgba(255, 149, 56, 0.4);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5L5 6.5L8 3.5' stroke='%23ff9538' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

details[open]>summary.group-header {
  border-bottom: 1px solid var(--line);
}

.group-content {
  padding: 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  animation: group-reveal 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes group-reveal {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Sub-label ── */
.sub-label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--hint);
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

/* ── Shape card buttons (like vial rack body shape selector) ── */
.shape-btns {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}

.shape-btn {
  position: relative;
  flex: 1 1 20%;
  text-align: center;
  padding: .6rem .25rem;
  border-radius: 9px;
  cursor: pointer;
  background: var(--panel2);
  border: 1px solid var(--line);
  font-size: .84rem;
  color: var(--mute);
  -webkit-user-select: none; user-select: none;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .24rem;
  min-width: 64px;
}

.shape-btn input[type=radio] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.shape-btn .shape-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.shape-btn:has(input:checked) {
  background: rgba(255, 149, 56, .15);
  color: var(--accent);
  border-color: rgba(255, 149, 56, .5);
  font-weight: 600;
}

.shape-btn:hover:not(:has(input:checked)) {
  border-color: rgba(255, 149, 56, .35);
  color: var(--text);
}

/* ── Fields & Inputs ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .88rem;
  color: var(--text);
  flex-wrap: wrap;
}

.field label>span {
  display: none;
}

.field-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
}

/* Sliders */
input[type=range] {
  flex: 1;
  min-width: 50px;
  background: transparent;
  height: 24px;
  cursor: pointer;
}

input[type=range]::-webkit-slider-runnable-track {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  transition: background 0.2s;
}

input[type=range]:hover::-webkit-slider-runnable-track {
  background: #3f4046;
}

input[type=range]::-webkit-slider-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -5px;
  box-shadow: 0 0 8px rgba(255, 149, 56, 0.4);
  transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.15s;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 12px rgba(255, 149, 56, 0.8);
}

/* Number inputs — hide native spinners; the touch-stepper +/− buttons replace them */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
  width: 64px;
  background: var(--panel);
  color: var(--text);
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .35rem .4rem;
  text-align: center;
  font-size: .9rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  font-variant-numeric: tabular-nums;
}

.field-row input[type=number] {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

input[type=number]:hover {
  border-color: #4a4b52;
  background: #232428;
}

input[type=number]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 149, 56, 0.2);
}

/* Touch Steppers */
.touch-stepper {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.touch-stepper:hover {
  border-color: #4a4b52;
}

.touch-stepper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 149, 56, 0.2);
}

.touch-stepper input[type=number] {
  border: none;
  border-radius: 0;
  background: transparent;
  width: 60px;
  padding: 0.45rem 0.3rem;
  min-height: 38px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

.touch-stepper input[type=number]:hover,
.touch-stepper input[type=number]:focus {
  border: none;
  background: transparent;
  box-shadow: none;
}

.touch-stepper .step-btn {
  background: var(--panel2);
  border: none;
  color: var(--mute);
  width: 36px;
  min-height: 38px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1;
  -webkit-user-select: none; user-select: none;
  transition: background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.touch-stepper .step-btn:hover {
  background: rgba(255, 149, 56, 0.15);
  color: var(--accent);
}

.touch-stepper .step-btn:active {
  background: rgba(255, 149, 56, 0.3);
  transform: scale(0.95);
}

.touch-stepper .step-down {
  border-right: 1px solid var(--line);
}

.touch-stepper .step-up {
  border-left: 1px solid var(--line);
}

.touch-stepper.compact input[type=number] {
  width: 48px;
  padding: 0.35rem 0.25rem;
  min-height: 34px;
  font-size: 0.95rem;
}

.touch-stepper.compact .step-btn {
  width: 30px;
  min-height: 34px;
  font-size: 1rem;
}

.touch-stepper.wide input[type=number] {
  width: 56px;
}

.hint-line {
  font-size: .76rem;
  color: var(--hint);
  margin: 0;
  line-height: 1.5;
}

/* ── Toggles ── */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
}

.toggle-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.toggle-row span {
  font-size: .88rem;
  color: var(--text);
  line-height: 1.2;
  word-wrap: break-word;
}

.toggle-sw {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-sw input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-sw .trk {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #232428;
  border: 1px solid #3a3b41;
  border-radius: 22px;
  transition: .18s;
}

.toggle-sw .trk::before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #55565e;
  border-radius: 50%;
  transition: .18s;
}

.toggle-sw input:checked+.trk {
  background: rgba(163, 230, 53, .2);
  border-color: var(--teal);
}

.toggle-sw input:checked+.trk::before {
  transform: translateX(16px);
  background: var(--teal);
}

.btn-add {
  width: 100%;
  background: none;
  border: 1px dashed rgba(255, 149, 56, 0.2);
  color: var(--hint);
  border-radius: 10px;
  padding: .65rem;
  font-size: .85rem;
  cursor: pointer;
  transition: all .18s;
  min-height: 40px;
  font-weight: 500;
}

.btn-add:hover {
  border-color: rgba(255, 149, 56, 0.55);
  color: var(--accent);
  background: rgba(255, 149, 56, 0.05);
  transform: translateY(-1px);
}


/* ── Freeform Grid ── */
.ff-grid-container {
  display: grid;
  gap: 3px;
  justify-content: center;
  position: relative;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}

/* ── Grid Builder: baseplate sockets ──
   Empty unit cells styled like gridfinity baseplate pockets, complete
   with faint magnet-dot corners. */
.gb-cell {
  border-radius: 7px;
  background-image:
    radial-gradient(circle at 7px 7px, rgba(255, 255, 255, 0.07) 1.4px, transparent 2.2px),
    radial-gradient(circle at calc(100% - 7px) 7px, rgba(255, 255, 255, 0.07) 1.4px, transparent 2.2px),
    radial-gradient(circle at 7px calc(100% - 7px), rgba(255, 255, 255, 0.07) 1.4px, transparent 2.2px),
    radial-gradient(circle at calc(100% - 7px) calc(100% - 7px), rgba(255, 255, 255, 0.07) 1.4px, transparent 2.2px);
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: crosshair;
  transition: background-color 0.12s, border-color 0.12s;
}

.gb-cell:hover {
  border-color: rgba(255, 149, 56, 0.45);
  background-color: rgba(255, 149, 56, 0.07);
}

/* ── Grid Builder: placed bins — chunky blocks that pop into place ── */
.gb-pocket {
  position: relative;
  z-index: 2;
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(255, 149, 56, 0.32) 0%, rgba(255, 106, 42, 0.2) 100%);
  border: 1.5px solid rgba(255, 149, 56, 0.75);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 8px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: #ffd9a8;
  cursor: grab;
  -webkit-user-select: none; user-select: none;
  animation: gb-pop 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: border-color 0.12s, box-shadow 0.12s, filter 0.12s;
}

.gb-pocket:hover { filter: brightness(1.12); }
.gb-pocket:active { cursor: grabbing; }

.gb-pocket.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(163, 230, 53, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 10px rgba(0, 0, 0, 0.4);
  color: #eaffc4;
}

@keyframes gb-pop {
  from { transform: scale(0.75); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.gb-pocket-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.gb-pocket-span {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1;
  opacity: 0.85;
}

/* Accessory bins get a lime tint so the layout reads at a glance */
.gb-shape-cylinder {
  background: linear-gradient(160deg, rgba(255, 196, 56, 0.3), rgba(255, 149, 56, 0.16));
}

.gb-shape-phone,
.gb-shape-airpods {
  background: linear-gradient(160deg, rgba(163, 230, 53, 0.26), rgba(120, 190, 40, 0.14));
  border-color: rgba(163, 230, 53, 0.6);
  color: #d6f5a0;
}

/* Drag-preview ghost while placing or moving a bin */
.gb-ghost {
  z-index: 3;
  pointer-events: none;
  border-radius: 8px;
  border: 2px dashed rgba(163, 230, 53, 0.9);
  background: rgba(163, 230, 53, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--teal);
}

.gb-ghost.invalid {
  border-color: rgba(224, 80, 80, 0.9);
  background: rgba(224, 80, 80, 0.16);
  color: #ff8f8f;
}

/* Deny shake when a drop / resize / shrink is blocked */
.gb-deny { animation: gb-shake 0.3s ease; }

@keyframes gb-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

/* ── Grid Builder: control zones ──
   The panel reads top-to-bottom as a workflow — quick start, pick a bin,
   draw on the plate, then plate-level settings. Zone mini-headers replace
   the old crammed toolbar. */

.gb-quickstart {
  width: 100%;
  background: linear-gradient(135deg, rgba(255, 149, 56, 0.12) 0%, rgba(255, 149, 56, 0.03) 100%);
  color: var(--accent);
  border: 1px solid rgba(255, 149, 56, 0.35);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  margin-bottom: 0.85rem;
  transition: border-color 0.15s, background 0.15s;
}

.gb-quickstart:hover,
.gb-quickstart:focus {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 149, 56, 0.18) 0%, rgba(255, 149, 56, 0.06) 100%);
  outline: none;
}

.gb-quickstart option {
  background: var(--panel);
  color: var(--text);
  font-weight: 400;
}

.gb-zone-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hint);
  font-weight: 700;
}

.gb-zone-label::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 2px;
  background: var(--accent);
  margin-right: 0.45rem;
  vertical-align: 1px;
}

/* Bin palette — what the next drag places */
.gb-palette { margin-bottom: 0.6rem; }

.gb-palette-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.gb-palette-depth {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.gb-palette-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: stretch;
}

/* Compact shape cards inside the palette row */
.gb-palette-row .shape-btn {
  flex: 1 1 0;
  min-width: 58px;
  padding: 0.45rem 0.2rem;
  gap: 0.2rem;
  font-size: 0.7rem;
}

.gb-palette-row .shape-btn .shape-icon {
  font-size: 1.15rem;
}

.shape-btn:has(input:focus-visible),
.desk-inline-024 label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Accessories dropdown acts as the fifth palette slot */
.gb-acc-select {
  flex: 1.6 1 138px;
  min-width: 132px;
  width: auto;
  align-self: stretch;
  color: var(--mute);
}

.gb-acc-select.active {
  background: rgba(163, 230, 53, 0.13);
  border-color: rgba(163, 230, 53, 0.55);
  color: var(--teal);
  font-weight: 600;
}

/* Baseplate zone — plate-level settings, separated like a section footer */
.gb-plate-bar {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.gb-plate-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.gb-plate-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.7rem 1rem;
}

.gb-tool {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.gb-tool-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--hint);
  font-weight: 600;
}

.gb-unit-suffix {
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.8;
}

.gb-shape-select {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.42rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 36px;
  transition: border-color 0.15s;
}

.gb-shape-select:hover,
.gb-shape-select:focus {
  border-color: var(--accent);
  outline: none;
}

.gb-hint {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0 0 0.45rem;
}

.gb-hint-place { color: var(--accent); }
.gb-hint-move { color: var(--teal); }
.gb-hint-erase { color: #e05050; }

.gb-footprint {
  margin: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--hint);
  letter-spacing: 0.03em;
}

/* ── Grid Builder: selected-bin inspector ── */
.gb-inspector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.55rem;
  background: rgba(163, 230, 53, 0.06);
  border: 1px solid rgba(163, 230, 53, 0.3);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  animation: gb-pop 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gb-inspector[hidden] { display: none; }

.gb-insp-shape {
  flex: 1 1 120px;
  min-width: 115px;
  width: auto;
}

.gb-insp-dim {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.gb-insp-lbl {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--hint);
  font-family: var(--font-mono);
}

.gb-insp-size {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--teal);
  margin-left: auto;
  white-space: nowrap;
}

.gb-insp-delete {
  background: none;
  border: 1px solid rgba(224, 80, 80, 0.35);
  color: #e05050;
  border-radius: 8px;
  min-width: 32px;
  min-height: 32px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.12s;
}

.gb-insp-delete:hover {
  background: rgba(224, 80, 80, 0.12);
  border-color: #e05050;
}

/* Light-mode Grid Builder */
body.light-mode .gb-cell {
  background-image:
    radial-gradient(circle at 7px 7px, rgba(0, 0, 0, 0.12) 1.4px, transparent 2.2px),
    radial-gradient(circle at calc(100% - 7px) 7px, rgba(0, 0, 0, 0.12) 1.4px, transparent 2.2px),
    radial-gradient(circle at 7px calc(100% - 7px), rgba(0, 0, 0, 0.12) 1.4px, transparent 2.2px),
    radial-gradient(circle at calc(100% - 7px) calc(100% - 7px), rgba(0, 0, 0, 0.12) 1.4px, transparent 2.2px);
  background-color: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .gb-pocket { color: #7c3d08; }

body.light-mode .gb-shape-phone,
body.light-mode .gb-shape-airpods { color: #3f6212; }

.ruler-inch {
  font-size: 0.75rem;
  opacity: 0.9;
}

/* ── Section Icons — thin-stroke SVGs in the workshop-orange accent ── */
.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  margin-right: 0.6rem;
  flex-shrink: 0;
  color: var(--accent);
  background: rgba(255, 149, 56, 0.1);
  border: 1px solid rgba(255, 149, 56, 0.2);
}

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

.section-num {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
}

/* ── Preview Column ── */
.preview-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.shader-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  font-size: 1.1rem;
  transition: all 0.2s;
  filter: grayscale(0.5);
  opacity: 0.6;
}

.shader-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.shader-btn.active {
  filter: grayscale(0);
  opacity: 1;
  background: rgba(255, 149, 56, 0.2);
  border-color: var(--accent);
}

/* Shader swatch dots — grayscaled while inactive by the rules above */
.shader-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.shader-dot {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.dot-classic {
  background: linear-gradient(135deg, #ffd9a8 0%, #c96a1a 100%);
}

.dot-matte {
  background: linear-gradient(135deg, #e6e6e6 0%, #8f8f8f 100%);
}

.dot-wire {
  background: transparent;
  border: 1.5px solid var(--mute);
  background-image: linear-gradient(45deg, transparent 46%, currentColor 46%, currentColor 54%, transparent 54%);
}

.dot-normals {
  background: conic-gradient(#ff5ec4, #ffb454, #3cf5b8, #2dd8ff, #ff5ec4);
}

.canvas-panel {
  background: radial-gradient(ellipse at 50% 40%, #262019 0%, #121114 65%);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  min-height: 600px;
  height: 100%;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  display: block;
}

#previewCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ── Canvas Footer ── */
.canvas-footer {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.dim-readout {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.dim-readout > span {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  position: relative;
}

/* Combined W × L × H readout — one stat instead of three */
.dim-size i {
  font-style: normal;
  color: var(--hint);
  font-size: 0.72em;
  margin: 0 0.28rem;
}

.dim-readout > span:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -0.75rem;
  top: 15%;
  height: 70%;
  width: 1px;
  background: var(--line);
}

.dim-readout .dim-val {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dim-readout .dim-lbl {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--hint);
}

.export-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-end;
}

/* Buttons that carry an inline SVG icon */
#simPrintBtn,
#shareLinkBtn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

/* ── Buttons ── */
button.primary {
  background: linear-gradient(135deg, #ff9538 0%, #ff6a2a 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .6rem 1.2rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .9rem;
  transition: opacity .15s;
  box-shadow: 0 2px 10px rgba(255, 149, 56, .2);
  white-space: nowrap;
}

button.primary:hover {
  opacity: .9;
}

button.primary:disabled {
  opacity: .4;
  cursor: not-allowed;
}

button.secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .6rem 1rem;
  cursor: pointer;
  font-size: .85rem;
  transition: all .14s;
  white-space: nowrap;
}

button.secondary:hover {
  border-color: var(--accent);
}

/* ── Theme Switch ── */
.theme-switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 28px;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-slider-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--panel);
  border: 1px solid var(--line);
  border-radius: 30px;
  transition: .3s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.theme-icon-sun,
.theme-icon-moon {
  font-size: 13px;
  z-index: 1;
  pointer-events: none;
}

.theme-knob {
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text);
  border-radius: 50%;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.theme-switch input:checked+.theme-slider-bg {
  background-color: var(--accent);
  border-color: var(--accent);
}

.theme-switch input:checked+.theme-slider-bg .theme-knob {
  transform: translateX(26px);
  background-color: #fff;
}

/* ── Light Mode Overrides ── */
body.light-mode {
  --bg: #f2efe8;
  --panel: #ffffff;
  --panel2: #eae6dc;
  --line: #d5cfc2;
  --accent: #e07514;
  --teal: #65a30d;
  --text: #292723;
  --mute: #6e6a61;
  --hint: #98938a;
}

body.light-mode .site-header {
  background: #141416;
  border-bottom: 1px solid #2d2e33;
}

body.light-mode .nav a {
  color: #a5a29a;
}

body.light-mode .nav a:hover,
body.light-mode .nav a[aria-current="page"] {
  color: #eceae4;
}

body.light-mode .maker-header h1 {
  background: linear-gradient(100deg, #292723 0%, #ff9538 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

body.light-mode summary.group-header:hover {
  background: #e6e1d6;
}

body.light-mode .canvas-panel {
  background: radial-gradient(ellipse at 50% 40%, #ffffff 0%, #d8d2c6 65%);
}

body.light-mode #viewToolsBtn,
body.light-mode #viewToolsPanel,
body.light-mode #cameraToggleBtn,
body.light-mode #rulerBtn,
body.light-mode #exitMeasureBtn {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.light-mode .shader-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.light-mode .plate-btn[data-plate="off"] {
  color: var(--mute) !important;
}

body.light-mode #plateSizeMenu {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: var(--line) !important;
}

body.light-mode .plate-size-opt {
  color: var(--text) !important;
}

body.light-mode .ff-workspace {
  background: #f6f3ec;
  border-color: var(--line);
}

body.light-mode .edge-btn {
  background: #ffffff;
  border-color: var(--line);
  color: var(--text);
}

body.light-mode .edge-btn:hover {
  background: rgba(224, 117, 20, 0.1);
  border-color: var(--accent);
}

/* ── Account Area ── */
.account-area {
  margin-left: auto;
  position: relative;
}

.account-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s;
  min-height: 38px;
  white-space: nowrap;
}

.account-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.account-btn .acct-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.account-btn.logged-in {
  background: rgba(163, 230, 53, 0.08);
  border-color: rgba(163, 230, 53, 0.4);
  color: var(--teal);
}

.account-btn.logged-in:hover {
  background: rgba(163, 230, 53, 0.15);
}

.account-btn .acct-chevron {
  font-size: 0.65rem;
  opacity: 0.7;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 200px;
  padding: 0.4rem;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  gap: 0.15rem;
}

.account-dropdown.open {
  display: flex;
}

.account-dropdown .dd-header {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.25rem;
}

.account-dropdown .dd-header .dd-label {
  font-size: 0.7rem;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.account-dropdown .dd-header .dd-username {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 600;
  margin-top: 0.1rem;
  word-break: break-all;
}

.account-dropdown .dd-item {
  background: none;
  border: none;
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-size: 0.88rem;
  transition: background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.account-dropdown .dd-item:hover {
  background: rgba(255, 149, 56, 0.1);
  color: var(--accent);
}

.account-dropdown .dd-item.danger:hover {
  background: rgba(224, 80, 80, 0.1);
  color: #ff7878;
}

body.light-mode .account-btn {
  background: #1d1e22;
  color: #eceae4;
  border-color: #2d2e33;
}

/* ── Auth Modal ── */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 21, 0.85);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-modal-backdrop.open {
  display: flex;
}

.auth-modal {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%;
  max-width: 400px;
  padding: 1.5rem;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  animation: auth-modal-in 0.18s ease-out;
}

@keyframes auth-modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-modal h2 {
  margin: 0 0 1rem 0;
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(100deg, #fff 0%, #ffd9a8 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-tabs {
  display: flex;
  gap: 0.3rem;
  background: var(--panel2);
  padding: 0.3rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  margin-bottom: 1.2rem;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--mute);
  padding: 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.auth-tab.active {
  background: rgba(255, 149, 56, 0.18);
  color: var(--accent);
  font-weight: 600;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.auth-field label {
  font-size: 0.78rem;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.auth-field input {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 42px;
}

.auth-field input:hover {
  border-color: #4a4b52;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 149, 56, 0.2);
}

.auth-hint {
  font-size: 0.76rem;
  color: var(--hint);
  margin: -0.3rem 0 0.9rem 0;
  line-height: 1.4;
}

.auth-error {
  background: rgba(224, 80, 80, 0.1);
  border: 1px solid rgba(224, 80, 80, 0.3);
  color: #ff8888;
  padding: 0.55rem 0.75rem;
  border-radius: 7px;
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
  display: none;
}

.auth-error.show {
  display: block;
}

.auth-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.auth-actions button {
  flex: 1;
  min-height: 42px;
}

.auth-modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--mute);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}

.auth-modal-close:hover {
  background: var(--panel2);
  color: var(--text);
}

/* ── Freeform brush shape select ── */
.ff-shape-select {
  width: 100%;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  cursor: pointer;
  min-height: 38px;
  transition: border-color 0.15s;
}

.ff-shape-select:hover {
  border-color: var(--accent);
}

.ff-shape-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 149, 56, 0.15);
}

/* ── Mesh quality radio cards ── */
label:has(input[name="quality"]:checked) {
  background: rgba(255, 149, 56, .15) !important;
  color: var(--accent) !important;
  border-color: rgba(255, 149, 56, .5) !important;
  font-weight: 600;
}

label:has(input[name="quality"]):hover:not(:has(input:checked)) {
  border-color: rgba(255, 149, 56, .35) !important;
  color: var(--text) !important;
}

/* Generated from former inline style attributes to keep HTML validation clean. */
.desk-inline-001 { width: 100%; display: flex; justify-content: space-between; }
.desk-inline-002 { display: flex; align-items: center; gap: 1.2rem; }
.desk-inline-003 { display: flex; align-items: center; gap: 0.7rem; }
.desk-inline-005 { font-size: 0.75rem; color: var(--hint); margin: -0.2rem 0 0.6rem 0; }
.desk-inline-007 { display:flex; flex-wrap:wrap; gap:0.5rem; background:var(--panel2); padding:0.6rem; border-radius:8px; border:1px solid var(--line); align-items:center; margin-bottom:0.5rem; }
.desk-inline-008 { color:var(--mute); font-size:0.84rem; }
.desk-inline-009 { display:flex; gap:0.3rem; align-items:center; }
.desk-inline-010 { font-size:0.74rem; color:var(--hint); }
.desk-inline-011 { flex:1; min-width:120px; background:var(--panel); color:var(--text); border:1px solid var(--line); border-radius:6px; padding:0.3rem 0.5rem; font-size:0.82rem; cursor:pointer; min-height:34px; }
.desk-inline-012 { margin-bottom:0.6rem; }
.desk-inline-013 { color:var(--teal); }
.desk-inline-014 { color:#e05050; }
.desk-inline-015 { display:none; margin-top:0.4rem; font-size:0.78rem; color:var(--teal); background:rgba(163,230,53,0.08); border:1px solid rgba(163,230,53,0.25); border-radius:7px; padding:0.4rem 0.6rem; line-height:1.4; }
.desk-inline-018 { font-size: 0.78rem; color: var(--hint); }
.desk-inline-019 { display:none; flex-direction:column; gap:0.6rem; margin-top:0.4rem; padding-left:1rem; border-left:2px solid var(--line); }
.desk-inline-020 { margin-bottom:0; }
.desk-inline-021 { font-size: 0.85rem; color: var(--text); margin-bottom: 0.3rem; }
.desk-inline-022 { width: 100%; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.9rem; box-sizing: border-box; }
.desk-inline-023 { margin-top:0.2rem; }
.desk-inline-024 { display:flex; gap:0.4rem; flex-wrap:wrap; }
.desk-inline-025 { position:relative; flex:1; text-align:center; padding:0.5rem 0.25rem; border-radius:9px; cursor:pointer; background:var(--panel2); border:1px solid var(--line); font-size:.84rem; color:var(--mute); -webkit-user-select:none; user-select:none; transition:all .15s; min-width:52px; }
.desk-inline-026 { position:absolute;opacity:0;width:0;height:0; }
.desk-inline-027 { position:relative; flex:1; text-align:center; padding:0.5rem 0.25rem; border-radius:9px; cursor:pointer; background:rgba(255,149,56,.15); border:1px solid rgba(255,149,56,.5); font-size:.84rem; color:var(--accent); -webkit-user-select:none; user-select:none; font-weight:600; min-width:52px; }
.desk-inline-028 { font-size:.76rem; color:var(--hint); margin:0.3rem 0 0 0; line-height:1.5; }
.desk-inline-029 { position:absolute; top:1rem; right:1.2rem; z-index:11; }
.desk-inline-030 { background:rgba(18,18,21,0.85); border:1px solid var(--line); color:var(--text); border-radius:8px; padding:0.45rem 0.7rem; font-size:0.82rem; cursor:pointer; display:flex; align-items:center; gap:0.4rem; -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px); }
#viewToolsBtn:hover { border-color:var(--accent); }
.desk-inline-031 { font-size:0.62rem; opacity:0.7; transition:transform 0.15s; }
.desk-inline-032 { display:none; position:absolute; top:calc(100% + 6px); right:0; background:rgba(18,18,21,0.96); border:1px solid var(--line); border-radius:10px; padding:0.7rem; min-width:240px; box-shadow:0 8px 24px rgba(0,0,0,0.55); flex-direction:column; gap:0.7rem; }
.desk-inline-033 { font-size:0.66rem; color:var(--hint); text-transform:uppercase; letter-spacing:0.06em; margin-bottom:0.35rem; }
.desk-inline-034 { display:inline-flex; gap:0.4rem; align-items:center; flex-wrap:wrap; }
.desk-inline-035 { width:1px; height:20px; background:var(--line); margin:0 0.2rem; }
.desk-inline-036 { width:24px; height:24px; border:none; padding:0; background:none; cursor:pointer; border-radius:50%; overflow:hidden; flex-shrink:0; }
.desk-inline-037 { display:inline-flex; gap:0.4rem; align-items:center; }
.desk-inline-038 { background:transparent; border:1px solid transparent; border-radius:6px; cursor:pointer; padding:0.2rem 0.5rem; font-size:0.78rem; color:var(--mute); }
.desk-inline-039 { position:relative; }
.desk-inline-040 { background:rgba(255,149,56,0.2); border:1px solid var(--accent); border-radius:6px; cursor:pointer; padding:0.2rem 0.5rem; font-size:0.78rem; color:var(--accent); font-weight:600; display:flex; align-items:center; gap:0.3rem; }
.desk-inline-041 { font-size:0.7rem; opacity:0.85; }
.desk-inline-042 { font-size:0.6rem; opacity:0.7; }
.desk-inline-043 { display:none; position:absolute; top:calc(100% + 4px); right:0; background:rgba(18,18,21,0.96); border:1px solid var(--line); border-radius:8px; padding:0.3rem; min-width:130px; box-shadow:0 4px 14px rgba(0,0,0,0.5); z-index:12; }
.desk-inline-044 { display:block; width:100%; text-align:left; background:transparent; border:none; color:var(--text); padding:0.4rem 0.6rem; border-radius:5px; cursor:pointer; font-size:0.78rem; }
.desk-inline-045 { width:100%; background:rgba(18,18,21,0.6); border:1px solid var(--line); color:var(--text); border-radius:6px; padding:0.35rem 0.6rem; font-size:0.82rem; cursor:pointer; text-align:left; }
#cameraToggleBtn:hover { border-color:var(--accent); color:var(--accent); }
.desk-inline-046 { width:100%; padding:0.4rem 0.7rem; font-size:0.82rem; text-align:left; }
.desk-inline-047 { width:100%; background:rgba(224,80,80,0.85); color:#fff; border-color:#e05050; padding:0.4rem 0.7rem; font-size:0.82rem; display:none; text-align:left; margin-top:0.3rem; }
.desk-inline-048 { position:absolute; display:none; background:var(--accent); color:#fff; padding:5px 10px; border-radius:5px; font-size:0.85rem; pointer-events:none; font-weight:bold; z-index:10; transform:translate(-50%,-50%); box-shadow:0 3px 10px rgba(0,0,0,0.5); }
.desk-inline-049 { padding-left:0.5rem; }
.desk-inline-050 { margin-right:0.8rem; }
.desk-inline-051 { font-size:0.85rem; color:var(--text); font-weight:600; white-space:nowrap; }
.desk-inline-052 { display:none; cursor:pointer; width:24px; height:24px; padding:0; border:none; border-radius:4px; background:transparent; margin-left:0.4rem; }
.desk-inline-053 { font-size: 0.82rem; color: #e05050; text-align: right; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════
   Grid Builder 2.0 — accessories, history, templates, fit-to-space,
   inspector options, canvas overlays
   ═══════════════════════════════════════════════════════════════════════ */

/* Workspace anchors the deny-toast */
.ff-workspace { position: relative; }

/* ── Fit-a-space tool ── */
.gb-tool-fit { min-width: 150px; }

.gb-fit-row {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.gb-fit-row input[type=number] {
  width: 52px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.38rem 0.4rem;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  min-height: 34px;
}

.gb-fit-row input[type=number]:focus {
  border-color: var(--accent);
  outline: none;
}

.gb-fit-x { color: var(--hint); font-size: 0.75rem; }

.gb-fit-btn {
  background: rgba(255, 149, 56, 0.14);
  border: 1px solid rgba(255, 149, 56, 0.5);
  color: var(--accent);
  border-radius: 8px;
  padding: 0.38rem 0.65rem;
  min-height: 34px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.13s;
}

.gb-fit-btn:hover {
  background: rgba(255, 149, 56, 0.26);
  transform: translateY(-1px);
}

/* ── Keyboard hint chips ── */
.gb-hint-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.75rem;
  opacity: 0.85;
}

.gb-hint-keys > span { white-space: nowrap; }

.gb-hint kbd {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 0.28em;
  color: var(--text);
}

/* ── Deny/status toast anchored over the workspace ── */
.gb-toast {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%) translateY(6px);
  max-width: 92%;
  background: rgba(20, 20, 24, 0.95);
  border: 1px solid rgba(224, 80, 80, 0.55);
  color: #ffb4b4;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 9px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 5;
  text-align: center;
}

.gb-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Plate-fit + print-cap warnings ── */
.gb-footprint.over-cap { color: #ff7a7a; font-weight: 700; }

.gb-plate-warn {
  margin: 0.5rem 0 0;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffb04d;
}

/* ── Grid tiles: accessory styling, rotation arrow, depth badge ── */
.gb-pocket.gb-accessory {
  background: linear-gradient(160deg, rgba(163, 230, 53, 0.26), rgba(120, 190, 40, 0.14));
  border-color: rgba(163, 230, 53, 0.6);
  border-style: dashed;
  color: #d6f5a0;
}

.gb-rot-arrow {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.6rem;
  line-height: 1;
  opacity: 0.8;
  transition: transform 0.15s ease;
}

.gb-pocket-depth {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  line-height: 1;
  opacity: 0.7;
}

/* ── Inspector 2.0 ── */
.gb-inspector {
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}

.gb-insp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.gb-insp-fixed {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--teal);
  background: rgba(163, 230, 53, 0.12);
  border: 1px dashed rgba(163, 230, 53, 0.45);
  border-radius: 6px;
  padding: 0.22rem 0.45rem;
  white-space: nowrap;
  cursor: help;
}

.gb-insp-sub {
  font-size: 0.55rem;
  opacity: 0.7;
  margin-left: 1px;
}

.gb-insp-actions {
  display: inline-flex;
  gap: 0.35rem;
  margin-left: auto;
}

.gb-insp-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  min-width: 32px;
  min-height: 32px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.12s;
}

.gb-insp-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(163, 230, 53, 0.1);
}

.touch-stepper.locked {
  opacity: 0.4;
  pointer-events: none;
}

.gb-insp-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.gb-insp-label {
  width: 110px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.34rem 0.5rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.gb-insp-label:focus { border-color: var(--teal); outline: none; }

.gb-insp-opts[hidden] { display: none; }

/* ── History / clear button row ── */
.gb-btn-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-top: 0.7rem;
}

/* Clear is destructive — compact and pushed aside, not a hero button */
.gb-clear-btn {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(224, 80, 80, 0.3);
  color: #e05050;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.gb-clear-btn:hover {
  background: rgba(224, 80, 80, 0.1);
  border-color: #e05050;
}

.gb-hist-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--mute);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.gb-hist-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 149, 56, 0.06);
}

.gb-hist-btn:disabled { opacity: 0.35; cursor: default; }

/* ── Canvas overlays: rebuild pill, empty state, measure chip ── */
.rebuild-pill {
  position: absolute;
  top: 12px;
  left: 14px;
  background: rgba(20, 20, 24, 0.85);
  border: 1px solid rgba(255, 149, 56, 0.5);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 6;
}

.rebuild-pill.show { opacity: 1; }

.canvas-empty-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
  color: var(--hint);
  font-size: 0.92rem;
  line-height: 1.6;
  pointer-events: none;
  z-index: 4;
}

.canvas-empty-msg[hidden] { display: none; }

.canvas-empty-msg .cem-icon {
  font-size: 2.2rem;
  opacity: 0.5;
}

.measure-chip {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 24, 0.92);
  border: 1px solid rgba(255, 149, 56, 0.6);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  z-index: 7;
  white-space: nowrap;
  max-width: 94%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.measure-chip[hidden] { display: none; }

/* Select optgroups readable on dark */
.gb-shape-select optgroup {
  background: var(--panel);
  color: var(--hint);
  font-style: normal;
}

.gb-shape-select option { color: var(--text); background: var(--panel); }

/* ── Light-mode overrides ── */
body.light-mode .gb-pocket.gb-accessory { color: #3f6212; }

body.light-mode .gb-toast {
  background: rgba(255, 252, 248, 0.96);
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.45);
}

body.light-mode .rebuild-pill,
body.light-mode .measure-chip {
  background: rgba(255, 252, 248, 0.92);
  color: #c2600a;
  border-color: rgba(217, 119, 6, 0.55);
}

body.light-mode .gb-hint kbd {
  background: #eef0f4;
  color: #1e293b;
}

body.light-mode .gb-plate-warn { color: #c2600a; }

body.light-mode .gb-fit-row input[type=number],
body.light-mode .gb-insp-label { color: #1e293b; }

body.light-mode .gb-quickstart {
  background: linear-gradient(135deg, rgba(224, 117, 20, 0.1) 0%, rgba(224, 117, 20, 0.02) 100%);
  border-color: rgba(224, 117, 20, 0.4);
}

body.light-mode .gb-acc-select.active { color: #3f6212; }

/* Author display rules beat the UA [hidden] rule — make hidden win */
.gb-insp-dim[hidden],
.gb-insp-toggle[hidden] { display: none; }
