/* de Lima's Wine Academy — Mobile-first Design System
   Dark burgundy + warm cream "MasterClass feel", system serif display headings,
   strictly tested at 360px–414px (zero horizontal overflow) and responsive up to desktop. */

:root {
  --bg-deep: #15080d;
  --bg-surface: #210e16;
  --bg-card: #2b131d;
  --bg-card-hover: #361824;
  --bg-elevated: #3a1a27;
  --bg-cream: #f8f3eb;
  --bg-cream-soft: #efe6d8;

  --text-cream: #f7f1e8;
  --text-muted: #cbb9c0;
  --text-dim: #9e8891;
  --text-dark: #231018;
  --text-dark-muted: #5b434c;

  --accent-gold: #dca85e;
  --accent-gold-bright: #eec17a;
  --accent-gold-dim: rgba(220, 168, 94, 0.18);
  --accent-wine: #8b243f;
  --accent-wine-light: #b83a5b;

  --color-success: #39b87e;
  --color-success-bg: rgba(57, 184, 126, 0.15);
  --color-danger: #e45c6a;
  --color-danger-bg: rgba(228, 92, 106, 0.16);

  --border-subtle: rgba(247, 241, 232, 0.11);
  --border-gold: rgba(220, 168, 94, 0.38);

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.35);
  --topbar-h: 60px;
  --bottombar-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg-deep);
  color: var(--text-cream);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #2f121e 0%, var(--bg-deep) 65%);
  color: var(--text-cream);
  padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  overflow-x: clip;
}

body.has-install-toast {
  padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom, 0px) + 76px);
}

a {
  color: var(--accent-gold);
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-gold-bright);
  outline-offset: 2px;
}

.noscript-banner {
  background: var(--accent-wine);
  color: var(--text-cream);
  padding: 12px 16px;
  text-align: center;
  font-size: 0.9rem;
}

/* Status & Install Banners */
.status-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-banner[hidden] {
  display: none !important;
}

.status-banner--offline {
  background: #3d2410;
  color: #f6d59e;
  border-bottom: 1px solid rgba(220, 168, 94, 0.35);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-gold);
  flex-shrink: 0;
}

.status-banner--install {
  position: fixed;
  bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom, 0px) + 8px);
  left: 10px;
  right: 10px;
  z-index: 150;
  background: rgba(33, 14, 22, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  max-height: 56px;
  box-sizing: border-box;
}

.install-banner-msg {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--text-cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.install-banner-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.install-banner-actions .btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
  min-height: 32px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  border-radius: 50%;
  color: var(--text-muted);
}

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

@media (min-width: 900px) {
  .status-banner--install {
    bottom: 20px;
    left: auto;
    right: 20px;
    max-width: 380px;
  }
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--topbar-h);
  background: rgba(21, 8, 13, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 12px;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-cream);
  min-height: 44px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand-emblem {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-wine), #561325);
  border: 1px solid var(--border-gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
  flex-shrink: 0;
}

.brand-wordmark {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  line-height: 1.15;
  color: var(--text-cream);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topnav {
  display: none;
  align-items: center;
  gap: 6px;
}

.topnav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 44px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.topnav-link:hover {
  color: var(--text-cream);
  background: rgba(255, 255, 255, 0.05);
}

.topnav-link.is-active {
  color: var(--bg-deep);
  background: var(--accent-gold);
  font-weight: 600;
}

.topbar-stats {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  min-height: 38px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-cream);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.stat-pill--streak .icon-flame {
  color: #f38b3c;
}

.stat-pill--xp .xp-num {
  color: var(--accent-gold);
}

.stat-pill--xp .xp-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 2px;
}

.lang-sep {
  color: var(--text-dim);
  font-size: 0.7rem;
  user-select: none;
}

.lang-btn {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 8px;
  min-height: 36px;
  min-width: 34px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.lang-btn.is-active {
  background: var(--accent-gold);
  color: var(--bg-deep);
}

/* Main container */
.app-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 14px 32px;
}

/* Bottom Tab Bar (phones <900px) */
.bottom-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(var(--bottombar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(21, 8, 13, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  min-height: 48px;
  padding: 6px 4px;
  text-align: center;
}

.bottom-tab svg {
  width: 20px;
  height: 20px;
}

.bottom-tab.is-active {
  color: var(--accent-gold);
}

/* Typography & Shared Elements */
.eyebrow {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

h1, h2, h3, .serif-heading {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.22;
  margin: 0 0 8px;
}

.hero-title {
  font-size: 1.65rem;
  color: var(--text-cream);
}

.section-title {
  font-size: 1.35rem;
  color: var(--text-cream);
}

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

/* Cards & Buttons */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.card + .card {
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}

.btn:active:not(:disabled) {
  transform: scale(0.99);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold), #c58d3f);
  color: var(--bg-deep);
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-gold-bright);
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-gold);
  color: var(--text-cream);
}

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

.btn-ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.btn-success {
  background: var(--color-success);
  color: #092216;
  font-weight: 700;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  font-weight: 700;
}

.btn-sm {
  min-height: 40px;
  padding: 6px 12px;
  font-size: 0.84rem;
}

.btn-block {
  width: 100%;
}

/* HOME SCREEN */
.home-hero {
  margin-bottom: 20px;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.choice-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-gold);
  background: linear-gradient(155deg, #351522 0%, #230e17 100%);
  color: var(--text-cream);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, border-color 0.15s;
  min-height: 156px;
}

.choice-card--long {
  background: linear-gradient(155deg, #2b1824 0%, #1c0d16 100%);
  border-color: rgba(247, 241, 232, 0.22);
}

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

.choice-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.choice-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.choice-card-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin: 0 0 6px;
  color: var(--text-cream);
}

.choice-card-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.choice-card-cta {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-gold);
}

/* Next Up Card */
.next-up-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(135deg, #2d141f, #220f17);
  border: 1px solid var(--border-gold);
  margin-bottom: 16px;
}

.next-up-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.next-up-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin: 0;
}

/* Dashboard row: Daily Goal Ring + Level Bar */
.home-stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.goal-ring-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.svg-ring {
  flex-shrink: 0;
  transform: rotate(-90deg);
}

.svg-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
}

.svg-ring-fg {
  fill: none;
  stroke: var(--accent-gold);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s ease;
}

.svg-ring-fg--green {
  stroke: var(--color-success);
}

.ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ring-label {
  position: absolute;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-cream);
}

.level-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 8px;
}

.level-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-wine-light), var(--accent-gold));
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

/* Module L1.3 Summary Card */
.module-card {
  margin-bottom: 16px;
}

.module-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.module-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.mini-stat {
  background: rgba(0, 0, 0, 0.22);
  padding: 8px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.mini-stat-val {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent-gold);
}

.mini-stat-lbl {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Badges Strip */
.badges-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-gold);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-chip.is-locked {
  opacity: 0.45;
  border-color: var(--border-subtle);
  filter: grayscale(1);
}

/* VINE SCROLL SECTION */
.vine-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.vine-scroll-track {
  position: relative;
  height: 360vh;
}

.vine-step-container {
  position: relative;
}

.vine-sticky-stage {
  position: sticky;
  top: max(calc(var(--topbar-h) + 8px), calc(50vh - 180px));
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.vine-stage-header {
  padding: 10px 14px 6px;
  background: var(--bg-card);
  text-align: center;
}

.vine-stage-heading {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--accent-gold);
}

.vine-stage-hint {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.vine-frame-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #12070b;
  overflow: hidden;
}

.vine-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.08s linear;
  will-change: opacity;
}

.vine-badge-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.vine-season-pill,
.vine-counter-pill {
  background: rgba(21, 8, 13, 0.82);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-gold);
  color: var(--text-cream);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
}

.vine-caption-bar {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card);
}

.vine-caption-text {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.vine-stage-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--accent-gold);
}

.vine-stage-season {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.vine-stepper {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.vine-dot {
  min-height: 44px;
  background: transparent;
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.vine-dot-inner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transition: transform 0.15s, background 0.15s;
}

.vine-dot.is-active .vine-dot-inner {
  background: var(--accent-gold);
  transform: scale(1.35);
}

.vine-step-controls {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* QUICK STUDY SCREEN */
.quick-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gold);
  transition: width 0.25s ease;
}

.combo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(243, 139, 60, 0.18);
  border: 1px solid rgba(243, 139, 60, 0.45);
  color: #ffb067;
  font-size: 0.78rem;
  font-weight: 700;
}

.drill-card {
  position: relative;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 16px;
}

.flashcard-box {
  background: var(--bg-cream);
  color: var(--text-dark);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--accent-gold);
  box-shadow: var(--shadow-card);
}

.flashcard-prompt {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.38;
  color: var(--text-dark);
  margin: 0 0 12px;
}

.flashcard-back {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(35, 16, 24, 0.15);
  font-size: 1.02rem;
  color: #3d1626;
  font-weight: 600;
}

.flashcard-hint {
  font-size: 0.82rem;
  color: var(--text-dark-muted);
  margin-top: auto;
}

.options-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-cream);
  text-align: left;
  cursor: pointer;
  font-size: 0.94rem;
  line-height: 1.4;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--accent-gold);
  background: var(--bg-card-hover);
}

.option-key {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.option-btn.is-selected {
  border-color: var(--accent-gold-bright);
  background: rgba(220, 168, 94, 0.16);
}

.option-btn.is-correct {
  border-color: var(--color-success);
  background: var(--color-success-bg);
}

.option-btn.is-wrong {
  border-color: var(--color-danger);
  background: var(--color-danger-bg);
}

.tf-statement-box {
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--accent-gold);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
}

.tf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.feedback-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
}

.feedback-panel--correct {
  background: var(--color-success-bg);
  border-color: var(--color-success);
}

.feedback-panel--wrong {
  background: var(--color-danger-bg);
  border-color: var(--color-danger);
}

.feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 8px;
}

.xp-pop {
  display: inline-block;
  background: var(--accent-gold);
  color: var(--bg-deep);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  animation: xpPop 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes xpPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.lesson-quote-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.28);
  border-left: 3px solid var(--accent-gold);
  border-radius: 6px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* LONG STUDY & READER */
.subnav-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.subnav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 44px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
}

.subnav-tab.is-active {
  background: var(--accent-gold);
  color: var(--bg-deep);
  border-color: var(--accent-gold);
}

.section-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-cream);
  min-height: 58px;
}

.section-row:hover {
  border-color: var(--accent-gold);
  background: var(--bg-card-hover);
}

.section-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-row.is-read .section-num {
  background: var(--color-success);
  color: #082015;
}

.reader-shell {
  max-width: 68ch;
  margin: 0 auto;
}

.reading-progress-sticky {
  position: sticky;
  top: var(--topbar-h);
  z-index: 40;
  background: rgba(21, 8, 13, 0.94);
  padding: 8px 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.reader-card {
  background: var(--bg-cream);
  color: var(--text-dark);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: var(--shadow-card);
}

.reader-card h1,
.reader-card h2,
.reader-card h3 {
  color: #2c0e1a;
}

.reader-body {
  font-size: 1.05rem;
  line-height: 1.72;
  color: #26131b;
}

.reader-body p {
  margin: 0 0 16px;
}

.reader-body strong {
  color: #4f1228;
}

.reader-body .md-list {
  padding-left: 20px;
  margin: 0 0 16px;
}

.reader-body .md-list li {
  margin-bottom: 10px;
}

.reader-mark-bar {
  position: sticky;
  bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom, 0px) + 8px);
  z-index: 35;
  margin-top: 16px;
  background: rgba(33, 14, 22, 0.95);
  backdrop-filter: blur(8px);
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-gold);
  box-shadow: var(--shadow-card);
}

.reader-nav-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

/* MAP SCREEN */
.map-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.schematic-map-box {
  background: #1a0b12;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 12px;
  position: relative;
}

.schematic-svg {
  width: 100%;
  max-height: 400px;
  height: auto;
  display: block;
}

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

.map-pin-circle {
  fill: var(--accent-wine-light);
  stroke: var(--text-cream);
  stroke-width: 2;
  transition: r 0.15s, fill 0.15s;
}

.map-pin-group.is-active .map-pin-circle {
  fill: var(--accent-gold-bright);
  stroke: #15080d;
}

.map-pin-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-cream);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.chip-btn.is-active {
  background: var(--accent-gold);
  color: var(--bg-deep);
  border-color: var(--accent-gold);
}

/* QUIZ & MOCK EXAM */
.short-answer-input {
  width: 100%;
  min-height: 90px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-gold);
  color: var(--text-cream);
  margin-top: 10px;
  resize: vertical;
}

.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-gold);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent-gold);
}

/* PROGRESS & SETTINGS */
.calendar-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.cal-day {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
}

.cal-day.is-done {
  background: var(--accent-gold-dim);
  border-color: var(--accent-gold);
}

.cal-day-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-transform: uppercase;
}

.cal-day-num {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-cream);
  margin-top: 1px;
}

.cal-day-dot {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.9rem;
}

.rings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.ring-stat-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.badges-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.badge-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-gold);
}

.badge-card.is-locked {
  opacity: 0.55;
  border-color: var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.badge-emoji {
  font-size: 1.7rem;
  line-height: 1;
  flex-shrink: 0;
}

.badge-card.is-locked .badge-emoji {
  filter: grayscale(1);
}

.srs-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.srs-row {
  display: grid;
  grid-template-columns: 82px 1fr 48px;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
}

.srs-bar-track {
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.srs-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-wine-light), var(--accent-gold));
  border-radius: var(--radius-pill);
}

.goal-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* Desktop & Tablet media queries */
@media (min-width: 640px) {
  .choice-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .home-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .rings-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .badges-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .map-layout {
    grid-template-columns: 1.1fr 1fr;
    align-items: start;
  }
  .next-up-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .brand-wordmark {
    font-size: 1.1rem;
  }
}

@media (min-width: 900px) {
  body {
    padding-bottom: 40px;
  }
  .bottom-tabs {
    display: none;
  }
  .topnav {
    display: flex;
  }
  .reader-mark-bar {
    bottom: 16px;
  }
  .hero-title {
    font-size: 2rem;
  }
  .reader-card {
    padding: 36px 40px;
  }
}

@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;
  }
}
