/* ==========================================================================
   KEYCHRON Q1 MAX V2 — Industrial Design System & Studio HUD
   ========================================================================== */

:root {
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="daylight"] {
  --surface-hud: rgba(244, 243, 239, 0.78);
  --surface-elevated: rgba(255, 255, 255, 0.76);
  --surface-subtle: rgba(20, 20, 19, 0.05);
  --surface-hover: rgba(20, 20, 19, 0.09);
  --border-hairline: rgba(20, 20, 19, 0.12);
  --border-strong: rgba(20, 20, 19, 0.3);
  --ink-primary: #141413;
  --ink-secondary: #53534e;
  --ink-muted: #7c7b74;
  --cta-bg: #141413;
  --cta-ink: #f6f5f2;
  --accent-sage: #6f9680;
  --shadow-hud: 0 12px 40px rgba(20, 20, 19, 0.08);
}

html[data-theme="golden"] {
  --surface-hud: rgba(246, 238, 227, 0.8);
  --surface-elevated: rgba(255, 249, 241, 0.76);
  --surface-subtle: rgba(34, 24, 16, 0.06);
  --surface-hover: rgba(34, 24, 16, 0.1);
  --border-hairline: rgba(34, 24, 16, 0.14);
  --border-strong: rgba(34, 24, 16, 0.32);
  --ink-primary: #1f1711;
  --ink-secondary: #625041;
  --ink-muted: #8a7564;
  --cta-bg: #1f1711;
  --cta-ink: #faf4ec;
  --accent-sage: #c96a2b;
  --shadow-hud: 0 14px 44px rgba(34, 20, 8, 0.12);
}

html[data-theme="nocturne"] {
  --surface-hud: rgba(16, 18, 21, 0.78);
  --surface-elevated: rgba(28, 31, 36, 0.8);
  --surface-subtle: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.11);
  --border-hairline: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.34);
  --ink-primary: #f2f1ed;
  --ink-secondary: #a1a09a;
  --ink-muted: #6c6c67;
  --cta-bg: #f2f1ed;
  --cta-ink: #101215;
  --accent-sage: #7fa890;
  --shadow-hud: 0 16px 48px rgba(0, 0, 0, 0.45);
}

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

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--ink-primary);
  background: #101216;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

#canvas-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#canvas-stage:active {
  cursor: grabbing;
}

/* ==========================================================================
   3D Exploded View Callout Overlay
   ========================================================================== */
.callout-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}

.callout-tag {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px 4px 7px;
  background: var(--surface-hud);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--ink-primary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transform: translate(-100%, -50%);
  transition: opacity 0.22s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.callout-tag.is-interactive {
  pointer-events: auto;
}

.callout-tag:hover {
  background: var(--surface-elevated);
  border-color: var(--ink-primary);
}

/* ==========================================================================
   Interactive CNC Rotary Knob Radial Readout
   ========================================================================== */
.knob-hud {
  position: fixed;
  bottom: 34px;
  left: 50%;
  transform: translate(-50%, 10px) scale(0.96);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 10px;
  background: var(--surface-hud);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-hud);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.2s ease, transform 0.24s var(--ease-out);
}

.knob-hud.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.knob-ring {
  transform: rotate(-90deg);
}

.knob-track {
  fill: none;
  stroke: var(--border-hairline);
  stroke-width: 2.5;
}

.knob-arc {
  fill: none;
  stroke: var(--ink-primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 163.36;
  stroke-dashoffset: 40.84;
  transition: stroke-dashoffset 0.08s linear;
}

.knob-hud-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.knob-hud-val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-primary);
}

.knob-hud-lbl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

/* ==========================================================================
   Custom Accent Keycap Painter
   ========================================================================== */
body.paint-mode #canvas-stage {
  cursor: crosshair;
}

body.knob-hover #canvas-stage {
  cursor: ns-resize;
}

.paint-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mini-pill-btn {
  appearance: none;
  padding: 3px 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.18s ease;
}

.mini-pill-btn:hover {
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.mini-pill-btn.is-active {
  background: var(--cta-bg);
  color: var(--cta-ink);
  border-color: var(--cta-bg);
}

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

.paint-palette {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.paint-chip {
  appearance: none;
  width: 34px;
  height: 26px;
  border-radius: var(--radius-xs);
  background: var(--swatch, var(--surface-subtle));
  border: 1px solid rgba(0, 0, 0, 0.18);
  cursor: pointer;
  position: relative;
  transition: transform 0.14s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

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

.paint-chip.is-active {
  box-shadow: 0 0 0 2px var(--surface-elevated), 0 0 0 3.5px var(--ink-primary);
}

.paint-eraser {
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.paint-eraser:hover {
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.callout-line {
  position: absolute;
  right: -28px;
  top: 50%;
  width: 28px;
  height: 1px;
  background: var(--border-strong);
}

.callout-line::after {
  content: '';
  position: absolute;
  right: -2px;
  top: -2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-primary);
}

.callout-idx {
  color: var(--accent-sage);
  font-weight: 500;
}

/* Shared HUD Transitions */
.hud-header,
.hud-bottom-left,
.hud-inspector,
.typing-pill {
  transition: opacity 0.35s var(--ease-out), transform 0.4s var(--ease-out), background-color 0.35s var(--ease-out), border-color 0.35s var(--ease-out);
}

body.hud-hidden .hud-header {
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
}

body.hud-hidden .hud-bottom-left,
body.hud-hidden .typing-pill {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

body.hud-hidden .hud-inspector {
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
}

/* ==========================================================================
   Top Header
   ========================================================================== */
.hud-header {
  position: fixed;
  top: 20px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
}

.brand-lockup,
.header-actions {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-lockup {
  padding: 8px 14px 8px 12px;
  background: var(--surface-hud);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-hud);
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent-sage);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ver-badge {
  font-size: 9px;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  color: var(--ink-primary);
}

.brand-sub {
  font-size: 11px;
  color: var(--ink-secondary);
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-hud);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-hud);
}

.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.seg-btn:hover {
  color: var(--ink-primary);
}

.seg-btn.is-active {
  background: var(--surface-elevated);
  color: var(--ink-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.icon-btn {
  appearance: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--surface-hud);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  color: var(--ink-primary);
  cursor: pointer;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-hud);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.icon-btn:hover {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
}

/* ==========================================================================
   Live Typing Telemetry + Auto-Type Bar
   ========================================================================== */
.typing-pill {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 12px;
  background: var(--surface-hud);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-hud);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-secondary);
  z-index: 10;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-sage);
  transition: transform 0.12s ease;
}

.typing-pill.is-firing .typing-dot {
  transform: scale(1.65);
}

.typing-pill.is-firing {
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.autotype-btn {
  appearance: none;
  padding: 5px 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.autotype-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.autotype-btn.is-running {
  background: var(--cta-bg);
  color: var(--cta-ink);
  border-color: var(--cta-bg);
}

/* ==========================================================================
   Bottom-Left Camera & Spec Strip
   ========================================================================== */
.hud-bottom-left {
  position: fixed;
  left: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.camera-rail {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-hud);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-hud);
  width: fit-content;
}

.cam-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cam-btn:hover {
  color: var(--ink-primary);
  background: var(--surface-subtle);
}

.cam-btn.is-active {
  color: var(--ink-primary);
  background: var(--surface-elevated);
  border-color: var(--border-hairline);
}

.spec-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(84px, auto));
  background: var(--surface-hud);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-hud);
  overflow: hidden;
}

.spec-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 14px;
  border-right: 1px solid var(--border-hairline);
}

.spec-cell:last-child {
  border-right: none;
}

.spec-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}

.spec-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-primary);
}

/* ==========================================================================
   Right Floating Inspector Rail
   ========================================================================== */
.hud-inspector {
  position: fixed;
  top: 74px;
  right: 24px;
  bottom: 24px;
  width: 322px;
  display: flex;
  flex-direction: column;
  background: var(--surface-hud);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: var(--shadow-hud);
  z-index: 10;
  overflow: hidden;
}

.inspector-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-hairline);
}

.product-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  color: var(--ink-primary);
}

.product-subtitle {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--ink-secondary);
}

.price-tag {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-primary);
  padding-top: 4px;
}

.inspector-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.inspector-scroll::-webkit-scrollbar {
  width: 4px;
}

.inspector-scroll::-webkit-scrollbar-thumb {
  background: var(--border-hairline);
  border-radius: 2px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.group-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.11em;
  color: var(--ink-muted);
}

.group-value {
  font-size: 11.5px;
  color: var(--ink-secondary);
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.swatch-btn {
  appearance: none;
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 9px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.swatch-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.swatch-btn.is-active {
  background: var(--surface-elevated);
  border-color: var(--ink-primary);
}

.swatch-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.16);
}

.swatch-shell {
  background: linear-gradient(135deg, #f5f5f2 0%, #f5f5f2 52%, #7da38c 52%, #7da38c 100%);
}

.swatch-carbon {
  background: linear-gradient(135deg, #212225 0%, #212225 56%, #d96432 56%, #d96432 100%);
}

.swatch-silver {
  background: linear-gradient(135deg, #d3d7dc 0%, #999fa7 55%, #5b7b8a 55%, #5b7b8a 100%);
}

.swatch-name {
  font-size: 10.5px;
  color: var(--ink-primary);
}

.swatch-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.pill-swatch {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-swatch:hover {
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.pill-swatch.is-active {
  background: var(--surface-elevated);
  color: var(--ink-primary);
  border-color: var(--ink-primary);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.dot-red { background: #d94646; }
.dot-brown { background: #8a5634; }
.dot-banana { background: #e8c547; }

.dual-row {
  display: flex;
  gap: 8px;
}

.mini-seg {
  flex: 1;
  display: flex;
  padding: 2px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
}

.mini-btn {
  flex: 1;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 6px 4px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.18s ease;
}

.mini-btn:hover {
  color: var(--ink-primary);
}

.mini-btn.is-active {
  background: var(--surface-elevated);
  color: var(--ink-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.pose-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.pose-btn {
  appearance: none;
  padding: 7px 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pose-btn:hover {
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.pose-btn.is-active {
  background: var(--surface-elevated);
  color: var(--ink-primary);
  border-color: var(--ink-primary);
}

.slider-block {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.slider-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-secondary);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--ink-primary);
}

.layer-legend {
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.45;
  color: var(--ink-muted);
}

.hairline-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--border-strong);
  border-radius: 1px;
  outline: none;
  cursor: pointer;
}

.hairline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink-primary);
  border: 2px solid var(--surface-elevated);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.hairline-slider::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

.hairline-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink-primary);
  border: 2px solid var(--surface-elevated);
}

.inspector-footer {
  padding: 13px 20px 15px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.shortcut-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-muted);
  text-align: center;
}

.cta-btn {
  appearance: none;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--cta-bg);
  color: var(--cta-ink);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.cta-btn:hover {
  opacity: 0.9;
}

.cta-btn:active {
  transform: scale(0.99);
}

.restore-hud-btn {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 20;
  appearance: none;
  padding: 8px 12px;
  background: var(--surface-hud);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  backdrop-filter: blur(20px);
  cursor: pointer;
}

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

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 16px);
  padding: 9px 16px;
  background: var(--cta-bg);
  color: var(--cta-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.25s ease, transform 0.25s var(--ease-out);
}

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

/* Mobile Bottom Sheet Handle (hidden on desktop) */
.sheet-handle {
  display: none;
  appearance: none;
  border: none;
  background: transparent;
  width: 100%;
  padding: 9px 0 4px;
  cursor: pointer;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.sheet-pill {
  width: 36px;
  height: 3.5px;
  border-radius: 99px;
  background: var(--border-strong);
  transition: background-color 0.2s ease, width 0.2s ease;
}

.sheet-handle:hover .sheet-pill {
  background: var(--ink-primary);
  width: 44px;
}

/* ==========================================================================
   Responsive Breakpoints (Laptop -> Tablet -> Mobile)
   ========================================================================== */

/* Compact Laptop: keep top telemetry pill from colliding with header */
@media (max-width: 1220px) {
  #typing-readout {
    display: none;
  }
  .typing-pill {
    padding: 5px 6px 5px 10px;
    gap: 8px;
  }
}

/* Tablet & Mobile: Collapsible Bottom Sheet + Floating Camera Rail */
@media (max-width: 960px) {
  .callout-layer {
    display: none;
  }

  .hud-header {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  /* Compact Auto-Type pill tucked cleanly below top-left brand */
  .typing-pill {
    top: 66px;
    left: 12px;
    transform: none;
  }

  body.hud-hidden .typing-pill {
    transform: translateY(-12px);
  }

  /* Keep Camera Rail accessible right above the bottom sheet */
  .hud-bottom-left {
    left: 12px;
    right: 12px;
    bottom: calc(44dvh + 18px);
    transition: bottom 0.35s var(--ease-out), opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
  }

  body.sheet-collapsed .hud-bottom-left {
    bottom: 84px;
  }

  .spec-strip {
    display: none;
  }

  .camera-rail {
    width: 100%;
    max-width: fit-content;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .camera-rail::-webkit-scrollbar {
    display: none;
  }

  .cam-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Collapsible Bottom Sheet Inspector */
  .sheet-handle {
    display: flex;
  }

  .hud-inspector {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    height: 44dvh;
    max-height: 44dvh;
    transition: height 0.35s var(--ease-out), max-height 0.35s var(--ease-out), opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
  }

  .hud-inspector.is-collapsed {
    height: 64px;
    max-height: 64px;
  }

  .hud-inspector.is-collapsed .inspector-scroll,
  .hud-inspector.is-collapsed .inspector-footer {
    opacity: 0;
    pointer-events: none;
  }

  .inspector-top {
    padding: 4px 16px 12px;
    cursor: pointer;
  }

  .product-title {
    font-size: 22px;
  }

  .inspector-scroll {
    padding: 12px 16px;
    gap: 16px;
  }

  .inspector-footer {
    padding: 10px 16px 12px;
  }

  .shortcut-hint {
    display: none;
  }

  /* Move Knob HUD to top-center on mobile so bottom sheet never obscures it */
  .knob-hud {
    top: 66px;
    bottom: auto;
    left: auto;
    right: 12px;
    transform: translateY(-8px) scale(0.96);
  }

  .knob-hud.is-visible {
    transform: translateY(0) scale(1);
  }

  .toast {
    top: 68px;
    bottom: auto;
  }
}

/* Narrow Portrait Phones (360px - 600px) */
@media (max-width: 600px) {
  .brand-sub {
    display: none;
  }

  .brand-lockup {
    padding: 8px 10px;
  }

  .brand-name {
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .header-actions {
    gap: 5px;
  }

  .seg-btn {
    padding: 5px 8px;
    font-size: 10.5px;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .typing-pill {
    top: 56px;
  }

  .knob-hud {
    top: 56px;
  }

  .paint-chip {
    flex: 1;
    width: auto;
    height: 30px;
  }

  .cam-btn {
    padding: 6px 9px;
    font-size: 10.5px;
  }
}
