/* aimusiclist.com — 공통 스타일. 외부 글꼴·라이브러리 없음 (첫 화면 속도) */
:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --text: #16161d;
  --muted: #646474;
  --line: #e4e4ee;
  --accent: #5b4bff;
  --accent-text: #ffffff;
  --radius: 14px;
  --gap: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .04);
  font-family: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Hiragino Sans", "Noto Sans JP", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f14;
    --surface: #18181f;
    --text: #ececf3;
    --muted: #9a9aab;
    --line: #2a2a35;
    --accent: #8578ff;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2 { line-height: 1.25; margin: 0; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); padding: 7px 14px; }

/* 상단 */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; text-decoration: none; letter-spacing: -.01em; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface); font-weight: 600; box-shadow: var(--shadow); }
.top-right { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }

/* 언어 선택 (JS 없음) */
.lang { position: relative; }
.lang summary { list-style: none; display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 7px 12px; border-radius: 999px; color: var(--muted); }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang[open] summary { color: var(--text); background: var(--surface); }
.lang ul { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; min-width: 160px; max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgb(0 0 0 / .15); }
.lang a { display: block; padding: 8px 12px; border-radius: 8px; text-decoration: none; }
.lang a:hover { background: var(--bg); }
.lang a[aria-current="true"] { font-weight: 700; color: var(--accent); }

/* 메인 */
.hero { padding: 48px 0 24px; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 20px; }
.hero h1 { font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.4rem); max-width: 22ch; letter-spacing: -.02em; }

.block { padding: 28px 0; }
.block-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.block-head h2 { font-size: 1.35rem; }
.block-head p { margin: 0; font-size: .92rem; }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); margin: 0; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap); }
.grid-sites  { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-covers { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); min-width: 0; }
.card .title { display: block; font-weight: 700; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .title:hover { text-decoration: underline; }
.card .sub { display: block; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 신규 아티스트 카드 */
.site { position: relative; display: flex; gap: 14px; align-items: center; padding: 14px; }
.site:hover { border-color: var(--accent); }
.site .stretch::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.site-txt { min-width: 0; }
.site .desc { display: block; font-size: .85rem; color: var(--muted); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.avatar {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 70% 55%), hsl(calc(var(--h) + 50) 70% 45%));
}

/* 앨범·플레이리스트 카드 */
.cover-card { padding: 10px 10px 12px; }
.cover {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; overflow: hidden; margin-bottom: 10px; color: #fff;
  background: linear-gradient(145deg, hsl(var(--h) 65% 55%), hsl(calc(var(--h) + 70) 60% 35%));
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-count { position: absolute; inset-inline-end: 8px; bottom: 8px; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgb(0 0 0 / .55); color: #fff; }
.cover:hover { filter: brightness(1.06); }
.site-link { display: inline-block; margin-top: 2px; font-size: .82rem; color: var(--accent); text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-link:hover { text-decoration: underline; }

/* 안내 화면 */
.notice { padding: 80px 0; text-align: center; }
.notice p { color: var(--muted); }
.debug { text-align: start; white-space: pre-wrap; background: var(--surface); padding: 12px; border-radius: 8px; border: 1px solid var(--line); }

.foot { margin-top: 48px; padding: 28px 0 100px; border-top: 1px solid var(--line); font-size: .9rem; }
.foot p { margin: 4px 0; }

@media (max-width: 640px) {
  .top-in { gap: 8px; padding-block: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .hero { padding-top: 28px; }
  .grid-covers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-sites { grid-template-columns: 1fr; }
}

/* ───────── 2-2: 폼·회원 ───────── */
[hidden] { display: none !important; }
.small { font-size: .85rem; }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.text-danger { color: #d33; }
.btn-small { padding: 6px 12px; font-size: .88rem; }
.btn-danger { color: #d33; }
.btn[disabled] { opacity: .5; cursor: default; }
.linkish { background: none; border: 0; padding: 8px 12px; font: inherit; color: inherit; cursor: pointer; width: 100%; text-align: start; border-radius: 8px; }
.linkish:hover { background: var(--bg); }
.me-menu summary { color: var(--text); }
.avatar-xs { width: 26px; height: 26px; font-size: .8rem; }
.me-name { max-width: 10ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth { max-width: 420px; margin: 40px auto; padding: 24px; }
.auth h1 { font-size: 1.5rem; margin-bottom: 8px; }
.form { display: grid; gap: 14px; margin: 16px 0; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.form input { font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); min-width: 0; }
.form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form .btn { justify-self: start; }
.alert { background: color-mix(in srgb, #d33 12%, var(--surface)); border: 1px solid color-mix(in srgb, #d33 40%, var(--line)); border-radius: 10px; padding: 8px 14px; }
.alert p { margin: 4px 0; }
.page-head { padding: 32px 0 12px; }
.page-head h1 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); }
.page-head p { margin: 6px 0 0; }
.crumbs { font-size: .88rem; color: var(--muted); }
.crumbs a { text-decoration: none; }
.notice-inline { color: var(--muted); }
.row-btns { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* 내 개인사이트 */
.site-admin-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: var(--gap); }
.site-admin { padding: 16px; }
.site-admin-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: start; }
.site-admin-head a { color: var(--muted); }
.site-admin-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.site-admin-facts { display: grid; gap: 4px; margin: 12px 0 0; }
.site-admin-facts div { display: flex; gap: 8px; flex-wrap: wrap; }
.site-admin-facts dt { color: var(--muted); min-width: 9em; }
.site-admin-facts dd { margin: 0; }
.site-admin-msg:not(:empty) { margin-top: 10px; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-inline-start: 6px; background: var(--bg); border: 1px solid var(--line); }
.badge-active { color: #138a4b; border-color: currentColor; }
.badge-pending { color: #b26b00; border-color: currentColor; }
.badge-hidden, .badge-suspended { color: #d33; border-color: currentColor; }
.form-card { padding: 20px; }
.form-card h2 { font-size: 1.15rem; }
.secret-box { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 12px; padding: 14px; margin: 10px 0; display: grid; gap: 8px; justify-items: start; }
.secret-box p { margin: 0; }
.secret-box pre { margin: 0; white-space: pre-wrap; word-break: break-all; background: var(--surface); padding: 10px; border-radius: 8px; border: 1px solid var(--line); width: 100%; }
.secret-box pre span { color: var(--muted); }

/* ───────── 장르 ───────── */
.genre-grid { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.genre-card { padding: 14px; border-top: 4px solid hsl(var(--h) 65% 55%); }
.genre-main { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 800; font-size: 1.05rem; text-decoration: none; margin-bottom: 8px; }
.genre-main:hover { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: .82rem; padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); text-decoration: none; color: var(--muted); }
.chip:hover, .chip[aria-current] { color: var(--accent); border-color: var(--accent); }

/* ───────── 곡 목록 ───────── */
.tracklist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.track { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); min-width: 0; }
.track:first-child { border-top: 0; }
.track:hover { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.track.is-playing { background: color-mix(in srgb, var(--accent) 11%, var(--surface)); }
.track.is-playing .tr-title { color: var(--accent); }
.tr-play, .tr-add, .tr-remove { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.tr-play { background: var(--bg); }
.tr-play:hover, .tr-add:hover { background: var(--accent); color: var(--accent-text); }
.tr-remove { color: var(--muted); width: 30px; height: 30px; }
.tr-remove:hover { color: #d33; }
.tr-play .i-eq, .track.is-playing:not(.is-paused) .tr-play .i-play { display: none; }
.track.is-playing:not(.is-paused) .tr-play .i-eq { display: block; }
.tr-main { flex: 1; min-width: 0; }
.tr-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.tr-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tr-genres { flex: none; max-width: 55%; font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-sub { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-site { color: var(--accent); text-decoration: none; }
.tr-site:hover { text-decoration: underline; }
.tr-dur { flex: none; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; }

/* 앨범·플레이리스트 상세 */
.detail-head { display: flex; gap: 24px; align-items: end; flex-wrap: wrap; padding: 32px 0 20px; }
.detail-cover { width: 200px; margin: 0; flex: none; }
.detail-txt { min-width: 0; flex: 1; display: grid; gap: 6px; justify-items: start; }
.detail-txt h1 { font-size: clamp(1.4rem, 1.1rem + 1.5vw, 2.2rem); word-break: break-word; }
.detail-txt p { margin: 0; }
.local-pl { padding: 14px; margin-bottom: var(--gap); }
.local-pl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.local-pl-head h2 { font-size: 1.1rem; }
.local-pl-head .row-btns { margin-inline-start: auto; }

/* + 메뉴 */
.add-menu { position: fixed; z-index: 30; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 32px rgb(0 0 0 / .2); padding: 6px; }
.add-menu-h { margin: 4px 8px 6px; font-weight: 700; font-size: .9rem; }
.add-menu button { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.add-menu button:hover, .add-menu button:focus { background: var(--bg); outline: none; }
.add-menu button span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-menu-new { color: var(--accent) !important; font-weight: 600; }
.add-menu-note { margin: 6px 8px 2px; }

/* ───────── 하단 플레이어 ───────── */
#player-root { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
.player { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.3fr); align-items: center; gap: 16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgb(0 0 0 / .08); }
.pl-info { min-width: 0; display: grid; }
.pl-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-site { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-ctrl { display: flex; gap: 6px; align-items: center; }
.pl-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.pl-btn:hover { background: var(--bg); }
.pl-main { width: 46px; height: 46px; background: var(--accent); color: var(--accent-text); }
.pl-main:hover { background: var(--accent); filter: brightness(1.1); }
.pl-seek { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pl-seek input { flex: 1; min-width: 60px; accent-color: var(--accent); }
body.has-player .foot { padding-bottom: 130px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); z-index: 40; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; background: #222; color: #fff; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .player { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .pl-seek { grid-column: 1 / -1; order: 3; }
  .tr-line { flex-wrap: wrap; column-gap: 6px; row-gap: 0; }
  .tr-genres { max-width: 100%; }
  .tr-dur { display: none; }
  .detail-cover { width: 140px; }
  .detail-head { padding-top: 20px; }
}

/* ───────── (2-3) 순위 ───────── */
.tr-rank { flex: none; width: 2.2em; text-align: center; font-weight: 750; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.tr-move { flex: none; width: 3.2em; font-size: .74rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.tr-move-up { color: #1a9e55; }
.tr-move-down { color: #d33; }
.tr-move-new { color: var(--accent); font-weight: 650; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 560px) { .tr-move { width: 2.4em; } .tr-rank { width: 1.8em; } }

/* ───────── (2-4) 신고 · 관리 화면 ───────── */
.tr-report { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--muted); opacity: .45; }
.tr-report:hover, .tr-report:focus-visible { opacity: 1; color: #d33; background: var(--bg); }
@media (hover: none) { .tr-report { opacity: .7; } }
.form select, .form textarea { font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); min-width: 0; }
.form textarea { resize: vertical; }
.form select:focus, .form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.report-track { display: grid; gap: 2px; padding: 10px 12px; margin: 10px 0; background: var(--bg); border-radius: 10px; }
.notice-ok { background: color-mix(in srgb, #1a9e55 12%, var(--surface)); border: 1px solid color-mix(in srgb, #1a9e55 40%, var(--line)); border-radius: 10px; padding: 10px 14px; }
.form-msg:empty { display: none; }
.admin-tabs, .admin-sub { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.admin-tabs .chip { font-size: .95rem; padding: 6px 14px; }
.admin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap); }
.admin-item { padding: 14px 16px; }
.admin-item.is-overdue { border-color: #b26b00; }
.admin-item-head { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; align-items: start; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: start; }
.admin-act { display: flex; gap: 6px; align-items: center; margin: 0; }
.admin-act input[type=text] { font: inherit; font-size: .85rem; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); width: 11em; }
.btn-solid-danger { background: #c62f2f; color: #fff; }
.admin-reports { margin: 12px 0 0; padding-inline-start: 1.2em; display: grid; gap: 10px; }
.admin-desc { margin: 4px 0; white-space: normal; word-break: break-word; }
.admin-evidence { word-break: break-all; }
.admin-search { display: flex; gap: 8px; margin: 0 0 10px; }
.admin-search input { font: inherit; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); min-width: 0; flex: 1; max-width: 320px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: start; vertical-align: top; border-top: 1px solid var(--line); }
.admin-table thead th { border-top: 0; font-size: .8rem; color: var(--muted); font-weight: 650; }
.admin-table .num { text-align: end; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .admin-table thead { display: none; }
  .admin-table tr { display: grid; padding: 8px 0; border-top: 1px solid var(--line); }
  .admin-table td { border: 0; padding: 4px 12px; }
  .admin-table .num { text-align: start; }
}
