@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;1,8..60,400&family=DM+Sans:wght@400;500;600;700&display=swap');

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

:root {
  --burgundy: #6B1D2A;
  --burgundy-deep: #4A0E1C;
  --burgundy-light: #8C2E3D;
  --cream: #FAF5EF;
  --cream-warm: #F5EDE3;
  --parchment: #EDE4D8;
  --ink: #1E1008;
  --warm-gray: #7A6B5D;
  --warm-gray-light: #A89888;
  --gold: #C4975A;
  --gold-muted: #B8A080;
  --border: #DDD0C2;
  --card-bg: #FFFCF8;
  --green: #3D7A4A;
  --green-light: rgba(61, 122, 74, 0.08);
  --red: #9B3B3B;
  --red-light: rgba(155, 59, 59, 0.08);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  width: 272px;
  background: var(--burgundy-deep);
  color: #F5E6DC;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 28px 24px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand h1 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: #FFF;
  letter-spacing: -0.3px;
}

.sidebar-brand h1 span {
  color: var(--gold);
}

.sidebar-brand p {
  font-size: 10.5px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 4px;
  font-weight: 500;
}

.sidebar-section-label {
  font-size: 9.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
  padding: 24px 24px 10px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  font-weight: 400;
}

.nav-item:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: #FFF;
  background: rgba(255, 255, 255, 0.08);
  border-left-color: var(--gold);
  font-weight: 500;
}

.nav-item .num {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.2);
  width: 20px;
  text-align: right;
}

.nav-item.active .num {
  color: var(--gold);
}

.nav-item .nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
}

.nav-item .nav-icon-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-progress {
  margin: auto 16px 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.progress-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 10px;
  font-weight: 600;
}

.progress-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-muted));
  border-radius: 3px;
  transition: width 0.6s ease;
}

.progress-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.progress-text strong {
  color: var(--gold);
  font-weight: 600;
}

.main {
  margin-left: 272px;
  flex: 1;
  min-height: 100vh;
}

.view { display: none; }
.view.active { display: block; }

.module-hero {
  background: linear-gradient(135deg, var(--burgundy-deep) 0%, var(--burgundy) 50%, var(--burgundy-light) 100%);
  padding: 56px 64px 48px;
  position: relative;
  overflow: hidden;
}

.module-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(196, 151, 90, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.module-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(196, 151, 90, 0.3), transparent);
}

.module-breadcrumb {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 16px;
  font-weight: 500;
}

.module-breadcrumb span {
  color: var(--gold-muted);
}

.module-hero h2 {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 900;
  color: #FFF;
  line-height: 1.1;
  margin-bottom: 14px;
  letter-spacing: -0.5px;
  max-width: 700px;
}

.module-hero p {
  font-family: 'Source Serif 4', serif;
  font-size: 17px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.6;
  max-width: 600px;
  font-weight: 300;
}

.module-meta {
  display: flex;
  gap: 24px;
  margin-top: 24px;
}

.module-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

.module-meta-item .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.content-area {
  padding: 40px 64px 64px;
  max-width: 860px;
}

.section-intro {
  font-family: 'Source Serif 4', serif;
  font-size: 18px;
  line-height: 1.8;
  color: var(--warm-gray);
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  font-weight: 300;
}

.section-intro strong {
  color: var(--ink);
  font-weight: 600;
}

.content-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  margin-bottom: 16px;
  transition: all 0.25s ease;
}

.content-card:hover {
  border-color: var(--gold-muted);
  box-shadow: 0 4px 20px rgba(30, 16, 8, 0.06);
  transform: translateY(-1px);
}

.content-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
  letter-spacing: -0.2px;
}

.content-card p {
  font-family: 'Source Serif 4', serif;
  font-size: 15px;
  line-height: 1.75;
  color: var(--warm-gray);
  font-weight: 300;
}

.card-tag {
  display: inline-block;
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--burgundy);
  background: rgba(107, 29, 42, 0.08);
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 14px;
  font-weight: 600;
}

.sommelier-note {
  background: linear-gradient(135deg, rgba(196, 151, 90, 0.08) 0%, rgba(196, 151, 90, 0.03) 100%);
  border: 1px solid rgba(196, 151, 90, 0.2);
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  padding: 20px 24px;
  margin: 24px 0 0;
}

.sommelier-note-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 8px;
}

.sommelier-note p {
  font-family: 'Source Serif 4', serif;
  font-size: 14.5px;
  font-style: italic;
  line-height: 1.7;
  color: var(--warm-gray);
  font-weight: 300;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 0;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--warm-gray-light);
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(221, 208, 194, 0.5);
  color: var(--warm-gray);
  font-family: 'Source Serif 4', serif;
  font-size: 14px;
  font-weight: 300;
}

.data-table td strong {
  color: var(--ink);
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.cta-banner {
  background: var(--burgundy-deep);
  border-radius: 14px;
  padding: 32px 36px;
  margin-top: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.cta-banner::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(196, 151, 90, 0.15) 0%, transparent 70%);
}

.cta-banner h3 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: #FFF;
  font-weight: 700;
  margin-bottom: 6px;
}

.cta-banner p {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 400;
}

.cta-button {
  background: var(--gold);
  color: var(--burgundy-deep);
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.cta-button:hover {
  background: #D4A76A;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(196, 151, 90, 0.3);
}

.page-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-footer span {
  font-size: 12px;
  color: var(--warm-gray-light);
}

.page-nav {
  display: flex;
  gap: 8px;
}

.page-nav-btn {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--warm-gray);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  background: none;
}

.page-nav-btn:hover {
  border-color: var(--burgundy-light);
  color: var(--burgundy);
}

.page-nav-btn.primary {
  background: var(--burgundy);
  color: #FFF;
  border-color: var(--burgundy);
}

.page-nav-btn.primary:hover {
  background: var(--burgundy-light);
}

.view-tabs {
  display: flex;
  background: var(--cream-warm);
  border-bottom: 1px solid var(--border);
  padding: 0 64px;
}

.view-tabs-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  padding: 14px 0;
  margin-right: auto;
}

.view-tab {
  padding: 16px 24px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--warm-gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.view-tab:hover { color: var(--ink); }

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

.flashcard-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 64px 64px;
}

.flashcard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 640px;
  margin-bottom: 32px;
}

.flashcard-count {
  font-size: 13px;
  color: var(--warm-gray);
}

.flashcard-count strong {
  color: var(--ink);
  font-family: 'Playfair Display', serif;
  font-size: 18px;
}

.flashcard-filter {
  display: flex;
  gap: 8px;
}

.filter-pill {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--warm-gray);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  background: none;
}

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

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

.flashcard {
  width: 100%;
  max-width: 640px;
  min-height: 340px;
  perspective: 1000px;
  cursor: pointer;
  margin-bottom: 32px;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 340px;
  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;
  top: 0; left: 0; right: 0;
  min-height: 340px;
  backface-visibility: hidden;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px;
  text-align: center;
}

.flashcard-front {
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(30, 16, 8, 0.06);
}

.flashcard-front .card-module {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--burgundy-light);
  font-weight: 600;
  margin-bottom: 20px;
  background: rgba(107, 29, 42, 0.06);
  padding: 5px 14px;
  border-radius: 4px;
}

.flashcard-front h3 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  max-width: 480px;
  letter-spacing: -0.3px;
}

.flashcard-front .hint {
  margin-top: 24px;
  font-size: 13px;
  color: var(--warm-gray-light);
}

.flashcard-back {
  background: var(--burgundy-deep);
  transform: rotateY(180deg);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.flashcard-back .card-module {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 20px;
}

.flashcard-back p {
  font-family: 'Source Serif 4', serif;
  font-size: 17px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 300;
  max-width: 480px;
}

.flashcard-back .detail {
  margin-top: 20px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

.grade-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 640px;
  margin-bottom: 32px;
}

.grade-btn {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  background: none;
}

.grade-btn.miss {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid rgba(155, 59, 59, 0.15);
}

.grade-btn.miss:hover {
  background: rgba(155, 59, 59, 0.14);
  border-color: rgba(155, 59, 59, 0.3);
}

.grade-btn.got-it {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid rgba(61, 122, 74, 0.15);
}

.grade-btn.got-it:hover {
  background: rgba(61, 122, 74, 0.14);
  border-color: rgba(61, 122, 74, 0.3);
}

.card-progress {
  display: flex;
  gap: 6px;
  align-items: center;
  max-width: 640px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.2s;
}

.card-dot.current {
  background: var(--burgundy);
  width: 24px;
  border-radius: 4px;
}

.card-dot.done-good { background: var(--green); }
.card-dot.done-bad { background: var(--red); }

.quiz-container {
  padding: 48px 64px 64px;
  max-width: 760px;
}

.quiz-header {
  margin-bottom: 40px;
}

.quiz-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.quiz-header p {
  font-size: 14px;
  color: var(--warm-gray);
}

.quiz-progress-bar {
  height: 4px;
  background: var(--parchment);
  border-radius: 2px;
  margin-top: 20px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--burgundy);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.quiz-question-num {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--warm-gray-light);
  font-weight: 600;
  margin-bottom: 12px;
}

.quiz-question-text {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 28px;
  letter-spacing: -0.2px;
}

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

.quiz-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.quiz-option:hover {
  border-color: var(--burgundy-light);
  background: rgba(107, 29, 42, 0.02);
}

.quiz-option.selected {
  border-color: var(--burgundy);
  background: rgba(107, 29, 42, 0.04);
}

.quiz-option.correct {
  border-color: var(--green);
  background: var(--green-light);
}

.quiz-option.incorrect {
  border-color: var(--red);
  background: var(--red-light);
}

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

.quiz-option-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--parchment);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--warm-gray);
  flex-shrink: 0;
  transition: all 0.2s;
}

.quiz-option.selected .quiz-option-letter {
  background: var(--burgundy);
  color: #FFF;
}

.quiz-option.correct .quiz-option-letter {
  background: var(--green);
  color: #FFF;
}

.quiz-option.incorrect .quiz-option-letter {
  background: var(--red);
  color: #FFF;
}

.quiz-option-text {
  font-family: 'Source Serif 4', serif;
  font-size: 15px;
  color: var(--warm-gray);
  font-weight: 400;
  line-height: 1.5;
}

.quiz-option.selected .quiz-option-text,
.quiz-option.correct .quiz-option-text {
  color: var(--ink);
}

.quiz-explanation {
  background: linear-gradient(135deg, rgba(196, 151, 90, 0.08) 0%, rgba(196, 151, 90, 0.03) 100%);
  border: 1px solid rgba(196, 151, 90, 0.2);
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  padding: 20px 24px;
  margin-bottom: 28px;
  display: none;
}

.quiz-explanation.visible {
  display: block;
}

.quiz-explanation-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 8px;
}

.quiz-explanation p {
  font-family: 'Source Serif 4', serif;
  font-size: 14.5px;
  font-style: italic;
  line-height: 1.7;
  color: var(--warm-gray);
  font-weight: 300;
}

.quiz-nav {
  display: flex;
  justify-content: flex-end;
}

.quiz-next-btn {
  background: var(--burgundy);
  color: #FFF;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: none;
}

.quiz-next-btn.visible {
  display: block;
}

.quiz-next-btn:hover {
  background: var(--burgundy-light);
  transform: translateY(-1px);
}

.quiz-module-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.quiz-results {
  text-align: center;
  padding: 48px 0;
}

.quiz-results h2 {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 8px;
}

.quiz-results .score {
  font-family: 'Playfair Display', serif;
  font-size: 64px;
  font-weight: 900;
  color: var(--burgundy);
  margin: 24px 0;
}

.quiz-results .score-label {
  font-size: 14px;
  color: var(--warm-gray);
  margin-bottom: 40px;
}

.quiz-results-list {
  text-align: left;
  margin-top: 32px;
}

.quiz-results-list h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
}

.missed-question {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 10px;
}

.missed-question .mq-question {
  font-family: 'Source Serif 4', serif;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 8px;
  font-weight: 400;
}

.missed-question .mq-answer {
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
}

/* ========== MOBILE HEADER ========== */
.mobile-header {
  display: none;
}

.sidebar-overlay {
  display: none;
}

/* ========== RESPONSIVE — MOBILE ========== */
@media (max-width: 768px) {

  /* Mobile header — persistent top bar */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    height: 56px;
    padding: 0 16px;
    background: var(--burgundy-deep);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  /* Hamburger button */
  .hamburger {
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
  }

  .hamburger:active {
    background: rgba(255, 255, 255, 0.08);
  }

  .hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
  }

  .hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .hamburger.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .mobile-brand {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
    color: #FFF;
    letter-spacing: -0.3px;
  }

  .mobile-brand span {
    color: var(--gold);
  }

  .mobile-mastery {
    margin-left: auto;
    width: 64px;
  }

  .mobile-mastery-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
  }

  .mobile-mastery-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gold), var(--gold-muted));
    border-radius: 2px;
    transition: width 0.6s ease;
  }

  /* Sidebar becomes a slide-out drawer */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 14;
    background: rgba(30, 16, 8, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }

  .sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 15;
    top: 0;
    padding-top: 56px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(30, 16, 8, 0.25);
  }

  .sidebar-brand {
    padding: 20px 24px 18px;
  }

  /* Main content shifts down for fixed header */
  .main {
    margin-left: 0;
    padding-top: 56px;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Prevent anything from breaking viewport */
  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  /* Module hero — compact mobile version */
  .module-hero {
    padding: 28px 20px 24px;
  }

  .module-hero h2 {
    font-size: 26px;
    line-height: 1.15;
    letter-spacing: -0.3px;
  }

  .module-hero p {
    font-size: 14.5px;
    line-height: 1.5;
  }

  .module-meta {
    gap: 14px;
    margin-top: 16px;
    flex-wrap: wrap;
  }

  .module-meta-item {
    font-size: 11px;
  }

  /* Content area — tighter mobile padding */
  .content-area {
    padding: 24px 16px 40px;
  }

  .section-intro {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 28px;
    padding-bottom: 24px;
  }

  /* Content cards */
  .content-card {
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 12px;
  }

  .content-card:hover {
    transform: none;
    box-shadow: none;
  }

  .content-card h3 {
    font-size: 18px;
  }

  .content-card p {
    font-size: 14px;
    line-height: 1.7;
  }

  .sommelier-note {
    padding: 16px 18px;
    margin: 18px 0 0;
  }

  .sommelier-note p {
    font-size: 13.5px;
  }

  /* Content cards — prevent overflow */
  .content-card {
    overflow: hidden;
  }

  /* Data tables — convert to stacked cards on mobile */
  .data-table {
    display: block;
    border: none;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .data-table tr {
    display: block;
    background: var(--cream-warm);
    border-radius: 8px;
    padding: 14px 16px;
    border: none;
  }

  .data-table td {
    display: block;
    padding: 2px 0;
    border: none;
    font-size: 13px;
    line-height: 1.5;
  }

  .data-table td:first-child {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    color: var(--ink);
    font-size: 14px;
    margin-bottom: 4px;
  }

  .data-table td:not(:first-child)::before {
    content: attr(data-label);
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 9px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--warm-gray-light);
    font-weight: 600;
    margin-bottom: 2px;
  }

  /* CTA banner — stack vertically */
  .cta-banner {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
    border-radius: 12px;
    gap: 16px;
    margin-top: 28px;
  }

  .cta-banner h3 {
    font-size: 18px;
  }

  .cta-banner p {
    font-size: 12.5px;
  }

  /* Page footer nav */
  .page-footer {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
    margin-top: 32px;
    padding-top: 20px;
  }

  .page-footer span {
    text-align: center;
  }

  .page-nav {
    justify-content: center;
  }

  .page-nav-btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  /* View tabs — compact */
  .view-tabs {
    padding: 0 16px;
    gap: 0;
  }

  .view-tabs-title {
    font-size: 14px;
    padding: 12px 0;
  }

  .view-tab {
    padding: 12px 14px;
    font-size: 12.5px;
  }

  /* Flashcard mode */
  .flashcard-container {
    padding: 24px 16px 40px;
  }

  .flashcard-header {
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
  }

  .flashcard-filter {
    flex-wrap: wrap;
  }

  .flashcard {
    min-height: 280px;
  }

  .flashcard-inner {
    min-height: 280px;
  }

  .flashcard-front,
  .flashcard-back {
    min-height: 280px;
    padding: 28px 24px;
  }

  .flashcard-front h3 {
    font-size: 20px;
    line-height: 1.4;
  }

  .flashcard-back p {
    font-size: 15px;
    line-height: 1.65;
  }

  .grade-buttons {
    gap: 10px;
  }

  .grade-btn {
    padding: 14px 12px;
    font-size: 14px;
    border-radius: 10px;
  }

  /* Quiz mode */
  .quiz-container {
    padding: 24px 16px 40px;
  }

  .quiz-header h2 {
    font-size: 22px;
  }

  .quiz-question-text {
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 20px;
  }

  .quiz-option {
    padding: 14px 16px;
    gap: 12px;
  }

  .quiz-option-letter {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .quiz-option-text {
    font-size: 14px;
  }

  .quiz-explanation {
    padding: 16px 18px;
  }

  .quiz-explanation p {
    font-size: 13.5px;
  }

  .quiz-module-selector {
    gap: 6px;
  }

  .filter-pill {
    padding: 6px 12px;
    font-size: 11.5px;
  }

  .quiz-results .score {
    font-size: 48px;
  }

  .quiz-results h2 {
    font-size: 24px;
  }

  .missed-question {
    padding: 16px 18px;
  }

  /* Progress dots — smaller on mobile */
  .card-dot {
    width: 6px;
    height: 6px;
  }

  .card-dot.current {
    width: 18px;
  }
}
