* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: #0f0f0f;
    color: #f1f1f1;
    font-family: "Roboto", sans-serif;
    animation: page-fade-in 0.22s ease both;
}

@keyframes page-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

body {
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}


img {
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

/* topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 16px;
    background: #0f0f0f;
    border-bottom: 1px solid #1f1f1f;
}

.topbar-left,
.topbar-center,
.topbar-right {
    display: flex;
    align-items: center;
}

.topbar-left {
    min-width: 170px;
}

.topbar-center {
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.topbar-right {
    min-width: 120px;
    justify-content: flex-end;
    gap: 12px;
}

.logo-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.logo-badge {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7 0%, #4f46e5 100%);
    box-shadow: 0 2px 10px rgba(168, 85, 247, 0.45);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-item.is-active {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.logo-badge svg {
    width: 20px;
    height: 20px;
}

.logo-text {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1.5px;
    white-space: nowrap;
    background: linear-gradient(135deg, #c084fc, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-form {
    width: 100%;
    max-width: 640px;
    display: flex;
    align-items: center;
    border: 1px solid #303030;
    border-radius: 999px;
    overflow: hidden;
    background: #121212;
}

.search-form input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 16px;
    border: none;
    outline: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
}

.search-btn {
    width: 64px;
    height: 40px;
    border: none;
    border-left: 1px solid #303030;
    background: #222;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.search-btn:hover {
    background: #2b2b2b;
}

.search-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: transparent;
    transition: background 0.18s ease;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: #222;
}

.icon-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.profile {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff4e45, #ff8a00);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

/* notification bell */
.notif-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.notif-btn {
    position: relative;
    border: none;
    padding: 0;
    cursor: pointer;
    background: transparent;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.18s ease;
}

.notif-btn:hover {
    background: #222;
}

.notif-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.notif-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    background: #1f1f1f;
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 300;
    overflow: hidden;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #2a2a2a;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.notif-read-all {
    background: none;
    border: none;
    color: #a78bfa;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.notif-read-all:hover {
    color: #c4b5fd;
}

.notif-list {
    max-height: 360px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #2a2a2a;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-item.unread {
    background: rgba(168, 85, 247, 0.07);
}

.notif-thumb-wrap {
    position: relative;
    flex-shrink: 0;
}

.notif-thumb {
    width: 60px;
    height: 38px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
    background: #333;
}

.notif-type-icon {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1f1f1f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border: 1px solid #333;
}

.notif-msg {
    flex: 1;
    font-size: 13px;
    color: #d1d5db;
    line-height: 1.4;
}

.notif-time {
    font-size: 11px;
    color: #6b7280;
    margin-top: 3px;
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

/* common main */
.main {
    padding: 24px 24px 36px;
}

/* video grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px 16px;
}

.card {
    min-width: 0;
}

.card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.thumbnail-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    overflow: hidden;
    background: #181818;
}

.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.22s ease;
}

.card:hover .thumbnail-image {
    transform: scale(1.03);
}

.duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    font-weight: 500;
}

.meta {
    display: flex;
    gap: 12px;
    padding-top: 12px;
}

.avatar-image {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #222;
}

.text {
    min-width: 0;
}

.text h3 {
    margin: 0 0 6px;
    font-size: 16px;
    line-height: 1.45;
    color: #f1f1f1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.channel-name,
.video-info {
    margin: 0;
    color: #aaaaaa;
    font-size: 14px;
    line-height: 1.45;
}

/* watch */
.watch-page {
    padding: 24px 24px 40px;
}

.watch-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) 380px;
    gap: 24px;
    align-items: start;
}

.watch-main-column,
.watch-side-column {
    min-width: 0;
}

.player-box {
    width: 100%;
    background: #000;
    border-radius: 18px;
    line-height: 0;
}

.player-box img {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    border-radius: 18px;
    object-fit: cover;
}

.player-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    background: #000;
}

.player-iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    border: none;
    border-radius: 18px;
}

/* Custom Player */
.custom-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    line-height: 0;
}

.custom-player:fullscreen {
    border-radius: 0;
    aspect-ratio: unset;
    height: 100%;
}

.custom-player:fullscreen .player-video {
    height: 100%;
    aspect-ratio: unset;
    object-fit: contain;
}

.cp-thumb-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    pointer-events: none;
}

.cp-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 32px 12px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    border-radius: 0 0 18px 18px;
    opacity: 0;
    transition: opacity 0.2s;
    line-height: normal;
    z-index: 2;
}

.custom-player:hover .cp-controls,
.custom-player.show-controls .cp-controls {
    opacity: 1;
}

.cp-progress-wrap {
    position: relative;
    margin-bottom: 6px;
}

.cp-time-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    background: rgba(28,28,28,0.92);
    color: #fff;
    font-size: 12px;
    padding: 3px 7px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
}

.cp-time-tooltip.is-visible {
    opacity: 1;
}

.cp-progress {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.cp-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.cp-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cp-bar-left, .cp-bar-right {
    display: flex;
    align-items: center;
    gap: 2px;
}

.cp-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px 6px;
    border-radius: 4px;
    line-height: 0;
    display: flex;
    align-items: center;
}

.cp-btn:hover {
    background: rgba(255,255,255,0.15);
}

.cp-time {
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
    padding: 0 6px;
    font-variant-numeric: tabular-nums;
}

.cp-vol-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
}

.cp-volume {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.cp-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}


.watch-title {
    margin: 18px 0 14px;
    font-size: 22px;
    line-height: 1.4;
    letter-spacing: -0.2px;
    word-break: break-word;
}

.watch-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.watch-channel-box {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.watch-channel-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: #222;
    flex-shrink: 0;
}

.watch-channel-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.watch-channel-text strong {
    font-size: 15px;
    line-height: 1.3;
}

.watch-channel-text span {
    font-size: 13px;
    color: #aaaaaa;
    line-height: 1.3;
}

.watch-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.watch-action-btn {
    height: 38px;
    padding: 0 14px;
    border: 1px solid #303030;
    border-radius: 999px;
    background: #272727;
    color: #fff;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.watch-action-btn:hover {
    background: #343434;
}

.watch-action-btn.primary {
    background: #fff;
    color: #111;
    border-color: #fff;
    font-weight: 700;
}

.watch-action-btn.active {
    background: #3a3a3a;
    border-color: #4a4a4a;
}

.watch-description {
    margin-top: 14px;
    background: #181818;
    border-radius: 14px;
    padding: 14px 16px;
    color: #f1f1f1;
    line-height: 1.7;
    white-space: pre-line;
}

.watch-recommend-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* recommend card */
.recommend-card {
    display: flex;
    gap: 10px;
    padding: 8px;
    border-radius: 14px;
    color: inherit;
    text-decoration: none;
    transition: background 0.18s ease, transform 0.18s ease;
    min-width: 0;
}

.recommend-card:hover {
    background: #1a1a1a;
}

.recommend-thumb {
    position: relative;
    width: 168px;
    min-width: 168px;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
}

.recommend-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.22s ease;
}

.recommend-card:hover .recommend-thumb img {
    transform: scale(1.04);
}

.recommend-duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    font-weight: 500;
}

.recommend-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 2px;
}

.recommend-title {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: #f1f1f1;
    transition: color 0.18s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recommend-card:hover .recommend-title {
    color: #ffffff;
}

.recommend-meta {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: #aaaaaa;
}

/* comments */
.comments-section {
    margin-top: 28px;
}

.comments-header h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

.comment-form {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.comment-form-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff4e45, #ff8a00);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.comment-form-body {
    flex: 1;
    min-width: 0;
}

.comment-input {
    width: 100%;
    height: 42px;
    border: none;
    border-bottom: 1px solid #303030;
    background: transparent;
    color: #fff;
    outline: none;
    padding: 0 0 8px;
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.comment-btn {
    min-width: 72px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid #303030;
    background: #272727;
    color: #fff;
    cursor: pointer;
}

.comment-btn.submit {
    background: #fff;
    color: #111;
    border-color: #fff;
    font-weight: 700;
}

.comment-btn.submit:disabled {
    opacity: 0.45;
    cursor: default;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    display: flex;
    gap: 12px;
}

.replies-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reply-item {
    padding-left: 4px;
    border-left: 2px solid #333;
}

.reply-avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 12px !important;
}

.comment-reply-btn {
    font-size: 13px;
    color: #aaa;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.comment-reply-btn:hover {
    color: #fff;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #272727;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.comment-content {
    min-width: 0;
}

.comment-author-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.comment-author {
    font-size: 13px;
    font-weight: 700;
}

.comment-time {
    font-size: 12px;
    color: #aaaaaa;
}

.comment-text,
.comment-empty {
    margin: 0;
    color: #f1f1f1;
    line-height: 1.6;
    word-break: break-word;
}

/* upload */
.upload-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 40px;
}

.upload-wizard-card {
    background: #181818;
    border: 1px solid #272727;
    border-radius: 24px;
    padding: 24px;
}

.upload-wizard-title {
    margin: 0 0 18px;
    font-size: 28px;
    line-height: 1.25;
}

.upload-step-indicators {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.upload-step-chip {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid #303030;
    background: #202020;
    color: #bdbdbd;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.upload-step-chip.is-active {
    background: #fff;
    color: #111;
    border-color: #fff;
    font-weight: 700;
}

.upload-step-chip.is-complete {
    background: #2f2f2f;
    color: #fff;
}

.upload-step-panel {
    display: none;
}

.upload-step-panel.is-active {
    display: block;
}

.upload-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 20px;
}

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.upload-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-field label {
    font-size: 14px;
    font-weight: 500;
}

.upload-input,
.upload-select,
.upload-textarea {
    width: 100%;
    border: 1px solid #303030;
    background: #121212;
    color: #fff;
    border-radius: 14px;
    outline: none;
}

.upload-input,
.upload-select {
    height: 46px;
    padding: 0 14px;
}

.upload-textarea {
    min-height: 140px;
    resize: vertical;
    padding: 14px;
    line-height: 1.6;
}

.upload-file-box {
    border: 1px dashed #3a3a3a;
    border-radius: 16px;
    padding: 20px;
    background: #131313;
}

.upload-file-name {
    margin-top: 10px;
    color: #aaaaaa;
    font-size: 13px;
}

.upload-radio-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.upload-radio-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid #303030;
    background: #202020;
    font-size: 13px;
}

.upload-preview-card,
.upload-summary-card {
    background: #121212;
    border: 1px solid #2c2c2c;
    border-radius: 18px;
    padding: 16px;
}

.upload-preview-title,
.upload-summary-title {
    margin: 0 0 14px;
    font-size: 15px;
}

.upload-thumb-preview,
.upload-summary-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    overflow: hidden;
    background: #0d0d0d;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    text-align: center;
}

.upload-thumb-preview img,
.upload-summary-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.upload-summary-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.upload-summary-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #232323;
}

.upload-summary-item:last-child {
    border-bottom: none;
}

.upload-summary-label {
    color: #aaaaaa;
    font-size: 13px;
}

.upload-summary-value {
    text-align: right;
    font-size: 14px;
    word-break: break-word;
}

.upload-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.upload-link-btn,
.upload-cancel,
.upload-next,
.upload-submit {
    min-width: 110px;
    height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid #303030;
    background: #202020;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
}

.upload-submit,
.upload-next {
    background: #fff;
    color: #111;
    border-color: #fff;
    font-weight: 700;
}

/* saved / liked helper */
.saved-card,
.liked-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.saved-card-actions,
.liked-card-actions {
    display: flex;
    justify-content: flex-end;
}

.saved-remove-btn,
.liked-remove-btn {
    border: 1px solid #303030;
    background: #181818;
    color: #fff;
    border-radius: 999px;
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
    cursor: pointer;
}

.saved-remove-btn:hover,
.liked-remove-btn:hover {
    background: #272727;
}

/* responsive */
@media (max-width: 1280px) {
    .video-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .watch-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .watch-side-column {
        width: 100%;
    }
}

@media (max-width: 980px) {
    .upload-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .topbar {
        padding: 0 12px;
        gap: 10px;
    }

    .topbar-left {
        min-width: auto;
    }

    .topbar-right {
        min-width: auto;
        gap: 8px;
    }

    .logo-text {
        display: none;
    }

    .main,
    .watch-page,
    .upload-page {
        padding-left: 16px;
        padding-right: 16px;
    }

    .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .watch-title {
        font-size: 20px;
    }

    .watch-meta-row {
        align-items: stretch;
    }

    .watch-side-column {
        position: static !important;
    }
}

@media (max-width: 768px) {
    .search-form {
        max-width: none;
    }

    .search-btn {
        width: 56px;
    }

    .recommend-thumb {
        width: 150px;
        min-width: 150px;
    }

    .watch-channel-box {
        width: 100%;
    }

    .watch-actions {
        width: 100%;
    }

    .watch-action-btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }

    .comment-form {
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .topbar {
        padding: 0 10px;
        gap: 8px;
    }

    .topbar-left {
        gap: 6px;
    }

    .topbar-center {
        min-width: 0;
    }

    .search-form input {
        font-size: 13px;
        padding: 0 12px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }

    .profile {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .main,
    .watch-page,
    .upload-page {
        padding-left: 12px;
        padding-right: 12px;
    }

    .video-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .meta {
        gap: 10px;
    }

    .text h3 {
        font-size: 15px;
    }

    .channel-name,
    .video-info {
        font-size: 13px;
    }

    .watch-title {
        font-size: 18px;
        margin-top: 14px;
    }

    .watch-channel-avatar {
        width: 38px;
        height: 38px;
    }

    .watch-channel-text strong {
        font-size: 14px;
    }

    .watch-channel-text span {
        font-size: 12px;
    }

    .watch-actions {
        gap: 6px;
    }

    .watch-action-btn {
        height: 36px;
        font-size: 13px;
        padding: 0 10px;
    }

    .recommend-card {
        padding: 6px;
        gap: 8px;
    }

    .recommend-thumb {
        width: 132px;
        min-width: 132px;
        border-radius: 10px;
    }

    .recommend-title {
        font-size: 13px;
    }

    .recommend-meta {
        font-size: 11px;
    }

    .comment-form {
        gap: 10px;
    }

    .comment-form-avatar,
    .comment-avatar {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .comment-form-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .comment-btn {
        min-width: 64px;
        height: 34px;
        font-size: 13px;
    }

    .upload-wizard-card {
        padding: 18px;
    }

    .upload-wizard-title {
        font-size: 24px;
    }

    .upload-step-indicators {
        gap: 8px;
    }

    .upload-step-chip {
        min-height: 36px;
        padding: 0 12px;
        font-size: 12px;
    }

    .upload-input,
    .upload-select {
        height: 44px;
        font-size: 14px;
    }

    .upload-textarea {
        min-height: 120px;
        font-size: 14px;
    }

    .upload-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .upload-link-btn,
    .upload-cancel,
    .upload-next,
    .upload-submit {
        width: 100%;
    }

    .saved-card-actions,
    .liked-card-actions {
        justify-content: stretch;
    }

    .saved-remove-btn,
    .liked-remove-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .topbar {
        height: 52px;
    }

    .logo-badge {
        width: 30px;
        height: 30px;
        border-radius: 50%;
    }

    .search-form {
        height: 38px;
    }

    .search-form input {
        height: 38px;
    }

    .search-btn {
        height: 38px;
        width: 50px;
    }

    .watch-page,
    .main,
    .upload-page {
        padding-top: 14px;
        padding-bottom: 24px;
    }

    .recommend-thumb {
        width: 120px;
        min-width: 120px;
    }

    .watch-description,
    .watch-description-box {
        padding: 12px 13px;
        font-size: 14px;
    }
}
/* =========================================================
   메인/공통 상단 헤더 고정 보정
   - 햄버거 버튼이 스크롤 후에야 보이는 문제 수정
   - upload.html은 기존 업로드 클린 레이아웃 유지
========================================================= */

body:not(.upload-clean-layout) {
    padding-top: 56px;
}

body:not(.upload-clean-layout) .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 5000;
    background: #0f0f0f;
}

body:not(.upload-clean-layout) .sidebar,
body:not(.upload-clean-layout) #sidebar {
    top: 56px;
    height: calc(100vh - 56px);
}

body:not(.upload-clean-layout) .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
/* ── 미니 플레이어 ─────────────────────────────────────── */
.mini-player {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 320px;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    user-select: none;
    animation: mp-enter 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.mini-player.is-closing {
    animation: mp-exit 0.2s ease forwards;
}

@keyframes mp-enter {
    from { opacity: 0; transform: translateY(20px) scale(0.93); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mp-exit {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(16px) scale(0.93); }
}

.mp-video-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    cursor: pointer;
    overflow: hidden;
}

.mp-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.mp-bottom {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    gap: 4px;
    cursor: grab;
}

.mp-bottom:active { cursor: grabbing; }

.mp-info {
    flex: 1;
    min-width: 0;
    padding-right: 4px;
}

.mp-title {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.mp-channel {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.mp-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.mp-btn:hover { background: #333; color: #fff; }

@media (max-width: 480px) {
    .mini-player { width: 260px; right: 12px; bottom: 12px; }
}
/* ─────────────────────────────────────────────────────── */

/* ── 통합 설정 메뉴 (속도 + 화질) ─────────────────────── */
.cp-settings-wrap { position: relative; }

.cp-settings-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: rgba(20,20,20,0.97);
    border: 1px solid #333;
    border-radius: 10px;
    min-width: 200px;
    overflow: hidden;
    z-index: 20;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.cp-settings-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.cp-set-panel { padding: 6px 0; }

.cp-set-panel.is-entering {
    animation: cp-panel-in 0.15s ease;
}

@keyframes cp-panel-in {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes cp-panel-back {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.cp-set-panel.is-entering-back {
    animation: cp-panel-back 0.15s ease;
}

.cp-set-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 13px;
    color: #fff;
    cursor: pointer;
    gap: 16px;
}

.cp-set-item::after {
    content: '›';
    color: #aaa;
    font-size: 16px;
}

.cp-set-item { transition: background 0.12s; }
.cp-set-item:hover { background: rgba(255,255,255,0.08); }

.cp-set-val {
    color: #aaa;
    font-size: 12px;
    flex-shrink: 0;
}

.cp-set-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    border-bottom: 1px solid #2a2a2a;
    cursor: pointer;
}

.cp-set-back::before { content: '‹'; font-size: 16px; color: #aaa; }
.cp-set-back { transition: background 0.12s; }
.cp-set-back:hover { background: rgba(255,255,255,0.06); }

.cp-set-option {
    padding: 9px 16px 9px 36px;
    font-size: 13px;
    color: #ccc;
    cursor: pointer;
    position: relative;
}

.cp-set-option { transition: background 0.12s, color 0.12s; }
.cp-set-option:hover { background: rgba(255,255,255,0.08); color: #fff; }

.cp-set-option.active {
    color: #fff;
    font-weight: 600;
}

.cp-set-option.active::before {
    content: '✓';
    position: absolute;
    left: 14px;
    color: #fff;
}

/* =========================================================
   Studio Page (studio.html)
========================================================= */

.studio-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px 60px;
}

.studio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.studio-header h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
}

.studio-upload-btn {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    background: #fff;
    color: #111;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.18s;
}

.studio-upload-btn:hover {
    background: #e8e8e8;
}

.studio-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.studio-card {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 16px;
    align-items: start;
    background: #181818;
    border: 1px solid #272727;
    border-radius: 16px;
    padding: 14px;
    transition: background 0.18s, border-color 0.18s;
}

.studio-card:hover {
    background: #202020;
    border-color: #333;
}

.studio-card-thumb {
    position: relative;
    display: block;
    width: 160px;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background: #111;
    flex-shrink: 0;
}

.studio-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.studio-card-duration {
    position: absolute;
    right: 7px;
    bottom: 7px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 5px;
}

.studio-card-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.studio-card-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.studio-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

.studio-card-title a {
    color: #f1f1f1;
    text-decoration: none;
}

.studio-card-title a:hover {
    color: #fff;
    text-decoration: underline;
}

.studio-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

.studio-badge--public {
    background: #1a3a1a;
    color: #6fcf6f;
    border: 1px solid #2a5a2a;
}

.studio-badge--private {
    background: #2a2a2a;
    color: #aaa;
    border: 1px solid #3a3a3a;
}

.studio-card-meta {
    margin: 0;
    font-size: 13px;
    color: #9aa0a6;
}

.studio-conv-status {
    margin-top: 4px;
    font-size: 13px;
}

.studio-conv-done {
    color: #6fcf6f;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.studio-conv-icon {
    font-size: 14px;
}

.studio-conv-pending {
    color: #f0c040;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.studio-conv-label {
    font-size: 13px;
}

.studio-progress-bar-wrap {
    width: 100%;
    max-width: 240px;
    height: 6px;
    background: #333;
    border-radius: 999px;
    overflow: hidden;
}

.studio-progress-bar {
    height: 100%;
    background: #f0c040;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.studio-res-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.studio-res-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    background: #252525;
    border: 1px solid #333;
    color: #ccc;
    font-size: 11px;
    font-weight: 600;
}

.studio-card-actions {
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex-shrink: 0;
}

.studio-card-actions .studio-action-btn {
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid #303030;
    background: #202020;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.studio-card-actions .studio-action-btn:hover {
    background: #2a2a2a;
    border-color: #3b3b3b;
}

.studio-card-actions .studio-action-btn--delete {
    background: #2a1616;
    border-color: #4c2424;
    color: #ffb4b4;
}

.studio-card-actions .studio-action-btn--delete:hover {
    background: #3a1c1c;
    border-color: #6a2e2e;
}

.studio-empty {
    text-align: center;
    padding: 60px 24px;
    border: 1px solid #272727;
    border-radius: 20px;
    background: linear-gradient(180deg, #181818, #151515);
}

.studio-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: #202020;
    border: 1px solid #2e2e2e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.studio-empty-icon svg {
    width: 32px;
    height: 32px;
    fill: #9aa0a6;
}

.studio-empty-title {
    margin: 0 0 10px;
    font-size: 20px;
    color: #fff;
}

.studio-empty-text {
    margin: 0 0 22px;
    color: #9aa0a6;
    font-size: 14px;
    line-height: 1.7;
}

.studio-loading,
.studio-error {
    text-align: center;
    padding: 40px 0;
    color: #9aa0a6;
    font-size: 15px;
}

.studio-error {
    color: #ff6b6b;
}

@media (max-width: 700px) {
    .studio-wrap {
        padding: 20px 14px 40px;
    }

    .studio-card {
        grid-template-columns: 120px 1fr;
        grid-template-rows: auto auto;
    }

    .studio-card-thumb {
        width: 120px;
    }

    .studio-card-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .studio-card {
        grid-template-columns: 1fr;
    }

    .studio-card-thumb {
        width: 100%;
    }

    .studio-card-actions {
        grid-column: 1;
    }
}
/* ─────────────────────────────────────────────────────── */
