/* আসর: styles
   Design read: a personal music player for a Bengali listener; calm, printed-songbook feel.
   Dials: ENERGY 1 / RHYTHM 2 / MOTION 1.
   Palette: warm paper + ink neutrals, one terracotta accent reserved for playback
   (play buttons, the playing song, progress). Terracotta = Bengal's temple-clay colour.
   Type: Tiro Bangla (book serif, both scripts) for titles; Hind Siliguri for controls. */

:root {
  --bg: #f3efe7; --surface: #faf7f1; --surface-2: #ebe5da; --line: #ddd4c5; --field: #8f8576;
  --ink: #2a2621; --ink-2: #4a443c; --muted: #6e665b;
  --accent: #9c4f36; --accent-ink: #fff9f3; --accent-soft: rgba(156, 79, 54, .09);
  --np-bg: #f7f3ec; --scrim: rgba(30, 24, 18, .4);
  --r-sm: 6px; --r-md: 12px;
  --font-ui: "Hind Siliguri", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-book: "Tiro Bangla", "Hind Siliguri", Georgia, serif;
  --mini-h: 64px; --nav-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #191816; --surface: #201e1b; --surface-2: #292723; --line: #33302b; --field: #7a7266;
    --ink: #ece6da; --ink-2: #cfc7b8; --muted: #9a9183;
    --accent: #e09a7e; --accent-ink: #1e1410; --accent-soft: rgba(224, 154, 126, .11);
    --np-bg: #1d1b19; --scrim: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #191816; --surface: #201e1b; --surface-2: #292723; --line: #33302b; --field: #7a7266;
  --ink: #ece6da; --ink-2: #cfc7b8; --muted: #9a9183;
  --accent: #e09a7e; --accent-ink: #1e1410; --accent-soft: rgba(224, 154, 126, .11);
  --np-bg: #1d1b19; --scrim: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-ui); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
body.has-mini { padding-bottom: calc(var(--nav-h) + var(--mini-h) + 16px + env(safe-area-inset-bottom)); }
button, select { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: var(--r-sm); z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--r-sm); }
.muted { color: var(--muted); }
.en { font-family: var(--font-ui); font-size: .72em; color: var(--muted); margin-left: 8px; }

/* ── header ── */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.logo { font-family: var(--font-book); font-size: 28px; line-height: 1; color: var(--ink); }
.tag { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .tabs { display: none; margin-left: 28px; gap: 22px; }
.top-actions { margin-left: auto; display: flex; gap: 2px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2); position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.big svg { width: 26px; height: 26px; }
.icon-btn[aria-pressed="true"] { color: var(--ink); }
.icon-btn[aria-pressed="true"]::after { /* real state: the toggle is on */
  content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor;
}

/* ── layout ── */
.layout { max-width: 1240px; margin: 0 auto; }
main { padding: 0 16px 24px; min-width: 0; }
main:focus { outline: none; }
.view[hidden] { display: none; }

/* ── home ── */
.hello { padding: 30px 0 20px; }
.hello.small { padding-bottom: 8px; }
.greet { color: var(--muted); font-size: 15px; }
.ask { font-family: var(--font-book); font-size: clamp(32px, 8.5vw, 42px); line-height: 1.15; margin-top: 4px; }
.ask-en { color: var(--muted); font-size: 14.5px; margin-top: 6px; }

/* text tabs: language choice for mixes and browse */
.seg { display: flex; gap: 22px; margin: 0 0 6px; }
.seg button {
  border: 0; background: none; padding: 6px 0; font-size: 15px; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }

/* moods: a songbook index, one row per mood */
.moods { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.moods li { border-bottom: 1px solid var(--line); }
.mood {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 16px;
  border: 0; background: none; text-align: left; padding: 15px 4px;
}
.mood:hover { background: var(--surface); }
.mood .m-bn { font-family: var(--font-book); font-size: 25px; line-height: 1.25; }
.mood .m-en { grid-column: 1; font-size: 14px; color: var(--muted); }
.mood .m-count { grid-column: 2; grid-row: 1 / span 2; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mood.playing .m-bn, .mood.playing .m-count { color: var(--accent); }
.moods .loading { padding: 18px 4px; color: var(--muted); }

/* today's mix: the one boxed element on the page */
.today {
  margin-top: 28px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px;
}
.today h2 { font-family: var(--font-book); font-size: 23px; line-height: 1.2; }
.today .t-date { font-size: 14px; color: var(--muted); margin-top: 2px; }
.today .t-sub { font-size: 14px; color: var(--ink-2); margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.play-sm {
  width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.play-sm svg { width: 22px; height: 22px; fill: currentColor; stroke: none; margin-left: 2px; }
.play-sm:hover { filter: brightness(1.06); }

.row { margin-top: 38px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.row-head h3 { font-family: var(--font-book); font-size: 21px; }

.decades { display: flex; flex-wrap: wrap; gap: 8px; }
.decade {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 9px 14px; text-align: left;
  display: grid; line-height: 1.3;
}
.decade b { font-family: var(--font-book); font-weight: 400; font-size: 18px; }
.decade span { font-size: 12.5px; color: var(--muted); }
.decade:hover { border-color: var(--field); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-sm); padding: 7px 14px;
  border: 1px solid var(--field); background: transparent; font-size: 14.5px; color: var(--ink);
}
.btn svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.btn:hover { background: var(--surface); }

/* ── browse ── */
.search {
  display: flex; align-items: center; gap: 8px; margin-top: 22px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--field); border-radius: var(--r-sm);
}
.search svg { color: var(--muted); flex: none; width: 20px; height: 20px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; padding: 11px 0; outline: none; }
.search:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }
.search input::placeholder { color: var(--muted); }
.filters { display: grid; gap: 12px; margin: 14px 0 4px; }
.selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sel { display: grid; gap: 3px; font-size: 13px; color: var(--muted); min-width: 0; }
.sel[hidden] { display: none; }
.sel select {
  width: 100%; min-width: 0; appearance: none; -webkit-appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
  border: 1px solid var(--field); border-radius: var(--r-sm); padding: 8px 28px 8px 10px; font-size: 14.5px; color: var(--ink);
}
.list-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 2px; }
.list-head .muted { font-size: 14px; }

/* song lists: numbered like a songbook */
.songs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.song {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; align-items: center;
  border-bottom: 1px solid var(--line);
}
.song:hover { background: var(--surface); }
.s-main {
  display: grid; grid-template-columns: 2.1em minmax(0, 1fr); gap: 10px; align-items: center; min-width: 0;
  border: 0; background: none; text-align: left; padding: 9px 2px;
}
.song .s-text { display: grid; min-width: 0; }
.song .s-no { font-family: var(--font-book); color: var(--muted); font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.song .s-no svg { display: none; width: 15px; height: 15px; fill: var(--accent); stroke: none; vertical-align: -2px; }
.song.current .s-no .n { display: none; }
.song.current .s-no svg { display: inline-block; }
.song .s-title { font-family: var(--font-book); font-size: 17.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .s-sub { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .s-side { display: flex; align-items: center; gap: 2px; }
.song .s-year { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.song.current .s-title { color: var(--accent); }
.heart { color: var(--muted); }
.heart svg { width: 20px; height: 20px; }
.heart.on, .heart[aria-pressed="true"] { color: var(--ink); }
.heart.on svg, .heart[aria-pressed="true"] svg { fill: currentColor; }
.heart[aria-pressed="true"]::after { display: none; }
.songs.compact .song { padding: 7px 2px; }
.empty { color: var(--muted); padding: 22px 4px; }

.foot { margin-top: 44px; padding: 18px 0 8px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: grid; gap: 4px; }

/* ── now playing ── */
.np {
  position: fixed; inset: 0; z-index: 40; background: var(--np-bg); display: flex; flex-direction: column;
  transform: translateY(101%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); visibility: hidden;
  padding-top: env(safe-area-inset-top);
}
.np.open { transform: none; visibility: visible; }
.np-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.np-src { flex: 1; text-align: center; display: grid; line-height: 1.3; min-width: 0; }
.np-src .np-label { font-size: 12.5px; color: var(--muted); }
.np-src #np-mix { font-family: var(--font-book); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-scroll { flex: 1; overflow-y: auto; padding: 18px 18px calc(24px + env(safe-area-inset-bottom)); }
.video-wrap { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; background: #000; }
.video-wrap iframe, .video-wrap #yt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: rgba(0, 0, 0, .75); color: #fff;
  font-size: 13px; padding: 6px 12px; border-radius: var(--r-sm); pointer-events: none; white-space: nowrap;
}
.np-meta { display: flex; gap: 10px; align-items: flex-start; margin-top: 20px; }
.np-titles { flex: 1; min-width: 0; }
#np-title { font-family: var(--font-book); font-size: 27px; line-height: 1.22; }
.np-alt { font-family: var(--font-book); font-style: italic; color: var(--muted); font-size: 15.5px; margin-top: 2px; }
.np-alt:empty { display: none; }
.np-artist { color: var(--ink-2); margin-top: 8px; font-size: 15px; }
.np-film { font-size: 14px; color: var(--muted); }
.progress { margin-top: 18px; }
#seek { width: 100%; accent-color: var(--accent); height: 22px; margin: 0; cursor: pointer; }
.times { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 6px; }
.play {
  width: 66px; height: 66px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.play:hover { filter: brightness(1.06); }
.play svg, .mini .icon-btn svg.i-play, .mini .icon-btn svg.i-pause { fill: currentColor; stroke: none; }
.play svg { width: 28px; height: 28px; }
.play .i-play { margin-left: 3px; }
.i-pause { display: none; }
.is-playing .i-play { display: none; }
.is-playing .i-pause { display: block; }
#btn-repeat .badge1 { position: absolute; right: 6px; top: 6px; font-size: 10px; font-weight: 600; display: none; }
#btn-repeat[data-mode="one"] .badge1 { display: block; }
#btn-repeat[data-mode="all"], #btn-repeat[data-mode="one"] { color: var(--ink); }
#btn-repeat[data-mode="all"]::after, #btn-repeat[data-mode="one"]::after {
  content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor;
}
.extras { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent;
  border-radius: var(--r-sm); padding: 6px 11px; font-size: 13.5px; color: var(--muted);
}
.pill:hover { color: var(--ink); border-color: var(--field); }
.pill svg { width: 16px; height: 16px; }
.pill[aria-pressed="true"], .pill.on { color: var(--ink); border-color: var(--field); }
.queue { margin-top: 26px; }
.queue h3 { font-family: var(--font-book); font-size: 19px; margin-bottom: 6px; }

/* ── mini player: the one floating element on phones ── */
.mini {
  position: fixed; left: 10px; right: 10px; z-index: 30; height: var(--mini-h);
  bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 2px; padding: 0 6px 0 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .25); overflow: hidden;
}
.mini[hidden] { display: none; }
.mini-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; text-align: left; height: 100%; }
.mini img { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-2); flex: none; }
.mini-text { min-width: 0; display: grid; }
.mini-title { font-family: var(--font-book); font-size: 16.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-artist { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .icon-btn { color: var(--ink); }
.mini-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); }
.mini-bar span { display: block; height: 100%; width: 0; background: var(--accent); }

/* ── bottom nav ── */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg); border-top: 1px solid var(--line);
}
.bottom-nav .tab { border: 0; background: none; display: grid; place-items: center; align-content: center; gap: 1px; font-size: 12.5px; color: var(--muted); }
.bottom-nav .tab svg { width: 21px; height: 21px; }
.bottom-nav .tab[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ── toast & dialog ── */
.toast {
  position: fixed; left: 50%; top: calc(66px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: var(--r-sm); font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; }
.sheet-menu {
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); padding: 18px; width: min(360px, calc(100vw - 32px));
}
.sheet-menu::backdrop { background: var(--scrim); }
.sheet-menu h3 { font-family: var(--font-book); font-size: 20px; margin-bottom: 12px; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.menu-grid button { border: 1px solid var(--line); background: var(--bg); border-radius: var(--r-sm); padding: 10px; }
.menu-grid button:hover { border-color: var(--field); }

/* ── wider screens ── */
@media (min-width: 640px) {
  main { padding: 0 28px 24px; }
  .moods { display: grid; grid-template-columns: 1fr 1fr; column-gap: 36px; border-top: 0; }
  .moods li { border-top: 1px solid var(--line); border-bottom: 0; }
  .moods li:nth-last-child(-n + 2) { border-bottom: 1px solid var(--line); }
}
@media (min-width: 1000px) {
  body, body.has-mini { padding-bottom: 0; }
  .top { padding-left: 28px; padding-right: 28px; }
  .top .tabs { display: flex; }
  .top .tab { border: 0; background: none; padding: 6px 0; color: var(--muted); font-size: 15px; border-bottom: 2px solid transparent; }
  .top .tab:hover { color: var(--ink); }
  .top .tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
  .bottom-nav, .mini, #np-close { display: none !important; }
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; }
  main { padding: 0 40px 24px 28px; max-width: 820px; }
  .np {
    position: sticky; top: 61px; height: calc(100vh - 61px); transform: none; visibility: visible; inset: auto; z-index: 1;
    border-left: 1px solid var(--line);
  }
  .np-top { justify-content: space-between; }
  .np-src { text-align: left; padding-left: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
