:root {
    --bg-color: #000000;
    --player-bg: #1c1c1e;
    --accent: #0a84ff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: #ffffff;
    margin: 0;
    overflow: hidden; 
    user-select: none;
    -webkit-user-select: none; 
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    padding: 3rem 1.5rem 1rem;
}

h1 {
    font-size: 2rem;
    margin: 0;
    font-weight: 700;
}

.ptr-indicator {
    height: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #8e8e93;
    font-size: 0.9rem;
    font-weight: 500;
}

.ptr-indicator .spinner {
    display: inline-block;
    margin-right: 8px;
    font-size: 1.2rem;
}

.ptr-indicator.refreshing .spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.station-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem 1rem;
    padding: 1.5rem;
    overflow-y: auto;
    padding-bottom: 120px; 
}

.tile {
    background: transparent;
    border: none;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Der bildfreie Icon-Container */
.tile .icon {
    position: relative; /* WICHTIG: Damit das Badge weiß, wo es sich anheften soll */
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 22%; 
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.1s ease;
    
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 5px rgba(0,0,0,0.4);
    letter-spacing: 0.5px;
}

/* --- DAS NEUE HLS-BADGE --- */
.tile[data-url*=".m3u8"] .icon::after {
    content: "HLS";
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #34c759; /* iOS System-Grün */
    color: white;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    border: 2px solid var(--bg-color); /* Schwarzer Rand als Trenner */
    text-shadow: none; /* Hebt den Textschatten vom Icon auf */
    letter-spacing: normal;
}
/* -------------------------- */

.tile:active .icon {
    transform: scale(0.92);
}

.tile.active .icon {
    border: 3px solid var(--accent);
}

.tile span {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.bottom-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--player-bg);
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom)); 
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.now-playing-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#now-playing-title {
    font-weight: 600;
    font-size: 1rem;
}

#now-playing-subtitle {
    font-size: 0.8rem;
    color: #8e8e93;
    margin-top: 0.2rem;
}

#toggle-btn {
    background-color: var(--accent);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

#toggle-btn:disabled {
    background-color: #3a3a3c;
    color: #8e8e93;
}