@font-face {
  font-family: "Cormorant Garamond";
  src: url("/fonts/CormorantGaramond.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("/fonts/CormorantGaramond-Italic.ttf") format("truetype");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("/fonts/NotoNaskhArabic.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/NotoSans.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Class rules such as .preview-pill { display: inline-block } and
   .link-btn { display: block } have the same specificity as the UA
   [hidden] { display: none } stylesheet and would keep those elements
   visible even after JS sets the hidden attribute. */
[hidden] {
  display: none !important;
}

:root {
  --bg: #070b14;
  --bg-elev: rgba(14, 22, 36, 0.88);
  --navy: #0d1b2e;
  --gold: #d4af37;
  --gold-soft: #e8d5a3;
  --gold-dim: #8a7430;
  --sand: #c4a574;
  --text: #f6f0e4;
  --muted: #a89b82;
  --line: rgba(212, 175, 55, 0.2);
  --danger: #c87a7a;
  --tab-h: 62px;
  --mini-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html { background: var(--bg); }
body {
  font-family: "Noto Sans", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(42, 28, 18, 0.45), transparent 60%),
    url("/bg-stars.jpg") center top / cover no-repeat fixed,
    var(--bg);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; margin: 0; }
[lang="ar"] { font-family: "Noto Naskh Arabic", serif; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  position: relative;
  background: linear-gradient(180deg, rgba(7, 11, 20, 0.55), rgba(7, 11, 20, 0.88) 40%, #070b14 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: linear-gradient(180deg, rgba(7, 11, 20, 0.94), rgba(7, 11, 20, 0.72) 70%, transparent);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); object-fit: cover;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-en {
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 15px;
  color: var(--gold-soft);
}
.brand-ar { font-size: 13px; color: var(--gold); }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--gold-soft);
  border: 1px solid transparent;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { border-color: var(--line); background: rgba(212, 175, 55, 0.08); }
.icon-btn.play {
  background: var(--gold);
  color: #1a1408;
  border: 0;
}
.icon-btn.play.big { width: 68px; height: 68px; }
.icon-btn.play.big svg { width: 30px; height: 30px; }
.icon-btn.play .i-pause { display: none; }
.icon-btn.play.is-playing .i-play { display: none; }
.icon-btn.play.is-playing .i-pause { display: block; }
.icon-btn.ghost { color: var(--muted); }
.icon-btn.is-on { color: var(--gold); }

#main {
  padding: 4px 18px calc(var(--tab-h) + var(--mini-h) + var(--safe-bottom) + 20px);
}
#app.no-player #main {
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 20px);
}

.view { display: none; animation: fade 0.35s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.kicker {
  margin: 4px 0 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--sand);
}
.page-title { font-size: 32px; margin: 6px 0 16px; color: var(--gold-soft); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 22px 0 12px;
}
.section-head h2 { font-size: 24px; color: var(--gold-soft); }
.muted { color: var(--muted); font-size: 13px; }

.featured {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  min-height: 280px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line);
}
.featured img.featured-cover {
  width: 100%; height: 280px; object-fit: cover; object-position: top center;
}
.featured-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,11,20,0.15) 0%, transparent 32%, rgba(7,11,20,0.15) 58%, rgba(7,11,20,0.82) 100%);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 14px 16px 16px;
}
.featured .badge {
  align-self: flex-start;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  border-radius: 999px;
  padding: 3px 9px;
  margin-bottom: 8px;
}
.featured h1 { font-size: 30px; line-height: 1.3; }
.featured .en { font-family: "Cormorant Garamond", serif; font-style: italic; color: var(--sand); margin: 0; }
.featured-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14px;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
  background: rgba(7, 11, 20, 0.5);
  color: var(--text);
}
.btn.primary { background: var(--gold); color: #1a1408; border-color: var(--gold); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: rgba(246, 240, 228, 0.08); }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.card {
  display: flex; flex-direction: column; gap: 8px;
  text-align: left;
  color: inherit;
}
.card .cover, .row .cover {
  width: 100%; aspect-ratio: 1;
  border-radius: 14px;
  object-fit: cover;
  object-position: top center;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.card .t-ar { font-size: 16px; line-height: 1.5; }
.card .t-en { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 13px; color: var(--muted); }
.chip {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 2px;
}

.list { display: flex; flex-direction: column; gap: 4px; }
.row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 4px;
  border-radius: 12px;
  width: 100%;
  text-align: left;
  color: inherit;
}
.row:hover, .row:focus-visible { background: rgba(212, 175, 55, 0.06); }
.row .cover { width: 56px; height: 56px; border-radius: 10px; aspect-ratio: auto; }
.row .meta { display: flex; flex-direction: column; min-width: 0; }
.row .t-ar { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t-en { font-family: "Cormorant Garamond", serif; font-style: italic; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .dur { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.search-wrap {
  display: flex; align-items: center; gap: 10px;
  background: rgba(14, 22, 36, 0.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  margin: 8px 0 16px;
}
.search-wrap svg { width: 18px; height: 18px; color: var(--gold); flex: none; }
.search-wrap input {
  flex: 1; background: none; border: 0; outline: none; color: var(--text);
}
.search-wrap input::placeholder { color: var(--muted); }

.track-hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.track-hero img {
  width: min(78vw, 320px); aspect-ratio: 1;
  border-radius: 18px; border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  margin: 8px 0 18px;
}
.track-hero h1 { font-size: 28px; }
.track-hero .en { font-family: "Cormorant Garamond", serif; font-style: italic; color: var(--sand); margin: 4px 0 0; }
.track-hero .artist { color: var(--muted); margin: 6px 0 16px; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; }
.text-back {
  color: var(--sand);
  font-size: 14px;
  margin: 0 0 10px;
}

.form { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.form label { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.form input {
  width: 100%;
  background: rgba(14, 22, 36, 0.8);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
.form input:focus { border-color: var(--gold-dim); }
.form .error { color: var(--danger); font-size: 13px; min-height: 1.2em; }
.switch-auth { color: var(--muted); font-size: 14px; text-align: center; }
.switch-auth button { color: var(--gold); }

.account-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: rgba(14, 22, 36, 0.6);
}
.account-card h2 { margin-bottom: 6px; }
.status-pill {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.paywall-page, .sheet .paywall-inner { text-align: center; padding: 8px 0 24px; }
.paywall-page .crescent, .paywall-inner .crescent {
  width: 72px; height: 72px; margin: 8px auto 14px; border-radius: 18px;
  border: 1px solid var(--line);
}
.paywall-page h1, .paywall-inner h1 { font-size: 32px; color: var(--gold-soft); }
.paywall-page .ar, .paywall-inner .ar { font-size: 20px; color: var(--gold); margin: 6px 0 10px; }
.paywall-page p, .paywall-inner p { color: var(--muted); }
.plans { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.plan {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(14, 22, 36, 0.6);
  display: flex; justify-content: space-between; align-items: center;
}
.plan.is-selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.plan .name { font-family: "Cormorant Garamond", serif; font-size: 22px; }
.plan .price { color: var(--gold-soft); font-size: 15px; text-align: right; max-width: 62%; line-height: 1.35; }
.plan .note { font-size: 12px; color: var(--sand); }
.trial-cta {
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  color: var(--gold-soft);
  margin: 4px 0 10px;
}
.trial-promo {
  text-align: center;
  margin: 0 0 14px;
  font-size: 14px;
}
.trial-promo a { color: var(--gold); }
.fineprint { font-size: 11px; color: var(--muted); margin-top: 12px; line-height: 1.45; }

.mini-player {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 6px);
  width: min(460px, calc(100% - 16px));
  display: grid;
  grid-template-columns: 48px 1fr 46px;
  gap: 10px;
  align-items: center;
  padding: 8px 8px 8px 8px;
  border-radius: 14px;
  background: rgba(16, 24, 38, 0.86);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  z-index: 30;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.mini-player[hidden] { display: none !important; }
.mini-cover-btn img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.mini-meta { text-align: left; min-width: 0; display: flex; flex-direction: column; }
.mini-title-ar { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-title-en { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding: 6px 8px var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(7, 11, 20, 0.94);
  border-top: 1px solid var(--line);
  z-index: 25;
  backdrop-filter: blur(16px);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 10px; letter-spacing: 0.06em;
}
.tabbar svg { width: 22px; height: 22px; }
.tabbar a.is-active { color: var(--gold); }

.sheet {
  position: fixed;
  inset: 0;
  max-width: 480px;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(7,11,20,0.4), #070b14 30%),
    var(--bg);
  z-index: 50;
  overflow: auto;
  padding: calc(10px + var(--safe-top)) 22px calc(28px + var(--safe-bottom));
  animation: up 0.35s ease;
}
.sheet[hidden] { display: none !important; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-handle {
  width: 40px; height: 4px; border-radius: 4px;
  background: rgba(232, 213, 163, 0.35);
  margin: 4px auto 8px;
}
.player-hero { display: flex; justify-content: center; margin: 8px 0 20px; }
.player-hero img {
  width: min(82vw, 360px); aspect-ratio: 1;
  border-radius: 20px;
  object-fit: cover;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 0 80px rgba(212, 175, 55, 0.08);
}
.player-titles { text-align: center; }
.player-titles h1 { font-size: 30px; line-height: 1.4; }
.player-titles #player-title-en {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  color: var(--sand);
  margin: 2px 0 0;
  font-size: 18px;
}
.player-artist {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 0;
}
.preview-pill {
  display: inline-block;
  margin: 10px auto 0;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--gold-dim);
  color: var(--gold-soft);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.seek { margin: 22px 0 8px; }
.seek input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: rgba(232, 213, 163, 0.22);
  outline: none;
}
.seek input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--gold-soft);
  border: 0;
  box-shadow: 0 0 0 3px rgba(7,11,20,0.6);
}
.seek-times {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
}
.transport {
  display: flex; align-items: center; justify-content: space-between;
  margin: 10px 8px 0;
}
.repeat-one {
  position: absolute;
  font-size: 9px;
  color: var(--gold);
}
#btn-repeat { position: relative; }
.link-btn {
  display: block;
  width: 100%;
  margin-top: 22px;
  color: var(--gold);
  font-family: "Cormorant Garamond", serif;
  font-size: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tab-h) + var(--mini-h) + var(--safe-bottom) + 16px);
  background: rgba(16, 24, 38, 0.95);
  border: 1px solid var(--line);
  color: var(--gold-soft);
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 60;
  font-size: 13px;
}
.toast[hidden] { display: none !important; }

.empty { color: var(--muted); text-align: center; padding: 32px 8px; }

@media (min-width: 720px) {
  body { background-color: #05080f; }
  #app { box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0,0,0,0.5); min-height: 100vh; }
}

.paypal-buttons { margin: 4px 0 8px; min-height: 150px; }
.status-pill.is-cancelled { border-color: var(--sand); color: var(--sand); }
.status-pill.is-suspended, .status-pill.is-expired { border-color: var(--muted); color: var(--muted); }
