/* ==========================================================================
   GREENMIX CLINICAL OS — HEYCLICKY FUN & AESTHETIC DESIGN SYSTEM
   Vibe: Y2K Retro Mac OS, Skeuomorphic Gloss, Playful Stickers, Dynamic Visuals
   ========================================================================== */

:root {
  /* HeyClicky Palette */
  --desktop-bg: #ecebe8;
  --desktop-surface: #f9f8f6;
  --win-bg: #ffffff;
  --win-bar-top: #ededee;
  --win-bar-bot: #d5d4d7;
  --win-border: #b8b7bb;
  --win-shadow: 0 18px 45px -8px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08);
  
  --text-dark: #121316;
  --text-sub: #5a5c63;
  --text-muted: #8b8d96;
  
  --accent-cyan: #00b4d8;
  --accent-emerald: #10b981;
  --accent-pink: #ec4899;
  --accent-amber: #f59e0b;
  --accent-purple: #8b5cf6;
  --accent-blue: #0284c7;
  --laser-blue: #00f0ff;
  
  --font-main: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --trans-fast: 0.12s ease;
  --trans-spring: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
}

body.clicky-theme {
  font-family: var(--font-main);
  background-color: var(--desktop-bg);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.45;
  overflow-x: hidden;
  position: relative;
  /* Retro dotted desktop wallpaper pattern */
  background-image: 
    radial-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, #f3f2ef 0%, #e6e5e1 100%);
  background-size: 20px 20px, 100% 100%;
}

/* ================= RETRO MAC MENUBAR ================= */
.mac-menubar {
  position: sticky;
  top: 0;
  z-index: 999;
  height: 38px;
  background: rgba(248, 248, 247, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  font-size: 0.825rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.menubar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mac-apple-logo {
  font-size: 1.1rem;
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mac-apple-logo:hover {
  transform: scale(1.3) rotate(15deg);
}

.menubar-title {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-dark);
  font-size: 0.9rem;
}

.menubar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.menu-link {
  background: transparent;
  border: none;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-sub);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.menu-link:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-dark);
}

.menu-link.active {
  background: var(--text-dark);
  color: white;
  font-weight: 600;
}

/* Lo-Fi Music Player Pill in Menubar */
.menubar-center {
  display: flex;
  align-items: center;
}

.lofi-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-full);
  font-size: 0.725rem;
  color: var(--text-sub);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.lofi-player:hover {
  background: rgba(0, 0, 0, 0.09);
  color: var(--text-dark);
  transform: translateY(-1px);
}

.sound-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.sound-bars i {
  width: 2px;
  background: var(--accent-cyan);
  border-radius: 1px;
  height: 4px;
  transition: height 0.15s ease;
}

.sound-bars.playing i:nth-child(1) { animation: barPulse 0.8s infinite alternate 0.1s; }
.sound-bars.playing i:nth-child(2) { animation: barPulse 0.8s infinite alternate 0.3s; }
.sound-bars.playing i:nth-child(3) { animation: barPulse 0.8s infinite alternate 0.5s; }
.sound-bars.playing i:nth-child(4) { animation: barPulse 0.8s infinite alternate 0.2s; }
.sound-bars.playing i:nth-child(5) { animation: barPulse 0.8s infinite alternate 0.4s; }

@keyframes barPulse {
  0% { height: 3px; }
  100% { height: 12px; }
}

.menubar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.menubar-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: white;
  cursor: pointer;
  font-size: 0.725rem;
  font-family: var(--font-mono);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  transition: all var(--trans-fast);
}

.menubar-pill-btn:hover {
  background: #f0f0f0;
}

.menubar-pill-btn.sound-active {
  border-color: var(--accent-emerald);
  color: #065f46;
  background: #ecfdf5;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-sub);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 6px var(--accent-emerald);
  animation: pulseDot 1.6s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.battery-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.battery-shell {
  width: 18px;
  height: 10px;
  border: 1.5px solid var(--text-sub);
  border-radius: 2px;
  padding: 1px;
  position: relative;
}
.battery-shell::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 2px;
  width: 2px;
  height: 4px;
  background: var(--text-sub);
  border-radius: 0 1px 1px 0;
}
.battery-fill {
  width: 100%;
  height: 100%;
  background: var(--accent-emerald);
  border-radius: 1px;
}

/* ================= PLAYFUL STICKERS & KAOMOJIS ================= */
.floating-stickers-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.sticker {
  position: absolute;
  pointer-events: none;
  cursor: grab;
  user-select: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.12));
  transition: transform 0.2s var(--trans-spring), filter 0.2s ease;
}

.sticker:hover {
  transform: scale(1.1) rotate(0deg) !important;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

/* New sticker animation classes */
.sticker-emoji { font-size: 2rem; line-height: 1; }
.float-animation { animation: float 6s ease-in-out infinite; }
@keyframes float { 0% { transform: translateY(0); } 50% { transform: translateY(-8px); } 100% { transform: translateY(0); } }
.spin-animation { animation: spin 20s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.pulse-animation:hover { animation: pulse 0.8s ease-in-out infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

/* Nametag "Hello My Name Is" */
.nametag-sticker {
  width: 130px;
  background: white;
  border-radius: var(--radius-sm);
  border: 2px solid #ef4444;
  overflow: hidden;
  text-align: center;
}
.nametag-top {
  background: #ef4444;
  color: white;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  padding: 2px 0 0 0;
}
.nametag-sub {
  background: #ef4444;
  color: white;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: 4px;
}
.nametag-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  padding: 8px 4px;
  font-style: italic;
}

/* Kaomojis */
.kaomoji-bubble {
  background: white;
  border: 2px solid var(--text-dark);
  border-radius: var(--radius-full);
  padding: 4px 14px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* Rubber Stamps */
.rubber-stamp {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  border: 2.5px dashed;
  text-transform: uppercase;
}

.green-stamp {
  color: #059669;
  border-color: #059669;
  background: rgba(16, 185, 129, 0.1);
}

.blue-stamp {
  color: #0284c7;
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
}

.purple-stamp {
  color: #7c3aed;
  border-color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
}

/* ================= DESKTOP STAGE ================= */
.desktop-stage {
  max-width: 1560px;
  margin: 0 auto;
  padding: 24px 28px 60px 28px;
  position: relative;
  z-index: 20;
}

/* Hero Fun Headline */
.hero-fun-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  padding: 10px 0;
}

.fun-pill-badge {
  display: inline-flex;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  background: #fef3c7;
  border: 1.5px solid #f59e0b;
  color: #92400e;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.fun-headline {
  font-family: var(--font-serif);
  font-size: 3.2rem;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}

.fun-gradient-text {
  font-family: var(--font-main);
  font-weight: 800;
  font-style: normal;
  font-size: 2.6rem;
  background: linear-gradient(135deg, #0284c7 0%, #10b981 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  letter-spacing: -0.04em;
}

.fun-subhead {
  font-size: 0.95rem;
  color: var(--text-sub);
  margin-top: 6px;
  max-width: 680px;
}

.hero-actions {
  display: flex;
  gap: 12px;
}

/* Glossy 3D Skeuomorphic Buttons */
.btn-fun-hero {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: all var(--trans-spring);
  overflow: hidden;
}

.cure-gun-cta {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: white;
}
.cure-gun-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.report-cta {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: var(--text-dark);
}
.report-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.btn-fun-hero:active {
  transform: translateY(1px) scale(0.98);
}

.btn-shine {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

/* ================= RETRO SEGMENTED TABS ================= */
.retro-tabs-bar {
  display: flex;
  gap: 6px;
  background: rgba(220, 219, 215, 0.75);
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
}

.retro-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--text-sub);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.retro-tab:hover {
  color: var(--text-dark);
  background: rgba(255, 255, 255, 0.4);
}

.retro-tab.active {
  background: white;
  color: var(--text-dark);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.tab-chip {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  padding: 2px 8px;
  color: var(--text-muted);
}
.retro-tab.active .tab-chip {
  background: #e0f2fe;
  color: #0284c7;
}

/* ================= TWO COLUMN GRID ================= */
.fun-two-col {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 22px;
}

@media (max-width: 1100px) {
  .fun-two-col {
    grid-template-columns: 1fr;
  }
}

/* ================= RETRO MAC WINDOW COMPONENT ================= */
.retro-window {
  background: var(--win-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--win-border);
  box-shadow: var(--win-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: transform 0.2s var(--trans-spring), box-shadow 0.2s ease;
}

.retro-window:hover {
  box-shadow: 0 24px 50px -10px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.retro-window.compact {
  margin-bottom: 16px;
}

.retro-window.fun-hero-card {
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 18px 45px -8px rgba(0, 180, 216, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Window Titlebar with Traffic Lights */
.window-titlebar {
  height: 38px;
  background: linear-gradient(180deg, var(--win-bar-top) 0%, var(--win-bar-bot) 100%);
  border-bottom: 1px solid var(--win-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  user-select: none;
}

.window-traffic-lights {
  display: flex;
  align-items: center;
  gap: 7px;
}

.traffic-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.25);
  border: 0.5px solid rgba(0,0,0,0.18);
  cursor: pointer;
  transition: filter 0.15s ease;
}
.traffic-dot:hover { filter: brightness(0.9); }
.dot-close { background-color: #ff5f56; }
.dot-min { background-color: #ffbd2e; }
.dot-zoom { background-color: #27c93f; }

.window-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.win-btn {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: var(--radius-xs);
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: all var(--trans-fast);
}

.win-btn:hover {
  background: #f8fafc;
}

.win-btn.active {
  background: #0284c7;
  color: white;
  border-color: #0284c7;
}

.win-btn.highlight {
  background: #10b981;
  color: white;
  border-color: #059669;
}

.window-body {
  padding: 16px;
  background: var(--win-bg);
}

.window-bottom-bar {
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.window-caption-foot {
  padding: 6px 14px;
  background: #f1f5f9;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: right;
}

/* ================= VIEWPORT BOX & ACTINIC LIGHT BEAM ================= */
.viewport-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #090d16;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#cavity-canvas, #postop-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: crosshair;
}

/* Actinic 470nm Blue Light-Curing Gun Overlay */
.actinic-light-beam {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
  background: radial-gradient(circle at 50% 50%, rgba(0, 240, 255, 0.8) 0%, rgba(2, 132, 199, 0.6) 45%, rgba(0, 10, 40, 0.7) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.actinic-light-beam.firing {
  opacity: 1;
  visibility: visible;
  animation: actinicPulse 0.4s infinite alternate;
}

@keyframes actinicPulse {
  0% { filter: brightness(1.0) saturate(1.2); }
  100% { filter: brightness(1.4) saturate(1.8); }
}

.cure-countdown-hud {
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid var(--laser-blue);
  box-shadow: 0 0 35px var(--laser-blue);
  border-radius: var(--radius-lg);
  padding: 20px 30px;
  text-align: center;
  color: white;
  max-width: 380px;
}

.cure-laser-icon {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--laser-blue);
  letter-spacing: 0.08em;
}

.cure-timer-text {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 0 20px var(--laser-blue);
  margin: 6px 0;
}

.cure-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.cure-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00f0ff, #38bdf8);
  box-shadow: 0 0 10px #00f0ff;
  transition: width 0.1s linear;
}

.cure-subtext {
  font-size: 0.72rem;
  color: #94a3b8;
}

/* Floating HUD Pill */
.floating-hud-pill {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  font-size: 0.75rem;
  color: var(--text-dark);
}
.floating-hud-pill strong { color: #0284c7; }

/* Tool Selector Bar */
.tool-selector-pill {
  display: flex;
  gap: 6px;
}

.tool-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.tool-chip:hover {
  background: #f1f5f9;
  color: var(--text-dark);
}

.tool-chip.active {
  background: #0284c7;
  color: white;
  border-color: #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.live-telemetry {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-sub);
}
.highlight-cyan { color: #0284c7; font-weight: 700; }
.highlight-emerald { color: #059669; font-weight: 700; }
.highlight-amber { color: #d97706; font-weight: 700; }
.highlight-pink { color: #db2777; font-weight: 700; }
.live-telemetry .sep { margin: 0 6px; color: #cbd5e1; }

/* ================= CASE SELECTOR GRID ================= */
.case-grid-fun {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.case-card-fun {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all var(--trans-spring);
}

.case-card-fun:hover {
  background: white;
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.case-card-fun.active {
  background: #f0f9ff;
  border-color: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

.case-badge-user {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 6px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 4px;
  margin-bottom: 4px;
}

.case-badge-bench {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 6px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 4px;
  margin-bottom: 4px;
}

.case-card-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
}

.case-card-detail {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Fun Dropzone */
.fun-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  position: relative;
  transition: all var(--trans-fast);
}

.fun-dropzone:hover {
  border-color: var(--accent-cyan);
  background: #f0f9ff;
}

.drop-emoji { font-size: 1.4rem; display: block; margin-bottom: 2px; }
.drop-main-txt { font-size: 0.78rem; font-weight: 600; color: var(--text-dark); }
.sparkle-link { color: #0284c7; text-decoration: underline; font-weight: 700; }
.drop-sub-txt { font-size: 0.68rem; color: var(--text-muted); display: block; }
.file-input-hidden { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Fields */
.section-microtag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.fun-field {
  margin-bottom: 12px;
}

.fun-field label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 4px;
}

.field-split-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.fun-badge-val {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #0284c7;
}

.fun-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.fun-input-group input {
  width: 100%;
  padding: 8px 36px 8px 12px;
  background: white;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  outline: none;
}

.fun-input-group input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.fun-unit {
  position: absolute;
  right: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  pointer-events: none;
}

.fun-select {
  width: 100%;
  padding: 8px 12px;
  background: white;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-xs);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  outline: none;
}

/* Metrics Grid */
.fun-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.fun-metric-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.fun-metric-box.volume-box {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.fun-metric-box.cfactor-box {
  background: #fffbeb;
  border-color: #fde68a;
}

.f-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
}

.f-val-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 2px;
}

.f-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-dark);
}

.f-val.glow-text {
  color: #059669;
}

.f-unit {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.badge-ai-pulsing {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  color: #059669;
  background: #d1fae5;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  animation: pulseDot 1.6s infinite;
}

.btn-fun-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  color: white;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  position: relative;
  overflow: hidden;
  transition: all var(--trans-spring);
}

.btn-fun-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.4);
}

.btn-fun-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: white;
  color: var(--text-dark);
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: all var(--trans-fast);
}

.btn-fun-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-block { width: 100%; }

/* ================= THREE.JS & 3D LEGENDS ================= */
.fun-legend-box {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.legend-hdr {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 4px;
}

.legend-color-strip {
  width: 170px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #0284c7, #10b981, #f59e0b, #e11d48);
  margin-bottom: 4px;
}

.legend-numbers {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

.slice-slider-fun {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
}

.slice-emoji { font-size: 1.1rem; }
.nav-hint-txt { font-size: 0.7rem; color: var(--text-muted); }

.chart-canvas-wrap {
  background: #0f172a;
  border-radius: var(--radius-xs);
  padding: 6px;
  margin-bottom: 8px;
}

.profile-key-strip {
  display: flex;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--text-sub);
}
.profile-key-strip span { display: flex; align-items: center; gap: 4px; }
.profile-key-strip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-enamel { background: #e2e8f0; }
.dot-dentin { background: #b45309; }
.dot-comp { background: #00f0ff; }

.fun-spec-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.78rem;
}

.spec-k { color: var(--text-sub); font-weight: 600; }
.spec-v { font-family: var(--font-mono); font-weight: 700; }

.fun-callout-sticker {
  margin-top: 10px;
  padding: 8px 12px;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  font-size: 0.72rem;
  color: #92400e;
}

/* ================= TOOTH SCHEMATIC & EXTRUSION ================= */
.layering-playground {
  padding: 16px;
}

.fun-tooth-schematic {
  display: flex;
  height: 160px;
  background: #0f172a;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid #334155;
  margin-bottom: 14px;
}

.fun-cusp {
  width: 25%;
  background: linear-gradient(180deg, #f8fafc 0%, #cbd5e1 50%, #94a3b8 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
}
.cusp-left { border-top-left-radius: 40px; }
.cusp-right { border-top-right-radius: 40px; }

.cusp-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: #475569;
  font-weight: 700;
}

.fun-cavity-well {
  flex: 1;
  background: #451a03;
  display: flex;
  flex-direction: column-reverse;
  padding: 4px;
  gap: 3px;
  box-shadow: inset 0 -20px 30px rgba(0, 0, 0, 0.7);
}

.extrusion-playground-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.ext-title { font-size: 0.8rem; font-weight: 700; color: var(--text-dark); display: block; }
.ext-sub { font-size: 0.7rem; color: var(--text-muted); }

.btn-extrude-clicky {
  padding: 8px 16px;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  color: white;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.3);
  transition: all var(--trans-fast);
}

.btn-extrude-clicky:active {
  transform: scale(0.95);
  filter: brightness(1.2);
}

.layers-table-card {
  overflow-x: auto;
}

.fun-layers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.fun-layers-table th {
  background: #f1f5f9;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1.5px solid #e2e8f0;
  color: var(--text-sub);
}

.fun-layers-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
}

.fun-layers-table td:nth-child(3),
.fun-layers-table td:nth-child(4),
.fun-layers-table td:nth-child(5) {
  font-family: var(--font-mono);
  font-weight: 600;
}

.badge-tag-fun {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 10px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: var(--radius-full);
}

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

.hardware-item {
  display: flex;
  flex-direction: column;
}

.h-label { font-size: 0.65rem; color: var(--text-muted); }
.h-val { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; color: var(--text-dark); }

/* Material Fun Card */
.material-fun-card {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 8px;
}

.mat-category-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  color: #0284c7;
  text-transform: uppercase;
}

.mat-big-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.mat-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.mat-stat {
  display: flex;
  flex-direction: column;
}
.ms-lbl { font-size: 0.65rem; color: var(--text-muted); }
.ms-val { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; color: var(--text-dark); }

/* Formula Breakdown */
.formula-breakdown-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.8rem;
}

.f-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-sub);
}

.f-line strong { font-family: var(--font-mono); }

.f-line.highlight-target {
  padding-top: 6px;
  border-top: 1px dashed #cbd5e1;
  font-weight: 700;
  color: var(--text-dark);
}

.f-line.highlight-mass {
  font-weight: 800;
  font-size: 0.88rem;
}

.fun-cfactor-alert {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-xs);
  margin-bottom: 12px;
  font-size: 0.72rem;
  color: #92400e;
}

.alert-emoji { font-size: 1.1rem; flex-shrink: 0; }

/* ================= CLOSED LOOP VALIDATION ================= */
.fun-deviation-hud {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.7rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.d-chip { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-dark); }
.d-dot { width: 9px; height: 9px; border-radius: 50%; }
.d-green { background: #10b981; }
.d-blue { background: #0284c7; }
.d-red { background: #ef4444; }

.postop-upload-fun {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
}

.badge-status-optimal {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.waste-fun-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 12px;
}

.wb-hdr {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.wb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  margin-bottom: 6px;
}

.wb-title { width: 130px; color: var(--text-sub); }

.wb-track {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.wb-fill { height: 100%; border-radius: 4px; }
.fill-bad { background: #ef4444; }
.fill-good { background: #10b981; }

.wb-val { font-family: var(--font-mono); font-weight: 700; width: 50px; text-align: right; }

.wb-trophy-banner {
  margin-top: 8px;
  padding: 8px 12px;
  background: #ecfdf5;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

/* ================= CLINICAL DOSSIER PAPER ================= */
.report-desktop-frame {
  max-width: 960px;
  margin: 0 auto;
}

.dossier-paper {
  background: #ffffff;
  padding: 40px;
  color: #0f172a;
}

.dossier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #0284c7;
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.dossier-logo {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 800;
  color: #0284c7;
}

.dossier-branding h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: #0f172a;
}

.official-seal {
  border: 3px double #059669;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 0.75rem;
  color: #059669;
  border-radius: 8px;
  transform: rotate(-6deg);
}

.dossier-meta-bar {
  display: flex;
  justify-content: space-between;
  background: #f8fafc;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  border: 1px solid #e2e8f0;
  margin-bottom: 20px;
}

.dossier-section {
  margin-bottom: 20px;
}

.dossier-section h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #0284c7;
  text-transform: uppercase;
  margin-bottom: 8px;
}

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

.d-cell {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.78rem;
}

.d-cell span { display: block; font-size: 0.68rem; color: var(--text-muted); }
.highlight-blue { color: #0284c7; font-weight: 800; }
.highlight-pink { color: #db2777; font-weight: 800; }

.dossier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.dossier-table th { background: #f1f5f9; padding: 6px 10px; text-align: left; border: 1px solid #cbd5e1; }
.dossier-table td { padding: 6px 10px; border: 1px solid #e2e8f0; }

.dossier-footer {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid #cbd5e1;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

/* ================= TAB PANEL SHOW / HIDE ================= */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Print Styles */
@media print {
  body { background: white; }
  .mac-menubar, .floating-stickers-layer, .hero-fun-banner, .retro-tabs-bar { display: none !important; }
  .tab-content { display: none !important; }
  #tab-report { display: block !important; }
  .window-titlebar { display: none !important; }
  .retro-window { box-shadow: none; border: none; }
  .dossier-paper { padding: 0; }
}

/* ==========================================================================
   v2 ADDITIONS — guided placement, closed-loop states, toasts, dossier, responsive
   ========================================================================== */

button.lofi-player { font-family: var(--font-main); }
.lofi-player.active { background: #e0f2fe; border-color: #7dd3fc; color: #0369a1; }

.status-pill.busy .live-dot { background: var(--accent-amber); }

input, select, textarea, .dossier-paper, .dossier-paper * { -webkit-user-select: text; user-select: text; }

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

.field-note {
  margin-top: 6px;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.spec-v.muted { color: var(--text-muted); font-weight: 600; font-size: 0.72rem; }
.f-val.f-val-sm { font-size: 1rem; }

/* ---------- Drag & drop ---------- */
.drop-hint {
  position: absolute;
  inset: 12px;
  border: 2px dashed var(--laser-blue);
  border-radius: var(--radius-md);
  background: rgba(0, 180, 216, 0.15);
  color: white;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--trans-fast);
  z-index: 50;
}
.drag-over .drop-hint { opacity: 1; }
.fun-dropzone.drag-over { border-color: var(--accent-cyan); background: #e0f2fe; }

#cavity-canvas { touch-action: none; }

/* ---------- Empty viewport state ---------- */
.viewport-empty {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  color: #e2e8f0;
  background: rgba(9, 13, 22, 0.78);
  font-size: 0.82rem;
  z-index: 10;
}
.viewport-empty.show { display: flex; }
#three-container > .viewport-empty { display: flex; }
.viewport-empty span:last-child { max-width: 340px; color: #94a3b8; }
.fun-deviation-hud.hidden { display: none; }

/* ---------- Layering schematic ---------- */
.fun-tooth-schematic { position: relative; height: 200px; }

.layer-bar {
  --fill: 100%;
  --layer-color: #0284c7;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  padding: 0 10px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  color: white;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  transition: background 0.2s ease;
}
.layer-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--fill);
  background: var(--layer-color);
  transition: width 0.08s linear;
}
.layer-bar > span { position: relative; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-bar.pending { color: rgba(255, 255, 255, 0.55); }
.layer-bar.pending::before { width: 0; }
.layer-bar.current { border: 1.5px solid #fde68a; box-shadow: 0 0 12px rgba(253, 230, 138, 0.45); }
.layer-bar.cured { border-style: solid; border-color: rgba(255, 255, 255, 0.35); }

.fun-tooth-schematic .cure-countdown-hud { padding: 10px 26px; }
.fun-tooth-schematic .cure-timer-text { font-size: 2.1rem; margin: 2px 0; }

.layer-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

.fun-layers-table tr.row-current td { background: #fffbeb; }
.fun-layers-table tr.row-cured td { color: var(--text-muted); }

/* ---------- Guided placement ---------- */
.guided-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.guided-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.guided-progress { display: flex; align-items: center; gap: 10px; }
.guided-progress-track { flex: 1; height: 10px; border-radius: 5px; background: #e2e8f0; overflow: hidden; }
.guided-progress-fill { height: 100%; width: 0; border-radius: 5px; background: var(--accent-blue); transition: width 0.08s linear, background 0.2s; }
.guided-progress-fill.ok { background: var(--accent-emerald); }
.guided-progress-fill.over { background: var(--accent-amber); }
.guided-progress-label { font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700; min-width: 120px; text-align: right; }
.guided-actions { display: flex; gap: 8px; }
.guided-actions button { flex: 1; }
.btn-extrude-clicky { touch-action: none; }

.btn-cure {
  padding: 8px 16px;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: white;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.3);
}
.btn-cure:disabled, .btn-extrude-clicky:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
}

/* ---------- Material comparison ---------- */
.compare-body { padding: 10px 12px 12px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.74rem; }
.compare-table th { text-align: left; padding: 5px 6px; color: var(--text-muted); font-weight: 700; border-bottom: 1.5px solid #e2e8f0; }
.compare-table td { padding: 6px; border-bottom: 1px solid #f1f5f9; font-family: var(--font-mono); font-weight: 600; }
.compare-table td:first-child { font-family: var(--font-main); font-weight: 700; }
.compare-table tbody tr { cursor: pointer; transition: background var(--trans-fast); }
.compare-table tbody tr:hover { background: #f8fafc; }
.compare-table tbody tr.selected { background: #e0f2fe; }
.best-tag {
  font-size: 0.58rem;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: #d1fae5;
  color: #065f46;
  font-family: var(--font-mono);
}

/* ---------- Closed-loop status ---------- */
.badge-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid;
}
.status-optimal { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.status-underfill, .status-mixed { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.status-flash { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.status-pending { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

.fill-flash { background: #0284c7; }
.wb-val { width: 72px; }
.wb-trophy-banner:empty { display: none; }

.calib-actions { display: flex; gap: 8px; margin-top: 12px; }
.calib-actions .btn-fun-secondary { flex: 1; }
.k-history-hdr { margin-top: 14px; }
.k-history { font-size: 0.72rem; color: var(--text-muted); }
.k-row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #f1f5f9; font-family: var(--font-mono); color: var(--text-sub); }

/* ---------- Toasts ---------- */
.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}
.toast {
  max-width: 360px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  border-left: 4px solid var(--accent-cyan);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { border-left-color: var(--accent-emerald); }
.toast-warn { border-left-color: var(--accent-amber); }
.toast-error { border-left-color: #ef4444; }

/* ---------- Dossier ---------- */
.dossier-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 40px 0;
  background: var(--win-bg);
}
.dossier-fields .fun-field { margin-bottom: 0; }
.fun-text {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.82rem;
  background: white;
  color: var(--text-dark);
}
.fun-text:focus { outline: none; border-color: var(--accent-blue); }

.dossier-meta-bar { flex-wrap: wrap; gap: 6px 18px; }

.dossier-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.dossier-figures figure { margin: 0; background: #0f172a; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid #e2e8f0; }
.dossier-figures figure.hidden { display: none; }
.dossier-figures img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.dossier-figures figcaption { padding: 6px 10px; font-size: 0.68rem; color: var(--text-sub); background: #f8fafc; }

.official-seal.seal-optimal { color: #059669; border-color: #059669; }
.official-seal.seal-underfill, .official-seal.seal-mixed { color: #dc2626; border-color: #dc2626; }
.official-seal.seal-flash { color: #1d4ed8; border-color: #1d4ed8; }
.official-seal.seal-pending { color: #64748b; border-color: #94a3b8; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .menubar-nav, .menubar-center { display: none; }
}

@media (max-width: 760px) {
  .desktop-stage { padding: 16px 16px 48px; }
  .hero-fun-banner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .fun-headline { font-size: 2.4rem; }
  .fun-gradient-text { font-size: 2rem; }
  .retro-tabs-bar { overflow-x: auto; }
  .retro-tab { flex: 0 0 auto; }
  .tab-chip { display: none; }
  .window-titlebar { height: auto; min-height: 38px; flex-wrap: wrap; gap: 6px; padding: 6px 12px; }
  .window-bottom-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .tool-selector-pill { flex-wrap: wrap; }
  .hardware-bar { grid-template-columns: 1fr; }
  .dossier-fields { grid-template-columns: 1fr; padding: 14px 16px 0; }
  .dossier-paper { padding: 20px 16px; }
  .dossier-grid, .dossier-figures { grid-template-columns: 1fr; }
  .mac-clock, .status-pill { display: none; }
}

@media print {
  .dossier-fields, .toast-host, .window-actions { display: none !important; }
  .dossier-figures figure { break-inside: avoid; }
  .dossier-section { break-inside: avoid; }
}

label.fun-dropzone { display: block; margin-top: 12px; }
label.postop-upload-fun { cursor: pointer; }
.fun-two-col { align-items: start; }
#profile-canvas { display: block; width: 100%; }
.legend-numbers { gap: 12px; }
.legend-color-strip { width: 230px; }
.fun-metric-box.span-2 { grid-column: span 2; }
.dossier-figures figure { background: #f1f5f9; }
.wb-trophy-banner.tone-bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.wb-trophy-banner.tone-warn { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.wb-trophy-banner.tone-neutral { background: #f8fafc; border-color: #e2e8f0; color: var(--text-sub); }
.fun-layers-table td:nth-child(3), .fun-layers-table td:nth-child(4),
.fun-layers-table td:nth-child(5), .fun-layers-table td:nth-child(6) { white-space: nowrap; }
