/* =========================================================
   GATE CSE PYQ ONLINE TEST PORTAL DESIGN SYSTEM
   Modern Dark/Light Web Portal + Preserved TCS iON Test Engine
   ========================================================= */

:root {
  /* Modern Web Application Theme (Default Dark Slate/Midnight) */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.85);
  --bg-card-hover: rgba(51, 65, 85, 0.95);
  --border-color: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(99, 102, 241, 0.4);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-indigo: #6366f1;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --shadow-glow: 0 10px 30px -10px rgba(99, 102, 241, 0.3);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);

  /* Official TCS iON Exam Simulator Colors (Subject Test & Full Mock Test Only) */
  --tcs-bg-header: #0e668b;
  --tcs-bg-tab-active: #0073b7;
  --tcs-bg-tab-inactive: #eef2f6;
  --tcs-bg-subbar: #fafafa;
  --tcs-border: #d0d7de;
  --tcs-text-main: #222222;
  --tcs-sidebar-bg: #f4f8fb;
  --tcs-blue-btn: #0073b7;
  --tcs-submit-btn: #4ba6c6;

  --st-ans-bg: #4caf50;
  --st-not-ans-bg: #d9534f;
  --st-not-visited-bg: #e0e0e0;
  --st-marked-bg: #8e44ad;
  --st-ans-marked-bg: #8e44ad;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-accent: rgba(99, 102, 241, 0.25);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --shadow-glow: 0 10px 30px -10px rgba(99, 102, 241, 0.15);
  --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* =========================================================
   MODERN APPLICATION NAVBAR & DASHBOARD
   ========================================================= */

.app-navbar {
  height: 64px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  text-decoration: none;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.brand-badge {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-indigo);
  border: 1px solid var(--border-accent);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-calc-trigger {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
  transition: all 0.2s ease;
}

.btn-calc-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
}

.btn-theme-toggle {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
  background: var(--bg-card-hover);
}

/* Dashboard Container */
.dashboard-container {
  max-width: 1320px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* =========================================================
   MASTER DASHBOARD HERO & COMMAND CENTER (MASTER-TIER UI)
   ========================================================= */

.master-hero-section {
  background: radial-gradient(circle at 12% 20%, rgba(99, 102, 241, 0.22) 0%, transparent 45%),
              radial-gradient(circle at 88% 65%, rgba(6, 182, 212, 0.18) 0%, transparent 50%),
              radial-gradient(circle at 50% 100%, rgba(168, 85, 247, 0.12) 0%, transparent 60%),
              linear-gradient(135deg, rgba(20, 26, 43, 0.95), rgba(13, 17, 28, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 2.5rem 2.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.15);
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 2.5rem;
  align-items: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.master-hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.8), rgba(6, 182, 212, 0.8), transparent);
}

.hero-top-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.hero-sparkle {
  color: var(--accent-amber);
  animation: pulse 1.5s infinite;
}

.hero-year-pill {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  color: #ffffff;
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 800;
}

.master-hero-title {
  font-size: 2.4rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero-gradient-text {
  background: linear-gradient(135deg, #a5b4fc 0%, #38bdf8 50%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.master-hero-desc {
  font-size: 1rem;
  color: #94a3b8;
  line-height: 1.65;
  margin-bottom: 1.75rem;
  max-width: 640px;
}

.master-hero-desc strong {
  color: #e2e8f0;
}

.hero-cta-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.hero-btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  color: #ffffff;
  border: none;
  padding: 0.85rem 1.6rem;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.6);
  filter: brightness(1.08);
}

.hero-btn-primary .btn-arrow {
  transition: transform 0.2s ease;
}

.hero-btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}

.hero-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0.85rem 1.4rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.hero-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  transform: translateY(-2px);
}

/* Integrated Momentum Card */
.hero-momentum-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.momentum-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.momentum-user-info {
  flex: 1;
}

.momentum-user-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.momentum-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.momentum-target-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.15rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.35rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-accent);
}

.master-stats-grid .stat-card {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(26, 34, 54, 0.6), rgba(15, 23, 42, 0.7));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.master-stats-grid .stat-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 16px rgba(99, 102, 241, 0.2);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-lbl {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.section-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
}

/* Master Mode Cards Grid */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.master-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.75rem;
}

.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.master-mode-card {
  background: linear-gradient(180deg, rgba(26, 34, 54, 0.75) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  padding: 1.75rem;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}

.master-mode-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, var(--accent-indigo));
  opacity: 0.7;
  transition: opacity 0.3s ease, height 0.3s ease;
}

.master-mode-card:hover {
  transform: translateY(-6px);
  border-color: var(--card-accent, var(--accent-indigo));
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6), 0 0 30px color-mix(in srgb, var(--card-accent, var(--accent-indigo)) 25%, transparent);
}

.master-mode-card:hover::before {
  opacity: 1;
  height: 4px;
}

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

.mode-tag-free {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-badge-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.mode-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1.25rem;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-indigo);
}

.mode-name {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.mode-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.mode-feature-chips {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.mode-feature-chips span {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.mode-action {
  font-weight: 800;
  color: var(--accent-indigo);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mode-card:hover .mode-action {
  gap: 0.65rem;
}

/* Fast-Track Subject Explorer Launchpad */
.subject-explorer-section {
  margin-bottom: 3rem;
}

.subject-fast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
}

.subject-fast-card {
  background: linear-gradient(135deg, rgba(26, 34, 54, 0.5), rgba(15, 23, 42, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.subject-fast-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-cyan);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(15, 23, 42, 0.85));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3), 0 0 16px rgba(6, 182, 212, 0.2);
}

.subject-fast-icon {
  font-size: 1.5rem;
  margin-bottom: 0.2rem;
}

.subject-fast-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.subject-fast-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
}

@media (max-width: 992px) {
  .master-hero-section {
    grid-template-columns: 1fr;
    padding: 2rem;
  }
}

/* Modal Windows */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 90%;
  max-width: 580px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  color: var(--text-main);
}

.modal-header {
  background: rgba(30, 41, 59, 0.9);
  color: var(--text-main);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.modal-body {
  padding: 1.75rem;
}

.select-group {
  margin-bottom: 1.25rem;
}

.select-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}

.custom-select, .custom-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.custom-select:focus, .custom-input:focus {
  border-color: var(--accent-indigo);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo), #4f46e5);
  color: #fff;
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

/* =========================================================
   MODERN INTERACTIVE PRACTICE & QUIZ ENGINE VIEW
   Single Question View + Scientific Calculator + Option Keypad
   ========================================================= */

/* =========================================================
   RESUME PRACTICE SESSION BANNER
   ========================================================= */

.resume-session-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(99, 102, 241, 0.12));
  border: 1px solid rgba(6, 182, 212, 0.4);
  border-radius: 14px;
  padding: 1rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.15);
  animation: fadeIn 0.3s ease;
}

.resume-banner-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.resume-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.resume-banner-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  flex-wrap: wrap;
}

.resume-topic-pill {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.resume-banner-subtitle {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.resume-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.resume-btn-action {
  padding: 0.55rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.resume-btn-dismiss {
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-color: var(--border-color);
}

.modal-resume-callout {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* =========================================================
   MODERN INTERACTIVE PRACTICE & QUIZ ENGINE VIEW
   Clean Focused Layout: Sleek Top Header + Single Q + Topic HUD
   ========================================================= */

.practice-workspace {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Sleek Practice Header */
.practice-sleek-header {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 0.9rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
}

.practice-header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.btn-back-dashboard {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-back-dashboard:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  color: var(--text-main);
}

.practice-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  font-weight: 700;
}

.breadcrumb-mode {
  color: var(--accent-emerald);
  font-weight: 800;
}

.breadcrumb-sep {
  color: var(--text-muted);
  opacity: 0.5;
}

.breadcrumb-subj {
  color: var(--accent-cyan);
}

.breadcrumb-topic {
  color: var(--text-main);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.practice-progress-pill {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.28);
  color: var(--accent-indigo);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 800;
}

.practice-header-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.practice-stopwatch-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 0.45rem 1rem;
  border-radius: 24px;
  font-family: monospace, monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-indigo);
  letter-spacing: 0.05em;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.stopwatch-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 1.5s infinite;
}

.practice-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-header-calc {
  background: #0f172a;
  color: #38bdf8;
  border: 1.5px solid #0284c7;
  padding: 0.5rem 1.05rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 0 14px rgba(2, 132, 199, 0.28);
  transition: all 0.2s ease;
}

.btn-header-calc:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(2, 132, 199, 0.45);
}

.btn-header-calc svg {
  stroke: currentColor;
  stroke-width: 2.2;
}

.btn-header-fullscreen {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.95rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

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

.header-kbd {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: inherit;
  font-weight: 600;
}

.btn-header-scratch {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.95rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

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

.btn-header-finish {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  padding: 0.5rem 1.1rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.btn-header-finish:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

/* Unified Exam Main Body Layout */
.modern-quiz-layout {
  display: flex;
  gap: 0;
  align-items: stretch;
  flex: 1;
  overflow: hidden;
}

.modern-q-card {
  flex: 1;
  background: var(--bg-card);
  border: none;
  border-right: 1px solid var(--border-color);
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.q-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.q-title-text {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.q-badge-group {
  display: flex;
  gap: 0.4rem;
}

.q-badge {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-indigo);
  border: 1px solid var(--border-accent);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.q-body-content {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}

.q-body-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin: 1rem 0;
  background: #fff;
  padding: 0.5rem;
}

/* Option Cards for Modern Quiz */
.modern-options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.modern-opt-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.modern-opt-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

.modern-opt-card.selected {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--accent-indigo);
}

.modern-opt-card.correct-highlight {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3) !important;
}

.modern-opt-card.correct-highlight .opt-badge {
  background: #10b981 !important;
  color: #ffffff !important;
}

.modern-opt-card.wrong-highlight {
  background: rgba(244, 63, 94, 0.22) !important;
  border-color: #f43f5e !important;
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.3) !important;
}

.modern-opt-card.wrong-highlight .opt-badge {
  background: #f43f5e !important;
  color: #ffffff !important;
}

.modern-opt-card.revealed-correct {
  background: rgba(16, 185, 129, 0.12) !important;
  border: 2px dashed #10b981 !important;
}

.modern-opt-card.revealed-correct .opt-badge {
  background: #10b981 !important;
  color: #ffffff !important;
}

.opt-badge {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.modern-opt-card.selected .opt-badge {
  background: var(--accent-indigo);
  color: #ffffff;
}

.opt-feedback-pill {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.opt-feedback-correct {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.opt-feedback-wrong {
  background: rgba(244, 63, 94, 0.25);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.opt-feedback-key {
  background: rgba(6, 182, 212, 0.25);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.4);
}

/* Quiz Controls Bar */
.modern-quiz-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.modern-ans-box {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-emerald);
  color: var(--accent-emerald);
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  margin-top: 1.25rem;
  font-weight: 700;
}

/* =========================================================
   RIGHT SIDE: ACTIVE TOPIC FOCUS & CHAPTER HUD
   Replaces the useless question palette with rich chapter HUD
   ========================================================= */

.practice-topic-hud {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.hud-card {
  background: var(--bg-card);
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  padding: 1rem;
  box-shadow: none;
}

.hud-card-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.hud-subject-badge {
  display: inline-block;
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.hud-topic-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 1.1rem;
}

.hud-progress-section {
  margin-bottom: 1rem;
}

.hud-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.hud-progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.hud-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
  border-radius: 6px;
  transition: width 0.35s ease;
}

.hud-mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.hud-stat-box {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 0.45rem 0.2rem;
}

.hud-stat-num {
  font-size: 1.05rem;
  font-weight: 800;
  display: block;
}

.hud-stat-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Quick Calculator Card in HUD */
.hud-calc-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.08), rgba(234, 88, 12, 0.04));
  border-color: rgba(249, 115, 22, 0.25);
}

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

.hud-calc-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(249, 115, 22, 0.18);
  color: #f97316;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.btn-hud-calc {
  width: 100%;
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.35);
  color: #f97316;
  padding: 0.6rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-hud-calc:hover {
  background: #f97316;
  color: #fff;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

/* Chapters in Subject List */
.hud-topics-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.hud-topic-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.hud-topic-chip:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.hud-topic-chip.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}

.hud-chip-count {
  font-size: 0.75rem;
  background: var(--bg-card);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  flex-shrink: 0;
}

.hud-topic-chip.active .hud-chip-count {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.2);
}

/* =========================================================
   PRACTICE MODE: CHAPTER SWITCHER, TOPICS EXPLORER & QUESTION PALETTE
   ========================================================= */

.practice-chapters-box {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.practice-chapter-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.practice-chapter-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.practice-chapter-btn.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}

.practice-chapter-count {
  font-size: 0.74rem;
  background: var(--bg-card);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  flex-shrink: 0;
}

.practice-chapter-btn.active .practice-chapter-count {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.2);
}

/* Chapter Topics Pill Cloud */
.chapter-topics-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
  max-height: 140px;
  overflow-y: auto;
  padding: 0.2rem 0;
}

.chapter-topic-pill {
  font-size: 0.76rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--accent-indigo);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.chapter-topic-pill.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Question Palette for Practice Mode */
.practice-palette-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.practice-pal-legend {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.pal-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.practice-pal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 0.45rem;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 4px;
}

.practice-pal-btn {
  height: 36px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-muted);
  transition: all 0.15s ease;
  position: relative;
}

.practice-pal-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
  transform: translateY(-1px);
}

.practice-pal-btn.active {
  border: 2px solid var(--accent-cyan) !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4) !important;
  background: rgba(6, 182, 212, 0.25) !important;
}

.practice-pal-btn.pal-correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #34d399 !important;
}

.practice-pal-btn.pal-wrong {
  background: rgba(244, 63, 94, 0.2) !important;
  border-color: #f43f5e !important;
  color: #fb7185 !important;
}

.practice-pal-btn.pal-skipped {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
}

.practice-pal-btn.pal-visited {
  border-color: rgba(99, 102, 241, 0.4);
  color: var(--text-main);
}

/* Dynamic Action Button Transition */
.btn-submit-converted-next {
  background: linear-gradient(135deg, #0284c7, #2563eb) !important;
  box-shadow: 0 0 16px rgba(2, 132, 199, 0.45) !important;
  font-weight: 800 !important;
  animation: pulseButton 2s infinite ease-in-out;
}

@keyframes pulseButton {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* =========================================================
   DETAILED ANALYZER & MARKS DISTRIBUTION STYLING
   ========================================================= */

.weak-advisor-card {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.12), rgba(15, 23, 42, 0.85));
  border: 1.5px solid rgba(244, 63, 94, 0.35);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 24px rgba(244, 63, 94, 0.15);
}

.weak-advisor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.weak-advisor-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fb7185;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-anki-drill-cta {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.4);
  transition: all 0.2s ease;
}

.btn-anki-drill-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(244, 63, 94, 0.6);
}

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

.weak-topic-pill-card {
  background: var(--bg-card);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.weak-topic-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.weak-topic-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Marks Distribution Tabs & Tables */
.marks-dist-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
}

.marks-dist-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  flex-wrap: wrap;
}

.marks-tab-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.marks-tab-btn:hover {
  color: var(--text-main);
  border-color: var(--accent-cyan);
}

.marks-tab-btn.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.marks-dist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.marks-dist-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.marks-dist-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.marks-dist-bar-track {
  width: 120px;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
}

.marks-dist-bar-fill {
  height: 100%;
  border-radius: 4px;
}

/* =========================================================
   OFFICIAL TCS iON GATE TEST TAKING INTERFACE (IMAGE EXACT MATCH)
   Preserved 100% for Subject Wise Test & Full GATE Mock Test
   ========================================================= */

.tcs-interface {
  position: fixed;
  inset: 0;
  background: #fff;
  color: #111111 !important;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  font-family: Arial, sans-serif;
}

/* Force dark text on all standard reading surfaces inside TCS */
.tcs-interface * {
  box-sizing: border-box;
}

/* Top Header Bar */
.tcs-top-bar {
  height: 38px;
  background: #0e668b;
  color: #fff !important;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 700;
}

.tcs-top-bar * {
  color: #fff !important;
}

.tcs-top-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tcs-info-icon {
  background: rgba(255, 255, 255, 0.2);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.tcs-top-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.tcs-calc-btn-header {
  background: #0284c7;
  color: #ffffff !important;
  border: 1px solid #38bdf8;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.tcs-calc-btn-header:hover {
  background: #0369a1;
  border-color: #7dd3fc;
}

.tcs-calc-btn-header svg {
  stroke: #ffffff;
  stroke-width: 2.2;
}

/* Section Tabs Sub-Header */
.tcs-sections-bar {
  background: #f0f4f8;
  border-bottom: 1px solid #dcdcdc;
  padding: 0.5rem 1rem 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tcs-tabs-list {
  display: flex;
  gap: 0.5rem;
}

.tcs-tab {
  background: #fff;
  border: 1px solid #ccc;
  border-bottom: none;
  padding: 0.4rem 1rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: #0073b7 !important;
  cursor: pointer;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tcs-tab.active {
  background: #0073b7;
  color: #fff !important;
  border-color: #0073b7;
}

.tcs-tab.active * {
  color: #fff !important;
}

.tcs-time-left {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111111 !important;
}

/* Question Info Sub-Bar */
.tcs-q-subbar {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 0.4rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #111111 !important;
}

.tcs-q-type-lbl { font-weight: 700; color: #111111 !important; }
.tcs-q-marks-lbl { color: #444444 !important; }

/* Main Split View */
.tcs-main-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: #ffffff;
}

/* Left Question Panel */
.tcs-question-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  background: #ffffff !important;
  color: #111111 !important;
  border-right: 1px solid #d0d7de;
}

.tcs-q-number {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: #111111 !important;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.5rem;
}

.tcs-q-text {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  color: #111111 !important;
}

.tcs-q-text * {
  color: #111111 !important;
}

.tcs-q-text img {
  max-width: 100%;
  height: auto;
  border: 1px solid #ccc;
  margin: 0.75rem 0;
  border-radius: 4px;
}

/* MCQ Radio & MSQ Checkbox Options */
.tcs-mcq-options {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.75rem;
}

#optionsContainer,
#optionsContainer * {
  color: #111111 !important;
}

.tcs-mcq-item, .tcs-msq-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 1.05rem;
  color: #111111 !important;
  cursor: pointer;
  user-select: none;
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  transition: all 0.15s ease;
}

.tcs-mcq-item:hover, .tcs-msq-item:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.tcs-mcq-item.selected, .tcs-msq-item.selected {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
}

.tcs-mcq-item *, .tcs-msq-item * {
  color: #111111 !important;
}

.tcs-mcq-radio, .tcs-msq-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #0073b7;
}

.tcs-opt-letter {
  font-weight: 700;
  font-size: 1.05rem;
  color: #0073b7 !important;
  min-width: 28px;
  flex-shrink: 0;
}

.tcs-opt-content {
  color: #111111 !important;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.55;
  flex: 1;
}

.tcs-opt-content * {
  color: #111111 !important;
}

/* MathJax dark color enforcement in TCS interface */
.tcs-interface mjx-container,
.tcs-interface mjx-container *,
.tcs-interface .MathJax,
.tcs-interface .MathJax *,
.tcs-interface svg,
.tcs-interface svg *,
.tcs-interface mjx-c,
.tcs-interface mjx-utext {
  color: #111111 !important;
  fill: #111111 !important;
}

/* NAT Official Keypad Layout (Image 2 Match) */
.tcs-nat-box {
  margin-top: 1rem;
  color: #111111 !important;
}

.tcs-nat-box * {
  color: #111111 !important;
}

.tcs-nat-display {
  width: 220px;
  height: 34px;
  border: 1px solid #999;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0 0.5rem;
  text-align: right;
  margin-bottom: 0.75rem;
  background: #fff;
  outline: none;
}

.tcs-nat-keypad {
  width: 160px;
  border: 1px solid #b2b2b2;
  background: #e6e6e6;
  padding: 6px;
  border-radius: 6px;
}

.tcs-nat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.tcs-nat-btn {
  height: 34px;
  background: #fff;
  border: 1px solid #888;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tcs-nat-btn:hover { background: #e2e8f0; }

.tcs-nat-btn-wide {
  grid-column: span 3;
  background: #f0f0f0;
  height: 32px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Right Candidate & Palette Sidebar */
.tcs-sidebar {
  width: 320px;
  background: #f4f8fb;
  display: flex;
  flex-direction: column;
}

.tcs-candidate-card {
  background: #fff;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #d0d7de;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tcs-avatar-img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #c2d6e5 url('https://upload.wikimedia.org/wikipedia/commons/7/7c/Profile_avatar_placeholder_large.png') center/cover;
  border: 1px solid #aaa;
}

.tcs-candidate-name {
  font-size: 1rem;
  font-weight: 700;
  color: #222 !important;
}

/* Palette Status Legend (Image 1, 2, 3 Match) */
.tcs-legend-table {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #d0d7de;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  font-size: 0.75rem;
  background: #fff;
  color: #222 !important;
}

.tcs-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.2;
  color: #222 !important;
}

.tcs-legend-item span {
  color: #222 !important;
}

.tcs-badge {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff !important;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.tcs-badge-ans { background: #4caf50; clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%); }
.tcs-badge-not-ans { background: #d9534f; clip-path: polygon(50% 0, 100% 30%, 100% 100%, 0 100%, 0 30%); }
.tcs-badge-not-visited { background: #e0e0e0; color: #333 !important; border-radius: 3px; border: 1px solid #ccc; }
.tcs-badge-marked { background: #8e44ad; border-radius: 50%; }
.tcs-badge-ans-marked { background: #8e44ad; border-radius: 50%; position: relative; }
.tcs-badge-ans-marked::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: #4caf50;
  border: 1px solid #fff;
}

/* Question Palette Section Header */
.tcs-palette-header {
  background: #0073b7;
  color: #fff !important;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.tcs-palette-grid-box {
  flex: 1;
  padding: 0.85rem;
  overflow-y: auto;
  background: #f4f8fb;
  color: #222 !important;
}

.tcs-palette-grid-box > div {
  color: #222 !important;
}

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

.tcs-p-btn {
  height: 36px;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff !important;
  transition: opacity 0.15s ease;
}

.tcs-p-btn:hover { opacity: 0.85; }
.tcs-p-btn.active { outline: 2px solid #000; outline-offset: 1px; }

.tcs-p-btn.st-not-visited { background: #e0e0e0; color: #333 !important; border: 1px solid #ccc; border-radius: 3px; }
.tcs-p-btn.st-not-answered { background: #d9534f; clip-path: polygon(50% 0, 100% 30%, 100% 100%, 0 100%, 0 30%); }
.tcs-p-btn.st-answered { background: #4caf50; clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%); }
.tcs-p-btn.st-marked { background: #8e44ad; border-radius: 50%; }
.tcs-p-btn.st-ans-marked { background: #8e44ad; border-radius: 50%; position: relative; }
.tcs-p-btn.st-ans-marked::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #4caf50;
  border: 1px solid #fff;
}

/* Bottom Action Bar */
.tcs-bottom-bar {
  height: 52px;
  background: #fff;
  border-top: 1px solid #d0d7de;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1rem;
  overflow-x: auto;
}

.tcs-btn-left-group, .tcs-btn-right-group {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-shrink: 0;
}

.tcs-btn-action {
  background: #fff;
  border: 1px solid #ccc;
  color: #333 !important;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.tcs-btn-action:hover { background: #f0f0f0; }

.tcs-btn-save {
  background: #0073b7;
  color: #fff;
  border: none;
  padding: 0.4rem 1.1rem;
  font-weight: 700;
}

.tcs-btn-save:hover { background: #005a92; }

.tcs-btn-submit {
  background: #4ba6c6;
  color: #fff;
  border: none;
  padding: 0.4rem 1.1rem;
  font-weight: 700;
}

.tcs-btn-submit:hover { background: #388ba8; }

.tcs-footer-version {
  height: 20px;
  background: #546e7a;
  color: #fff;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* OFFICIAL TCS iON SCIENTIFIC CALCULATOR */
.tcs-calc-modal {
  position: fixed;
  top: 70px;
  right: 100px;
  width: 480px;
  background: #d4d4d4;
  border: 1px solid #aaa;
  border-bottom: 6px solid #888;
  border-radius: 6px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  z-index: 3000;
  display: none;
  flex-direction: column;
  user-select: none;
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
}

.tcs-calc-modal.show { display: flex; }

#helptopDiv {
  background-color: #3b82f6;
  color: #ffffff;
  padding: 8px 12px;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
}

.tcs-top-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tcs-calc-help-btn {
  background: #38bdf8;
  color: #fff;
  border: none;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.tcs-calc-icon-btn {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
}

#mainContentArea {
  padding: 12px;
  background: #d4d4d4;
}

.keyPad_TextBox1 {
  width: 100%;
  height: 32px;
  background: #fff;
  border: 1px solid #aaa;
  border-radius: 4px;
  margin-bottom: 6px;
  font-family: Arial, sans-serif;
  font-size: 1.1rem;
  padding: 0 8px;
  color: #333;
  text-align: right;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.keyPad_TextBox {
  width: 100%;
  height: 38px;
  background: #fff;
  border: 1px solid #aaa;
  border-radius: 4px;
  margin-bottom: 10px;
  font-family: Arial, sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  padding: 0 8px;
  color: #000;
  text-align: right;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.tcs-calc-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tcs-row1-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tcs-btn-mod {
  background: #f1f1f1;
  border: 1px solid #aaa;
  border-bottom: 3px solid #999;
  border-radius: 4px;
  color: #222;
  font-size: 13px;
  font-weight: bold;
  height: 28px;
  padding: 0 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tcs-deg-rad {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: bold;
  color: #111;
}

.tcs-mem-group {
  display: flex;
  gap: 4px;
}

.tcs-btn-mem {
  background: #f1f1f1;
  border: 1px solid #aaa;
  border-bottom: 3px solid #999;
  border-radius: 4px;
  color: #222;
  font-size: 11px;
  font-weight: bold;
  height: 28px;
  width: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tcs-keypad-grid {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 4px;
}

.tcs-kbtn {
  background: #f1f1f1;
  border: 1px solid #aaa;
  border-bottom: 3px solid #999;
  border-radius: 4px;
  color: #222;
  font-size: 13px;
  font-weight: bold;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.tcs-kbtn:hover { background: #e5e5e5; }
.tcs-kbtn:active { border-bottom-width: 1px; transform: translateY(1px); }

.tcs-kbtn-red {
  background: #e74c3c !important;
  border: 1px solid #c0392b !important;
  border-bottom: 3px solid #962d22 !important;
  color: #fff !important;
  font-size: 14px !important;
}

.tcs-kbtn-red:hover { background: #d63031 !important; }

.tcs-btn-back {
  grid-column: span 2;
  font-size: 16px !important;
}

.tcs-btn-zero {
  grid-column: span 2;
}

.tcs-btn-equal {
  grid-row: span 2;
  height: 72px !important;
  background: #2ecc71 !important;
  border: 1px solid #27ae60 !important;
  border-bottom: 3px solid #1e8449 !important;
  color: #fff !important;
  font-size: 20px !important;
}

.tcs-btn-equal:hover { background: #27ae60 !important; }

.subscript, .superscript {
  font-size: 0.7em;
  position: relative;
}

.superscript { top: -0.4em; }
.subscript { top: 0.3em; }

#helpContent {
  height: 260px;
  overflow-y: auto;
  padding: 10px;
  background: #fff;
  border-radius: 4px;
}

.hidden { display: none !important; }

/* ==========================================================================
   USER PROFILE, STREAK, ANALYTICS & LONG RETENTION MODE STYLES
   ========================================================================== */

/* Navbar User Controls */
.user-nav-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.user-profile-pill:hover {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.user-avatar-badge {
  font-size: 1.25rem;
  line-height: 1;
}

.user-name-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(239, 68, 68, 0.2));
  color: #f97316;
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
  animation: streakGlow 2s infinite alternate;
}

@keyframes streakGlow {
  0% { box-shadow: 0 0 5px rgba(245, 158, 11, 0.2); }
  100% { box-shadow: 0 0 14px rgba(245, 158, 11, 0.5); }
}

.btn-analytics-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  color: var(--accent-indigo);
  border: 1px solid rgba(99, 102, 241, 0.4);
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-base);
}

.btn-analytics-nav:hover {
  background: var(--accent-indigo);
  color: #fff;
  transform: translateY(-1px);
}

/* User Creation & Switcher Modal */
.user-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 92%;
  max-width: 540px;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
}

.avatar-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1rem 0 1.5rem 0;
}

.avatar-option-btn {
  font-size: 2rem;
  padding: 0.75rem;
  background: rgba(148, 163, 184, 0.08);
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-option-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  transform: scale(1.08);
}

.avatar-option-btn.selected {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.2);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.user-switch-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
}

.user-switch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-base);
}

.user-switch-item:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--accent-indigo);
}

.user-switch-item.active {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
}

/* Analytics Dashboard Layout */
.analytics-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem 4rem 1.5rem;
}

.analytics-hero-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95)),
              radial-gradient(circle at top right, rgba(99, 102, 241, 0.25), transparent 60%);
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  box-shadow: var(--shadow-xl);
}

.analytics-user-profile {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.analytics-big-avatar {
  font-size: 3.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--accent-cyan);
  border-radius: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}

.analytics-user-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.analytics-user-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Analytics Stats Grid */
.analytics-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition-base);
}

.analytics-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
}

.analytics-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.analytics-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
}

.analytics-lbl {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Subject Mastery Progress Bars */
.subject-mastery-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.75rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-lg);
}

.subject-mastery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.subject-mastery-card {
  background: rgba(148, 163, 184, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: var(--transition-base);
}

.subject-mastery-card:hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
}

.subject-mastery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.progress-bar-bg {
  height: 8px;
  width: 100%;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-indigo));
  border-radius: 9999px;
  transition: width 0.8s ease-in-out;
}

.subject-mastery-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Question History & Detailed Inspector Table */
.question-history-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}

.history-filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin: 1.25rem 0;
}

.filter-pills-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-pill-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
}

.filter-pill-btn.active {
  background: var(--accent-indigo);
  color: #fff;
  border-color: var(--accent-indigo);
}

.history-table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.history-table th {
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-muted);
  padding: 0.85rem 1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}

.history-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.history-table tr:hover {
  background: rgba(99, 102, 241, 0.05);
}

.badge-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
}

.badge-stat-correct { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.badge-stat-wrong { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.badge-stat-skipped { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* =========================================================
   COMPETITIVE ARENA & LEADERBOARD STYLES
   ========================================================= */

.competitive-hero-bar {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.95) 0%, rgba(49, 46, 129, 0.85) 50%, rgba(67, 56, 202, 0.75) 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 18px;
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  box-shadow: 0 12px 35px -10px rgba(99, 102, 241, 0.3);
  backdrop-filter: blur(12px);
}

@media (max-width: 900px) {
  .competitive-hero-bar {
    grid-template-columns: 1fr;
  }
}

.comp-rank-badge-box {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.comp-trophy-avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
  flex-shrink: 0;
}

.comp-rank-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.comp-tier-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
}

.comp-rank-sub {
  font-size: 0.95rem;
  color: #cbd5e1;
  margin-top: 0.35rem;
  line-height: 1.5;
}

.comp-daily-target-card {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 1.15rem 1.4rem;
  min-width: 280px;
}

.comp-target-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 0.6rem;
}

.comp-target-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.comp-target-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
  border-radius: 999px;
  transition: width 0.6s ease;
}

.comp-target-footer {
  font-size: 0.8rem;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
}

/* Quick Filter Chips */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.4rem 0 0.85rem 0;
}

.chip-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.3rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-main);
  border-color: var(--border-accent);
}

.chip-btn.active {
  background: var(--accent-indigo);
  color: #fff;
  border-color: var(--accent-indigo);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Modal Dialog Large */
.modal-dialog-large {
  max-width: 680px;
}

/* Mode Choice Cards in Setup */
.mode-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.mode-toggle-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.mode-toggle-card:hover {
  border-color: var(--border-accent);
}

.mode-toggle-card.selected {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.1);
}

/* Leaderboard View */
.leaderboard-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.podium-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 1.25rem;
  align-items: flex-end;
  margin: 2rem 0 3rem;
}

@media (max-width: 768px) {
  .podium-grid {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

.podium-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.75rem 1.25rem;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease;
}

.podium-card:hover {
  transform: translateY(-4px);
}

.podium-card-1st {
  border-color: rgba(245, 158, 11, 0.6);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.12) 0%, var(--bg-card) 60%);
  transform: scale(1.04);
}

.podium-card-2nd {
  border-color: rgba(148, 163, 184, 0.5);
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.1) 0%, var(--bg-card) 60%);
}

.podium-card-3rd {
  border-color: rgba(205, 127, 50, 0.5);
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.1) 0%, var(--bg-card) 60%);
}

.podium-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 0.75rem;
}

.podium-badge-gold { background: #f59e0b; color: #fff; box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4); }
.podium-badge-silver { background: #94a3b8; color: #fff; box-shadow: 0 4px 14px rgba(148, 163, 184, 0.4); }
.podium-badge-bronze { background: #cd7f32; color: #fff; box-shadow: 0 4px 14px rgba(205, 127, 50, 0.4); }

.podium-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.podium-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.podium-xp {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-amber);
}

/* User Leaderboard Row Highlight */
.leaderboard-table tr.user-row {
  background: rgba(99, 102, 241, 0.18) !important;
  border-left: 4px solid var(--accent-indigo);
  font-weight: 700;
}

.leaderboard-table tr.user-row td {
  color: var(--text-main);
}

/* Scratchpad Window */
.scratchpad-window {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 440px;
  height: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 2500;
  overflow: hidden;
  transition: all 0.25s ease;
}

.scratchpad-header {
  background: rgba(15, 23, 42, 0.85);
  padding: 0.65rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  font-weight: 700;
}

.scratchpad-toolbar {
  padding: 0.5rem 0.85rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.scratchpad-tool-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.scratchpad-tool-btn.active {
  background: var(--accent-indigo);
  color: #fff;
  border-color: var(--accent-indigo);
}

.scratchpad-canvas {
  flex: 1;
  background: #111827;
  cursor: crosshair;
  width: 100%;
}

/* Question Action Buttons */
.q-action-icon-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.q-action-icon-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-main);
  border-color: var(--border-accent);
}

.q-action-icon-btn.active {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-amber);
  border-color: var(--accent-amber);
}

.q-bench-pill {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Modern Stopwatch & Visited Pills */
.practice-stopwatch-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-indigo);
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.practice-visited-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 20px;
  font-size: 0.88rem;
  color: var(--accent-emerald);
  font-weight: 700;
}

.btn-finish-practice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  border: 1px solid rgba(239, 68, 68, 0.6);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-finish-practice:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.45);
}

.practice-action-hint {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.practice-action-hint.hidden {
  display: none !important;
}

#btnPracticeNext:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.5);
  pointer-events: none;
}

.p-qbadge.status-correct {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: var(--accent-emerald) !important;
  color: var(--accent-emerald) !important;
}

.p-qbadge.status-wrong {
  background: rgba(244, 63, 94, 0.25) !important;
  border-color: var(--accent-rose) !important;
  color: var(--accent-rose) !important;
}

.p-qbadge.status-skipped {
  background: rgba(148, 163, 184, 0.25) !important;
  border-color: var(--text-muted) !important;
  color: var(--text-muted) !important;
}

@media (max-width: 900px) {
  .modern-quiz-layout {
    flex-direction: column;
  }
  .practice-topic-hud {
    width: 100%;
  }
  .practice-sleek-header {
    flex-direction: column;
    align-items: stretch;
  }
  .practice-header-left, .practice-header-center, .practice-header-right {
    justify-content: center;
  }
}

/* =========================================================
   DETAILED ANALYTICS v2: container, hero banner, tabs, KPI cards, trees, drawer
   ========================================================= */

.analytics-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  min-height: calc(100vh - 70px);
}

.analytics-hero-banner {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 20px;
  padding: 1.75rem 2rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35), 0 0 35px rgba(99, 102, 241, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.analytics-hero-banner::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.analytics-user-profile {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}

.analytics-big-avatar {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
  border: 1.5px solid rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.analytics-user-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.2;
}

.analytics-user-sub {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.ana-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.4rem;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  margin-bottom: 1.75rem;
}

.ana-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.65rem 1.15rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.ana-tab-btn:hover {
  color: var(--text-main);
  background: rgba(148, 163, 184, 0.08);
}

.ana-tab-btn.active {
  color: #38bdf8;
  background: rgba(6, 182, 212, 0.14);
  border-color: rgba(6, 182, 212, 0.35);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
}

.ana-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.ana-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1rem;
}
.ana-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}
@media (max-width: 1000px) { .ana-grid-2 { grid-template-columns: minmax(0, 1fr); } }

.ana-muted, .ana-hint { color: var(--text-muted); font-weight: 500; }
.ana-hint { font-size: 0.86rem; line-height: 1.5; margin: 0.5rem 0 0; }
.ana-muted-line { color: var(--text-muted); font-size: 0.85rem; margin: 0.25rem 0 0.75rem; }
.ana-divider { height: 1px; background: var(--border-color); margin: 0.9rem 0; }
.ana-callout {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid var(--border-accent);
  border-radius: 12px;
  padding: 0.9rem 1.2rem;
  margin-bottom: 1.25rem;
  color: var(--text-main);
  font-size: 0.92rem;
}

/* KPI row */
.ana-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.ana-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.ana-kpi-label { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ana-kpi-val { font-size: 1.9rem; font-weight: 800; color: var(--text-main); line-height: 1.15; }
.ana-kpi-sub { font-size: 0.8rem; color: var(--text-muted); }
.ana-kpi-action .ana-link-btn { align-self: flex-start; margin-top: 0.4rem; }

.ana-link-btn {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  padding: 0.15rem 0;
  white-space: nowrap;
}
.ana-link-btn:hover { text-decoration: underline; }

/* Mastery stack bar + legend */
.ana-stackbar {
  display: flex;
  height: 16px;
  border-radius: 9999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.15);
}
.ana-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; margin-top: 0.9rem; font-size: 0.85rem; color: var(--text-muted); }
.ana-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.35rem; }
.ana-legend strong { color: var(--text-main); }

/* 14-day activity chart */
.ana-activity { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 0.5rem; }
.ana-day { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.ana-day > span { font-size: 0.66rem; color: var(--text-dim); }
.ana-day-bar { width: 100%; max-width: 26px; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; background: rgba(148, 163, 184, 0.12); min-height: 3px; }

/* Bars and badges */
.ana-bar { display: flex; align-items: center; gap: 0.5rem; min-width: 90px; }
.ana-bar-track { flex: 1; height: 8px; background: rgba(148, 163, 184, 0.18); border-radius: 9999px; overflow: hidden; }
.ana-bar-fill { height: 100%; border-radius: 9999px; transition: width 0.5s ease; }
.ana-bar-val { font-size: 0.82rem; font-weight: 800; min-width: 38px; text-align: right; }
.ana-bar-val.muted { color: var(--text-dim); font-weight: 600; }

.ana-badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 6px; font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.ana-st-weak { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.ana-st-strong, .ana-st-mastered { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.ana-st-needs_revision, .ana-st-learning { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.ana-st-low_data { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }
.ana-st-untested, .ana-st-unseen { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

.ana-trend { font-weight: 800; font-size: 0.85rem; }
.ana-trend.up { color: var(--accent-emerald); }
.ana-trend.down { color: var(--accent-rose); }
.ana-trend.flat { color: var(--text-dim); }

/* Focus lists & chips */
.ana-focus-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border-color); }
.ana-focus-row:last-child { border-bottom: none; }
.ana-rank { width: 24px; height: 24px; border-radius: 50%; background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); font-size: 0.78rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ana-focus-main { flex: 1; min-width: 0; }
.ana-focus-name { font-weight: 700; font-size: 0.92rem; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ana-focus-path { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.1rem; }
.ana-focus-nums { display: flex; flex-direction: column; align-items: flex-end; font-size: 0.76rem; color: var(--text-muted); }
.ana-focus-nums strong { font-size: 1rem; }
.ana-chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ana-chip { background: rgba(148, 163, 184, 0.12); border: 1px solid var(--border-color); border-radius: 9999px; padding: 0.2rem 0.7rem; font-size: 0.78rem; color: var(--text-main); font-weight: 600; }
.ana-chip small { color: var(--text-muted); font-weight: 500; margin-left: 0.25rem; }
.ana-anki-btn { padding: 0.45rem 0.9rem !important; font-size: 0.82rem !important; }

.ana-metric-simple { display: grid; grid-template-columns: 90px minmax(100px, 1fr) minmax(120px, 1.2fr); gap: 0.75rem; align-items: center; padding: 0.35rem 0; font-size: 0.86rem; }
.ana-metric-simple-name { font-weight: 700; color: var(--text-main); }
.ana-metric-simple-sub { color: var(--text-muted); font-size: 0.76rem; }

/* Subject / chapter / topic tree */
.ana-metric-row {
  display: grid;
  grid-template-columns: minmax(170px, 2.2fr) 105px minmax(110px, 1.3fr) 150px 60px 70px 24px 90px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.5rem;
  font-size: 0.86rem;
}
.ana-metric-head { color: var(--text-dim); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border-color); }
.ana-metric-name { font-weight: 700; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ana-metric-name small { color: var(--text-dim); font-weight: 500; margin-left: 0.3rem; }
.ana-metric-nums, .ana-metric-cov, .ana-metric-time { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.ana-metric-action { text-align: right; }
@media (max-width: 1150px) {
  .ana-metric-row { grid-template-columns: minmax(150px, 2fr) 100px minmax(100px, 1.2fr) 60px 24px 80px; }
  .ana-metric-nums, .ana-metric-time { display: none; }
}

.ana-details { border-top: 1px solid var(--border-color); }
.ana-details > summary { list-style: none; cursor: pointer; border-radius: 8px; }
.ana-details > summary::-webkit-details-marker { display: none; }
.ana-details > summary:hover { background: rgba(99, 102, 241, 0.06); }
.ana-details > summary .ana-metric-name::before { content: '\25B8'; display: inline-block; width: 1rem; color: var(--text-dim); transition: transform 0.15s; }
.ana-details[open] > summary .ana-metric-name::before { transform: rotate(90deg); }
.ana-details-body { padding-left: 1.4rem; }
.ana-details-nested { border-top: 1px dashed var(--border-color); }
.ana-details-body > .ana-metric-row .ana-metric-name { padding-left: 1rem; }

/* Tables */
.ana-filter-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.75rem; }
.ana-input, .ana-select {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  padding: 0.5rem 0.8rem;
  font-size: 0.88rem;
}
.ana-input { flex: 1 1 240px; min-width: 200px; }
.ana-select { cursor: pointer; }
.ana-input:focus, .ana-select:focus { outline: none; border-color: var(--accent-cyan); }

.ana-q-table th { cursor: pointer; user-select: none; white-space: nowrap; }
.ana-q-table th.sorted-asc::after { content: ' \25B2'; color: var(--accent-cyan); font-size: 0.7rem; }
.ana-q-table th.sorted-desc::after { content: ' \25BC'; color: var(--accent-cyan); font-size: 0.7rem; }
.ana-q-table th.num, .ana-q-table td.num, .ana-mini-table th.num, .ana-mini-table td.num { text-align: right; }
.ana-click { cursor: pointer; }
.ana-click:hover { background: rgba(6, 182, 212, 0.07); }
.ana-empty { text-align: center; padding: 2rem; color: var(--text-muted); }

.ana-mini-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.ana-mini-table th { text-align: left; color: var(--text-dim); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border-color); }
.ana-mini-table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border-color); }

.ana-pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.ana-pager-info { color: var(--text-muted); font-size: 0.85rem; }
.ana-pager-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.ana-pager-btns .filter-pill-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Per-question drawer */
.q-drawer-overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.6); z-index: 900; }
.q-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(560px, 100vw);
  background: var(--bg-primary);
  border-left: 1px solid var(--border-accent);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.45);
  z-index: 901;
  overflow-y: auto;
  padding: 1.5rem;
}
.q-drawer-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.q-drawer-title { font-size: 1.35rem; font-weight: 800; color: var(--text-main); }
.q-drawer-close { background: rgba(148, 163, 184, 0.12); border: 1px solid var(--border-color); color: var(--text-main); width: 34px; height: 34px; border-radius: 8px; font-size: 1.3rem; cursor: pointer; flex-shrink: 0; }
.q-drawer-close:hover { border-color: var(--accent-rose); color: var(--accent-rose); }

.q-count-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; margin-bottom: 1rem; }
.q-count { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 0.8rem 0.5rem; text-align: center; }
.q-count-val { font-size: 1.8rem; font-weight: 800; color: var(--text-main); line-height: 1.1; }
.q-count-lbl { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 0.2rem; }
.q-count.good .q-count-val { color: var(--accent-emerald); }
.q-count.bad .q-count-val { color: var(--accent-rose); }
.q-count.skip .q-count-val { color: var(--text-muted); }

.q-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem 1.2rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 0.9rem 1.1rem; font-size: 0.85rem; }
.q-facts div { display: flex; justify-content: space-between; gap: 0.5rem; }
.q-facts span { color: var(--text-muted); }
.q-facts strong { color: var(--text-main); }
.q-mastery { display: grid; grid-template-columns: 70px 1fr; gap: 0.2rem 0.75rem; align-items: center; margin-top: 0.9rem; font-size: 0.85rem; color: var(--text-muted); }
.q-mastery small { grid-column: 2; color: var(--text-dim); }

.q-section { margin: 1.4rem 0 0.6rem; font-size: 0.95rem; font-weight: 800; color: var(--text-main); }
.ana-timeline { display: flex; flex-direction: column; }
.ana-tl-row { display: flex; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border-color); font-size: 0.86rem; }
.ana-tl-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 0.4rem; flex-shrink: 0; background: var(--text-dim); }
.ana-tl-correct { background: var(--accent-emerald); }
.ana-tl-wrong { background: var(--accent-rose); }
.ana-tl-meta { color: var(--text-muted); font-size: 0.76rem; margin-top: 0.1rem; }
.ana-tl-main code { background: rgba(148, 163, 184, 0.15); padding: 0.05rem 0.4rem; border-radius: 4px; }

.ana-note { width: 100%; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; color: var(--text-main); padding: 0.7rem; font-family: inherit; font-size: 0.88rem; resize: vertical; }
.q-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.q-question-box { margin-top: 1.4rem; border: 1px solid var(--border-color); border-radius: 12px; padding: 0.75rem 1rem; }
.q-question-box > summary { font-weight: 700; color: var(--accent-cyan); }
.q-question-html { margin-top: 0.8rem; line-height: 1.6; color: var(--text-main); font-size: 0.92rem; overflow-x: auto; }
.q-options { margin: 0.8rem 0 0 1.4rem; color: var(--text-main); line-height: 1.55; font-size: 0.9rem; }
.q-key { margin-top: 0.8rem; font-size: 0.86rem; color: var(--text-muted); }
.q-key strong { color: var(--accent-emerald); }
.q-key a { color: var(--accent-cyan); }

/* Anki card: reason banner */
.anki-reason-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  margin-bottom: 0.75rem;
  font-size: 0.84rem;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.anki-reason-banner span { color: var(--text-muted); font-size: 0.78rem; }

/* =========================================================
   PRACTICE MODE v2: focus mode (no home navbar), slim bar,
   palette-first side panel
   ========================================================= */

body.practice-active {
  overflow: hidden !important;
}

body.practice-active #dashboardHeader {
  display: none !important;
}

body.practice-active #practiceView.dashboard-container,
#practiceView.practice-interface-screen,
#practiceView {
  max-width: none !important;
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  background: var(--bg-primary) !important;
}

#practiceView.hidden {
  display: none !important;
}

#practiceView .practice-workspace {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  width: 100% !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
}

/* 1. TOP HEADER BAR */
.practice-bar {
  height: 50px;
  min-height: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  margin: 0;
  z-index: 40;
  position: static;
  box-shadow: none;
}

.practice-bar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.practice-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.practice-mode-badge.badge-exam {
  background: rgba(6, 182, 212, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.4);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.practice-mode-badge.badge-drill {
  background: rgba(168, 85, 247, 0.16);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.15);
}

.practice-mode-badge.badge-practice {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.practice-mode-badge.badge-anki {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.practice-bar .practice-stopwatch-pill.timer-warning {
  background: rgba(244, 63, 94, 0.25);
  border-color: #f43f5e;
  color: #fb7185;
  animation: pulse-timer-warn 1.5s infinite;
}

@keyframes pulse-timer-warn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(244, 63, 94, 0); }
}

.practice-bar-center {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.practice-bar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.practice-bar .practice-breadcrumbs {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.88rem;
}

.practice-bar .breadcrumb-subj {
  color: var(--accent-cyan);
  font-weight: 800;
  flex-shrink: 0;
}

.practice-bar .breadcrumb-chap,
.practice-bar .breadcrumb-topic {
  color: var(--text-muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.practice-bar .breadcrumb-topic {
  color: var(--text-main);
}

.practice-bar .practice-stopwatch-pill {
  padding: 0.3rem 0.85rem;
  font-size: 1.05rem;
  box-shadow: none;
}

.practice-progress-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: transparent;
}

.practice-progress-line i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
  transition: width 0.4s ease;
}

.btn-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-bar:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--border-accent);
}

.btn-bar svg {
  stroke: currentColor;
}

.btn-bar-end {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

.btn-bar-end:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

/* 2. MAIN MERGED SPLIT BODY (QUESTION + PALETTE) */
#practiceView .modern-quiz-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  margin: 0;
  padding: 0;
  gap: 0;
  background: var(--bg-primary);
  min-height: 0;
  width: 100%;
  align-items: stretch;
  border: none;
}

/* Left: Single Question Pane */
#practiceView .modern-q-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-card);
  border: none;
  border-right: 1px solid var(--border-color);
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 0;
  min-height: 0;
  max-width: none;
  backdrop-filter: none;
}

/* Question Meta Sub-Bar (Docked at top of Question Pane) */
#practiceView .q-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1.75rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  margin: 0;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#practiceView .q-title-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* Scrollable Question Content (Body, Options, Solution) */
#practiceView .q-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  min-height: 0;
}

#practiceView .q-body-content {
  font-size: 1.08rem;
  line-height: 1.75;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}

#practiceView .modern-options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

#practiceView .modern-opt-card {
  padding: 0.95rem 1.25rem;
  font-size: 1.02rem;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  transition: all 0.15s ease;
}

#practiceView .modern-opt-card:hover:not(.selected) {
  transform: translateX(3px);
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

#practiceView .modern-ans-box {
  margin-bottom: 1rem;
}

#practiceBenchPill:empty {
  display: none;
}

/* Right: Question Palette Sidebar (Seamlessly attached) */
#practiceView .practice-topic-hud {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: none;
  border-left: 1px solid var(--border-color);
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 0;
  position: static;
  max-height: none;
  overflow-y: auto;
  gap: 0;
}

.practice-palette-header {
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.practice-pal-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.practice-pal-count {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-indigo);
}

.practice-pal-legend {
  padding: 0.6rem 0.85rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.pal-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pal-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

#practiceView .practice-pal-grid {
  padding: 0.75rem 0.85rem;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
  overflow-y: auto;
  max-height: 280px;
  flex-shrink: 0;
}

#practiceView .practice-pal-btn {
  height: 36px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

#practiceView .practice-pal-btn:hover {
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
}

#practiceView .practice-pal-btn.active {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 1px;
  font-weight: 800;
}

#practiceView .hud-mini-stats {
  padding: 0.65rem 0.85rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  text-align: center;
  flex-shrink: 0;
  margin: 0;
}

/* Unified Chapters & Topics Tree View */
.practice-tree-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  overflow: hidden;
}

.practice-tree-header {
  padding: 0.65rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.practice-tree-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.practice-tree-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.practice-subject-tree {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Tree Branch (Chapter Node) */
.tree-chapter-branch {
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: all 0.15s ease;
}

.tree-chapter-branch.tree-active-branch {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.tree-branch-header {
  padding: 0.55rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.tree-branch-header:hover {
  background: var(--bg-card-hover);
  color: var(--accent-cyan);
}

.tree-chevron {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  display: inline-block;
  width: 14px;
  text-align: center;
}

.tree-chapter-branch.open .tree-chevron {
  transform: rotate(90deg);
}

.tree-branch-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-branch-count {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.tree-branch-children {
  display: none;
  padding: 0.35rem 0.45rem 0.45rem 1.1rem;
  border-top: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.3);
  flex-direction: column;
  gap: 0.25rem;
  border-left: 2px solid rgba(6, 182, 212, 0.25);
  margin-left: 0.75rem;
  margin-bottom: 0.3rem;
}

.tree-chapter-branch.open .tree-branch-children {
  display: flex;
}

/* Tree Leaf (Topic Node) */
.tree-topic-leaf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.tree-topic-leaf:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.tree-topic-leaf.tree-active-leaf {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
  font-weight: 700;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.tree-topic-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-topic-count {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* 3. DOCKED BOTTOM ACTION TOOLBAR */
#practiceView .practice-bottom-bar,
#practiceView .modern-quiz-actions {
  height: 58px;
  min-height: 58px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
  margin: 0;
  border-radius: 0;
  box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.2);
  position: static;
}

.practice-btn-left-group,
.practice-btn-right-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: nowrap;
}

/* Action button styles */
#practiceView .btn-action-submit,
#practiceView #btnPracticeSubmit {
  background: #10b981;
  color: #ffffff;
  border: 1px solid #059669;
  font-size: 0.86rem;
  font-weight: 700;
  height: 38px;
  padding: 0 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

#practiceView .btn-action-submit:hover,
#practiceView #btnPracticeSubmit:hover {
  background: #059669;
  transform: translateY(-1px);
}

#practiceView .btn-action-secondary,
#practiceView #btnPracticeSkip,
#practiceView #btnPracticeClear {
  background: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-size: 0.84rem;
  font-weight: 600;
  height: 38px;
  padding: 0 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all 0.15s ease;
}

#practiceView .btn-action-secondary:hover,
#practiceView #btnPracticeSkip:hover,
#practiceView #btnPracticeClear:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

#practiceView #btnPracticeClear:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

#practiceView .btn-action-nav,
#practiceView #btnPracticePrev {
  background: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-size: 0.84rem;
  font-weight: 600;
  height: 38px;
  padding: 0 1.15rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all 0.15s ease;
}

#practiceView .btn-action-nav:hover,
#practiceView #btnPracticePrev:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

#practiceView #btnPracticePrev:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#practiceView .btn-action-next,
#practiceView #btnPracticeNext {
  background: var(--accent-indigo);
  color: #ffffff;
  border: 1px solid var(--accent-indigo);
  font-size: 0.86rem;
  font-weight: 700;
  height: 38px;
  padding: 0 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

#practiceView .btn-action-next:hover,
#practiceView #btnPracticeNext:hover {
  background: #4f46e5;
  border-color: #4f46e5;
  transform: translateY(-1px);
}

/* Converted Submit Button (Next Question state) */
#practiceView .btn-submit-converted-next {
  background: var(--accent-indigo) !important;
  color: #ffffff !important;
  border: 1px solid var(--accent-indigo) !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3) !important;
  animation: none !important;
}

#practiceView .btn-submit-converted-next:hover {
  background: #4f46e5 !important;
}

#practiceView .btn-submitted-state {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  cursor: default !important;
  opacity: 0.9 !important;
  box-shadow: none !important;
  transform: none !important;
}

#practiceView #btnPracticeClear:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

#practiceView .btn-action-skip,
#practiceView #btnPracticeSkip {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 0.84rem;
  font-weight: 700;
  height: 38px;
  padding: 0 1.05rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  transition: all 0.15s ease;
}

#practiceView .btn-action-skip:hover:not(:disabled),
#practiceView #btnPracticeSkip:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.24);
  border-color: #f59e0b;
  color: #ffffff;
  transform: translateY(-1px);
}

#practiceView .btn-action-skip:disabled,
#practiceView #btnPracticeSkip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Question Solution & Discussion URL Styles */
.btn-view-solution-url {
  background: rgba(6, 182, 212, 0.12) !important;
  border: 1px solid rgba(6, 182, 212, 0.35) !important;
  color: var(--accent-cyan) !important;
}

.btn-view-solution-url:hover {
  background: rgba(6, 182, 212, 0.25) !important;
  border-color: var(--accent-cyan) !important;
}

/* Exam Mode Action Buttons (Save & Next, Mark for Review, Submit Exam) */
#practiceView .btn-action-review,
#practiceView #btnPracticeMarkReview {
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c084fc;
  font-size: 0.84rem;
  font-weight: 700;
  height: 38px;
  padding: 0 1rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all 0.15s ease;
}

#practiceView .btn-action-review:hover,
#practiceView #btnPracticeMarkReview:hover {
  background: rgba(168, 85, 247, 0.28);
  border-color: #a855f7;
  color: #ffffff;
  transform: translateY(-1px);
}

#practiceView .btn-action-finish,
#practiceView #btnPracticeExamSubmit {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ffffff;
  border: 1px solid #10b981;
  font-size: 0.86rem;
  font-weight: 800;
  height: 38px;
  padding: 0 1.35rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.15s ease;
}

#practiceView .btn-action-finish:hover,
#practiceView #btnPracticeExamSubmit:hover {
  background: linear-gradient(135deg, #047857, #059669);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* Explicit hide rule overrides for practice toolbar */
#practiceView .hidden,
#practiceView #btnPracticeSkip.hidden,
#practiceView #btnPracticeMarkReview.hidden,
#practiceView #btnPracticeExamSubmit.hidden,
#practiceView .btn-action-review.hidden,
#practiceView .btn-action-finish.hidden,
#practiceView .btn-action-skip.hidden {
  display: none !important;
}

/* Exam Mode Palette Status Classes */
#practiceView .practice-pal-btn.pal-exam-answered {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: #10b981 !important;
  color: #34d399 !important;
  font-weight: 800 !important;
}

#practiceView .practice-pal-btn.pal-exam-marked {
  background: rgba(168, 85, 247, 0.22) !important;
  border-color: #a855f7 !important;
  color: #c084fc !important;
  font-weight: 800 !important;
}

#practiceView .practice-pal-btn.pal-exam-ans-marked {
  background: rgba(16, 185, 129, 0.22) !important;
  border: 2px solid #a855f7 !important;
  color: #34d399 !important;
  font-weight: 800 !important;
  position: relative;
}

#practiceView .practice-pal-btn.pal-exam-ans-marked::after {
  content: '•';
  position: absolute;
  top: 1px;
  right: 4px;
  color: #c084fc;
  font-size: 1rem;
  line-height: 1;
}

#practiceView .practice-pal-btn.pal-exam-visited {
  background: rgba(249, 115, 22, 0.18) !important;
  border-color: #f97316 !important;
  color: #fb923c !important;
  font-weight: 800 !important;
}

#practiceView .practice-pal-btn.pal-exam-notvisited {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-muted) !important;
}

/* Subject breakdown list in Exam Mode sidebar */
.practice-exam-subj-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.82rem;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s ease;
}

.practice-exam-subj-row:hover {
  background: rgba(99, 102, 241, 0.08);
}

.practice-exam-subj-badge {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-indigo);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 800;
}

.solution-url-banner {
  margin-top: 0.85rem;
  padding: 0.85rem 1.15rem;
  background: rgba(6, 182, 212, 0.08);
  border: 1px dashed rgba(6, 182, 212, 0.4);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.q-solution-external-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-decoration: none;
  transition: all 0.15s ease;
  width: fit-content;
}

.q-solution-external-link:hover {
  color: #38bdf8;
  text-decoration: underline;
  transform: translateX(3px);
}

/* Chapter Complete Celebration Modal */
.chapter-complete-dialog {
  max-width: 530px;
  text-align: center;
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(16, 185, 129, 0.2);
}

.chapter-complete-header {
  padding: 1.5rem 1.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.celebrate-badge {
  font-size: 3.2rem;
  margin-bottom: 0.4rem;
  animation: bounceCelebrate 0.9s ease infinite alternate;
}

@keyframes bounceCelebrate {
  from { transform: scale(1); }
  to { transform: scale(1.18); }
}

.chapter-complete-title {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-main);
}

.chapter-complete-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}

.chapter-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin: 1.25rem 1.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 0.5rem;
}

.chapter-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.chapter-stat-val {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text-main);
}

.chapter-stat-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chapter-complete-actions {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  padding: 0 1.75rem 1.75rem;
}

.btn-complete-continue {
  background: linear-gradient(135deg, #0284c7, #2563eb) !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4) !important;
}

.resume-journey-dialog {
  max-width: 540px;
}

.stopwatch-digits {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .practice-bar {
    grid-template-columns: 1fr;
    justify-items: stretch;
    position: static;
  }
  .practice-bar-center,
  .practice-bar-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  #practiceView .modern-quiz-layout {
    flex-direction: column;
  }
  #practiceView .practice-topic-hud {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-color);
    max-height: 280px;
  }
  #practiceView .practice-bottom-bar {
    height: auto;
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.6rem;
  }
}

/* =========================================================
   USER DATABASE & PROFILE CONTROL MODAL STYLES
   ========================================================= */

.user-control-modal-dialog {
  max-width: 840px;
  width: 95%;
}

.uc-tabs-bar {
  display: flex;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1rem;
  overflow-x: auto;
  gap: 0.5rem;
}

.uc-tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

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

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

.uc-tab-panel {
  animation: fadeIn 0.2s ease;
}

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

.uc-avatar-picker {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.uc-avatar-opt {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.uc-avatar-opt:hover {
  transform: translateY(-2px);
  border-color: var(--accent-indigo);
}

.uc-avatar-opt.selected {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.2);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

/* Multi-User Profiles Grid */
.uc-profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.uc-profile-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.uc-profile-card.active {
  border-color: var(--accent-indigo);
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.25);
  background: color-mix(in srgb, var(--accent-indigo) 10%, var(--bg-card));
}

.uc-profile-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.uc-profile-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.uc-profile-card-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.uc-profile-card-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.uc-new-profile-box {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: 1rem;
}

/* Database Diagnostics & Backup Cards */
.uc-diagnostics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
}

.uc-diag-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 0.75rem;
}

.uc-diag-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
}

.uc-diag-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.uc-diag-val {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-main);
  margin-top: 0.25rem;
}

.uc-backup-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.4rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Reset Box */
.uc-warning-box {
  display: flex;
  gap: 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

.uc-reset-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.uc-reset-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

/* Diagnostics & Pacing Badges */
.ana-diag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.ana-diag-critical {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.ana-diag-time_trap {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.ana-diag-concept_gap {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.ana-diag-fluent {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.ana-diag-needs_revision {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.overtime-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.optimal-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

@media (max-width: 768px) {
  .uc-form-grid { grid-template-columns: 1fr; }
  .uc-diag-grid { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   MASTER-TIER DETAILED ANALYSIS & SUMMARY VIEW
   ========================================================= */

/* Hero Diagnostic Banner */
.res-hero-banner {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 20px;
  padding: 2.25rem;
  margin-bottom: 2rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35), 0 0 35px rgba(99, 102, 241, 0.1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.res-hero-banner::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.res-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.res-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #818cf8;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  margin-bottom: 0.5rem;
}

.res-hero-title {
  font-size: 1.85rem;
  font-weight: 900;
  color: #ffffff;
  margin: 0;
  line-height: 1.25;
}

.res-hero-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.res-hero-main-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
}

@media (max-width: 900px) {
  .res-hero-main-grid { grid-template-columns: 1fr; }
}

.res-score-block {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.res-big-score {
  font-size: 3.8rem;
  font-weight: 900;
  background: linear-gradient(135deg, #818cf8 0%, #38bdf8 50%, #4ade80 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  letter-spacing: -1px;
}

.res-max-score {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-muted);
}

.res-score-pills {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.res-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 700;
}

.res-pill-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.res-pill-rose {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.res-pill-muted {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.res-verdict-card {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.res-verdict-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.res-verdict-title {
  font-weight: 800;
  font-size: 1.05rem;
  color: #ffffff;
}

.res-verdict-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.45;
}

/* Ratio Bar Card */
.res-ratio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
}

.res-ratio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.res-ratio-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.res-ratio-track {
  height: 14px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.15);
  display: flex;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.res-ratio-seg-correct {
  background: linear-gradient(90deg, #10b981, #059669);
  height: 100%;
  transition: width 0.6s ease;
}

.res-ratio-seg-wrong {
  background: linear-gradient(90deg, #f43f5e, #e11d48);
  height: 100%;
  transition: width 0.6s ease;
}

.res-ratio-seg-skipped {
  background: linear-gradient(90deg, #64748b, #475569);
  height: 100%;
  transition: width 0.6s ease;
}

.res-ratio-legend {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.res-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.res-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Master KPI Grid */
.res-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.res-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.35rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.res-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
}

.res-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.res-kpi-val {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.15;
}

.res-kpi-lbl {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.25rem;
}

.res-kpi-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Pacing & Speed Matrix (Summary Diagnostic) */
.res-pacing-matrix {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
}

.res-pacing-header {
  margin-bottom: 1.25rem;
}

.res-pacing-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.pacing-matrix-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .pacing-matrix-grid { grid-template-columns: 1fr; }
}

.pacing-matrix-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.pacing-matrix-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
}

.pacing-matrix-card.pacing-correct {
  border-left: 4px solid #10b981;
}

.pacing-matrix-card.pacing-wrong {
  border-left: 4px solid #f43f5e;
}

.pacing-matrix-card.pacing-skipped {
  border-left: 4px solid #64748b;
}

.pacing-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.pacing-status {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.pacing-badge {
  font-size: 0.74rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.pacing-badge.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pacing-badge.badge-red {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.pacing-badge.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.pacing-badge.badge-slate {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.pacing-val {
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.15;
  margin-top: 0.1rem;
}

.pacing-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Segmented Question Review Control Section */
.review-master-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2rem;
  margin-top: 2rem;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-card);
}

.review-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.review-section-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.review-section-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.review-section-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* Segmentation Tabs */
.review-filter-tabs {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.rev-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.15rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.rev-tab-btn:hover {
  border-color: var(--accent-indigo);
  color: var(--text-main);
  transform: translateY(-1px);
}

.rev-tab-btn.active.tab-wrong {
  background: rgba(244, 63, 94, 0.14);
  border-color: #f43f5e;
  color: #fb7185;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.25);
}

.rev-tab-btn.active.tab-correct {
  background: rgba(16, 185, 129, 0.14);
  border-color: #10b981;
  color: #34d399;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.rev-tab-btn.active.tab-skipped {
  background: rgba(148, 163, 184, 0.15);
  border-color: #94a3b8;
  color: #e2e8f0;
  box-shadow: 0 4px 14px rgba(148, 163, 184, 0.2);
}

.rev-tab-btn.active.tab-all {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
  color: #a5b4fc;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.rev-tab-badge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.25);
}

/* Insight Banner */
.review-insight-banner {
  border-radius: 12px;
  padding: 0.85rem 1.15rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.review-insight-banner.banner-wrong {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #fca5a5;
}

.review-insight-banner.banner-correct {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #86efac;
}

.review-insight-banner.banner-skipped {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.review-insight-banner.banner-all {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
}

/* Jump Palette */
.review-palette-wrap {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
}

.review-palette-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.review-palette-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.rev-p-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.rev-p-btn:hover {
  transform: scale(1.1);
}

.rev-p-btn.p-correct {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #34d399;
}

.rev-p-btn.p-wrong {
  background: rgba(244, 63, 94, 0.18);
  border-color: #f43f5e;
  color: #fb7185;
}

.rev-p-btn.p-skipped {
  background: rgba(148, 163, 184, 0.14);
  border-color: #64748b;
  color: #94a3b8;
}

/* Upgraded Question Review Cards */
.review-q-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
  transition: border-color 0.2s ease;
}

.review-q-card.status-correct {
  border-left: 6px solid #10b981;
}

.review-q-card.status-wrong {
  border-left: 6px solid #f43f5e;
}

.review-q-card.status-unattempted {
  border-left: 6px solid #64748b;
}

.review-q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.review-q-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.review-q-num-pill {
  font-weight: 900;
  font-size: 0.95rem;
  color: #ffffff;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
}

.review-q-topic-trail {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-muted);
}

.review-q-meta-badges {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.review-meta-chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.review-status-pill {
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
}

.review-status-pill.pill-correct {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.review-status-pill.pill-wrong {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.review-status-pill.pill-skipped {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.review-q-content {
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}

.review-q-answers-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.15rem 1.35rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .review-q-answers-box { grid-template-columns: 1fr; }
}

.review-ans-col-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.review-user-ans {
  font-size: 1.1rem;
  font-weight: 800;
}

.review-user-ans.ans-correct { color: #34d399; }
.review-user-ans.ans-wrong { color: #fb7185; }
.review-user-ans.ans-skipped { color: #94a3b8; font-style: italic; }

.review-key-ans {
  font-size: 1.1rem;
  font-weight: 900;
  color: #34d399;
}

.review-q-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-color);
}

.review-marks-calc {
  font-size: 0.88rem;
  font-weight: 700;
}

.review-sol-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-cyan);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  transition: all 0.2s ease;
}

.review-sol-link:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* =========================================================
   STARRED QUESTIONS VAULT STYLES
   ========================================================= */

.starred-modal-dialog {
  max-width: 960px !important;
  width: 94vw !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  background: var(--bg-card) !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(245, 158, 11, 0.15) !important;
  border-radius: 20px !important;
  overflow: hidden !important;
}

.starred-count-pill {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.35);
  display: inline-flex;
  align-items: center;
}

.starred-filter-toolbar {
  padding: 1rem 1.75rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: center;
}

.starred-search-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.starred-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  opacity: 0.6;
  pointer-events: none;
}

.starred-search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.starred-search-input:focus {
  border-color: var(--accent-amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.starred-filter-group {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.starred-select {
  padding: 0.65rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.starred-select:focus {
  border-color: var(--accent-amber);
}

.starred-actions-bar {
  padding: 0.85rem 1.75rem;
  background: rgba(245, 158, 11, 0.05);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.starred-actions-left, .starred-actions-right {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

.starred-btn-practice {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  padding: 0.55rem 1.25rem !important;
  border-radius: 9px !important;
  font-size: 0.9rem !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3) !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.starred-btn-practice:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.45) !important;
}

.starred-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.75rem !important;
}

.starred-questions-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Starred Question Card */
.starred-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  transition: all 0.2s ease;
  position: relative;
}

.starred-card:hover {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

.starred-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.starred-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.starred-toggle-btn {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-amber);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.starred-toggle-btn:hover {
  background: rgba(245, 158, 11, 0.3);
  transform: scale(1.08);
}

.starred-q-num {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.starred-telemetry-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.starred-q-path {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.starred-q-path strong {
  color: var(--accent-cyan);
}

.starred-q-content {
  font-size: 0.96rem;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 1rem;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.starred-key-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  margin-bottom: 0.85rem;
}

/* Personal Revision Note Box */
.starred-note-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.starred-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-amber);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.starred-note-content {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.5;
  white-space: pre-wrap;
}

.starred-note-edit-area {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--text-main);
  font-size: 0.88rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  outline: none;
  box-sizing: border-box;
}

.starred-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.starred-footer-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Empty State */
.starred-empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-secondary);
  border: 2px dashed var(--border-color);
  border-radius: 16px;
}

.starred-empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 4px 12px rgba(245, 158, 11, 0.3));
}

.starred-empty-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.starred-empty-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 1.5rem auto;
  line-height: 1.6;
}

/* =========================================================
   KEYBOARD SHORTCUTS CHEATSHEET MODAL STYLES
   ========================================================= */

.shortcuts-dialog {
  max-width: 820px !important;
  width: 92vw !important;
  max-height: 88vh !important;
  display: flex !important;
  flex-direction: column !important;
  background: var(--bg-card) !important;
  border: 1px solid rgba(99, 102, 241, 0.35) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.15) !important;
  border-radius: 20px !important;
  overflow: hidden !important;
}

.shortcuts-header-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.shortcuts-modal-body {
  padding: 1.25rem 1.75rem !important;
  overflow-y: auto !important;
  max-height: calc(88vh - 140px);
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.1rem;
}

.shortcuts-cat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.shortcuts-cat-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 0.4rem 0;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 0.75rem;
}

.shortcut-row:last-child {
  border-bottom: none;
}

.shortcut-desc {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
}

.shortcut-keys {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

kbd, .kbd-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 0.45rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  user-select: none;
}

/* =========================================================
   GATE CSE CORE FORMULAS & QUICK REFERENCE DRAWER STYLES
   ========================================================= */

.formula-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.formula-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.formula-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(880px, 94vw);
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  box-shadow: -15px 0 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.formula-drawer-backdrop.active .formula-drawer-panel {
  transform: translateX(0);
}

.formula-drawer-header {
  padding: 1.15rem 1.75rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.formula-drawer-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.formula-drawer-icon {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(6, 182, 212, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.formula-drawer-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.formula-drawer-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0 0;
}

.formula-drawer-toolbar {
  padding: 0.85rem 1.75rem;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.formula-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.formula-search-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  pointer-events: none;
}

.formula-search-input {
  width: 100%;
  padding: 0.55rem 2.2rem 0.55rem 2.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.formula-search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.formula-search-clear {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.formula-subject-pills {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.formula-pill {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.formula-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.formula-pill.active {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.formula-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.formula-subject-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  padding-bottom: 0.4rem;
  border-bottom: 2px solid rgba(6, 182, 212, 0.35);
  margin-top: 0.5rem;
}

.formula-section-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.15rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s ease;
}

.formula-section-card:hover {
  border-color: rgba(6, 182, 212, 0.4);
}

.formula-section-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.formula-section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.formula-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.formula-item-box {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.formula-item-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.formula-item-math {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  padding: 0.35rem 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  margin-bottom: 0.35rem;
  overflow-x: auto;
}

.formula-item-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Formula Data Tables */
.formula-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.formula-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.formula-table th {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-main);
  font-weight: 800;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.formula-table td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  vertical-align: middle;
}

.formula-table tr:last-child td {
  border-bottom: none;
}

.formula-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* =========================================================
   PRACTICE PALETTE DYNAMIC FILTER CHIPS
   ========================================================= */

.practice-pal-filter-bar {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  padding: 0.4rem 0.5rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 0.6rem;
  scrollbar-width: thin;
}

.pal-filter-pill {
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.pal-filter-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.pal-filter-pill.active {
  background: var(--accent-indigo);
  color: #fff;
  border-color: var(--accent-indigo);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
}

.practice-pal-btn.pal-filtered-out {
  display: none !important;
}

/* =========================================================
   QUESTION TYPE GUIDANCE CALLOUT (NAT / MSQ / MCQ)
   ========================================================= */

.q-type-guidance-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.95rem;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.guidance-nat {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
}

.guidance-msq {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.3);
  color: var(--accent-purple);
}

.guidance-mcq {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
}

/* =========================================================
   PRINT STYLESHEET (@media print) FOR REPORT SAVING
   ========================================================= */

@media print {
  /* Hide non-printable app chromes */
  #dashboardHeader,
  .practice-bar,
  .practice-bottom-bar,
  .modal-backdrop,
  .formula-drawer-backdrop,
  .scratchpad-window,
  .tcs-calc-modal,
  .res-hero-header button,
  .res-hero-main-grid > div:last-child {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  #resultView {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .res-hero-banner,
  .res-ratio-card,
  .res-kpi-grid,
  .res-pacing-matrix,
  .marks-dist-box,
  .review-master-section {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
    color: #000000 !important;
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .res-big-score,
  .res-hero-title,
  .res-kpi-val,
  .res-verdict-title {
    color: #000000 !important;
  }

  .rev-card {
    background: #ffffff !important;
    border: 1px solid #dddddd !important;
    color: #000000 !important;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 1.5rem !important;
  }

  .rev-expl-box {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
  }
}




/* =========================================================
   UI v3: shared tree component, compact practice header,
   dropdown palette filter, quieter footer
   ========================================================= */

/* ---------- Shared tree ---------- */
.tr { font-size: 0.86rem; }
.tr-node { position: relative; }
.tr-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 34px;
  padding: 0 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-main);
  transition: background 0.12s ease;
}
.tr-row:hover { background: rgba(99, 102, 241, 0.09); }
.tr-row.active { background: rgba(6, 182, 212, 0.12); box-shadow: inset 3px 0 0 var(--accent-cyan); }
.tr-row.active .tr-label { color: var(--accent-cyan); font-weight: 700; }

.tr-chev { flex: none; width: 14px; height: 14px; position: relative; color: var(--text-dim); }
.tr-chev::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.tr-chev.none::before { display: none; }
.tr-node.open > .tr-row .tr-chev::before { transform: rotate(45deg); top: 2px; }

.tr-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-meta { flex: none; min-width: 34px; text-align: right; font-size: 0.74rem; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* children collapse with a smooth height transition */
.tr-children {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.2s ease;
  margin-left: 14px;
  border-left: 1px solid var(--border-color);
}
.tr-children > div { overflow: hidden; padding-left: 4px; min-height: 0; }
.tr-node.open > .tr-children { grid-template-rows: 1fr; }

/* weight decreases with depth */
.tr-parent .tr-label, .tr-subject .tr-label { font-weight: 700; }
.tr-chapter .tr-label { font-weight: 600; }
.tr-topic .tr-label, .tr-leaf .tr-label { font-weight: 500; color: var(--text-muted); }
.tr-row.active.tr-leaf .tr-label { color: var(--accent-cyan); }

/* practice: tiny progress line under a chapter + leaf dots */
.tr-mini { position: absolute; left: 8px; right: 8px; bottom: 2px; height: 2px; background: rgba(148, 163, 184, 0.15); border-radius: 2px; overflow: hidden; }
.tr-mini i { display: block; height: 100%; background: var(--accent-emerald); }
.tr-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--text-dim); margin-left: 3px; }
.tr-dot.part { border-color: var(--accent-amber); background: rgba(245, 158, 11, 0.4); }
.tr-dot.done { border-color: var(--accent-emerald); background: var(--accent-emerald); }

.tree-search {
  margin: 0.5rem 0.65rem 0.25rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
}
.tree-search:focus { outline: none; border-color: var(--accent-cyan); }
.tree-empty { padding: 0.75rem; color: var(--text-muted); font-size: 0.8rem; }
#practiceView .practice-subject-tree { gap: 0; padding: 0.35rem 0.5rem 0.75rem; }

/* ---------- Analytics tree specifics ---------- */
.tr-metrics { min-height: 38px; }
.tr-metrics .tr-label { flex: 1 1 0; }
.tr-acc { flex: none; width: 130px; }
.tr-acc .ana-bar { min-width: 0; }
.tr-action { flex: none; width: 84px; text-align: right; }
.tr-status { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--text-dim); }
.ana-dot-weak { background: var(--accent-rose); }
.ana-dot-needs_revision { background: var(--accent-amber); }
.ana-dot-strong { background: var(--accent-emerald); }
.ana-dot-low_data { background: var(--accent-indigo); }
.ana-dot-untested { background: rgba(148, 163, 184, 0.45); }
.tr-subject { min-height: 42px; }
.tr-subject .tr-label { font-size: 0.95rem; }
.tr-metrics .tr-action .ana-link-btn { visibility: hidden; }
.tr-metrics:hover .tr-action .ana-link-btn { visibility: visible; }

.tr-head { display: grid; grid-template-columns: 1fr 130px 34px 84px; gap: 0.5rem; padding: 0 0.5rem 0.4rem 3.3rem; color: var(--text-dim); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border-color); margin-bottom: 0.4rem; }
.tr-head span:nth-child(3) { text-align: right; }

.tree-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.tree-toolbar-left { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.tree-check { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.84rem; color: var(--text-muted); cursor: pointer; margin-left: 0.5rem; }
.tree-legend { display: flex; gap: 0.9rem; flex-wrap: wrap; font-size: 0.76rem; color: var(--text-muted); }
.tree-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.3rem; }

@media (max-width: 1000px) {
  .tr-acc { width: 90px; }
  .tr-head { grid-template-columns: 1fr 90px 34px 84px; }
}

/* ---------- Practice: compact question header ---------- */
#practiceView .q-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
  padding: 0.7rem 1.75rem;
  margin: 0;
}
#practiceView .q-meta-main { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; min-width: 0; }
#practiceView .q-title-text { font-size: 1rem; white-space: nowrap; }
#practiceView .q-badge-group { display: flex; gap: 0.35rem; }
#practiceView .q-badge { font-size: 0.72rem; padding: 0.15rem 0.5rem; }
#practiceView .q-meta-tools { display: flex; gap: 0.35rem; flex: none; }
#practiceView .q-action-icon-btn { padding: 0; width: 34px; height: 34px; justify-content: center; font-size: 1rem; background: transparent; }
#practiceView .q-ico-label { display: none; }
#practiceView .q-bench-pill {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 0.74rem;
  color: var(--text-dim);
}

/* ---------- Practice: side panel ---------- */
.pal-filter-select {
  margin: 0.5rem 0.75rem 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
}
#practiceView .hud-mini-stats {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  margin: 0;
  border-top: 1px solid var(--border-color);
}
#practiceView .hud-stat-box {
  flex-direction: row;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0;
  background: none;
  border: none;
}
#practiceView .hud-stat-num { font-size: 0.9rem; }
#practiceView .hud-stat-lbl { font-size: 0.68rem; text-transform: none; letter-spacing: 0; }
#practiceView .practice-pal-legend { gap: 0.2rem 0.7rem; font-size: 0.68rem; padding: 0.4rem 0.75rem; }

/* ---------- Practice: footer ---------- */
#practiceView #btnPracticeClear {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
#practiceView #btnPracticeClear:hover:not(:disabled) { color: var(--accent-rose); background: rgba(244, 63, 94, 0.08); }
#practiceView #btnPracticeSkip { background: transparent; }

/* ---------- Timed CBT: tighter chrome ---------- */
.tcs-interface .tcs-sidebar { padding-top: 0.5rem; }

/* ---- Dashboard v3 ---- */
.master-modes-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 1.1rem !important; }
@media (max-width: 1100px) { .master-modes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 700px) { .master-modes-grid { grid-template-columns: minmax(0, 1fr) !important; } }
.master-mode-card .mode-desc { font-size: 0.86rem; line-height: 1.5; }
.master-mode-card .mode-card-body { padding-bottom: 0.5rem; }
.subject-fast-bar { height: 3px; background: rgba(148, 163, 184, 0.18); border-radius: 3px; overflow: hidden; margin-top: 0.6rem; }
.subject-fast-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald)); }
.subject-fast-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important; }

/* navbar tidy */
.app-navbar .btn-analytics-nav, .app-navbar .btn-theme-toggle { white-space: nowrap; padding: 0.4rem 0.75rem; font-size: 0.82rem; }
.app-navbar .brand-badge { white-space: nowrap; }
@media (max-width: 1500px) { .app-navbar .brand-badge { display: none; } }

/* ---- v3.1: NAT label, rule chip ---- */
#practiceView .tcs-nat-box > div:first-child { color: var(--text-muted) !important; font-size: 0.85rem !important; }
#practiceView .tcs-nat-box .tcs-nat-display {
  background: var(--bg-primary);
  color: var(--text-main) !important;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}
#practiceView .q-badge-rule { color: var(--text-muted); background: transparent; border-style: dashed; }

/* =========================================================
   IPAD 9TH GEN (810px × 1080px) & TABLET INTERACTIVE UI SYSTEM
   Designed specifically for iPadOS Safari, touch gestures,
   and both portrait (810px) and landscape (1080px) orientations.
   ========================================================= */

/* Global Touch & iPad Polish */
@media (hover: none) and (pointer: coarse), (max-width: 1100px) {
  /* Eliminate iOS Safari 300ms tap delay and tap grey rectangles */
  button, a, input, select, textarea,
  .subject-fast-card, .tcs-mcq-item, .tcs-msq-item,
  .tcs-p-btn, .pal-btn, .practice-opt-item, .mode-tile, .ana-tab-btn {
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation;
  }

  /* Prevent iOS Safari auto-zoom-on-focus */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Momentum smooth scrolling on iPadOS WebKit */
  .tcs-question-panel,
  .tcs-palette-grid-box,
  #practiceSingleQuestionContainer .q-scroll-area,
  .practice-topic-hud,
  .ana-table-wrap,
  .dashboard-container,
  .modern-scroll,
  .q-drawer {
    -webkit-overflow-scrolling: touch !important;
  }
}

/* iPad Safe Area Insets & Dynamic Viewport Height (100dvh) */
@media (max-width: 1150px) {
  body.practice-active #practiceView.dashboard-container,
  #practiceView.practice-interface-screen,
  #practiceView {
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
  }

  .tcs-interface {
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
  }

  /* Safe area padding for iPad home indicator bar & top status bar */
  .practice-bottom-bar,
  .tcs-bottom-bar {
    padding-bottom: max(0.6rem, env(safe-area-inset-bottom)) !important;
  }

  .app-navbar {
    padding-top: max(0.75rem, env(safe-area-inset-top)) !important;
    padding-left: max(1.25rem, env(safe-area-inset-left)) !important;
    padding-right: max(1.25rem, env(safe-area-inset-right)) !important;
  }

  /* iPad Calculator Sizing & Boundaries */
  .tcs-calc-modal {
    max-width: min(480px, calc(100vw - 24px)) !important;
    max-height: calc(100dvh - 30px) !important;
    touch-action: none;
  }

  #helptopDiv {
    touch-action: none !important;
    user-select: none;
    -webkit-user-select: none;
  }

  .tcs-calc-btn-header {
    min-height: 38px;
    padding: 0.35rem 0.75rem;
    font-size: 0.88rem;
  }
}

/* iPad 9th Gen Portrait & Tablet Portrait (< 920px) Responsive Architecture */
@media (max-width: 920px) {
  /* 1. TCS CBT Interface: Transform sidebar into an interactive slide-over drawer */
  .tcs-palette-toggle-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 0.35rem;
  }

  .tcs-main-body {
    position: relative;
    overflow: hidden;
    width: 100%;
  }

  .tcs-question-panel {
    width: 100% !important;
    flex: 1 1 100% !important;
    border-right: none !important;
    padding: 1rem 1.25rem 4.5rem 1.25rem !important;
  }

  .tcs-sidebar {
    position: absolute !important;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 86vw) !important;
    height: 100% !important;
    z-index: 1050 !important;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.3);
    border-left: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
  }

  .tcs-sidebar.drawer-open {
    transform: translateX(0) !important;
  }

  .tcs-sidebar-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1040;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .tcs-sidebar-backdrop.hidden {
    display: none;
  }

  .tcs-bottom-bar {
    height: auto !important;
    min-height: 56px;
    padding: 0.6rem 1rem max(0.6rem, env(safe-area-inset-bottom)) 1rem !important;
    gap: 0.6rem;
    overflow-x: auto;
  }

  .tcs-btn-action {
    padding: 0.6rem 0.95rem !important;
    font-size: 0.88rem !important;
    min-height: 42px;
  }

  /* 2. Practice Mode: Transform Topic HUD into an interactive slide-over drawer */
  .btn-hud-toggle {
    display: inline-flex !important;
  }

  #practiceView .modern-quiz-layout {
    position: relative !important;
    overflow: hidden !important;
    flex-direction: row !important;
    width: 100% !important;
  }

  #practiceView .modern-q-card {
    width: 100% !important;
    flex: 1 1 100% !important;
    border-right: none !important;
  }

  #practiceView .practice-topic-hud {
    position: absolute !important;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 86vw) !important;
    height: 100% !important;
    z-index: 50 !important;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.45);
    border-left: 1px solid var(--border-color) !important;
    max-height: none !important;
    background: var(--bg-card) !important;
  }

  #practiceView .practice-topic-hud.hud-open {
    transform: translateX(0) !important;
  }

  .practice-hud-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .practice-hud-backdrop.hidden {
    display: none;
  }

  .practice-bar {
    padding: 0 0.85rem !important;
    height: 52px !important;
    min-height: 52px !important;
  }

  .practice-breadcrumbs {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .practice-bottom-bar {
    height: auto !important;
    min-height: 58px;
    padding: 0.6rem 0.85rem max(0.6rem, env(safe-area-inset-bottom)) 0.85rem !important;
    gap: 0.5rem;
  }

  .practice-bottom-bar .btn-action {
    min-height: 44px;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
  }

  /* 3. Touch Friendly NAT Keypad for iPad */
  .tcs-nat-display {
    width: 100% !important;
    max-width: 280px !important;
    height: 44px !important;
    font-size: 1.25rem !important;
  }

  .tcs-nat-keypad {
    width: 100% !important;
    max-width: 280px !important;
    padding: 8px !important;
  }

  .tcs-nat-btn {
    height: 44px !important;
    font-size: 1.15rem !important;
  }

  .tcs-nat-btn-wide {
    height: 42px !important;
    font-size: 0.95rem !important;
  }

  /* 4. Touch Choices Sizing */
  .tcs-mcq-item, .tcs-msq-item {
    min-height: 48px;
    padding: 0.85rem 1rem;
    font-size: 1.05rem;
  }

  .tcs-p-btn {
    height: 42px !important;
    font-size: 0.95rem !important;
  }

  /* 5. Dashboard Hero & Grid on iPad Portrait */
  .master-hero-section {
    padding: 2rem 1.5rem !important;
  }

  .hero-cta-group {
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .hero-btn-primary, .hero-btn-secondary {
    min-height: 44px;
    padding: 0.75rem 1.25rem;
  }

  .subject-fast-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.85rem;
  }
}

/* iPad 9th Gen Landscape Specific Polish (811px to 1080px) */
@media (min-width: 921px) and (max-width: 1100px) {
  .tcs-sidebar {
    width: 280px !important;
  }

  #practiceView .practice-topic-hud {
    width: 280px !important;
  }

  .tcs-palette-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}


/* =========================================================
   PRACTICE v3: bright white theme, one-row legend, dropdown
   chapters/topics, compact footer with Star + Submit by Next
   ========================================================= */

body.practice-active #practiceView {
  --bg-primary: #ffffff;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-accent: rgba(79, 70, 229, 0.35);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --accent-indigo: #4f46e5;
  --accent-cyan: #0ea5e9;
  --accent-emerald: #16a34a;
  --accent-rose: #e11d48;
  --accent-amber: #d97706;
  --shadow-card: 0 4px 15px rgba(15, 23, 42, 0.06);
  background: #ffffff !important;
  color: var(--text-main);
}
#practiceView .practice-bar { background: #ffffff; box-shadow: 0 1px 0 #e2e8f0, 0 2px 8px rgba(15, 23, 42, 0.04); }
#practiceView .modern-q-card { background: #ffffff; }
#practiceView .practice-topic-hud { background: #f8fafc; border-left: 1px solid #e2e8f0; }
#practiceView .practice-palette-header,
#practiceView .practice-tree-header { background: #f1f5f9; }
#practiceView .btn-bar { background: #f1f5f9; }
#practiceView .btn-bar:hover { background: #e0e7ff; }
#practiceView .btn-bar-end { color: #be123c; background: #fff1f2; border-color: #fecdd3; }
#practiceView .btn-bar-end:hover { background: #e11d48; color: #fff; border-color: #e11d48; }
#practiceView .modern-quiz-actions { box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06); background: #ffffff; }
#practiceView .modern-opt-card { background: #ffffff; border: 1.5px solid #e2e8f0; }
#practiceView .modern-opt-card:hover { border-color: #818cf8; background: #f5f7ff; }
#practiceView .modern-opt-card.selected { border-color: #4f46e5; background: #eef2ff; }
#practiceView .q-body-content, #practiceView .q-title-text { color: #0f172a; }
#practiceView .pal-filter-select { background: #ffffff; }
#practiceView .practice-pal-btn { background: #f1f5f9; border: 1px solid #e2e8f0; color: #334155; }
#practiceView .practice-pal-btn.active { outline: 2px solid #4f46e5; outline-offset: 1px; }

/* Palette legend + stats: one row each */
#practiceView .practice-pal-legend {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.66rem;
  white-space: nowrap;
}
#practiceView .pal-legend-item { gap: 0.25rem; }
#practiceView .pal-legend-dot { width: 8px; height: 8px; }

/* Chapters & topics dropdown card */
#practiceView .practice-tree-container { flex: none; overflow: visible; background: #ffffff; }
#practiceView .practice-subject-tree { overflow: visible; padding: 0.8rem 0.85rem 1rem; gap: 0.75rem; }
.ct-field { display: flex; flex-direction: column; gap: 0.3rem; }
.ct-label { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.ct-select {
  width: 100%;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  color: #0f172a;
  padding: 0.55rem 2rem 0.55rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ct-select:hover { border-color: #818cf8; }
.ct-select:focus { outline: none; border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }
.ct-topic-row { display: flex; gap: 0.4rem; align-items: stretch; }
.ct-step {
  flex: none;
  width: 34px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  border-radius: 10px;
  font-size: 1.2rem;
  line-height: 1;
  color: #334155;
  cursor: pointer;
}
.ct-step:hover:not(:disabled) { border-color: #4f46e5; background: #eef2ff; color: #4f46e5; }
.ct-step:disabled { opacity: 0.35; cursor: default; }
.ct-progress { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 0.6rem 0.75rem; }
.ct-progress-top { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.72rem; color: #166534; margin-bottom: 0.4rem; }
.ct-progress-top strong { font-weight: 800; }
.ct-progress-track { height: 6px; background: #dcfce7; border-radius: 99px; overflow: hidden; }
.ct-progress-track i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); border-radius: 99px; transition: width 0.3s ease; }

/* Footer: Star on the left; Previous · Submit · Next kept together on the right */
#practiceView .practice-btn-right-group { gap: 0.5rem; }
#practiceView .btn-action-star {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  font-size: 0.84rem;
  font-weight: 700;
  height: 38px;
  padding: 0 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
#practiceView .btn-action-star:hover { background: #fef3c7; }
#practiceView .btn-action-star.active { background: #f59e0b; border-color: #d97706; color: #ffffff; }
#practiceView .btn-action-star .star-ico { font-size: 1rem; line-height: 1; }

@media (max-width: 720px) {
  #practiceView .modern-quiz-actions { height: auto; min-height: 58px; flex-wrap: wrap; padding: 0.5rem 0.75rem; gap: 0.5rem; }
  #practiceView .practice-btn-left-group, #practiceView .practice-btn-right-group { flex-wrap: wrap; }
}
