/*
 * FITPLACE 스타일시트.
 *
 * Vite/Tailwind를 쓰지 않는다 — 지금은 화면이 몇 장뿐이라 빌드 단계를
 * 추가할 이득이 없다. 플레이어에 TypeScript가 필요해지는 시점에
 * Vite를 도입하고 이 파일을 resources/css 로 옮긴다. (doc/07 §2)
 */

:root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f232c;
    --line: #2a2f3a;
    --text: #e8eaed;
    --muted: #9aa3b2;
    --accent: #22c55e;
    --accent-dim: #16a34a;
    --danger: #ef4444;
    --radius: 10px;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.6 "Pretendard", -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
}

a { color: inherit; text-decoration: none; }

/* ── 상단바 ── */
.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar .brand { font-weight: 700; letter-spacing: -0.02em; font-size: 17px; }
.topbar .brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 16px; margin-left: auto; align-items: center; }
.topbar nav a { color: var(--muted); font-size: 14px; }
.topbar nav a:hover, .topbar nav a.on { color: var(--text); }
.nav-toggle { display: none; }
.nav-user { color: var(--muted); font-size: 13px; white-space: nowrap; }
.nav-logout { margin: 0; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 24px 64px; }
.wrap--wide { max-width: 1360px; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 17px; margin: 28px 0 12px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 24px; }

/* ── 버튼 ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: var(--radius);
    border: 1px solid var(--line); background: var(--surface-2);
    color: var(--text); font-size: 14px; cursor: pointer;
    font-family: inherit;
}
.btn:hover { border-color: #3a4150; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #06240f; font-weight: 600; }
.btn--primary:hover { background: var(--accent-dim); }
.btn--danger { color: var(--danger); }
.btn--sm { padding: 5px 10px; font-size: 13px; }

/* ── 카드 그리드 ── */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
}
.card__body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.card__title { font-weight: 600; margin: 0 0 6px; }
.card__meta { color: var(--muted); font-size: 13px; margin-top: auto; padding-top: 12px; }
.card__thumb { aspect-ratio: 16/9; background: var(--surface-2); object-fit: cover; width: 100%; }

/* ── 표 ── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr:hover td { background: var(--surface); }

/* ── 폼 ── */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
    width: 100%; padding: 10px 12px; border-radius: var(--radius);
    border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
    font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-dim); outline-offset: -1px; }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }

/* ── 알림 ── */
.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; }
.flash--ok { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); }
.flash--err { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); }

.badge {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.badge--on { background: rgba(34,197,94,.15); border-color: rgba(34,197,94,.35); color: #86efac; }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ── 로그인 ── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px; }
.login-card h1 { text-align: center; margin-bottom: 24px; }
.err { color: #fca5a5; font-size: 13px; margin-top: 6px; }

/* ── 영상 고르기 ── */
.picker { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pick-item {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); cursor: pointer; font-size: 13px;
}
.pick-item:hover { border-color: #3a4150; }
.pick-item input { margin-top: 2px; }
.pick-item.is-in { opacity: .45; }
.pick-item small { color: var(--muted); display: block; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters > div { min-width: 130px; }

/* ── 재생 화면 ── */
.player-page { background: #000; min-height: 100vh; }
.stage { position: relative; max-width: 1280px; margin: 0 auto; }
.stage video { width: 100%; display: block; background: #000; }
.overlay {
    position: absolute; inset: 0; pointer-events: none;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 20px 24px;
}
.overlay__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.chip {
    background: rgba(0,0,0,.6); padding: 8px 14px; border-radius: 8px;
    font-size: 15px; font-weight: 600; backdrop-filter: blur(4px);
}
.chip small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.chip--song { display: flex; align-items: center; gap: 10px; text-align: right; }
.chip__cover { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; display: block;
    border: 1px solid rgba(255,255,255,.18); flex-shrink: 0; }
.overlay__desc {
    background: rgba(0,0,0,.72); padding: 12px 16px; border-radius: 8px;
    font-size: 14px; max-width: 70%; backdrop-filter: blur(4px);
}
.gauge { height: 4px; background: rgba(255,255,255,.2); border-radius: 2px; overflow: hidden; margin-top: 12px; }
.gauge > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s linear; }
.player-bar {
    max-width: 1280px; margin: 0 auto; padding: 14px 20px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--surface); border-top: 1px solid var(--line);
}
.player-bar .spacer { flex: 1; }
.player-bar label { display: inline; margin: 0; }
.tracklist { max-width: 1280px; margin: 0 auto; padding: 0 20px 40px; }
.tracklist li { padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.tracklist li.on { color: var(--text); font-weight: 600; }
.tracklist ol { padding-left: 20px; margin: 0; }

/* ── 오늘의 루틴 ── */
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 20px; }
.hero__date { color: var(--muted); font-size: 13px; }
.hero__title { font-size: 26px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -0.03em; }
.hero__meta { color: var(--muted); font-size: 14px; }
.cond { display: flex; align-items: center; gap: 14px; margin: 20px 0 6px; }
.cond input[type=range] { flex: 1; accent-color: var(--accent); }
.cond span { font-size: 20px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chips a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--surface-2); font-size: 13px; color: var(--muted); }
.chips a.on { background: var(--accent); border-color: var(--accent); color: #06240f; font-weight: 600; }

/*
 * 오늘의 음악.
 *
 * 고르는 자리가 아니라 **보는 자리**다 — 기본이 랜덤이라 아무것도 안 해도
 * 음악은 나온다. 그래서 지금 걸린 앨범을 위에 크게 놓고, 바꾸는 수단은
 * 아래 레일에 깐다. 선택을 강요하지 않으려는 배치다.
 *
 * 레일인 이유는 **앨범이 계속 늘어나기 때문**이다. 줄바꿈으로 쌓으면 스무 장이
 * 됐을 때 이 블록만 화면 절반을 먹는다. 가로 스크롤은 개수와 무관하게 높이가
 * 일정하다.
 */
.music { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ── 지금 걸린 앨범 ── */
.music__now { display: flex; align-items: center; gap: 14px; }
.music__art { position: relative; width: 72px; height: 72px; border-radius: 12px;
    overflow: hidden; flex-shrink: 0; background: var(--surface-2);
    box-shadow: 0 8px 20px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.07); }
.music__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.music__art img[hidden] { display: none; }
.music__art-fallback { position: absolute; inset: 0; display: grid; place-items: center;
    color: var(--muted); font-size: 24px; }
.music__art-fallback[hidden] { display: none; }

.music__meta { min-width: 0; }
.music__eyebrow { display: flex; align-items: center; gap: 8px;
    color: var(--muted); font-size: 12px; }
.music__mode { padding: 2px 8px; border-radius: 999px; font-size: 11px; line-height: 1.5;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.music__title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music__sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ── 고르는 레일 ── */
.music__rail { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; padding: 8px 0 12px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
    scrollbar-width: thin; scrollbar-color: var(--line) transparent;
    /* 넘치는 쪽만 흐려진다 — 실제 스크롤 위치는 JS 가 fade-l/fade-r 로 알려준다 */
    --fade-l: 0px; --fade-r: 0px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l),
        #000 calc(100% - var(--fade-r)), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l),
        #000 calc(100% - var(--fade-r)), transparent 100%);
}
.music__rail.fade-l { --fade-l: 36px; }
.music__rail.fade-r { --fade-r: 36px; }
.music__rail::-webkit-scrollbar { height: 6px; }
.music__rail::-webkit-scrollbar-track { background: transparent; }
.music__rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.music__rail::-webkit-scrollbar-thumb:hover { background: #3a4150; }

.music__tile { flex-shrink: 0; width: 68px; padding: 0; border: 0; background: none;
    cursor: pointer; font-family: inherit; scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: center; gap: 7px; }
.music__tile-art { position: relative; display: block; width: 68px; height: 68px;
    border-radius: 10px; overflow: hidden; background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line);
    transition: box-shadow .18s ease, transform .18s ease; }
.music__tile-art img { width: 100%; height: 100%; object-fit: cover; display: block;
    /* 안 고른 것은 살짝 물러나 있는다. 다섯 장이 전부 소리치면 고를 수가 없다 */
    opacity: .55; filter: saturate(.6); transition: opacity .18s ease, filter .18s ease; }
.music__tile-fallback { position: absolute; inset: 0; display: grid; place-items: center;
    color: var(--muted); font-size: 18px; }
/*
 * 이름은 두 줄까지. 한 줄로 자르면 'Explosive Strength' 와 'Explosive Power' 가
 * 둘 다 'Explosive ...' 로 보여서 고를 수가 없다. 높이는 두 줄로 고정해
 * 이름 길이와 상관없이 타일 아랫단이 맞는다.
 */
.music__tile-name { width: 100%; height: 2.7em; font-size: 11px; line-height: 1.35;
    text-align: center; color: var(--muted); overflow: hidden;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    word-break: keep-all; transition: color .18s ease; }

.music__tile:hover .music__tile-art,
.music__tile:focus-visible .music__tile-art { transform: translateY(-2px); }
.music__tile:hover .music__tile-art img { opacity: 1; filter: none; }
.music__tile:hover .music__tile-name { color: var(--text); }
.music__tile:focus-visible { outline: none; }
.music__tile:focus-visible .music__tile-art { box-shadow: 0 0 0 2px var(--accent); }

/* 고른 것 — 초록 링에 옅은 번짐. 2px 실선만 두면 잘라 붙인 것처럼 보인다 */
.music__tile.on .music__tile-art { box-shadow: 0 0 0 2px var(--accent),
    0 4px 12px rgba(34,197,94,.22); }
.music__tile.on .music__tile-art img { opacity: 1; filter: none; }
.music__tile.on .music__tile-name { color: var(--text); font-weight: 600; }

/*
 * 랜덤이 이번에 집은 앨범. 고른 것과 같은 표시를 쓰면 "내가 고른 건가?" 가
 * 되므로 링을 반쯤 죽여 구분한다.
 */
.music__tile.is-auto .music__tile-art { box-shadow: inset 0 0 0 1px rgba(34,197,94,.55); }
.music__tile.is-auto .music__tile-art img { opacity: .85; filter: none; }
.music__tile.is-auto .music__tile-name { color: var(--text); }

/* 랜덤 타일 — 자켓 자리에 아이콘을 넣어 다른 타일과 크기를 맞춘다 */
.music__tile--shuffle .music__tile-art { display: grid; place-items: center;
    background: linear-gradient(150deg, #232833, #171b23);
    color: var(--muted); transition: color .18s ease, box-shadow .18s ease, transform .18s ease; }
.music__tile--shuffle:hover .music__tile-art { color: var(--text); }
.music__tile--shuffle.on .music__tile-art { color: var(--accent);
    background: linear-gradient(150deg, rgba(34,197,94,.16), rgba(34,197,94,.04)); }
.music__shuffle { width: 26px; height: 26px; }

/* 자켓 위에 겹치는 재생 표시 — 평소엔 숨고, 올리거나 재생 중일 때만 뜬다 */
.music__tile-play { position: absolute; inset: 0; display: grid; place-items: center;
    background: rgba(8,10,14,.5); opacity: 0; transition: opacity .18s ease; font-style: normal; }
.music__tile-play::before { content: '▶'; font-size: 13px; color: #fff; }
.music__tile:hover .music__tile-play { opacity: 1; }
.music__tile.playing .music__tile-play { opacity: 1; background: rgba(8,10,14,.6); }
.music__tile.playing .music__tile-play::before { content: '❚❚'; font-size: 10px; letter-spacing: 1px; }

.music__hint { color: var(--muted); font-size: 11px; margin: 2px 0 0; }

@media (max-width: 520px) {
    .music__art { width: 60px; height: 60px; }
    .music__title { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .music__tile-art, .music__tile-art img, .music__tile-name, .music__tile-play {
        transition: none;
    }
    .music__tile:hover .music__tile-art,
    .music__tile:focus-visible .music__tile-art { transform: none; }
}

/* 진단용 수치 — 관리자에게만 렌더링된다. 눈에 띄지 않게 흘려 둔다. */
.hero__admin { color: #64748b; font-size: 12px; }

.slot { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.slot__no { width: 26px; color: var(--muted); font-size: 13px; text-align: right; }
.slot__name { flex: 1; font-weight: 500; }
.slot__meta { color: var(--muted); font-size: 12px; }
.slot__bar { width: 60px; height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.slot__bar i { display: block; height: 100%; background: var(--accent); }

/* ── 체력측정 ── */
.test-card { max-width: 560px; margin: 0 auto; background: var(--surface);
    border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.test-step { color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: .04em; }
.test-title { font-size: 22px; font-weight: 700; margin: 6px 0 16px; }
.test-desc { background: var(--surface-2); border-radius: var(--radius); padding: 14px;
    font-size: 13px; color: var(--muted); white-space: pre-line; line-height: 1.7; margin-bottom: 20px; }
.timer { font-size: 46px; font-weight: 700; text-align: center; margin: 18px 0; font-variant-numeric: tabular-nums; }
.progress-dots { display: flex; gap: 6px; margin-bottom: 20px; }
.progress-dots i { flex: 1; height: 3px; border-radius: 2px; background: var(--surface-2); }
.progress-dots i.on { background: var(--accent); }

/* ── 레이더 / 레벨 ── */
.level-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.level-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.level-item .name { font-size: 13px; color: var(--muted); }
.level-item .lv { font-size: 24px; font-weight: 700; margin: 4px 0 8px; }
.level-item .track { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.level-item .track i { display: block; height: 100%; background: var(--accent); }
.level-item.weak .lv { color: #fbbf24; }
.level-item.weak .track i { background: #fbbf24; }

/* ── 운동 카드 ── */
.ex-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ex-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; position: relative; }
.ex-card__thumb { aspect-ratio: 16/10; background: var(--surface-2); display: grid; place-items: center;
    color: var(--muted); font-size: 11px; }
.ex-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.ex-card__body { padding: 10px 12px 12px; }
.ex-card__name { font-size: 13px; font-weight: 600; margin-bottom: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-card__meta { font-size: 11px; color: var(--muted); }
.ex-card.locked { opacity: .42; }
.ex-card.locked .ex-card__thumb { filter: grayscale(1); }
.lock-badge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.7);
    border-radius: 6px; padding: 3px 7px; font-size: 11px; }
.dots { letter-spacing: 1px; }

/* ── 미리보기 오버레이 ── */
/*
 * 미리보기는 **작은 인셋 창**이다.
 * 전체 화면에 반투명으로 겹치면 현재 영상과 이중노출이 되어
 * 무엇을 보라는 건지 알 수 없다. 지금 동작을 가리지 않으면서
 * 다음 동작을 미리 보여주는 게 목적이다.
 */
/* .stage video 보다 특이도가 높아야 한다 — 아니면 width:100% 에 먹힌다 */
.stage video.preview-video {
    position: absolute; right: 3%; bottom: 9%;
    width: 26%; aspect-ratio: 16/10;
    object-fit: cover; opacity: 0; pointer-events: none;
    filter: grayscale(1) contrast(1.08);
    border: 2px solid rgba(255,255,255,.35); border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,.55);
    transform: translateY(12px) scale(.96);
    transition: opacity .35s ease, transform .35s ease;
    z-index: 5;
}
.stage video.preview-video.on { opacity: 1; transform: translateY(0) scale(1); }
.preview-label {
    position: absolute; right: 3%; bottom: 5.5%;
    background: rgba(0,0,0,.78); padding: 6px 14px; border-radius: 999px;
    font-size: 12px; letter-spacing: .02em; opacity: 0;
    transition: opacity .35s ease; z-index: 6; pointer-events: none;
    max-width: 26%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview-label.on { opacity: 1; }
.vjs-control-bar { display: none !important; }

/* 오버레이는 미리보기 위에 */
.overlay { z-index: 4; }
.overlay__top, .overlay__desc { transition: opacity .4s ease; }

/* 동작 게이지 — 세로, 오른쪽 */
.gauge-v {
    position: absolute; right: 18px; top: 22%; width: 5px; height: 56%;
    background: rgba(255,255,255,.18); border-radius: 3px; overflow: hidden;
}
.gauge-v > i {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 0;
    background: var(--accent); transition: height .25s linear;
}

/* ── 체력측정 레이더 ── */
.radar-wrap {
    display: flex; gap: 32px; align-items: center; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 14px; padding: 24px 28px;
}
.radar { width: 320px; height: 320px; flex: 0 0 auto; overflow: visible; }
.radar__grid { fill: none; stroke: var(--line); stroke-width: 1; }
.radar__axis { stroke: var(--line); stroke-width: 1; }
.radar__area {
    fill: rgba(34,197,94,.22); stroke: var(--accent); stroke-width: 2;
    stroke-linejoin: round;
}
.radar__dot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.radar__dot.is-weak { fill: #fbbf24; }
.radar__label { fill: var(--text); font-size: 12px; font-weight: 600; }
.radar__label.is-weak { fill: #fbbf24; }
.radar__lv { fill: var(--muted); font-size: 11px; }
.radar__lv.is-weak { fill: #fbbf24; }
.radar__est { fill: var(--muted); font-size: 9px; }

.radar-legend { flex: 1; min-width: 300px; display: flex; flex-direction: column; gap: 10px; }
.radar-legend__row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.radar-legend__name { width: 64px; color: var(--muted); flex: 0 0 auto; }
.radar-legend__bar {
    flex: 1; height: 6px; background: var(--surface-2);
    border-radius: 3px; overflow: hidden; min-width: 60px;
}
.radar-legend__bar > i { display: block; height: 100%; background: var(--accent); }
.radar-legend__lv { width: 42px; font-weight: 700; flex: 0 0 auto; }
.radar-legend__item { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.radar-legend__row.is-weak .radar-legend__lv,
.radar-legend__row.is-weak .radar-legend__name { color: #fbbf24; }
.radar-legend__row.is-weak .radar-legend__bar > i { background: #fbbf24; }

@media (max-width: 720px) {
    .radar-wrap { flex-direction: column; gap: 20px; padding: 20px 16px; }
    .radar { width: 280px; height: 280px; }
    .radar-legend__item { display: none; }
}

/* ── 진행바 탐색 ── */
.gauge { cursor: pointer; height: 6px; transition: height .15s ease; }
.gauge:hover { height: 10px; }
.player-bar .time {
    color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums;
    margin-left: 4px;
}

/* ── 이전/다음 ── */
.neighbors {
    max-width: 1280px; margin: 0 auto; padding: 12px 20px 0;
    display: flex; gap: 12px;
}
.neighbor {
    flex: 1; display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); cursor: pointer; font-size: 14px;
}
.neighbor:hover { border-color: #3a4150; }
.neighbor.off { opacity: .35; pointer-events: none; }
.neighbor__k {
    font-size: 11px; color: var(--muted); background: var(--surface-2);
    padding: 3px 9px; border-radius: 999px; flex: 0 0 auto;
}
#nb-next { justify-content: flex-end; text-align: right; }

/* 전체화면일 때 하단 바가 화면 안에 들어오도록 */
.player-page:fullscreen { display: flex; flex-direction: column; background: #000; }
.player-page:fullscreen .stage { flex: 1; display: grid; place-items: center; }
.player-page:fullscreen .stage video#player { max-height: 100vh; width: auto; }
.player-page:fullscreen .neighbors,
.player-page:fullscreen .tracklist,
.player-page:fullscreen .topbar { display: none; }

/* .overlay 가 pointer-events:none 이라 안쪽 진행바가 클릭을 못 받는다.
   탐색이 필요한 요소만 다시 켠다. */
#seekbar { pointer-events: auto; }

/* ── 관리자 디버그 패널 (DAW 스타일) ── */
.dbg {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60;
    background: rgba(12,14,18,.96); border: 1px solid #2f3846; border-radius: 12px;
    padding: 12px 14px; font-size: 12px; color: #cbd5e1;
    font-family: "Cascadia Mono", Consolas, monospace;
    box-shadow: 0 12px 40px rgba(0,0,0,.6); backdrop-filter: blur(8px);
    max-height: 46vh; overflow: auto;
}
.dbg[hidden] { display: none !important; }
.dbg__bar { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.dbg__bar strong { color: #22c55e; letter-spacing: .04em; }
.dbg__k { color: #94a3b8; }
.dbg__k b { color: #e2e8f0; }
.dbg__sp { flex: 1; }
.dbg__x {
    background: none; border: 1px solid #2f3846; color: #94a3b8;
    border-radius: 6px; width: 24px; height: 24px; cursor: pointer; line-height: 1;
}

.dbg__tl { position: relative; margin-bottom: 10px; }
.dbg__row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dbg__lb { width: 62px; color: #64748b; flex: 0 0 auto; font-size: 11px; text-align: right; }
.dbg__track {
    flex: 1; height: 16px; background: #171c24; border-radius: 4px;
    position: relative; overflow: hidden;
}
.dbg__seg {
    position: absolute; top: 0; height: 100%;
    border-right: 1px solid rgba(0,0,0,.55); box-sizing: border-box;
    font-size: 9px; line-height: 16px; text-align: center; color: rgba(255,255,255,.55);
    overflow: hidden; white-space: nowrap;
}
.dbg__seg--video   { background: #1e3a5f; }
.dbg__seg--video.on{ background: #2563eb; color: #fff; }
.dbg__seg--tail    { background: rgba(251,191,36,.35); }
.dbg__seg--prev    { background: rgba(148,163,184,.4); }
/* 도입곡(01) · 중간곡 · 엔딩곡(07) 을 색으로 구분한다 — 자리가 정해진 곡들이다 */
.dbg__seg--first   { background: #155e75; }
.dbg__seg--first.on{ background: #0891b2; color: #fff; }
.dbg__seg--music   { background: #14532d; }
.dbg__seg--music.on{ background: #16a34a; color: #fff; }
.dbg__seg--last    { background: #7c2d12; }
.dbg__seg--last.on { background: #ea580c; color: #fff; }
.dbg__beat { position: absolute; top: 3px; width: 2px; height: 10px; background: #f472b6; }

.dbg__play {
    position: absolute; top: 0; bottom: 0; width: 2px; background: #ef4444;
    left: 70px; pointer-events: none;
}
.dbg__play::before {
    content: ''; position: absolute; top: -3px; left: -3px;
    border: 4px solid transparent; border-top-color: #ef4444;
}

.dbg__tbl { width: 100%; font-size: 11px; border-collapse: collapse; }
.dbg__tbl td { padding: 2px 8px 2px 0; border: 0; color: #cbd5e1; }
.dbg__tbl td:first-child { color: #64748b; width: 62px; text-align: right; }
.dbg__tbl tr:hover td { background: transparent; }
.dbg__note { margin-top: 8px; color: #fbbf24; font-size: 11px; min-height: 14px; }

.dbg-hint {
    position: fixed; right: 14px; bottom: 14px; z-index: 55;
    background: rgba(12,14,18,.9); border: 1px solid #2f3846; color: #64748b;
    padding: 6px 12px; border-radius: 999px; font-size: 11px;
}

/* ── 프로필 통계 ── */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0 8px; }
.stat {
    flex: 1; min-width: 120px; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px; text-align: center;
}
.stat__v { display: block; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat__v small { font-size: 15px; color: var(--muted); font-weight: 400; }
.stat__k { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ── 동작 편집 ── */
.ex-edit { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.ex-edit__side { flex: 0 0 380px; }
.ex-edit__form { flex: 1; min-width: 420px; }
.ex-edit__vid {
    width: 100%; border-radius: var(--radius); background: #000;
    border: 1px solid var(--line); display: block; margin-bottom: 14px;
}
.ex-edit__meta { font-size: 13px; }
.ex-edit__meta td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.ex-edit__meta td:first-child { color: var(--muted); width: 88px; }
.mono { font-family: Consolas, monospace; font-size: 12px; }

.tag-src {
    font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
    vertical-align: middle; margin-left: 6px;
}
.tag-src--own { background: rgba(34,197,94,.15); border-color: rgba(34,197,94,.35); color: #86efac; }

.beat-grid { display: flex; gap: 2px; flex-wrap: wrap; }
.beat-cell {
    width: 26px; height: 26px; display: grid; place-items: center;
    background: var(--surface-2); border-radius: 4px; font-size: 11px;
    color: var(--muted); font-family: Consolas, monospace;
}
.beat-cell.on { background: rgba(244,114,182,.25); color: #f9a8d4; font-weight: 700; }
.beat-cell.bar { box-shadow: inset 2px 0 0 var(--accent); }

@media (max-width: 900px) {
    .ex-edit__side, .ex-edit__form { flex: 1 1 100%; min-width: 0; }
}

/* ── 잠긴 카드 — 자리는 남기되 내용은 가린다 ── */
.ex-card--locked { opacity: .6; }
.ex-card__thumb--q {
    display: grid; place-items: center;
    font-size: 34px; font-weight: 700; color: #3a4150;
    background: repeating-linear-gradient(45deg,
        #171a21, #171a21 8px, #1b1f27 8px, #1b1f27 16px);
}
.ex-card--locked .ex-card__name { color: #4b5563; letter-spacing: .1em; }
.ex-card--locked .ex-card__meta { color: #fbbf24; }

/* 필터가 많아져 두 줄로 흐른다 */
.filters--wide { gap: 10px 12px; }
.filters--wide > div { min-width: 118px; }
.filters--wide label { white-space: nowrap; }

/* ── 사용 근육 ── */
.muscle {
    position: absolute; left: 24px; top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,.62); border-radius: 10px; padding: 10px 14px;
    backdrop-filter: blur(4px); min-width: 88px;
}
.muscle__k { font-size: 10px; color: var(--muted); letter-spacing: .06em; margin-bottom: 4px; }
.muscle__p { font-size: 17px; font-weight: 700; color: var(--accent); }
.muscle__s { font-size: 12px; color: rgba(255,255,255,.45); margin-top: 2px; }

/* 자막은 문장 단위로 흐른다 */
.overlay__desc { transition: opacity .35s ease; min-height: 1.6em; }

/* ── 페이지네이션 ── */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager__btn {
    min-width: 34px; height: 34px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--text); font-size: 13px;
    text-decoration: none;
}
.pager__btn:hover { border-color: #3a4150; }
.pager__btn.is-on { background: var(--accent); border-color: var(--accent); color: #06240f; font-weight: 700; }
.pager__btn.is-off { opacity: .3; pointer-events: none; }
.pager__gap { color: var(--muted); padding: 0 4px; }
.pager__info { color: var(--muted); font-size: 12px; margin-left: 8px; }

/* ── 설정 연결 테스트 ── */
.test-result { font-size: 13px; margin-left: 10px; color: var(--muted); }
.test-result.is-ok { color: #86efac; }
.test-result.is-ng { color: #fca5a5; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ── 반응형 레이아웃 ── */
@media (max-width: 900px) {
    .topbar {
        min-height: 58px; padding: 10px 16px; gap: 12px;
        justify-content: space-between;
    }
    .topbar .brand { font-size: 18px; }
    .nav-toggle {
        width: 42px; height: 38px; padding: 9px; margin-left: auto;
        display: flex; flex-direction: column; justify-content: space-between;
        border: 1px solid var(--line); border-radius: 9px;
        background: var(--surface-2); color: var(--text); cursor: pointer;
    }
    .nav-toggle span { display: block; width: 100%; height: 2px; border-radius: 2px; background: currentColor; }
    .topbar nav {
        display: none; position: absolute; top: calc(100% + 1px); left: 10px; right: 10px;
        margin: 0; padding: 10px; gap: 4px; align-items: stretch;
        background: rgba(23,26,33,.98); border: 1px solid var(--line); border-radius: 12px;
        box-shadow: 0 16px 40px rgba(0,0,0,.45); backdrop-filter: blur(12px);
        max-height: calc(100vh - 76px); overflow-y: auto;
    }
    .topbar.nav-open nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar nav a {
        display: flex; align-items: center; min-height: 44px; padding: 9px 12px;
        border-radius: 8px; font-size: 14px;
    }
    .topbar nav a.on { background: var(--surface-2); color: var(--accent); }
    .nav-user { padding: 9px 12px; align-self: center; overflow: hidden; text-overflow: ellipsis; }
    .nav-logout .btn { width: 100%; min-height: 42px; justify-content: center; }

    .wrap, .wrap--wide { width: 100%; padding: 22px 16px 48px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
    .filters > div, .filters--wide > div { flex: 1 1 150px; min-width: 0; }
    .hero { padding: 18px; }

    table { min-width: 620px; }
    .table-wrap, .overflow-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* 재생 중에는 사이트 메뉴보다 영상과 종료 버튼을 우선한다. */
    .player-page .topbar { display: none; }
    .player-page { min-height: 100dvh; }
    .stage { width: 100%; }
    .overlay { padding: 14px 16px; }
    .overlay__top { gap: 10px; }
    .chip { max-width: 52%; padding: 7px 10px; font-size: 13px; }
    .chip--song { max-width: 48%; }
    .chip__cover { width: 30px; height: 30px; }
    .muscle { left: 16px; padding: 8px 10px; min-width: 74px; }
    .muscle__p { font-size: 15px; }
    .gauge-v { right: 10px; width: 4px; }
    .overlay__desc { max-width: calc(100% - 18px); font-size: 13px; padding: 9px 12px; }

    .player-bar {
        display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 10px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    }
    .player-bar .btn { min-height: 44px; padding: 9px 10px; justify-content: center; white-space: nowrap; }
    #btn-prev, #btn-play, #btn-next { grid-column: span 2; }
    .player-bar .time { grid-column: span 3; margin: 0; }
    .player-bar .spacer { display: none; }
    #btn-full { grid-column: span 1; }
    .player-bar label[for="vol-music"] { grid-column: span 1; }
    #vol-music { grid-column: span 2; width: 100% !important; min-width: 0; }
    .player-bar > label:has(#tg-sub) { grid-column: span 2; white-space: nowrap; }
    .player-bar > a.btn { grid-column: span 2; }
    .neighbors { padding: 10px 16px 0; }
    .tracklist { padding: 0 16px 32px; }
}

@media (max-width: 560px) {
    body { font-size: 14px; }
    .wrap, .wrap--wide { padding: 18px 12px 40px; }
    .topbar.nav-open nav { grid-template-columns: 1fr; }
    .login-wrap { padding: 16px; }
    .login-card { padding: 24px 18px; }
    .hero__title { font-size: 22px; }
    .row { gap: 10px; }
    .row > * { min-width: 100%; }
    .btn { min-height: 42px; }

    .stage video#player { min-height: 240px; object-fit: contain; }
    .overlay { padding: 10px 12px; }
    .chip { padding: 6px 8px; font-size: 12px; border-radius: 7px; }
    .chip small { font-size: 10px; }
    .chip--song { gap: 6px; }
    .chip__cover { width: 26px; height: 26px; }
    .muscle { left: 12px; top: 49%; padding: 6px 8px; }
    .muscle__k { margin: 0; font-size: 9px; }
    .muscle__p { font-size: 13px; }
    .muscle__s { display: none; }
    .overlay__desc {
        max-width: calc(100% - 12px); padding: 7px 9px; font-size: 12px;
        line-height: 1.45; min-height: 0;
    }
    .gauge { margin-top: 7px; }
    .gauge-v { top: 26%; height: 46%; }
    .stage video.preview-video { right: 3%; bottom: 13%; width: 32%; border-radius: 7px; }
    .preview-label { right: 3%; bottom: 7%; max-width: 32%; padding: 4px 8px; font-size: 10px; }

    .player-bar { grid-template-columns: repeat(6, minmax(0, 1fr)); padding-inline: 12px; gap: 8px; }
    .player-bar .btn { font-size: 13px; padding-inline: 6px; }
    .player-bar .time { grid-column: span 4; font-size: 12px; }
    #btn-full { grid-column: span 2; }
    .player-bar > label:has(#tg-sub) { grid-column: span 2; }
    .player-bar label[for="vol-music"] { grid-column: span 1; }
    #vol-music { grid-column: span 3; }
    .player-bar > a.btn { grid-column: span 6; }
    .neighbors { gap: 8px; padding-inline: 12px; }
    .neighbor { min-width: 0; padding: 9px 10px; font-size: 12px; }
    .neighbor__k { display: none; }
    .tracklist { padding-inline: 12px; }
}

/* 잠긴 카드도 이름은 읽히게 — 무엇이 잠겼는지 알아야 목표가 된다 */
.ex-card--locked { opacity: 1; }
.ex-card--locked .ex-card__name { color: var(--muted); letter-spacing: 0; }
.ex-card--locked .ex-card__meta { color: #4b5563; }
.ex-card__lock { font-size: 11px; color: #fbbf24; margin-top: 5px; }

/* ── 설정 — 목록에서 고르기(모델·보이스) ── */
.picker__filter { margin-bottom: 6px; }
.picker__custom { margin-top: 6px; }
.picker__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.picker__note { color: var(--muted); font-size: 12px; }
/* 모델이 300개가 넘는다 — 열었을 때 목록이 화면을 다 덮지 않게 */
.picker__select { max-width: 100%; }
.picker__select optgroup { color: var(--muted); background: var(--surface); }
.picker__select option { color: var(--text); background: var(--surface-2); }
