@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #141414;
    --bg-card: #181818;
    --bg-hover: #252525;
    --text: #e5e5e5;
    --text-dim: #999;
    --text-muted: #666;
    --accent: #e50914;
    --blue: #2196f3;
    --card-w: 228px;
    --card-radius: 4px;
    --nav-h: 68px;
    --fast: 150ms ease;
    --smooth: 300ms cubic-bezier(.4,0,.2,1);
}

html, body {
    width: 100%; height: 100%;
    background: var(--bg); color: var(--text);
    font-family: 'Noto Sans KR', -apple-system, sans-serif;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}
::-webkit-scrollbar { width: 0; height: 0; }
* { scrollbar-width: none; }

/* === Loading === */
#loading {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 28px;
    transition: opacity .4s;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
    width: 36px; height: 36px;
    border: 3px solid #333; border-top-color: var(--accent);
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Screens === */
.screen { display: none; position: absolute; inset: 0; }
.screen.active { display: flex; }

/* === Top Nav === */
.top-nav {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: rgba(20,20,20,.98);
    display: flex; align-items: center;
    padding: 0 48px; z-index: 100;
}
.nav-logo-img {
    height: 28px; margin-right: 8px; flex-shrink: 0;
    cursor: pointer;
}
.nav-logo-text {
    height: 18px; margin-right: 36px; flex-shrink: 0;
    cursor: pointer;
}
.nav-items { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav-item {
    padding: 8px 16px; border-radius: 4px;
    font-size: 14px; font-weight: 500; color: #b3b3b3;
    cursor: pointer; transition: var(--fast);
    white-space: nowrap; outline: none;
    border: 2px solid transparent;
}
.nav-item:hover, .nav-item.focused { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; font-weight: 700; background: rgba(255,255,255,.12); }
.nav-item.focused { border-color: #fff; }
.nav-search {
    margin-left: auto; display: flex; align-items: center;
    gap: 6px; color: #b3b3b3; font-size: 14px;
    padding: 8px 14px; border-radius: 4px;
    cursor: pointer; transition: var(--fast);
    outline: none; border: 2px solid transparent; flex-shrink: 0;
}
.nav-search:hover, .nav-search.focused { color: #fff; background: rgba(255,255,255,.08); }
.nav-search.focused { border-color: #fff; }
.nav-search svg { width: 20px; height: 20px; }

/* === Home === */
#home-screen { flex-direction: column; }
.home-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }

/* Hero */
.hero {
    position: relative; width: 100%; padding: 90px 48px 40px;
    display: flex; align-items: center; gap: 36px;
    overflow: hidden;
}
.hero-bg {
    position: absolute; inset: -40px;
    background-size: cover; background-position: center;
    filter: blur(40px) brightness(.3) saturate(1.2);
}
.hero-ov {
    position: absolute; inset: 0;
    background: linear-gradient(0deg, var(--bg) 0%, transparent 60%);
}
.hero-thumb {
    position: relative; z-index: 1;
    width: 200px; height: 200px; border-radius: 14px;
    object-fit: cover; flex-shrink: 0;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.hero-body { position: relative; z-index: 1; flex: 1; min-width: 0; }
.hero-tag {
    display: inline-block; padding: 3px 8px;
    background: var(--accent); color: #fff;
    font-size: 11px; font-weight: 700; border-radius: 3px;
    margin-bottom: 10px;
}
.hero-title {
    font-size: 36px; font-weight: 800; line-height: 1.15;
    margin-bottom: 10px;
}
.hero-info {
    font-size: 13px; color: rgba(255,255,255,.6);
    display: flex; gap: 14px; flex-wrap: wrap;
}
.hero-btns { display: flex; gap: 10px; margin-top: 18px; }
.h-btn {
    padding: 10px 24px; border-radius: 4px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: var(--fast); outline: none; border: 2px solid transparent;
}
.h-btn.white { background: #fff; color: #141414; }
.h-btn.white:hover, .h-btn.white.focused { background: #ddd; }
.h-btn.gray { background: rgba(255,255,255,.15); color: #fff; }
.h-btn.gray:hover, .h-btn.gray.focused { background: rgba(255,255,255,.25); }
.h-btn.focused { border-color: #fff; box-shadow: 0 0 0 1px #fff; }

/* Rows */
.rows { position: relative; padding-top: 20px; padding-bottom: 60px; }
.row { margin-bottom: 24px; }
.row-head { padding: 0 48px 8px; }
.row-title {
    font-size: 17px; font-weight: 700; color: #e5e5e5;
    display: inline;
}
.row-cards {
    display: flex; gap: 6px;
    overflow-x: auto; padding: 6px 48px 6px;
    scroll-behavior: smooth;
}
.row-cards::after { content: ''; flex: 0 0 42px; }

/* Card */
.card {
    flex: 0 0 var(--card-w); width: var(--card-w);
    border-radius: var(--card-radius); overflow: hidden;
    cursor: pointer; transition: transform var(--smooth), box-shadow var(--smooth), border-color var(--smooth);
    outline: none; position: relative;
    border: 2px solid transparent; background: var(--bg-card);
}
.card:hover, .card.focused {
    transform: scale(1.08); z-index: 10;
    box-shadow: 0 8px 28px rgba(0,0,0,.7);
}
.card-poster {
    position: relative; width: 100%; padding-top: 100%;
    background: #222; overflow: hidden;
}
.card-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; transition: transform .4s;
}
.no-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #1a1a2e; gap: 8px;
}
.no-img img { width: 36px; height: 36px; opacity: .4; }
.no-img span { font-size: 11px; color: #555; }
.card:hover .card-img, .card.focused .card-img { transform: scale(1.06); }
.card-body { padding: 8px 10px 10px; }
.card-title {
    font-size: 13px; font-weight: 600; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub {
    font-size: 11px; color: var(--text-muted); margin-top: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 6px;
}
.card-meta-item {
    display: inline-flex; align-items: center; gap: 2px;
}
.card-meta-item svg { vertical-align: middle; opacity: .7; }
.card-meta-sep { color: #444; font-size: 10px; }

/* === Detail === */
#detail-screen { flex-direction: column; background: var(--bg); overflow-y: auto; }
.det-hero { position: relative; width: 100%; min-height: 320px; overflow: hidden; flex-shrink: 0; }
.det-hero-bg {
    position: absolute; inset: -40px;
    background-size: cover; background-position: center;
    filter: blur(40px) brightness(.3) saturate(1.2);
}
.det-hero-ov {
    position: absolute; inset: 0;
    background: linear-gradient(0deg, var(--bg) 0%, transparent 100%);
}
.det-body {
    position: relative; z-index: 1;
    display: flex; gap: 28px; padding: 90px 48px 32px; align-items: flex-end;
}
.det-thumb {
    width: 180px; height: 180px; border-radius: 10px;
    object-fit: cover; flex-shrink: 0;
    box-shadow: 0 8px 28px rgba(0,0,0,.5);
}
.det-meta { flex: 1; min-width: 0; }
.det-title { font-size: 34px; font-weight: 800; line-height: 1.15; margin-bottom: 8px; }
.det-author { font-size: 15px; color: var(--text-dim); margin-bottom: 12px; }
.det-stats {
    display: flex; gap: 18px; font-size: 13px; color: var(--text-dim);
    flex-wrap: wrap; margin-bottom: 8px;
}
.det-desc {
    font-size: 13px; color: #aaa; line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    margin-bottom: 14px; max-width: 600px;
}
.det-actions { display: flex; gap: 8px; }
.d-btn {
    padding: 9px 18px; border-radius: 4px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: var(--fast); outline: none;
    border: 2px solid transparent;
    display: flex; align-items: center; gap: 6px;
}
.d-btn.fav { background: rgba(255,255,255,.15); color: #fff; }
.d-btn.fav.on { background: var(--accent); }
.d-btn.focused { border-color: #fff; box-shadow: 0 0 0 1px #fff; }

.ep-list { padding: 0 48px 40px; }
.ep-list-head { font-size: 17px; font-weight: 700; margin-bottom: 14px; padding-top: 8px; }
.ep {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 14px; border-radius: 4px;
    cursor: pointer; transition: background var(--fast);
    outline: none; border: 2px solid transparent;
}
.ep:hover, .ep.focused { background: var(--bg-hover); }
.ep.focused { border-color: rgba(255,255,255,.5); }
.ep-n { font-size: 16px; font-weight: 600; color: var(--text-muted); width: 28px; text-align: center; flex-shrink: 0; }
.ep-img { width: 112px; height: 63px; border-radius: 3px; object-fit: cover; flex-shrink: 0; background: #222; }
.ep-no-img { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: #1a1a2e; }
.ep-info { flex: 1; min-width: 0; }
.ep-t { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.ep-m { font-size: 12px; color: var(--text-muted); display: flex; gap: 10px; }
.ep-dur { font-size: 12px; color: var(--text-dim); flex-shrink: 0; }
.ep-play {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,.1); display: flex;
    align-items: center; justify-content: center;
    flex-shrink: 0; opacity: 0; transition: opacity var(--fast); font-size: 12px;
}
.ep:hover .ep-play, .ep.focused .ep-play { opacity: 1; }
.load-more {
    text-align: center; padding: 14px; color: var(--blue);
    font-size: 14px; font-weight: 600; cursor: pointer;
    border-radius: 4px; transition: background var(--fast);
    outline: none; border: 2px solid transparent;
}
.load-more:hover, .load-more.focused { background: var(--bg-hover); }
.load-more.focused { border-color: rgba(255,255,255,.5); }

/* === Player === */
#player-screen { flex-direction: column; align-items: center; justify-content: center; background: var(--bg); }
.pl-bg {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    filter: blur(60px) brightness(.2) saturate(1.4); transform: scale(1.3);
}
.pl-wrap {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center;
    width: 100%; max-width: 600px; padding: 20px 40px;
}
.pl-art {
    width: 360px; height: 270px; border-radius: 10px;
    object-fit: cover; box-shadow: 0 16px 48px rgba(0,0,0,.6);
    margin-bottom: 32px;
}
.pl-art-none {
    display: flex; align-items: center; justify-content: center;
    background: #1a1a2e; object-fit: unset;
}
.pl-title {
    font-size: 20px; font-weight: 700; text-align: center;
    margin-bottom: 6px; max-width: 100%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pl-ch-row {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 28px; justify-content: center;
}
.pl-ch-thumb {
    width: 28px; height: 28px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
}
.pl-ch-name { font-size: 14px; color: var(--text-dim); }
.pl-prog { width: 100%; margin-bottom: 4px; }
.pl-bar {
    width: 100%; height: 4px; background: rgba(255,255,255,.15);
    border-radius: 2px; cursor: pointer; position: relative;
}
.pl-bar:hover { height: 6px; }
.pl-fill {
    height: 100%; background: var(--accent); border-radius: 2px;
    width: 0%; transition: width .2s linear;
}
.pl-times {
    display: flex; justify-content: space-between;
    width: 100%; font-size: 11px; color: var(--text-muted); margin-bottom: 20px;
}
.pl-ctrls { display: flex; align-items: center; gap: 20px; }
.pl-btn {
    background: none; border: none; color: #ddd;
    cursor: pointer; width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: var(--fast); outline: none; border: 2px solid transparent;
    padding: 0;
}
.pl-btn svg { pointer-events: none; }
.pl-btn:hover, .pl-btn.focused { color: #fff; background: rgba(255,255,255,.1); }
.pl-btn.focused { border-color: #fff; }
.pl-btn.pp {
    width: 64px; height: 64px;
    background: #fff; color: #141414;
}
.pl-btn.pp:hover, .pl-btn.pp.focused { background: #ddd; transform: scale(1.06); }

/* === Search === */
#search-screen { flex-direction: column; background: var(--bg); }
.src-head { padding: 80px 48px 16px; display: flex; align-items: center; gap: 12px; }
.src-input {
    flex: 1; background: #333; border: 2px solid #555;
    border-radius: 4px; padding: 12px 18px;
    font-size: 18px; color: #fff; outline: none;
    font-family: inherit; transition: border-color var(--fast);
}
.src-input:focus { border-color: #fff; }
.src-input::placeholder { color: #666; }
.src-body { flex: 1; overflow-y: auto; padding: 0 48px 40px; }
.src-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
    gap: 10px;
}

/* === Ranking === */
#ranking-screen { flex-direction: column; background: var(--bg); }
.rk-head { padding: 80px 48px 14px; display: flex; align-items: center; justify-content: space-between; }
.rk-title { font-size: 28px; font-weight: 800; }
.rk-tabs { display: flex; gap: 4px; padding: 0 48px; margin-bottom: 16px; }
.rk-tab {
    padding: 7px 18px; border-radius: 20px;
    font-size: 13px; font-weight: 500; color: #aaa;
    cursor: pointer; transition: var(--fast);
    outline: none; border: 2px solid transparent;
    background: rgba(255,255,255,.07);
}
.rk-tab:hover, .rk-tab.focused { color: #fff; background: rgba(255,255,255,.14); }
.rk-tab.active { background: #fff; color: #141414; font-weight: 700; }
.rk-tab.focused { border-color: #fff; }
.rk-body { flex: 1; overflow-y: auto; padding: 0 48px 40px; }
.rk-item {
    display: flex; align-items: center; gap: 14px;
    padding: 8px 14px; border-radius: 4px;
    cursor: pointer; transition: background var(--fast);
    outline: none; border: 2px solid transparent;
}
.rk-item:hover, .rk-item.focused { background: var(--bg-hover); }
.rk-item.focused { border-color: rgba(255,255,255,.5); }
.rk-n { font-size: 20px; font-weight: 800; width: 36px; text-align: center; color: var(--text-muted); }
.rk-item:nth-child(1) .rk-n { color: var(--accent); font-size: 24px; }
.rk-item:nth-child(2) .rk-n { color: #e5e5e5; }
.rk-item:nth-child(3) .rk-n { color: #b87333; }
.rk-img { width: 72px; height: 72px; border-radius: 6px; object-fit: cover; background: #222; flex-shrink: 0; }
.rk-info { flex: 1; min-width: 0; }
.rk-name { font-size: 15px; font-weight: 600; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-meta { font-size: 12px; color: var(--text-muted); }
.rk-chg { font-size: 13px; font-weight: 700; width: 56px; text-align: center; flex-shrink: 0; }
.rk-chg.up { color: var(--accent); }
.rk-chg.down { color: var(--blue); }
.rk-chg.same { color: var(--text-muted); }

/* === Favorites === */
#favorites-screen { flex-direction: column; background: var(--bg); }
.fv-head { padding: 80px 48px 16px; }
.fv-title { font-size: 28px; font-weight: 800; }
.fv-body { flex: 1; overflow-y: auto; padding: 0 48px 40px; }
.fv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
    gap: 10px; align-content: start;
}
.empty-msg {
    grid-column: 1 / -1; text-align: center;
    padding: 80px 0; color: var(--text-muted); font-size: 15px;
}
