/* ============================================
   THE VINE — WSET Level 3 Study Companion
   Design System & Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --primary: #722F37;
  --primary-hover: #5A252C;
  --primary-light: rgba(114, 47, 55, 0.08);
  --secondary: #C9A96E;
  --secondary-light: rgba(201, 169, 110, 0.12);
  --accent: #8B9E7C;
  --accent-light: rgba(139, 158, 124, 0.12);
  --text: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-light: #767676; /* WCAG AA compliant (4.54:1 on white) */
  --border: #E8E4DF;
  --border-light: #F0EDE8;
  --success: #4A7C59;
  --warning: #D4A03C;
  --error: #C0392B;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --shadow-hover: 0 6px 20px rgba(0,0,0,0.1);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 50px;
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;
  --card-bg: #FFFFFF;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---- Accessibility: Skip Link ---- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 16px;
}

/* ---- Accessibility: Focus Indicators ---- */
*:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

/* Remove default outline for mouse clicks */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Specific focus styles for buttons */
.btn-primary:focus-visible,
.btn-outline:focus-visible,
.btn-secondary:focus-visible,
.nav-item:focus-visible,
.mobile-nav-item:focus-visible,
.filter-pill:focus-visible,
.mode-pill:focus-visible,
.sat-option-btn:focus-visible,
.aroma-pill:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

/* ---- Accessibility: Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .flashcard-inner {
    transition: none !important;
  }
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.65rem); letter-spacing: -0.015em; }
h3 { font-size: 1.15rem; }
h4 { font-size: 0.95rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

p { color: var(--text-secondary); line-height: 1.7; }

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ---- App Container ---- */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  padding-bottom: 100px;
}

/* ---- App Header ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 247, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
  margin-bottom: 8px;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  color: var(--primary);
}

.brand h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  font-family: var(--font-body);
}

/* ---- Header Search ---- */
.header-search-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.header-search-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* ---- Global Search Overlay ---- */
.global-search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  animation: fadeIn 0.15s ease;
}

.global-search-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

.global-search-input-wrap {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
}

.global-search-icon {
  font-size: 1.1rem;
  opacity: 0.5;
  flex-shrink: 0;
}

.global-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 1rem;
  background: transparent;
  color: var(--text);
}

.global-search-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0 4px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.global-search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

.global-search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: none;
  font-family: var(--font-body);
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  text-align: left;
  transition: background 0.15s;
}

.global-search-result:hover {
  background: var(--bg);
}

.gsr-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.gsr-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.gsr-type {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
}

.gsr-title {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-empty {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-light);
  font-size: 0.88rem;
}

@media (max-width: 600px) {
  .global-search-overlay { padding-top: 20px; padding: 10px; }
  .global-search-panel { max-width: 100%; }
}

/* ---- Quiz Recommendations ---- */
.quiz-recommendations {
  margin-top: 24px;
  padding: 20px 24px;
  background: rgba(192, 57, 43, 0.05);
  border-radius: var(--radius);
  border-left: 3px solid var(--error);
}

.quiz-recommendations h3 {
  color: var(--error);
  font-size: 1rem;
  margin-bottom: 4px;
}

.quiz-rec-card {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.quiz-rec-card:last-child {
  border-bottom: none;
}

.cat-weak-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--error);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-category-card.weak {
  border-left: 3px solid var(--error);
}

.quiz-pass-message {
  margin-top: 20px;
  padding: 16px 20px;
  background: rgba(74, 124, 89, 0.08);
  border-radius: var(--radius);
  border-left: 3px solid var(--success);
  font-size: 0.9rem;
  color: var(--text);
}

/* ---- Exam Simulation ---- */
.exam-intro {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.exam-intro h2 {
  color: var(--primary);
  margin-bottom: 20px;
}

.exam-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
  text-align: left;
}

.exam-info-item {
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.exam-info-item strong {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
}

.exam-info-item p {
  font-size: 0.85rem;
  margin-top: 2px;
}

.exam-rules {
  text-align: left;
  padding: 16px 20px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.exam-rules h4 {
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.exam-rules ul {
  list-style: none;
  padding: 0;
}

.exam-rules li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 4px 0;
  padding-left: 16px;
  position: relative;
}

.exam-rules li::before {
  content: '\2022';
  position: absolute;
  left: 0;
  color: var(--primary);
}

.mode-card.exam-sim {
  border: 2px solid var(--secondary);
  background: var(--secondary-light);
}

/* ---- Desktop Navigation ---- */
.app-nav {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border-bottom: 2px solid var(--border-light);
  padding: 0 20px;
  margin: 0 auto 28px;
  max-width: 1200px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.nav-item {
  flex: 0 0 auto;
  min-width: 0;
  padding: 14px 16px 12px;
  border: none;
  background: transparent;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-align: center;
}

.nav-item:hover {
  color: var(--text);
  border-bottom-color: var(--border);
}

.nav-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: transparent;
}

.nav-item .nav-icon {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 2px;
}

/* ---- Mobile Bottom Navigation ---- */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 900;
  justify-content: space-around;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border: none;
  background: none;
  font-family: var(--font-body);
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.15s;
  min-width: 56px;
  min-height: 48px;
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.mobile-nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Mobile More Menu (bottom sheet) */
.mobile-more-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 950;
}

.mobile-more-menu.open {
  display: block;
}

.mobile-more-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  animation: fadeIn 0.2s ease;
}

.mobile-more-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.mobile-more-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.mobile-more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 12px;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  text-align: left;
}

.mobile-more-item:hover {
  background: var(--bg);
}

.mobile-more-icon {
  font-size: 1.3rem;
}

/* ---- Welcome Screen ---- */
.welcome-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.4s ease;
}

.welcome-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: slideUp 0.4s ease;
}

.welcome-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
}

.welcome-card h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.welcome-subtitle {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.welcome-features {
  text-align: left;
  margin-bottom: 28px;
}

.welcome-feature {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.welcome-feature:last-child {
  border-bottom: none;
}

.welcome-feature > span {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.welcome-feature strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 1px;
}

.welcome-feature p {
  font-size: 0.78rem;
  color: var(--text-light);
  margin: 0;
}

.welcome-cta {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  border-radius: var(--radius-pill);
}

.welcome-hint {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 10px;
}

/* Show mobile nav on small screens, hide desktop nav */
@media (max-width: 768px) {
  .desktop-nav {
    display: none !important;
  }

  .mobile-nav {
    display: flex;
  }

  /* Add bottom padding so content isn't hidden behind mobile nav */
  .app-container {
    padding-bottom: 80px;
  }

  .welcome-card {
    padding: 32px 24px;
  }
}

/* ---- Pages ---- */
.page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

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

/* ---- Dashboard Stats ---- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card .stat-value {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.stat-card.highlight {
  border-color: var(--secondary);
  background: rgba(201, 169, 110, 0.06);
}

.stat-modes {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mode-pill {
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.mode-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.mode-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--secondary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover { background: #b8963d; transform: translateY(-1px); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 23px;
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-outline:hover { background: var(--primary-light); }

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1.1rem;
}

.btn-icon:hover { background: var(--bg); color: var(--text); border-color: var(--text-light); }

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Flashcards ---- */
.flashcard-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.flashcard {
  perspective: 1200px;
  width: 100%;
  max-width: 560px;
  height: 320px;
  cursor: pointer;
}

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

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

.flashcard-front,
.flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  border-radius: var(--radius-lg);
  text-align: center;
  overflow-y: auto;
}

.flashcard-front {
  background: var(--surface);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
}

.flashcard-front h3 {
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--text);
}

.flashcard-front .flashcard-category {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
  font-weight: 600;
}

.flashcard-front .flip-hint {
  position: absolute;
  bottom: 16px;
  font-size: 0.72rem;
  color: var(--text-light);
}

.flashcard-back {
  background: var(--primary);
  color: #fff;
  transform: rotateY(180deg);
}

.flashcard-back p {
  color: rgba(255,255,255,0.95);
  font-size: 1rem;
  line-height: 1.7;
}

.flashcard-back .flashcard-category {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.6);
  margin-bottom: 12px;
}

.flashcard-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.flashcard-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.flashcard-counter {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 80px;
  text-align: center;
}

.flashcard-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn-got-it {
  padding: 12px 28px;
  background: var(--success);
  color: #fff;
  border: 2px solid var(--success);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(74, 124, 89, 0.3);
}

.btn-got-it:hover { background: #3d6a4a; border-color: #3d6a4a; box-shadow: 0 3px 12px rgba(74, 124, 89, 0.4); }

.btn-still-learning {
  padding: 12px 28px;
  background: transparent;
  color: var(--warning);
  border: 2px solid var(--warning);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-still-learning:hover { background: var(--warning); color: #fff; }

/* ---- Filter / Tag Pills ---- */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-pill {
  padding: 7px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-pill:hover { border-color: var(--primary); color: var(--primary); }

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

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--primary-light);
  color: var(--primary);
  margin: 2px;
}

.tag.red { background: rgba(192, 57, 43, 0.1); color: #C0392B; }
.tag.white { background: rgba(201, 169, 110, 0.15); color: #96791E; }
.tag.green { background: var(--accent-light); color: #5A6F4E; }

/* ---- Quiz ---- */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.quiz-progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.quiz-timer {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 600;
}

.quiz-question {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 24px;
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.95rem;
}

.quiz-option:hover { border-color: var(--primary); background: var(--primary-light); }

.quiz-option .option-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.quiz-option.selected .option-letter {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.quiz-option.correct {
  border-color: var(--success);
  background: rgba(74, 124, 89, 0.08);
}

.quiz-option.correct .option-letter {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.quiz-option.incorrect {
  border-color: var(--error);
  background: rgba(192, 57, 43, 0.06);
}

.quiz-option.incorrect .option-letter {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

.quiz-option.disabled { pointer-events: none; }

.quiz-explanation {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

.quiz-results {
  text-align: center;
  padding: 40px 20px;
}

.quiz-score {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 16px 0;
}

.quiz-score-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.results-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 24px 0;
  text-align: left;
}

.result-category-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.result-category-card .cat-name {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.result-category-card .cat-score {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

/* ---- SAT Builder ---- */
.sat-option-btn {
  padding: 9px 18px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.sat-option-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.sat-option-btn.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.sat-section {
  margin-bottom: 28px;
}

.sat-section h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.sat-section .sat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 10px;
}

.sat-options-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sat-step-indicator {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}

.sat-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: all var(--transition);
}

.sat-step-dot.active {
  background: var(--primary);
  transform: scale(1.2);
}

.sat-step-dot.completed {
  background: var(--success);
}

.sat-textarea {
  width: 100%;
  min-height: 100px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: vertical;
  transition: border-color var(--transition);
  background: var(--surface);
  color: var(--text);
  line-height: 1.6;
}

.sat-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.sat-summary {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
}

.sat-summary h4 {
  color: var(--primary);
  margin-bottom: 4px;
}

.sat-summary p {
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.sat-note-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 10px;
  border-left: 3px solid var(--secondary);
}

.sat-note-card .note-date {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.sat-note-card .note-wine-name {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.sat-note-card .note-producer {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.sat-note-card .note-region-link {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  margin-top: 4px;
}

.sat-note-card .note-region-link:hover {
  text-decoration: underline;
}

.sat-note-photo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.sat-note-card.has-identity {
  border-left: 3px solid var(--primary);
}

/* Wine Identity Section */
.sat-identity-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.sat-text-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition);
  box-sizing: border-box;
}

.sat-text-input:focus {
  outline: none;
  border-color: var(--primary);
}

.sat-select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.sat-select:focus {
  outline: none;
  border-color: var(--primary);
}

.sat-photo-area {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.sat-photo-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.82rem;
  padding: 12px;
}

.sat-photo-upload:hover {
  color: var(--primary);
}

.sat-photo-preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-sm);
  display: block;
  margin: 0 auto 10px;
}

.sat-photo-remove {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  font-family: var(--font-body);
}

/* ---- SAT Aroma Groups (Primary / Secondary / Tertiary) ---- */
.sat-aroma-group {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}

.sat-aroma-group:nth-child(3) {
  border-left-color: var(--secondary);
}

.sat-aroma-group:nth-child(4) {
  border-left-color: var(--accent);
}

.sat-group-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.sat-group-name {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.sat-group-hint {
  font-size: 0.75rem;
  color: var(--text-light);
  font-style: italic;
}

.sat-subcategory {
  margin-bottom: 12px;
}

.sat-subcategory:last-child {
  margin-bottom: 0;
}

.sat-sub-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sat-subcat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  cursor: pointer;
  user-select: none;
}

.sat-subcat-header:hover {
  color: var(--primary);
}

.sat-subcat-toggle {
  font-size: 0.7rem;
  color: var(--text-light);
  transition: transform 0.2s;
}

.sat-subcat-open .sat-subcat-toggle {
  transform: rotate(90deg);
}

.sat-subcat-pills {
  display: none;
  padding-top: 6px;
}

.sat-subcat-open .sat-subcat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sat-subcat-count {
  font-size: 0.7rem;
  color: var(--secondary);
  font-weight: 600;
  margin-left: 6px;
}

/* ---- Study Today ---- */
.study-progress-card {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 28px;
}

.study-progress-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  flex-shrink: 0;
}

.study-progress-num {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.study-progress-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.85);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.study-progress-info h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.study-progress-info p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.study-plan {
  margin-bottom: 32px;
}

.study-plan-title {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.study-plan-subtitle {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 20px;
}

.study-block {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 12px;
}

.study-block-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.study-block-time {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.study-block-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.study-block-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 2px;
}

.study-block-links {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.study-chapter-link {
  display: inline-block;
  font-size: 0.82rem;
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition);
}

.study-chapter-link:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.study-action-btn {
  margin-top: 12px;
}

.study-weak-topics {
  margin-bottom: 32px;
}

.study-topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.study-topic-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.study-topic-card strong {
  font-size: 0.9rem;
}

.study-topic-week {
  font-size: 0.75rem;
  color: var(--text-light);
}

.study-topic-review {
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.study-topic-review:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .study-progress-card {
    flex-direction: column;
    text-align: center;
  }
}

/* ---- Progress Bar ---- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.green {
  background: linear-gradient(90deg, var(--accent), var(--success));
}

/* ---- World Map ---- */
.world-map-container {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  overflow: hidden;
}

.world-map-title {
  font-size: 1.15rem;
  margin-bottom: 4px;
  text-align: center;
}

.world-map-subtitle {
  font-size: 0.82rem;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 16px;
}

.world-map-svg {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.world-map-frame {
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-height: 200px;
}

.world-map-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 0.88rem;
}

.world-country-shape {
  fill: var(--primary, #722F37);
  opacity: 0.55;
  stroke: var(--primary, #722F37);
  stroke-width: 0.5;
  transition: opacity 0.2s, transform 0.2s;
  cursor: pointer;
}

.world-country-marker:hover .world-country-shape,
.world-country-marker.highlight .world-country-shape {
  opacity: 1;
  fill: #C9A96E;
  stroke: #a8893a;
}

.world-country-label {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  fill: var(--text, #333);
  text-anchor: middle;
  pointer-events: none;
}


.world-region-section {
  margin-bottom: 20px;
}

.world-region-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 8px;
}

.world-map-region {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

@media (max-width: 600px) {
  .world-map-container {
    padding: 14px;
  }

  .world-country-label {
    font-size: 7px;
  }
}

/* ---- Country Picker & Wine Maps ---- */
.country-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.country-picker-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 22px 18px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
}

.country-picker-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.country-picker-card.has-map {
  border-color: var(--secondary);
}

.country-picker-flag {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.country-picker-card h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.country-picker-count {
  font-size: 0.78rem;
  color: var(--text-light);
  display: block;
}

.country-picker-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--secondary);
  background: rgba(201, 169, 110, 0.1);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.map-country-header {
  margin-bottom: 20px;
}

.map-country-header h2 {
  margin-bottom: 2px;
}

.map-country-header p {
  color: var(--text-light);
  font-size: 0.88rem;
}

.wine-map-container {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 8px;
  overflow: hidden;
}

.wine-map-svg {
  width: 100%;
  max-width: 500px;
  height: auto;
  margin: 0 auto;
  display: block;
}

.map-outline {
  fill: rgba(114, 47, 55, 0.04);
  stroke: none;
}

.map-outline-stroke {
  fill: none;
  stroke: var(--border);
  stroke-width: 1.5;
}

.map-river {
  fill: none;
  stroke: #7BA7C9;
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.5;
  stroke-dasharray: none;
}

.map-river-label {
  font-family: var(--font-body);
  font-size: 7.5px;
  fill: #7BA7C9;
  font-style: italic;
  opacity: 0.7;
}

.map-mountain {
  fill: none;
  stroke: #9e8e7a;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.35;
}

.map-mountain-label {
  font-family: var(--font-body);
  font-size: 7px;
  fill: #9e8e7a;
  font-style: italic;
  opacity: 0.5;
  letter-spacing: 1px;
}

.map-annotation {
  font-family: var(--font-body);
  font-size: 10px;
  fill: var(--text-light, #999);
}

.map-annotation.water {
  font-style: italic;
  fill: #7BA7C9;
  font-size: 9px;
  opacity: 0.7;
}

.map-annotation.city {
  font-size: 9px;
  fill: var(--text-light, #999);
}

.map-annotation.label {
  font-size: 11px;
  font-weight: 600;
  fill: var(--text-light, #999);
  letter-spacing: 2px;
  opacity: 0.4;
}

.map-city-dot {
  fill: var(--text-light, #999);
  opacity: 0.5;
}

.map-region-group {
  cursor: pointer;
}

.map-region-group:hover .map-region-dot {
  r: 13;
}

.map-region-group:hover .map-region-label {
  font-weight: 700;
}

.map-region-glow {
  transition: opacity 0.2s;
}

.map-region-group:hover .map-region-glow {
  opacity: 0.25 !important;
}

.map-region-group.active .map-region-glow {
  opacity: 0.3 !important;
}

.map-region-dot {
  opacity: 0.9;
  transition: r 0.2s ease;
}

.map-region-dot-inner {
  pointer-events: none;
}

.map-region-group:hover .map-region-dot {
  r: 10;
}

.map-region-group.active .map-region-dot {
  r: 11;
}

/* Popup Card */
.map-popup-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-top: 12px;
  overflow: hidden;
  animation: fadeIn 0.2s ease;
  box-shadow: var(--shadow);
}

.map-popup-inner {
  padding: 20px 24px;
  position: relative;
}

.map-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.map-popup-close:hover {
  background: var(--bg-alt);
  color: var(--text);
}

/* ── Compare Mode ── */

.compare-toggle-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.compare-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-alt);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-light);
}
.compare-status-text strong {
  color: var(--primary);
}
.compare-clear-btn {
  background: none;
  border: 1px solid var(--text-light);
  color: var(--text-light);
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.compare-clear-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.compare-go-btn {
  width: 100%;
  margin-bottom: 20px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
}
.compare-selectable {
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.compare-selectable:hover {
  border-color: var(--secondary);
}
.compare-selected {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(114,47,55,0.15);
}
.compare-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}
.compare-item-country {
  font-size: 0.8rem;
  color: var(--text-light);
  display: block;
  margin-bottom: 6px;
}
.compare-grape-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.compare-grape-dot.red { background: var(--primary); }
.compare-grape-dot.white { background: var(--secondary); }

/* Compare Result View */
.compare-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 8px;
  padding: 24px 0 16px;
}
.compare-header-col h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--primary);
  margin: 0;
  line-height: 1.3;
}
.compare-header-country {
  font-size: 0.85rem;
  color: var(--text-light);
}
.compare-header-vs {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-style: italic;
  color: var(--text-light);
  padding: 0 8px;
}
.compare-swap-btn {
  display: block;
  margin: 0 auto 24px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-light);
  font-size: 0.8rem;
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.compare-swap-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.compare-view {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.compare-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.compare-row:last-child {
  border-bottom: none;
}
.compare-row-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  padding-top: 2px;
}
.compare-col {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.compare-col .tag {
  margin: 0;
}
.compare-col .tag.compare-shared {
  background: rgba(139,158,124,0.15);
  color: #4a5e40;
}
.compare-col .tag.compare-unique {
  background: rgba(114,47,55,0.08);
  color: var(--primary);
  font-weight: 600;
}
.compare-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}
.compare-list-item {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 6px;
  width: 100%;
}
.compare-list-item:last-child {
  margin-bottom: 0;
}

/* ── Flavor Wheel ── */

.fw-wheel-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}
.fw-svg {
  width: 100%;
  max-width: 900px;
  height: auto;
}
.fw-sub-arc {
  transition: opacity 0.2s;
}
.fw-sub-arc:hover {
  opacity: 0.85 !important;
}
.fw-cat-arc:hover {
  opacity: 1 !important;
}
.fw-detail-card {
  background: var(--card-bg, #fff);
  border-radius: 14px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--card-accent, var(--primary));
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.fw-detail-header h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--card-accent, var(--primary));
  margin-bottom: 2px;
}
.fw-detail-origin {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}
.fw-detail-section {
  margin-top: 16px;
}
.fw-detail-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.fw-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fw-detail-section p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

/* ── Label Decoder ── */

.ld-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.ld-country-card {
  background: var(--card-bg, #fff);
  border-radius: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: 20px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.ld-country-card:hover {
  box-shadow: 0 2px 12px rgba(114,47,55,0.1);
}
.ld-country-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.ld-flag { font-size: 1.5rem; }
.ld-country-header h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--primary);
}
.ld-country-count {
  font-size: 0.8rem;
  color: var(--text-light);
}

.ld-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-top: 8px;
}
.ld-header-flag { font-size: 2.5rem; }
.ld-header h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--primary);
}
.ld-header p {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Wine label card */
.ld-wine-label {
  max-width: 540px;
  margin: 0 auto;
}
.ld-wine-label-frame {
  background: var(--card-bg, #fff);
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}
.ld-lbl-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.ld-lbl-row:last-child { border-bottom: none; }
.ld-lbl-row:hover { background: rgba(201,169,110,0.04); }
.ld-lbl-row.active {
  background: rgba(114,47,55,0.03);
  border-left: 4px solid var(--label-accent, var(--primary));
}
.ld-lbl-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.ld-lbl-content {
  flex: 1;
  min-width: 0;
}
.ld-lbl-value {
  font-family: 'Playfair Display', var(--font-heading), serif;
  font-size: 1.1rem;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 2px;
}
.ld-lbl-row:first-child .ld-lbl-value {
  font-size: 1.3rem;
  font-weight: 600;
}
.ld-lbl-type {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--label-accent, var(--primary));
}
.ld-lbl-explain {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.7;
}

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

/* ── Map Quiz ── */

.mapquiz-intro h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--primary);
  margin-bottom: 6px;
}
.mapquiz-intro p {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.mapquiz-country-card {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mapquiz-country-card:hover {
  border-color: var(--secondary);
  box-shadow: 0 2px 12px rgba(114,47,55,0.1);
}
.mapquiz-progress {
  margin-bottom: 16px;
}
.mapquiz-progress-text {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 8px;
  font-weight: 500;
}
.mapquiz-progress-bar {
  height: 6px;
  background: var(--bg-alt);
  border-radius: 3px;
  overflow: hidden;
}
.mapquiz-progress-fill {
  height: 100%;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width 0.4s ease;
}
.mapquiz-prompt {
  text-align: center;
  margin-bottom: 16px;
}
.mapquiz-prompt h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 4px;
}
.mapquiz-prompt h3 strong {
  color: var(--primary);
}
.mapquiz-prompt p {
  font-size: 0.85rem;
  color: var(--text-light);
}
.mapquiz-map .mapquiz-dot {
  cursor: pointer;
}
.mapquiz-map .mapquiz-dot:hover .mapquiz-dot-outer {
  fill: var(--secondary) !important;
  transition: fill 0.15s;
}
.mapquiz-feedback {
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  margin-top: 16px;
  font-size: 1rem;
  font-weight: 600;
  min-height: 48px;
}
.mapquiz-feedback.correct {
  background: rgba(76,175,80,0.1);
  color: #2e7d32;
}
.mapquiz-feedback.wrong {
  background: rgba(229,57,53,0.08);
  color: #c62828;
}
.mapquiz-feedback-icon {
  font-size: 1.2rem;
  margin-right: 6px;
}
.mapquiz-next-btn {
  display: block;
  margin: 14px auto 0;
  padding: 10px 28px;
  font-size: 0.9rem;
}
.mapquiz-results {
  text-align: center;
  padding: 40px 20px;
}
.mapquiz-results-header {
  margin-bottom: 20px;
}
.mapquiz-results-emoji {
  font-size: 3rem;
  margin-bottom: 8px;
}
.mapquiz-results-header h2 {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  color: var(--primary);
  margin: 0;
}
.mapquiz-results-pct {
  font-size: 1.1rem;
  color: var(--text-light);
  margin: 4px 0;
}
.mapquiz-results-country {
  font-size: 0.9rem;
  color: var(--text-light);
}
.mapquiz-results-msg {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 28px;
}
.mapquiz-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.mapquiz-new-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}
.mapquiz-new-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Winemaking Flowcharts ── */

.wm-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.wm-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--card-bg, #fff);
  border-radius: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.wm-card:hover {
  box-shadow: 0 2px 12px rgba(114,47,55,0.1);
}
.wm-card-icon {
  font-size: 2rem;
  flex-shrink: 0;
}
.wm-card-info {
  flex: 1;
}
.wm-card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 2px;
}
.wm-card-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 4px;
}
.wm-card-steps {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.wm-card-arrow {
  font-size: 1.2rem;
  color: var(--text-light);
  flex-shrink: 0;
}

/* Process view */
.wm-process-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding: 16px 0;
}
.wm-process-icon {
  font-size: 2.5rem;
}
.wm-process-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.wm-process-header p {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* Flowchart */
.wm-flowchart {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.wm-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  max-width: 600px;
  padding: 16px 20px;
  background: var(--card-bg, #fff);
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.wm-step:hover {
  border-color: var(--step-color, var(--primary));
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.wm-step.active {
  border-color: var(--step-color, var(--primary));
  box-shadow: 0 2px 16px rgba(114,47,55,0.1);
  background: var(--bg);
}
.wm-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.wm-step-info {
  flex: 1;
}
.wm-step-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 2px;
}
.wm-step-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}
.wm-step-detail {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.65;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.wm-connector {
  display: flex;
  justify-content: center;
  padding: 2px 0;
}

/* ── Classification Explorer ── */

.clf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.clf-country-card {
  background: var(--card-bg, #fff);
  border-radius: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: 20px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.clf-country-card:hover {
  box-shadow: 0 2px 12px rgba(114,47,55,0.1);
}
.clf-country-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.clf-flag {
  font-size: 1.5rem;
}
.clf-country-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--primary);
}
.clf-country-desc {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.5;
  margin-bottom: 10px;
}
.clf-country-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Country detail view */
.clf-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  padding-top: 8px;
}
.clf-header-flag {
  font-size: 2.5rem;
}
.clf-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--primary);
}
.clf-intro {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 28px;
  max-width: 650px;
}
.clf-section-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--primary);
  margin-bottom: 16px;
  margin-top: 32px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.clf-section-title:first-of-type {
  margin-top: 0;
}

/* Pyramid tiers */
.clf-pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.clf-tier {
  width: var(--tier-width, 100%);
  cursor: pointer;
  transition: all 0.2s;
}
.clf-tier-bar {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.clf-tier:hover .clf-tier-bar {
  border-color: var(--tier-color, var(--primary));
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.clf-tier.active .clf-tier-bar {
  border-color: var(--tier-color, var(--primary));
  box-shadow: 0 2px 12px rgba(114,47,55,0.1);
}
.clf-tier-num {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  background: var(--tier-color, var(--primary));
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.clf-tier-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.clf-tier-aka {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}
.clf-tier-detail {
  padding: 16px 18px;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.7;
  background: var(--bg);
  border-radius: 0 0 10px 10px;
  border: 1px solid var(--border);
  border-top: none;
  margin-top: -1px;
}

/* Special classifications */
.clf-special {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.clf-special:hover {
  border-color: var(--secondary);
}
.clf-special.active {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(114,47,55,0.08);
}
.clf-special-header {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.clf-special-header h4 {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--primary);
}
.clf-expand {
  font-size: 1.2rem;
  color: var(--text-light);
  font-weight: 300;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.clf-special-detail {
  padding: 0 18px 16px;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

@media (max-width: 600px) {
  .clf-grid { grid-template-columns: 1fr; }
  .clf-tier { width: 100% !important; }
}

/* Compare responsive */
@media (max-width: 600px) {
  .compare-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .compare-row-label {
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }
  .compare-col {
    padding-left: 0;
  }
  .compare-col::before {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    display: block;
    width: 100%;
    margin-bottom: 4px;
  }
  .compare-header {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 8px;
  }
  .compare-header-col h2 {
    font-size: 1.2rem;
  }
}

.map-popup-header h3 {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.map-popup-sub {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 0;
}

.map-popup-section {
  margin-top: 14px;
}

.map-popup-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  margin-bottom: 6px;
}

.map-popup-section p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.map-popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.map-popup-detail-btn {
  margin-top: 16px;
}

.map-region-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  fill: var(--text, #333);
  transition: font-weight 0.2s;
}

.map-region-sub {
  font-family: var(--font-body);
  font-size: 8.5px;
  fill: var(--text-light, #999);
  font-style: italic;
}

.map-regions-title {
  font-size: 1.05rem;
}

@media (max-width: 600px) {
  .country-picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .wine-map-container {
    padding: 12px;
  }

  .map-region-label {
    font-size: 9px;
  }

  .map-region-sub {
    font-size: 7px;
  }
}

/* ---- Aroma Tracker ---- */
.aroma-progress-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.aroma-progress-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.aroma-stat {
  display: flex;
  flex-direction: column;
}

.aroma-stat-num {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.aroma-stat-label {
  font-size: 0.75rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.aroma-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.aroma-guide {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.aroma-guide h3 {
  font-size: 1rem;
  margin-bottom: 14px;
}

.aroma-guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.aroma-guide-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.aroma-guide-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.aroma-guide-step strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.aroma-guide-step p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.aroma-chapter-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}

.aroma-chapter-card.completed {
  border-left: 3px solid var(--success, #4caf50);
}

.aroma-chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  gap: 12px;
}

.aroma-chapter-header:hover {
  background: var(--bg);
}

.aroma-chapter-header strong {
  font-size: 0.9rem;
  display: block;
}

.aroma-chapter-count {
  font-size: 0.75rem;
  color: var(--text-light);
  display: block;
  margin-top: 2px;
}

.aroma-toggle {
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--text-light);
  cursor: pointer;
  flex-shrink: 0;
}

.aroma-chapter-body {
  display: none;
  padding: 0 18px 18px;
}

.aroma-chapter-card.open .aroma-chapter-body {
  display: block;
}

.aroma-tip {
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  line-height: 1.6;
}

.aroma-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.aroma-pills-wrap {
  padding-top: 8px;
}

.aroma-pill {
  padding: 8px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.aroma-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.aroma-pill.mastered {
  background: var(--success, #4caf50);
  border-color: var(--success, #4caf50);
  color: #fff;
}

.aroma-chapter-link {
  font-size: 0.82rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.aroma-chapter-link:hover {
  text-decoration: underline;
}

/* Aroma Practice Mode */
.aroma-practice-start,
.aroma-practice-done {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}

.aroma-practice-start h3,
.aroma-practice-done h3 {
  margin-bottom: 8px;
}

.aroma-practice-start p,
.aroma-practice-done p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.aroma-practice-count {
  font-weight: 600;
  color: var(--primary) !important;
  margin-bottom: 16px !important;
}

.aroma-practice-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
  margin-bottom: 16px;
}

.aroma-practice-progress {
  font-size: 0.75rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
}

.aroma-practice-prompt {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 8px;
}

.aroma-practice-hint {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 20px;
}

.aroma-practice-name {
  font-family: var(--font-heading, 'Playfair Display', serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.aroma-practice-chapter {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 20px;
}

.aroma-practice-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.aroma-practice-controls {
  text-align: center;
}

.aroma-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* ---- Region & Grape Cards ---- */
.explorer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.region-card,
.grape-card {
  background: var(--surface);
  border: none;
  border-left: 3px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 18px 20px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.region-card:hover,
.grape-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-left-color: var(--primary);
}

.region-card .region-country {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 4px;
}

.region-card h3 { font-size: 1.1rem; margin-bottom: 8px; }

.region-card .region-grapes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.grape-card .grape-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.grape-color-dot.red { background: #8B2252; }
.grape-color-dot.white { background: #D4C875; border: 1px solid var(--border); }

.region-detail,
.grape-detail {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}

.detail-back {
  font-size: 0.95rem;
  color: var(--primary);
  background: rgba(114,47,55,0.06);
  border: 1px solid rgba(114,47,55,0.15);
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  margin-bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  transition: all 0.15s;
  min-height: 44px;
}

.detail-back:hover {
  background: rgba(114,47,55,0.12);
  border-color: var(--primary);
  color: var(--primary);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.detail-section h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 8px;
  font-family: var(--font-body);
  font-weight: 600;
}

.detail-section p,
.detail-section li {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

.detail-section ul {
  list-style: none;
  padding: 0;
}

.detail-section li::before {
  content: '~';
  color: var(--secondary);
  margin-right: 8px;
  font-weight: 600;
}

/* Country Group */
.country-group {
  margin-bottom: 32px;
}

.country-group-header {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-light);
}

/* ---- Search Input ---- */
.search-input {
  width: 100%;
  max-width: 400px;
  padding: 12px 16px 12px 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ---- Study Tracker ---- */
.tracker-overall {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
}

.tracker-overall h2 { margin-bottom: 4px; }

.tracker-overall .tracker-percent {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 8px 0;
}

.tracker-session {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.tracker-session:hover { box-shadow: var(--shadow); }

.tracker-session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  cursor: pointer;
  user-select: none;
}

.tracker-session-header h3 {
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tracker-session-header .session-progress {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 500;
}

.tracker-session-header .week-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
}

.tracker-session.completed .week-badge {
  background: var(--success);
  color: #fff;
}

.tracker-items {
  padding: 0 20px 18px;
  display: none;
}

.tracker-session.open .tracker-items {
  display: block;
}

.tracker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.tracker-item:last-child { border-bottom: none; }

.tracker-item .topic-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.tracker-checkboxes {
  display: flex;
  gap: 16px;
}

.tracker-checkbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.tracker-checkbox label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  font-weight: 500;
}

.tracker-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.tracker-checkbox input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.tracker-checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.tracker-item.completed .topic-name {
  color: var(--text-light);
  text-decoration: line-through;
}

.celebration {
  font-size: 1.4rem;
  animation: celebrate 0.6s ease;
}

@keyframes celebrate {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ---- Sub Tabs ---- */
.sub-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-light);
}

.sub-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

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

.sub-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ---- Short Answer ---- */
.short-answer-area {
  width: 100%;
  min-height: 150px;
  padding: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  line-height: 1.6;
}

.short-answer-area:focus {
  outline: none;
  border-color: var(--primary);
}

.model-answer {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  padding: 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 16px;
}

.model-answer h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 8px;
  font-family: var(--font-body);
  font-weight: 600;
}

.model-answer p {
  color: var(--text);
  font-size: 0.9rem;
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

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

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInToast 0.3s ease, fadeOutToast 0.3s ease 2.7s;
  max-width: 340px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.warning { background: var(--warning); }

@keyframes slideInToast {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOutToast {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ---- Section Headers ---- */
.section-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-light);
}

.section-header h2 {
  margin-bottom: 6px;
  color: var(--primary);
}

.section-header p {
  font-size: 0.88rem;
  color: var(--text-light);
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; display: block; opacity: 0.6; }

/* ---- Quiz Mode Selector ---- */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.mode-card {
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px 24px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
}

.mode-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.mode-card .mode-icon { font-size: 2rem; margin-bottom: 12px; display: block; }
.mode-card h3 { font-size: 1rem; margin-bottom: 6px; }
.mode-card p { font-size: 0.8rem; }

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.easy { background: rgba(74, 124, 89, 0.1); color: var(--success); }
.badge.medium { background: rgba(212, 160, 60, 0.12); color: var(--warning); }
.badge.hard { background: rgba(192, 57, 43, 0.1); color: var(--error); }

/* ---- Chapters Index (in main app) ---- */
.chapters-hero {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 28px;
}

.chapters-routine {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  margin: 0;
}

.chapters-routine strong { color: var(--primary); }

.chapters-index {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chapter-section-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px 28px;
  transition: box-shadow var(--transition);
}

.chapter-section-card:hover {
  box-shadow: var(--shadow);
}

.chapter-section-card h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--secondary-light);
}

.chapter-section-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chapter-section-card li {
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
}

.chapter-section-card li:last-child {
  border-bottom: none;
}

.chapter-section-card li a {
  display: flex;
  align-items: center;
  padding: 12px 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all var(--transition);
  border-radius: var(--radius-sm);
  flex: 1;
}

.chapter-section-card li a:hover {
  background: var(--primary-light);
  color: var(--primary);
  padding-left: 16px;
}

.chapter-section-card li a::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--secondary);
  margin-right: 12px;
  flex-shrink: 0;
}

/* ---- Chapter Read/Unread Indicators ---- */
.chapter-section-card li.chapter-read a::before {
  background: var(--accent, #8B9E7C);
}

.chapter-read-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent, #8B9E7C);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  margin-right: 8px;
  flex-shrink: 0;
}

.chapter-section-card li.chapter-read a {
  color: var(--text-secondary);
}

.chapter-section-card li.chapter-read a::before {
  display: none;
}

.chapter-start-badge {
  display: inline-block;
  padding: 2px 10px;
  background: var(--secondary);
  color: #fff;
  border-radius: var(--radius-pill, 999px);
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: auto;
  white-space: nowrap;
}

.chapter-section-card li.chapter-start-here a {
  font-weight: 600;
  color: var(--primary);
}

/* ---- Flashcard Filter Toggle ---- */
.filter-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.filter-summary-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.filter-toggle-btn {
  padding: 5px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill, 999px);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition);
  margin-left: auto;
  white-space: nowrap;
}

.filter-toggle-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.filter-panel {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 12px;
  width: 100%;
}

/* ---- Chapter Page Styles (shared by chapter-XX.html) ---- */
.chapter-topbar {
  background: rgba(250, 250, 247, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

.chapter-topbar-brand {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--primary);
}

.chapter-topbar-sep { opacity: 0.3; color: var(--border); }

.chapter-topbar-section {
  font-size: 0.82rem;
  color: var(--text-light);
}

.chapter-topbar-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chapter-topbar-link {
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  transition: all var(--transition);
}

.chapter-topbar-link:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.chapter-topbar-badge {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.chapter-body {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.chapter-hero {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 44px 48px;
  margin-bottom: 48px;
  position: relative;
  overflow: hidden;
}

.chapter-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(201,169,110,0.15);
}

.chapter-hero::after {
  content: '';
  position: absolute;
  bottom: -60px; right: 60px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(201,169,110,0.08);
}

.chapter-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 10px;
}

.chapter-hero h1 {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
  color: #fff;
}

.chapter-hero .intro {
  font-size: 1.05rem;
  line-height: 1.7;
  opacity: 0.88;
  max-width: 600px;
  position: relative;
  z-index: 1;
  color: #fff;
}

.chapter-hero .aroma-hint {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.86rem;
  opacity: 0.75;
  position: relative;
  z-index: 1;
  color: #fff;
}

.chapter-hero .aroma-hint strong { color: var(--secondary); opacity: 1; }

/* Chapter content sections */
.section-block { margin-bottom: 48px; }

.section-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--secondary);
  padding-bottom: 10px;
  margin-bottom: 24px;
}

.subsection-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-hover);
  margin: 28px 0 12px;
}

.sub-sub-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 20px 0 8px;
}

/* Chapter content cards */
.ch-region-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 16px 0;
}

.ch-region-card-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

/* Callout boxes */
.callout {
  background: var(--surface);
  border-left: 4px solid var(--secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 24px;
  margin: 20px 0;
  font-size: 0.97rem;
}

.callout.sage { border-left-color: var(--accent); }
.callout.burgundy { border-left-color: var(--primary); background: var(--primary-light); }
.callout strong { color: var(--primary); }

/* Scale pills */
.scale-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px;
  align-items: center;
}

.scale-pill {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.scale-pill.highlight {
  background: var(--secondary-light);
  border-color: var(--secondary);
  color: var(--primary);
  font-weight: 600;
}

.scale-arrow { color: var(--secondary); font-size: 1rem; }

/* Data tables */
.data-table {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 20px 0;
}

.data-table-header {
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 20px;
}

.data-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  border-bottom: 1px solid var(--border-light);
}

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

.data-row.sub-header {
  background: var(--accent-light);
  grid-template-columns: 1fr;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  padding: 7px 20px;
}

.data-label {
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
  border-right: 1px solid var(--border-light);
  background: var(--bg);
}

.data-value {
  padding: 12px 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Region tags in chapters */
.ch-region-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.ch-region-tag {
  background: var(--accent-light);
  color: var(--primary);
  border-radius: var(--radius-pill);
  padding: 3px 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.ch-region-tag.gold-tag {
  background: var(--secondary-light);
  color: var(--primary);
}

/* Grape pills in chapters */
.ch-grape-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.ch-grape-pill {
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.83rem;
  font-weight: 600;
  white-space: nowrap;
}

.ch-grape-pill.white {
  background: rgba(201, 169, 110, 0.15);
  border: 1.5px solid var(--secondary);
  color: #96791E;
}

.ch-grape-pill.red {
  background: var(--primary-light);
  border: 1.5px solid var(--primary);
  color: var(--primary);
}

/* Comparison tables */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 0.9rem;
}

.compare-table th {
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.compare-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: top;
}

.compare-table tr:nth-child(even) td { background: var(--bg); }
.compare-table td:first-child { font-weight: 600; color: var(--primary); }

/* Exam tip box */
.exam-tip {
  background: var(--primary-light);
  border: 1.5px solid var(--secondary);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 24px 0;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.tip-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }

.exam-tip h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 6px;
}

.exam-tip p { font-size: 0.9rem; color: var(--text-secondary); margin: 0; }

/* Aroma tip box */
.aroma-tip {
  background: var(--accent-light);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 20px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.9rem;
}

.aroma-tip h4 {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  color: var(--accent);
  margin-bottom: 6px;
}

.aroma-tip p { color: var(--text-secondary); margin: 0; line-height: 1.6; }

/* Content lists in chapters */
.content-list {
  margin: 8px 0 16px 24px;
  line-height: 2.1;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.content-list li { margin-bottom: 2px; }
.content-list strong { color: var(--primary); }

/* Chapter nav footer */
/* ---- Audio Player ---- */
.audio-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface, #fff);
  border-top: 2px solid var(--primary, #722F37);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  z-index: 1000;
  font-family: var(--font-body, 'Inter', sans-serif);
}

.audio-player-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
}

.audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}

.audio-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary, #722F37);
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: transform 0.15s, background 0.15s;
}

.audio-play-btn:hover {
  transform: scale(1.05);
}

.audio-play-btn:active {
  transform: scale(0.95);
}

.audio-player.playing .audio-play-btn {
  background: var(--secondary, #C9A96E);
}

.audio-play-icon {
  line-height: 1;
}

.audio-info {
  flex: 1;
  min-width: 0;
}

.audio-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text, #333);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-progress-text {
  font-size: 0.72rem;
  color: var(--text-light, #999);
  margin-top: 2px;
}

.audio-expand-btn {
  width: 36px;
  height: 36px;
  color: var(--text-light, #999);
  font-size: 0.7rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.audio-expand-btn:hover {
  background: var(--bg, #f5f5f5);
}

.audio-player-expanded {
  display: none;
  padding: 0 20px 16px;
  border-top: 1px solid var(--border-light, #eee);
}

.audio-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px 0;
}

.audio-nav-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg, #f5f5f5);
  color: var(--text, #333);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
}

.audio-nav-btn:hover {
  background: var(--border-light, #eee);
}

.audio-play-btn-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary, #722F37);
  color: #fff;
  font-size: 1.4rem;
  transition: transform 0.15s;
}

.audio-play-btn-lg:hover {
  transform: scale(1.05);
}

.audio-player.playing .audio-play-btn-lg {
  background: var(--secondary, #C9A96E);
}

.audio-play-icon-lg {
  line-height: 1;
}

.audio-speed {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-bottom: 14px;
}

.audio-speed-label {
  font-size: 0.75rem;
  color: var(--text-light, #999);
  margin-right: 4px;
}

.audio-speed-btn {
  padding: 5px 12px;
  border-radius: var(--radius-pill, 20px);
  border: 1.5px solid var(--border, #ddd);
  background: var(--surface, #fff);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary, #666);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.audio-speed-btn:hover {
  border-color: var(--primary, #722F37);
  color: var(--primary, #722F37);
}

.audio-speed-btn.active {
  background: var(--primary, #722F37);
  border-color: var(--primary, #722F37);
  color: #fff;
}

.audio-sections {
  max-height: 200px;
  overflow-y: auto;
  border-top: 1px solid var(--border-light, #eee);
  padding-top: 10px;
}

.audio-section-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-secondary, #666);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.audio-section-item:hover {
  background: var(--bg, #f5f5f5);
}

.audio-section-item.active {
  background: rgba(114, 47, 55, 0.08);
  color: var(--primary, #722F37);
  font-weight: 600;
}

/* Add bottom padding to chapter body so content isn't hidden behind player */
.chapter-body {
  padding-bottom: 100px;
}

@media (max-width: 600px) {
  .audio-play-btn {
    width: 52px;
    height: 52px;
    font-size: 1.2rem;
  }

  .audio-player-main {
    padding: 10px 14px;
  }

  .audio-title {
    font-size: 0.82rem;
  }
}

/* ---- Chapter Table of Contents ---- */
.ch-toc-toggle {
  position: fixed;
  top: 70px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary, #722F37);
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 800;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.ch-toc-toggle:hover {
  transform: scale(1.08);
}

.ch-toc-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  max-width: 85vw;
  height: 100vh;
  background: var(--surface, #fff);
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  z-index: 850;
  overflow-y: auto;
  transition: right 0.25s ease;
  padding: 20px;
}

.ch-toc-panel.open {
  right: 0;
}

.ch-toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border, #eee);
}

.ch-toc-header strong {
  font-size: 1rem;
}

.ch-toc-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-light, #999);
  cursor: pointer;
  padding: 4px 8px;
}

.ch-toc-list {
  margin-bottom: 20px;
}

.ch-toc-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-secondary, #666);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
  line-height: 1.4;
}

.ch-toc-item:hover {
  background: var(--bg, #f5f5f5);
  color: var(--primary, #722F37);
}

.ch-toc-applinks {
  border-top: 1px solid var(--border, #eee);
  padding-top: 14px;
}

.ch-toc-applinks-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light, #999);
  margin-bottom: 8px;
}

.ch-toc-applink {
  display: block;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--text, #333);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s;
}

.ch-toc-applink:hover {
  background: var(--bg, #f5f5f5);
  color: var(--primary, #722F37);
}

.audio-seek {
  padding: 0 4px 10px;
}

.audio-seek-bar {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-light, #eee);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.audio-seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary, #722F37);
  cursor: pointer;
}

.audio-seek-bar::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary, #722F37);
  cursor: pointer;
  border: none;
}

/* ---- Chapter Read Bar ---- */
.chapter-read-bar {
  margin-top: 40px;
  margin-bottom: 8px;
}

.chapter-read-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1.5px solid var(--border);
  flex-wrap: wrap;
}

.chapter-read-inner.read {
  background: rgba(74, 124, 89, 0.12);
  border-color: var(--success);
}

.chapter-read-check {
  color: var(--success, #4caf50);
  font-size: 1.2rem;
  font-weight: 700;
}

.chapter-read-hint {
  font-size: 0.8rem;
  color: var(--text-light);
}

.chapter-read-undo {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  font-family: var(--font-body);
}

.chapter-read-btn {
  font-size: 0.9rem;
  padding: 10px 24px;
}

.chapter-footer {
  border-top: 2px solid var(--border-light);
  padding-top: 28px;
  margin-top: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.chapter-nav-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

.chapter-nav-btn:hover { background: var(--primary-hover); color: #fff; }

.chapter-nav-btn.secondary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.chapter-nav-btn.secondary:hover { background: var(--primary-light); }

.chapter-nav-btn.disabled {
  background: var(--border);
  color: var(--text-light);
  pointer-events: none;
  cursor: default;
  box-shadow: none;
}

.chapter-footer-meta {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.6;
}

/* ---- Pronunciation Tooltips ---- */
.pron {
  border-bottom: 1.5px dotted var(--secondary);
  cursor: help;
  position: relative;
}

.pron:hover {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.pron-tooltip {
  display: none;
  position: absolute;
  z-index: 500;
  background: var(--text);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.pron-tooltip.visible {
  display: block;
}

/* ---- Chapter Mini Quiz ---- */
.cq-question {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.cq-q-text {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 16px;
}

.cq-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cq-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--text);
  text-align: left;
  transition: all var(--transition);
}

.cq-opt:hover:not(.cq-disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.cq-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition);
}

.cq-opt.cq-correct {
  border-color: var(--success);
  background: rgba(74, 124, 89, 0.08);
}

.cq-opt.cq-correct .cq-letter {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.cq-opt.cq-incorrect {
  border-color: var(--error);
  background: rgba(192, 57, 43, 0.06);
}

.cq-opt.cq-incorrect .cq-letter {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

.cq-opt.cq-disabled {
  pointer-events: none;
  opacity: 0.7;
}

.cq-opt.cq-correct.cq-disabled {
  opacity: 1;
}

.cq-feedback {
  display: none;
  margin-top: 14px;
}

.cq-feedback.cq-visible {
  display: block;
}

.cq-explain {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0;
}

.cq-result {
  display: none;
  text-align: center;
  padding: 32px 20px;
}

.cq-result.cq-visible {
  display: block;
}

.cq-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.cq-score-num {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
}

.cq-score-label {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* ---- SVG Illustrations ---- */
.illustration {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 20px auto;
  display: block;
}

.illustration-caption {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: 8px;
  font-style: italic;
}

.illustration-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.illustration-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.illustration-card svg {
  max-width: 100%;
  height: auto;
  margin-bottom: 12px;
}

.illustration-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ---- Interactive Wine Maps ---- */
.wine-map-container {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

.wine-map {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
}

.map-region {
  cursor: pointer;
  transition: fill-opacity 0.2s ease, filter 0.2s ease;
  /* Override the faint inline opacity attrs: defined border + a fill that actually reads */
  opacity: 1;
  fill-opacity: 0.32;
  stroke-opacity: 0.95;
  stroke-width: 1.6px;
}

.map-region:hover {
  fill-opacity: 0.5;
  filter: brightness(1.05);
}

.map-tooltip {
  display: none;
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 280px;
  z-index: 50;
  pointer-events: none;
}

.map-tooltip.visible {
  display: block;
}

.map-tooltip h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.map-tooltip p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .app-container { padding: 0 14px; padding-bottom: 90px; }

  .app-header { padding: 12px 0; }

  .header-inner { padding: 0 14px; }

  .brand h1 { font-size: 1.2rem; }

  /* Desktop nav hidden on mobile via .desktop-nav rule above */

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .flashcard { height: 280px; }

  .flashcard-front h3 { font-size: 1.1rem; }

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

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

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

  .results-breakdown { grid-template-columns: 1fr; }

  .tracker-checkboxes { gap: 10px; }

  .chapter-body { padding: 28px 20px 60px; }
  .chapter-topbar { padding: 12px 16px; }
  .chapter-hero { padding: 30px 24px; }
  .chapter-hero h1 { font-size: 1.7rem; }
  .data-row { grid-template-columns: 120px 1fr; }
  .compare-table { font-size: 0.82rem; }
  .compare-table th, .compare-table td { padding: 8px 10px; }
}

@media (max-width: 480px) {
  .stats-bar { grid-template-columns: 1fr; }

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

  .flashcard { height: 260px; }

  .btn-group { flex-direction: column; }

  .flashcard-actions { flex-direction: row; }
}

/* ---- Dark Mode ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141211;
    --surface: #1E1C1A;
    --primary: #C47A82;
    --primary-hover: #D4929A;
    --primary-light: rgba(196, 122, 130, 0.12);
    --secondary: #D4B87A;
    --secondary-light: rgba(212, 184, 122, 0.12);
    --accent: #A3B595;
    --accent-light: rgba(163, 181, 149, 0.12);
    --text: #EDEBE8;
    --text-secondary: #A09D98;
    --text-light: #706C67;
    --border: #2E2B28;
    --border-light: #252320;
    --success: #6DAE7E;
    --warning: #E0B85C;
    --error: #D96B5E;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.2);
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
    --shadow-hover: 0 6px 20px rgba(0,0,0,0.3);
    --card-bg: #1E1C1A;
  }

  .app-header {
    background: rgba(20, 18, 17, 0.85);
  }

  .flashcard-back {
    background: #2A1F21;
  }

  .flashcard-back p { color: var(--text); }

  .tracker-checkbox input[type="checkbox"] {
    background: var(--bg);
  }

  .chapter-topbar {
    background: rgba(30, 28, 26, 0.9);
    border-bottom-color: #333;
  }

  .chapter-hero {
    background: #2A1F21;
  }

  .chapter-hero h1,
  .chapter-hero .intro,
  .chapter-hero .aroma-hint { color: var(--text); }

  .ch-grape-pill.white { background: rgba(212, 184, 122, 0.15); color: var(--secondary); }
  .ch-grape-pill.red { background: rgba(196, 122, 130, 0.15); color: var(--primary); }

  .world-map-svg rect:first-child {
    fill: #1a2330;
  }

  .world-country-shape {
    fill: var(--secondary, #C9A96E);
    stroke: var(--secondary, #C9A96E);
    opacity: 0.5;
  }

  .world-country-marker:hover .world-country-shape {
    opacity: 0.8;
  }

  .world-country-label {
    fill: #ccc;
  }

  .map-outline {
    fill: rgba(201, 169, 110, 0.06);
  }

  .chapter-read-inner.read {
    background: rgba(76, 175, 80, 0.1);
  }
}

/* ---- Site Footer ---- */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem 6rem;
  font-size: 0.75rem;
  color: var(--text-light);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

@media (min-width: 769px) {
  .site-footer {
    padding-bottom: 2rem;
  }
}

/* ── Auth Screen ── */
#auth-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.auth-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 48px 40px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
}
.auth-logo {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
}
.auth-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 4px;
}
.auth-subtitle {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-bottom: 28px;
}
.auth-google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.auth-google-btn:hover {
  background: var(--bg);
  border-color: var(--text-light);
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  color: var(--text-light);
  font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: var(--bg);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s;
}
.auth-tab.active {
  background: var(--primary);
  color: white;
}
.auth-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  margin-bottom: 12px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.auth-input:focus {
  border-color: var(--primary);
}
.auth-error {
  background: rgba(229,57,53,0.08);
  color: #c62828;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 12px;
  text-align: left;
}
.auth-success {
  background: rgba(76,175,80,0.08);
  color: #2e7d32;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 12px;
  text-align: left;
}
.auth-submit-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.auth-submit-btn:hover {
  background: var(--primary-hover);
}
.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-signout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-light);
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.header-signout-btn:hover {
  background: rgba(114,47,55,0.06);
  color: var(--primary);
  border-color: var(--primary);
}
.auth-disclaimer {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 20px;
}

/* ---- Quiz Celebration & Missed Review ---- */
.quiz-celebration {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--gold, #C9A96E);
  margin-bottom: 28px;
}
.missed-header { text-align: center; margin-bottom: 24px; }
.missed-header h2 { font-family: var(--font-heading); color: var(--primary); }
.missed-card { background: var(--card-bg, var(--bg)); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; border: 1px solid var(--border, rgba(0,0,0,0.06)); }
.missed-number { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-light); margin-bottom: 8px; }
.missed-question { font-size: 1.05rem; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.missed-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.missed-opt { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; background: var(--bg); color: var(--text-secondary); }
.missed-opt.correct { background: rgba(76, 175, 80, 0.1); color: var(--text); font-weight: 500; }
.missed-opt.incorrect { background: rgba(211, 47, 47, 0.08); color: var(--text); }
.missed-opt .option-letter { flex-shrink: 0; }
.missed-badge { margin-left: auto; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 10px; }
.correct-badge { background: rgba(76, 175, 80, 0.15); color: #2e7d32; }
.wrong-badge { background: rgba(211, 47, 47, 0.12); color: #c62828; }
.missed-explain { background: var(--bg); border-left: 3px solid var(--gold, #C9A96E); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; }

/* ---- Continue Reading Card ---- */
.study-continue { margin-bottom: 20px; }
.study-continue-link { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; background: var(--card-bg, #fff); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: background 0.15s, box-shadow 0.15s; }
.study-continue-link:hover { background: var(--primary-light, rgba(114, 47, 55, 0.05)); box-shadow: var(--shadow-sm); }
.study-continue-text { display: flex; flex-direction: column; gap: 2px; }
.study-continue-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary); }
.study-continue-title { font-size: 1rem; font-weight: 500; }
.study-continue-arrow { font-size: 1.2rem; color: var(--text-light); }

/* ---- Audio Sleep Timer ---- */
.audio-sleep { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border-light, #eee); }
.audio-sleep-btn { padding: 5px 12px; border-radius: var(--radius-pill, 20px); border: 1.5px solid var(--border, #ddd); background: transparent; font-size: 0.8rem; font-weight: 500; cursor: pointer; color: var(--text-secondary, #666); transition: all 0.15s; font-family: inherit; }
.audio-sleep-btn:hover { border-color: var(--accent, #8B9E7C); color: var(--accent, #8B9E7C); }
.audio-sleep-btn.active { background: var(--accent, #8B9E7C); border-color: var(--accent, #8B9E7C); color: #fff; }
.audio-sleep-status { font-size: 0.75rem; color: var(--accent, #8B9E7C); font-weight: 500; margin-left: 4px; }

/* ---- Compare Page ---- */
.cmp-custom-btn {
  display: block;
  margin: 0 auto 24px;
  padding: 10px 24px;
  font-size: 0.9rem;
}
.cmp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.cmp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.cmp-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.cmp-card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cmp-card-name {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.cmp-card-vs {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cmp-card-why {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}
.cmp-card-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.cmp-chip {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.cmp-chip-a { background: var(--primary-light); color: var(--primary); }
.cmp-chip-b { background: var(--accent-light); color: var(--accent); }
.cmp-chip-vs { background: none; color: var(--text-light); font-weight: 600; padding: 3px 4px; }
.cmp-view-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.cmp-view-btn:hover { background: var(--primary-hover); }
.cmp-exam-tip {
  background: var(--secondary-light);
  border-left: 4px solid var(--secondary);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 16px 0 24px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}
.cmp-exam-tip strong { color: var(--primary); }
.cmp-empty { text-align: center; color: var(--text-light); padding: 40px 20px; font-size: 0.95rem; }
.cmp-custom-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  color: var(--primary);
  margin-bottom: 16px;
}
.cmp-dropdowns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.cmp-dropdown-wrap { display: flex; flex-direction: column; gap: 6px; }
.cmp-dropdown-label { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.cmp-dropdown {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  appearance: auto;
  min-height: 44px;
}
.cmp-dropdown:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
@media (max-width: 600px) {
  .cmp-grid { grid-template-columns: 1fr; }
  .cmp-card-header { flex-direction: column; gap: 4px; }
  .cmp-dropdowns { grid-template-columns: 1fr; }
}

/* ---- Print ---- */
@media print {
  .app-header, .app-nav, .toast-container { display: none; }
  .page { display: block !important; }
  .card, .region-card, .grape-card { break-inside: avoid; }
}
