* {
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', Arial, sans-serif;
    text-align: center;
    background: linear-gradient(135deg, #ff9a9e, #fad0c4, #a18cd1);
    height: 100vh;
    overflow: hidden;           /* kein vertikales Scrollen */
    margin: 0;
    color: #333;
    display: flex;
    flex-direction: column;
}

/* ── Kopfzeile ── */
h1 {
    font-size: 2.2em;
    margin: 0;
    padding: 90px 20px 10px;    /* Platz für Home-Button */
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

/* ── Kategorie-Buttons ── */
.category {
    display: flex;
    justify-content: center;
    gap: 3vw;
    padding: 10px 4vw;
    flex-shrink: 0;
}

.category button {
    flex: 1;
    max-width: 280px;
    height: 14vh;
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', Arial, sans-serif;
    font-size: 1.6em;
    font-weight: bold;
    border-radius: 50px;
    border: none;
    color: #fff;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.category button:first-child { background: #FF9800; }
.category button:last-child  { background: #9C27B0; }

.category button:active {
    transform: scale(0.95);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
}

/* ── Bibliothek: horizontales Scrollen ── */
#library {
    display: flex;
    flex-wrap: nowrap;          /* eine Zeile, kein Umbruch */
    overflow-x: auto;           /* seitlich scrollen */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 16px;
    padding: 16px 20px;
    flex: 1;                    /* nimmt verfügbaren Platz */
    align-items: center;
    scrollbar-width: none;      /* Firefox: Scrollbar verstecken */
}
#library::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.item {
    flex-shrink: 0;             /* Karten nicht stauchen */
    cursor: pointer;
    transition: transform 0.15s ease;
}

.item:active { transform: scale(0.95); }

.item img {
    width: 150px;
    height: 150px;
    border-radius: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    display: block;
}

.item p {
    margin: 8px 0 0;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
    max-width: 150px;
    font-size: 0.85em;
}

/* ── Player: fixiert am unteren Rand ── */
#player {
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(12px);
    border-radius: 30px 30px 0 0;
    padding: 14px 24px 20px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#player.hidden { display: none !important; }

/* Obere Zeile: Cover + Info */
.player-top {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
}

#playerCover {
    width: 70px;
    height: 70px;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.player-info {
    flex: 1;
    min-width: 0;
}

#playerTitle {
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
    margin: 0 0 6px;
    font-size: 1em;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#time-display {
    font-size: 0.78em;
    color: rgba(255,255,255,0.75);
    margin-bottom: 6px;
}

#progress-wrap {
    width: 100%;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    height: 8px;
    cursor: pointer;
}

#progress-bar {
    height: 8px;
    border-radius: 10px;
    background: #ffcc00;
    width: 0%;
    transition: width 0.5s linear;
}

/* Untere Zeile: Steuerung + Sleep-Timer */
.player-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex: 1;
}

.controls button {
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', Arial, sans-serif;
    font-weight: bold;
    padding: 12px 18px;
    border-radius: 20px;
    border: none;
    background: rgba(255,255,255,0.35);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 80px;
}

.controls button .btn-icon  { font-size: 1.8em; line-height: 1; }
.controls button .btn-label { font-size: 0.68em; opacity: 0.95; }

.controls button:active {
    transform: scale(0.93);
    background: rgba(255,255,255,0.55);
}

/* Sleep-Timer rechts neben den Controls */
#sleep-btn {
    background: rgba(255,255,255,0.25);
    border: none;
    border-radius: 18px;
    color: #fff;
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', Arial, sans-serif;
    font-weight: bold;
    padding: 12px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 72px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: background 0.2s;
    position: static;  /* nicht mehr fixed */
}
#sleep-btn .btn-icon  { font-size: 1.6em; line-height: 1; }
#sleep-btn .btn-label { font-size: 0.68em; opacity: 0.9; }
#sleep-btn.active { background: rgba(255,180,0,0.55); }

/* Resume-Badge */
.resume-badge {
    display: inline-block;
    background: #ff9800; color: #fff;
    font-size: 0.7em; border-radius: 8px;
    padding: 2px 7px; margin-left: 6px;
    vertical-align: middle;
}

.hidden { display: none; }
/* ── Hochformat Smartphone: scrollbar statt fixed height ── */
@media (orientation:portrait) and (max-width:768px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
    h1 {
        font-size: 1.6em;
        padding: 80px 16px 8px;
    }
    .category button {
        height: 11vh;
        min-height: 80px;
        font-size: 1.3em;
    }
    #library {
        flex: none;
        min-height: 180px;
        padding: 12px 16px;
    }
    .item img { width: 130px; height: 130px; }
    /* Player unten normal im Flow */
    #player {
        border-radius: 20px;
        margin: 8px 0 16px;
    }
    .controls button { min-width: 70px; padding: 10px 12px; }
    .controls button .btn-icon { font-size: 1.5em; }
    #sleep-btn { min-width: 60px; padding: 10px 10px; }
}
