:root {
    color-scheme: dark;
    --bg: #08090d;
    --panel: #11131a;
    --panel-soft: #171a23;
    --line: #2a2f3d;
    --text: #f4f6fb;
    --muted: #a6adbc;
    --accent: #33d6a6;
    --accent-2: #f2c14e;
    --danger: #ff6b6b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; letter-spacing: 0; }

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(120deg, rgba(51, 214, 166, 0.18), transparent 38%),
        linear-gradient(300deg, rgba(242, 193, 78, 0.12), transparent 42%),
        var(--bg);
}

.login-panel {
    width: min(520px, 100%);
    padding: 32px;
    background: rgba(17, 19, 26, 0.94);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.login-panel h1, .topbar h1 {
    margin: 6px 0 0;
    line-height: 1.05;
}

.login-copy { color: var(--muted); line-height: 1.6; }
.tiny, .help-text { color: var(--muted); font-size: 13px; line-height: 1.5; }
.eyebrow { margin: 0; color: var(--accent); text-transform: uppercase; font-size: 12px; font-weight: 800; }

.primary-action, .button, .transport button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--text);
    padding: 10px 14px;
    cursor: pointer;
    text-decoration: none;
}

.primary-action {
    display: inline-flex;
    margin-top: 14px;
    background: var(--accent);
    color: #07100d;
    font-weight: 800;
    border-color: transparent;
}

.button:hover, .transport button:hover, .nav-link:hover { border-color: var(--accent); }
.button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}
.button.accent { background: var(--accent); color: #07100d; border-color: transparent; font-weight: 800; }
.button.danger { color: var(--danger); }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    padding-bottom: 112px;
}

.sidebar {
    border-right: 1px solid var(--line);
    background: #0c0e13;
    padding: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.brand-mark, .cover {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--accent);
    color: #07100d;
    font-weight: 900;
}
.brand small, .now small { display: block; color: var(--muted); margin-top: 3px; }

.nav { display: grid; gap: 8px; }
.nav-link {
    text-align: left;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    padding: 12px;
    cursor: pointer;
}
.nav-link.is-active { background: var(--panel); color: var(--text); border-color: var(--line); }
.logout { position: absolute; bottom: 22px; color: var(--muted); text-decoration: none; }

.main { padding: 28px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 22px; }
.search-wrap { display: grid; gap: 6px; color: var(--muted); width: min(420px, 100%); }

input[type="search"], input[type="text"] {
    width: 100%;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.notice {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    background: var(--panel);
    color: var(--muted);
}

.view { display: none; }
.view.is-visible { display: block; }
.section-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }

.track-list, .playlist-list, .folder-grid, .selected-folders {
    display: grid;
    gap: 10px;
}

.track-row, .playlist-row, .folder-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 12px;
}

.track-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.track-title { font-weight: 750; overflow-wrap: anywhere; }
.track-meta { color: var(--muted); font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }
.track-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.track-actions button, .playlist-row button, .folder-card button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0d0f15;
    color: var(--text);
    padding: 8px 10px;
    cursor: pointer;
}

.folder-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.folder-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0d0f15;
    padding: 14px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 12px;
}

.panel-heading strong {
    color: var(--accent);
}

.folder-grid {
    grid-template-columns: 1fr;
    gap: 8px;
}

.folder-card {
    display: grid;
    gap: 10px;
    cursor: pointer;
}

.folder-card.is-active {
    border-color: var(--accent);
    background: #151a21;
}

.folder-card strong { display: block; overflow-wrap: anywhere; line-height: 1.35; }
.folder-card small { color: var(--muted); }
.folder-card .section-actions { margin-bottom: 0; }
.folder-card .section-actions button { padding: 7px 9px; }

.folder-detail {
    min-width: 0;
}

.folder-detail-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 16px;
    margin-bottom: 14px;
}

.folder-detail-head h2 {
    margin: 4px 0;
    overflow-wrap: anywhere;
}

.folder-detail-head small {
    color: var(--muted);
}

.folder-actions {
    margin-bottom: 0;
    justify-content: flex-end;
}

.playlist-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; }
.inline-form { display: flex; gap: 8px; margin-bottom: 12px; }
.playlist-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.playlist-row.is-active { border-color: var(--accent); }

.settings-form { display: grid; gap: 18px; max-width: 760px; }
.settings-form label { display: grid; gap: 8px; color: var(--muted); }
.check-row { display: flex !important; align-items: center; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.player {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 96px;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 2fr) minmax(120px, 1fr);
    gap: 18px;
    align-items: center;
    padding: 16px 22px;
    border-top: 1px solid var(--line);
    background: rgba(8, 9, 13, 0.96);
    backdrop-filter: blur(14px);
}

.now { display: flex; gap: 12px; align-items: center; min-width: 0; }
.now strong { overflow-wrap: anywhere; }
.transport { display: grid; gap: 10px; }
.transport-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.icon-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0 !important;
}
.icon-btn svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
}
.icon-btn.is-active {
    color: var(--accent);
    border-color: rgba(51, 214, 166, 0.75);
    background: rgba(51, 214, 166, 0.08);
}
.play-main {
    width: 52px;
    height: 52px;
    background: var(--accent) !important;
    color: #07100d !important;
    border-color: transparent !important;
    font-weight: 900;
}
.play-main .icon-pause { display: none; }
.play-main.is-playing .icon-play { display: none; }
.play-main.is-playing .icon-pause { display: block; }
.play-main.is-loading {
    animation: pulsePlay 1s ease-in-out infinite;
}
.repeat-one {
    position: absolute;
    right: 8px;
    bottom: 7px;
    display: none;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}
.repeat-one.is-visible { display: block; }
.repeat-off { opacity: 0.72; }
.progress-row { display: grid; grid-template-columns: 48px 1fr 48px; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.queue-panel { position: relative; justify-self: end; }
.queue-popover {
    position: absolute;
    right: 0;
    bottom: 48px;
    width: min(360px, calc(100vw - 28px));
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 10px;
}
.queue-item { padding: 8px; border-bottom: 1px solid var(--line); color: var(--muted); }
.queue-item.is-current { color: var(--accent); }

@keyframes pulsePlay {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.94); }
}

@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; padding-bottom: 190px; }
    .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .logout { position: static; display: inline-block; margin-top: 18px; }
    .topbar { display: grid; }
    .folder-layout { grid-template-columns: 1fr; }
    .folder-detail-head { display: grid; }
    .folder-actions { justify-content: flex-start; }
    .playlist-layout { grid-template-columns: 1fr; }
    .track-row { grid-template-columns: 1fr; }
    .track-actions { justify-content: flex-start; }
    .player { grid-template-columns: 1fr; }
    .queue-panel { justify-self: stretch; }
}
