/* ============================================================
   AvenStory — Design tokens
   Palette: warm marigold paper + hot-pink & teal neubrutalist accents
   (Indian festival colour energy, not the generic cream/terracotta AI look)
   Type: Space Grotesk (display) + Work Sans (body) + JetBrains Mono (data/labels)
   Signature: stacked "cassette" story cards with hard offset shadows
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Work+Sans:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --paper: #FFF7E6;
  --paper-alt: #FFEFC7;
  --ink: #161119;
  --pink: #FF3D68;
  --teal: #1FAE9A;
  --marigold: #FFC93C;
  --violet: #7C5CFC;
  --line: var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --radius: 18px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Work Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 148px; /* room for mini player + bottom nav */
}

h1, h2, h3, .display {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.mono { font-family: 'JetBrains Mono', monospace; letter-spacing: -0.02em; }

img { max-width: 100%; display: block; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ---- Header ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
}

.brand-mark {
  width: 30px; height: 30px;
  background: var(--pink);
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--paper);
  font-weight: 700;
  transform: rotate(-6deg);
}

.icon-btn {
  width: 38px; height: 38px;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.icon-btn:active { box-shadow: none; transform: translate(3px, 3px); }

/* ---- Section headers ---- */
.section {
  padding: 22px 18px 6px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 19px; }
.section-head .see-all { font-size: 13px; font-weight: 600; color: var(--violet); }

/* ---- Category chips ---- */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 18px 14px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 8px 14px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.active {
  background: var(--ink);
  color: var(--paper);
}

/* ---- Story card (horizontal scroll rail) ---- */
.rail {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 18px 12px;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.story-card {
  flex: none;
  width: 156px;
}
.cover {
  width: 156px; height: 156px;
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  background: linear-gradient(135deg, var(--marigold), var(--pink));
  display: flex; align-items: flex-end;
  padding: 10px;
  position: relative;
  overflow: hidden;
}
.cover .badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--ink); color: var(--paper);
  font-size: 10.5px; font-weight: 600;
  padding: 3px 7px; border-radius: 6px;
}
.cover .cover-emoji { font-size: 34px; filter: drop-shadow(2px 2px 0 rgba(0,0,0,.15)); }

.story-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 14px;
  margin-top: 8px;
  line-height: 1.25;
}
.story-meta {
  font-size: 11.5px;
  color: #6b6470;
  margin-top: 3px;
}

/* ---- Stacked "cassette" hero — the signature element ---- */
.hero-stack {
  position: relative;
  height: 210px;
  margin: 10px 18px 26px;
}
.hero-stack .card {
  position: absolute;
  inset: 0;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.hero-stack .card:nth-child(1) {
  background: var(--paper-alt);
  transform: rotate(-4deg) translateY(6px);
  z-index: 1;
}
.hero-stack .card:nth-child(2) {
  background: #FFDCE6;
  transform: rotate(3deg) translateY(3px);
  z-index: 2;
}
.hero-stack .card:nth-child(3) {
  background: var(--marigold);
  transform: rotate(0deg);
  z-index: 3;
  box-shadow: var(--shadow);
}
.hero-stack .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.hero-stack .headline {
  font-size: 22px;
  line-height: 1.15;
  margin-bottom: 10px;
}
.hero-stack .play-pill {
  align-self: flex-start;
  display: flex; align-items: center; gap: 6px;
  background: var(--ink); color: var(--paper);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
}

/* ---- Mini player ---- */
.mini-player {
  position: fixed;
  left: 12px; right: 12px;
  bottom: 78px;
  z-index: 30;
  background: var(--ink);
  color: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  display: none;
  align-items: center;
  gap: 10px;
}
.mini-player.visible { display: flex; }
.mini-player .cover-mini {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--marigold), var(--pink));
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.mini-player .info { flex: 1; min-width: 0; }
.mini-player .info .t { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-player .info .s { font-size: 11px; opacity: .7; }
.mini-player .controls { display: flex; align-items: center; gap: 10px; }
.mini-player button { color: var(--paper); font-size: 20px; }

/* ---- Bottom nav ---- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 29;
  background: var(--paper);
  border-top: 3px solid var(--ink);
  display: flex;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 600;
  color: #8a8390;
  padding: 6px 0;
}
.nav-item .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: transparent;
}
.nav-item.active { color: var(--ink); }
.nav-item.active .dot { background: var(--pink); }
.nav-item svg { width: 22px; height: 22px; }

/* ---- Player screen (full) ---- */
.player-screen {
  position: fixed; inset: 0;
  background: var(--paper);
  z-index: 50;
  display: none;
  flex-direction: column;
  padding: 18px;
}
.player-screen.visible { display: flex; }
.player-top { display: flex; justify-content: space-between; align-items: center; }
.player-cover {
  margin: 26px auto;
  width: min(70vw, 300px); height: min(70vw, 300px);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--violet), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 72px;
  overflow: hidden;
}
.player-title { font-size: 21px; text-align: center; padding: 0 12px; }
.player-sub { text-align: center; color: #6b6470; font-size: 13px; margin-top: 4px; }

.scrub { display: flex; align-items: center; gap: 10px; margin: 22px 0 6px; }
.scrub input[type=range] { flex: 1; accent-color: var(--pink); }
.scrub .t { font-size: 11px; width: 38px; }

.transport {
  display: flex; align-items: center; justify-content: center; gap: 22px;
  margin: 14px 0 24px;
}
.transport .play-main {
  width: 66px; height: 66px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.transport .skip { font-size: 22px; }

.player-actions {
  display: flex; justify-content: space-around;
  border-top: 2.5px solid var(--ink);
  padding-top: 16px;
}
.player-actions .a { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; }

/* ---- Modals (auth / checkout) ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(22,17,25,.55);
  z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-sheet {
  width: 100%; max-width: 440px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 20px;
  box-shadow: 0 -6px 0 rgba(22,17,25,.08);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-input {
  width: 100%;
  padding: 12px 14px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 10px;
  background: #fff;
}
.modal-cta {
  width: 100%;
  background: var(--pink);
  color: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 12px;
  font-weight: 700;
  font-size: 14.5px;
  box-shadow: var(--shadow-sm);
  margin-top: 4px;
}
.modal-cta:active { box-shadow: none; transform: translate(3px,3px); }

.plan-toggle { display: flex; gap: 10px; margin-top: 4px; }
.plan-opt {
  flex: 1;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  font-weight: 600;
  font-size: 13.5px;
  background: #fff;
  line-height: 1.5;
}
.plan-opt.active { background: var(--marigold); box-shadow: var(--shadow-sm); }

.gateway-btn {
  width: 100%;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 12px;
  font-weight: 700;
  font-size: 13.5px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.gateway-btn:active { box-shadow: none; transform: translate(3px,3px); }

/* ---- Utility ---- */
.hidden { display: none !important; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
