:root {
    --bg: #07131a;
    --bg-soft: #0c1e29;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-strong: rgba(255, 255, 255, 0.12);
    --text: #f6fbff;
    --text-soft: #aac2d1;
    --accent: #1fd0b7;
    --accent-warm: #ff8f3f;
    --danger: #ff6b6b;
    --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 12px;
    color: var(--text);
    background: radial-gradient(circle at 15% 20%, #16394a 0%, transparent 45%),
                radial-gradient(circle at 85% 10%, #3b2f1f 0%, transparent 35%),
                linear-gradient(140deg, #050b10 0%, #081823 45%, #0b1621 100%);
    font-family: 'Sora', sans-serif;
    overflow: hidden;
}

.app-frame {
    position: relative;
    width: 100%;
    max-width: 1480px;
    height: calc(100vh - 24px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, rgba(8, 18, 26, 0.94), rgba(6, 12, 18, 0.92));
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.app-content {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px 18px 18px 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0));
}

h1, h2, h3 {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
}

p {
    margin: 0;
    color: var(--text-soft);
}

.bg-blur {
    position: fixed;
    width: 360px;
    height: 360px;
    filter: blur(80px);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.55;
}

.bg-blur-a {
    background: #1fd0b7;
    top: -130px;
    left: -80px;
}

.bg-blur-b {
    background: #ff8f3f;
    right: -120px;
    bottom: -130px;
}

.topbar {
    width: 100%;
    margin: 0;
    padding: 22px 18px 18px 22px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 18px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
}

.sidebar-shell {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding-bottom: 10px;
}

.sidebar-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    padding: 2px 4px 0;
}

.sidebar-block {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 16px;
    background: linear-gradient(180deg, rgba(31, 208, 183, 0.08), rgba(255, 255, 255, 0.02));
}

.sidebar-intro h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.sidebar-intro p:last-child {
    line-height: 1.55;
    font-size: 0.95rem;
}

.sidebar-search-wrap {
    width: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #07131a;
    font-weight: 700;
    background: linear-gradient(130deg, var(--accent), #7fffe9);
}

.brand p {
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 10px 12px;
}

.search-box input {
    min-width: 0;
    width: 100%;
    background: transparent;
    border: 0;
    color: var(--text);
    outline: 0;
    font-family: inherit;
}

.search-box span {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
}

.app-shell {
    width: 100%;
    margin: 0;
    padding: 0 6px 0;
}

.hero {
    background: linear-gradient(135deg, rgba(31, 208, 183, 0.16), rgba(255, 143, 63, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 22px;
    padding: 20px 22px;
    box-shadow: var(--shadow);
    animation: reveal 0.7s ease;
}

.pill {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    color: #d5fff8;
    font-size: 0.78rem;
    border-radius: 999px;
    padding: 6px 10px;
    margin-bottom: 10px;
}

.hero h2 {
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    margin-bottom: 8px;
}

.hero-copy {
    max-width: 760px;
    line-height: 1.55;
}

.main-hero {
    margin-bottom: 22px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin: 24px 0 20px;
}

.sidebar-tabs {
    flex-direction: column;
    gap: 8px;
    margin: 0;
}

.sidebar-tabs .tab {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    border-radius: 16px;
    padding: 13px 14px;
    background: rgba(255, 255, 255, 0.04);
}

.tab-icon {
    width: 22px;
    min-width: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.98rem;
    color: inherit;
    opacity: 0.9;
}

.tab-text {
    flex: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 8px;
}

.sidebar-logout {
    width: 100%;
    justify-content: center;
}

.tab,
.btn {
    border: 0;
    border-radius: 12px;
    padding: 10px 16px;
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    transition: transform 0.2s ease, background 0.2s ease;
}

.tab:hover,
.btn:hover {
    transform: translateY(-1px);
    background: var(--surface-strong);
}

.tab.active {
    background: linear-gradient(120deg, var(--accent), #2aefd2);
    color: #04201c;
    box-shadow: 0 10px 24px rgba(31, 208, 183, 0.18);
}

.btn.ghost {
    background: rgba(255, 255, 255, 0.08);
}

.grid-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    align-content: start;
}

.grid-feed > .grid-feed {
    grid-column: 1 / -1;
}

.card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 13px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow);
    animation: cardIn 0.5s ease both;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(31, 208, 183, 0.28);
    box-shadow: 0 24px 44px rgba(0, 0, 0, 0.32);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
}

.card-cover {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
}

.card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 14px;
    transition: transform 0.35s ease;
}

.card:hover img {
    transform: scale(1.04);
}

.card-overlay {
    position: absolute;
    inset: auto 10px 10px auto;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.card:hover .card-overlay {
    opacity: 1;
    transform: translateY(0);
}

.card-quick-play {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    display: grid;
    place-items: center;
    background: linear-gradient(120deg, var(--accent), #2af5d9);
    color: #03241f;
    box-shadow: 0 12px 24px rgba(31, 208, 183, 0.28);
}

.card-quick-play span {
    font-size: 1rem;
    transform: translateX(1px);
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card h3 {
    font-size: 1.04rem;
    line-height: 1.28;
}

.meta {
    font-size: 0.92rem;
    line-height: 1.45;
}

.card-actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.card-actions.primary-actions {
    margin-top: 2px;
}

.card-actions.secondary-actions {
    gap: 6px;
}

.card .btn,
.card .btn.ghost {
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 0.88rem;
}

.btn.play {
    background: linear-gradient(120deg, var(--accent), #2af5d9);
    color: #03241f;
}

.btn.favorite.active {
    background: linear-gradient(120deg, var(--accent-warm), #ffbb56);
    color: #2a1704;
}

.btn.like.active {
    background: linear-gradient(120deg, #ff7d6b, #ffb24e);
    color: #2f1406;
}

.panel-card {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.panel-card h3 {
    margin-bottom: 6px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.panel-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-row {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.panel-row h4 {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
}

.share-count {
    font-size: 0.82rem;
    color: var(--text-soft);
}

.row-actions {
    display: flex;
    gap: 8px;
}

.inline-form,
.stack-form {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.inline-form input {
    flex: 1;
}

.stack-form {
    flex-direction: column;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row input,
.form-row select,
.inline-form input {
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 10px 12px;
    outline: none;
    font-family: inherit;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-soft);
}

.dropzone {
    border: 1px dashed rgba(255, 255, 255, 0.28);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone strong {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    margin-bottom: 4px;
}

.dropzone span {
    color: var(--text-soft);
    font-size: 0.9rem;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.dropzone.is-drag {
    border-color: var(--accent);
    background: rgba(31, 208, 183, 0.12);
}

.upload-progress {
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(120deg, var(--accent), #77ffea);
    transition: width 0.2s ease;
}

.toast-container {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    min-width: 240px;
    max-width: 340px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(7, 20, 28, 0.95);
    color: var(--text);
    padding: 10px 12px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.player-bar {
    position: relative;
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    background: rgba(9, 14, 19, 0.97);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(280px, 1fr) minmax(190px, 250px);
    gap: 16px;
    padding: 12px 16px;
    align-items: center;
    box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px);
}

.player-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.player-meta img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 12px;
}

.player-track-text {
    min-width: 0;
}

.player-track-text h3,
.player-track-text p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-track-text h3 {
    font-size: 0.98rem;
    line-height: 1.2;
}

.player-track-text p {
    font-size: 0.92rem;
}

.player-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.player-media-stage {
    width: 100%;
    display: flex;
    justify-content: center;
}

.player-transport {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.player-icon-btn,
.player-play-btn {
    border: 0;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.player-icon-btn {
    width: 42px;
    min-width: 42px;
    height: 42px;
    border-radius: 999px;
    padding: 0;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    display: grid;
    place-items: center;
    font-size: 1.05rem;
}

.player-play-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #f4f8fb;
    color: #041118;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
}

.player-icon {
    width: 18px;
    height: 18px;
    display: block;
}

.player-icon-lg {
    width: 20px;
    height: 20px;
}

.player-icon-btn:hover,
.player-play-btn:hover {
    transform: translateY(-1px);
}

.player-timeline {
    width: min(580px, 100%);
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    gap: 8px;
}

.player-timeline span {
    font-size: 0.76rem;
    color: var(--text-soft);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

#playerSeekBar,
#playerVolumeSlider {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

#playerSeekBar::-webkit-slider-thumb,
#playerVolumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #ffffff;
    border: 0;
}

#playerSeekBar::-moz-range-thumb,
#playerVolumeSlider::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #ffffff;
    border: 0;
}

.player-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.player-volume {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

#playerVolumeBtn {
    font-size: 1rem;
}

#playerVolumeSlider {
    width: 100px;
}

#audioPlayer {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

#inlineVideoPlayer {
    width: min(300px, 100%);
    max-height: 140px;
    border-radius: 12px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal,
.auth-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.55);
    z-index: 20;
}

.modal-content {
    width: min(860px, 95vw);
    background: #081923;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    padding: 14px;
}

#playlistPickerList .panel-row {
    margin-top: 10px;
}

#videoPlayer {
    width: 100%;
    border-radius: 10px;
    max-height: 78vh;
}

.modal-close {
    margin-left: auto;
    display: block;
    margin-bottom: 8px;
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    cursor: pointer;
}

.auth-card {
    width: min(420px, 92vw);
    border-radius: 18px;
    background: #081923;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 22px;
}

.auth-switch {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}

.auth-tab {
    flex: 1;
    border: 0;
    border-radius: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    cursor: pointer;
}

.auth-tab.active {
    background: linear-gradient(120deg, var(--accent), #39e8cf);
    color: #03261f;
    font-weight: 700;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-form input {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 10px 12px;
    outline: none;
}

.auth-message {
    margin-top: 12px;
    min-height: 24px;
    font-size: 0.9rem;
}

.empty-state {
    grid-column: 1 / -1;
    border: 1px dashed rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    padding: 26px;
    text-align: center;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 860px) {
    body {
        padding: 0;
        overflow: auto;
    }

    .app-frame {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
        height: auto;
        min-height: 100vh;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .app-content {
        grid-column: 1;
        grid-row: 2;
        overflow: visible;
        padding: 0 14px 14px;
    }

    .topbar {
        grid-column: 1;
        grid-row: 1;
        flex-direction: column;
        align-items: flex-start;
        padding: 18px 14px 14px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .sidebar-tabs {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-tabs .tab {
        width: auto;
        text-align: center;
        gap: 8px;
    }

    .sidebar-footer {
        width: 100%;
    }

    .search-box input {
        min-width: 190px;
        width: 100%;
    }

    .header-actions {
        width: 100%;
    }

    .search-box {
        flex: 1;
    }

    .player-bar {
        grid-column: 1;
        grid-row: 3;
        grid-template-columns: 1fr;
        border-left: 0;
        justify-items: stretch;
    }

    .player-center,
    .player-right {
        flex-direction: column;
        align-items: stretch;
    }

    .player-timeline {
        width: 100%;
    }

    .player-volume {
        width: 100%;
    }

    #playerVolumeSlider {
        width: 100%;
    }

    .panel-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .row-actions,
    .inline-form {
        width: 100%;
        flex-direction: column;
    }
}
