/* Capacity & Volume Lab - Stylesheet */
:root {
  --navy: #0f2b48;
  --water-blue: #0284c7;
  --water-light: #38bdf8;
  --cyan: #06b6d4;
  --amber: #f59e0b;
  --emerald: #10b981;
  --coral: #ef4444;
  --bg: #f0fdf4;
  --surface: #ffffff;
  --line: #e2e8f0;
  --muted: #64748b;
  --text: #1e293b;
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Lexend', system-ui, sans-serif;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow: 0 10px 25px -5px rgba(2, 132, 199, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: var(--surface);
  border-bottom: 2px solid var(--line);
  padding: 0.8rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.back-link {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f9;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  transition: all 0.2s;
}
.back-link:hover { color: var(--navy); background: #e2e8f0; }
.logo-icon {
  font-size: 2rem;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand h1 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
}
.subtitle {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Header Stats */
.header-stats {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.stat-pill {
  background: #f1f5f9;
  border: 1px solid var(--line);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stat-label { color: var(--muted); font-weight: 600; }
.stat-val { color: var(--navy); font-weight: 800; }
.ctrl-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}
.ctrl-btn:hover { background: #f8fafc; border-color: var(--muted); }

/* Main Container */
.main-container {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.2rem;
  width: 100%;
  flex: 1;
}

/* Mode Navigation Tabs */
.mode-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  background: #e2e8f0;
  padding: 0.35rem;
  border-radius: 16px;
  overflow-x: auto;
}
.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  border: none;
  background: transparent;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mode-tab:hover { color: var(--navy); }
.mode-tab.active {
  background: var(--surface);
  color: var(--water-blue);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Views */
.game-view { display: none; }
.game-view.active { display: block; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.view-intro {
  margin-bottom: 1.5rem;
}
.view-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--water-blue);
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}
.view-intro h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--navy);
}
.view-intro p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* VIEW 1: LAB WORKSPACE */
.lab-workspace {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) {
  .lab-workspace { grid-template-columns: 1fr; }
}

.beaker-stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.beaker-container {
  width: 100%;
  max-width: 300px;
  height: 380px;
  display: flex;
  justify-content: center;
}
#liquid-rect {
  transition: height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), y 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#liquid-meniscus {
  transition: cy 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pouring-controls {
  width: 100%;
  margin-top: 1.5rem;
}
.ctrl-subhead {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.tap-buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}
.pour-btn {
  background: #f0f9ff;
  border: 2px solid #bae6fd;
  color: #0369a1;
  border-radius: 10px;
  padding: 0.75rem 0.5rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}
.pour-btn:hover { background: #e0f2fe; border-color: #0284c7; }
.pour-btn:active { transform: translateY(2px); }

.secondary-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 0.6rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.secondary-btn:hover { background: #e2e8f0; color: var(--navy); }

/* Mission Card */
.capacity-mission-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.capacity-gauge-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.gauge-label { font-size: 0.8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.gauge-huge-val {
  font-family: var(--font-display);
  font-size: 4.2rem;
  font-weight: 800;
  color: var(--water-blue);
  line-height: 1.1;
  margin: 0.4rem 0;
}
.unit-sym { font-size: 2.2rem; color: var(--muted); }
.conversion-pills { display: flex; gap: 0.5rem; justify-content: center; }
.conv-pill {
  background: #f1f5f9;
  border: 1px solid var(--line);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
}

.target-challenge-box {
  background: var(--surface);
  border: 2px solid var(--amber);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow);
}
.target-title { font-size: 0.82rem; font-weight: 800; color: #b45309; text-transform: uppercase; }
#target-volume-text { font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; color: var(--navy); margin: 0.5rem 0 0.3rem; }
#target-clue { font-size: 0.88rem; color: var(--muted); margin-bottom: 1.2rem; }
.action-btn {
  background: var(--navy);
  color: #fff;
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn:hover { background: var(--water-blue); }
.target-feedback { margin-top: 0.8rem; font-size: 0.95rem; font-weight: 700; min-height: 24px; }

/* VIEW 2: DISPLACEMENT */
.displacement-arena {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 800px) {
  .displacement-arena { grid-template-columns: 1fr; }
}
.tank-visual-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  box-shadow: var(--shadow);
}
.tank-controls-col { display: flex; flex-direction: column; gap: 1.2rem; }
.eureka-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.eureka-card h3 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; color: var(--navy); margin-bottom: 0.3rem; }
.rule-math { font-size: 0.9rem; color: var(--water-blue); font-weight: 700; margin-bottom: 0.8rem; }
.tank-stats-row { display: flex; justify-content: space-between; font-size: 0.95rem; }

.objects-picker-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.objects-picker-card h4 { font-size: 0.9rem; font-weight: 800; color: var(--navy); margin-bottom: 0.8rem; }
.objects-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
.obj-btn {
  background: #f8fafc;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.4rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.obj-btn:hover { border-color: var(--water-blue); }
.obj-btn.active { background: #e0f2fe; border-color: var(--water-blue); }
.obj-icon { font-size: 2rem; display: block; }
.obj-name { font-size: 0.75rem; font-weight: 700; color: var(--navy); margin-top: 0.3rem; display: block; }

.displacement-math-card {
  background: #eff6ff;
  border: 2px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}
.calc-label { font-size: 0.8rem; font-weight: 800; color: #1e40af; text-transform: uppercase; }
.calc-huge-val { font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; color: #1e3a8a; margin: 0.3rem 0; }
#eureka-desc { font-size: 0.88rem; color: #3b82f6; }

/* VIEW 3: DUEL */
.duel-wrap { max-width: 720px; margin: 0 auto; }
.duel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow);
}
.duel-header { display: flex; justify-content: space-between; margin-bottom: 1.2rem; }
.duel-badge { font-size: 0.8rem; font-weight: 800; color: var(--water-blue); background: #e0f2fe; padding: 0.25rem 0.7rem; border-radius: 999px; }
.duel-score { font-size: 0.88rem; font-weight: 700; color: var(--amber); }
.duel-question { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--navy); margin-bottom: 1.8rem; line-height: 1.35; }
.duel-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
@media (max-width: 600px) { .duel-options { grid-template-columns: 1fr; } }
.duel-btn {
  background: #f8fafc;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 800;
  color: var(--navy);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.duel-btn:hover { background: #f1f5f9; border-color: var(--navy); }
.duel-btn.correct { background: #ecfdf5; border-color: #10b981; color: #047857; }
.duel-btn.wrong { background: #fef2f2; border-color: #ef4444; color: #b91c1c; }
.duel-feedback { text-align: center; font-size: 1.05rem; font-weight: 700; margin-top: 1.2rem; min-height: 28px; }
