:root {
    --bg: #050505;
    --panel: #050505;
    --panel-strong: #050505;
    --sidebar-width: 260px;
    --line: rgba(255, 255, 255, 0.08);
    --text: #f5f7fb;
    --muted: #95a0b5;
    --soft: rgba(255, 255, 255, 0.04);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Noto Sans KR', sans-serif;
}

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

img {
    display: block;
    width: 100%;
}

.app-shell {
    position: relative;
    display: block;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    padding: 24px 20px;
    background: var(--bg);
    transform: translateX(0);
    z-index: 20;
    overflow-y: auto;
    overflow-x: hidden;
    border: 0;
    box-shadow: none;
    outline: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.brand {
    display: block;
    margin: 12px 0 30px;
    white-space: nowrap;
    overflow: hidden;
}

.brand strong {
    display: block;
    color: #ffffff;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
}

.brand p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2em;
}

.sidebar-note,
.user-meta p,
.hero-submeta,
.video-card p,
.genre-title-row span,
.section-head span,
table,
.live-card span,
.live-card p {
    color: var(--muted);
}

.sidebar-note {
    font-size: 11px;
    line-height: 1.45;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    display: grid;
    gap: 2px;
}

.sidebar-section {
    margin-top: 22px;
}

.sidebar-profile-slot {
    display: flex;
    justify-content: center;
    margin-top: 14px;
    margin-bottom: 10px;
}

.sidebar-divider {
    height: 1px;
    margin: 8px 4px 14px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
}

.sidebar-profile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 6px 4px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-profile-avatar,
.sidebar-profile-fallback {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    flex: 0 0 38px;
}

.sidebar-profile-avatar {
    object-fit: cover;
    background: var(--soft);
}

.sidebar-profile-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 700;
}

.sidebar-profile-name {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 4px 12px;
    color: var(--text);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-subnav a {
    padding-left: 6px;
    font-size: 14px;
}

.category-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.72);
}

.category-icon svg {
    width: 18px;
    height: 18px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    color: var(--muted);
    transition: color 0.2s ease, opacity 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-footer {
    margin-top: 28px;
}

.text-link,
.primary-button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    cursor: pointer;
    color: var(--text);
    background: transparent;
    font: inherit;
}

.sidebar-nav a.active,
.sidebar-nav a:hover,
.text-link:hover {
    color: var(--text);
}

.nav-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 22px;
    height: 22px;
}

.user-meta {
    margin-bottom: 14px;
    white-space: nowrap;
    overflow: hidden;
}

.main-content {
    padding: 24px 24px 40px;
    max-width: 1600px;
    margin-left: calc(var(--sidebar-width) + 16px);
    margin-right: auto;
}

.site-footer {
    padding: 18px 24px 28px;
    margin-left: calc(var(--sidebar-width) + 16px);
    color: var(--muted);
    font-size: 12px;
}

.footer-counter {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 10px;
    color: var(--text);
    font-size: 12px;
}

.footer-counter span {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-search {
    min-width: 320px;
}

.top-search input {
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--bg);
}

.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;
}

.topbar-title p,
.topbar-user {
    color: var(--muted);
    margin: 4px 0 0;
}

.topbar-user-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.topbar-logout {
    color: var(--muted);
    font-size: 12px;
    line-height: 1;
}

.topbar-logout:hover {
    color: var(--text);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr);
    gap: 24px;
}

.hero-player,
.live-sidebar,
.content-section,
.admin-card {
    background: var(--panel);
    border-top: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.hero-player {
    overflow: hidden;
}

.live-carousel {
    align-items: start;
}

.hero-video {
    aspect-ratio: 16 / 9;
    background: #000;
}

.hero-video iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.hero-meta,
.live-sidebar,
.content-section,
.admin-card,
.empty-state {
    padding: 20px;
}

.hero-badge {
    display: inline-flex;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.hero-meta h1,
.section-head h1,
.section-head h2,
.genre-title-row h3 {
    margin: 12px 0;
}

.hero-submeta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.section-head,
.genre-title-row,
.admin-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.live-list,
.video-grid {
    display: grid;
    gap: 14px;
}

.live-card {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: transparent;
}

.live-card.selected,
.live-card:hover,
.video-card:hover {
    background: transparent;
}

.live-card img,
.video-card img {
    object-fit: cover;
    background: var(--soft);
}

.content-section {
    margin-top: 24px;
}

.video-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-top: 16px;
}

.search-grid {
    margin-top: 20px;
}

.video-card {
    padding: 0 0 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: transparent;
}

.video-card img {
    aspect-ratio: 16 / 9;
    margin-bottom: 10px;
}

.genre-block + .genre-block {
    margin-top: 28px;
}

.empty-state {
    display: grid;
    place-items: start;
    min-height: 360px;
}

.compact-empty {
    min-height: auto;
    padding-top: 18px;
}

.mypage-shell {
    padding-top: 24px;
}

.profile-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 0 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--muted);
}

.subscription-section {
    margin-bottom: 8px;
}

.more-videos-section {
    margin-bottom: 12px;
}

.subscription-browser {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 24px;
    margin-top: 20px;
}

.subscription-list {
    display: grid;
    gap: 10px;
    align-content: start;
}

.subscription-group {
    display: grid;
    gap: 8px;
}

.subscription-group + .subscription-group {
    margin-top: 10px;
}

.subscription-group-title {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.subscription-item {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.subscription-item img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    background: var(--soft);
}

.subscription-item.selected,
.subscription-item:hover {
    border-color: rgba(255, 255, 255, 0.22);
}

.subscription-empty {
    color: var(--muted);
    font-size: 13px;
    padding: 8px 0 12px;
}

.subscription-panel {
    min-width: 0;
}

.subscription-live {
    margin-top: 12px;
    margin-bottom: 22px;
}

.subscription-videos {
    margin-top: 12px;
}

.youtube-thumb-card {
    padding: 0;
    border-bottom: 0;
}

.youtube-thumb-frame {
    position: relative;
    margin-bottom: 10px;
    background: #111;
    overflow: hidden;
}

.thumb-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.thumb-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    background: rgba(18, 21, 28, 0.84);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.thumb-badge.is-live {
    background: rgba(199, 47, 47, 0.92);
}

.youtube-thumb-frame img {
    aspect-ratio: 16 / 9;
    width: 100%;
    margin-bottom: 0;
    object-fit: cover;
}

.youtube-thumb-meta {
    display: grid;
    gap: 4px;
}

.youtube-thumb-meta strong {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    font-size: 14px;
    font-weight: 700;
}

.youtube-thumb-meta p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.channel-latest-card {
    display: grid;
    gap: 10px;
}

.channel-latest-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.channel-latest-avatar,
.channel-latest-avatar img,
.channel-latest-avatar span {
    width: 44px;
    height: 44px;
    border-radius: 999px;
}

.channel-latest-avatar {
    flex: 0 0 44px;
    overflow: hidden;
    background: var(--soft);
}

.channel-latest-avatar img {
    object-fit: cover;
}

.channel-latest-avatar span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    font-weight: 700;
}

.channel-latest-meta {
    min-width: 0;
}

.channel-latest-meta strong {
    display: block;
    margin-bottom: 4px;
}

.channel-latest-meta p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.live-highlight-card .youtube-thumb-meta strong {
    color: #fff;
}

.watch-shell {
    margin-top: 24px;
}

.watch-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr);
    gap: 24px;
}

.watch-sidebar {
    align-self: start;
}

.watch-list {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.watch-list-item {
    display: grid;
    grid-template-columns: 148px 1fr;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.watch-list-thumb {
    position: relative;
    overflow: hidden;
    background: #111;
}

.watch-list-thumb img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.watch-list-meta strong {
    display: block;
    margin-bottom: 6px;
}

.watch-list-meta p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.admin-shell {
    display: grid;
    gap: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.stat-card {
    padding: 18px 16px;
    border-top: 1px solid var(--line);
    background: var(--panel);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.stat-card strong {
    color: #fff;
    font-size: 28px;
    font-weight: 800;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

form {
    display: grid;
    gap: 10px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: #0d1016;
    color: var(--text);
    font: inherit;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.flash-message {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-left: 2px solid rgba(255, 255, 255, 0.25);
}

.youtube-status-card {
    display: grid;
    gap: 16px;
}

.status-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.status-meta-grid strong {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
}

.status-meta-grid p,
.status-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.status-chip.is-warning {
    border-color: rgba(255, 196, 83, 0.45);
    color: #ffd36f;
}

.status-chip.is-ok {
    border-color: rgba(120, 220, 160, 0.35);
    color: #8de0aa;
}

.warning-note {
    color: #ffd36f;
}

.compact-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.primary-button,
button,
.ghost-button {
    padding: 10px 0;
    color: var(--text);
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0;
}

.primary-button:hover,
button:hover,
.ghost-button:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.table-wrap {
    overflow-x: auto;
    margin-top: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

@media (max-width: 1100px) {
    .sidebar {
        position: static;
        width: auto;
        padding: 20px 20px 12px;
    }

    .main-content {
        margin-left: 0;
    }

    .site-footer {
        margin-left: 0;
    }

    .hero-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-search {
        min-width: 100%;
        width: 100%;
    }

    .topbar-right {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .profile-strip {
        flex-direction: column;
        align-items: flex-start;
    }

    .subscription-browser {
        grid-template-columns: 1fr;
    }

    .watch-layout {
        grid-template-columns: 1fr;
    }
}

.inline-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.ghost-button {
    display: inline-flex;
}

.global-flash {
    margin-bottom: 18px;
}
