/* 
========================================================================
THINK LAB - UNIVERSAL GOLD STANDARD 4.0 CSS ENGINE
========================================================================
This replaces the 96-headed monster of inline <style> blocks.
*/

:root {
  /* Core Base */
  --bg: #F5F3FF; /* LLOS Lavender per Design Bible Rule 1 */
  --card: #FFFFFF;
  --bdr: #E2E8F0;
  
  /* Typography */
  --text: #1E293B;
  --text-light: #64748B;
  --font-body: 'Nunito', sans-serif;
  --font-display: 'Baloo 2', cursive;
  
  /* Divisions */
  --logic: #0EA5E9;
  --spatial: #A855F7;
  --pattern: #22C55E;
  --systems: #6366F1;
  --numbers: #F59E0B;
}

/* 1. ARCHITECTURE - 100dvh Zero-Scroll Lock */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100dvh; max-height: 100dvh; width: 100vw; max-width: 100vw;
  overflow: hidden; overscroll-behavior: none; touch-action: none;
  font-family: var(--font-body); background: var(--bg); color: var(--text);
  font-size: 16px; 
}
.unselectable { -webkit-user-select: none; user-select: none; }

/* 2. THE HEADER (Standardized) */
.thinklab-header { 
  flex-shrink: 0; height: 60px; display: flex; justify-content: space-between; 
  align-items: center; padding: 0 16px; background: var(--card); 
  border-bottom: 1.5px solid var(--bdr); z-index: 60; 
}
.header-btn {
  background: var(--bg); border: 1.5px solid var(--bdr); color: var(--text-light);
  width: 40px; height: 40px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 1.2rem; 
  cursor: pointer; text-decoration: none; transition: all 0.2s;
}
.header-btn:hover { background: var(--bdr); color: var(--text); }
.header-title {
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.score-display { 
  font-family: var(--font-display); font-size: 0.9rem; color: var(--text-light); 
  background: var(--bdr); padding: 6px 14px; border-radius: 16px; 
  min-width: 60px; text-align: center; font-weight: 700; 
}

/* 3. PROGRESS BAR */
.progress-track { flex-shrink: 0; width: 100%; height: 8px; background: var(--bdr); }
.progress-fill { height: 100%; width: 0%; background: var(--logic); transition: width 0.3s ease; }

/* 4. HYBRID DESKTOP/MOBILE HERO SCALING */
.hybrid-content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.puzzle-area {
  flex: 1; min-height: 0; display: flex; flex-direction: column; 
  align-items: center; justify-content: flex-start; padding: 16px; gap: 16px; overflow: hidden;
}

/* 5. INTERACTION LOCK STATE (The Click-Rage Fix) */
body[data-state="evaluating"] .opt-btn,
body[data-state="evaluating"] .draggable {
  pointer-events: none;
  opacity: 0.6;
  filter: grayscale(30%);
  transform: scale(0.98);
  transition: all 0.2s ease;
}

/* 6. STANDARDIZED NATIVE BOTTOM SHEET */
.bottom-sheet { 
  max-width: 600px; margin: 0 auto; 
  position: absolute; bottom: 0; left: 0; right: 0;
  transform: translateY(110%); opacity: 0; pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease; 
  background: #FFFBEB; 
  border-top-left-radius: 32px; border-top-right-radius: 32px; 
  box-shadow: 0 -10px 40px rgba(0,0,0,0.15); 
  display: flex; flex-direction: column; z-index: 1000;
  max-height: 75dvh; 
}
.bottom-sheet.active { transform: translateY(0); opacity: 1; pointer-events: all; }
.bs-container { padding: 24px 24px 30px; display: flex; flex-direction: column; max-height: 100%; }
.bs-scroll { overflow-y: auto; flex-shrink: 1; overscroll-behavior: contain; scrollbar-width: none; }
.bs-scroll::-webkit-scrollbar { display: none; }

/* Desktop Flex Injection */
@media (min-width: 768px) {
  .hybrid-content { flex-direction: row; }
  .puzzle-area { flex: 1.5; justify-content: center; height: 100%; gap: 52px; padding-bottom: 80px; }
  .bottom-sheet { transform: translateY(20px) scale(0.95); top: 50%; left: 50%; bottom: auto; right: auto; margin-left: -250px; margin-top: -200px; width: 500px; border-radius: 28px; }
  .bottom-sheet.active { transform: translateY(0) scale(1); }
}
