/* album.basicwork.work — โทนเหลืองจีวร/ธรรมะ มือถือก่อน */
:root {
  --saffron: #e8a317;
  --saffron-2: #f2b705;
  --deep: #b8650a;
  --ink: #3b2a12;
  --ink-2: #7a6040;
  --paper: #fff8e6;
  --card: #fffdf6;
  --line: #f0dfb5;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
[ng-cloak] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 -apple-system, "Sukhumvit Set", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  min-height: 100vh;
  padding-bottom: calc(24px + var(--safe-b));
}
body.has-player { padding-bottom: calc(96px + var(--safe-b)); }
body.sheet-open { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 24px; height: 24px; fill: currentColor; }
.top-btn svg, .ic svg path[d*="M6 9"], .ios svg, .skip svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- หัว ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: linear-gradient(135deg, #fad02c 0%, var(--saffron) 55%, #ed8911 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(184, 101, 10, .25);
}
.top-logo { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.top-text { flex: 1; min-width: 0; }
.top-kicker { font-size: 12px; opacity: .9; letter-spacing: .02em; }
.top-title { margin: 0; font-size: 18px; line-height: 1.3; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(120, 60, 0, .25); }
.top-btn {
  position: relative; width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.22); color: #fff; display: grid; place-items: center;
}
.top-badge {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #fff; color: var(--deep); font-size: 11px; font-weight: 700; line-height: 18px;
}

/* ---------- แถบติดตั้ง ---------- */
.install {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 16px 0; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  font-size: 14px; color: var(--ink-2);
}
.install span { flex: 1; }
.install svg { width: 16px; height: 16px; vertical-align: -3px; color: #1a73e8; }
.install button {
  border: 0; border-radius: 999px; padding: 6px 14px;
  background: var(--saffron); color: #fff; font-weight: 600;
}
.install button.x { background: transparent; color: var(--ink-2); font-size: 22px; padding: 0 6px; }

/* ---------- เนื้อหา ---------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.msg { padding: 14px; text-align: center; color: var(--ink-2); }
.msg.err { color: #a33b12; background: #fde9dc; border-radius: 12px; }

.empty { text-align: center; padding: 32px 8px; color: var(--ink-2); }
.empty-logo { width: 120px; height: 120px; }
.paste { display: flex; gap: 8px; margin-top: 16px; }
.paste input {
  flex: 1; min-width: 0; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
.paste button { border: 0; border-radius: 12px; padding: 0 18px; background: var(--saffron); color: #fff; font-weight: 600; }

.resume {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 14px 16px; border: 0; border-radius: 18px;
  background: linear-gradient(135deg, #fad02c, var(--saffron) 60%, #ed8911);
  color: #fff; box-shadow: 0 6px 18px rgba(232, 163, 23, .35);
}
.resume-ico { flex: none; width: 52px; height: 52px; border-radius: 50%; background: #fff; color: var(--deep); display: grid; place-items: center; }
.resume-ico svg { width: 28px; height: 28px; margin-left: 3px; }
.resume-ico svg.pause { margin-left: 0; }
.resume-text { min-width: 0; display: flex; flex-direction: column; }
.resume-kicker { font-size: 13px; opacity: .95; }
.resume-title { font-weight: 700; font-size: 17px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.count { margin: 20px 4px 8px; font-size: 13px; color: var(--ink-2); }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list li {
  display: flex; gap: 12px; padding: 10px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.list li:active { transform: scale(.995); }
.list li.on { border-color: var(--saffron); box-shadow: 0 0 0 2px rgba(232, 163, 23, .25); }
.thumb {
  position: relative; flex: none; width: 112px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, #fbe6a6, #f5c45a);
}
.thumb.audio { width: 64px; aspect-ratio: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-kind {
  position: absolute; left: 4px; bottom: 4px; padding: 0 6px; border-radius: 6px;
  background: rgba(59, 42, 18, .7); color: #fff; font-size: 10px; line-height: 16px;
}
.eq { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 30%; background: rgba(59, 42, 18, .35); }
.eq i { width: 4px; background: #fff; border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; }
.eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 6px; } 50% { height: 18px; } }
.info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.title { font-weight: 600; font-size: 15px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list li.on .title { color: var(--deep); }
.meta { margin-top: 2px; font-size: 13px; color: var(--ink-2); }
.heard { color: var(--deep); }
.bar { margin-top: 6px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--saffron); }
.foot { margin: 24px 0 8px; text-align: center; font-size: 12px; color: #b49a72; }

/* ---------- แถบเล่นด้านล่าง ---------- */
.mini {
  position: fixed; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); z-index: 30;
  max-width: 704px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 8px;
  background: #3b2a12; color: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(59, 42, 18, .35); cursor: pointer;
}
.mini-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.15); }
.mini-prog i { display: block; height: 100%; background: var(--saffron-2); }
.mini-thumb { flex: none; width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: linear-gradient(135deg, #fad02c, #ed8911); }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-text { flex: 1; min-width: 0; }
.mini-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-time { font-size: 12px; opacity: .75; font-variant-numeric: tabular-nums; }
.ic { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; flex: none; }
.ic:disabled { opacity: .3; }
.mini .ic { color: #fff; }

/* ---------- เต็มจอ ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  padding: calc(8px + var(--safe-t)) 16px calc(20px + var(--safe-b));
  background: linear-gradient(180deg, #fff3cf 0%, var(--paper) 45%);
  transform: translateY(105%); transition: transform .28s ease;
  visibility: hidden;
}
.sheet.open { transform: none; visibility: visible; }
.sheet-bar { display: flex; align-items: center; }
.sheet-bar .ic { color: var(--ink); }
.sheet-kicker { flex: 1; text-align: center; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-space { width: 44px; }
.stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px 0; }
.stage video { width: 100%; max-height: 100%; background: #000; border-radius: 12px; }
.art { width: min(78vw, 46vh, 360px); aspect-ratio: 1; border-radius: 20px; overflow: hidden; box-shadow: 0 16px 40px rgba(184, 101, 10, .3); }
.art img { width: 100%; height: 100%; object-fit: cover; }
.sheet-title { max-width: 640px; width: 100%; margin: 0 auto; text-align: center; font-weight: 700; font-size: 18px; line-height: 1.4; }
.seek { max-width: 640px; width: 100%; margin: 14px auto 0; }
.seek input { width: 100%; accent-color: var(--saffron); height: 28px; }
.seek-t { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ctrl { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 8px; color: var(--ink); }
.ctrl .big { width: 72px; height: 72px; background: var(--saffron); color: #fff; box-shadow: 0 8px 20px rgba(232, 163, 23, .4); }
.ctrl .big svg { width: 34px; height: 34px; }
.skip { position: relative; }
.skip b { position: absolute; bottom: 4px; font-size: 9px; font-weight: 700; }

/* ---------- อัลบัมที่เคยเปิด ---------- */
.hist-back { position: fixed; inset: 0; z-index: 50; background: rgba(59, 42, 18, .35); }
.hist {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(86vw, 360px);
  padding: calc(14px + var(--safe-t)) 0 var(--safe-b);
  background: var(--paper); box-shadow: -8px 0 24px rgba(59, 42, 18, .2);
  transform: translateX(105%); transition: transform .25s ease; overflow-y: auto;
}
.hist.open { transform: none; }
.hist-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px 16px; font-weight: 700; }
.hist-head .ic { font-size: 26px; }
.hist-empty { padding: 16px; color: var(--ink-2); font-size: 14px; }
.hist ul { list-style: none; margin: 0; padding: 0 8px; }
.hist li { display: flex; align-items: center; border-radius: 12px; }
.hist li.on { background: #fbeec6; }
.hist-go { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 8px; border: 0; background: transparent; text-align: left; }
.hist-thumb { flex: none; width: 44px; height: 44px; border-radius: 10px; overflow: hidden; }
.hist-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hist-text { min-width: 0; display: flex; flex-direction: column; }
.hist-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-text small { color: var(--ink-2); font-size: 12px; }
.hist-del { border: 0; background: transparent; color: #b49a72; font-size: 22px; width: 40px; height: 40px; }

@media (min-width: 720px) {
  .thumb { width: 160px; }
  .thumb.audio { width: 80px; }
  .title { font-size: 16px; }
}

/* ---------- ออฟไลน์ + โหลดเก็บไว้ในเครื่อง ---------- */
.offline-bar { margin: 12px 16px 0; padding: 8px 12px; border-radius: 12px; background: #3b2a12; color: #fde9b0; font-size: 13px; text-align: center; }
.list li.off { opacity: .45; }
.list li.off .thumb img { filter: grayscale(1); }
.new { color: #a33b12; }

.dl-btn {
  flex: none; align-self: center; width: 48px; min-height: 48px; padding: 4px 0; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.dl-btn:active { background: var(--line); }
.dl-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dl-btn small { font-size: 10px; line-height: 1.2; white-space: nowrap; }
.dl-btn.done { color: #2f7d32; }
.dl-btn.loading, .dl-btn.queued { color: var(--deep); }
.dl-btn svg.ring { width: 26px; height: 26px; transform: rotate(-90deg); }
.dl-btn svg.ring circle { fill: none; stroke-width: 4; }
.dl-btn svg.ring .bg { stroke: var(--line); }
.dl-btn svg.ring .fg { stroke: var(--saffron); stroke-dasharray: 87.96; transition: stroke-dashoffset .3s; }
.dl-btn.part svg.ring .fg { stroke: #c9b38a; }

.dl-back { position: fixed; inset: 0; z-index: 60; background: rgba(59, 42, 18, .35); }
.dl-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-width: 720px; margin: 0 auto;
  padding: 8px 16px calc(16px + var(--safe-b)); background: var(--paper);
  border-radius: 20px 20px 0 0; box-shadow: 0 -6px 24px rgba(59, 42, 18, .2);
}
.dl-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; }
.dl-head .ic { border: 0; background: transparent; font-size: 26px; width: 44px; height: 44px; color: var(--ink-2); }
.dl-title { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dl-row { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.dl-row.done { border-color: #a5d6a7; }
.dl-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-name small { font-size: 12px; color: var(--ink-2); }
.dl-st { color: var(--deep) !important; }
.dl-st.ok { color: #2f7d32 !important; }
.dl-bar { margin: 6px 0 2px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.dl-bar i { display: block; height: 100%; background: var(--saffron); transition: width .3s; }
.dl-act { display: flex; flex-direction: column; gap: 6px; }
.dl-act button { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; background: #fff; color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.dl-act button.go { border-color: var(--saffron); background: var(--saffron); color: #fff; font-weight: 600; }
.dl-note { font-size: 12px; color: #b49a72; text-align: center; margin-top: 4px; }

.store { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.store button { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; background: #fff; color: #a33b12; font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); z-index: 70; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px; background: rgba(59, 42, 18, .92); color: #fff; font-size: 14px; text-align: center;
}
