:root {
    --primary-color: #e10600;
    --secondary-color: #15151e;
    --background-dark: #0d0d0d;
    --background-light: #1a1a1a;
    --text-light: #ffffff;
    --text-muted: #b0b0b0;
    --border-color: #e10600;
    --success-color: #00d800;
    --warning-color: #ffa500;
    --error-color: #e10600;
    --accent-yellow: #ffd700;
    --carbon-fiber: #2a2a2a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Formula1', 'Arial Black', 'Impact', sans-serif;
    background: linear-gradient(135deg, var(--background-dark) 0%, #15151e 100%);
    color: var(--text-light);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(225, 6, 0, 0.03) 2px, rgba(225, 6, 0, 0.03) 4px),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(225, 6, 0, 0.03) 2px, rgba(225, 6, 0, 0.03) 4px);
    pointer-events: none;
    z-index: 0;
}

header {
    background: linear-gradient(90deg, var(--secondary-color) 0%, #1a1a24 100%);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    border-bottom: 3px solid var(--primary-color);
    position: relative;
    z-index: 1000;
    overflow: visible;
}

header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, 
        var(--primary-color) 0%, 
        var(--accent-yellow) 25%, 
        var(--primary-color) 50%,
        var(--accent-yellow) 75%,
        var(--primary-color) 100%);
    background-size: 200% 100%;
    animation: racingLine 3s linear infinite;
}

@keyframes racingLine {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.8rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.logo-img {
    height: 2.5rem;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(225, 6, 0, 0.5));
}

.logo span {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-yellow));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#header-message {
    flex: 1;
    text-align: center;
    max-width: 50%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    color: var(--text-muted);
    font-size: 0.9rem;
}

#header-message.scrolling {
    animation: marquee 15s linear infinite;
}

@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.nav-buttons button {
    background: linear-gradient(135deg, var(--carbon-fiber) 0%, #1a1a1a 100%);
    border: 2px solid var(--border-color);
    color: var(--text-light);
    padding: 0.6rem 1.5rem;
    border-radius: 0;
    cursor: pointer;
    margin-left: 0.5rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.nav-buttons button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(225, 6, 0, 0.3), transparent);
    transition: left 0.5s ease;
}

.nav-buttons button:hover::before {
    left: 100%;
}

.nav-buttons button:hover {
    border-color: var(--accent-yellow);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(225, 6, 0, 0.4);
}

.nav-buttons button.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #c70500 100%);
    border-color: var(--accent-yellow);
    box-shadow: 0 0 20px rgba(225, 6, 0, 0.6);
}

main {
    padding: 1rem;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    padding-bottom: 3rem;
}

.player-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 1200px) {
    .player-container {
        flex-direction: column;
    }
}

.server-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.server-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color), var(--accent-yellow));
}

.server-title {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
    color: var(--text-light);
    text-align: center;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-yellow));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.server-tabs {
    display: flex;
    margin-bottom: 0.5rem;
    background: var(--background-light);
    padding: 0.25rem;
    border-radius: 8px;
}

.server-tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.server-tab:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.server-tab.active {
    background-color: var(--primary-color);
}

.video-container {
    position: relative;
    width: 100%;
    background-color: #000;
    border-radius: 0;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
    margin-top: 0.5rem;
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 30px rgba(225, 6, 0, 0.5);
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.media-status {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.5rem;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 0.5rem;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
}

.status-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.status-active {
    background-color: var(--success-color);
    box-shadow: 0 0 5px var(--success-color);
}

.status-inactive {
    background-color: var(--error-color);
    box-shadow: 0 0 5px var(--error-color);
}

.channel-navigation {
    background: var(--background-light);
    border-radius: 8px;
    padding: 0.5rem;
    margin-top: 0.5rem;
    flex: 1;
}

.group-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.group-tab {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--carbon-fiber), var(--background-dark));
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: bold;
    border: 2px solid #333;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.group-tab:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(225, 6, 0, 0.4);
}

.group-tab.active {
    background: linear-gradient(135deg, var(--primary-color), #c70500);
    border-color: var(--accent-yellow);
    box-shadow: 0 0 15px rgba(225, 6, 0, 0.7);
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(3.5rem, 1fr));
    gap: 0.25rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.25rem;
    scroll-behavior: smooth;
}

.channel-grid-container {
    background: linear-gradient(135deg, var(--background-light) 0%, var(--carbon-fiber) 100%);
    border-radius: 0;
    padding: 0.5rem;
    margin-top: 0.5rem;
    flex: 1;
    border: 2px solid var(--primary-color);
    box-shadow: inset 0 0 20px rgba(225, 6, 0, 0.1);
}

.channels-grid::-webkit-scrollbar {
    width: 6px;
}

.channels-grid::-webkit-scrollbar-track {
    background: var(--background-dark);
    border-radius: 3px;
}

.channels-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.channel-item {
    text-align: center;
    padding: 0.5rem 0.25rem;
    background: linear-gradient(135deg, var(--carbon-fiber), var(--background-dark));
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: bold;
    border: 1px solid #333;
    position: relative;
    overflow: hidden;
}

.channel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(225, 6, 0, 0.3), transparent);
    transition: left 0.4s ease;
}

.channel-item:hover::before {
    left: 100%;
}

.channel-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(225, 6, 0, 0.5);
}

.channel-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #c70500 100%);
    font-weight: 900;
    border-color: var(--accent-yellow);
    box-shadow: 0 0 20px rgba(225, 6, 0, 0.8);
    color: var(--accent-yellow);
}

.settings-container {
    display: block;
    max-width: 800px;
    margin: 0 auto;
}

.settings-section {
    background: linear-gradient(135deg, var(--background-light), var(--carbon-fiber));
    padding: 1rem;
    border-radius: 0;
    margin-bottom: 1rem;
    border: 2px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.settings-title {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-yellow));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

input, select {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--background-dark), #0a0a0a);
    border: 2px solid #333;
    border-radius: 0;
    color: var(--text-light);
    transition: all 0.3s ease;
    font-weight: 600;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(225, 6, 0, 0.5);
    background: var(--background-dark);
}

.url-structure {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.url-part {
    flex: 1;
}

.channel-override {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.channel-input {
    width: 100px;
}

button {
    background: linear-gradient(135deg, var(--primary-color), #c70500);
    color: var(--text-light);
    border: 2px solid var(--accent-yellow);
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.4), transparent);
    transition: left 0.5s ease;
}

button:hover::before {
    left: 100%;
}

button:hover {
    box-shadow: 0 0 20px rgba(225, 6, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4);
    transform: translateY(-2px);
}

.buttons-row {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

#cancel-settings {
    background-color: transparent;
    border: 1px solid var(--border-color);
}

.save-indicator {
    margin-top: 1rem;
    position: fixed;
    top: 2%;
    left: 85%;
    padding: 1rem;
    border-radius: 4px;
    background-color: var(--success-color);
    display: none;
    animation: fadeIn 0.3s ease;
}

/* Source Management Styles */
.add-source-btn {
    margin-top: 0.5rem;
    width: 100%;
}

.sources-list {
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid #333;
    background: linear-gradient(135deg, var(--background-dark), #0a0a0a);
}

.source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #333;
    transition: background 0.2s ease;
}

.source-item:hover {
    background: rgba(225, 6, 0, 0.1);
}

.source-info {
    flex: 1;
}

.source-name {
    font-weight: bold;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.source-id {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.source-delete {
    background: linear-gradient(135deg, var(--error-color), #c70500);
    border: 2px solid var(--accent-yellow);
    color: var(--text-light);
    padding: 0.4rem 0.8rem;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.source-delete:hover {
    box-shadow: 0 0 15px rgba(225, 6, 0, 0.8);
    transform: scale(1.05);
}

/* Dialog Styles */
dialog {
    border: 3px solid var(--primary-color);
    background: linear-gradient(135deg, var(--background-light), var(--carbon-fiber));
    box-shadow: 0 0 40px rgba(225, 6, 0, 0.6);
    padding: 0;
    max-width: 90%;
    min-width: 500px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.85);
}

.dialog-content {
    padding: 2rem;
}

.dialog-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-yellow));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.dialog-buttons button {
    min-width: 100px;
}

/* Sources Dialog Tabs */
.sources-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--text-light);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-box {
    background: linear-gradient(135deg, var(--background-light), var(--carbon-fiber));
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 40px rgba(225, 6, 0, 0.6);
    padding: 2rem;
    min-width: 400px;
    max-width: 90%;
}

.dialog-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-yellow));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== NEW PRESET & MENU STYLES ==================== */

/* Index Page Styles */
.index-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.index-page .container {
    max-width: 1200px;
    width: 100%;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.index-page .header {
    text-align: center;
    margin-bottom: 3rem;
}

.index-page .header-logo {
    height: 4rem;
    width: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px rgba(225, 6, 0, 0.5));
}

.index-page h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-yellow));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.index-page .subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* Preset Grid */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.preset-card {
    background: var(--background-light);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.preset-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(225, 6, 0, 0.3);
    border-color: var(--accent-yellow);
}

.preset-card.selected {
    background: linear-gradient(135deg, rgba(225, 6, 0, 0.2), rgba(255, 215, 0, 0.1));
    border-color: var(--accent-yellow);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.preset-icon {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.preset-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border-color);
    box-shadow: 0 4px 8px rgba(225, 6, 0, 0.3);
    transition: all 0.3s ease;
}

.preset-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preset-card:hover .preset-avatar {
    border-color: var(--accent-yellow);
    box-shadow: 0 6px 12px rgba(255, 215, 0, 0.5);
    transform: scale(1.05);
}

.preset-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.preset-date {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.empty-state, .error-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.error-message {
    color: var(--error-color);
    margin-bottom: 1rem;
}

/* Preset Actions */
.preset-actions {
    background: var(--background-light);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
}

.selected-preset {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--accent-yellow);
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #ff0800;
    box-shadow: 0 4px 8px rgba(225, 6, 0, 0.4);
}

.btn-primary:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--background-light);
    border-color: var(--accent-yellow);
}

.btn-danger {
    background: #8b0000;
    color: white;
}

.btn-danger:hover {
    background: #b30000;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    margin: 0 1rem;
    transition: color 0.3s;
}

.footer-link:hover {
    color: var(--primary-color);
}

.separator {
    color: var(--text-muted);
}

/* 2-Pane Layout (DAZN/GDS) */
.pane-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

.pane {
    background: var(--background-light);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pane-title {
    font-size: 1.5rem;
    text-align: center;
    color: var(--accent-yellow);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* 2x2 Grid Layout (UHD/Mozaic, F1TV/OBC) */
.grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    height: calc(100vh - 80px);
    position: relative;
    z-index: 1;
}

.grid-2x2 .pane {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 0.5rem;
}

.grid-2x2 .pane-title {
    grid-column: 1 / -1;
}

.grid-2x2 .source-grid {
    grid-column: 1;
    grid-row: 2;
    max-height: none;
    height: 100%;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 0.4rem;
}

.grid-2x2 .source-btn {
    padding: 0.3rem 0.2rem;
    font-size: 0.7rem;
    min-height: 35px;
    max-height: 35px;
}

.grid-2x2 .video-wrapper {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: black;
}

.grid-2x2 .video-16-9 {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 100%;
    object-fit: contain;
}

.grid-2x2 .player-controls {
    grid-column: 1 / -1;
    grid-row: 3;
}

/* Source Grid */
.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.3rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.source-btn {
    background: var(--secondary-color);
    color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.4rem 0.3rem;
    font-size: 0.8rem;
    text-align: center;
    min-height: 38px;
    max-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.source-btn:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

.source-btn.playing {
    background: linear-gradient(135deg, #e10600 0%, #ff4444 100%);
    border-color: #ff4444;
    box-shadow: 0 0 15px rgba(225, 6, 0, 0.4);
}

.empty-message {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

/* Video Player */
.video-wrapper {
    flex: 1;
    background: black;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-16-9 {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 100%;
    object-fit: contain;
}

/* Player Controls */
.player-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Settings Page Styles */
.settings-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}

.settings-section {
    background: var(--background-light);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.settings-title {
    font-size: 1.8rem;
    color: var(--accent-yellow);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Preset Selector Group */
.preset-selector-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.preset-selector-group select {
    flex: 1;
    padding: 0.75rem;
    font-size: 1rem;
    background: var(--secondary-color);
    color: white;
    border: 2px solid var(--border-color);
    border-radius: 4px;
}

/* Category Accordion */
.categories-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-item {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.category-header {
    width: 100%;
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 1rem;
    font-size: 1.1rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
}

.category-header:hover {
    background: var(--background-light);
}

.toggle-icon {
    font-size: 0.8rem;
}

.category-content {
    display: none;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-weight: bold;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    background: var(--secondary-color);
    color: white;
    border: 2px solid var(--border-color);
    border-radius: 4px;
}

.manage-sources-btn {
    padding: 0.5rem 1.5rem;
    background: var(--secondary-color);
    color: white;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.manage-sources-btn:hover {
    background: var(--primary-color);
}

.buttons-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Dialogs */
dialog {
    background: var(--background-light);
    border: 3px solid var(--border-color);
    border-radius: 8px;
    color: white;
    padding: 0;
    max-width: 600px;
    width: 90%;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.8);
}

.dialog-content {
    padding: 2rem;
}

.dialog-content h2 {
    color: var(--accent-yellow);
    margin-bottom: 1.5rem;
}

.dialog-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Sources Checklist */
.sources-checklist {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
}

.source-checkbox {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.source-checkbox:hover {
    background: rgba(225, 6, 0, 0.1);
}

.source-checkbox input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Sources List */
.sources-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem;
}

.source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(225, 6, 0, 0.2);
}

.source-item:last-child {
    border-bottom: none;
}

/* Notifications */
.notification {
    position: fixed;
    top: 100px;
    right: -400px;
    background: var(--background-light);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem 1.5rem;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    transition: right 0.3s;
    z-index: 10000;
    max-width: 400px;
}

.notification.show {
    right: 20px;
}

.notification-success {
    border-color: var(--success-color);
}

.notification-error {
    border-color: var(--error-color);
}

.notification-info {
    border-color: var(--border-color);
}

/* Responsive */
@media (max-width: 1024px) {
    .pane-row {
        grid-template-columns: 1fr;
    }
    
    .grid-2x2 {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 1fr);
        height: auto;
    }
}

@media (max-width: 768px) {
    .index-page h1 {
        font-size: 2rem;
    }
    
    .preset-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .source-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* Sources Page Styles */
.sources-section {
    margin-bottom: 2rem;
}

.sources-section-title {
    color: var(--accent-yellow);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.source-info {
    display: flex;
    flex-direction: column;
}

.source-name {
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.25rem;
}

/* Audio Track Modal */
.audio-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.audio-modal.active {
    display: flex;
}

.audio-modal-content {
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.audio-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.audio-modal-title {
    color: var(--accent-yellow);
    font-size: 1.5rem;
    margin: 0;
}

.audio-close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.audio-close-btn:hover {
    color: var(--accent-yellow);
}

.audio-track-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.audio-track-btn {
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.audio-track-btn:hover {
    background: #3a3a3a;
}

.audio-track-btn.active {
    background: linear-gradient(135deg, #e10600 0%, #ff4444 100%);
    border-color: #ff4444;
}

.audio-no-tracks {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.source-id {
    font-size: 0.9rem;
    color: #999;
}

/* User Management Styles */
.users-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-card {
    background: var(--background-light);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-username {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
}

.user-role {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.user-role.admin {
    color: #ffd700;
    font-weight: 600;
}

.user-actions {
    display: flex;
    gap: 0.5rem;
}

.user-actions button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.user-actions button:hover {
    transform: translateY(-2px);
}

.user-actions .edit-btn {
    background: #333;
    color: white;
}

.user-actions .delete-btn {
    background: #e10600;
    color: white;
}

/* User Avatar Dropdown Menu */
.user-menu {
    position: relative;
    display: inline-block;
    z-index: 10000;
}

.username-btn {
    background: transparent;
    border: 2px solid #e10600;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.username-btn:hover {
    background: #e10600;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(225, 6, 0, 0.3);
}

.user-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background: #2a2a2a;
    border: 2px solid #e10600;
    border-radius: 8px;
    min-width: 200px;
    padding: 0.5rem 0.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s;
    overflow: hidden;
}

.user-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.user-dropdown-role {
    padding: 0.5rem;
    font-size: 0.85rem;
    color: #ffd700;
    font-weight: 600;
}

.user-dropdown-divider {
    height: 1px;
    background: #444;
    margin: 0.5rem 0;
}

.user-dropdown-btn {
    display: block;
    width: calc(100% - 15px);
    padding: 0.5rem;
    background: transparent;
    color: var(--text-light);
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
    margin: 0 auto;
    border-radius: 4px;
    box-sizing: border-box;
}

.user-dropdown-btn:hover {
    background: #3a3a3a;
}

.user-dropdown-btn.logout {
    color: #e10600;
    font-weight: 700;
    border-top: 1px solid #444;
}

.user-dropdown-btn.logout:hover {
    background: rgba(225, 6, 0, 0.1);
}

/* Tagline Footer */
.tagline-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 36, 0.95);
    border-top: 2px solid var(--primary-color);
    padding: 0.5rem 1rem;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
    z-index: 500;
    backdrop-filter: blur(5px);
}

/* Attribution Footer (Index Page) */
.attribution-footer {
    margin-top: 2rem;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    font-style: italic;
    text-align: center;
    line-height: 1.3;
    position: relative;
    overflow: hidden;
}

.attribution-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(225, 6, 0, 0.3), transparent);
    animation: attributionShimmer 4s infinite;
}

@keyframes attributionShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.tagline-prefix {
    color: var(--accent-yellow);
    font-weight: 600;
    font-style: normal;
    margin-right: 0.5rem;
}
