/* ========================================================
   THEORY PLUS AI - ISRAELI DRIVING THEORY MASTER SYSTEM
   High-End Modern Dark/Light Theme with Glassmorphism & Animations
   ======================================================== */

:root {
  /* Fonts */
  --font-main: 'Heebo', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Rubik', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Dark Theme Palette (Default) */
  --bg-primary: #0A0D14;
  --bg-secondary: #101622;
  --bg-tertiary: #182133;
  --bg-card: rgba(22, 30, 46, 0.85);
  --bg-card-hover: rgba(28, 38, 58, 0.95);
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --border-focus: rgba(0, 210, 255, 0.6);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  /* Inset / Subtle backgrounds for code, features, explanations */
  --bg-inset: rgba(0, 0, 0, 0.25);
  --bg-inset-border: rgba(255, 255, 255, 0.08);

  /* Accents */
  --accent-cyan: #00D2FF;
  --accent-blue: #0077FF;
  --accent-green: #10B981;
  --accent-emerald: #059669;
  --accent-amber: #F59E0B;
  --accent-red: #EF4444;
  --accent-purple: #8B5CF6;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #00D2FF 0%, #0077FF 100%);
  --grad-accent-warm: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
  --grad-pass: linear-gradient(135deg, #10B981 0%, #059669 100%);
  --grad-fail: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%);
  --grad-hero: linear-gradient(135deg, rgba(0, 210, 255, 0.12) 0%, rgba(0, 119, 255, 0.06) 100%);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow-cyan: 0 0 24px rgba(0, 210, 255, 0.25);
  --shadow-glow-green: 0 0 24px rgba(16, 185, 129, 0.25);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========================================================
   LIGHT THEME (Day Mode - Crisp, High Contrast, Flawless)
   ======================================================== */
[data-theme="light"] {
  --bg-primary: #F1F5F9;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #E2E8F0;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --border-subtle: #E2E8F0;
  --border-strong: #CBD5E1;
  --border-focus: rgba(0, 119, 255, 0.6);

  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;

  --bg-inset: #F8FAFC;
  --bg-inset-border: #E2E8F0;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
  --shadow-glow-cyan: 0 0 20px rgba(0, 119, 255, 0.18);
  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.18);
}

/* ========================================================
   BASE RESET
   ======================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  text-align: right;
  transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 210, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(0, 119, 255, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
}

[data-theme="light"] body {
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 119, 255, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(16, 185, 129, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

p, span, li, button, input {
  text-align: right;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
  transition: var(--transition);
}

input {
  font-family: inherit;
  outline: none;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* ========================================================
   HEADER & NAVIGATION
   ======================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

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

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  user-select: none;
}

.brand-logo-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: 0;
}

.app-brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.auth-brand-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  background: transparent;
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text-primary);
}

.text-accent {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
}

.brand-tagline {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-tertiary);
  padding: 0.35rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  position: relative;
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .nav-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-tab-btn.active {
  color: #FFFFFF !important;
  background: var(--grad-primary) !important;
  box-shadow: var(--shadow-glow-cyan);
}

.badge-new-pulse {
  font-size: 0.65rem;
  background: var(--accent-green);
  color: #fff;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  font-weight: 800;
  animation: pulse-badge 1.8s infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* User Profile Widget in Header */
.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.user-profile-widget:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.user-avatar-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-greeting {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.user-age-pill {
  font-size: 0.68rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

[data-theme="light"] .user-age-pill {
  color: var(--accent-blue);
}

.readiness-pill-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
}

.ctrl-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 1.1rem;
}

.ctrl-btn:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

/* ========================================================
   MAIN CONTENT WRAPPER & TAB SWITCHING
   ======================================================== */
.app-main-content {
  max-width: 1400px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
}

.tab-view {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

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

/* ========================================================
   TAB 1: SIGNS CATALOG STYLES
   ======================================================== */
.signs-hero-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1.8rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.signs-hero-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad-primary);
}

.hero-heading {
  font-size: 2rem;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 680px;
}

.hero-actions {
  display: flex;
  gap: 0.8rem;
  flex-shrink: 0;
}

.btn-hero-primary {
  background: var(--grad-primary);
  color: #FFFFFF !important;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--shadow-glow-cyan);
}

.btn-hero-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-hero-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
}

.btn-hero-secondary:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

/* Toolbar */
.signs-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.search-input-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--text-muted);
}

.search-input-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 3.2rem 1rem 1.5rem;
  font-size: 1.05rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  text-align: right;
}

.search-input-box input::placeholder {
  color: var(--text-muted);
}

.search-input-box input:focus {
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-glow-cyan);
}

.category-chips-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.cat-filter-chip {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.cat-filter-chip:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.cat-filter-chip.active {
  background: var(--accent-cyan);
  color: #0A0D14;
  border-color: var(--accent-cyan);
  font-weight: 800;
}

[data-theme="light"] .cat-filter-chip.active {
  background: var(--accent-blue);
  color: #FFFFFF;
  border-color: var(--accent-blue);
}

.signs-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.signs-count {
  font-weight: 700;
  color: var(--text-primary);
}

/* Signs Grid */
.signs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.3rem;
}

.sign-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.sign-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.sign-fav-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-size: 1.3rem;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-inset);
}

.sign-fav-btn:hover {
  color: var(--accent-amber);
  transform: scale(1.15);
}

.sign-fav-btn.is-fav {
  color: var(--accent-amber);
}

/* ========================================================
   REAL SIGN IMAGES FROM TAMRURIM.CO.IL
   ======================================================== */
.sign-img-wrapper {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem 0 1rem;
  position: relative;
}

.sign-real-img {
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25));
  transition: transform 0.25s ease;
  border-radius: 4px;
}

.sign-img-card {
  max-height: 100px;
  max-width: 110px;
}

.sign-img-modal {
  max-height: 160px;
  max-width: 180px;
}

.sign-img-flashcard {
  max-height: 130px;
  max-width: 140px;
}

.sign-card:hover .sign-real-img {
  transform: scale(1.1);
}

.sign-svg-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Keep old SVG wrapper for backwards compat */
.sign-svg-wrapper {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem 0 1rem;
}

.sign-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.sign-id-badge {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(0, 210, 255, 0.12);
  color: var(--accent-cyan);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

[data-theme="light"] .sign-id-badge {
  color: var(--accent-blue);
  background: rgba(0, 119, 255, 0.1);
}

.sign-cat-mini {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.sign-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.sign-card-snippet {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.signs-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px dashed var(--border-subtle);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ========================================================
   TAB 2: EXAM SIMULATOR STYLES
   ======================================================== */
.exam-hub-card {
  max-width: 1000px;
  margin: 0 auto;
}

.hub-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hub-title {
  font-size: 2.3rem;
  margin-bottom: 0.6rem;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hub-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 700px;
  margin: 0 auto;
}

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

.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.mode-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.mode-badge {
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  font-size: 0.75rem;
  font-weight: 800;
  background: rgba(0, 210, 255, 0.15);
  color: var(--accent-cyan);
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
}

[data-theme="light"] .mode-badge {
  color: var(--accent-blue);
  background: rgba(0, 119, 255, 0.1);
}

.badge-green {
  background: rgba(16, 185, 129, 0.15) !important;
  color: var(--accent-green) !important;
}

.badge-purple {
  background: rgba(139, 92, 246, 0.15) !important;
  color: var(--accent-purple) !important;
}

.mode-icon {
  font-size: 2.8rem;
  margin-bottom: 1.2rem;
}

.mode-name {
  font-size: 1.35rem;
  margin-bottom: 0.7rem;
  color: var(--text-primary);
}

.mode-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  flex-grow: 1;
  line-height: 1.4;
}

.mode-features {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  background: var(--bg-inset);
  border: 1px solid var(--bg-inset-border);
  padding: 0.8rem;
  border-radius: var(--radius-md);
}

.btn-start-mode {
  width: 100%;
  background: var(--grad-primary);
  color: #FFFFFF !important;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--shadow-glow-cyan);
}

.btn-mode-easy {
  background: var(--grad-pass) !important;
}

.btn-mode-mistakes {
  background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%) !important;
}

/* Active Exam View */
.exam-active-card {
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.2rem;
  box-shadow: var(--shadow-lg);
}

.exam-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.exam-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.exam-badge-tag {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
}

.exam-q-counter {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.exam-cat-pill {
  font-size: 0.8rem;
  background: rgba(0, 210, 255, 0.12);
  color: var(--accent-cyan);
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  font-weight: 700;
}

[data-theme="light"] .exam-cat-pill {
  color: var(--accent-blue);
  background: rgba(0, 119, 255, 0.1);
}

.exam-timer-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
}

.timer-warning {
  animation: pulse-timer 1s infinite alternate;
}

@keyframes pulse-timer {
  from { background: rgba(239, 68, 68, 0.15); }
  to { background: rgba(239, 68, 68, 0.4); transform: scale(1.05); }
}

.exam-easy-badge {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
}

.exam-progress-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  margin-bottom: 1.8rem;
  overflow: hidden;
}

.exam-progress-fill {
  height: 100%;
  background: var(--grad-primary);
  transition: width 0.3s ease;
}

/* Question Body */
.exam-body-grid.has-sign {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1.8rem;
  align-items: start;
}

.exam-sign-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.exam-sign-frame {
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  width: 100%;
}

.exam-sign-frame svg {
  max-width: 120px;
  max-height: 120px;
}

.sign-frame-caption {
  margin-top: 0.6rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-cyan);
}

[data-theme="light"] .sign-frame-caption {
  color: var(--accent-blue);
}

.exam-question-title {
  font-size: 1.35rem;
  margin-bottom: 1.5rem;
  line-height: 1.4;
  color: var(--text-primary);
  text-align: right;
}

.exam-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.exam-option-btn {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  text-align: right;
  color: var(--text-primary);
  font-size: 0.98rem;
  line-height: 1.4;
  transition: var(--transition);
}

.exam-option-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  transform: translateX(-4px);
}

.exam-option-btn.selected {
  background: rgba(0, 210, 255, 0.12) !important;
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.2);
}

[data-theme="light"] .exam-option-btn.selected {
  background: rgba(0, 119, 255, 0.1) !important;
  border-color: var(--accent-blue) !important;
}

.exam-option-btn.correct-reveal {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: var(--accent-green) !important;
  color: var(--accent-green) !important;
}

.exam-option-btn.incorrect-reveal {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: var(--accent-red) !important;
  color: var(--accent-red) !important;
}

.opt-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.exam-option-btn.selected .opt-num {
  background: var(--accent-cyan);
  color: #0A0D14;
}

.opt-text {
  flex-grow: 1;
  color: var(--text-primary);
}

.exam-instant-feedback {
  display: flex;
  gap: 1rem;
  padding: 1.2rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.feedback-correct {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
}

.feedback-incorrect {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

.fb-explanation {
  margin-top: 0.4rem;
  color: var(--text-primary);
  font-size: 0.92rem;
  line-height: 1.4;
}

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

.hint-text {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 0.8rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 1.2rem;
}

.hint-text.hidden {
  display: none;
}

/* Question Matrix Dots */
.exam-nav-matrix-wrap {
  margin: 1.5rem 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border-subtle);
}

.matrix-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

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

.matrix-dot {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.matrix-dot:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}

.matrix-dot.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

.matrix-dot.answered {
  background: rgba(0, 210, 255, 0.18);
  color: var(--accent-cyan);
  font-weight: 800;
}

[data-theme="light"] .matrix-dot.answered {
  background: rgba(0, 119, 255, 0.15);
  color: var(--accent-blue);
}

.matrix-dot.flagged {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

/* Actions Footer */
.exam-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.exam-left-actions {
  display: flex;
  gap: 0.6rem;
}

.btn-exam-flag {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-exam-flag.flagged {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border-color: var(--accent-amber);
}

.btn-ask-ai-this {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-purple);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
}

.exam-nav-buttons {
  display: flex;
  gap: 0.6rem;
}

.btn-exam-nav {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.92rem;
}

.btn-exam-nav:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.btn-next {
  background: var(--grad-primary);
  color: #FFFFFF !important;
  border: none;
}

.btn-exam-submit {
  background: var(--grad-pass);
  color: #FFFFFF !important;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: var(--shadow-glow-green);
}

/* Exam Results Screen */
.exam-results-card {
  max-width: 900px;
  margin: 0 auto;
}

.result-banner {
  padding: 2.5rem;
  border-radius: var(--radius-xl);
  text-align: center;
  color: #FFFFFF;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
}

.banner-pass {
  background: var(--grad-pass);
}

.banner-fail {
  background: var(--grad-fail);
}

.result-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.result-title {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  color: #FFFFFF !important;
}

.result-subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 650px;
  margin: 0 auto;
  color: #FFFFFF !important;
  line-height: 1.4;
}

.result-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.res-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}

.res-val {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  display: block;
}

.val-danger {
  color: var(--accent-red);
}

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

.result-actions-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.btn-res-action {
  flex: 1;
  padding: 1rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
}

.btn-retake {
  background: var(--grad-primary);
  color: #FFFFFF !important;
}

.btn-easy {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.btn-mistakes {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: var(--accent-purple);
}

.result-review-section h3 {
  font-size: 1.4rem;
  margin-bottom: 1.2rem;
  color: var(--text-primary);
}

.review-questions-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.review-q-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.rev-correct {
  border-right: 5px solid var(--accent-green);
}

.rev-incorrect {
  border-right: 5px solid var(--accent-red);
}

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

.rev-num {
  font-weight: 800;
  color: var(--text-muted);
}

.rev-status {
  font-weight: 700;
  font-size: 0.9rem;
}

.rev-correct .rev-status { color: var(--accent-green); }
.rev-incorrect .rev-status { color: var(--accent-red); }

.rev-content-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: start;
}

.rev-sign-wrap svg {
  max-width: 90px;
  max-height: 90px;
}

.rev-q-text {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.rev-options {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.rev-opt {
  display: flex;
  gap: 0.6rem;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.is-correct-answer {
  background: rgba(16, 185, 129, 0.15) !important;
  color: var(--accent-green) !important;
  font-weight: 700;
}

.is-user-wrong {
  background: rgba(239, 68, 68, 0.15) !important;
  color: var(--accent-red) !important;
  font-weight: 700;
}

.rev-explanation {
  background: var(--bg-inset);
  border: 1px solid var(--bg-inset-border);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ========================================================
   TAB 3: AI THEORY TUTOR STYLES
   ======================================================== */
.ai-view-layout {
  max-width: 950px;
  margin: 0 auto;
}

.ai-chat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  height: 75vh;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.ai-header-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.8rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.ai-avatar-wrap {
  position: relative;
}

.ai-bot-face {
  font-size: 2.2rem;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 210, 255, 0.15);
  border-radius: var(--radius-md);
}

.ai-online-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: var(--accent-green);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.ai-title-wrap h2 {
  font-size: 1.25rem;
  color: var(--text-primary);
}

.ai-title-wrap p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ai-chat-messages {
  flex-grow: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  background: var(--bg-card);
}

.ai-msg {
  display: flex;
  gap: 0.8rem;
  max-width: 85%;
  animation: fadeIn 0.25s ease;
}

.ai-msg-bot {
  align-self: flex-start;
}

.ai-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.bot-avatar, .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.ai-msg-user .msg-bubble {
  background: var(--grad-primary);
  color: #FFFFFF !important;
  border-radius: 18px 4px 18px 18px;
  padding: 0.85rem 1.2rem;
}

.ai-msg-bot .msg-bubble {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px 18px 18px 18px;
  padding: 1.2rem 1.4rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.ai-quick-triggers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.ai-chip-btn {
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.25);
  color: var(--accent-cyan);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}

[data-theme="light"] .ai-chip-btn {
  color: var(--accent-blue);
  border-color: rgba(0, 119, 255, 0.3);
  background: rgba(0, 119, 255, 0.08);
}

.ai-chip-btn:hover {
  background: var(--accent-cyan);
  color: #0A0D14;
  transform: translateY(-2px);
}

/* AI Sign Card rendered in Chat */
.ai-sign-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 0.5rem 0;
  box-shadow: var(--shadow-md);
  text-align: right;
}

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

.ai-sign-badge {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

[data-theme="light"] .ai-sign-badge {
  color: var(--accent-blue);
}

.ai-sign-cat {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ai-sign-body {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.2rem;
}

.ai-sign-visual svg {
  max-width: 120px;
  max-height: 120px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.ai-sign-title {
  font-size: 1.25rem;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.ai-sign-section {
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
}

.sec-label {
  font-weight: 700;
  color: var(--text-secondary);
  display: inline-block;
  margin-left: 0.4rem;
}

.law-text {
  color: var(--accent-amber);
  font-weight: 700;
}

.ai-sign-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

.ai-sign-tip {
  display: flex;
  gap: 0.8rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.tip-icon {
  font-size: 1.4rem;
}

.ai-sign-actions {
  display: flex;
  gap: 0.8rem;
}

.btn-voice-read {
  background: rgba(0, 210, 255, 0.15);
  border: 1px solid rgba(0, 210, 255, 0.3);
  color: var(--accent-cyan);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
}

[data-theme="light"] .btn-voice-read {
  color: var(--accent-blue);
  background: rgba(0, 119, 255, 0.1);
  border-color: rgba(0, 119, 255, 0.3);
}

.btn-practice-sign {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
}

/* Comparison Card in AI */
.ai-comparison-card {
  padding: 0.5rem;
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin: 1rem 0;
}

.comp-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  text-align: center;
  color: var(--text-primary);
}

.comp-svg-wrap svg {
  max-width: 80px;
  max-height: 80px;
  margin-bottom: 0.8rem;
}

.comp-box ul {
  text-align: right;
  margin-top: 0.8rem;
  font-size: 0.85rem;
  list-style: none;
}

.comp-box li {
  margin-bottom: 0.4rem;
}

.badge-highlight {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
}

/* Speed Table in AI */
.speed-table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

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

.speed-table th, .speed-table td {
  padding: 0.65rem 0.9rem;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.speed-badge {
  background: rgba(0, 210, 255, 0.15);
  color: var(--accent-cyan);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-weight: 800;
}

[data-theme="light"] .speed-badge {
  color: var(--accent-blue);
  background: rgba(0, 119, 255, 0.1);
}

/* Hierarchy List */
.hierarchy-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.hierarchy-list li {
  display: flex;
  gap: 0.8rem;
  background: var(--bg-inset);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  align-items: flex-start;
}

.step-num {
  width: 28px;
  height: 28px;
  background: var(--grad-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.formula-box {
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin: 1rem 0;
  text-align: center;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.styled-list {
  list-style-position: inside;
  color: var(--text-primary);
}

.styled-list li {
  margin-bottom: 0.5rem;
}

/* Typing Dots */
.typing-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  margin: 0 2px;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Chat Input Bar */
.ai-chat-input-bar {
  display: flex;
  gap: 0.8rem;
  padding: 1.2rem 1.8rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

.ai-chat-input-bar input {
  flex-grow: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  padding: 0.85rem 1.5rem;
  color: var(--text-primary);
  font-size: 0.98rem;
  text-align: right;
}

.ai-chat-input-bar input::placeholder {
  color: var(--text-muted);
}

.ai-chat-input-bar input:focus {
  border-color: var(--accent-cyan);
}

.btn-ai-send {
  background: var(--grad-primary);
  color: #FFFFFF !important;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-glow-cyan);
}

.btn-ai-send:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.send-arrow {
  transform: rotate(180deg);
}

/* ========================================================
   TAB 4: STUDY TOPICS STYLES
   ======================================================== */
.learn-hero-card {
  text-align: center;
  margin-bottom: 2.5rem;
}

.learn-hero-card h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.learn-hero-card p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

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

.learn-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

.learn-card-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.learn-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.learn-card p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.learn-bullets {
  list-style-position: inside;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.learn-bullets li {
  margin-bottom: 0.5rem;
}

.btn-learn-ask {
  background: rgba(0, 210, 255, 0.12);
  border: 1px solid rgba(0, 210, 255, 0.3);
  color: var(--accent-cyan);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
}

[data-theme="light"] .btn-learn-ask {
  color: var(--accent-blue);
  background: rgba(0, 119, 255, 0.08);
  border-color: rgba(0, 119, 255, 0.25);
}

.btn-learn-ask:hover {
  background: var(--accent-cyan);
  color: #0A0D14;
}

/* ========================================================
   TAB 5: STATS & READINESS DASHBOARD
   ======================================================== */
.stats-dashboard {
  max-width: 1000px;
  margin: 0 auto;
}

.gauge-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.gauge-tag {
  background: rgba(0, 210, 255, 0.15);
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-bottom: 0.8rem;
}

[data-theme="light"] .gauge-tag {
  color: var(--accent-blue);
  background: rgba(0, 119, 255, 0.1);
}

.gauge-hero-card h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.gauge-hero-card p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 1.8rem;
}

.gauge-progress-bar-wrap {
  width: 100%;
  max-width: 500px;
  height: 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  margin: 0 auto 1.5rem;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.gauge-progress-fill {
  height: 100%;
  background: var(--grad-primary);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-glow-cyan);
}

.big-score {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--accent-cyan);
  display: block;
  line-height: 1;
}

[data-theme="light"] .big-score {
  color: var(--accent-blue);
}

.score-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  text-align: center;
}

.kpi-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.kpi-val {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-primary);
}

.kpi-label {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.history-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
}

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

.btn-history-clear {
  color: var(--accent-red);
  font-size: 0.85rem;
  font-weight: 600;
}

.table-responsive {
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.history-table th, .history-table td {
  padding: 0.85rem 1rem;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.history-table th {
  color: var(--text-muted);
  font-weight: 600;
}

.badge-status {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-pass {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.badge-fail {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.empty-table-td {
  text-align: center !important;
  padding: 2.5rem !important;
  color: var(--text-muted);
}

/* ========================================================
   MODALS & AUTH
   ======================================================== */
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none !important;
  visibility: hidden !important;
  transition: opacity 0.25s ease;
}

.app-modal.open {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  color: var(--text-primary);
}

.modal-close-btn {
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  font-size: 1.3rem;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
}

.modal-close-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

.sign-modal-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.modal-sign-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.modal-sign-svg svg {
  max-width: 170px;
  max-height: 170px;
  margin-bottom: 1.2rem;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}

.modal-sign-tags {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  margin-bottom: 1.2rem;
}

.badge-sign-lg {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(0, 210, 255, 0.12);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
}

[data-theme="light"] .badge-sign-lg {
  color: var(--accent-blue);
  background: rgba(0, 119, 255, 0.1);
}

.badge-cat-lg {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.btn-modal-fav {
  width: 100%;
  padding: 0.6rem;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
}

.btn-modal-fav.active {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border-color: var(--accent-amber);
}

.modal-sign-title {
  font-size: 1.6rem;
  margin-bottom: 1.2rem;
  line-height: 1.3;
  color: var(--text-primary);
}

.modal-detail-block {
  margin-bottom: 1.2rem;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.block-title {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.highlight-block {
  background: rgba(0, 210, 255, 0.08);
  border-right: 4px solid var(--accent-cyan);
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-md);
}

[data-theme="light"] .highlight-block {
  border-right-color: var(--accent-blue);
  background: rgba(0, 119, 255, 0.06);
}

.tip-block {
  background: rgba(245, 158, 11, 0.1);
  border-right: 4px solid var(--accent-amber);
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-md);
}

.modal-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.8rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-ask-ai-sign {
  background: var(--grad-primary);
  color: #FFFFFF !important;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  box-shadow: var(--shadow-glow-cyan);
}

.btn-voice-sign {
  background: rgba(0, 210, 255, 0.15);
  border: 1px solid rgba(0, 210, 255, 0.3);
  color: var(--accent-cyan);
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 700;
}

[data-theme="light"] .btn-voice-sign {
  color: var(--accent-blue);
  background: rgba(0, 119, 255, 0.1);
}

/* ========================================================
   AUTHENTICATION MODAL STYLES
   ======================================================== */
.auth-modal-dialog {
  max-width: 520px;
  padding: 2.5rem;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-brand-logo {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.auth-title {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

.auth-subtitle {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 1.5rem;
}

.auth-tabs-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  padding: 0.3rem;
  border: 1px solid var(--border-subtle);
}

.auth-tab-btn {
  flex: 1;
  padding: 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
}

.auth-tab-btn.active {
  background: var(--grad-primary);
  color: #FFFFFF !important;
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: right;
}

.auth-field label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  right: 1rem;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.auth-input-wrap input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.85rem 3rem 0.85rem 1rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  text-align: right;
}

.auth-input-wrap input:focus {
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-glow-cyan);
}

.auth-age-calc-badge {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 0.5rem;
  line-height: 1.4;
}

.btn-auth-submit {
  background: var(--grad-primary);
  color: #FFFFFF !important;
  padding: 0.95rem;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: var(--shadow-glow-cyan);
  margin-top: 0.5rem;
}

.btn-auth-submit:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

/* ========================================================
   IN-APP CUSTOM DIALOG MODAL (Confirm / Alert)
   ======================================================== */
.app-dialog-box {
  max-width: 460px;
  text-align: center;
  padding: 2.2rem;
}

.dialog-icon-wrap {
  font-size: 3.2rem;
  margin-bottom: 0.8rem;
}

.dialog-title {
  font-size: 1.4rem;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.dialog-message {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.8rem;
  white-space: pre-line;
}

.dialog-actions-row {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
}

.btn-dialog-confirm {
  background: var(--grad-primary);
  color: #FFFFFF !important;
  padding: 0.75rem 1.8rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 110px;
}

.btn-dialog-cancel {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 90px;
}

/* Toast Notifications */
.app-toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.app-toast {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.92rem;
  font-weight: 600;
  animation: slideToast 0.3s ease;
  pointer-events: auto;
}

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

.toast-success { border-right: 4px solid var(--accent-green); }
.toast-error { border-right: 4px solid var(--accent-red); }
.toast-info { border-right: 4px solid var(--accent-cyan); }

/* ========================================================
   FLASHCARDS MODAL
   ======================================================== */
.modal-flashcard-dialog {
  max-width: 580px;
  text-align: center;
}

.fc-modal-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.flashcard-3d-wrapper {
  perspective: 1200px;
  width: 100%;
  height: 380px;
  cursor: pointer;
  margin-bottom: 1.8rem;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  transform-style: preserve-3d;
}

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

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}

.flashcard-front {
  background: var(--bg-card);
}

.flashcard-back {
  background: var(--bg-tertiary);
  transform: rotateY(180deg);
}

.fc-svg-wrap svg {
  max-width: 140px;
  max-height: 140px;
  margin-bottom: 1.2rem;
}

.fc-number {
  font-size: 1.4rem;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
}

[data-theme="light"] .fc-number {
  color: var(--accent-blue);
}

.fc-tap-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.fc-back-title {
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.fc-back-body {
  font-size: 0.95rem;
  text-align: right;
  margin-bottom: 1.2rem;
  color: var(--text-primary);
}

.fc-back-body p {
  margin-bottom: 0.5rem;
}

.fc-back-tip {
  background: rgba(245, 158, 11, 0.15);
  border-radius: var(--radius-md);
  padding: 0.8rem;
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: var(--accent-amber);
}

.flashcard-controls {
  display: flex;
  gap: 1rem;
}

.btn-fc-action {
  flex: 1;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
}

.btn-fc-review {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

.btn-fc-know {
  background: var(--grad-pass);
  color: #FFFFFF !important;
}

/* ========================================================
   RESPONSIVE DESIGN
   ======================================================== */
@media (max-width: 900px) {
  .header-container {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .nav-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .signs-hero-card {
    flex-direction: column;
    text-align: center;
  }

  .hero-actions {
    width: 100%;
    flex-direction: column;
  }

  .sign-modal-layout {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1.2rem;
  }

  .modal-sign-hero {
    height: auto !important;
    min-height: auto !important;
    margin-bottom: 1rem;
  }

  .exam-body-grid.has-sign {
    grid-template-columns: 1fr;
  }

  .exam-sign-column {
    margin-bottom: 1rem;
  }

  .result-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-actions-row {
    flex-direction: column;
  }

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

@media (max-width: 600px) {
  .signs-grid {
    grid-template-columns: 1fr;
  }

  .exam-top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .exam-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .exam-nav-buttons {
    width: 100%;
  }

  .exam-nav-buttons button {
    flex: 1;
  }

  .ai-chat-card {
    height: 80vh;
  }
}

/* ========================================================
   LIGHT THEME COMPREHENSIVE TEXT & UI FIXES
   Ensures all text is readable in day mode
   ======================================================== */
[data-theme="light"] {
  /* Force all primary text to be dark */
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
}

[data-theme="light"] body,
[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] h5,
[data-theme="light"] h6,
[data-theme="light"] p,
[data-theme="light"] span,
[data-theme="light"] li {
  color: var(--text-primary);
}

[data-theme="light"] .sign-card-title,
[data-theme="light"] .sign-card-snippet,
[data-theme="light"] .sign-card-meta,
[data-theme="light"] .sign-cat-mini {
  color: var(--text-secondary);
}

[data-theme="light"] .sign-card {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .sign-card:hover {
  background: #F8FAFC;
  border-color: var(--accent-blue);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

/* Header & Nav in light mode */
[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: #E2E8F0;
}

[data-theme="light"] .nav-tabs {
  background: #F1F5F9;
  border-color: #E2E8F0;
}

[data-theme="light"] .nav-tab-btn {
  color: #334155;
}

[data-theme="light"] .nav-tab-btn:hover {
  background: rgba(0, 119, 255, 0.08);
  color: var(--accent-blue);
}

[data-theme="light"] .brand-title {
  color: #0F172A;
}

[data-theme="light"] .brand-tagline {
  color: #64748B;
}

/* Auth modal in light mode */
[data-theme="light"] .auth-card-wrapper {
  background: #FFFFFF;
  color: #0F172A;
}

[data-theme="light"] .auth-title,
[data-theme="light"] .auth-subtitle {
  color: #0F172A;
}

[data-theme="light"] .auth-field label {
  color: #334155;
}

[data-theme="light"] .auth-input-wrap input {
  background: #F8FAFC;
  border-color: #CBD5E1;
  color: #0F172A;
}

[data-theme="light"] .auth-input-wrap input::placeholder {
  color: #94A3B8;
}

/* Hero and section text in light mode */
[data-theme="light"] .hero-heading,
[data-theme="light"] .hero-desc {
  color: #0F172A;
}

[data-theme="light"] .signs-hero-card {
  background: linear-gradient(135deg, rgba(0, 119, 255, 0.06) 0%, rgba(16, 185, 129, 0.04) 100%);
  border-color: rgba(0, 119, 255, 0.15);
}

/* Exam cards in light mode */
[data-theme="light"] .mode-card {
  background: #FFFFFF;
  border-color: #E2E8F0;
}

[data-theme="light"] .mode-card:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .mode-name,
[data-theme="light"] .mode-desc {
  color: #0F172A;
}

/* Stats cards in light mode */
[data-theme="light"] .kpi-card,
[data-theme="light"] .gauge-hero-card,
[data-theme="light"] .history-table-card {
  background: #FFFFFF;
  border-color: #E2E8F0;
  color: #0F172A;
}

[data-theme="light"] .kpi-val,
[data-theme="light"] .kpi-label {
  color: #0F172A;
}

/* AI chat in light mode */
[data-theme="light"] .ai-chat-card {
  background: #FFFFFF;
  border-color: #E2E8F0;
}

[data-theme="light"] .ai-chat-messages {
  background: #F8FAFC;
}

[data-theme="light"] .ai-title-wrap h2,
[data-theme="light"] .ai-title-wrap p {
  color: #0F172A;
}

/* Learn cards in light mode */
[data-theme="light"] .learn-card {
  background: #FFFFFF;
  border-color: #E2E8F0;
}

[data-theme="light"] .learn-card h3,
[data-theme="light"] .learn-card p,
[data-theme="light"] .learn-card li {
  color: #334155;
}

/* Modal in light mode */
[data-theme="light"] .modal-dialog {
  background: #FFFFFF;
}

[data-theme="light"] .modal-sign-title,
[data-theme="light"] .modal-detail-block p,
[data-theme="light"] .block-title {
  color: #0F172A;
}

[data-theme="light"] .modal-detail-block {
  background: #F8FAFC;
  border-color: #E2E8F0;
}

/* Toast in light mode */
[data-theme="light"] .app-toast {
  background: #1E293B;
  color: #F8FAFC;
}

/* User profile widget */
[data-theme="light"] .user-profile-widget {
  background: #F1F5F9;
  border-color: #E2E8F0;
}

[data-theme="light"] .user-greeting {
  color: #0F172A;
}

/* Flashcard in light mode */
[data-theme="light"] .flashcard-face {
  background: #FFFFFF;
  color: #0F172A;
}

[data-theme="light"] .flashcard-face.flashcard-back {
  background: linear-gradient(135deg, #EFF6FF 0%, #F0FDF4 100%);
}

[data-theme="light"] .fc-back-title,
[data-theme="light"] .fc-number {
  color: #0F172A;
}

/* Exam questions in light mode */
[data-theme="light"] .exam-question-card {
  background: #FFFFFF;
  color: #0F172A;
}

[data-theme="light"] .question-text {
  color: #0F172A;
}

[data-theme="light"] .option-btn {
  background: #F8FAFC;
  border-color: #E2E8F0;
  color: #334155;
}

[data-theme="light"] .option-btn:hover {
  border-color: var(--accent-blue);
  background: rgba(0, 119, 255, 0.05);
  color: #0F172A;
}

/* History table */
[data-theme="light"] .history-table th,
[data-theme="light"] .history-table td {
  color: #334155;
  border-color: #E2E8F0;
}

[data-theme="light"] .history-table tr:hover td {
  background: #F8FAFC;
}

/* Signs toolbar in light mode */
[data-theme="light"] .signs-toolbar {
  background: #FFFFFF;
  border-color: #E2E8F0;
}

[data-theme="light"] .search-input-box {
  background: #F8FAFC;
  border-color: #CBD5E1;
}

[data-theme="light"] .search-input-box input {
  color: #0F172A;
}

[data-theme="light"] .cat-filter-chip {
  color: #334155;
  border-color: #E2E8F0;
  background: #F8FAFC;
}

[data-theme="light"] .cat-filter-chip:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

[data-theme="light"] .cat-filter-chip.active {
  background: var(--grad-primary);
  color: #FFFFFF !important;
  border-color: transparent;
}

/* ========================================================
   HARDENED SECURITY & ANTI-THEFT PROTECTION STYLES
   Blocks text copying, dragging, image downloading, and printing
   WITHOUT interfering with normal mouse clicks and touches
   ======================================================== */
*, *::before, *::after {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input, textarea, [contenteditable="true"] {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

img, svg, picture, canvas {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  pointer-events: auto;
}

/* Ensure ALL buttons, cards, options, inputs, badges and links receive mouse clicks flawlessly */
button, a, input, textarea, select, .sign-card, .mode-card, .cat-filter-chip, 
.nav-tab-btn, .exam-option-btn, .modal-close-btn, .sign-img-wrapper,
.opt-text, .opt-num, .btn-start-mode, .btn-hero-primary, .btn-hero-secondary,
.brand-area, .user-profile-badge, .auth-tab-btn, .btn-auth-submit, .btn-dialog-confirm, .btn-dialog-cancel,
.flashcard, .fc-action-btn, .theme-toggle-btn, .sound-toggle-btn {
  pointer-events: auto !important;
  cursor: pointer;
}

.app-modal:not(.open) {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Print blocker */
@media print {
  html, body {
    display: none !important;
    visibility: hidden !important;
  }
}

/* Security and Legal Notice Footer Bar */
.legal-security-footer {
  margin-top: 60px;
  padding: 24px 20px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.legal-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.legal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
}

.legal-pill-warn {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

.legal-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 800px;
  line-height: 1.6;
}

.legal-btn-link {
  color: var(--accent-cyan);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ========================================================
   CREATOR STRIP (פס נוצר על ידי ליאב)
   ======================================================== */
.creator-bottom-bar {
  width: 100%;
  margin-top: 16px;
  padding: 12px 20px;
  background: linear-gradient(90deg, rgba(10, 13, 20, 0.6) 0%, rgba(24, 33, 51, 0.95) 50%, rgba(10, 13, 20, 0.6) 100%);
  border: 1px solid rgba(0, 210, 255, 0.3);
  border-radius: var(--radius-full);
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 210, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.creator-bottom-bar span {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #00D2FF 0%, #FFFFFF 50%, #0077FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 18px rgba(0, 210, 255, 0.4);
}

[data-theme="light"] .creator-bottom-bar {
  background: linear-gradient(90deg, #F8FAFC 0%, #FFFFFF 50%, #F8FAFC 100%);
  border-color: rgba(0, 119, 255, 0.3);
  box-shadow: 0 4px 15px rgba(0, 119, 255, 0.1);
}

[data-theme="light"] .creator-bottom-bar span {
  background: linear-gradient(135deg, #0077FF 0%, #0F172A 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.creator-admin-link {
  margin-right: 12px;
  font-size: 0.85rem;
  opacity: 0.35;
  transition: all 0.2s ease;
  text-decoration: none;
  cursor: pointer;
}

.creator-admin-link:hover {
  opacity: 1;
  transform: scale(1.25);
  filter: drop-shadow(0 0 8px #00D2FF);
}

/* ========================================================
   BROADCAST ANNOUNCEMENT BANNERS (מודעות מערכת עליונות)
   ======================================================== */
#announcement-banner-container {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.announcement-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 500;
  direction: rtl;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s ease;
  animation: bannerSlideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bannerSlideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.announcement-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.announcement-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.announcement-title {
  font-weight: 700;
}

.announcement-text {
  opacity: 0.95;
}

.announcement-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.announcement-btn:hover {
  background: #FFFFFF;
  color: #000000;
}

.announcement-close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.15rem;
  opacity: 0.7;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: opacity 0.2s ease;
}

.announcement-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

/* Banner Severity Flavors */
.banner-info {
  background: linear-gradient(90deg, rgba(14, 116, 144, 0.95), rgba(30, 58, 138, 0.95));
  color: #E0F2FE;
  border-bottom: 1px solid rgba(56, 189, 248, 0.4);
}

.banner-success {
  background: linear-gradient(90deg, rgba(6, 95, 70, 0.95), rgba(16, 185, 129, 0.95));
  color: #ECFDF5;
  border-bottom: 1px solid rgba(52, 211, 153, 0.4);
}

.banner-warning {
  background: linear-gradient(90deg, rgba(146, 64, 14, 0.95), rgba(217, 119, 6, 0.95));
  color: #FFFBEB;
  border-bottom: 1px solid rgba(251, 191, 36, 0.4);
}

.banner-urgent {
  background: linear-gradient(90deg, rgba(153, 27, 27, 0.95), rgba(239, 68, 68, 0.95));
  color: #FEF2F2;
  border-bottom: 1px solid rgba(248, 113, 113, 0.4);
}




/* ========================================================
   RESPONSIVE DESIGN — TABLET & MOBILE MASTER ENGINE
   Full support for: Desktop (1024+), Tablet (768-1024), Mobile (<768), Small (<400)
   ======================================================== */

/* Prevent iOS tap highlight & 300ms touch delay across all interactive elements */
button, a, input, select, textarea, .sign-card, .mode-card, .cat-filter-chip, .nav-tab-btn, .exam-option-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── TABLET (768px – 1023px) ─────────────────────────── */
@media (max-width: 1023px) {
  .header-container {
    padding: 0.65rem 1rem;
    gap: 0.75rem;
  }

  .brand-tagline {
    display: none;
  }

  .nav-tab-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
    gap: 0.35rem;
  }

  .signs-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
  }

  .hero-heading {
    font-size: 1.45rem;
  }

  .hero-desc {
    font-size: 0.92rem;
  }

  .app-main-content {
    padding: 1rem 1rem;
  }

  .exam-modes-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .learn-topics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .result-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .app-modal .modal-box {
    max-width: 520px;
    margin: 5vh auto;
  }

  .auth-card {
    max-width: 440px;
    padding: 2rem;
  }
}

/* ── MOBILE MASTER (max 767px) ───────────────────────── */
@media (max-width: 767px) {

  /* Global mobile typography & inputs (16px stops iOS auto-zoom) */
  input, select, textarea {
    font-size: 16px !important;
  }

  body {
    -webkit-text-size-adjust: 100%;
  }

  /* 1. Header & Navigation */
  .app-header {
    padding: 0;
  }

  .header-container {
    padding: 0.5rem 0.75rem;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    row-gap: 0.5rem;
    align-items: center;
  }

  .brand-area {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    gap: 0.5rem;
  }

  .brand-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  .brand-title {
    font-size: 1.15rem;
    line-height: 1.2;
  }

  .brand-tagline {
    display: none;
  }

  .header-controls {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  .user-profile-widget {
    padding: 0.25rem 0.5rem;
    gap: 0.35rem;
  }

  .user-avatar-badge {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }

  .user-info-text {
    display: none;
  }

  .readiness-pill-header {
    display: none; /* Hidden on phone header to prevent crowding */
  }

  .ctrl-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    font-size: 0.95rem;
    padding: 0;
  }

  /* Navigation — Full Width Touch Carousel */
  .nav-tabs {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    width: 100%;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    border-radius: var(--radius-full);
    padding: 0.25rem;
    gap: 0.3rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tab-btn {
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    gap: 0.3rem;
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: var(--radius-full);
  }

  .tab-icon {
    font-size: 0.95rem;
  }

  .tab-label {
    font-size: 0.8rem;
    font-weight: 600;
  }

  .badge-new-pulse {
    display: none;
  }

  /* 2. Main Content Container */
  .app-main-content {
    margin: 0.8rem auto 2.5rem;
    padding: 0 0.65rem;
    max-width: 100%;
  }

  /* 3. Hero Card */
  .signs-hero-card {
    padding: 1.2rem 1rem;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    border-radius: var(--radius-lg);
    margin-bottom: 1.2rem;
  }

  .hero-heading {
    font-size: 1.25rem;
    line-height: 1.3;
  }

  .hero-desc {
    font-size: 0.85rem;
    line-height: 1.5;
    margin-top: 0.4rem;
  }

  .hero-actions {
    width: 100%;
    flex-direction: column;
    gap: 0.6rem;
  }

  .btn-hero-primary,
  .btn-hero-secondary {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.92rem;
    border-radius: var(--radius-md);
  }

  /* 4. Toolbar & Category Chips */
  .signs-toolbar {
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 0.8rem;
  }

  .search-input-box {
    width: 100%;
  }

  .search-input-box input {
    padding: 0.75rem 2.6rem 0.75rem 1rem;
    font-size: 16px !important;
    border-radius: var(--radius-md);
  }

  .search-input-box .search-icon {
    right: 0.85rem;
    font-size: 1.1rem;
  }

  .category-chips-scroll {
    width: 100%;
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .category-chips-scroll::-webkit-scrollbar {
    display: none;
  }

  .cat-filter-chip {
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: var(--radius-full);
  }

  /* Signs Count & Hint */
  .signs-meta-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    margin-bottom: 0.85rem;
    font-size: 0.8rem;
  }

  .signs-hint {
    font-size: 0.75rem;
    line-height: 1.4;
  }

  /* 5. Signs Grid — Perfect 2-column touch cards */
  .signs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.55rem;
  }

  .sign-card {
    padding: 0.75rem 0.6rem;
    border-radius: var(--radius-md);
    min-height: auto;
  }

  .sign-visual-frame {
    height: 90px;
    padding: 0.4rem;
    margin-bottom: 0.5rem;
  }

  .sign-card-title {
    font-size: 0.82rem;
    line-height: 1.3;
    margin-bottom: 0.3rem;
  }

  .sign-card-snippet {
    font-size: 0.72rem;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    margin-bottom: 0.4rem;
  }

  .sign-cat-mini {
    font-size: 0.68rem;
    padding: 0.15rem 0.45rem;
  }

  .sign-card-footer {
    padding-top: 0.4rem;
  }

  .btn-sign-details {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }

  /* 6. Exam Hub View */
  .hub-title {
    font-size: 1.5rem;
    line-height: 1.2;
  }

  .hub-subtitle {
    font-size: 0.88rem;
    line-height: 1.5;
  }

  .exam-modes-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .mode-card {
    padding: 1.3rem 1.1rem;
    border-radius: var(--radius-lg);
  }

  .mode-icon {
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
  }

  .mode-name {
    font-size: 1.15rem;
  }

  .mode-desc {
    font-size: 0.85rem;
    margin-bottom: 1rem;
  }

  .mode-features {
    font-size: 0.8rem;
    margin-bottom: 1rem;
    padding: 0.65rem;
  }

  .btn-start-mode {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  /* 7. Active Exam Question Screen */
  .exam-active-card {
    padding: 1.1rem 0.85rem;
    border-radius: var(--radius-lg);
  }

  .exam-top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
  }

  .exam-meta {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .exam-timer-box {
    font-size: 1rem;
    padding: 0.3rem 0.75rem;
  }

  .exam-body-grid.has-sign {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .exam-sign-column {
    order: -1;
    margin-bottom: 0.4rem;
  }

  .exam-sign-frame {
    padding: 0.85rem;
    max-width: 140px;
    margin: 0 auto;
  }

  .exam-sign-frame svg {
    max-width: 90px;
    max-height: 90px;
  }

  .exam-question-title {
    font-size: 1.05rem;
    line-height: 1.45;
    margin-bottom: 1rem;
  }

  .exam-options-list {
    gap: 0.55rem;
    margin-bottom: 1rem;
  }

  .exam-option-btn {
    padding: 0.75rem 0.85rem;
    font-size: 0.88rem;
    line-height: 1.35;
    gap: 0.65rem;
    border-radius: var(--radius-md);
  }

  .opt-num {
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 0.78rem;
  }

  .exam-actions-bar {
    flex-direction: column;
    gap: 0.6rem;
  }

  .exam-nav-buttons {
    width: 100%;
    display: flex;
    gap: 0.4rem;
  }

  .exam-nav-buttons button {
    flex: 1;
    padding: 0.7rem 0.6rem;
    font-size: 0.88rem;
    justify-content: center;
  }

  /* 8. Exam Results Card */
  .result-score-circle {
    width: 110px;
    height: 110px;
  }

  .score-number {
    font-size: 2rem;
  }

  .result-stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .result-stat-box {
    padding: 0.85rem;
  }

  .stat-val {
    font-size: 1.3rem;
  }

  .result-actions-row {
    flex-direction: column;
    gap: 0.6rem;
  }

  .result-actions-row button {
    width: 100%;
    padding: 0.75rem;
  }

  /* 9. AI Tutor Chat - Highly Optimized Mobile Layout */
  .ai-view-layout {
    padding: 0;
  }

  .ai-chat-card {
    height: calc(100vh - 135px);
    height: calc(100dvh - 135px);
    min-height: 420px;
    max-height: 90vh;
    border-radius: var(--radius-md);
  }

  .ai-header-bar {
    padding: 0.65rem 0.85rem !important;
    gap: 0.65rem !important;
  }

  .ai-bot-face {
    font-size: 1.35rem !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: var(--radius-sm) !important;
  }

  .ai-title-wrap h2 {
    font-size: 0.95rem !important;
    margin-bottom: 0.15rem !important;
  }

  .ai-title-wrap p {
    font-size: 0.72rem !important;
    line-height: 1.25 !important;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .ai-chat-messages {
    padding: 0.7rem 0.65rem !important;
    gap: 0.65rem !important;
  }

  .ai-msg {
    max-width: 95% !important;
    gap: 0.45rem !important;
  }

  .bot-avatar, .user-avatar {
    width: 26px !important;
    height: 26px !important;
    font-size: 0.9rem !important;
    flex-shrink: 0 !important;
  }

  .ai-msg-bot .msg-bubble {
    padding: 0.7rem 0.85rem !important;
    font-size: 0.86rem !important;
    line-height: 1.5 !important;
    border-radius: 4px 14px 14px 14px !important;
  }

  .ai-msg-user .msg-bubble {
    padding: 0.55rem 0.85rem !important;
    font-size: 0.86rem !important;
    line-height: 1.4 !important;
    border-radius: 14px 4px 14px 14px !important;
  }

  .ai-quick-triggers {
    gap: 0.35rem !important;
    margin-top: 0.55rem !important;
  }

  .ai-chip-btn {
    padding: 0.3rem 0.65rem !important;
    font-size: 0.75rem !important;
  }

  /* Comparison Cards within AI responses on Mobile */
  .ai-comparison-card {
    padding: 0.2rem !important;
  }

  .ai-comparison-card h4 {
    font-size: 0.9rem !important;
    margin-bottom: 0.4rem !important;
  }

  .comparison-grid {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
    margin: 0.5rem 0 !important;
  }

  .comp-box {
    padding: 0.65rem 0.75rem !important;
    text-align: right !important;
    border-radius: var(--radius-sm) !important;
  }

  .comp-box strong {
    font-size: 0.85rem !important;
    display: block;
    margin: 0.25rem 0;
  }

  .comp-svg-wrap svg {
    max-width: 50px !important;
    max-height: 50px !important;
    margin: 0 auto;
  }

  .comp-box ul {
    margin-top: 0.4rem !important;
    font-size: 0.78rem !important;
    padding-right: 0 !important;
  }

  .comp-box li {
    margin-bottom: 0.25rem !important;
  }

  .ai-tip {
    font-size: 0.78rem !important;
    padding: 0.45rem 0.6rem !important;
    margin-top: 0.45rem !important;
  }

  /* Road Sign Card within AI Chat */
  .ai-sign-card {
    padding: 0.75rem !important;
    margin: 0.35rem 0 !important;
    border-radius: var(--radius-md) !important;
  }

  .ai-sign-header {
    margin-bottom: 0.5rem !important;
    padding-bottom: 0.35rem !important;
  }

  .ai-sign-badge {
    font-size: 0.95rem !important;
  }

  .ai-sign-cat {
    font-size: 0.75rem !important;
  }

  .ai-sign-body {
    grid-template-columns: 1fr !important;
    gap: 0.55rem !important;
    text-align: center !important;
    margin-bottom: 0.6rem !important;
  }

  .ai-sign-visual svg {
    max-width: 70px !important;
    max-height: 70px !important;
    margin: 0 auto !important;
  }

  .ai-sign-title {
    font-size: 1rem !important;
    margin-bottom: 0.35rem !important;
  }

  .ai-sign-section {
    font-size: 0.8rem !important;
    line-height: 1.4 !important;
    text-align: right !important;
    margin-bottom: 0.35rem !important;
  }

  /* Input Bar */
  .ai-chat-input-bar {
    padding: 0.45rem 0.6rem !important;
    gap: 0.4rem !important;
  }

  .ai-chat-input-bar input {
    font-size: 16px !important;
    padding: 0.55rem 0.75rem !important;
    border-radius: var(--radius-full) !important;
  }

  .btn-ai-send {
    padding: 0.55rem 0.95rem !important;
    font-size: 0.85rem !important;
    min-width: auto !important;
    flex-shrink: 0 !important;
    gap: 0.35rem !important;
  }

  .btn-ai-send span {
    font-size: 0.85rem !important;
  }

  /* 10. Study Materials (Learn Topics) */
  .learn-hero-card {
    padding: 1.3rem 1rem;
    text-align: center;
    border-radius: var(--radius-lg);
  }

  .learn-hero-card h1 {
    font-size: 1.35rem;
  }

  .learn-hero-card p {
    font-size: 0.85rem;
  }

  .learn-topics-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .learn-card {
    padding: 1.2rem 1rem;
  }

  .learn-card h3 {
    font-size: 1.05rem;
  }

  .learn-bullets {
    font-size: 0.82rem;
  }

  /* 11. Readiness Dashboard & KPIs */
  .gauge-hero-card {
    padding: 1.3rem 1rem;
    border-radius: var(--radius-lg);
  }

  .gauge-hero-card h2 {
    font-size: 1.35rem;
  }

  .big-score {
    font-size: 2.6rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .kpi-card {
    padding: 1rem 0.75rem;
  }

  .kpi-val {
    font-size: 1.4rem;
  }

  .kpi-label {
    font-size: 0.78rem;
  }

  /* 12. Modals — Perfect Mobile Overlay */
  .app-modal {
    padding: 0.5rem;
    align-items: center;
    justify-content: center;
  }

  .app-modal .modal-dialog,
  .app-modal .modal-box {
    max-width: 100%;
    width: 100%;
    max-height: 90vh;
    margin: auto;
    border-radius: var(--radius-lg);
    padding: 1.4rem 1rem 1.2rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  .modal-close-btn {
    top: 0.8rem;
    left: 0.8rem;
    z-index: 20;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }

  /* Sign Details Modal in Mobile — Perfectly stacked without any overlaps */
  .sign-modal-layout {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    width: 100%;
  }

  .modal-sign-hero {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 2;
  }

  .modal-sign-svg {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 0.6rem;
  }

  .modal-sign-svg svg,
  .modal-sign-svg img {
    max-width: 125px;
    max-height: 125px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
  }

  .modal-sign-tags {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    margin-bottom: 0.65rem;
    position: relative;
    z-index: 2;
  }

  .badge-sign-lg {
    font-size: 0.92rem;
    padding: 0.35rem 0.8rem;
    display: inline-block;
  }

  .badge-cat-lg {
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    display: inline-block;
  }

  .btn-modal-fav {
    width: auto;
    min-width: 180px;
    max-width: 240px;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    margin: 0.2rem auto 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
  }

  .modal-sign-details {
    width: 100%;
    text-align: right;
    position: relative;
    z-index: 1;
    margin-top: 0.4rem;
  }

  .modal-sign-title {
    font-size: 1.25rem;
    line-height: 1.35;
    text-align: center;
    margin-bottom: 1rem;
  }

  .modal-detail-block {
    padding: 0.8rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
  }

  .modal-detail-block.highlight-block {
    background: rgba(0, 210, 255, 0.08);
    border-right: 4px solid var(--accent-cyan);
  }

  .modal-detail-block.tip-block {
    background: rgba(245, 158, 11, 0.1);
    border-right: 4px solid var(--accent-amber);
  }

  .modal-footer-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
  }

  .modal-footer-actions button {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.88rem;
    justify-content: center;
  }

  /* Auth Card */
  .auth-card {
    padding: 1.4rem 1rem;
    border-radius: var(--radius-lg);
    max-width: 100%;
  }

  .auth-brand-logo {
    width: 60px;
    height: 60px;
  }

  .auth-tabs-nav {
    margin-bottom: 1.2rem;
  }

  .auth-tab-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  /* Flashcards Modal */
  .flashcard {
    min-height: 220px;
    padding: 1.2rem;
  }

  .flashcard-sign-svg {
    max-width: 110px;
    max-height: 110px;
  }

  .fc-controls-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .fc-action-btn {
    flex: 1;
    padding: 0.65rem 0.5rem;
    font-size: 0.82rem;
  }

  /* Footer & Creator Strip */
  .legal-security-footer {
    margin-top: 2rem;
    padding: 1.2rem 0.85rem;
    border-radius: var(--radius-md);
  }

  .legal-badge-row {
    gap: 0.4rem;
  }

  .legal-pill {
    font-size: 0.72rem;
    padding: 2px 8px;
  }

  .legal-text {
    font-size: 0.75rem;
    line-height: 1.5;
  }

  .creator-bottom-bar {
    padding: 8px 12px;
    border-radius: var(--radius-full);
  }

  .creator-bottom-bar span {
    font-size: 0.82rem;
  }

  /* Announcement Banner */
  .announcement-banner {
    padding: 8px 12px;
    font-size: 0.82rem;
  }
}

/* ── SMALL PHONES (max 390px — iPhone SE / Small Androids) ── */
@media (max-width: 390px) {
  .signs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
  }

  .sign-card {
    padding: 0.6rem 0.45rem;
  }

  .sign-visual-frame {
    height: 80px;
  }

  .sign-card-title {
    font-size: 0.78rem;
  }

  .nav-tab-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }

  .tab-icon {
    font-size: 0.85rem;
  }

  .hero-heading {
    font-size: 1.15rem;
  }

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

  .hub-title {
    font-size: 1.3rem;
  }
}
