/* Sehaj Path web player — Bhai Sahib Singh brand: Nishan Blue, Kesari, Brass Gold, Ivory */
@font-face {
  font-family: "Noto Serif Gurmukhi";
  src: url("fonts/NotoSerifGurmukhi.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --blue: #0B2545;
  --kesari: #F28C28;
  --gold: #C9A227;
  --ivory: #F7F3E8;

  --bg: #F7F3E8;
  --surface: #FFFDF7;
  --ink: #1B2333;
  --muted: #5E6573;
  --line: #E4DCC8;
  --active-bg: #FCEBD5;
  --active-edge: #F28C28;
  --bar: #0B2545;
  --bar-ink: #F7F3E8;
  --accent: #B8650F;           /* kesari dark enough for text on ivory */
  --gfont: 1.55rem;            /* Gurmukhi size, changed by A−/A+ */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1626;
    --surface: #0F1F35;
    --ink: #F1ECE0;
    --muted: #A3ABB8;
    --line: #1E3150;
    --active-bg: #2A2416;
    --active-edge: #F28C28;
    --bar: #06101E;
    --bar-ink: #F1ECE0;
    --accent: #F5A04E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1626; --surface: #0F1F35; --ink: #F1ECE0; --muted: #A3ABB8; --line: #1E3150;
  --active-bg: #2A2416; --active-edge: #F28C28; --bar: #06101E; --bar-ink: #F1ECE0; --accent: #F5A04E;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  min-height: 100vh;
  padding-bottom: calc(150px + env(safe-area-inset-bottom));
}
[lang="pa"], .g { font-family: "Noto Serif Gurmukhi", serif; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* ---- header ---- */
.top {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--blue); color: var(--ivory);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; flex: 1; }
.brand img { border-radius: 50%; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-pa { font-size: 1.15rem; font-weight: 600; }
.brand-en { font-size: .78rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  flex: none; min-width: 44px; height: 44px; border-radius: 22px;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  background: transparent; cursor: pointer; font-size: 1.1rem;
}
.top .icon-btn { color: var(--ivory); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
body.on-home .home-btn { visibility: hidden; }

/* ---- install banner ---- */
.install {
  margin: 12px 16px 0; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--gold);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  font-size: .9rem;
}
.install-text { flex: 1 1 220px; }
.install-actions { display: flex; gap: 8px; }

/* ---- ang bar ---- */
.angbar {
  position: sticky; top: 0; z-index: 4;
  padding-top: calc(8px + env(safe-area-inset-top)) !important;
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.angbar .icon-btn { color: var(--ink); font-size: 1.5rem; line-height: 1; }
.ang-center { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; line-height: 1.2; }
.path-name { font-size: .75rem; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ang-pill {
  display: inline-flex; align-items: baseline; gap: 8px; min-height: 44px; padding: 4px 16px; margin: 2px 0;
  border-radius: 22px; border: 1.5px solid var(--kesari); background: var(--surface); cursor: pointer;
}
.ang-pa { font-size: 1.2rem; font-weight: 600; color: var(--accent); }
.ang-num { font-size: .95rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.caret { color: var(--accent); font-size: .9rem; }
.ang-sub { font-size: .75rem; color: var(--muted); }
.angbar .icon-btn:disabled { opacity: .3; }

/* ---- home ---- */
main { max-width: 760px; margin: 0 auto; padding: 0 16px; }
#homeView { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 20px; }
#homeView > * { width: 100%; max-width: 560px; }
.intro { text-align: center; }
.intro p { margin: 0 0 6px; }
.welcome-pa { font-size: 1.15rem; color: var(--accent); }
.center { text-align: center; margin: 0; }
.section-title { font-size: 1.05rem; margin: 10px 0 0; }
.paths { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.path-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center;
}
.path-card.recent { border-color: var(--kesari); }
.path-card h3 { margin: 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.path-card .where { grid-column: 1 / -1; font-size: .9rem; color: var(--muted); }
.path-card .bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.path-card .bar span { display: block; height: 100%; background: var(--kesari); }
.path-card .row { grid-column: 1 / -1; display: flex; gap: 8px; }
.path-card .row .btn.primary { flex: 1; }
.badge { font-size: .75rem; color: #1b1206; background: var(--gold); border-radius: 10px; padding: 1px 8px; margin-left: 6px; vertical-align: middle; }
.nowplaying {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left;
  min-height: 52px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--kesari);
  background: var(--active-bg); color: var(--ink); cursor: pointer;
}
.hint { margin: 10px 0 0; text-align: center; }

/* ---- buttons ---- */
.btn {
  min-height: 44px; padding: 0 18px; border-radius: 22px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn.small { min-height: 36px; padding: 0 14px; font-size: .9rem; }
.btn.big { width: 100%; max-width: 340px; min-height: 50px; font-size: 1.02rem; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--ivory); }
.btn.ghost { background: transparent; }
.btn.big { align-self: center; }
.btn.danger { color: #B03A2E; border-color: #E0B4AE; }
.btn:disabled { opacity: .45; cursor: default; }
:root[data-theme="dark"] .btn.primary { background: var(--kesari); border-color: var(--kesari); color: #1b1206; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary { background: var(--kesari); border-color: var(--kesari); color: #1b1206; }
}
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--kesari); outline-offset: 2px; }

/* ---- status ---- */
.status { margin: 16px 0; padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.status.error { border-color: #C0392B; }

/* ---- lines ---- */
.lines { list-style: none; margin: 8px 0 0; padding: 0; }
.line {
  position: relative; margin: 6px 0; padding: 12px 14px 12px 16px;
  border-radius: 10px; border-left: 4px solid transparent; cursor: pointer;
  transition: background-color .25s ease, border-color .25s ease;
}
.line:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.line .g { display: block; font-size: var(--gfont); line-height: 1.6; }
.line .x { display: block; margin-top: 4px; color: var(--muted); font-size: .95rem; }
.line .x.tr { font-style: italic; }
.line .x[lang="pa"] { font-size: 1.02rem; }
.line .x[dir="rtl"] { text-align: right; font-family: "Noto Nastaliq Urdu", "Geeza Pro", serif; }
.line.active { background: var(--active-bg); border-left-color: var(--active-edge); }
.line.active .x { color: var(--ink); }
.line .rep {
  margin-top: 6px; font-size: .75rem; color: var(--accent);
  border: 1px solid currentColor; border-radius: 10px; padding: 0 8px; display: none;
}
.line.repeating .rep { display: inline-block; }
.line .num { position: absolute; left: -2px; top: 14px; font-size: .65rem; color: var(--muted); opacity: 0; }

.ang-end { text-align: center; padding: 20px 0 8px; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ---- player bar ---- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: var(--bar); color: var(--bar-ink);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0,0,0,.18);
}
.progress { display: flex; align-items: center; gap: 10px; max-width: 760px; margin: 0 auto; }
.time { font-variant-numeric: tabular-nums; font-size: .78rem; opacity: .85; min-width: 38px; text-align: center; }
#seek { flex: 1; accent-color: var(--kesari); height: 28px; }
.controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 2px auto 2px; max-width: 760px; }
.ctl {
  width: 48px; height: 48px; border-radius: 24px; border: 0; cursor: pointer;
  background: transparent; color: var(--bar-ink); display: inline-flex; align-items: center; justify-content: center;
}
.ctl svg { width: 26px; height: 26px; fill: currentColor; }
.ctl.play { width: 60px; height: 60px; border-radius: 30px; background: var(--kesari); color: #1b1206; }
.ctl.play svg { width: 32px; height: 32px; }
.ctl.toggle { width: auto; padding: 0 12px; gap: 6px; border: 1px solid color-mix(in srgb, var(--bar-ink) 30%, transparent); }
.ctl.toggle .ctl-label { font-size: .8rem; }
.ctl.toggle[aria-pressed="true"] { background: var(--gold); color: #1b1206; border-color: var(--gold); }
.ctl:disabled { opacity: .4; cursor: default; }
.credit {
  display: block; text-align: center; font-size: .74rem; color: var(--bar-ink); opacity: .85;
  text-decoration: none; margin-top: 2px;
}
@media (max-width: 380px) { .ctl.toggle .ctl-label { display: none; } .controls { gap: 8px; } }

/* ---- sheets (dialogs) ---- */
.sheet {
  width: min(560px, calc(100vw - 24px)); max-height: 82vh; border: 0; border-radius: 16px;
  padding: 16px; background: var(--surface); color: var(--ink);
}
.sheet::backdrop { background: rgba(5, 12, 24, .55); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-head h2 { margin: 0; font-size: 1.15rem; }
.sheet .icon-btn { color: var(--ink); }
.sheet-sub { margin: 2px 0 0; }
.stepper {
  display: grid; gap: 8px; align-items: center;
  grid-template-columns: 52px 1fr 52px;
  grid-template-areas: "m1 in p1" "m10 . p10" "go go go";
}
.stepper [data-step="-1"] { grid-area: m1; }
.stepper [data-step="1"] { grid-area: p1; }
.stepper [data-step="-10"] { grid-area: m10; }
.stepper [data-step="10"] { grid-area: p10; }
.stepper .btn.small { min-width: 52px; min-height: 48px; padding: 0 6px; }
.stepper input {
  grid-area: in; width: 100%; min-height: 56px; text-align: center; font-size: 1.6rem; font-variant-numeric: tabular-nums;
  border-radius: 12px; border: 1.5px solid var(--kesari); background: var(--bg); color: var(--ink);
}
.stepper .go { grid-area: go; max-width: none; width: 100%; margin-top: 4px; }
.more { margin-top: 8px; }
.more summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; font-size: .9rem; color: var(--muted); }
.field input {
  min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); padding: 0 12px; font-size: 1.05rem;
}
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.groups { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.groups .btn[aria-pressed="true"] { border-color: var(--kesari); color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.grid button {
  min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg);
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.grid button.current { background: var(--kesari); color: #1b1206; border-color: var(--kesari); }
.grid button:disabled { opacity: .3; cursor: default; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; border-bottom: 1px solid var(--line); }
.setting input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--kesari); flex: none; }
.setting.nav { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; padding: 6px 0; }
.lang-title { margin: 4px 0 2px; font-size: 1.15rem; }
.lang-group { margin: 14px 0 0; font-size: .85rem; color: var(--accent); text-transform: none; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(160px + env(safe-area-inset-bottom)); z-index: 8;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 22px;
  background: var(--blue); color: var(--ivory); font-size: .9rem; box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

.seg { display: flex; gap: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

@media (prefers-reduced-motion: reduce) { .line { transition: none; } }

/* offline (saved) angs — added v2 */
.grid button.saved { position: relative; }
.grid button.saved::after {
  content: ""; position: absolute; right: 5px; top: 5px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold);
}
.saved-tag { color: var(--gold); }
#offlineNote { margin: 6px 0 4px; }
