* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #f0d15a;
    --primary-dark: #d4b43f;
    --secondary: #111111;
    --success: #6fdc6f;
    --warning: #f0d15a;
    --danger: #ff5c5c;
    --dark: #0b0b0b;
    --light: #f7f7f7;
    --border: #3a3a3a;
    --text: #151515;
    --text-light: #5f5f5f;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0b0b0b 0%, #151515 60%, #1f1f1f 100%);
    color: var(--text);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: visible;
}

header {
    background: linear-gradient(135deg, #0b0b0b, #191919);
    color: white;
    padding: 40px;
    text-align: center;
    border-bottom: 3px solid var(--primary);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 30px;
}

.tv-section {
    background: #ffffff;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 25px;
    transition: all 0.3s ease;
    min-width: 0;
}

.tv-section:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.tv-header h2 {
    font-size: 1.5em;
    color: var(--dark);
    margin: 0;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.control-group label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95em;
}

.control-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text);
}

.control-group select:hover {
    border-color: var(--primary-dark);
    background: #fff8da;
}

.control-group select:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(240, 209, 90, 0.25);
}

.control-group select[multiple] {
    min-height: 140px;
    padding: 8px;
}

.control-group select[multiple] option {
    padding: 6px;
}

.status-box {
    background: white;
    border: 2px solid var(--border);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.95em;
    min-height: 60px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-box p {
    margin: 0;
}

.preview {
    background: white;
    border: 2px dashed var(--border);
    border-radius: 6px;
    padding: 20px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    text-align: center;
    font-size: 0.95em;
    overflow: auto;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-size: 0.9em;
}

.btn-primary {
    background: var(--primary);
    color: #111;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(212, 180, 63, 0.35);
}

footer {
    background: #f3f4f6;
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid var(--border);
    font-size: 0.9em;
    color: var(--text-light);
}

footer p {
    margin: 5px 0;
}

.status-disconnected {
    color: var(--danger);
    font-weight: 600;
}

.status-connected {
    color: var(--success);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2em;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 8px;
    }
    
    header {
        padding: 25px;
    }
    
    .main-grid {
        padding: 15px;
        gap: 15px;
    }
    
    .tv-section {
        padding: 16px;
    }

    .tv-header {
        align-items: stretch;
    }

    .tv-header .btn {
        width: 100%;
        text-align: center;
    }

    .controls {
        grid-template-columns: minmax(0, 1fr);
    }

    .control-group select[multiple] {
        min-height: 170px;
    }
}
