:root {
  --bg: #0f0f0f; --bg2: #1a1a1a; --bg3: #262626; --fg: #f1f1f1; --muted: #9a9a9a; --accent: #ff0033;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { position: fixed; inset: 0; overflow: hidden; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input { font: inherit; }
img { background: var(--bg3); }

/* login */
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 360px; text-align: center; }
.login-logo { width: 88px; height: 88px; border-radius: 22px; }
.login-box h1 { margin: 12px 0 4px; }
.login-box input { width: 100%; padding: 14px; border-radius: 12px; border: 1px solid #333; background: var(--bg2); color: #fff; margin: 12px 0; font-size: 16px; }
.btn-primary { width: 100%; padding: 14px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; font-size: 16px; }

/* layout */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
#topbar { display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-top) + 8px) 8px 8px; background: var(--bg); min-height: 44px; }
#title { flex: 1; font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#back-btn { visibility: hidden; font-size: 28px; }
#back-btn.show { visibility: visible; }
#view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 0 16px; }
#tabs { display: flex; background: var(--bg2); border-top: 1px solid #222; padding-bottom: var(--safe-bottom); }
#tabs a { flex: 1; text-align: center; padding: 8px 0 6px; color: var(--muted); text-decoration: none; font-size: 11px; }
#tabs a span { display: block; font-size: 20px; line-height: 22px; }
#tabs a.active { color: #fff; }
.icon-btn { padding: 8px; font-size: 20px; line-height: 1; border-radius: 50%; }
.icon-btn.big { font-size: 28px; }
.icon-btn.huge { font-size: 40px; width: 76px; height: 76px; background: #fff; color: #000; display: flex; align-items: center; justify-content: center; }
.icon-btn.on { color: var(--accent); }

/* mini player */
#mini { position: relative; display: grid; grid-template-columns: 48px 1fr auto auto auto; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg3); }
#mini-art { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
.mini-text { overflow: hidden; }
#mini-title, #mini-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
#mini-bar { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: #444; }
#mini-fill { height: 100%; width: 0; background: var(--accent); }

/* lists */
.section { padding: 10px 14px 0; }
.section h2 { font-size: 17px; margin: 10px 0 8px; }
.row-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.row-scroll::-webkit-scrollbar { display: none; }
.card { flex: 0 0 136px; }
.card img { width: 136px; height: 136px; border-radius: 10px; object-fit: cover; display: block; }
.card.round img { border-radius: 50%; }
.card .t { font-size: 13px; margin-top: 6px; line-height: 1.25; }
/* titulos quebram em ate 2 linhas e cortam com reticencias (igual YouTube Music) */
.card .t, .track .t, .list-item .t,
.card .s, .track .s, .list-item .s { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; line-height: 1.25; }
.card { display: block; }
.card .s { font-size: 12px; color: var(--muted); }
.track { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 14px; }
.track > div, .list-item > div, .card > div { min-width: 0; max-width: 100%; }
.track img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
.track .t { font-size: 15px; line-height: 1.25; }
.track .s { font-size: 13px; color: var(--muted); }
.track.current .t { color: var(--accent); }
.track .dl { font-size: 11px; color: #3c3; margin-left: 4px; }
.list-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 14px; }
.list-item img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.list-item.round img { border-radius: 50%; }
.list-item .t { font-size: 15px; } .list-item .s { font-size: 13px; color: var(--muted); }
.hero { text-align: center; padding: 16px 14px 6px; }
.hero img { width: 180px; height: 180px; border-radius: 12px; object-fit: cover; box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.hero.round img { border-radius: 50%; }
.hero h1 { font-size: 22px; margin: 12px 0 2px; }
.hero .s { color: var(--muted); font-size: 13px; }
.hero h1, .hero .s { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; line-height: 1.3; padding: 0 6px; }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 10px 14px; }
.chip { padding: 9px 16px; border-radius: 20px; background: var(--bg3); font-size: 14px; }
.chip.primary { background: #fff; color: #000; font-weight: 600; }
.chip.on { background: var(--accent); color: #fff; }
.search-box { padding: 8px 14px; }
.search-box input { width: 100%; padding: 12px 14px; border-radius: 22px; border: 0; background: var(--bg3); color: #fff; font-size: 16px; outline: none; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.spinner { text-align: center; color: var(--muted); padding: 30px; }
.progress { font-size: 12px; color: var(--muted); padding: 0 14px; }

/* now playing */
#now { position: fixed; inset: 0; background: linear-gradient(#242424, #0f0f0f); display: flex; flex-direction: column; padding: calc(var(--safe-top) + 8px) 18px calc(var(--safe-bottom) + 14px); z-index: 20; }
.now-top { display: flex; align-items: center; justify-content: space-between; }
.now-title-sm { font-size: 13px; color: var(--muted); }
#now-body { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 10px 0; }
#now-art { width: min(80vw, 60vh); aspect-ratio: 1; border-radius: 14px; object-fit: cover; box-shadow: 0 12px 40px rgba(0,0,0,.7); }
#video { width: 100%; max-height: 100%; border-radius: 12px; background: #000; }
#now-body { overflow: hidden; }
#now-body.split { flex-direction: column; gap: 10px; }
#now-body.split #video { flex: 0 0 auto; max-height: 32vh; width: auto; max-width: 100%; }
#now-body.split #now-lyrics { flex: 1 1 0; height: auto; min-height: 0; padding: 4px 0; font-size: 17px; }
#now-lyrics { width: 100%; height: 100%; overflow-y: auto; text-align: center; font-size: 20px; line-height: 1.5; padding: 20px 0; mask-image: linear-gradient(transparent, #000 15%, #000 85%, transparent); }
#now-lyrics div { color: #777; padding: 5px 0; transition: color .2s; }
#now-lyrics div.on { color: #fff; font-weight: 600; }
.now-info { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.now-info > div { flex: 1; min-width: 0; }
#now-title { font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#now-artist { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#now { overflow: hidden; max-width: 100vw; }
#now-lyrics div { overflow-wrap: anywhere; }
.hero h1 { overflow-wrap: anywhere; }
.now-seek { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
#now-range { flex: 1; accent-color: #fff; }
.now-controls { display: flex; align-items: center; justify-content: space-between; margin: 8px 0; }
.now-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

/* sheet */
#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 30; display: flex; align-items: flex-end; }
#sheet-box { width: 100%; max-height: 75vh; overflow-y: auto; background: var(--bg2); border-radius: 16px 16px 0 0; padding: 10px 0 calc(var(--safe-bottom) + 10px); }
#sheet-box .sh { padding: 10px 18px; font-weight: 600; border-bottom: 1px solid #2a2a2a; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sheet-box .it { display: block; width: 100%; text-align: left; padding: 14px 18px; font-size: 16px; }
#sheet-box .it:active { background: var(--bg3); }
#toast { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px; z-index: 40; max-width: 90vw; }
