@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/noto-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/noto-sans-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #101010;
  --bg-raise: #181818;
  --surface: #1f1f1f;
  --surface-2: #292929;
  --line: #2f2f2f;
  --text: #ececec;
  --text-2: #a8a8a8;
  --text-3: #8a8a8a;
  --accent: #00a4dc;
  --accent-ink: #00202c;
  --accent-soft: rgba(0, 164, 220, 0.14);
  --ok: #5cc25a;
  --ok-soft: rgba(92, 194, 90, 0.14);
  --warn: #e3ad35;
  --warn-soft: rgba(227, 173, 53, 0.14);
  --busy: #4cb8f0;
  --busy-soft: rgba(76, 184, 240, 0.14);
  --bad: #f2645f;
  --bad-soft: rgba(242, 100, 95, 0.14);
  --violet: #b77ad0;
  --radius: 10px;
  --radius-s: 6px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 64px;
  --top-h: 58px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: #3a3a3a var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 "Noto Sans", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(0, 164, 220, 0.45); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
input { caret-color: var(--accent); }
.sprite { display: none; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.fill { fill: currentColor; stroke: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { color: var(--text-2); text-align: center; margin-top: 30vh; }

/* ---------- shell ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: rgba(16, 16, 16, 0.92);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -0.01em; text-decoration: none; color: var(--text); white-space: nowrap; }
.brand img { width: 26px; height: 26px; }
.top .search { flex: 1; max-width: 520px; margin-left: auto; }
.quota { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.quota b { color: var(--text); font-weight: 600; }
.desk-nav { display: none; gap: 2px; }
.desk-nav a, .iconbtn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 8px;
  color: var(--text-2); text-decoration: none; background: none; border: 0; cursor: pointer; font-size: 14px;
  transition: background .2s, color .2s;
}
.desk-nav a:hover, .iconbtn:hover { background: var(--surface); color: var(--text); }
.desk-nav a[aria-current="page"] { color: var(--text); background: var(--surface); }
.iconbtn { padding: 8px; }

main { padding: 18px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(var(--n, 3), 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(20, 20, 20, 0.96); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); text-decoration: none; font-size: 11.5px; font-weight: 500;
}
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar .ico { width: 22px; height: 22px; }

@media (min-width: 860px) {
  .tabbar { display: none; }
  .desk-nav { display: flex; }
  main { padding: 28px 28px 60px; }
  .top { padding-left: 28px; padding-right: 20px; }
}
@media (max-width: 520px) {
  .brand span { display: none; }
  .top .quota { display: none; }
}

/* ---------- inputs & buttons ---------- */
.search { position: relative; }
.search .ico { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 14px 0 40px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; outline: none;
  transition: border-color .2s, background .2s;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus { border-color: var(--accent); background: var(--bg-raise); }
.search input::-webkit-search-cancel-button { filter: invert(0.6); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 14px; cursor: pointer;
  transition: filter .2s, background .2s, transform .15s var(--ease);
  white-space: nowrap; text-decoration: none;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.btn:disabled { cursor: default; filter: none; opacity: .5; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; height: 44px; }
.btn .ico { width: 17px; height: 17px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field input, .num {
  height: 44px; padding: 0 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; outline: none;
  transition: border-color .2s;
}
.field input:focus, .num:focus { border-color: var(--accent); }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .logo { width: 52px; height: 52px; margin-bottom: 18px; }
.login-card h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.02em; font-weight: 700; }
.login-card p.lead { margin: 0 0 26px; color: var(--text-2); }
.login-card .hint { margin-top: 18px; font-size: 13px; color: var(--text-3); }
.err { color: var(--bad); font-size: 14px; margin: 0 0 12px; display: flex; gap: 8px; align-items: flex-start; }
.err .ico { width: 18px; height: 18px; margin-top: 2px; }

/* ---------- sections ---------- */
h1.page { font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; margin: 4px 0 18px; font-weight: 700; text-wrap: balance; }
.section { margin: 0 0 34px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.section-head p { margin: 0; color: var(--text-3); font-size: 13px; }
.muted { color: var(--text-2); }
.empty { padding: 28px 18px; text-align: center; color: var(--text-2); background: var(--bg-raise); border-radius: var(--radius); border: 1px dashed var(--line); }
.empty .ico { width: 30px; height: 30px; color: var(--text-3); margin-bottom: 6px; }

/* ---------- album tiles ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 18px 14px; }
@media (max-width: 420px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; } }
.row { display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: thin; }
.row > * { scroll-snap-align: start; }
@media (min-width: 860px) { .row { margin: 0; padding-left: 0; padding-right: 0; grid-auto-columns: 168px; } }

.tile { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; text-decoration: none; color: inherit; }
.tile .cw { position: relative; margin-bottom: 2px; }
.open { display: block; width: 100%; background: none; border: 0; padding: 0; color: inherit; text-align: left; cursor: pointer; }
.slot { position: absolute; left: 7px; top: 7px; }
.cover {
  position: relative; aspect-ratio: 1; width: 100%; border-radius: var(--radius-s); overflow: hidden;
  background: linear-gradient(135deg, #232323, #1a1a1a); box-shadow: var(--shadow);
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .4s var(--ease); }
.cover img.on { opacity: 1; }
.cover .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #3c3c3c; }
.cover .ph .ico { width: 38%; height: 38%; stroke-width: 1.3; }
.tile:hover .cover img.on { filter: brightness(1.08); }
.tile .t { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .s { color: var(--text-2); font-size: 13px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .quick {
  position: absolute; right: 7px; bottom: 7px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 14px -4px rgba(0,0,0,.7);
  transition: transform .2s var(--ease);
}
.tile .quick:hover { transform: scale(1.08); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; backdrop-filter: blur(8px);
}
.badge .ico { width: 13px; height: 13px; stroke-width: 2.4; }
.tile .badge { background: rgba(12, 12, 12, 0.82); }
.b-available { color: var(--ok); }
.b-partial { color: var(--violet); }
.b-downloading { color: var(--busy); }
.b-requested, .b-searching, .b-waiting, .b-adding { color: var(--warn); }
.b-failed { color: var(--bad); }
.list .badge.b-available, .sheet .badge.b-available { background: var(--ok-soft); }
.list .badge.b-downloading, .sheet .badge.b-downloading { background: var(--busy-soft); }
.list .badge.b-searching, .list .badge.b-waiting, .list .badge.b-adding, .sheet .badge.b-requested { background: var(--warn-soft); }
.list .badge.b-failed { background: var(--bad-soft); }
.sheet .badge.b-partial { background: rgba(183,122,208,.14); }

/* ---------- artist list ---------- */
.artists { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.artist {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius);
  text-decoration: none; color: inherit; background: var(--bg-raise); border: 1px solid transparent;
  transition: background .2s, border-color .2s;
}
.artist:hover { background: var(--surface); border-color: var(--line); }
.avatar { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex: none; background: var(--surface-2); position: relative; }
.avatar img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; }
.avatar img.on { opacity: 1; }
.avatar .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #4a4a4a; }
.artist .meta { min-width: 0; }
.artist .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artist .d { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib { color: var(--ok); font-size: 12px; font-weight: 600; }

/* ---------- artist page ---------- */
.hero { position: relative; margin: -18px -16px 22px; padding: 64px 16px 22px; overflow: hidden; isolation: isolate; }
.hero .bg { position: absolute; inset: 0; z-index: -1; }
.hero .bg img { width: 100%; height: 100%; object-fit: cover; opacity: .35; filter: blur(2px) saturate(110%); }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(16,16,16,.2) 0%, var(--bg) 96%); }
.hero-in { display: flex; gap: 18px; align-items: flex-end; }
.hero .avatar { width: 108px; height: 108px; box-shadow: var(--shadow); }
.hero h1 { font-size: clamp(26px, 6vw, 44px); line-height: 1.05; margin: 0 0 6px; letter-spacing: -0.03em; font-weight: 750; text-wrap: balance; }
.hero .d { color: var(--text-2); font-size: 14px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); text-decoration: none; font-size: 14px; margin-bottom: 6px; background: none; border: 0; cursor: pointer; padding: 4px 0; }
.back:hover { color: var(--text); }
.bio { color: var(--text-2); max-width: 70ch; margin: 0 0 22px; font-size: 14px; }
.bio p { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bio.open p { -webkit-line-clamp: unset; display: block; }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px 0; font-size: 13.5px; font-weight: 600; }
@media (min-width: 860px) { .hero { margin: -28px -28px 26px; padding: 96px 28px 26px; } .hero .avatar { width: 148px; height: 148px; } }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 18px; padding: 2px 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-raise);
  color: var(--text-2); cursor: pointer; font-size: 13.5px; font-weight: 500; transition: background .2s, color .2s, border-color .2s;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .c { opacity: .6; margin-left: 4px; }
@media (min-width: 860px) { .chips { margin: 0 0 20px; padding: 2px 0 4px; } }

/* ---------- request list ---------- */
.seg { display: inline-flex; background: var(--bg-raise); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 16px; }
.seg button { border: 0; background: none; color: var(--text-2); height: 32px; padding: 0 16px; border-radius: 999px; cursor: pointer; font-weight: 500; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.list { display: grid; gap: 2px; }
.item {
  display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: start; padding: 12px; border-radius: var(--radius);
  background: var(--bg-raise);
}
.item:first-child { border-top-left-radius: var(--radius); }
.item .cover { box-shadow: none; border-radius: 5px; }
.item .t { font-weight: 600; line-height: 1.3; }
.item .s { color: var(--text-2); font-size: 13.5px; }
.item .s a { color: var(--text-2); text-decoration: none; }
.item .s a:hover { color: var(--text); text-decoration: underline; }
.item .foot { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--text-3); }
.item .msg { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.item .msg.bad { color: var(--bad); }
.item .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.bar { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 10px; max-width: 320px; }
.bar i { display: block; height: 100%; background: var(--busy); border-radius: 4px; transition: width .6s var(--ease); }
.list .item + .item { border-radius: 0; }
.list .item:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.list .item:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.list .item:only-child { border-radius: var(--radius); }

/* ---------- sheet (album detail) ---------- */
dialog.sheet {
  width: min(560px, 100%); max-height: min(86dvh, 760px); margin: auto auto 0; padding: 0; border: 0; border-radius: 16px 16px 0 0;
  background: var(--bg-raise); color: var(--text); box-shadow: 0 -20px 60px -10px rgba(0,0,0,.8); overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: up .38s var(--ease); }
dialog.sheet::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); animation: fade .3s; }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 16px; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.sheet .head { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 20px 20px 16px; position: relative; }
.sheet .head h2 { margin: 0 0 4px; font-size: 20px; line-height: 1.2; letter-spacing: -0.015em; padding-right: 34px; text-wrap: balance; }
.sheet .head .s { color: var(--text-2); font-size: 14px; }
.sheet .head .s a { color: var(--text-2); }
.sheet .close { position: absolute; right: 10px; top: 10px; }
.sheet .cta { padding: 0 20px 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sheet .tracks { overflow-y: auto; padding: 4px 20px 24px; border-top: 1px solid var(--line); }
.sheet ol { list-style: none; margin: 0; padding: 0; }
.sheet li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; padding: 9px 0; border-bottom: 1px solid #242424; font-size: 14px; }
.sheet li .no { color: var(--text-3); text-align: right; }
.sheet li .len { color: var(--text-3); }

/* ---------- admin ---------- */
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 30px; }
.hcard { padding: 14px 16px; background: var(--bg-raise); border-radius: var(--radius); }
.hcard h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.dot.bad { background: var(--bad); }
.hcard p { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); background: var(--bg-raise); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid #262626; white-space: nowrap; }
th { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.num { width: 84px; height: 34px; padding: 0 10px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.switch input { accent-color: var(--bad); width: 16px; height: 16px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 30px; }
.log td.d { white-space: normal; color: var(--text-2); }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 50;
  translate: -50% 20px; opacity: 0; pointer-events: none;
  max-width: min(92vw, 460px); padding: 11px 16px; border-radius: 10px; background: #2b2b2b; color: var(--text);
  box-shadow: 0 12px 30px -8px rgba(0,0,0,.8); font-size: 14px; transition: opacity .3s var(--ease), translate .4s var(--ease);
}
#toast.on { opacity: 1; translate: -50% 0; }
#toast.bad { background: #3a1d1c; color: #ffb3b0; }
@media (min-width: 860px) { #toast { bottom: 28px; } }

.skel { background: linear-gradient(90deg, #1b1b1b, #232323, #1b1b1b); background-size: 200% 100%; animation: sh 1.4s infinite linear; border-radius: var(--radius-s); }
@keyframes sh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
