* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: #20232a;
    color: #eeeeee;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

a { color: #4db6bc; text-decoration: none; }
a:hover, a:active { color: #5cc7cd; }

/* iOS safe-area */
.top-bar {
    padding: max(12px, env(safe-area-inset-top)) 14px 12px;
    background: #333843;
    border-bottom: 1px solid #2b3138;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}
.top-bar h1 { margin: 0; font-size: 18px; font-weight: 500; color: #4db6bc; }
.top-bar a.logout { color: #b4b5b6; padding: 6px 10px; border-radius: 4px; display: inline-flex; align-items: center; }
.top-bar a.logout svg { margin: 0; width: 18px; height: 18px; }

.container {
    padding: 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    max-width: 720px;
    margin: 0 auto;
}

/* ====== Список носителей ====== */
.media-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.media-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #2b3138;
    border-radius: 8px;
    color: #eeeeee !important;
    font-size: 16px;
}
.media-item:active { background: #3a4048; }
.media-item svg { flex-shrink: 0; margin: 0; width: 22px; height: 22px; color: #4db6bc; }
.media-item .m-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-item .m-meta { font-size: 12px; color: #6a7078; }

/* ====== Плеер ====== */
.player-page h2 { margin: 6px 0 4px; font-size: 20px; }
.player-page .desc { color: #b4b5b6; font-size: 13px; margin: 0 0 14px; white-space: pre-wrap; }

.player-block {
    background: #333843;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}
.pl-title {
    font-size: 15px; color: #eeeeee;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    margin-bottom: 10px; text-align: center;
}
.pl-progress {
    height: 8px; background: #2b3138; border-radius: 4px; cursor: pointer;
    margin-bottom: 6px; touch-action: manipulation;
}
.pl-bar {
    height: 100%; background: #4db6bc; width: 0;
    border-radius: 4px; transition: width 0.1s linear; pointer-events: none;
}
.pl-time {
    font-size: 12px; color: #6a7078; margin-bottom: 12px;
    display: flex; justify-content: space-between;
}

.pl-controls {
    display: flex; gap: 10px; justify-content: center;
}
.pl-btn {
    background: #464f5a; border: 1px solid #464f5a;
    color: #b4b5b6;
    border-radius: 8px;
    padding: 12px 14px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    min-width: 52px; min-height: 52px;
    transition: background 0.15s, border-color 0.15s;
}
.pl-btn:active { background: #555e69; }
.pl-btn svg { margin: 0; width: 22px; height: 22px; }
.pl-btn.pl-active {
    background: #4db6bc; border-color: #4db6bc; color: #ffffff;
}

/* ====== Список треков ====== */
.side-switch {
    display: flex; gap: 6px; margin-bottom: 10px;
}
.side-switch a {
    flex: 1; padding: 8px; text-align: center;
    background: #464f5a; color: #b4b5b6 !important;
    border-radius: 6px; font-size: 14px;
}
.side-switch a.active { background: #4db6bc; color: #ffffff !important; }

.tracks-list { display: flex; flex-direction: column; gap: 4px; }
.trk {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: #2b3138; border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.trk:active { background: #3a4048; }
.trk .trk-num { color: #6a7078; font-size: 12px; min-width: 24px; text-align: right; }
.trk .trk-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trk .trk-dur { color: #6a7078; font-size: 12px; }
.trk.playing { background: #333843; }
.trk.playing .trk-title { color: #4db6bc; }

.totals {
    text-align: center; color: #6a7078; font-size: 12px; margin-top: 12px;
}
.totals b { color: #4db6bc; }

/* ====== Login ====== */
body.pwa-login { display: flex; align-items: center; justify-content: center; padding: 20px; }
body.pwa-login form {
    background: #2b3138; padding: 20px; border-radius: 10px;
    width: 100%; max-width: 320px;
    display: flex; flex-direction: column; gap: 12px;
}
body.pwa-login h1 { margin: 0 0 4px; text-align: center; font-size: 18px; }
body.pwa-login input {
    background: #464f5a; color: #eeeeee; border: 1px solid #464f5a;
    border-radius: 6px; padding: 10px 12px; font-size: 16px;
}
body.pwa-login button {
    background: #4db6bc; color: #ffffff; border: none;
    border-radius: 6px; padding: 12px; font-size: 16px; cursor: pointer;
}

/* Back-link на верхней панели */
.top-bar a.back {
    color: #b4b5b6; padding: 6px 10px; border-radius: 4px;
    display: inline-flex; align-items: center;
}
