:root {
  --bar-h: 64px;
  --sidebar-w: 50vw;
  --sidebar-rail-w: 72px;
  --bottombar-h: clamp(320px, 52vh, 420px);
  --bottombar-collapsed-h: 64px;
  --transition-ms: 260ms;
  --chrome-offset: 0px;
  --stage-radius: 0px;
  --stage-border: transparent;
  --stage-shadow: none;

  --bg: #0b0b0c;
  --bg-gradient:
    radial-gradient(70% 60% at 12% 8%, #34343a 0%, rgba(52, 52, 58, 0) 62%),
    radial-gradient(60% 60% at 92% 95%, #2a2a2e 0%, rgba(42, 42, 46, 0) 60%),
    linear-gradient(160deg, #161618 0%, #0d0d0e 55%, #08080a 100%);
  --text: #f5f5f7;
  --muted-1: rgba(245, 245, 247, 0.78);
  --muted-2: rgba(235, 235, 240, 0.64);
  --accent: #f5f5f7;
  --accent-strong: #3a3a3e;
  --accent-soft: rgba(255, 255, 255, 0.08);
  /* Glass surfaces */
  --glass: rgba(40, 40, 44, 0.46);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  --glass-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.35);
  --glass-blur: saturate(180%) blur(40px);
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.11);
  --chip-bg: rgba(255, 255, 255, 0.08);
  --chip-hover-bg: rgba(255, 255, 255, 0.16);
  --chip-border: rgba(255, 255, 255, 0.18);
  --field-bg: rgba(0, 0, 0, 0.28);
  --btn-primary-bg: rgba(245, 245, 247, 0.92);
  --btn-primary-fg: #111113;
  --panel-muted: rgba(255, 255, 255, 0.06);
  --outline-strong: rgba(255, 255, 255, 0.7);
  --hud-progress-bg: rgba(40, 40, 44, 0.55);
  --hud-info-bg: rgba(40, 40, 44, 0.62);
  --grip-color: rgba(255, 255, 255, 0.35);
  --grip-hover-color: rgba(255, 255, 255, 0.65);
  --bg-radial-1: rgba(255, 255, 255, 0.07);
  --bg-radial-2: rgba(255, 255, 255, 0.05);
  --bg-radial-3: rgba(255, 255, 255, 0.04);
  /* Tints used by buttons, chips and panels (RGB triplets) */
  --tint-rgb: 200, 200, 205;
  --tint-deep-rgb: 120, 120, 125;
  --glow-rgb: 0, 0, 0;
  --panel-dark-rgb: 28, 28, 30;
}

[data-theme="light"] {
  --bg: #e9e9ec;
  --bg-gradient:
    radial-gradient(70% 60% at 10% 5%, #ffffff 0%, rgba(255, 255, 255, 0) 62%),
    radial-gradient(60% 60% at 95% 95%, #d4d4d8 0%, rgba(212, 212, 216, 0) 60%),
    linear-gradient(160deg, #f2f2f4 0%, #e6e6e9 55%, #dcdcdf 100%);
  --text: #1d1d1f;
  --muted-1: rgba(29, 29, 31, 0.74);
  --muted-2: rgba(29, 29, 31, 0.66);
  --accent: #1d1d1f;
  --accent-strong: #1d1d1f;
  --accent-soft: rgba(0, 0, 0, 0.05);
  --glass: rgba(255, 255, 255, 0.52);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 0 rgba(0, 0, 0, 0.03);
  --glass-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.06);
  --card-bg: rgba(255, 255, 255, 0.55);
  --card-border: rgba(255, 255, 255, 0.85);
  --chip-bg: rgba(255, 255, 255, 0.6);
  --chip-hover-bg: rgba(255, 255, 255, 0.85);
  --chip-border: rgba(0, 0, 0, 0.08);
  --field-bg: rgba(255, 255, 255, 0.7);
  --btn-primary-bg: rgba(29, 29, 31, 0.9);
  --btn-primary-fg: #ffffff;
  --panel-muted: rgba(255, 255, 255, 0.6);
  --outline-strong: rgba(0, 0, 0, 0.45);
  --hud-progress-bg: rgba(255, 255, 255, 0.6);
  --hud-info-bg: rgba(255, 255, 255, 0.7);
  --grip-color: rgba(0, 0, 0, 0.25);
  --grip-hover-color: rgba(0, 0, 0, 0.5);
  --bg-radial-1: rgba(255, 255, 255, 0.7);
  --bg-radial-2: rgba(0, 0, 0, 0.04);
  --bg-radial-3: rgba(255, 255, 255, 0.5);
  --tint-rgb: 140, 140, 145;
  --tint-deep-rgb: 90, 90, 95;
  --glow-rgb: 0, 0, 0;
  --panel-dark-rgb: 28, 28, 30;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
}

body {
  background: var(--bg-gradient);
  color: var(--text);
  font-family: 'SF Pro Text', 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

body {
  position: relative;
  min-height: 100%;
  overflow-x: hidden;
  isolation: isolate;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20% -10% 30% -10%;
  pointer-events: none;
  background:
    radial-gradient(at 10% 15%, var(--bg-radial-1), transparent 58%),
    radial-gradient(at 85% 10%, var(--bg-radial-2), transparent 60%),
    radial-gradient(at 30% 85%, var(--bg-radial-3), transparent 65%);
  opacity: 0.95;
  filter: saturate(130%);
  z-index: -2;
}

body::after {
  inset: auto -25% -30% -15%;
  transform: rotate(-6deg);
  opacity: 0.65;
}

body[data-theme="light"]::before,
body[data-theme="light"]::after {
  opacity: 0.82;
  filter: saturate(110%);
}

#topbar {
  position: fixed;
  top: var(--chrome-offset);
  left: var(--chrome-offset);
  right: var(--chrome-offset);
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  background: var(--glass);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: saturate(200%) blur(28px);
  -webkit-backdrop-filter: saturate(200%) blur(28px);
  z-index: 40;
}

#brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  font-weight: 600;
}

#brand img {
  height: 34px;
  width: auto;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.38);
  opacity: 0.92;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.brand-eyebrow {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.toolbar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--chip-border);
  color: var(--muted-1);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toolbar-pill .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #36ffba;
  box-shadow: 0 0 0 0 rgba(54, 255, 186, 0.8);
  animation: pulse 2.8s ease-in-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(54, 255, 186, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(54, 255, 186, 0); }
  100% { box-shadow: 0 0 0 0 rgba(54, 255, 186, 0); }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--chip-border);
  background: linear-gradient(150deg, rgba(var(--tint-rgb), 0.2), rgba(var(--tint-rgb), 0.05));
  color: var(--text);
  cursor: url('../assets/hand_open.svg') 8 0, pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.icon-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(150deg, rgba(var(--tint-rgb), 0.32), rgba(var(--tint-rgb), 0.12));
}

.icon-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

#sidebar {
  position: fixed;
  top: var(--bar-h);
  left: 0;
  bottom: 0;
  width: min(var(--sidebar-w), 50vw);
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border-right: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: saturate(180%) blur(32px);
  -webkit-backdrop-filter: saturate(180%) blur(32px);
  padding: 14px 20px 20px;
  overflow: hidden;
  transition: width var(--transition-ms) ease, transform var(--transition-ms) ease, box-shadow 160ms ease;
  z-index: 20;
}

#sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 120% at 0% 0%, rgba(255, 255, 255, 0.16), transparent);
  opacity: 0.7;
  pointer-events: none;
}

#sidebar::after {
  content: '';
  position: absolute;
  top: 32px;
  right: -3px;
  width: 6px;
  height: calc(100% - 64px);
  border-radius: 999px;
  background: transparent;
  cursor: ew-resize;
  transition: background 0.2s ease;
  z-index: 26;
}

#sidebar:hover::after {
  background: rgba(255, 255, 255, 0.08);
}

#sidebarGrip {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 6px;
  height: 48px;
  border-radius: 999px;
  background: var(--grip-color);
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
  pointer-events: none;
  z-index: 26;
}

#sidebarGrip::before {
  content: '';
  position: absolute;
  inset: 12px 2px;
  border-radius: 999px;
  background: linear-gradient(to bottom, currentColor 25%, transparent 25%, transparent 50%, currentColor 50%, currentColor 75%, transparent 75%, transparent);
  mask: linear-gradient(#000, #000);
}

#sidebar:hover #sidebarGrip {
  opacity: 1;
  transform: translateY(-50%) scaleX(1.06);
}

#sidebar.resizing {
  transition: none;
}

#sidebar.resizing #sidebarGrip,
body.sidebar-resizing #sidebarGrip {
  opacity: 1;
  transform: translateY(-50%) scaleX(1.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.35) 100%);
}

.side-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 10px;
}

.side-scroll {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  padding-right: 12px;
  margin-right: -4px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1 1 auto;
  min-height: 0;
  scroll-behavior: smooth;
}

.side-scroll > * {
  flex-shrink: 0;
}

.side-scroll-cols {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.side-scroll-cols > * {
  flex-shrink: 0;
}

body.mobile #sidebar .side-scroll-cols {
  gap: 16px;
}

/* Cards reflow into extra columns as the panel widens so more fits without scrolling */
body:not(.mobile) #sidebar .side-scroll {
  container-type: inline-size;
  container-name: sidescroll;
}

@container sidescroll (min-width: 600px) {
  .side-scroll-cols {
    display: block;
    columns: 280px;
    column-gap: 16px;
  }

  .side-scroll-cols > .side-section {
    break-inside: avoid;
    margin-bottom: 16px;
    padding: 18px 18px 20px;
    border-radius: 22px;
  }

  .side-scroll-cols .hero-headline {
    font-size: 26px;
  }

  .side-scroll-cols .stat-grid {
    gap: 12px;
  }

  .side-scroll-cols .stat {
    padding: 12px;
  }

  .side-scroll-cols .stat-value {
    font-size: 20px;
    margin-top: 4px;
  }

  .side-scroll-cols .print-config {
    gap: 10px;
    margin-top: 14px;
  }
}

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

.side-header-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
}

.side-header-sub {
  font-size: 13px;
  color: var(--muted-2);
}

.side-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 26px;
  padding: 22px 22px 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
}

.hero-panel {
  color: var(--text);
  position: relative;
  overflow: hidden;
}

.hero-panel::after {
  content: '';
  position: absolute;
  inset: -40% 10% auto;
  height: 60%;
  background: none;
  pointer-events: none;
}

.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
}

.hero-headline {
  font-size: clamp(28px, 3vw, 34px);
  font-weight: 650;
  margin: 10px 0 8px;
  line-height: 1.1;
}

.hero-price {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.hero-body {
  margin: 0;
  color: var(--muted-1);
  font-size: 15px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 160ms ease, background 160ms ease;
}

.chip:hover {
  background: var(--chip-hover-bg);
  transform: translateY(-1px);
}

.product-card {
  display: grid;
  gap: 12px;
  color: var(--muted-1);
}

.product-card p {
  margin: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.stat {
  padding: 16px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted-2);
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.muted {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted-2);
}

.side-title {
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 12px;
  font-weight: 600;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-btn,
#uploadLabel {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(140deg, var(--accent-strong), rgba(var(--tint-rgb), 0.32));
  color: #fff;
  cursor: url('../assets/hand_open.svg') 8 0, pointer;
  box-shadow: 0 16px 32px -20px rgba(var(--glow-rgb), 0.9);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  text-align: center;
}

.action-btn.secondary,
#uploadLabel {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.16), rgba(var(--tint-rgb), 0.12));
  color: var(--text);
  border: 1px solid var(--chip-border);
  box-shadow: none;
}

.action-btn:hover,
#uploadLabel:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px -22px rgba(var(--glow-rgb), 0.8);
}

.action-btn:active,
#uploadLabel:active {
  transform: translateY(0);
  box-shadow: none;
}

.print-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted-1);
  font-size: 13px;
}

#printStatus {
  flex: 1;
  min-height: 20px;
}

.linklike {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  font-weight: 600;
  cursor: url('../assets/hand_open.svg') 8 0, pointer;
  text-decoration: underline;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.linklike:hover {
  opacity: 1;
}

.linklike[aria-disabled="true"] {
  opacity: 0.4;
  pointer-events: none;
}

.print-config {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.print-config label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted-1);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.print-config input,
.print-config select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font: inherit;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.print-config input[readonly] {
  cursor: default;
  opacity: 0.75;
  pointer-events: none;
}

.print-config input:focus,
.print-config select:focus {
  outline: none;
  border-color: var(--outline-strong);
  box-shadow: 0 0 0 3px rgba(var(--tint-rgb), 0.25);
}

.downloads {
  display: grid;
  gap: 10px;
}

.downloads .download-item {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: var(--muted-1);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 500;
  letter-spacing: 0.02em;
}

[data-theme="light"] .stat,
[data-theme="light"] .downloads .download-item {
  background: var(--panel-muted);
  border-color: var(--card-border);
}

.downloads a.download-item {
  text-decoration: none;
  border-style: solid;
  transition: background 0.2s ease, color 0.2s ease;
}

.downloads a.download-item:hover,
.downloads a.download-item:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.downloads .download-item[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

#stage {
  position: fixed;
  top: var(--bar-h);
  left: min(var(--sidebar-w), 50vw);
  right: 0;
  bottom: 0;
  transition: left var(--transition-ms) ease, bottom var(--transition-ms) ease, opacity 0.2s ease;
  z-index: 10;
}

body.sidebar-collapsed #stage {
  left: var(--sidebar-rail-w);
}

body.mobile #stage {
  left: 0;
  bottom: var(--bottombar-h);
}

body.mobile.sidebar-collapsed #stage {
  bottom: calc(var(--bottombar-collapsed-h) + var(--chrome-offset));
}

body.sidebar-resizing #stage {
  transition: none !important;
  opacity: 0.98;
  pointer-events: none;
}

.stage-shell {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--stage-radius);
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(14, 14, 14, 0.78));
  border: 1px solid var(--stage-border);
  box-shadow: var(--stage-shadow);
  display: flex;
  isolation: isolate;
}

.stage-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(at 18% 22%, rgba(255, 255, 255, 0.05), transparent 60%),
    radial-gradient(at 80% 20%, rgba(255, 255, 255, 0.04), transparent 65%),
    radial-gradient(at 50% 85%, rgba(255, 255, 255, 0.03), transparent 60%);
  opacity: 0.85;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 1;
}

.stage-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.55));
  opacity: 0.28;
  pointer-events: none;
  z-index: 2;
}

body[data-theme="light"] .stage-shell {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.75), rgba(232, 232, 232, 0.82));
}

body[data-theme="light"] .stage-shell::after {
  opacity: 0.12;
}

body[data-theme="light"] .stage-shell::before {
  opacity: 0.6;
}

#view {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  background: #b2b2b2;
  display: block;
}

#loadingOverlay {
  position: fixed;
  top: var(--bar-h);
  left: min(var(--sidebar-w), 50vw);
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(10, 10, 10, 0.82);
  color: var(--text);
  font-size: 15px;
  z-index: 60;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.sidebar-collapsed #loadingOverlay {
  left: var(--sidebar-rail-w);
}

body.mobile #loadingOverlay {
  left: 0;
  bottom: var(--bottombar-h);
}

body.mobile.sidebar-collapsed #loadingOverlay {
  bottom: calc(var(--bottombar-collapsed-h) + var(--chrome-offset));
}

#loadingOverlay.loading-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#loadingIcon {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.45));
  animation: rock 1.4s ease-in-out infinite alternate;
}

/* Blurred still of the model: an instant first paint while the real one downloads */
#loadingPoster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.55;
  filter: blur(6px) saturate(0.9);
  pointer-events: none;
  z-index: -1;
}

#loadingBar {
  width: min(240px, 60%);
  height: 4px;
  border-radius: 999px;
  background: rgba(var(--tint-rgb), 0.25);
  overflow: hidden;
}

#loadingBar span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: var(--text);
  transition: width 0.2s ease;
}

#loadingBar.indeterminate span {
  width: 35%;
  animation: loading-slide 1.2s ease-in-out infinite;
}

@keyframes loading-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(290%); }
}

@keyframes rock {
  0% { transform: rotate(-10deg); }
  100% { transform: rotate(10deg); }
}

#hud {
  position: fixed;
  left: calc(min(var(--sidebar-w), 50vw) + 24px);
  bottom: 24px;
  display: flex;
  gap: 14px;
  align-items: center;
  z-index: 30;
  transition: left var(--transition-ms) ease, bottom var(--transition-ms) ease;
}

body.sidebar-collapsed #hud {
  left: calc(var(--sidebar-rail-w) + 24px);
}

body.mobile #hud {
  left: 24px;
  bottom: calc(var(--bottombar-h) + 18px);
  flex-direction: column;
  align-items: flex-start;
}

body.mobile.sidebar-collapsed #hud {
  bottom: calc(var(--bottombar-collapsed-h) + 18px);
}

#progress, #info {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--hud-progress-bg);
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  min-width: 180px;
}

#info {
  background: var(--hud-info-bg);
  min-width: 220px;
}

#calloutsContainer {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
  font-size: 12px;
  color: var(--text);
}

.callout {
  position: absolute;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.callout.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.callout-card {
  background: rgba(var(--panel-dark-rgb), 0.82);
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  min-width: 160px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .callout-card {
  background: rgba(255, 255, 255, 0.86);
}

.callout-line {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -100%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  color: var(--text);
}

.callout-line.visible .callout-icon,
.callout-line.visible .callout-action {
  pointer-events: auto;
  cursor: url('../assets/hand_point.svg') 8 0, pointer;
}

.callout-line:hover {
  z-index: 2;
}

.callout-line.visible:hover .callout-info {
  display: block;
}

/* Ink markers sit side by side at one height: slightly smaller so neighbours don't touch */
.callout-line.callout-ink .callout-icon {
  width: 20px;
  height: 20px;
  font-size: 10px;
}

.callout-action {
  order: 1;
  margin-top: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(var(--panel-dark-rgb), 0.78);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  transition: background 160ms ease, transform 160ms ease;
}

.callout-action:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.callout-line.expanded {
  z-index: 1;
}

.callout-line.expanded .callout-info {
  display: block;
}

.callout-line .callout-svg {
  order: 3;
  display: block;
  flex: none;
}

.callout-line .callout-icon {
  order: 2;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.85);
  font-family: inherit;
  width: 24px;
  height: 24px;
  margin: 6px 0;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.callout-info {
  order: 1;
  display: none;
  max-width: 220px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(var(--panel-dark-rgb), 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .callout-info {
  background: rgba(255, 255, 255, 0.88);
}

.callout-info h4 {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
}

.callout-info p {
  margin: 0;
  color: var(--muted-1);
  line-height: 1.4;
}

.callout-info .status {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Canvas cursor is driven by one state attribute (see updateCursor):
   idle = open hand (drag to orbit), interactive = pointing hand, dragging = closed hand */
#view {
  cursor: url('../assets/hand_open.svg') 16 16, grab;
}

#view[data-cursor="interactive"] {
  cursor: url('../assets/hand_point.svg') 8 0, pointer;
}

#view[data-cursor="dragging"] {
  cursor: url('../assets/hand_closed.svg') 16 16, grabbing;
}

#debugToggle {
  display: none;
}

body.debug-enabled #debugToggle {
  display: inline-flex;
}

#debugToggle.active {
  background: linear-gradient(150deg, rgba(var(--tint-rgb), 0.5), rgba(var(--tint-rgb), 0.25));
  border-color: var(--outline-strong);
}

.callout-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 0 6px rgba(var(--tint-rgb), 0.25);
  margin-bottom: 8px;
}

#bottomRightControls {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 35;
}

body.mobile #bottomRightControls {
  right: 16px;
  bottom: calc(var(--bottombar-h) + 18px);
}

body.mobile.sidebar-collapsed #bottomRightControls {
  bottom: calc(var(--bottombar-collapsed-h) + 18px);
}

#bottomRightControls .icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 16px;
}

/* First-person walk mode (desktop only) */
#fpsOverlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

#fpsOverlay[hidden],
#fpsBtn[hidden],
body.mobile #fpsBtn {
  display: none;
}

#fpsCrosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.55);
}

#fpsCrosshair.interactive {
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: transparent;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px rgba(0, 0, 0, 0.45);
}

#fpsHint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
}

#fpsBtn[aria-pressed="true"] {
  background: var(--accent-strong);
  color: #fff;
}

#debugPanel {
  position: fixed;
  top: calc(var(--bar-h) + 24px);
  right: 24px;
  width: min(340px, calc(100% - 48px));
  max-height: calc(100% - var(--bar-h) - 48px);
  overflow-y: auto;
  background: rgba(12, 12, 12, 0.92);
  color: #f2f2f2;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(var(--tint-rgb), 0.22);
  box-shadow: var(--glass-shadow);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  z-index: 50;
  display: none;
}

#debugPanel h3 {
  margin: 0 0 12px 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
}

#debugPanel .section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

#debugPanel .label {
  color: var(--accent);
  font-weight: 600;
}

#debugPanel .value {
  color: var(--muted-1);
}

#debugPanel .error {
  color: #ff6b6b;
}

#debugPanel .success {
  color: #4ef1c7;
}

#debugPanel .warning {
  color: #ffd166;
}

#debugPanel .mode-control {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

#debugPanel .mode-control button {
  justify-self: flex-start;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid rgba(var(--tint-rgb), 0.4);
  background: rgba(var(--tint-rgb), 0.12);
  color: var(--text);
  cursor: url('../assets/hand_open.svg') 8 0, pointer;
}

#debugPanel .mode-control button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.loading-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.sidebar-collapsed #sidebar {
  width: var(--sidebar-rail-w);
  padding: 24px 12px;
}

body.sidebar-collapsed #sidebar .side-scroll {
  display: none !important;
}

body.sidebar-collapsed #sidebar .side-header {
  justify-content: center;
}

body.sidebar-collapsed:not(.mobile) #sidebar .side-header-copy {
  display: none;
}

body.sidebar-collapsed #sidebar::before {
  opacity: 0.3;
}

body.sidebar-collapsed #sidebar::after {
  display: none;
}

body.mobile #sidebar {
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  height: var(--bottombar-h);
  border-right: none;
  border-top: 1px solid var(--glass-border);
  border-radius: 32px 32px 0 0;
  padding: 18px 18px 24px;
  transform: translateY(0);
}

body.mobile.sidebar-collapsed #sidebar {
  height: var(--bottombar-collapsed-h);
}

body.mobile #sidebar::before {
  inset: -20% -10% 0 -10%;
}

body.mobile #sidebar::after,
body.mobile #sidebarGrip {
  display: none;
}

body.mobile #sidebar .side-header {
  padding-bottom: 16px;
}

body.mobile #sidebar .side-scroll {
  padding-right: 6px;
  gap: 16px;
}

body.mobile.sidebar-collapsed #sidebar .side-scroll {
  display: none !important;
}

body.mobile #hud {
  left: 24px;
}



@media (max-width: 640px) {
  .hero-headline {
    font-size: clamp(26px, 4vw, 32px);
  }

  .button-group {
    flex-direction: column;
    gap: 10px;
  }

  .action-btn,
  #uploadLabel,
  .downloads .download-item {
    width: 100%;
    justify-content: center;
  }
}

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

@media (max-width: 860px) {
  .brand-title {
    font-size: 16px;
  }

  #topbar {
    gap: 12px;
    padding: 0 16px;
  }

  #sidebar {
    padding: 20px 16px 24px;
  }
}

@media (max-width: 720px) {
  .brand-copy {
    display: none;
  }

  .toolbar-pill {
    display: none;
  }
}

@media (max-width: 640px) {
  body {
    overflow: hidden;
  }
}
/* ================= Glass theme (light + dark) ================= */
:root {
  --gap: 12px;
  --panel-radius: 28px;
}

body {
  background: var(--bg-gradient), var(--bg);
}

#topbar,
#sidebar {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
  backdrop-filter: var(--glass-blur, saturate(180%) blur(40px));
  -webkit-backdrop-filter: var(--glass-blur, saturate(180%) blur(40px));
}

#sidebar::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 35%);
  opacity: 1;
}

.side-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  box-shadow: var(--glass-highlight);
}

/* Hero card: same glass, slightly brighter sheen to lead the panel */
.side-section.hero-panel {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02) 60%), var(--card-bg);
  box-shadow: var(--glass-highlight), 0 14px 30px -18px rgba(0, 0, 0, 0.35);
}

.stat,
.downloads .download-item {
  background: var(--panel-muted);
  border: 1px solid var(--card-border);
  box-shadow: var(--glass-highlight);
}

.chip {
  background: var(--chip-bg);
  border-color: var(--chip-border);
  box-shadow: var(--glass-highlight);
}

.action-btn {
  border-radius: 18px;
  border: none;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 24px -12px rgba(0, 0, 0, 0.5);
}

.action-btn.secondary,
#uploadLabel {
  background: var(--chip-bg);
  color: var(--text);
  border: 1px solid var(--chip-border);
  box-shadow: var(--glass-highlight);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.action-btn:hover,
#uploadLabel:hover {
  filter: brightness(1.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 14px 28px -14px rgba(0, 0, 0, 0.55);
}

.print-config input,
.print-config select {
  background: var(--field-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

.icon-btn {
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), 0 10px 24px -10px rgba(0, 0, 0, 0.45);
  backdrop-filter: var(--glass-blur, saturate(180%) blur(40px));
  -webkit-backdrop-filter: var(--glass-blur, saturate(180%) blur(40px));
}

.icon-btn:hover {
  background: var(--chip-hover-bg);
}

#bottomRightControls .icon-btn {
  border-radius: 50%;
}

#progress,
#info {
  color: var(--text);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
  backdrop-filter: var(--glass-blur, saturate(180%) blur(40px));
  -webkit-backdrop-filter: var(--glass-blur, saturate(180%) blur(40px));
}

/* Loading overlay covers just the render window */
#loadingOverlay {
  position: absolute !important;
  inset: 0 !important;
  background: var(--glass);
}

.stage-shell {
  border: 1px solid var(--stage-border);
}

/* Floating panels on desktop */
body:not(.mobile) {
  --stage-radius: var(--panel-radius);
  --stage-border: var(--glass-border);
  --stage-shadow: var(--glass-shadow);
}

body:not(.mobile) #topbar {
  top: var(--gap);
  left: var(--gap);
  right: var(--gap);
  border-radius: 22px;
}

body:not(.mobile) #sidebar {
  top: calc(var(--bar-h) + 2 * var(--gap));
  left: var(--gap);
  bottom: var(--gap);
  border-radius: var(--panel-radius);
}

body:not(.mobile) #stage {
  top: calc(var(--bar-h) + 2 * var(--gap));
  left: calc(min(var(--sidebar-w), 50vw) + 2 * var(--gap));
  right: var(--gap);
  bottom: var(--gap);
}

body.sidebar-collapsed:not(.mobile) #stage {
  left: calc(var(--sidebar-rail-w) + 2 * var(--gap));
}

body:not(.mobile) #hud {
  left: calc(min(var(--sidebar-w), 50vw) + 2 * var(--gap) + 16px);
  bottom: calc(var(--gap) + 16px);
}

body.sidebar-collapsed:not(.mobile) #hud {
  left: calc(var(--sidebar-rail-w) + 2 * var(--gap) + 16px);
}

body:not(.mobile) #bottomRightControls {
  right: calc(var(--gap) + 16px);
  bottom: calc(var(--gap) + 16px);
}

body:not(.mobile) #debugPanel {
  top: calc(var(--bar-h) + 2 * var(--gap) + 16px);
  right: calc(var(--gap) + 16px);
}

/* Build version badge (version.json, generated by scripts/write-version.mjs) */
.version-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 4;
  padding: 5px 10px;
  border-radius: 999px;
  font: 500 11px/1.4 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
  color: var(--muted-1);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight);
  backdrop-filter: var(--glass-blur, saturate(180%) blur(40px));
  -webkit-backdrop-filter: var(--glass-blur, saturate(180%) blur(40px));
  text-decoration: none;
  user-select: text;
}

.version-badge:hover {
  color: var(--text);
}

.version-badge[hidden] {
  display: none;
}

/* --------- Accessibility --------- */
:root { --focus-ring: #4d8dff; }
[data-theme="light"] { --focus-ring: #0014cc; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

#view:focus-visible {
  outline-offset: -4px;
  border-radius: var(--stage-radius);
}

.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;
}

.btn-icon {
  display: inline-flex;
  flex: none;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

.btn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#uploadLabel {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}

/* Keyboard focus on a callout shows its detail card, like hover */
.callout-line.visible:focus-within {
  z-index: 2;
}

.callout-line.visible:focus-within .callout-info {
  display: block;
}

/* Keyboard-resizable sidebar edge */
#sidebarGrip:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Interactive parts list: the same actions as clicking parts in the 3D view */
.parts-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.part-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--chip-border);
  background: var(--card-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 500;
  text-align: left;
  cursor: url('../assets/hand_point.svg') 8 0, pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.part-btn:hover {
  background: var(--chip-hover-bg);
}

.part-btn[aria-pressed="true"] {
  border-color: var(--outline-strong);
}

.parts-list .skeleton {
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(100deg, var(--card-bg) 30%, var(--chip-hover-bg) 50%, var(--card-bg) 70%);
  background-size: 300% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

.part-swatch svg,
.callout-line .callout-icon svg {
  width: 13px;
  height: 13px;
}

.part-swatch {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-strong);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.85);
}

.part-state {
  margin-left: auto;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.part-btn[aria-pressed="true"] .part-state {
  background: #36c47a;
  box-shadow: 0 0 0 3px rgba(54, 196, 122, 0.25);
}

h2.side-title {
  margin-top: 0;
  line-height: inherit;
}

.print-readout {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 15px;
  letter-spacing: normal;
  text-transform: none;
  opacity: 0.85;
}

/* --------- View toolbar, tips, toast, drop target --------- */
.view-toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 24px);
  padding: 4px;
  overflow-x: auto;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), 0 10px 30px -18px rgba(0, 0, 0, 0.6);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  scrollbar-width: none;
}

.view-toolbar[hidden] {
  display: none;
}

.view-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: url('../assets/hand_point.svg') 8 0, pointer;
  transition: background 160ms ease;
}

.view-btn:hover,
.view-btn[aria-pressed="true"] {
  background: var(--chip-hover-bg);
}

.view-btn.icon-only {
  width: 32px;
  padding: 0;
}

.view-btn svg {
  width: 16px;
  height: 16px;
}

.view-sep {
  flex: none;
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--glass-border);
}

.coach {
  position: absolute;
  right: 76px;
  bottom: 16px;
  z-index: 6;
  width: min(320px, calc(100% - 92px));
  padding: 16px 18px;
  border-radius: 20px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  animation: coach-in 320ms ease both;
}

.coach[hidden] {
  display: none;
}

@keyframes coach-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.coach-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.coach-steps {
  margin: 0 0 12px;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-1);
}

.coach-steps strong {
  color: var(--text);
  font-weight: 600;
}

.coach-btn {
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: url('../assets/hand_point.svg') 8 0, pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  transform: translate(-50%, 16px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.drop-hint {
  position: absolute;
  inset: 12px;
  z-index: 7;
  display: grid;
  place-items: center;
  border: 2px dashed var(--outline-strong);
  border-radius: max(0px, calc(var(--stage-radius) - 6px));
  background: rgba(var(--panel-dark-rgb), 0.35);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

#stage.drop-active .drop-hint {
  opacity: 1;
}

/* Phones: the toolbar takes the top edge, tips sit just under it */
body.mobile .version-badge {
  display: none;
}

body.mobile .coach {
  top: 60px;
  bottom: auto;
  left: 12px;
  right: 12px;
  width: auto;
}

@media (max-width: 640px) {
  .view-toolbar {
    top: 8px;
  }

  .view-btn {
    padding: 6px 10px;
  }
}

.ar-btn {
  width: 100%;
  margin-top: 16px;
}

.ar-btn[hidden] {
  display: none;
}

.key-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted-2);
}

.key-hint kbd {
  font: inherit;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
}

/* Pause / fullscreen toggles swap their icon with state */
#rotateBtn .icon-play,
#rotateBtn[aria-pressed="true"] .icon-pause,
#fullscreenBtn .icon-exit-fs,
#fullscreenBtn[aria-pressed="true"] .icon-enter-fs {
  display: none;
}

#rotateBtn[aria-pressed="true"] .icon-play,
#fullscreenBtn[aria-pressed="true"] .icon-exit-fs {
  display: block;
}
