/* =========================================================
   Krishna Stories — Stylesheet
   Mobile-first. Centered column on desktop.
   ========================================================= */

:root {
  --bg:        #fdf7ec;
  --card:      #ffffff;
  --ink:       #352819;
  --muted:     #887866;
  --soft:      #eee2cf;
  --accent:    #1f6f8b;
  --gold:      #e89b3c;
  --green:     #3f8e5b;
}

*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, p, ol, ul, li, button { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button { border: 0; background: none; color: inherit; cursor: pointer; font: inherit; }
button:disabled { cursor: default; }
input { font: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

body {
  min-height: 100dvh;
  background: radial-gradient(circle at top, #fff6db 0%, var(--bg) 42%, #f8edda 100%);
  color: var(--ink);
  font-family: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Sticky player ---------- */
.player {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: max(12px, env(safe-area-inset-top, 12px)) 14px 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(54, 38, 18, 0.12);
  backdrop-filter: blur(12px);
}

.player-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Wide banner image area */
.art {
  position: relative;
  width: 100%;
  max-width: 235px;
  aspect-ratio: 2 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: #dfeef2;
  margin: 0 auto;
}
.art-placeholder {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(232, 155, 60, 0.7) 0 18%, transparent 19%),
    linear-gradient(135deg, #2e8eac, #155366);
}
.art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.now-playing { min-width: 0; text-align: center; }
.player-section {
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.player-title {
  font-family: Fraunces, Georgia, serif;
  font-size: 18px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-title:empty { display: none; }

.controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 360px;
}
.ctrl {
  min-height: 44px;
  border-radius: 999px;
  background: #f4ecdf;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.12s, background 0.12s;
}
.ctrl svg { width: 22px; height: 22px; }
.ctrl:active { transform: scale(0.96); }

.ctrl:focus-visible,
.search:focus-visible,
.filter:focus-visible,
.reset:focus-visible,
.progress:focus-visible,
.story-btn:focus-visible {
  outline: 3px solid rgba(31, 111, 139, 0.35);
  outline-offset: 2px;
}

.ctrl.play {
  background: var(--ink);
  color: white;
}
.ctrl.play svg { width: 24px; height: 24px; }

.ctrl.loop[data-mode="all"] { color: var(--accent); }
.ctrl.loop[data-mode="one"] { color: var(--accent); }
.ctrl.loop[data-mode="off"] { color: #b3a795; }

.loop-mark {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 10px;
  font-weight: 900;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 2px #f4ecdf;
}

.progress {
  position: relative;
  max-width: 760px;
  height: 18px;
  margin: 10px auto 0;
  cursor: pointer;
  touch-action: none;
}
.progress-track,
.progress-fill {
  position: absolute;
  top: 50%;
  left: 0;
  height: 5px;
  border-radius: 99px;
  transform: translateY(-50%);
}
.progress-track { right: 0; background: var(--soft); }
.progress-fill  { width: 0%; background: var(--gold); }

.times {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Main ---------- */
.main {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 14px 70px;
}

.search {
  width: 100%;
  height: 50px;
  margin-bottom: 12px;
  padding: 0 16px;
  border: 1px solid var(--soft);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.filter {
  padding: 9px 13px;
  border: 1px solid var(--soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.filter.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.message {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #e6cf9c;
  border-radius: 16px;
  background: #fff3d5;
  color: #6a4a05;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.section { margin-bottom: 28px; }

.section-title {
  margin-bottom: 4px;
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--soft);
  font-family: Fraunces, Georgia, serif;
  font-size: 22px;
  line-height: 1.15;
}

.story { border-bottom: 1px solid rgba(238, 226, 207, 0.92); }

.story-btn {
  width: 100%;
  min-height: 60px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 4px;
  border-radius: 14px;
  text-align: left;
  transition: background 0.12s;
}
.story-btn:not(:disabled):hover { background: rgba(31, 111, 139, 0.08); }
.story.playing .story-btn       { background: rgba(232, 155, 60, 0.14); }

.status {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 2px solid #c9bda9;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  color: transparent;
}
.story[data-status="completed"] .status {
  border-color: var(--green);
  background: var(--green);
  color: white;
}
.story[data-status="completed"] .status::before { content: "✓"; }

.story[data-status="in-progress"] .status {
  border-color: var(--gold);
  color: var(--gold);
}
.story[data-status="in-progress"] .status::before { content: "◔"; }

.story-text { min-width: 0; }
.story-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}
.story-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.story[data-status="in-progress"] .story-meta {
  color: var(--gold);
  font-weight: 800;
}

.story[data-available="false"] .story-title,
.story[data-available="false"] .story-meta {
  color: #8a7e6d;
}
.story[data-available="false"] .story-meta { font-style: italic; }
.story[data-available="false"] .story-btn:hover { background: transparent; }

.story.playing .story-title { color: var(--accent); }

.empty {
  margin: 30px 0;
  padding: 24px;
  border: 1px solid var(--soft);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-style: italic;
  font-weight: 600;
  text-align: center;
}

.footer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--soft);
  color: var(--muted);
  text-align: center;
}
.reset {
  margin-bottom: 10px;
  padding: 11px 15px;
  border-radius: 999px;
  background: #efe6d7;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}
.reset:hover { background: var(--soft); }
.footer p { font-size: 13px; font-weight: 600; }

@media (min-width: 620px) {
  .story-btn { padding-left: 8px; padding-right: 8px; }
}

/* ---------- Email signup ---------- */
.signup {
  max-width: 380px;
  margin: 8px auto -40px;
  padding: 6px 14px 0;
  text-align: center;
  transform: scale(0.7);
  transform-origin: top center;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}