/* Basic Setup & Theming Variables */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-gradient-start: #161b22;
    --bg-gradient-end: #0d1117;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --accent-primary: #58a6ff;
    --accent-secondary: #3fb950;
    --card-bg: rgba(22, 27, 34, 0.7);
    --card-border: rgba(56, 139, 253, 0.2);
    --shadow-color: rgba(56, 139, 253, 0.15);
    --modal-bg: #161b22;
    --modal-text: #c9d1d9;
}

body.theme-light {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-gradient-start: #f6f8fa;
    --bg-gradient-end: #ffffff;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --accent-primary: #0969da;
    --accent-secondary: #1a7f37;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(9, 105, 218, 0.1);
    --modal-bg: #ffffff;
    --modal-text: #24292f;
}

body.theme-synthwave {
    --bg-primary: #0d0221;
    --bg-secondary: #1a0a3a;
    --bg-gradient-start: #241b52;
    --bg-gradient-end: #0d0221;
    --text-primary: #f0f0ff;
    --text-secondary: #a6a3d2;
    --accent-primary: #ff00e5;
    --accent-secondary: #00f7ff;
    --card-bg: rgba(42, 23, 94, 0.65);
    --card-border: rgba(0, 247, 255, 0.35);
    --shadow-color: rgba(255, 0, 229, 0.3);
    --modal-bg: #1a0a3a;
    --modal-text: #f0f0ff;
}

body.theme-crimson {
    --bg-primary: #1a0000;
    --bg-secondary: #2f0505;
    --bg-gradient-start: #2f0505;
    --bg-gradient-end: #1a0000;
    --text-primary: #ffd9d9;
    --text-secondary: #d49999;
    --accent-primary: #ff4d4d;
    --accent-secondary: #ff9696;
    --card-bg: rgba(47, 5, 5, 0.7);
    --card-border: rgba(255, 77, 77, 0.3);
    --shadow-color: rgba(255, 77, 77, 0.2);
    --modal-bg: #2f0505;
    --modal-text: #ffd9d9;
}

body.theme-lime {
    --bg-primary: #0a1a0a;
    --bg-secondary: #122a12;
    --bg-gradient-start: #122a12;
    --bg-gradient-end: #0a1a0a;
    --text-primary: #d4ffb8;
    --text-secondary: #92c892;
    --accent-primary: #adff2f;
    --accent-secondary: #e6fae6;
    --card-bg: rgba(18, 42, 18, 0.75);
    --card-border: rgba(173, 255, 47, 0.35);
    --shadow-color: rgba(173, 255, 47, 0.25);
    --modal-bg: #122a12;
    --modal-text: #d4ffb8;
}

/* General Styles */
* { box-sizing: border-box; }

body {
    background: linear-gradient(180deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
    transition: background 0.5s, color 0.5s;
    padding-bottom: 120px; /* Space for the player */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    padding: 18px 0;
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    position: relative;
    z-index: 200;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo img {
    height: 100%;
    max-width: 250px;
    object-fit: contain;
    filter: invert(1);
    mix-blend-mode: difference;
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    gap: 8px;
    z-index: 1; /* Ensure it's clickable */
}

.theme-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.3s;
}
.theme-btn:hover { transform: scale(1.15); }
.theme-btn.active { border-color: var(--accent-primary); transform: scale(1.1); }

#theme-dark { background: #0d1117; }
#theme-light { background: #f6f8fa; }
#theme-synthwave { background: linear-gradient(45deg, #ff00e5, #00f7ff); }
#theme-crimson { background: linear-gradient(45deg, #ff4d4d, #8b0000); }
#theme-lime { background: linear-gradient(45deg, #adff2f, #006400); }

/* Main Content */
main { padding: 28px 0; }
.section-title { font-size: 24px; font-weight: 700; margin: 0 0 20px; }

/* Streams Grid */
.streams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 28px;
}

/* --- Steam Card 3D Effect --- */
.stream-card {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 4px 25px -5px var(--shadow-color);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.1s ease-out, box-shadow 0.3s ease;
}

.stream-card:hover {
    box-shadow: 0 12px 40px -10px var(--shadow-color);
}

.stream-card-artwork {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background-color: #1b1b1b;
    background-size: cover;
    background-position: center;
    border-radius: 10px;
    overflow: hidden;
    transform: translateZ(35px); /* Give depth to the artwork */
}

.play-button {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: var(--accent-secondary);
    color: var(--bg-primary);
    border: 0;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px) translateZ(50px);
    transition: transform 0.3s cubic-bezier(0.215, 0.610, 0.355, 1), opacity 0.3s;
}

.stream-card:hover .play-button {
    transform: translateY(0) translateZ(50px);
    opacity: 1;
}

.stream-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    transform: translateZ(25px); /* Give depth to the text */
}
/* --- End Steam Card Effect --- */

.stream-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
}

.artist-name {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Player Section */
.player-section {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--bg-secondary), 0.8);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border-top: 1px solid var(--card-border);
    padding: 12px 0;
    z-index: 100;
    transition: background 0.5s;
}

.player-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.song-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

#song-artwork {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    background: #222;
}

#song-title { font-weight: 700; }
#song-artist { color: var(--text-secondary); font-size: 13px; }

.player-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

#play-toggle {
    background: var(--accent-primary);
    color: var(--text-primary);
    border: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

/* Custom Volume Slider */
input[type=range].volume {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    background: transparent;
}
input[type=range].volume:focus { outline: none; }
input[type=range].volume::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: background 0.3s;
}
input[type=range].volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    margin-top: -5px;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    transition: background 0.3s;
}
/* Similar styles for moz */
input[type=range].volume::-moz-range-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: background 0.3s;
}
input[type=range].volume::-moz-range-thumb {
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    border: none;
    transition: background 0.3s;
}


/* Footer */
footer {
    padding: 20px 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
}

footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--card-border);
    padding-top: 20px;
}

footer a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s;
}
footer a:hover { text-decoration: underline; color: var(--accent-primary); }

/* Modal */
#modal {
    display: none;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    z-index: 9999;
}
.modal-content {
    max-width: 800px;
    margin: 40px auto;
    background: var(--modal-bg);
    color: var(--modal-text);
    border-radius: 12px;
    overflow: auto;
    max-height: 85%;
    padding: 24px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    border: 1px solid var(--card-border);
}
#modal-close {
    position: absolute;
    right: 12px;
    top: 12px;
    border: 0;
    background: var(--accent-primary);
    color: var(--modal-text);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}
#modal-title { margin-top: 0; }
#modal-body {
    white-space: pre-wrap;
    word-wrap:break-word;
    margin-top: 12px;
    line-height: 1.6;
}
