:root {
  --bg: #ece4d7;
  --card: #fffaf1;
  --ink: #161b19;
  --muted: #7a766e;
  --line: #e2d7c8;
  --saffron: #d78225;
  --maroon: #8e2634;
  --teal: #087269;
  --soft: #f1e5d3;
  --shadow: 0 10px 30px rgba(38, 29, 20, 0.1);
  /* Selection and the mobile tap flash, or the UA paints both blue. */
  --select: rgba(8, 114, 105, 0.22);
  --tap: rgba(8, 114, 105, 0.15);
}

::selection {
  background: var(--select);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  -webkit-tap-highlight-color: var(--tap);
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  line-height: 1.45;
}

button {
  font: inherit;
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


/* ---------- Buttons ---------- */

.primary,
.secondary {
  border: none;
  border-radius: 14px;
  padding: 13px 20px;
  font-weight: 700;
}

.primary {
  background: var(--maroon);
  color: #fff;
}

.primary.teal {
  background: var(--teal);
}

.secondary {
  background: var(--soft);
  color: var(--ink);
}

.primary:hover,
.secondary:hover {
  filter: brightness(1.06);
}

.ghost {
  background: none;
  border: none;
  color: var(--teal);
  font-weight: 700;
  padding: 6px 8px;
}

.ghost.muted {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.danger {
  border: none;
  border-radius: 14px;
  padding: 13px 20px;
  font-weight: 700;
  background: var(--maroon);
  color: #fff;
}

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 250, 241, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

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

.brand strong {
  font-size: 1.02rem;
}

.badge {
  background: var(--soft);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav-tab {
  border: none;
  background: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  color: var(--muted);
}

.nav-tab.active {
  background: var(--ink);
  color: var(--card);
}

/* ---------- Layout ---------- */

.main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 140px;
}

.screen-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.screen-title h1 {
  font-size: 1.6rem;
}

.hero-card {
  background: var(--card);
  border-radius: 20px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.hero-card h2 {
  font-size: 1.35rem;
  margin: 4px 0 12px;
}

.source {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.progress-row {
  display: flex;
  gap: 5px;
}

.progress-seg {
  height: 6px;
  flex: 1;
  border-radius: 999px;
  background: var(--line);
}

.progress-seg.active {
  background: var(--saffron);
}

.progress-seg.done {
  background: var(--teal);
}

.prompt {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 14px;
}

/* ---------- Home ---------- */

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.stat {
  background: var(--card);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.stat strong {
  display: block;
  margin-top: 4px;
}

.flow {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.flow-step {
  flex: 1;
  background: var(--soft);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}

.flow-step span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--card);
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.flow-step strong {
  display: block;
  font-size: 0.88rem;
}

.today-card {
  background: var(--card);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.item-list {
  display: grid;
  gap: 10px;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1.5px solid transparent;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.item-row.current {
  border-color: var(--saffron);
}

.item-row .titles strong {
  display: block;
  font-size: 1.05rem;
}

.status-chip {
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.74rem;
  font-weight: 800;
  background: var(--soft);
  color: var(--muted);
  white-space: nowrap;
}

.status-chip.perfect {
  background: rgba(8, 114, 105, 0.14);
  color: var(--teal);
}

.status-chip.almost {
  background: rgba(215, 130, 37, 0.16);
  color: var(--saffron);
}

.status-chip.review {
  background: rgba(142, 38, 52, 0.12);
  color: var(--maroon);
}

.shlok-group {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  padding: 4px 0;
}

.shlok-group summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}

.shlok-group summary::-webkit-details-marker {
  display: none;
}

.shlok-summary-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.shlok-summary-title strong {
  font-size: 1.05rem;
}

.shlok-summary-title::before {
  content: "›";
  color: var(--muted);
  font-weight: 800;
  transition: transform 0.15s ease;
  display: inline-block;
}

.shlok-group[open] .shlok-summary-title::before {
  transform: rotate(90deg);
}

.shlok-group .item-list {
  padding: 0 10px 10px;
}

.shlok-group .item-row {
  box-shadow: none;
  background: var(--soft);
}

/* Quarter headers: a light section label above the shlok cards (not a card
   themselves), collapsible so Q1 can be tucked away once a kid moves on. */
.quarter-group {
  background: transparent;
  margin-bottom: 18px;
}

.quarter-group > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 6px 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quarter-group > summary::-webkit-details-marker {
  display: none;
}

.quarter-group > summary::before {
  content: "›";
  font-weight: 800;
  transition: transform 0.15s ease;
  display: inline-block;
}

.quarter-group[open] > summary::before {
  transform: rotate(90deg);
}

/* The "mark the whole quarter done" tick, on the right of the quarter header.
   A real checkbox so it is keyboard- and screen-reader-native; the label
   swallows the click so ticking does not also collapse the quarter. */
.quarter-name {
  white-space: nowrap;
}

.quarter-done {
  margin-left: auto;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.quarter-done:hover {
  filter: brightness(0.97);
}

.quarter-done.on {
  background: rgba(8, 114, 105, 0.14);
  color: var(--teal);
}

.quarter-done input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--teal);
  cursor: pointer;
}

.quarter-group > summary .quarter-meta {
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* On a phone the header runs out of room, so the counts drop to their own
   line and the tick stays up beside the quarter name. */
@media (max-width: 520px) {
  .quarter-group > summary .quarter-meta {
    order: 3;
    flex-basis: 100%;
    padding-left: 18px;
  }

  .quarter-done {
    order: 2;
  }
}

.quarter-body .shlok-group:last-child {
  margin-bottom: 0;
}

.reset-zone {
  margin-top: 28px;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.content-warning {
  background: rgba(142, 38, 52, 0.1);
  border: 1.5px solid rgba(142, 38, 52, 0.35);
  color: var(--maroon);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.rating-help {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 12px;
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

/* ---------- First-time walkthrough ---------- */

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(22, 27, 25, 0.55);
  animation: fade-in 0.25s ease both;
}

.tour-spotlight {
  position: relative;
  z-index: 70;
  border-radius: 14px;
  animation: spot-pulse 1.6s ease-in-out infinite;
}

/* Text-only targets need a backing card; buttons keep their own colors. */
.tour-spotlight:not(button) {
  background: var(--card);
}

.tour-card {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 140px; /* fallback when a step has no spotlight target */
  width: min(94vw, 500px);
  z-index: 80;
  background: var(--card);
  border-radius: 22px;
  padding: 26px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: rise-up 0.35s ease both;
}

.tour-card.anchored {
  bottom: auto;
  transform: none;
  animation-name: rise-up-plain;
}

.tour-card .source {
  font-size: 0.9rem;
}

.tour-text {
  font-size: 1.22rem;
  font-weight: 600;
  margin-top: 8px;
  line-height: 1.55;
}

.tour-actions {
  display: grid;
  gap: 6px;
  margin-top: 20px;
}

.tour-actions .primary {
  width: 100%;
  padding: 13px 30px;
  font-size: 1.05rem;
}

.tour-actions .ghost {
  font-size: 1rem;
}

/* ---------- Read ---------- */

.line-pair {
  background: var(--card);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.line-pair .mukhpath-line {
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.6;
}

.line-pair .meaning {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

/* The per-line "what this line means" note, as a disclosure. It starts closed:
   the literal English is already directly above it, so the note is opt-in
   rather than doubling the height of every card. Matches the First Letters
   artifact, where the same box opens by default on the first-letters screen
   because no translation is on screen there. */
.line-pair .line-note {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.5;
}

.line-pair .line-note[open] {
  padding-bottom: 12px;
}

.line-note-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  color: var(--teal);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  list-style: none;
}

/* Both selectors are needed: WebKit still uses the pseudo-element. */
.line-note-label::-webkit-details-marker {
  display: none;
}

.line-note-label::after {
  content: "▾";
  font-size: 0.85rem;
  letter-spacing: 0;
  transition: transform 0.15s ease;
}

.line-note[open] > .line-note-label::after {
  transform: rotate(180deg);
}

.line-note-body {
  margin-top: 6px;
}

.line-hint-note {
  margin-top: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .line-note-label::after {
    transition: none;
  }
}

/* ---------- Memorize ---------- */

.line-card {
  background: var(--card);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.line-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.count-pill {
  background: var(--soft);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 800;
}

.line-text {
  font-size: 1.45rem;
  font-weight: 600;
  min-height: 5.5rem;
}

.word-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
}

.word {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  filter: blur(8px);
  user-select: none;
  cursor: pointer;
  transition: filter 0.6s ease;
  animation: cloud-drift 5s ease-in-out infinite alternate;
  will-change: transform, filter;
}

.word.revealed {
  filter: none;
  animation: none;
}

.line-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.line-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.line-actions.single {
  grid-template-columns: 1fr;
}

.line-dots {
  display: flex;
  gap: 6px;
  margin-top: 16px;
}

.line-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
}

.line-dot.done {
  background: var(--teal);
}

.line-dot.active {
  background: var(--saffron);
}

.complete-card {
  background: rgba(8, 114, 105, 0.1);
  border: 1.5px solid rgba(8, 114, 105, 0.3);
  color: var(--teal);
  font-weight: 600;
  border-radius: 18px;
  padding: 20px;
}

.finished-card {
  background: var(--card);
  border-radius: 20px;
  padding: 36px 24px 26px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: pop-in 0.3s ease both;
}

.finished-card h2 {
  margin-top: 14px;
  font-size: 1.4rem;
}

.finished-card .source {
  margin-top: 6px;
  font-size: 0.95rem;
}

.finished-check {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 1.7rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

/* ---------- Recall ---------- */

.recall-box {
  background: var(--card);
  border-radius: 20px;
  padding: 40px 24px;
  box-shadow: var(--shadow);
  text-align: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.mic {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.text-card {
  background: var(--card);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.mukhpath-text {
  font-size: 1.3rem;
  font-weight: 600;
}

.text-card .meaning {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

.rating-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.rating-row button {
  border: none;
  border-radius: 16px;
  padding: 14px 10px;
  display: grid;
  gap: 3px;
  justify-items: center;
}

.rating-row button strong {
  font-weight: 800;
  font-size: 1.05rem;
}

.rating-row button span {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.85;
}

.rating-row [data-rating="perfect"] {
  background: var(--teal);
  color: #fff;
}

.rating-row [data-rating="almost"] {
  background: var(--saffron);
  color: #fff;
}

.rating-row [data-rating="review"] {
  background: var(--maroon);
  color: #fff;
}

/* ---------- Bottom dock (item switcher + mobile nav) ---------- */

.bottom-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: rgba(255, 250, 241, 0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}

.dock-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
}

.item-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-label {
  text-align: center;
}

.item-label p {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.item-label strong {
  font-size: 0.92rem;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--soft);
  font-size: 1.2rem;
  font-weight: 800;
}

.mobile-nav {
  display: none;
  gap: 4px;
}

.mobile-nav .nav-tab {
  flex: 1;
  text-align: center;
  padding: 9px 4px;
  font-size: 0.85rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
  .site-header .nav {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .main {
    padding-bottom: 170px;
  }
}

@media (max-width: 640px) {
  .screen-title h1 {
    font-size: 1.35rem;
  }

  .line-text {
    font-size: 1.25rem;
  }

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


/* ---------- Motion ---------- */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise-up {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes rise-up-plain {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes view-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spot-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--saffron); }
  50% { box-shadow: 0 0 0 8px rgba(215, 130, 37, 0.55); }
}

@keyframes blur-hide {
  from { filter: blur(0); }
  to { filter: blur(10px); }
}

@keyframes cloud-drift {
  from { transform: translateY(-1.5px); }
  to { transform: translateY(1.5px); }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

#app.view-anim > *:not(.tour-card):not(.tour-overlay) {
  animation: view-rise 0.35s ease both;
}

#app.view-anim > *:nth-child(2):not(.tour-card):not(.tour-overlay) { animation-delay: 0.04s; }
#app.view-anim > *:nth-child(3):not(.tour-card):not(.tour-overlay) { animation-delay: 0.08s; }
#app.view-anim > *:nth-child(4):not(.tour-card):not(.tour-overlay) { animation-delay: 0.12s; }
#app.view-anim > *:nth-child(5):not(.tour-card):not(.tour-overlay) { animation-delay: 0.16s; }
#app.view-anim > *:nth-child(6):not(.tour-card):not(.tour-overlay) { animation-delay: 0.2s; }
#app.view-anim > *:nth-child(n + 7):not(.tour-card):not(.tour-overlay) { animation-delay: 0.24s; }

.primary,
.secondary,
.danger,
.icon-button,
.nav-tab,
.rating-row button,
.ghost {
  transition: transform 0.15s ease, filter 0.15s ease, background 0.2s ease, color 0.2s ease;
}

.primary:hover,
.secondary:hover,
.danger:hover,
.rating-row button:hover {
  transform: translateY(-1px);
}

.primary:active,
.secondary:active,
.danger:active,
.icon-button:active,
.rating-row button:active {
  transform: scale(0.97);
}

.item-row {
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.item-row:hover {
  transform: translateY(-2px);
}

.progress-seg,
.line-dot {
  transition: background 0.3s ease;
}

.word-cloud .word:not(.revealed) {
  animation-name: cloud-drift;
}

.line-hint,
.rating-row,
.complete-card,
.recall-box,
.text-card {
  animation: pop-in 0.3s ease both;
}

.shlok-group[open] .item-list {
  animation: fade-in 0.25s ease both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.tour-text mark {
  background: rgba(215, 130, 37, 0.28);
  color: inherit;
  font-weight: 800;
  border-radius: 5px;
  padding: 0 4px;
}

/* One-shot feedback when a read is tapped */

@keyframes pill-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); background: var(--saffron); color: #fff; }
  100% { transform: scale(1); }
}

.count-pill.pulse {
  animation: pill-pop 0.5s ease;
}

@keyframes read-flash {
  0% { background: rgba(215, 130, 37, 0.2); transform: scale(0.99); }
  100% { background: transparent; transform: scale(1); }
}

.line-text.read-flash {
  animation: read-flash 0.6s ease;
  border-radius: 12px;
}

/* ---------- Show Shloka modal + Read toolbar ---------- */

.read-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.read-toolbar .prompt {
  flex: 1;
}

.read-toolbar .ghost {
  white-space: nowrap;
}

/* ---------- Listen player ---------- */

.audio-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 4px 0 14px;
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: none;
  color: var(--teal);
  font-weight: 700;
  padding: 4px 6px;
  min-height: 40px;
}

.audio-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
}

.audio-icon svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.audio-icon .icon-pause {
  display: none;
}

.audio-btn[aria-pressed="true"] .icon-play {
  display: none;
}

.audio-btn[aria-pressed="true"] .icon-pause {
  display: block;
}

/* Track + timer move as one unit, so on a phone they wrap to a second line
   together rather than the timer stranding one of the buttons. */
.audio-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.audio-track {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.audio-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--teal);
  transition: width 0.2s linear;
}

.audio-time {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 6.5ch;
  text-align: right;
}

/* Repeat and speed. Unfilled until on, so the row still reads as one Listen
   control rather than three competing buttons. */
.audio-opt {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0 6px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.audio-opt:hover {
  background: var(--soft);
}

/* Stroke icons, unlike the filled play/pause glyphs above. */
.audio-opt svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The speed label is small bold text, so it needs 4.5:1, which teal ink on a
   teal wash misses (~4.1:1). Ink instead — and the button always shows a
   value, so unlike the repeat icon it is never really "off". */
.audio-speed {
  color: var(--ink);
}

/* Repeat is a true on/off, so it uses aria-pressed. Speed cycles, so "on"
   there just means it has been moved off normal speed — data-active, since
   aria-pressed would claim a two-state control it isn't. Both go to a solid
   teal fill, like the play button, rather than a wash: white on teal clears
   the bar at this size where teal-on-wash does not. */
.audio-opt[aria-pressed="true"],
.audio-opt[data-active] {
  background: var(--teal);
  color: #fff;
}

/* The filled state and :hover have equal specificity, so the fill wins and
   the background hover above stops applying — brightness keeps the feedback. */
.audio-opt[aria-pressed="true"]:hover,
.audio-opt[data-active]:hover {
  filter: brightness(1.08);
}

/* On a phone, Listen + repeat + speed already fill the row, leaving the
   progress bar a couple of dozen pixels. So the bar and its timer drop to a
   full-width second line instead of being squeezed into a stub. */
@media (max-width: 430px) {
  .audio-player {
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .audio-btn {
    order: 1;
    margin-right: auto;
  }

  .audio-opt[data-audio-loop] {
    order: 2;
  }

  .audio-speed {
    order: 3;
  }

  .audio-progress {
    order: 4;
    flex-basis: 100%;
    gap: 8px;
  }

  .audio-time {
    font-size: 0.74rem;
    min-width: 0;
  }
}

.meaning-card .source {
  margin-bottom: 6px;
}

.shloka-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(94vw, 520px);
  max-height: 80vh;
  overflow-y: auto;
  z-index: 80;
  background: var(--card);
  border-radius: 22px;
  padding: 26px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: shloka-pop 0.3s ease both;
}

.shloka-modal .shloka-line {
  font-size: 1.15rem;
  font-weight: 600;
  font-style: italic;
  line-height: 1.6;
  margin-top: 8px;
}

.shloka-modal .meaning {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

@keyframes shloka-pop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.shlok-group.empty summary .source {
  font-style: italic;
}

.shloka-inline {
  padding: 0 18px 16px;
}

.shloka-inline .shloka-line {
  font-size: 1.05rem;
  font-weight: 600;
  font-style: italic;
  line-height: 1.6;
}

.shloka-inline .meaning {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.text-card .mukhpath-text + .mukhpath-text {
  margin-top: 10px;
}

.line-hint {
  max-height: 9rem;
  overflow-y: auto;
}

.hint-label {
  display: block;
  color: var(--saffron);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.tap-hint {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 10px;
}

/* ---------- Toast ---------- */

/* One short message at a time, above the dock. Hidden from pointer events so
   it never sits between a thumb and a button underneath it. */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 90;
  width: min(420px, calc(100vw - 32px));
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
