:root {
  --bg: #0A0A0A;
  --surface: #141414;
  --surface-2: #1C1C1C;
  --border: #262626;
  --text: #F3EFE6;
  --muted: #9E978B;
  --gold: #D4AF37;
  --gold-soft: rgba(212, 175, 55, 0.14);
  --danger: #E06C75;
  --success: #7EC699;
  --radius: 16px;
}

[data-theme="light"] {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-2: #F2ECE1;
  --border: #E5DCCB;
  --text: #1E1B18;
  --muted: #6E655A;
  --gold: #B08924;
  --gold-soft: rgba(176, 137, 36, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100dvh;
}

.serif-title {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.hidden { display: none !important; }

/* LOGIN */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px 24px;
  text-align: center;
}

.gold-ring {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 24px var(--gold-soft);
}

.eyebrow { font-size: 11px; letter-spacing: 2.5px; color: var(--gold); margin-bottom: 8px; text-transform: uppercase; }
.subtitle { font-size: 14px; color: var(--muted); margin: 8px 0 24px; }
.field-label { display: block; text-align: left; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

input, textarea, select {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  margin-bottom: 14px;
}

input:focus, textarea:focus, select:focus { border-color: var(--gold); }
textarea { min-height: 92px; resize: vertical; }

.btn-gold {
  width: 100%;
  background: var(--gold);
  color: #0A0A0A;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn-gold:active { transform: scale(0.98); }

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 10px;
  margin-top: 8px;
  font-size: 14px;
  cursor: pointer;
}

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 12px; }

/* APP SHELL */
.app-shell {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.greeting { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-track { width: 140px; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--gold); transition: width 0.4s ease; }
.progress-label { font-size: 12px; color: var(--muted); }

.pause-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 99px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 14px;
}

.main-content { flex: 1; padding: 18px 18px 96px; }

/* CARDS E SEÇÕES */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.card-gold {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-soft), var(--surface));
}

.install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px dashed var(--gold);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 12px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--gold);
  margin: 22px 0 10px;
}

/* TRILHA */
.chapter-list { display: flex; flex-direction: column; gap: 10px; }

.chapter-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  width: 100%;
}

.chapter-item.done { border-color: rgba(212, 175, 55, 0.45); }
.chapter-item.current { border-color: var(--gold); box-shadow: 0 0 16px var(--gold-soft); }

.chapter-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  color: var(--muted);
}

.chapter-item.done .chapter-dot { background: var(--gold); border-color: var(--gold); color: #0A0A0A; font-weight: 700; }
.chapter-item.current .chapter-dot { border-color: var(--gold); color: var(--gold); }
.chapter-meta { font-size: 12px; color: var(--muted); }
.chapter-name { font-size: 15px; font-weight: 600; }

/* ILUSTRAÇÃO E VÍDEO DO CAPÍTULO */
.chapter-art-wrap {
  margin: 14px 0 18px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: #000;
}
.chapter-art-img { width: 100%; display: block; max-height: 340px; object-fit: cover; }

.video-card {
  margin: 14px 0 18px;
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px;
}
.chapter-video {
  width: 100%;
  border-radius: 12px;
  background: #000;
  max-height: 480px;
  display: block;
}

/* PLAYER DE ÁUDIO (pronto para quando subir no futuro) */
.audio-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin: 14px 0 18px;
}
.audio-controls { display: flex; align-items: center; gap: 10px; }
.audio-play-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: var(--gold); color: #0A0A0A; font-size: 16px; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.audio-progress { flex: 1; accent-color: var(--gold); margin: 0; padding: 0; }
.audio-speed {
  background: var(--surface); color: var(--gold); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px; font-size: 12px; cursor: pointer;
}

/* TEXTO DA LIÇÃO */
.lesson-body p { margin-bottom: 14px; font-size: 16px; line-height: 1.75; }

.quote-card {
  text-align: center;
  padding: 22px 18px;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background: var(--gold-soft);
  margin: 18px 0;
}

.quote-text {
  font-family: Georgia, serif;
  font-size: 18px;
  font-style: italic;
  margin-bottom: 14px;
}

/* SUB-ABAS DO DIÁRIO */
.pill-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 14px; }
.pill-tab {
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
  border-radius: 99px; padding: 8px 14px; font-size: 13px; white-space: nowrap; cursor: pointer;
}
.pill-tab.active { background: var(--gold); color: #0A0A0A; border-color: var(--gold); font-weight: 600; }

/* PERFIL E MEDALHAS */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 10px; text-align: center;
}
.stat-num { font-size: 22px; font-weight: 700; color: var(--gold); }
.stat-lbl { font-size: 11px; color: var(--muted); }

.badges-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badge-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; opacity: 0.45;
}
.badge-card.unlocked { opacity: 1; border-color: var(--gold); background: var(--gold-soft); }
.badge-title { font-size: 14px; font-weight: 600; margin-top: 6px; }
.badge-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* MODAL (ONBOARDING E INSTALAÇÃO) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 22px;
  padding: 28px 22px;
  text-align: center;
}

.step-dots { display: flex; justify-content: center; gap: 8px; margin: 18px 0 16px; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.step-dot.active { background: var(--gold); width: 22px; border-radius: 99px; }

.install-steps {
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 14px;
}
.install-steps li { margin-left: 18px; margin-bottom: 8px; }

/* BARRA INFERIOR */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 540px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
}

.nav-btn {
  background: transparent; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; cursor: pointer;
}
.nav-btn.active { color: var(--gold); }
.nav-icon { font-size: 18px; }
.nav-label { font-size: 11px; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #0A0A0A;
  padding: 12px 18px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 70;
  max-width: 90%;
  text-align: center;
}