:root {
  --bg: #0f1115;
  --card-bg: #1a1d24;
  --accent: #0fa0a1;
  --text: #f1f1f3;
  --text-muted: #9a9ea8;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Long-pressing titles/subtitles/buttons on mobile popped the OS
     copy/lookup callout -- suppress it app-wide and re-enable selection
     only where users actually want to copy text (the bible passage in
     play_modal_overview, see .info-fulltext below). */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  /* Otherwise mobile Chrome/Safari flash their default grey tap-highlight
     rectangle over any button/link on touch (e.g. list_view rows and the
     play icon) before the real :hover/:active styling ever shows. */
  -webkit-tap-highlight-color: transparent;
}

.info-fulltext {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

/* list_view scrolls at the document level -- hide the browser's own
   scrollbar (ugly on desktop) while leaving scrolling itself untouched. */
html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar {
  display: none;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 1rem 0;
  background: var(--bg);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Matches .container's max-width/padding exactly, so the hamburger and tag
   bubble line up with the list items' edges instead of the viewport's. */
.topbar-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

.topbar-titles {
  text-align: center;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
}

.topbar-titles:hover {
  background: rgba(255,255,255,0.08);
}

.app-title {
  font-size: 1.2rem;
  margin: 0;
}

#feed-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
}

.icon-button {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

#menu-toggle {
  position: absolute;
  left: 1rem;
}

#drawer-close {
  font-size: 1.6rem;
}

.icon-button:hover {
  background: rgba(255,255,255,0.08);
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

/* Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0,0,0,0.5);
}

.drawer-backdrop.hidden {
  display: none;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 30;
  width: 280px;
  max-width: 84vw;
  background: var(--card-bg);
  box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

.drawer.hidden {
  transform: translateX(-100%);
  visibility: hidden;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.drawer-brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
}

.drawer-brand-name {
  font-size: 0.95rem;
}

.drawer-section-label {
  margin: 0.9rem 1.2rem 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.feed-list {
  overflow-y: auto;
  padding: 0.6rem;
}

.drawer-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 0;
}

.drawer-footer {
  padding: 0.6rem;
}

.feed-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  padding: 0.75rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
}

.feed-item:hover {
  background: rgba(255,255,255,0.06);
}

.feed-item.active {
  background: var(--accent);
  color: #fff;
}

.feed-item-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.feed-item.active .feed-item-count {
  color: rgba(255,255,255,0.8);
}

/* Track list */
.container {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

#list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: opacity 0.18s ease;
}

#list.fade-out {
  opacity: 0;
}

.track {
  position: relative;
  width: 100%;
  background: var(--card-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 0.7rem 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.track-listened {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: none;
  background: none;
  color: #2ecc71;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  box-sizing: border-box;
  cursor: pointer;
}

.track-listened svg {
  width: 100%;
  height: 100%;
}

.track-listened.hidden {
  display: none;
}

.track-title-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.track-heart {
  position: relative;
  top: -2px;
  flex: none;
  width: 13px;
  height: 13px;
  color: #e0245e;
  pointer-events: none;
}

.track-heart svg {
  width: 100%;
  height: 100%;
}

.track-heart.hidden {
  display: none;
}

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

.track-play,
.track-main {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.track-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.track-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.track-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.track-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-play {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.track-play svg {
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

.track:hover .track-play {
  filter: brightness(1.1);
}

.track-duration {
  flex: none;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tag-bar {
  position: absolute;
  right: 1rem;
}

.tag-bar.hidden {
  display: none;
}

.tag-bubble {
  border: 1px solid rgba(255,255,255,0.14);
  background: var(--card-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  max-width: 30vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-bubble:hover {
  border-color: rgba(255,255,255,0.3);
}

.tag-modal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.tag-modal-option {
  width: 100%;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
}

.tag-modal-option:hover {
  background: rgba(255,255,255,0.08);
}

.tag-modal-option.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
}

/* Player modal */
.player-modal.hidden {
  display: none;
}

.player-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.player-modal-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 480px;
  margin: 1rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2rem 1.6rem 1.6rem;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
}

.player-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem;
}

.player-modal-close:hover {
  color: var(--text);
}

.player-modal-heart {
  position: absolute;
  top: 0.75rem;
  left: 0.8rem;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-modal-heart svg {
  width: 20px;
  height: 20px;
}

.player-modal-heart:hover {
  color: var(--text);
}

.player-modal-heart.active {
  color: #e0245e;
}

.player-modal-heart:disabled {
  opacity: 0.5;
  cursor: default;
}

.player-modal-title {
  flex: none;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.player-modal-subtitle {
  flex: none;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.3rem 0 0 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.player-modal-subtitle.hidden {
  display: none;
}

/* Info view (description + full text) vs player view -- only one shown at a time */
.info-view,
.player-view {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.player-modal.mode-info .info-view {
  display: flex;
}

.player-modal.mode-player .player-view {
  display: flex;
}

/* About modal (app orientation + current feed) */
.about-modal.hidden {
  display: none;
}

.about-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

.about-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.about-modal-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  overflow-y: auto;
  margin: 1rem;
  background: var(--card-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 2rem 1.6rem 1.6rem;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}

.about-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem;
}

.about-modal-close:hover {
  color: var(--text);
}

.about-modal-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 0 1.1rem;
  font-size: 1.3rem;
  font-weight: 600;
  text-align: center;
}

.about-modal-icon {
  width: 1.5em;
  height: 1.5em;
  flex: none;
}

.about-modal-app-desc {
  margin: 0.6rem 0 0;
  font-size: 1.1rem;
  text-align: center;
}

.feed-vibe-label {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
}

.feed-vibe-desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-align: center;
}

.feed-vibe-desc.hidden {
  display: none;
}

.about-modal-ack {
  margin: 0.9rem 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.about-modal-ack a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.about-modal-ack a:hover {
  text-decoration: underline;
}

.about-modal-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.12);
  margin: 1.1rem 0;
}

.about-modal-feeds-intro {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.about-modal-feed-guide {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.about-modal-feed-guide strong {
  color: var(--text);
  font-weight: 600;
}

.about-modal-homescreen {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.info-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 0.6rem;
  padding-right: 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.info-scroll::-webkit-scrollbar {
  width: 6px;
}

.info-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.info-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
}

.info-description {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 1rem;
  text-align: center;
}

.info-fulltext {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-line;
  margin: 0;
  text-align: center;
}

.info-description.hidden,
.info-fulltext.hidden {
  display: none;
}

.info-actions {
  flex: none;
  position: relative;
  width: 100%;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-play-button {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  border-radius: 999px;
  cursor: pointer;
}

.info-play-button svg {
  width: 18px;
  height: 18px;
}

.info-play-button:hover {
  filter: brightness(1.1);
}

.player-captions {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow-y: auto;
  font-size: 1rem;
  line-height: 1.4;
  padding: 0.4rem;
}

.player-captions-text {
  color: var(--text);
  white-space: pre-line;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.player-captions-text.faded {
  color: var(--text-muted);
  opacity: 0.7;
}

.player-controls {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.player-toggle {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.player-toggle svg {
  width: 22px;
  height: 22px;
}

.player-toggle:hover {
  filter: brightness(1.1);
}

.player-time {
  flex: none;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 2.6em;
  text-align: center;
}

.player-seek-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.player-seek {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

/* Same size as .player-seek-thumb below and left fully transparent -- it
   still owns dragging/hit-testing, but .player-seek-thumb is what's drawn,
   so the visible circle and the repeat number are one element and can
   never visually drift apart from each other. */
.player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.player-seek::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.player-seek-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  /* Horizontal position is set via the transform's translateX in app.js,
     not `left` -- `left` is a layout property, so animating it re-hints/
     re-antialiases the number glyph on every frame; a transform just
     moves an already-rasterized layer, so the digit stays crisp. */
  will-change: transform;
}

.player-repeat-badge {
  font-size: 0.5rem;
  font-weight: 400;
  line-height: 1;
  color: #fff;
}

.player-repeat-badge.hidden {
  display: none;
}

.player-download,
.info-download,
.info-share {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

.info-download {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.info-share {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.player-download:hover,
.info-download:hover,
.info-share:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.player-download svg,
.info-download svg,
.info-share svg {
  width: 20px;
  height: 20px;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .container { padding: 1.2rem 0.8rem 1.6rem; }
  .topbar-inner { padding: 0 0.8rem; }
  #menu-toggle { left: 0.8rem; }
  .tag-bar { right: 0.8rem; }
  .tag-bubble {
    /* max-width is content-only here so "9ch" means 9 characters of text,
       not 9 characters minus the pill's own left/right padding. */
    box-sizing: content-box;
    max-width: 9ch;
    white-space: normal;
    word-break: break-word;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .app-title { font-size: 1.05rem; }
  .track { padding: 0.6rem 1rem; }
  .player-modal-content { height: 420px; padding: 1.6rem 1.2rem 1.2rem; }
}
