/* Profile-selectable visual systems. Structure and behaviour stay shared. */
html { color-scheme: dark; }
body { transition: background .28s ease, color .28s ease; }
.player-bar {
  background:linear-gradient(180deg,color-mix(in srgb,var(--bg-elevated) 94%,transparent),color-mix(in srgb,var(--bg) 97%,transparent));
  border-top-color:var(--border); color:var(--text);
}
.full-player { background:linear-gradient(180deg,var(--bg-elevated),var(--bg)); color:var(--text); }
.fp-queue-side { background:color-mix(in srgb,var(--bg-card) 88%,transparent); }
.queue-item.now-playing { background:var(--accent-dim); border-color:color-mix(in srgb,var(--accent) 35%,transparent); }
.rec-item.rec-playing { background:var(--accent-dim); }
.player-progress-bar::after,.fp-progress-bar::after {
  /* Android System WebView can resolve color-mix(..., transparent) to a fully
     transparent paint. A concrete rail keeps both timelines visible. */
  background:rgba(255,255,255,.28);
  box-shadow:0 0 0 1px rgba(0,0,0,.12);
}

/* Modern Cinematic */
html[data-theme="cinematic"] {
  --bg:#07100f; --bg-card:#101c19; --bg-elevated:#15241f; --bg-input:#101d1b;
  --border:#274238; --border-hover:#3c6552; --text:#f3f7f4; --text-muted:#94a9a1;
  --text-dim:#60766e; --accent:#9cec35; --accent-dim:rgba(126,220,44,.13);
  --accent-glow:rgba(126,220,44,.28); --shadow-card:0 8px 30px rgba(0,0,0,.38);
}
html[data-theme="cinematic"] body {
  background:
    radial-gradient(ellipse at 78% 8%, rgba(22,113,79,.22), transparent 36%),
    linear-gradient(155deg,#07100f 0%,#07100f 48%,#091411 100%);
}
html[data-theme="cinematic"] .home-welcome {
  background:linear-gradient(110deg,rgba(13,39,31,.96),rgba(9,47,38,.78),rgba(87,135,34,.28));
  box-shadow:inset 0 0 45px rgba(25,104,67,.12),0 12px 40px rgba(0,0,0,.25);
}
html[data-theme="cinematic"] nav,
html[data-theme="cinematic"] .player-bar { background:rgba(5,15,13,.88); }

/* Liquid Glass Transparent */
html[data-theme="glass"] {
  --bg:#07101e; --bg-card:rgba(28,47,76,.42); --bg-elevated:rgba(54,73,105,.38);
  --bg-input:rgba(15,31,53,.5); --border:rgba(211,231,255,.22); --border-hover:rgba(222,240,255,.58);
  --text:#f8fbff; --text-muted:#bdc9da; --text-dim:#7e8fa7; --accent:#8fd7ff;
  --accent-dim:rgba(111,200,255,.17); --accent-glow:rgba(105,196,255,.34);
  --shadow-card:0 18px 48px rgba(0,7,20,.32); --shadow-glow:0 0 34px rgba(105,196,255,.2);
}
html[data-theme="glass"] body {
  background:radial-gradient(circle at 80% 14%,rgba(144,91,255,.34),transparent 25%),radial-gradient(circle at 12% 76%,rgba(40,178,255,.34),transparent 33%),linear-gradient(145deg,#061322,#101c36 56%,#1a1535);
  background-attachment:fixed;
}
html[data-theme="glass"] :is(.player-bar,.setting-section,.card,.home-mix,.home-continue-card,.settings-sidebar) {
  background:linear-gradient(145deg,rgba(70,94,132,.38),rgba(21,39,67,.34));
  backdrop-filter:blur(30px) saturate(175%); -webkit-backdrop-filter:blur(30px) saturate(175%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.17),var(--shadow-card);
}
html[data-theme="glass"] .home-welcome { background:linear-gradient(115deg,rgba(38,80,130,.58),rgba(102,70,175,.46),rgba(82,157,206,.32)); box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 18px 55px rgba(3,12,34,.3); }

/* Bento Grid */
html[data-theme="bento"] {
  --bg:#0b0f12; --bg-card:#151c20; --bg-elevated:#20292e; --bg-input:#11181c;
  --border:#344247; --border-hover:#baf45f; --text:#f7faf5; --text-muted:#aebbb5;
  --text-dim:#6e7d77; --accent:#baf45f; --accent-dim:rgba(186,244,95,.14);
  --accent-glow:rgba(186,244,95,.3); --radius:18px; --radius-sm:12px; --shadow-card:0 12px 30px rgba(0,0,0,.32);
}
html[data-theme="bento"] body { background:linear-gradient(135deg,#090d10,#10171b 52%,#0b1012); background-attachment:fixed; }
html[data-theme="bento"] :is(.card,.home-mix,.home-continue-card,.setting-section,.settings-sidebar) { border-width:1px; box-shadow:inset 0 1px 0 rgba(255,255,255,.035),var(--shadow-card); }
html[data-theme="bento"] .home-welcome { background:linear-gradient(115deg,#182420,#172829 58%,#26351d); }

/* Fog */
html[data-theme="fog"] {
  --bg:#151a20; --bg-card:rgba(47,56,66,.7); --bg-elevated:rgba(68,78,89,.68); --bg-input:rgba(37,45,54,.82);
  --border:rgba(220,231,240,.16); --border-hover:rgba(235,244,250,.42); --text:#f4f7f9; --text-muted:#bdc5cc;
  --text-dim:#858f98; --accent:#dcebf3; --accent-dim:rgba(220,235,243,.13); --accent-glow:rgba(205,228,240,.2);
  --shadow-card:0 18px 42px rgba(3,7,11,.3);
}
html[data-theme="fog"] body { background:radial-gradient(ellipse at 50% 4%,rgba(205,216,226,.2),transparent 34%),radial-gradient(circle at 8% 75%,rgba(102,123,139,.2),transparent 32%),linear-gradient(150deg,#12171c,#222930 52%,#151a20); background-attachment:fixed; }
html[data-theme="fog"] :is(.card,.home-mix,.home-continue-card,.setting-section,.settings-sidebar) { backdrop-filter:blur(19px); -webkit-backdrop-filter:blur(19px); box-shadow:inset 0 1px 0 rgba(255,255,255,.09),var(--shadow-card); }
html[data-theme="fog"] .home-welcome { background:linear-gradient(110deg,rgba(67,79,90,.88),rgba(93,103,111,.68),rgba(154,162,169,.25)); }

/* Dusk */
html[data-theme="dusk"] {
  --bg:#171225; --bg-card:#28203b; --bg-elevated:#382d4d; --bg-input:#241c35;
  --border:#514363; --border-hover:#ff9d86; --text:#fff8f5; --text-muted:#c9b7ca;
  --text-dim:#8b758d; --accent:#ff9d86; --accent-dim:rgba(255,125,105,.15);
  --accent-glow:rgba(255,115,93,.32); --shadow-card:0 14px 40px rgba(12,4,25,.44);
}
html[data-theme="dusk"] body { background:radial-gradient(circle at 78% 12%,rgba(248,102,92,.3),transparent 28%),radial-gradient(circle at 12% 82%,rgba(93,63,172,.3),transparent 35%),linear-gradient(145deg,#171225,#271834 54%,#111326); background-attachment:fixed; }
html[data-theme="dusk"] :is(nav,.player-bar) { background:rgba(23,18,37,.93); }
html[data-theme="dusk"] .home-welcome { background:linear-gradient(112deg,rgba(56,40,85,.96),rgba(93,48,88,.76),rgba(236,112,91,.27)); }

/* iOS-style minimal */
html[data-theme="ios"] {
  color-scheme:dark; --bg:#151923; --bg-card:rgba(52,58,72,.84); --bg-elevated:#424858;
  --bg-input:#353b49; --border:rgba(238,241,248,.14); --border-hover:rgba(255,255,255,.3);
  --text:#fbfcff; --text-muted:#c2c7d2; --text-dim:#8b92a1; --accent:#f2f5fb;
  --accent-dim:rgba(255,255,255,.12); --accent-glow:rgba(255,255,255,.18);
  --radius:16px; --radius-sm:12px; --shadow-card:0 12px 35px rgba(0,0,0,.28);
}
html[data-theme="ios"] body {
  background:
    radial-gradient(circle at 86% 20%,rgba(182,133,121,.25),transparent 25%),
    radial-gradient(circle at 10% 9%,rgba(102,117,151,.28),transparent 28%),#151923;
  background-attachment:fixed;
}
html[data-theme="ios"] nav,
html[data-theme="ios"] .player-bar { background:rgba(35,40,51,.9); backdrop-filter:blur(28px); }
html[data-theme="ios"] .home-welcome { background:linear-gradient(115deg,rgba(71,79,99,.88),rgba(103,91,97,.76)); }
html[data-theme="ios"] .card,
html[data-theme="ios"] .home-mix,
html[data-theme="ios"] .home-continue-card,
html[data-theme="ios"] .setting-section { box-shadow:inset 0 1px 0 rgba(255,255,255,.06),var(--shadow-card); }
html[data-theme="ios"] .nav-btn.active,
html[data-theme="ios"] .home-continue-play,
html[data-theme="ios"] .player-play-btn { color:#151923; }

/* TV / big-screen */
html[data-theme="tv"] {
  --bg:#071017; --bg-card:#101a21; --bg-elevated:#15232a; --bg-input:#111d24;
  --border:#29404a; --border-hover:#89e52d; --text:#f5f8f8; --text-muted:#a2b0b5;
  --text-dim:#61737a; --accent:#91ed2c; --accent-dim:rgba(145,237,44,.13);
  --accent-glow:rgba(145,237,44,.42); --nav-height:76px; --radius:18px; --radius-sm:13px;
}
html[data-theme="tv"] body {
  background:radial-gradient(ellipse at 74% 4%,rgba(177,77,42,.22),transparent 27%),linear-gradient(145deg,#09141c,#071017 52%,#061016);
}
html[data-theme="tv"] main { max-width:1500px; padding:38px 48px; }
html[data-theme="tv"] nav { padding-left:42px; padding-right:42px; background:rgba(7,16,23,.92); }
html[data-theme="tv"] .player-bar { background:linear-gradient(180deg,rgba(18,32,39,.98),rgba(5,14,19,.99)); border-top-color:var(--accent); }
html[data-theme="tv"] .nav-btn,
html[data-theme="tv"] .downloads-btn { min-height:46px; font-size:15px; }
html[data-theme="tv"] .nav-global-search { height:46px; }
html[data-theme="tv"] .home-welcome { padding:34px 38px; background:linear-gradient(110deg,rgba(12,27,35,.94),rgba(21,38,43,.78),rgba(124,67,38,.26)); }
html[data-theme="tv"] .home-welcome h1 { font-size:clamp(34px,4vw,56px); }
html[data-theme="tv"] .home-section-head h2 { font-size:22px; }
html[data-theme="tv"] .home-continue-card { padding:20px; border-color:var(--accent); box-shadow:0 0 24px var(--accent-glow); }
html[data-theme="tv"] .home-continue-card img,
html[data-theme="tv"] .home-continue-art { width:90px; height:90px; }
html[data-theme="tv"] .home-mix { min-height:160px; padding:24px; }
html[data-theme="tv"] .home-mix-name { font-size:19px; }
html[data-theme="tv"] :is(button,a,input,select,[tabindex]):focus-visible { outline:3px solid var(--accent); outline-offset:4px; box-shadow:0 0 26px var(--accent-glow); }

/* Deep Ocean */
html[data-theme="ocean"] {
  --bg:#04151d; --bg-card:#0b2530; --bg-elevated:#113441; --bg-input:#0a2834;
  --border:#1e4d5c; --border-hover:#32d7e8; --text:#effcff; --text-muted:#9bc2ca;
  --text-dim:#5c8993; --accent:#32d7e8; --accent-dim:rgba(50,215,232,.14);
  --accent-glow:rgba(50,215,232,.32); --shadow-card:0 12px 36px rgba(0,8,15,.42);
}
html[data-theme="ocean"] body { background:radial-gradient(circle at 78% 8%,rgba(0,155,184,.25),transparent 30%),radial-gradient(circle at 8% 82%,rgba(20,91,144,.2),transparent 34%),linear-gradient(145deg,#04151d,#061d28 55%,#04131b); background-attachment:fixed; }
html[data-theme="ocean"] :is(nav,.player-bar) { background:rgba(4,21,29,.91); }
html[data-theme="ocean"] .home-welcome { background:linear-gradient(112deg,rgba(8,47,60,.96),rgba(7,77,91,.74),rgba(30,173,184,.25)); }

/* Rose Noir */
html[data-theme="rose"] {
  --bg:#140a14; --bg-card:#281329; --bg-elevated:#381b39; --bg-input:#2a142b;
  --border:#58305a; --border-hover:#ff70b7; --text:#fff5fb; --text-muted:#cda8c4;
  --text-dim:#89647f; --accent:#ff70b7; --accent-dim:rgba(255,91,177,.14);
  --accent-glow:rgba(255,73,169,.34); --shadow-card:0 12px 38px rgba(18,2,18,.46);
}
html[data-theme="rose"] body { background:radial-gradient(circle at 82% 14%,rgba(195,37,132,.28),transparent 28%),radial-gradient(circle at 9% 78%,rgba(105,42,132,.22),transparent 34%),linear-gradient(145deg,#140a14,#220d22 55%,#100810); background-attachment:fixed; }
html[data-theme="rose"] :is(nav,.player-bar) { background:rgba(20,10,20,.92); }
html[data-theme="rose"] .home-welcome { background:linear-gradient(112deg,rgba(62,22,57,.96),rgba(91,24,71,.76),rgba(219,57,143,.24)); }

/* Arctic Blue */
html[data-theme="arctic"] {
  --bg:#0b121c; --bg-card:#172332; --bg-elevated:#213044; --bg-input:#192738;
  --border:#344c66; --border-hover:#8fc8ff; --text:#f6faff; --text-muted:#b0c3d6;
  --text-dim:#71869d; --accent:#8fc8ff; --accent-dim:rgba(120,188,255,.14);
  --accent-glow:rgba(113,184,255,.3); --shadow-card:0 12px 36px rgba(1,7,16,.42);
}
html[data-theme="arctic"] body { background:radial-gradient(circle at 76% 7%,rgba(89,151,211,.25),transparent 30%),radial-gradient(circle at 10% 82%,rgba(78,111,156,.2),transparent 34%),linear-gradient(145deg,#0b121c,#111c29 54%,#09111a); background-attachment:fixed; }
html[data-theme="arctic"] :is(nav,.player-bar) { background:rgba(11,18,28,.92); }
html[data-theme="arctic"] .home-welcome { background:linear-gradient(112deg,rgba(27,48,70,.96),rgba(42,72,101,.76),rgba(113,177,231,.22)); }

/* Profile preference cards */
.theme-picker { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.theme-option { display:flex; align-items:center; gap:12px; min-width:0; padding:10px; border:1px solid var(--border); border-radius:12px; background:var(--bg-input); color:var(--text); text-align:left; cursor:pointer; font:inherit; transition:all var(--transition); }
.theme-option:hover { border-color:var(--border-hover); transform:translateY(-1px); }
.theme-option.selected { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-dim); }
.theme-option>span:last-child { min-width:0; display:flex; flex-direction:column; gap:3px; }
.theme-option strong { font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.theme-option small { color:var(--text-muted); font-size:10px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.theme-preview { position:relative; width:72px; height:46px; flex:0 0 72px; overflow:hidden; border:1px solid rgba(255,255,255,.18); border-radius:8px; background:#09110f; }
.theme-preview i { position:absolute; left:5px; top:5px; bottom:5px; width:14px; border-radius:4px; background:rgba(255,255,255,.08); }
.theme-preview b { position:absolute; left:23px; right:5px; top:5px; height:12px; border-radius:4px; background:rgba(255,255,255,.12); }
.theme-preview em { position:absolute; left:23px; right:5px; bottom:5px; height:17px; border-radius:4px; background:rgba(145,237,44,.22); }
.theme-preview-glass { background:radial-gradient(circle at 80% 25%,#956fff,#2379a8 55%,#071525); }
.theme-preview-glass em { background:rgba(143,215,255,.42); backdrop-filter:blur(3px); }
.theme-preview-bento { background:linear-gradient(135deg,#0b1012,#253026); }
.theme-preview-bento em { background:rgba(186,244,95,.38); }
.theme-preview-fog { background:radial-gradient(circle at 50% 15%,#88939c,#343d45 55%,#171c21); }
.theme-preview-fog em { background:rgba(220,235,243,.3); }
.theme-preview-dusk { background:radial-gradient(circle at 78% 18%,#d85e68,#4b285e 50%,#171225); }
.theme-preview-dusk em { background:rgba(255,157,134,.4); }
.theme-preview-ios { background:linear-gradient(135deg,#263040,#67565b); }
.theme-preview-ios em { background:rgba(238,241,248,.32); }
.theme-preview-tv { background:linear-gradient(145deg,#101c25,#071015); }
.theme-preview-tv i { background:rgba(145,237,44,.25); box-shadow:0 0 7px #91ed2c; }
.theme-preview-tv em { border:1px solid #91ed2c; background:rgba(145,237,44,.08); }
.theme-preview-ocean { background:radial-gradient(circle at 78% 18%,#0aaec0,#0b3446 48%,#04151d); }
.theme-preview-ocean em { background:rgba(50,215,232,.4); }
.theme-preview-rose { background:radial-gradient(circle at 78% 18%,#c72785,#4b1749 50%,#140a14); }
.theme-preview-rose em { background:rgba(255,112,183,.42); }
.theme-preview-arctic { background:radial-gradient(circle at 78% 18%,#578fbd,#263d58 50%,#0b121c); }
.theme-preview-arctic em { background:rgba(143,200,255,.42); }
@media (hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference) {
  html:not([data-settings-animations="off"]) .theme-option:hover .theme-preview { animation:themePreviewLift .75s cubic-bezier(.2,.75,.25,1) both; }
  html:not([data-settings-animations="off"]) .theme-option:hover .theme-preview i { animation:themePreviewRail .75s ease both; }
  html:not([data-settings-animations="off"]) .theme-option:hover .theme-preview b { animation:themePreviewHeader .75s ease both; }
  html:not([data-settings-animations="off"]) .theme-option:hover .theme-preview em { animation:themePreviewPanel .75s ease both; }
}
@keyframes themePreviewLift { 0%{transform:translateY(0) scale(1)} 45%{transform:translateY(-3px) scale(1.035)} 100%{transform:translateY(-1px) scale(1.015)} }
@keyframes themePreviewRail { 0%{transform:translateX(0);opacity:.65} 55%{transform:translateX(2px);opacity:1} 100%{transform:translateX(0);opacity:.85} }
@keyframes themePreviewHeader { 0%{transform:scaleX(.7);transform-origin:left;opacity:.6} 65%{transform:scaleX(1);opacity:1} 100%{transform:scaleX(.94);opacity:.9} }
@keyframes themePreviewPanel { 0%{transform:translateY(5px);opacity:.45} 60%{transform:translateY(-1px);opacity:1} 100%{transform:translateY(0);opacity:.9} }
@media(max-width:640px) { .theme-picker { grid-template-columns:1fr; } .theme-preview { width:64px; flex-basis:64px; } }
@media (min-width:769px) and (max-width:1100px) {
  html[data-theme="tv"] .nav-btn, html[data-theme="tv"] .downloads-btn { min-height:44px; }
  html[data-theme="tv"] .nav-global-search { height:44px; }
}
@media (min-width:769px) and (max-width:900px) {
  html[data-theme="tv"] .nav-btn, html[data-theme="tv"] .downloads-btn { min-height:38px; }
  html[data-theme="tv"] .nav-global-search { height:38px; }
}

/* Now Playing is song-aware, not theme-aware. Keep the original neutral dark
   canvas so tv-player.css can paint the artwork-derived mood wash and seasonal
   scenes consistently in every theme and on every device class. */
html[data-theme] .full-player {
  background:linear-gradient(180deg,rgba(28,28,40,.99) 0%,rgba(10,10,16,.99) 100%);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}

/* Desktop and TV navigation must fully mask content scrolling underneath it.
   Mobile keeps the lightweight search-only treatment below. */
html[data-theme] nav {
  background:var(--bg) !important;
  border-bottom:1px solid var(--border) !important;
  box-shadow:0 8px 24px rgba(0,0,0,.28) !important;
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
}
@media (max-width:768px) {
  html[data-theme] nav {
    padding-left:10px;
    padding-right:10px;
    background:transparent !important;
    border-bottom:0 !important;
    box-shadow:none !important;
  }
}
