* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #222;
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: fixed;
    touch-action: pan-y;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Grundriss-Bereich (80%) */
.arena {
    width: 80%;
    height: 100vh;
    position: relative;
    background-image: url('arena-grundriss.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #1a1a1a;
}

/* Sidebar (20%) */
.sidebar {
    width: 20%;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    padding: 30px 20px;
    overflow-y: auto;
    border-left: 3px solid #00bcd4;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
}

.sidebar h1 {
    color: #00bcd4;
    margin-bottom: 30px;
    font-size: 1.4rem;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Raum-Kacheln */
.room-tile {
    position: absolute;
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.9), rgba(0, 151, 167, 0.9));
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1rem;
    min-width: 100px;
    min-height: 50px;
    padding: 12px 16px;
    user-select: none;
}

.room-tile:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 188, 212, 0.6);
    background: linear-gradient(135deg, rgba(38, 198, 218, 0.95), rgba(0, 172, 193, 0.95));
}

.room-tile:active {
    transform: translateY(-1px) scale(1.02);
}

.room-tile.active {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9), rgba(56, 142, 60, 0.9));
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.5);
    border-color: rgba(255, 255, 255, 0.5);
}

.room-tile.active:hover {
    background: linear-gradient(135deg, rgba(102, 187, 106, 0.95), rgba(76, 175, 80, 0.95));
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.7);
}

/* Slider-Gruppen */
.slider-group {
    margin-bottom: 35px;
    padding: 20px;
    background: rgba(42, 42, 42, 0.8);
    border-radius: 15px;
    border: 1px solid rgba(0, 188, 212, 0.3);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.slider-label {
    display: block;
    margin-bottom: 12px;
    color: #00bcd4;
    font-weight: 600;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slider-container {
    position: relative;
    margin-bottom: 10px;
    height: 10px;
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: #444;
    outline: none;
    position: relative;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #00bcd4;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 188, 212, 0.5);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    background: #26c6da;
    transform: scale(1.15);
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.7);
}

.slider::-webkit-slider-thumb:active {
    transform: scale(1.05);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #00bcd4;
    cursor: pointer;
    border: none;
    box-shadow: 0 3px 10px rgba(0, 188, 212, 0.5);
    transition: all 0.2s ease;
}

.slider::-moz-range-thumb:hover {
    background: #26c6da;
    transform: scale(1.15);
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.7);
}

.slider-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 10px;
    background: linear-gradient(90deg, #00bcd4, #26c6da);
    border-radius: 5px;
    pointer-events: none;
    transition: width 0.2s ease;
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.5);
}

.slider-value {
    display: block;
    color: #fff;
    font-weight: 600;
    font-size: 1.2rem;
    text-align: center;
    margin-top: 8px;
}

/* Status Bar */
.status-bar {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 188, 212, 0.3);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(42, 42, 42, 0.8);
    margin-bottom: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f44336;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #4caf50;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 0.9rem;
    color: #ccc;
}

.update-status {
    font-size: 0.8rem;
    color: #00bcd4;
    text-align: center;
    padding: 8px;
}

/* Settings Button */
.settings-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 188, 212, 0.9);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.4);
}

.settings-btn:hover {
    background: rgba(38, 198, 218, 0.9);
    transform: rotate(90deg);
    box-shadow: 0 6px 20px rgba(0, 188, 212, 0.6);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #2a2a2a;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    border: 2px solid #00bcd4;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    color: #00bcd4;
    margin-bottom: 30px;
    font-size: 1.6rem;
    text-align: center;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: #00bcd4;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 15px;
    border: 1px solid #444;
    border-radius: 10px;
    background: #333;
    color: white;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #00bcd4;
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.2);
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #00bcd4;
    color: white;
}

.btn-primary:hover {
    background: #26c6da;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.4);
}

.btn-secondary {
    background: #666;
    color: white;
}

.btn-secondary:hover {
    background: #777;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #00bcd4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-overlay p {
    color: white;
    font-size: 1.2rem;
}

/* Responsive - iPad Portrait */
@media (max-width: 1024px) and (orientation: portrait) {
    .container {
        flex-direction: column;
    }
    
    .arena {
        width: 100%;
        height: 60vh;
    }
    
    .sidebar {
        width: 100%;
        height: 40vh;
        border-left: none;
        border-top: 3px solid #00bcd4;
    }
    
    .sidebar h1 {
        font-size: 1.2rem;
        margin-bottom: 20px;
    }
    
    .slider-group {
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .room-tile {
        font-size: 0.9rem;
        min-width: 80px;
        min-height: 40px;
    }
}

/* iPad Pro */
@media (min-width: 1024px) and (max-width: 1366px) {
    .sidebar {
        width: 25%;
    }
    
    .arena {
        width: 75%;
    }
}

/* iPad Mini */
@media (max-width: 768px) {
    .settings-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .slider-group {
        padding: 12px;
    }
    
    .slider-label {
        font-size: 0.95rem;
    }
}