/* Audioers base + reusable components. Requires tokens.css. */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0; background: var(--bg-0); color: var(--text-1);
  font: 500 var(--fs-md)/var(--lh-body) var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--violet-400); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-lg); }
p { margin: 0; }
.num { font-family: var(--font-num); font-feature-settings: "tnum" 1; }
:focus-visible { outline: 2px solid var(--violet-400); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Indic scripts: put the right Noto face first and give lines room */
:lang(hi), :lang(mr), :lang(sa), :lang(ne), :lang(kok), :lang(bho), :lang(mai) { font-family: "Noto Sans Devanagari", var(--font-sans); line-height: var(--lh-indic); }
:lang(kn), :lang(tcy) { font-family: "Noto Sans Kannada", var(--font-sans); line-height: var(--lh-indic); }
:lang(ta) { font-family: "Noto Sans Tamil", var(--font-sans); line-height: var(--lh-indic); }
:lang(te) { font-family: "Noto Sans Telugu", var(--font-sans); line-height: var(--lh-indic); }
:lang(ml) { font-family: "Noto Sans Malayalam", var(--font-sans); line-height: var(--lh-indic); }
:lang(bn), :lang(as) { font-family: "Noto Sans Bengali", var(--font-sans); line-height: var(--lh-indic); }
:lang(gu) { font-family: "Noto Sans Gujarati", var(--font-sans); line-height: var(--lh-indic); }
:lang(pa) { font-family: "Noto Sans Gurmukhi", var(--font-sans); line-height: var(--lh-indic); }
:lang(or) { font-family: "Noto Sans Oriya", var(--font-sans); line-height: var(--lh-indic); }
:lang(ur) { font-family: "Noto Nastaliq Urdu", var(--font-sans); line-height: 2; direction: rtl; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-5); border: 0; border-radius: var(--r-md);
  font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--text-on-accent); box-shadow: var(--glow-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-3); color: var(--text-1); }
.btn-secondary:hover { background: var(--bg-4); }
.btn-light { background: #fff; color: #0d1026; border-radius: var(--r-pill); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text-1); background: var(--bg-3); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: var(--fs-lg); border-radius: var(--r-lg); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent; color: var(--text-1); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-3); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Form ---------- */
.field { display: flex; align-items: center; gap: var(--s-3); min-height: 52px; padding: 0 var(--s-4);
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: var(--r-md); }
.field:focus-within { border-color: var(--violet-400); }
.field input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; }
.field input::placeholder { color: var(--text-3); }
.field-error { color: var(--danger); font-size: var(--fs-sm); margin-top: var(--s-1); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s-1);
  padding: var(--s-1); background: var(--bg-2); border-radius: var(--r-md); }
.segmented button { min-height: 40px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); font-weight: 700; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* ---------- Chips & badges ---------- */
.chip-row { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; min-height: 34px; padding: 0 var(--s-4); border: 1px solid var(--line-strong);
  border-radius: var(--r-pill); background: var(--bg-2); color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: #fff; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: var(--fs-xs); font-weight: 700; }
.badge-premium { background: linear-gradient(90deg, #f5a524, #ff8a2a); color: #1a0f00; }
.badge-coin { background: rgba(245,165,36,.15); color: var(--coin); }
.badge-free { background: rgba(34,197,94,.15); color: var(--green-500); }
.badge-demo { background: rgba(53,208,255,.15); color: var(--cyan-400); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-ok { color: var(--green-500); } .status-warn { color: var(--amber-400); } .status-bad { color: var(--red-500); }

/* ---------- Cards ---------- */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--s-3); }
.section-head a { font-size: var(--fs-sm); font-weight: 600; }

.cover { position: relative; aspect-ratio: 1; border-radius: var(--r-lg); overflow: hidden; background: var(--bg-3); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .badge { position: absolute; top: 8px; left: 8px; }
.story-card { display: grid; gap: var(--s-2); color: inherit; }
.story-card:hover { text-decoration: none; }
.story-card .title { font-weight: 700; font-size: var(--fs-sm); line-height: 1.3; }
.story-card .meta { color: var(--text-3); font-size: var(--fs-xs); }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(128px, 36%); gap: var(--s-3);
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.rail > * { scroll-snap-align: start; }
@media (min-width: 720px) { .rail { grid-auto-columns: minmax(160px, 1fr); grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); overflow: visible; } }

.hero { position: relative; min-height: 240px; border-radius: var(--r-xl); overflow: hidden; padding: var(--s-5);
  display: flex; flex-direction: column; justify-content: flex-end; gap: var(--s-2); background: var(--bg-3) center/cover; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 20%, rgba(7,8,26,.92)); }
.hero > * { position: relative; }
.hero h2 { font-size: var(--fs-2xl); }
.hero .meta { color: var(--text-2); font-size: var(--fs-sm); }

.cat-tile { display: grid; place-items: center; gap: var(--s-2); padding: var(--s-4) var(--s-2); border-radius: var(--r-md);
  background: var(--bg-2); border: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 600; color: var(--text-1); }
.cat-tile svg { width: 32px; height: 32px; }

.list-item { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: var(--s-3); padding: var(--s-2); border-radius: var(--r-md); }
.list-item:hover { background: var(--bg-2); }
.list-item .thumb { width: 56px; height: 56px; border-radius: var(--r-sm); object-fit: cover; background: var(--bg-3); }
.list-item .title { font-weight: 700; font-size: var(--fs-sm); }
.list-item .meta { font-size: var(--fs-xs); color: var(--text-3); }
.progress { height: 4px; border-radius: 2px; background: var(--bg-4); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }

.coin-card { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-lg);
  background: linear-gradient(120deg, #5a3a0d, #2a1c08 70%); border: 1px solid rgba(245,165,36,.25); }
.coin-card .amount { color: var(--coin); font-weight: 800; }

/* ---------- Bottom navigation (mobile) ---------- */
.bottom-nav { position: fixed; inset: auto 0 0 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--bottom-nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: rgba(13,16,38,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.bottom-nav a { display: grid; place-items: center; align-content: center; gap: 2px; color: var(--text-3); font-size: 11px; font-weight: 600; }
.bottom-nav a:hover { text-decoration: none; color: var(--text-2); }
.bottom-nav a[aria-current="page"] { color: var(--violet-400); }
.bottom-nav svg { width: 22px; height: 22px; }
@media (min-width: 1024px) { .bottom-nav { display: none; } }

/* ---------- Mini player ---------- */
.mini-player { position: fixed; left: var(--s-2); right: var(--s-2); bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + var(--s-2));
  z-index: 39; display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: var(--s-3);
  height: var(--mini-player-h); padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  background: var(--bg-3); box-shadow: var(--shadow-card); overflow: hidden; }
.mini-player img { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; }
.mini-player .title { font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-player .meta { font-size: var(--fs-xs); color: var(--text-3); }
.mini-player .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--bg-4); }
.mini-player .bar > span { display: block; height: 100%; background: var(--accent); }
.mini-player.static { position: relative; inset: auto; }
@media (min-width: 1024px) { .mini-player { bottom: var(--s-4); left: auto; width: 420px; right: var(--s-4); } }

/* ---------- Player controls ---------- */
.play-btn { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; box-shadow: var(--glow-accent); cursor: pointer; }
.play-btn svg { width: 30px; height: 30px; }
.seek { width: 100%; accent-color: var(--violet-500); }
.times { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-2); }
.option-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
.option-grid button { min-height: 44px; border: 0; border-radius: var(--r-sm); background: var(--bg-3); color: var(--text-1); font-weight: 600; cursor: pointer; }
.option-grid button[aria-pressed="true"] { background: var(--accent); }
.sheet { background: var(--bg-1); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: var(--s-3) var(--s-5) var(--s-6); box-shadow: var(--shadow-sheet); }
.sheet::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto var(--s-4); border-radius: 2px; background: var(--bg-4); }

/* ---------- Admin: KPI, table, sidebar ---------- */
.kpi { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4); border-radius: var(--r-lg);
  border: 1px solid var(--kpi-line, var(--line)); background: linear-gradient(135deg, var(--kpi-tint, transparent), var(--bg-2) 70%); }
.kpi .icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-md); background: var(--kpi-color, var(--accent)); color: #fff; }
.kpi .icon svg { width: 26px; height: 26px; }
.kpi .label { font-size: var(--fs-sm); color: var(--text-2); }
.kpi .value { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.1; }
.kpi .delta { font-size: var(--fs-xs); color: var(--green-500); font-weight: 700; }
.kpi .delta.down { color: var(--red-500); }
.kpi-violet { --kpi-color: var(--violet-500); --kpi-tint: rgba(124,77,255,.18); --kpi-line: rgba(124,77,255,.35); }
.kpi-green { --kpi-color: #16a36a; --kpi-tint: rgba(34,197,94,.14); --kpi-line: rgba(34,197,94,.3); }
.kpi-orange { --kpi-color: var(--orange-500); --kpi-tint: rgba(255,138,42,.14); --kpi-line: rgba(255,138,42,.3); }
.kpi-blue { --kpi-color: var(--blue-500); --kpi-tint: rgba(47,124,255,.16); --kpi-line: rgba(47,124,255,.32); }
.kpi-pink { --kpi-color: var(--pink-500); --kpi-tint: rgba(255,61,139,.14); --kpi-line: rgba(255,61,139,.3); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 600; color: var(--text-3); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--line); }
.table td { padding: var(--s-3); border-bottom: 1px solid var(--line); }
.table tr:hover td { background: rgba(255,255,255,.02); }

.sidebar { width: var(--sidebar-w); background: var(--bg-1); border-right: 1px solid var(--line); padding: var(--s-4) var(--s-3); }
.sidebar .group { margin-top: var(--s-5); padding: 0 var(--s-3) var(--s-2); color: var(--text-3); font-size: var(--fs-xs); font-weight: 700; }
.sidebar a { display: flex; align-items: center; gap: var(--s-3); min-height: 40px; padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; }
.sidebar a:hover { background: var(--bg-3); color: var(--text-1); text-decoration: none; }
.sidebar a[aria-current="page"] { background: var(--accent); color: #fff; }
.sidebar svg { width: 20px; height: 20px; flex: none; }

/* ---------- Brand ---------- */
.wordmark { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 800; font-size: var(--fs-xl); letter-spacing: -0.02em; color: var(--text-1); }
.wave { display: inline-flex; align-items: center; gap: 3px; height: 28px; }
.wave i { width: 4px; border-radius: 2px; background: linear-gradient(180deg, var(--violet-400), var(--orange-500)); height: var(--h, 50%); }
.wave.live i { animation: wave 1.1s var(--ease) infinite alternate; animation-delay: calc(var(--i, 0) * -0.13s); }
@keyframes wave { from { transform: scaleY(.35); } to { transform: scaleY(1); } }

/* ---------- Feedback ---------- */
.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-md); }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast { display: inline-flex; gap: var(--s-2); align-items: center; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--bg-4); box-shadow: var(--shadow-card); font-size: var(--fs-sm); }
.empty { text-align: center; padding: var(--s-10) var(--s-5); color: var(--text-2); }
.empty h3 { color: var(--text-1); margin-bottom: var(--s-2); }
.cover .badge-coin { background: rgba(7,8,26,.82); }
