:root{
  --emerald:#10B981; --emerald-d:#0E9F6E; --emerald-ink:#00281b;
  --azure:#3B82F6; --cyan:#22D3EE;
  --bg:#121212; --surface:#1A1A1A; --surface2:#212121; --line:#2A2A2A;
  --text:#F3F4F6; --muted:#9CA3AF;
}

/* ---- themes ---- */
body[data-theme="black"]{ --bg:#000000; --surface:#0A0A0A; --surface2:#111111; --line:#1C1C1C; }
body[data-theme="light"]{
  --bg:#F6F7F9; --surface:#FFFFFF; --surface2:#F0F2F5; --line:#E2E6EC;
  --text:#0F172A; --muted:#5B6472;
}

/* ---- accents ---- */
body[data-accent="green"]{ --emerald:#10B981; --emerald-d:#0E9F6E; --emerald-ink:#00281b; }
body[data-accent="saffron"]{ --emerald:#F59E0B; --emerald-d:#D97706; --emerald-ink:#2b1600; }
body[data-accent="indigo"]{ --emerald:#4F46E5; --emerald-d:#4338CA; --emerald-ink:#ffffff; }
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%}
body{
  background:var(--bg);color:var(--text);
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  overscroll-behavior:none;
}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}

#app{display:flex;flex-direction:column;height:100dvh;max-width:1100px;margin:0 auto}

.topbar{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  padding:14px 14px 10px;
}
.topbar-left{display:flex;align-items:center;gap:8px;min-width:0}
.topbar h1{font-size:19px;margin:0;font-weight:700;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar-right{display:flex;gap:2px}
.icon{width:38px;height:38px;border-radius:10px;display:grid;place-items:center;font-size:17px;color:var(--muted)}
.icon:hover{background:var(--surface);color:var(--text)}
.icon.light{color:#fff}
.icon.light:hover{background:rgba(255,255,255,.12)}
.icon.big{font-size:16px}
.icon.huge{width:64px;height:64px;font-size:26px;background:rgba(255,255,255,.10)}
.icon.huge:hover{background:rgba(255,255,255,.2)}

.searchbar{padding:0 14px 10px}
.searchbar input{
  width:100%;padding:11px 14px;border-radius:12px;border:1px solid var(--line);
  background:var(--surface);color:var(--text);font-size:14px;outline:none;
}
.searchbar input:focus{border-color:var(--emerald)}

#content{flex:1;overflow-y:auto;padding:0 14px 90px}

.bottom-nav{
  position:fixed;left:0;right:0;bottom:0;max-width:1100px;margin:0 auto;
  display:grid;grid-template-columns:repeat(5,1fr);
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter:blur(12px);
  border-top:1px solid var(--line);padding:6px 0 8px;
}
.bottom-nav button{
  display:flex;flex-direction:column;align-items:center;gap:3px;
  font-size:11px;color:var(--muted);padding:6px 0;border-radius:10px;
}
.bottom-nav button span{font-size:17px;line-height:1}
.bottom-nav button.active{color:var(--emerald)}

/* sections */
.section{margin:16px 0}
.section-head{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:10px}
.section-head h2{font-size:14px;margin:0;color:var(--muted);font-weight:600;letter-spacing:.03em;text-transform:uppercase}
.section-head button{font-size:12px;color:var(--emerald)}

/* rows */
.row-scroll{display:flex;gap:12px;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}
.row-scroll::-webkit-scrollbar{display:none}

.card{
  flex:0 0 auto;width:210px;background:var(--surface);border:1px solid var(--line);
  border-radius:14px;overflow:hidden;cursor:pointer;transition:.15s;
}
.card:hover{border-color:var(--emerald);transform:translateY(-2px)}
.thumb{position:relative;width:100%;aspect-ratio:16/9;background:#000;display:grid;place-items:center}
.thumb img{width:100%;height:100%;object-fit:cover;display:block}
.thumb .ph{font-size:26px;color:#3a3a3a}
.thumb .dur{
  position:absolute;right:6px;bottom:6px;background:rgba(0,0,0,.75);
  color:#fff;font-size:11px;padding:2px 6px;border-radius:6px;font-variant-numeric:tabular-nums;
}
.card .meta{padding:9px 11px 11px}
.card .name{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.card .sub{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.progress{height:3px;background:var(--line);border-radius:2px;margin-top:7px;overflow:hidden}
.progress i{display:block;height:100%;background:var(--emerald)}

/* list rows */
.list{display:flex;flex-direction:column;gap:2px}
.item{display:flex;gap:12px;align-items:center;padding:9px;border-radius:12px;cursor:pointer}
.item:hover{background:var(--surface)}
.item .thumb{width:112px;flex:0 0 112px;border-radius:10px}
.item .info{min-width:0;flex:1}
.item .info .name{font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.item .info .sub{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}

/* grid */
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px}
.grid .card{width:auto}

/* empty */
.empty{display:grid;place-items:center;text-align:center;padding:56px 20px;color:var(--muted)}
.empty h3{color:var(--text);margin:0 0 6px;font-size:16px}
.empty p{margin:0 0 18px;font-size:13px;max-width:340px}

.btn{
  display:inline-flex;align-items:center;gap:8px;padding:11px 18px;border-radius:12px;
  background:linear-gradient(135deg,var(--emerald),var(--emerald-d));color:#00281b;
  font-weight:600;font-size:14px;border:0;
}
.btn.ghost{background:var(--surface);color:var(--text);border:1px solid var(--line)}

/* settings */
.group{background:var(--surface);border:1px solid var(--line);border-radius:14px;overflow:hidden;margin-bottom:14px}
.setting{display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--line)}
.setting:last-child{border-bottom:0}
.setting .txt{flex:1;min-width:0}
.setting .txt .t{font-size:14px}
.setting .txt .d{font-size:12px;color:var(--muted);margin-top:2px}
.setting select,.setting input[type=number]{
  background:var(--surface2);color:var(--text);border:1px solid var(--line);
  border-radius:9px;padding:7px 10px;font-size:13px;
}
.switch{width:44px;height:26px;border-radius:999px;background:var(--line);position:relative;flex:0 0 44px;transition:.15s}
.switch::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:.15s}
.switch.on{background:var(--emerald)}
.switch.on::after{left:21px}

/* player */
.player{position:fixed;inset:0;background:#000;z-index:50;display:flex;align-items:center;justify-content:center}
.player[hidden]{display:none}
#video{width:100%;height:100%;background:#000;object-fit:contain}
#video.fit{object-fit:contain}
#video.zoom{object-fit:cover}
#video.stretch{object-fit:fill}

.p-overlay{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:space-between;
  background:linear-gradient(180deg,rgba(0,0,0,.6),transparent 22%,transparent 70%,rgba(0,0,0,.8));
  transition:opacity .2s}
.p-overlay.hidden{opacity:0;pointer-events:none}
.p-top{display:flex;align-items:center;gap:2px;padding:10px 8px}
.p-title{flex:1;color:#fff;font-weight:600;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 6px}
.p-center{display:flex;align-items:center;justify-content:center;gap:26px}
.p-bottom{padding:8px 14px 14px}
.p-times{display:flex;justify-content:space-between;color:#fff;font-size:12px;font-variant-numeric:tabular-nums;opacity:.9}
#p-seek{width:100%;accent-color:var(--emerald);margin:4px 0 8px}
.p-row{display:flex;align-items:center;justify-content:space-between;gap:2px;overflow-x:auto;scrollbar-width:none}
.p-row::-webkit-scrollbar{display:none}
.chip{color:#fff;font-size:13px;padding:8px 12px;border-radius:10px;background:rgba(255,255,255,.12)}
.chip:hover{background:rgba(255,255,255,.22)}

.p-hud{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
  background:rgba(0,0,0,.72);color:#fff;padding:10px 18px;border-radius:10px;font-size:14px}
.p-menu{position:absolute;right:12px;top:56px;background:var(--surface);border:1px solid var(--line);
  border-radius:12px;overflow:hidden;min-width:200px;box-shadow:0 12px 32px rgba(0,0,0,.5)}
.p-menu button{display:block;width:100%;text-align:left;padding:13px 16px;font-size:14px;color:var(--text)}
.p-menu button:hover{background:var(--surface2)}

.sheet{position:fixed;left:0;right:0;bottom:0;z-index:60;background:var(--surface);
  border-top-left-radius:18px;border-top-right-radius:18px;border:1px solid var(--line);
  max-height:70vh;overflow-y:auto;padding:8px 0 18px;max-width:1100px;margin:0 auto}
.sheet h3{margin:14px 18px 8px;font-size:15px}
.sheet button{display:block;width:100%;text-align:left;padding:13px 18px;font-size:14px}
.sheet button:hover{background:var(--surface2)}
.sheet .scrim{position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:-1}
.toast{position:fixed;bottom:96px;left:50%;transform:translateX(-50%);background:#000c;
  color:#fff;padding:10px 16px;border-radius:10px;font-size:13px;z-index:70}

/* YouTube embed mode */
.p-yt{position:absolute;inset:0;background:#000;display:flex;z-index:1}
.p-yt[hidden]{display:none}
.p-yt iframe{width:100%;height:100%;border:0}
body.yt-mode .p-center,body.yt-mode .p-bottom{display:none}
body.yt-mode .p-overlay{background:linear-gradient(180deg,rgba(0,0,0,.65),transparent 24%)}

.chipbtn{
  height:32px;padding:0 12px;border-radius:9px;font-size:12px;font-weight:700;letter-spacing:.04em;
  background:linear-gradient(135deg,var(--emerald),var(--emerald-d));color:#00281b;
}
.empty-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}

/* appearance pills */
.pills{display:flex;gap:8px;flex-wrap:wrap}
.pill{
  padding:9px 16px;border-radius:999px;background:var(--surface2);
  border:1px solid var(--line);color:var(--text);font-size:13px;font-weight:600;
}
.pill:hover{border-color:var(--emerald)}
.pill.on{background:var(--emerald);border-color:var(--emerald);color:var(--emerald-ink)}
