:root {
  --ink: #0c1018;
  --bg: #121a14;
  --bg-deep: #0a100c;
  --panel: rgba(22, 32, 26, 0.82);
  --panel-solid: #16201a;
  --text: #f4f0e6;
  --muted: #c4bba8;
  --dim: #8a8274;
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.16);
  --gold-line: rgba(212, 175, 55, 0.35);
  --cream: #f3ead7;
  --line: rgba(243, 234, 215, 0.1);
  --ok: #6bbf8a;
  --bad: #e07a7a;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Outfit", system-ui, sans-serif;
  --wallpaper: none;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}

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

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  line-height: 1.55;
  background:
    radial-gradient(ellipse 90% 55% at 50% -15%, rgba(212, 175, 55, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(80, 120, 90, 0.12), transparent 50%),
    linear-gradient(165deg, #141c16 0%, #0c1210 45%, #101816 100%);
  background-attachment: fixed;
}

/* Image URL is set via --wallpaper AND body inline styles (see wallpapers.js).
   Relative classic paths must be absolutized in JS — CSS var url() resolves
   against assets/css/style.css, which breaks assets/wallpapers/*.jpg. */
body.has-wallpaper {
  background-color: var(--bg-deep);
  background-image:
    linear-gradient(180deg, rgba(12, 16, 14, 0.72) 0%, rgba(12, 16, 14, 0.86) 100%),
    var(--wallpaper);
  background-size: auto, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: scroll, fixed;
}

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

a:hover {
  color: #f0d878;
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 50;
  background: var(--gold);
  color: var(--ink);
  padding: 0.4rem 0.7rem;
  border-radius: 0.5rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid var(--gold-line);
  background: rgba(10, 14, 12, 0.75);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
  transition: transform 0.22s ease, opacity 0.22s ease, box-shadow 0.22s ease;
  will-change: transform;
  min-height: 0;
}

/* Phone: hide sticky section header while scrolling down to free space */
.topbar.is-scroll-hidden {
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
  box-shadow: none;
}

.topbar:focus-within {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
}

.brand-mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.45rem;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ink);
  background: linear-gradient(145deg, #f0d878, var(--gold) 45%, #8f7417);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.22);
}

.brand strong {
  display: block;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand small {
  color: var(--dim);
  font-size: 0.65rem;
  line-height: 1.2;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  font-size: 0.8rem;
}

.top-nav a {
  color: var(--muted);
}

.top-nav a:hover {
  color: var(--cream);
}

main {
  max-width: 58rem;
  margin: 0 auto;
  padding: 1.1rem 1.2rem 3.5rem;
}

.hero {
  margin-bottom: 1rem;
  padding: 0.1rem 0.15rem 0.25rem;
}

.hero-compact h1 {
  font-size: clamp(1.65rem, 4.2vw, 2.25rem);
}

.hero-lead {
  margin: 0.45rem 0 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 0.3rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.1rem, 5.5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--cream);
}

.hero p {
  margin: 0.75rem 0 0;
  max-width: 40rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero-compact p.hero-lead {
  margin-top: 0.45rem;
  font-size: 0.95rem;
}

.panel {
  border: 1px solid var(--gold-line);
  border-radius: 1.1rem;
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  padding: 1.25rem 1.3rem 1.3rem;
  margin-bottom: 1.1rem;
}

.panel h2 {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--cream);
}

.panel > .hint,
.panel .hint {
  margin: 0 0 1rem;
  color: var(--dim);
  font-size: 0.9rem;
}

.theme-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.theme-card {
  text-align: left;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(40, 52, 42, 0.55), rgba(18, 24, 20, 0.75));
  color: inherit;
  border-radius: 0.9rem;
  padding: 0.95rem 1rem;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.theme-card:hover,
.theme-card:focus-visible {
  border-color: var(--gold-line);
  outline: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.theme-card.is-active {
  border-color: var(--gold);
  background: var(--gold-soft);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.25);
}

.theme-card .emoji {
  font-size: 1.3rem;
}

.theme-card strong {
  display: block;
  margin: 0.3rem 0 0.25rem;
  color: var(--cream);
}

.theme-card small {
  color: var(--dim);
  font-size: 0.82rem;
  line-height: 1.4;
  display: block;
}

/* Keep Topics compact while fitting as many sensible-width cards as space allows. */
.topics-panel .theme-grid {
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(clamp(7rem, 15vw, 9rem), 100%), 1fr)
  );
  grid-auto-rows: 13rem;
  max-height: calc(26rem + 0.7rem);
  padding: 0.1rem 0.4rem 0.1rem 0.1rem;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
  overscroll-behavior-y: contain;
  scrollbar-color: rgba(212, 175, 55, 0.45) rgba(0, 0, 0, 0.18);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scroll-snap-type: y proximity;
}

.topics-panel .theme-grid:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 0.3rem;
}

.topics-panel .theme-grid::-webkit-scrollbar {
  width: 7px;
}

.topics-panel .theme-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
}

.topics-panel .theme-grid::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.45);
  border-radius: 999px;
}

.topics-panel .theme-card-wrap {
  min-width: 0;
  height: 13rem;
  container: topic-card / inline-size;
  scroll-snap-align: start;
}

.topics-panel .theme-card-wrap .theme-card {
  height: 100%;
  overflow: hidden;
}

@container topic-card (max-width: 11rem) {
  .topics-panel .theme-card small {
    display: none;
  }

  .topics-panel .theme-card strong {
    font-size: 0.88rem;
    line-height: 1.2;
  }
}

.mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
  align-items: center;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip:hover {
  color: var(--cream);
  border-color: var(--gold-line);
}

.chip.is-active {
  color: var(--ink);
  background: linear-gradient(135deg, #f0d878, var(--gold));
  border-color: var(--gold);
  font-weight: 600;
}

.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 0.7rem;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--gold-line);
}

.btn.primary {
  background: linear-gradient(135deg, #f0d878, var(--gold));
  color: var(--ink);
  border-color: var(--gold);
}

.btn.primary:hover {
  filter: brightness(1.05);
}

.btn.ghost {
  background: transparent;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.ref {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.verse-prompt {
  margin: 0.75rem 0 0;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--text);
}

.verse-prompt .blank {
  display: inline-block;
  min-width: 3.5rem;
  border-bottom: 2px solid var(--gold);
  color: var(--gold);
  text-align: center;
  margin: 0 0.15rem;
  font-weight: 600;
}

.choices {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}

.choice {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.choice:hover:not(:disabled) {
  border-color: var(--gold-line);
}

.choice.is-correct {
  border-color: var(--ok);
  background: rgba(107, 191, 138, 0.12);
}

.choice.is-wrong {
  border-color: var(--bad);
  background: rgba(224, 122, 122, 0.12);
}

.input-block {
  margin-top: 1rem;
}

.input-block label {
  display: block;
  font-size: 0.8rem;
  color: var(--dim);
  margin-bottom: 0.35rem;
}

.input-block textarea,
.input-block input[type="text"] {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
  padding: 0.7rem 0.85rem;
  resize: vertical;
  min-height: 5rem;
}

.input-block textarea:focus,
.input-block input:focus {
  outline: none;
  border-color: var(--gold-line);
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.word-chip {
  border: 1px solid var(--line);
  background: var(--gold-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.word-chip:hover {
  border-color: var(--gold);
}

.word-chip.is-used {
  opacity: 0.35;
  pointer-events: none;
}

.assemble-line {
  min-height: 3rem;
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px dashed var(--gold-line);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--dim);
  margin-bottom: 0.75rem;
}

.hud strong {
  color: var(--cream);
  font-weight: 600;
}

.feedback {
  margin-top: 0.85rem;
  padding: 0.65rem 0.8rem;
  border-radius: 0.65rem;
  font-size: 0.9rem;
}

.feedback.ok {
  background: rgba(107, 191, 138, 0.12);
  color: #9be7c4;
}

.feedback.bad {
  background: rgba(224, 122, 122, 0.12);
  color: #f0b4b4;
}

.study-box {
  margin-top: 0.75rem;
  padding: 1rem 1.1rem;
  border-radius: 0.85rem;
  border: 1px solid var(--gold-line);
  background: linear-gradient(160deg, rgba(40, 48, 38, 0.65), rgba(12, 16, 14, 0.7));
}

.study-box p {
  margin: 0.45rem 0 0;
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--cream);
}

.footer {
  max-width: 58rem;
  margin: 0 auto;
  padding: 1.25rem 1.15rem 2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--dim);
  border-top: 1px solid var(--line);
}

.footer a {
  color: var(--muted);
}

.footer a:hover {
  color: var(--gold);
}

[hidden] {
  display: none !important;
}

/* Ambient: music + wallpapers */
.ambient-panel .hint {
  margin-bottom: 0.85rem;
}

@media (max-width: 720px) {
  .topbar {
    padding: 0.32rem 0.7rem;
    gap: 0.3rem;
  }

  .brand small {
    display: none;
  }

  .top-nav {
    gap: 0.3rem 0.55rem;
    font-size: 0.74rem;
  }

  .top-nav a[href*="http"],
  .top-nav .nav-extra {
    display: none; /* conserve header space on phone */
  }

}

@media (min-width: 721px) {
  .topbar.is-scroll-hidden {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar,
  .topbar.is-scroll-hidden {
    transition: none;
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
}

/* —— Left music dock (fixed mid-edge tab · sliding side panel) —— */
.music-dock {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  width: 0;
  height: 0;
  overflow: visible;
}

.music-dock-tab {
  pointer-events: auto !important;
  position: fixed;
  left: 0;
  top: 50%;
  z-index: 70; /* normal; float shell 100, mini-on-tab 110, dragging 200 */
  transform: translateY(-50%);
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 0.95rem 0.48rem;
  border: 1px solid var(--gold-line);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: rgba(10, 14, 12, 0.96);
  color: var(--cream);
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 6px 0 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  transition: left 0.28s ease, color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.music-dock.is-dock .music-dock-tab {
  left: min(22rem, calc(100vw - 2.5rem));
  color: var(--gold);
  border-color: rgba(212, 175, 55, 0.6);
  background: rgba(12, 16, 14, 0.98);
  box-shadow: 4px 0 18px rgba(0, 0, 0, 0.35);
}

.music-dock.is-playing .music-dock-tab-icon {
  animation: music-tab-pulse 1.6s ease-in-out infinite;
}

@keyframes music-tab-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.65;
    transform: scale(1.12);
  }
}

.music-dock-tab:hover,
.music-dock-tab:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
  outline: none;
}

.music-dock-tab-icon {
  color: var(--gold);
  font-size: 0.95rem;
  writing-mode: horizontal-tb;
  text-orientation: upright;
  flex-shrink: 0;
}

.music-dock-tab-text {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  max-height: 8.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-dock-panel {
  pointer-events: none;
  position: fixed;
  left: 0;
  top: 4.25rem;
  bottom: 1rem;
  width: min(22rem, calc(100vw - 2.5rem));
  max-height: calc(100vh - 5.25rem);
  z-index: 56;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.95rem 1rem 1.05rem;
  margin: 0;
  border-radius: 0 16px 16px 0;
  border: 1px solid var(--gold-line);
  border-left: 0;
  background: rgba(10, 14, 12, 0.97);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.music-dock.is-dock .music-dock-panel,
.music-dock.is-open .music-dock-panel {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.music-dock-scrim {
  pointer-events: auto;
  position: fixed;
  inset: 0;
  z-index: 54;
  background: rgba(4, 8, 6, 0.48);
  border: 0;
  display: none;
}

.music-dock.is-dock .music-dock-scrim:not([hidden]),
.music-dock.is-open .music-dock-scrim:not([hidden]) {
  display: block;
  pointer-events: auto;
}

.music-dock-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
}

.music-dock-head-copy {
  flex: 1;
  min-width: 0;
}

.music-dock-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.music-dock-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.music-dock-title {
  margin: 0.15rem 0 0;
  font-size: 1.15rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  color: var(--cream);
}

.music-dock-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.music-dock-close:hover,
.music-dock-close:focus-visible {
  border-color: var(--gold-line);
  color: var(--gold);
  outline: none;
}

.music-dock-note {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--dim);
  flex-shrink: 0;
}

.music-dock-tabs {
  flex-wrap: wrap;
  margin: 0;
  flex-shrink: 0;
}

.pick-list {
  display: grid;
  gap: 0.7rem;
  flex: 1 1 auto;
  min-height: 6rem;
  max-height: min(40vh, 18rem);
  overflow: auto;
  padding-right: 0.15rem;
}

.pick-group-title {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.4rem;
}

.pick-group {
  display: grid;
  gap: 0.4rem;
}

.pick-card {
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(8, 12, 10, 0.45);
  color: inherit;
  border-radius: 0.75rem;
  padding: 0.55rem 0.7rem;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.pick-card:hover,
.pick-card.is-active {
  border-color: var(--gold-line);
  background: var(--gold-soft);
}

.pick-card.pick-mine {
  border-color: rgba(212, 175, 55, 0.28);
}

.pick-card.pick-mine.is-active {
  border-color: var(--gold);
}

.pick-card strong {
  display: block;
  font-size: 0.88rem;
  color: var(--cream);
}

.pick-card small {
  display: block;
  margin-top: 0.15rem;
  color: var(--dim);
  font-size: 0.74rem;
  line-height: 1.35;
}

.music-player-slot {
  position: relative;
  margin-top: 0.15rem;
  flex: 0 0 auto;
  width: 100%;
}

.music-empty-inline {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 0.85rem;
  border: 1px dashed var(--gold-line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--dim);
  font-size: 0.88rem;
}

.music-player-shell[hidden] {
  display: none !important;
}

/* Player stays in the dock slot only (no free-float / drag) */
.music-player-shell,
.music-player-shell.is-docked {
  position: relative;
  pointer-events: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 10, 0.55);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-shadow: none;
  z-index: auto;
  transform: none;
}

.music-player-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.55rem;
  border-bottom: 1px solid var(--line);
  user-select: none;
  cursor: default;
}

.music-player-label {
  flex: 1;
  font-size: 0.72rem;
  color: var(--gold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.music-player-frame-wrap {
  width: 100%;
  line-height: 0;
  border-radius: 12px;
  background: #000;
  overflow: hidden;
  clip-path: inset(0 round 12px);
}

.music-player-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 152px;
  border: 0;
  border-radius: inherit;
  background: #000;
  clip-path: inset(0 round 12px);
}

.music-dock-tab.is-playing-tab .music-dock-tab-icon,
.music-dock.is-playing .music-dock-tab-icon {
  color: var(--gold);
}

@media (max-width: 720px) {
  .music-dock-tab {
    padding: 0.8rem 0.4rem;
  }

  .music-dock-panel {
    top: 3.5rem;
    bottom: 0.65rem;
    width: min(20rem, calc(100vw - 2.25rem));
    max-height: calc(100vh - 4.15rem);
    padding: 0.8rem 0.85rem 0.95rem;
  }

  .music-dock.is-dock .music-dock-tab {
    left: min(20rem, calc(100vw - 2.25rem));
  }

  .pick-list {
    max-height: min(36vh, 14rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .music-dock-tab,
  .music-dock-panel {
    transition: none;
  }
}

/* Wallpapers — daily + hearts */
.wp-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.wp-format-picker {
  display: inline-flex;
  align-items: stretch;
  gap: 0.35rem;
  margin-top: 0.85rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(0, 0, 0, 0.28);
}

.wp-format-label {
  align-self: center;
  padding: 0 0.45rem;
  color: var(--dim);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wp-format-option {
  display: grid;
  gap: 0.05rem;
  min-width: 8.6rem;
  padding: 0.42rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.wp-format-option strong {
  font-size: 0.82rem;
  font-weight: 600;
}

.wp-format-option small {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.wp-format-option:hover,
.wp-format-option:focus-visible {
  border-color: var(--gold-line);
  color: var(--cream);
}

.wp-format-option.is-active,
.wp-format-option[aria-pressed="true"] {
  border-color: rgba(212, 175, 55, 0.55);
  background: var(--gold-soft);
  color: #f0d878;
}

.wp-format-option.is-active small,
.wp-format-option[aria-pressed="true"] small {
  color: var(--muted);
}

/* Wallpaper search / filter */
.wp-search-bar {
  display: grid;
  gap: 0.45rem;
  margin: 0.35rem 0 0.85rem;
  align-items: center;
}

.wp-search-label {
  display: block;
  width: 100%;
}

.wp-search-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 1rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.wp-search-input::placeholder {
  color: var(--dim);
}

.wp-search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.wp-search-bar {
  grid-template-columns: 1fr auto;
}

.wp-search-clear {
  white-space: nowrap;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.wp-search-meta {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.72rem;
  color: var(--dim);
}

.wp-search-chips {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.28rem;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 0.2rem;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.3) transparent;
}

.wp-search-chips::-webkit-scrollbar {
  height: 4px;
}

.wp-search-chips::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.3);
}

.wp-chip {
  width: auto;
  min-width: max-content;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  color: var(--muted);
  border-radius: 0.42rem;
  padding: 0.2rem 0.48rem;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.wp-chip:hover {
  border-color: var(--gold-line);
  color: var(--cream);
}

.wp-chip.is-on {
  border-color: rgba(212, 175, 55, 0.65);
  background: rgba(212, 175, 55, 0.14);
  color: #f0d878;
}

.wp-search-empty {
  grid-column: 1 / -1;
  margin: 0.25rem 0 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px dashed var(--line);
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
}

.wp-grid-density {
  display: flex;
  align-items: center;
  gap: 0.12rem;
  width: max-content;
  max-width: 100%;
  margin: -0.25rem 0 0.2rem auto;
  padding: 0.16rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
}

.wp-grid-density-label {
  padding: 0 0.42rem 0 0.35rem;
  color: var(--dim);
  font-size: 0.58rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.wp-grid-density-option {
  min-width: 2.35rem;
  padding: 0.28rem 0.42rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.wp-grid-density-option:hover,
.wp-grid-density-option:focus-visible {
  color: var(--cream);
}

.wp-grid-density-option.is-active,
.wp-grid-density-option[aria-pressed="true"] {
  background: var(--gold-soft);
  color: #f0d878;
}

.wp-hero-loved {
  margin-top: 0.75rem;
}

.wp-hero-loved-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(224, 122, 140, 0.4);
  background: rgba(224, 122, 140, 0.1);
  color: var(--cream);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.wp-hero-loved-btn:hover {
  border-color: #e8a0ae;
}

.wp-hero-loved-icon {
  color: #e8a0ae;
}

@media (max-width: 720px) {
  .wp-search-bar {
    grid-template-columns: 1fr;
  }

  .wp-search-clear {
    justify-self: start;
  }
}

.wallpaper-grid {
  display: grid;
  gap: 0.75rem;
}

.wallpaper-grid-inner {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(var(--wp-grid-columns, 4), minmax(0, 1fr));
  transition: grid-template-columns 0.18s ease;
}

.wp-card {
  position: relative;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(8, 12, 10, 0.45);
  color: inherit;
  border-radius: 0.9rem;
  padding: 0;
  overflow: hidden;
  font: inherit;
  transition: border-color 0.15s, transform 0.15s;
}

.wp-card:hover,
.wp-card.is-active {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.wp-card.is-active {
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.22);
}

.wp-card.is-active::after {
  content: "In use";
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 3;
  border-radius: 999px;
  padding: 0.18rem 0.48rem;
  background: rgba(10, 16, 12, 0.88);
  border: 1px solid var(--gold);
  color: #f0d878;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
}

.wp-card.is-hearted {
  border-color: rgba(224, 122, 140, 0.45);
}

.wp-main {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.wp-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-deep);
  overflow: hidden;
}

html[data-wallpaper-format="phone"] .wp-thumb {
  aspect-ratio: 9 / 16;
}

.wp-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wp-badges {
  position: absolute;
  top: 0.28rem;
  left: 0.28rem;
  right: 0.28rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.18rem;
  pointer-events: none;
  z-index: 1;
}

.wp-badge {
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  padding: 0.1rem 0.32rem;
  border-radius: 0.34rem;
  background: rgba(212, 175, 55, 0.9);
  color: var(--ink);
  border: 1px solid transparent;
  line-height: 1.2;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.wp-badge-daily {
  background: rgba(212, 175, 55, 0.92);
  color: var(--ink);
}

.wp-badge-classic {
  background: rgba(0, 0, 0, 0.55);
  color: var(--cream);
  border-color: var(--line);
}

.wp-badge-personal,
.wp-badge-pc {
  background: rgba(70, 120, 165, 0.9);
  color: #f2f7fb;
}

.wp-badge-lofi {
  background: rgba(180, 120, 160, 0.88);
  color: #fff8fc;
}

.wp-badge-gospel {
  background: rgba(170, 90, 95, 0.9);
  color: #fff5f5;
}

.wp-badge-spirit {
  background: rgba(210, 150, 70, 0.92);
  color: #1a1208;
}

.wp-badge-cosmos {
  background: rgba(70, 60, 130, 0.9);
  color: #e8e4ff;
}

.wp-badge-water {
  background: rgba(55, 120, 150, 0.9);
  color: #eaf6fb;
}

.wp-badge-study {
  background: rgba(95, 85, 70, 0.9);
  color: #f5efe4;
}

.wp-badge-worship {
  background: rgba(150, 115, 50, 0.92);
  color: #1a1408;
}

.wp-badge-peace {
  background: rgba(80, 120, 95, 0.9);
  color: #eef6f0;
}

.wp-badge-creation {
  background: rgba(100, 140, 80, 0.9);
  color: #f4faf0;
}

.wp-badge-night {
  background: rgba(45, 55, 90, 0.92);
  color: #dce4ff;
}

.wp-badge-hope {
  background: rgba(190, 150, 90, 0.92);
  color: #1a1208;
}

.wp-badge-minimal {
  background: rgba(230, 228, 220, 0.92);
  color: #2a2824;
  border-color: rgba(255, 255, 255, 0.15);
}

.wp-badge-realistic {
  background: rgba(55, 48, 42, 0.95);
  color: #e8dcc8;
  border-color: rgba(180, 140, 90, 0.45);
}

.wp-none {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--dim);
  font-size: 0.85rem;
}

.wp-meta {
  padding: 0.55rem 0.7rem 0.7rem;
  padding-right: 4rem;
}

.wp-meta strong {
  display: block;
  font-size: 0.88rem;
  color: var(--cream);
}

.wp-meta small {
  display: block;
  margin-top: 0.15rem;
  color: var(--dim);
  font-size: 0.75rem;
}

.wp-format-meta {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.62rem;
}

/* Always opens in a new tab (classic + daily) — no download attribute */
.wp-open-hd {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.wp-open-hd:hover {
  border-bottom-color: rgba(212, 175, 55, 0.55);
  color: #f0d878;
}

/* Download + heart cluster (bottom-right of card) */
.wp-side-actions {
  position: absolute;
  right: 0.35rem;
  bottom: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  z-index: 2;
}

html[data-wallpaper-grid="3"] .wallpaper-grid-inner {
  gap: 0.75rem;
}

html[data-wallpaper-grid="4"] .wallpaper-grid-inner {
  gap: 0.55rem;
}

html[data-wallpaper-grid="4"] .wp-card {
  border-radius: 0.65rem;
}

html[data-wallpaper-grid="4"] .wp-meta {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 1.5rem 5rem 0.42rem 0.55rem;
  background: linear-gradient(transparent, rgba(4, 7, 6, 0.94));
  pointer-events: none;
}

html[data-wallpaper-grid="4"] .wp-meta strong {
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.15;
  white-space: nowrap;
  text-overflow: ellipsis;
}

html[data-wallpaper-grid="4"] .wp-meta small,
html[data-wallpaper-grid="4"] .wp-format-meta,
html[data-wallpaper-grid="4"] .wp-open-hd {
  display: none;
}

html[data-wallpaper-grid="4"] .wp-side-actions {
  bottom: 0.3rem;
}

html[data-wallpaper-grid="4"] .wp-badge {
  max-width: 5.5rem;
  font-size: 0.5rem;
  padding: 0.1rem 0.28rem;
}

/* Compact card actions — view, download, then heart */
.wp-view-mini,
.wp-dl-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 1.4rem;
  min-width: 1.4rem;
  width: 1.4rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.55);
  color: var(--gold);
  font-size: 0.65rem;
  line-height: 1;
  flex-shrink: 0;
  cursor: pointer;
  font: inherit;
}

.wp-view-mini {
  color: #b8dfd2;
}

.wp-view-mini:hover,
.wp-view-mini:focus-visible {
  border-color: rgba(126, 211, 178, 0.55);
  background: rgba(79, 160, 127, 0.16);
  color: #e4fff5;
  outline: none;
}

.wp-dl-mini:hover {
  border-color: var(--gold-line);
  background: rgba(212, 175, 55, 0.12);
  color: #f0d878;
}

.wp-dl-mini:disabled,
.wp-dl-mini.is-busy {
  opacity: 0.55;
  cursor: wait;
}

.wp-heart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 1.45rem;
  gap: 0.15rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.55);
  color: var(--muted);
  border-radius: 999px;
  padding: 0 0.4rem;
  font: inherit;
  font-size: 0.7rem;
  cursor: pointer;
}

.wp-heart:hover,
.wp-heart.is-on {
  color: #f0b4c0;
  border-color: rgba(224, 122, 140, 0.5);
}

.wp-heart-icon {
  font-size: 0.78rem;
  line-height: 1;
}

.wp-heart-count {
  font-size: 0.62rem;
  min-width: 0.7rem;
}

.wp-credit {
  margin-top: 0.85rem !important;
  margin-bottom: 0 !important;
  font-size: 0.78rem !important;
}

.panel-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.panel-head-row h2 {
  margin: 0 0 0.25rem;
}

.panel-head-row .hint {
  margin: 0;
}

.live-bible-toggle {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  max-width: 16rem;
}

.live-bible-toggle small {
  display: block;
  color: var(--dim);
  font-size: 0.72rem;
  margin-top: 0.1rem;
}

.live-tag {
  margin-left: 0.45rem;
  font-size: 0.68rem;
  color: var(--dim);
  letter-spacing: 0.02em;
  font-weight: 500;
}

.music-note {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.music-note a {
  font-weight: 550;
}

/* Progress & mastery */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.15rem;
  margin-top: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.75rem;
  color: var(--dim);
}

.stats-bar strong {
  color: var(--cream);
  font-weight: 600;
}

.resume-hint {
  margin: 0.85rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.linkish {
  border: none;
  background: none;
  color: var(--gold);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}

.linkish:hover {
  color: #f0d878;
}

.theme-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.55rem;
  font-size: 0.68rem;
  color: var(--dim);
}

.theme-mastery {
  color: var(--gold);
}

.theme-bar {
  display: block;
  height: 3px;
  margin-top: 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.theme-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #8f7417, var(--gold));
  border-radius: inherit;
  transition: width 0.25s ease;
}

.kbd-row {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--dim);
}

kbd {
  display: inline-block;
  padding: 0.08rem 0.35rem;
  border-radius: 0.3rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--mono);
  font-size: 0.72em;
  color: var(--cream);
  line-height: 1.3;
}

.study-hint,
.kbd-hint,
.type-hint {
  margin-top: 0.75rem !important;
  color: var(--dim) !important;
  font-size: 0.88rem !important;
}

.type-letter-hint {
  margin-top: 0.5rem;
  letter-spacing: 0.04em;
  color: var(--gold) !important;
}

.auto-advance {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.choice-num {
  display: inline-block;
  min-width: 1.1rem;
  margin-right: 0.35rem;
  color: var(--dim);
  font-size: 0.75rem;
}

.site-version {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--dim);
}

.type-actions {
  margin-top: 0.5rem;
}

.theme-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem 1rem;
}

.theme-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.85rem 0 1rem;
  align-items: center;
}

.theme-search {
  flex: 1;
  min-width: 10rem;
  border-radius: 0.65rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
}

.theme-search:focus {
  outline: none;
  border-color: var(--gold-line);
}

.tr-select {
  border-radius: 0.55rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
}

.theme-card-wrap {
  position: relative;
}

.theme-card-wrap .theme-card {
  width: 100%;
  padding-right: 2.2rem;
  padding-top: 2.1rem;
}

.theme-card.is-fav {
  border-color: rgba(212, 175, 55, 0.45);
}

.theme-drill-btn {
  position: absolute;
  left: 0.5rem;
  top: 0.45rem;
  z-index: 2;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.theme-drill-btn:hover,
.theme-drill-btn:focus-visible {
  border-color: var(--gold-line);
  color: var(--cream);
  outline: none;
}

.fav-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  color: var(--dim);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.fav-btn.is-on,
.fav-btn:hover {
  color: var(--gold);
  border-color: var(--gold-line);
}

.study-actions {
  margin-top: 0.65rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

#study-text.is-obscured {
  color: var(--dim);
  letter-spacing: 0.08em;
  user-select: none;
  filter: blur(0);
}

/* —— Meditation (primary) —— */
.meditate-panel {
  border-color: rgba(212, 175, 55, 0.35);
  background: linear-gradient(
    165deg,
    rgba(36, 44, 38, 0.72),
    rgba(12, 16, 14, 0.82)
  );
}

.med-head {
  margin-bottom: 0.65rem;
}

.med-topics {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 0.15rem 0.1rem 0.45rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.med-topics::-webkit-scrollbar {
  height: 6px;
}

.med-topics::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.35);
  border-radius: 999px;
}

@media (min-width: 900px) {
  .med-topics {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

.med-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(8, 12, 10, 0.45);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.med-topic-chip:hover,
.med-topic-chip:focus-visible {
  border-color: var(--gold-line);
  color: var(--cream);
  outline: none;
}

.med-topic-chip.is-active {
  border-color: var(--gold);
  color: var(--cream);
  background: var(--gold-soft);
}

.meditate-card {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(6, 10, 9, 0.5);
  padding: 1.1rem 1.15rem 1.2rem;
  margin-bottom: 0.85rem;
  touch-action: pan-y;
  user-select: text;
}

.med-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.65rem;
}

.med-topic-pill {
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.med-pos {
  font-size: 0.68rem;
  color: var(--dim);
}

.med-ref {
  margin: 0 0 0.45rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.01em;
}

.med-verse {
  margin: 0 0 1.1rem;
  padding: 0;
  border: none;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.8vw, 1.45rem);
  font-weight: 500;
  line-height: 1.55;
  color: var(--cream);
}

.med-block {
  margin: 0 0 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(212, 175, 55, 0.12);
}

.med-block:last-child {
  margin-bottom: 0;
}

.med-block p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.med-label {
  margin: 0 0 0.3rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.med-block-prayer {
  border-radius: 0.75rem;
  padding: 0.75rem 0.85rem 0.85rem;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(212, 175, 55, 0.06);
}

.med-block-prayer p {
  color: var(--cream);
  font-style: italic;
}

.med-actions {
  flex-wrap: wrap;
  position: sticky;
  bottom: 0.5rem;
  z-index: 8;
  padding: 0.55rem 0.15rem 0.15rem;
  margin-top: 0.25rem;
  background: linear-gradient(180deg, transparent, rgba(10, 14, 12, 0.92) 28%);
}

.med-feedback {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: var(--gold);
}

.med-streak {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.med-verse.is-loading {
  opacity: 0.72;
  animation: med-pulse 1.1s ease-in-out infinite;
}

@keyframes med-pulse {
  0%,
  100% {
    opacity: 0.62;
  }
  50% {
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .med-verse.is-loading {
    animation: none;
  }
}

/* Focus mode: dim chrome, center the meditation */
body.med-focus .hero,
body.med-focus .topics-panel,
body.med-focus #themes,
body.med-focus #play-panel,
body.med-focus #wallpapers,
body.med-focus main > .panel:not(.meditate-panel),
body.med-focus .footer {
  display: none !important;
}

body.med-focus .topbar {
  opacity: 0.55;
}

body.med-focus .topbar:hover,
body.med-focus .topbar:focus-within {
  opacity: 1;
}

body.med-focus main {
  max-width: 42rem;
  padding-top: 0.75rem;
}

body.med-focus .meditate-panel {
  margin-bottom: 0;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

body.med-focus .med-topics {
  max-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

#med-amen {
  border-color: rgba(212, 175, 55, 0.45);
  color: var(--cream);
  background: rgba(212, 175, 55, 0.12);
}

#med-amen:hover,
#med-amen:focus-visible {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.2);
}

#med-focus[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--cream);
  background: var(--gold-soft);
}

.med-head .hint kbd {
  font-family: var(--mono);
  font-size: 0.68em;
  padding: 0.08rem 0.28rem;
  border-radius: 0.25rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--dim);
}

.topics-panel .stats-bar {
  margin: 0.65rem 0 0.85rem;
}

/* Wallpapers collapsed by default so meditation stays primary */
.wp-details {
  border: none;
  margin: 0;
}

.wp-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.15rem 0.1rem;
  color: var(--cream);
}

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

.wp-summary strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
}

.wp-summary small {
  display: block;
  margin-top: 0.15rem;
}

.wp-summary::after {
  content: "▸";
  color: var(--gold);
  font-size: 0.9rem;
  transition: transform 0.15s ease;
}

.wp-details[open] .wp-summary::after {
  transform: rotate(90deg);
}

.wp-details-body {
  margin-top: 0.85rem;
}

.wallpaper-scroll {
  max-height: min(52rem, 72vh);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.9rem 1rem 1.1rem;
  background: rgba(6, 10, 9, 0.35);
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

.wallpaper-scroll .wallpaper-grid {
  margin: 0;
}

.wallpaper-scroll::-webkit-scrollbar {
  width: 8px;
}

.wallpaper-scroll::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.35);
  border-radius: 999px;
}

@media (max-width: 720px) {
  .topics-panel {
    padding: 0.9rem 0.75rem 1rem;
  }

  .topics-panel .panel-head-row {
    margin-bottom: 0;
  }

  .topics-panel .panel-head-row .hint {
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .topics-panel .theme-filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
    margin: 0.65rem 0;
  }

  .topics-panel .theme-search {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .topics-panel .theme-filter-row .btn {
    min-width: 0;
    padding-inline: 0.45rem;
    font-size: 0.78rem;
  }

  .topics-panel .stats-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem 0.65rem;
    margin: 0.65rem 0;
    padding: 0.5rem 0.6rem;
    font-size: 0.68rem;
  }

  .topics-panel .theme-grid {
    grid-auto-rows: 8.6rem;
    gap: 0.45rem;
    max-height: calc(25.8rem + 0.9rem);
    padding-right: 0.3rem;
  }

  .topics-panel .theme-card-wrap {
    height: 8.6rem;
  }

  .topics-panel .theme-card-wrap .theme-card {
    padding: 1.9rem 0.55rem 0.55rem;
  }

  .topics-panel .theme-card .emoji {
    font-size: 1.05rem;
  }

  .topics-panel .theme-card strong {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    line-height: 1.15;
  }

  .topics-panel .theme-card small {
    display: none;
  }

  .topics-panel .theme-meta {
    gap: 0.1rem 0.4rem;
    margin-top: 0.35rem;
    font-size: 0.58rem;
    line-height: 1.2;
  }

  .topics-panel .theme-bar {
    margin-top: 0.35rem;
  }

  .topics-panel .theme-drill-btn {
    left: 0.35rem;
    top: 0.35rem;
    padding: 0.15rem 0.42rem;
    font-size: 0.58rem;
  }

  .topics-panel .fav-btn {
    top: 0.3rem;
    right: 0.3rem;
    width: 1.65rem;
    height: 1.65rem;
    font-size: 0.82rem;
  }

  .wp-format-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .wp-format-label {
    grid-column: 1 / -1;
    padding: 0.15rem 0.35rem 0.05rem;
  }

  .wp-format-option {
    min-width: 0;
  }

  .wallpaper-scroll {
    max-height: 72vh;
    padding: 0.7rem;
  }

  .wallpaper-grid-inner {
    gap: 0.55rem;
    grid-template-columns: repeat(var(--wp-grid-columns, 2), minmax(0, 1fr));
  }

  html[data-wallpaper-grid="2"] .wp-card {
    border-radius: 0.65rem;
  }

  html[data-wallpaper-grid="2"] .wp-meta {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 1.6rem 4.7rem 0.4rem 0.48rem;
    background: linear-gradient(transparent, rgba(4, 7, 6, 0.94));
    pointer-events: none;
  }

  html[data-wallpaper-grid="2"] .wp-meta strong {
    overflow: hidden;
    font-size: 0.68rem;
    line-height: 1.15;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  html[data-wallpaper-grid="2"] .wp-meta small,
  html[data-wallpaper-grid="2"] .wp-format-meta,
  html[data-wallpaper-grid="2"] .wp-open-hd {
    display: none;
  }

  html[data-wallpaper-grid="2"] .wp-badges {
    gap: 0.15rem;
  }

  html[data-wallpaper-grid="2"] .wp-badge {
    max-width: 4.7rem;
    font-size: 0.48rem;
    padding: 0.1rem 0.25rem;
  }

  html[data-wallpaper-grid="2"] .wp-side-actions {
    right: 0.25rem;
    bottom: 0.25rem;
    gap: 0.15rem;
  }

  html[data-wallpaper-grid="2"] .wp-view-mini,
  html[data-wallpaper-grid="2"] .wp-dl-mini {
    width: 1.25rem;
    min-width: 1.25rem;
    height: 1.25rem;
  }

  html[data-wallpaper-grid="2"] .wp-heart {
    height: 1.3rem;
    padding: 0 0.3rem;
    font-size: 0.62rem;
  }

  .meditate-card {
    padding: 0.9rem 0.85rem 1rem;
  }

  .med-verse {
    font-size: 1.12rem;
  }
}

@media (max-width: 340px) {
  .topics-panel .theme-grid {
    grid-auto-rows: 8.75rem;
    max-height: calc(26.25rem + 0.9rem);
  }

  .topics-panel .theme-card-wrap {
    height: 8.75rem;
  }
}

/* —— Compact page rhythm + distraction-free background view —— */
.topbar {
  gap: 0.3rem 0.6rem;
  padding: 0.32rem 0.8rem;
}

.brand {
  gap: 0.5rem;
}

.top-nav {
  gap: 0.25rem 0.65rem;
  font-size: 0.76rem;
}

.top-nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  line-height: inherit;
  cursor: pointer;
  padding: 0;
}

.top-nav button:hover,
.top-nav button:focus-visible,
.nav-background-toggle[aria-pressed="true"] {
  color: var(--cream);
  outline: none;
}

.nav-background-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-background-short {
  display: none;
}

main {
  padding: 0.75rem 1rem 2rem;
}

.hero {
  margin-bottom: 0.6rem;
  padding-bottom: 0.1rem;
}

.panel {
  padding: 0.95rem 1rem 1rem;
  margin-bottom: 0.7rem;
}

.panel h2 {
  margin-bottom: 0.2rem;
  font-size: 1.28rem;
}

.panel > .hint,
.panel .hint {
  margin-bottom: 0.65rem;
  line-height: 1.42;
}

.panel-head-row {
  gap: 0.45rem;
  margin-bottom: 0.1rem;
}

.mode-row {
  gap: 0.35rem;
  margin-bottom: 0.7rem;
}

.chip {
  padding: 0.34rem 0.72rem;
}

.btn {
  padding: 0.46rem 0.8rem;
  font-size: 0.85rem;
}

.actions {
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.theme-filter-row {
  gap: 0.4rem;
  margin: 0.55rem 0 0.65rem;
}

.topics-panel .stats-bar {
  margin: 0.5rem 0 0.6rem;
  padding: 0.5rem 0.7rem;
}

.topics-panel .theme-grid {
  grid-auto-rows: 10rem;
  gap: 0.55rem;
  max-height: calc(20rem + 0.55rem);
}

.topics-panel .theme-card-wrap {
  height: 10rem;
}

.med-head {
  margin-bottom: 0.4rem;
}

.med-topics {
  gap: 0.32rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.3rem;
}

.med-topic-chip {
  padding: 0.24rem 0.6rem;
  font-size: 0.74rem;
}

.meditate-card {
  padding: 0.9rem 1rem;
  margin-bottom: 0.6rem;
}

.med-card-top {
  margin-bottom: 0.45rem;
}

.med-ref {
  margin-bottom: 0.35rem;
}

.med-verse {
  margin-bottom: 0.8rem;
}

.med-block {
  margin-bottom: 0.6rem;
  padding-top: 0.55rem;
}

.med-block-prayer {
  padding: 0.6rem 0.7rem 0.65rem;
}

.wp-details-body {
  margin-top: 0.6rem;
}

.wp-search-bar {
  margin-bottom: 0.6rem;
}

.wallpaper-scroll {
  padding: 0.7rem 0.75rem 0.85rem;
}

.footer {
  padding: 0.8rem 1rem 1.25rem;
}

.background-view-exit {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(243, 234, 215, 0.28);
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  background: rgba(8, 12, 10, 0.7);
  color: var(--cream);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0.82;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
}

.background-view-exit:hover,
.background-view-exit:focus-visible {
  opacity: 1;
  border-color: var(--gold-line);
  background: rgba(8, 12, 10, 0.9);
  outline: none;
}

body.is-background-view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body.is-background-view > .topbar,
body.is-background-view > main,
body.is-background-view > .footer,
body.is-background-view > .music-dock {
  display: none;
}

body.has-wallpaper.is-background-view {
  background-image: none !important;
}

body.has-wallpaper.is-background-view::before,
body.has-wallpaper.is-background-view::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: var(--wallpaper);
  background-position: center !important;
  background-repeat: no-repeat !important;
}

body.has-wallpaper.is-background-view::before {
  z-index: 0;
  background-size: cover !important;
  filter: blur(14px) brightness(0.62) saturate(0.78);
  transform: scale(1.04);
}

body.has-wallpaper.is-background-view::after {
  z-index: 1;
  background-size: contain !important;
}

@media (max-width: 720px) and (orientation: portrait) {
  .background-view-exit {
    top: max(0.5rem, env(safe-area-inset-top));
    right: max(0.5rem, env(safe-area-inset-right));
    padding: 0.38rem 0.58rem;
    font-size: 0.7rem;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0.28rem 0.62rem;
  }

  .top-nav {
    gap: 0.22rem 0.48rem;
    font-size: 0.71rem;
  }

  .nav-background-label {
    display: none;
  }

  .nav-background-toggle > span[aria-hidden="true"]:first-child {
    display: none;
  }

  .nav-background-short {
    display: inline;
  }

  main {
    padding: 0.6rem 0.7rem 1.5rem;
  }

  .panel {
    padding: 0.8rem 0.72rem 0.85rem;
    margin-bottom: 0.58rem;
  }

  .topics-panel {
    padding: 0.8rem 0.72rem 0.85rem;
  }

  .topics-panel .theme-grid {
    grid-auto-rows: 8.6rem;
    gap: 0.42rem;
    max-height: calc(25.8rem + 0.84rem);
  }

  .topics-panel .theme-card-wrap {
    height: 8.6rem;
  }

  .wallpaper-scroll {
    padding: 0.55rem;
  }
}
