:root {
  --bg-primary: #0a0f1d;
  --bg-surface: #131d35;
  --bg-card: #1c294a;
  --bg-card-hover: #24345d;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.2);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.2);
  --accent-rose: #ef4444;
  --border-subtle: #2d3d68;
  --border-focus: #38bdf8;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Top Bar */
.app-header {
  background: rgba(19, 29, 53, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-info span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.btn-pill:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

/* Nav Tabs */
.nav-tabs {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.tabs-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  padding: 0 1rem;
}

.tab-btn {
  padding: 0.9rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  min-height: 44px;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

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

.view-section {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Score Dial Hero */
.score-hero-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  text-align: center;
}

.score-dial {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-emerald) calc(var(--score-pct, 45) * 1%), #223254 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 1rem;
  box-shadow: 0 0 25px var(--accent-emerald-glow);
}

.score-dial-inner {
  width: 130px;
  height: 130px;
  background: var(--bg-surface);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-size: 2.3rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #ffffff;
  line-height: 1;
}

.score-denom {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.2rem;
}

.score-status-badge {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 0.5rem;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Leaky Bucket Highlights */
.leak-item {
  background: var(--bg-card);
  border-left: 4px solid var(--accent-rose);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.leak-info h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.leak-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.leak-stat {
  text-align: right;
}

.leak-stat .mark-loss {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-rose);
}

.leak-stat .accuracy {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* CBT Question Interface */
.cbt-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
}

@media (max-width: 860px) {
  .cbt-container {
    grid-template-columns: 1fr;
  }
}

.cbt-screen {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cbt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.85rem;
}

.subject-badge {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
}

.cbt-timer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.1);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
}

.cbt-question-text {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.6;
  color: #ffffff;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  color: var(--text-main);
  text-align: left;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 48px;
}

.option-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.option-btn.selected {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
}

.option-btn.correct {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.15);
}

.option-btn.wrong {
  border-color: var(--accent-rose);
  background: rgba(239, 68, 68, 0.15);
}

.option-badge {
  width: 28px;
  height: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Socratic Coach Sidepanel */
.coach-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 620px;
}

.coach-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.coach-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.coach-chat-area {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.chat-bubble {
  max-width: 88%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-line;
}

.chat-bubble.coach {
  background: var(--bg-card);
  align-self: flex-start;
  border: 1px solid var(--border-subtle);
}

.chat-bubble.student {
  background: #2563eb;
  color: #ffffff;
  align-self: flex-end;
}

.coach-input-row {
  padding: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 0.5rem;
}

.coach-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}

.coach-input:focus {
  border-color: var(--accent-cyan);
}

/* WhatsApp Phone Mockup Simulator */
.whatsapp-simulator {
  max-width: 440px;
  margin: 0 auto;
  border: 12px solid #1e293b;
  border-radius: 36px;
  background: #0b141a;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  height: 680px;
  display: flex;
  flex-direction: column;
}

.wa-top-bar {
  background: #202c33;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid #2a3942;
}

.wa-avatar {
  width: 38px;
  height: 38px;
  background: #00a884;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
}

.wa-contact-info h3 {
  font-size: 0.95rem;
  color: #e9edef;
}

.wa-contact-info p {
  font-size: 0.72rem;
  color: #8696a0;
}

.wa-chat-canvas {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background-image: radial-gradient(#182229 1px, transparent 1px);
  background-size: 16px 16px;
}

.wa-msg {
  max-width: 82%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.83rem;
  line-height: 1.45;
  white-space: pre-line;
  word-break: break-word;
}

.wa-msg.bot {
  background: #202c33;
  color: #d1d7db;
  align-self: flex-start;
  border-top-left-radius: 0;
}

.wa-msg.user {
  background: #005c4b;
  color: #e9edef;
  align-self: flex-end;
  border-top-right-radius: 0;
}

.wa-input-row {
  background: #202c33;
  padding: 0.65rem;
  display: flex;
  gap: 0.5rem;
}

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.pricing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.pricing-card.featured {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 25px var(--accent-cyan-glow);
}

.pricing-tag {
  position: absolute;
  top: -12px;
  right: 20px;
  background: var(--accent-cyan);
  color: #000;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.price-amount {
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffffff;
  margin: 0.75rem 0;
}

.price-amount span {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pricing-features {
  list-style: none;
  margin: 1.25rem 0 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.pricing-features li {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pricing-features li.check {
  color: var(--text-main);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom)) 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  margin: auto 0;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Auth & Profile Styles */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.75rem 0.25rem 0.4rem;
  font-size: 0.82rem;
  color: var(--text-main);
  cursor: pointer;
}

.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  color: white;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

/* Exam Subject Filter Pills */
.subject-filter-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  scrollbar-width: none;
}
.subject-filter-bar::-webkit-scrollbar { display: none; }

.filter-pill {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-pill:hover, .filter-pill.active {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--accent-cyan);
}

/* Form Styles */
.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.85rem;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-cyan);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Voice Button */
.btn-speech {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.4rem;
  opacity: 0.85;
}
.btn-speech:hover { opacity: 1; text-decoration: underline; }

/* Countdown Banner */
.countdown-banner {
  background: linear-gradient(90deg, #1e1b4b, #172554, #083344);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  text-align: center;
  color: #bae6fd;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Question Navigator Grid */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.palette-btn {
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.palette-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.palette-btn.current {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
  color: #ffffff;
}

.palette-btn.answered {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

.palette-btn.flagged::after {
  content: "🚩";
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 0.65rem;
}

/* Calculator Modal & Styling */
.calculator-box {
  background: #111827;
  border: 2px solid #374151;
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.calc-display {
  background: #030712;
  border: 1px solid #1f2937;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: #38bdf8;
  font-family: monospace;
  font-size: 1.5rem;
  text-align: right;
  margin-bottom: 0.85rem;
  overflow: hidden;
  white-space: nowrap;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.calc-btn {
  height: 44px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: var(--radius-sm);
  color: #f3f4f6;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
}

.calc-btn:hover { background: #374151; }
.calc-btn:active { transform: scale(0.96); }

.calc-btn.operator {
  background: #0284c7;
  color: #ffffff;
}
.calc-btn.operator:hover { background: #0369a1; }

.calc-btn.clear {
  background: #dc2626;
  color: #ffffff;
}

/* Leaderboard Table */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.leaderboard-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-table td {
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.rank-badge {
  display: inline-flex;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}
.rank-1 { background: #fbbf24; color: #000; }
.rank-2 { background: #94a3b8; color: #000; }
.rank-3 { background: #d97706; color: #fff; }

/* Mistake Vault Cards */
.vault-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--accent-amber);
}

.vault-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.4rem;
}

.vault-trap-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px dashed var(--accent-amber);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: #fde68a;
  margin: 0.6rem 0;
}

/* Print Styling */
@media print {
  .app-header, .nav-tabs, .countdown-banner, .btn-pill, .modal-overlay { display: none !important; }
  body { background: #ffffff !important; color: #000000 !important; }
  .card { border: 1px solid #000 !important; box-shadow: none !important; background: transparent !important; }
}

/* Topic Focus Navigation Bar */
.topic-focus-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.topic-focus-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}
.topic-focus-pills::-webkit-scrollbar {
  height: 4px;
}
.topic-focus-pills::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}
.topic-pill {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.topic-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}
.topic-pill.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(59, 130, 246, 0.35));
  border-color: #3b82f6;
  color: #60a5fa;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}
.topic-pill .count-badge {
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  color: var(--text-muted);
}
.topic-pill.active .count-badge {
  background: rgba(59, 130, 246, 0.4);
  color: #ffffff;
}

/* ==========================================================================
   VIDEO LECTURE & EDUCATIONAL VISUAL SCHEMATICS
   ========================================================================== */
.lesson-tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}
.lesson-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.lesson-tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}
.lesson-tab-btn.active {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  border-bottom: 2px solid var(--accent-cyan);
}

.video-player-container {
  background: #070b14;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.video-screen-mock {
  position: relative;
  background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
  aspect-ratio: 16 / 9;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.video-screen-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.video-center-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.video-play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #ffffff;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.video-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 28px rgba(14, 165, 233, 0.6);
}
.video-waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 28px;
}
.waveform-bar {
  width: 4px;
  background: var(--accent-cyan);
  border-radius: 2px;
  animation: soundwave 1.2s ease-in-out infinite alternate;
}
.waveform-bar:nth-child(2) { animation-delay: 0.15s; }
.waveform-bar:nth-child(3) { animation-delay: 0.3s; }
.waveform-bar:nth-child(4) { animation-delay: 0.45s; }
.waveform-bar:nth-child(5) { animation-delay: 0.6s; }
.waveform-bar:nth-child(6) { animation-delay: 0.75s; }
.waveform-bar:nth-child(7) { animation-delay: 0.9s; }
.waveform-bar:nth-child(8) { animation-delay: 1.05s; }

@keyframes soundwave {
  0% { height: 6px; opacity: 0.4; }
  100% { height: 26px; opacity: 1; }
}

.video-progress-bar-wrap {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  height: 6px;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.video-progress-filled {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
  width: 35%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.video-controls-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #0b111e;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.video-speed-pill {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
}
.video-speed-pill.active {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

.video-mode-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}
.video-mode-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #ffffff;
}
.video-mode-btn.active {
  background: var(--accent-cyan);
  color: #030712;
  border-color: var(--accent-cyan);
  font-weight: 700;
}

.video-chapters-container {
  padding: 0.85rem 1rem;
  background: #090e18;
  border-top: 1px solid var(--border-subtle);
}
.video-chapter-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.35rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.8rem;
  color: #cbd5e1;
  transition: all 0.2s;
}
.video-chapter-pill:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.3);
  color: #ffffff;
}
.video-chapter-pill.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Video Module Tabs */
.video-module-tabs {
  display: flex;
  background: #040810;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
}
.video-module-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.video-module-btn .mod-num {
  font-weight: 800;
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
.video-module-btn:hover {
  background: rgba(56, 189, 248, 0.1);
  color: #ffffff;
}
.video-module-btn.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}
.video-module-btn.active .mod-num {
  background: var(--accent-cyan);
  color: #030712;
}

/* Synchronized Note Cards */
.synced-note-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.synced-note-card:hover {
  border-color: var(--accent-cyan);
  background: rgba(15, 23, 42, 0.95);
  transform: translateY(-1px);
}
.synced-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}
.synced-note-time {
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  font-weight: 700;
}
.synced-note-title {
  font-weight: 700;
  color: #ffffff;
  font-size: 0.8rem;
}
.synced-note-content {
  color: #cbd5e1;
  font-size: 0.75rem;
  line-height: 1.45;
}

/* In-Video Retention Pop-Quiz */
.retention-q-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}
.retention-option-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #e2e8f0;
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
  margin-top: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.retention-option-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
}
.retention-option-btn.correct {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: #10b981 !important;
  color: #34d399 !important;
  font-weight: 700;
}
.retention-option-btn.incorrect {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: #ef4444 !important;
  color: #f87171 !important;
}

/* Floating Mini-Player (Picture-in-Picture Mode) */
.video-player-container.floating-pip {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 400px;
  max-width: 92vw;
  z-index: 9999;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.85), 0 0 0 2px rgba(56, 189, 248, 0.5);
  border-radius: var(--radius-md);
  overflow: hidden;
  animation: floatIn 0.25s ease-out;
}
@keyframes floatIn {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Visual Diagram Card */
.lesson-diagram-card {
  background: #080d1a;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}
.diagram-svg-wrap {
  width: 100%;
  overflow-x: auto;
  text-align: center;
  padding: 0.5rem 0;
}
.diagram-svg-wrap svg {
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}
.diagram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.75rem;
  font-size: 0.75rem;
}
.diagram-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-dim);
}
.diagram-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Key Terms & Vocabulary Cards */
.key-term-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.key-term-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}
.key-term-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.2rem;
}
.key-term-def {
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.45;
}

/* Worked Examples Card */
.worked-example-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-left: 4px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  padding: 0.95rem;
  margin-bottom: 0.75rem;
}
.worked-example-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
}
.worked-example-solution {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-subtle);
  font-size: 0.85rem;
  color: #a7f3d0;
  line-height: 1.5;
}

/* ==========================================================================
   CBT SUBJECT NAVIGATION TABS (20 QUESTIONS PER SUBJECT)
   ========================================================================== */
.cbt-subject-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  margin-bottom: 0.85rem;
}
.cbt-subject-tab {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.cbt-subject-tab:hover {
  background: var(--bg-card-hover);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--text-main);
}
.cbt-subject-tab.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(6, 182, 212, 0.2));
  border-color: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
  font-weight: 700;
}
.cbt-subject-tab .badge-count {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}
.cbt-subject-tab.active .badge-count {
  background: var(--accent-cyan);
  color: #000;
  font-weight: 800;
}
.cbt-subject-tab.completed {
  border-color: rgba(16, 185, 129, 0.5);
}
.cbt-subject-tab.completed .badge-count {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

/* ==========================================================================
   CANDIDATE SETTINGS & LOCKED IDENTITY BADGING
   ========================================================================== */
.locked-identity-card {
  background: linear-gradient(135deg, #0b1329 0%, #0d1b38 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
.locked-identity-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #38bdf8, #10b981);
}
.locked-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}
.locked-field-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.locked-field-val {
  font-family: monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
}

.preference-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.preference-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.preference-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: -0.2rem;
  line-height: 1.4;
}
.preference-pills-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.pref-pill-btn {
  flex: 1;
  min-width: 60px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.pref-pill-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: rgba(56, 189, 248, 0.4);
}
.pref-pill-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* ==========================================================================
   PassMaster AI Mobile Responsive Ergonomics (< 768px and < 480px)
   ========================================================================== */
@media (max-width: 768px) {
  .app-header {
    padding: max(6px, env(safe-area-inset-top)) 0 6px 0;
  }

  .header-container {
    padding: 0 12px;
    gap: 8px;
  }

  .brand-logo {
    font-size: 1.4rem;
  }

  .brand-info h1 {
    font-size: 1rem;
  }

  .brand-info span {
    font-size: 0.65rem;
  }

  .header-actions {
    gap: 4px;
  }

  .btn-pill {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    min-height: 36px;
  }

  .countdown-banner {
    padding: 6px 10px;
    font-size: 0.75rem;
    gap: 4px;
    text-align: center;
  }

  .countdown-banner .hide-mobile {
    display: none;
  }

  .tabs-container {
    padding: 4px 10px;
    gap: 4px;
  }

  .tab-btn {
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    min-height: 40px;
  }

  .main-content {
    padding: 12px 10px;
  }

  .card {
    padding: 1rem;
  }

  /* CBT Layout on Mobile */
  .cbt-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .cbt-screen {
    padding: 1rem;
    gap: 1rem;
  }

  .cbt-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .cbt-timer {
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
  }

  .cbt-question-text {
    font-size: 1rem;
    line-height: 1.5;
  }

  .option-btn {
    padding: 0.85rem;
    font-size: 0.9rem;
    min-height: 46px;
  }

  .cbt-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .cbt-actions button {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-input, select.form-input {
    font-size: 16px !important; /* Prevent iOS auto-zoom */
    min-height: 44px;
  }

  /* Modals on Phone */
  .modal-box {
    padding: 1.15rem;
    width: 100%;
    border-radius: 14px;
  }

  /* Mistake Vault & Leaky Topic Grids */
  .leak-grid,
  .vault-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header-actions .btn-pill:not(.btn-primary):not(.mobile-menu-trigger) span:not(:first-child) {
    display: none; /* Icon-only for secondary pills on extra-narrow phones */
  }

  .header-actions .btn-pill {
    padding: 0.4rem;
  }

  .brand-info span {
    display: none;
  }

  .calc-grid {
    gap: 0.35rem;
  }

  .calc-btn {
    height: 40px;
    font-size: 0.9rem;
  }
}

/* ==========================================================================
   PHONE DEVICE AUTO-ADAPTATION & MOBILE BOTTOM DOCK ENGINE
   ========================================================================== */

/* Mobile Navigation Dock */
.mobile-bottom-dock {
  display: none;
}

.mobile-menu-trigger {
  display: none;
}

.mobile-cbt-bottom-bar {
  display: none;
}

.coach-mobile-drawer {
  display: none;
}

.mobile-sheet-overlay {
  display: none;
}

.show-mobile {
  display: none;
}

/* When phone is detected via JS classes */
.is-phone .show-mobile,
body.phone-device .show-mobile {
  display: inline-block;
}

.is-phone .mobile-menu-trigger,
body.phone-device .mobile-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  padding: 0.4rem 0.65rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-cyan);
}

.is-phone .mobile-bottom-dock,
body.phone-device .mobile-bottom-dock {
  display: flex;
}

@media (max-width: 768px) {
  .show-mobile {
    display: inline-block;
  }

  .mobile-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    padding: 0.4rem 0.65rem;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: var(--accent-cyan);
  }

  .mobile-bottom-dock {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(9, 14, 26, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 9980;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  }

  .mobile-dock-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 5px 2px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 48px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-dock-btn .dock-icon {
    font-size: 1.2rem;
    line-height: 1.2;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .mobile-dock-btn .dock-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    margin-top: 2px;
  }

  .mobile-dock-btn.active {
    color: var(--accent-cyan);
  }

  .mobile-dock-btn.active .dock-icon {
    transform: translateY(-2px) scale(1.15);
  }

  .main-content {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* CBT Sticky Bottom Navigation Bar on Phones */
  .mobile-cbt-bottom-bar {
    display: flex;
    position: sticky;
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding: 8px 10px;
    background: rgba(13, 21, 39, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    z-index: 100;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
  }

  .mobile-cbt-bottom-bar .btn-pill {
    flex: 1;
    justify-content: center;
    padding: 0.6rem 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    min-height: 44px;
  }

  .btn-coach-peek {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(56, 189, 248, 0.15));
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    position: relative;
  }

  .coach-dot-pulse {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    margin-left: 4px;
    animation: coachPulse 1.5s infinite;
  }

  @keyframes coachPulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8); }
    70% { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
  }

  /* Horizontal Scrolling Tool Ribbons on Phones */
  .subject-filter-bar {
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 2px 6px 2px;
    gap: 6px;
  }

  .subject-filter-bar::-webkit-scrollbar {
    display: none;
  }

  .subject-filter-bar .filter-pill {
    flex-shrink: 0;
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
  }

  .cbt-tools-ribbon {
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 2px 6px 2px;
    gap: 6px;
    width: 100%;
  }

  .cbt-tools-ribbon::-webkit-scrollbar {
    display: none;
  }

  .cbt-tools-ribbon .btn-pill {
    flex-shrink: 0;
  }

  /* Question Options on Mobile */
  .options-list {
    gap: 0.65rem;
  }

  .option-btn {
    padding: 0.85rem 0.95rem;
    font-size: 0.95rem;
    min-height: 52px;
    border-radius: 12px;
    line-height: 1.4;
  }

  .option-badge {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    border-radius: 8px;
  }

  /* Question Navigator Grid on Mobile */
  .palette-collapse-container {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    margin-top: 1rem;
    border: 1px solid var(--border-subtle);
  }

  .palette-grid {
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    gap: 0.35rem;
    max-height: 220px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px;
  }

  .palette-grid.collapsed {
    display: none;
  }

  .palette-btn {
    height: 38px;
    font-size: 0.85rem;
    border-radius: 8px;
  }

  /* Socratic Coach Kalu Mobile Drawer */
  .coach-mobile-drawer {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 72vh;
    background: #0b1329;
    border-top: 2px solid var(--accent-cyan);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
    z-index: 9995;
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
    flex-direction: column;
  }

  .coach-mobile-drawer.active {
    transform: translateY(0);
  }

  /* Mobile More Slide-Up Menu Sheet */
  .mobile-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  .mobile-sheet-overlay.active {
    display: flex;
    opacity: 1;
  }

  .mobile-sheet-card {
    width: 100%;
    max-height: 82vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #0d1527;
    border-top: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 22px 22px 0 0;
    padding: 1rem 1.15rem calc(1.25rem + env(safe-area-inset-bottom, 0px)) 1.15rem;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
  }

  .mobile-sheet-overlay.active .mobile-sheet-card {
    transform: translateY(0);
  }

  .sheet-drag-handle {
    width: 42px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 0 auto 10px auto;
  }

  .sheet-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 0.85rem;
  }

  .sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #f8fafc;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 70px;
  }

  .sheet-item:active {
    transform: scale(0.96);
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.35);
  }

  .sheet-icon {
    font-size: 1.35rem;
    margin-bottom: 4px;
  }

  .sheet-label {
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    color: #e2e8f0;
  }

  /* Form Elements on Phone: Ensure no auto-zoom on iOS */
  input, select, textarea, .form-input, .coach-input {
    font-size: 16px !important;
  }

  /* Modals on Mobile: full mobile bottom sheet style */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 1.25rem 1.15rem calc(1.5rem + env(safe-area-inset-bottom, 0px)) 1.15rem !important;
  }

  /* Admission Calculator & Topic Masterclasses on Phone */
  .aggregate-stat-card {
    padding: 0.75rem;
  }

  .flashcards-grid {
    grid-template-columns: 1fr;
  }

  .flashcard-container {
    min-height: 240px;
  }
}

/* ========================================================
   FEATURE SUITE 2.0: FLASHCARDS, NOVEL COMPANION, ADMISSION CALCULATOR
   ======================================================== */

/* Formula Flashcards & 3D Flip */
.flashcards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.flashcard-container {
  perspective: 1000px;
  min-height: 280px;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: left;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  cursor: pointer;
}

.flashcard-container.is-flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.flashcard-front {
  background: linear-gradient(145deg, #16223e 0%, #0e172a 100%);
}

.flashcard-back {
  background: linear-gradient(145deg, #0f1c38 0%, #091326 100%);
  transform: rotateY(180deg);
  overflow-y: auto;
}

.flashcard-formula-box {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: #38bdf8;
  text-align: center;
  margin: 0.85rem 0;
  letter-spacing: 0.5px;
}

.flashcard-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

/* Novel Companion Cards & Accordions */
.novel-chapter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 0.85rem;
  transition: all 0.2s ease;
}

.novel-chapter-card:hover {
  border-color: var(--border-focus);
}

.novel-character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.novel-character-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Admission Calculator Gauge & Meter */
.prob-meter-bar {
  width: 100%;
  height: 18px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-subtle);
}

.prob-meter-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s ease-in-out;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.aggregate-stat-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

/* Audio Voice Buttons */
.btn-audio-speak {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  cursor: pointer;
  border-radius: var(--radius-full);
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.btn-audio-speak:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
}

/* Print Stylesheet for 1-Page Cram Sheet */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-header,
  .nav-tabs,
  .countdown-banner,
  .app-footer,
  .btn-pill,
  .modal-close,
  .cbt-actions,
  #cbtAntiCheatBanner {
    display: none !important;
  }
  .modal-overlay {
    position: static !important;
    background: transparent !important;
  }
  .modal-box {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    color: #000000 !important;
    background: #ffffff !important;
  }
  .cram-sheet-print-container {
    color: #000000 !important;
    background: #ffffff !important;
  }
}
