:root {
    color-scheme: dark;

    --background: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --text-soft: #94a3b8;
    --primary: #3b82f6;
    --success: #4ade80;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--background);
    color: var(--text);
    font-family: system-ui, sans-serif;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header h1 {
    margin: 0;
    font-size: 24px;
}

.header p {
    margin: 4px 0 0;
    color: var(--text-soft);
    font-size: 13px;
}

.status {
    color: var(--success);
    font-size: 13px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
}

button {
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
}

button:hover {
    background: #334155;
}

button.active {
    background: var(--primary);
    border-color: var(--primary);
}

#scene-container {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#scene-container canvas {
    display: block;
    touch-action: none;
}

.footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 24px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 12px;
}

@media (max-width: 600px) {
    .header {
        padding: 12px;
    }

    .header h1 {
        font-size: 20px;
    }

    .toolbar {
        padding: 10px;
        gap: 6px;
    }

    button {
        padding: 8px 10px;
    }

    .footer {
        padding: 8px 12px;
    }
}


/* ==================================
   PANNEAU EQUIPEMENTS DOMOTIQUES
   ================================== */

.equipment-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 20;

    width: 310px;
    max-width: calc(100% - 32px);
    max-height: calc(100% - 32px);

    overflow-y: auto;

    padding: 18px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;

    box-shadow: 0 12px 35px
        rgba(0, 0, 0, 0.35);
}

.equipment-panel[hidden],
#equipment-content[hidden] {
    display: none !important;
}

.equipment-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.equipment-header h2 {
    margin: 4px 0 0;
    font-size: 19px;
}

.equipment-eyebrow {
    color: #93c5fd;
    font-size: 10px;
    letter-spacing: 1.2px;
    font-weight: 600;
}

#equipment-close {
    padding: 5px 10px;
}

.equipment-mode {
    margin: 14px 0;
    font-size: 12px;
    color: #fbbf24;
}

.equipment-panel label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-soft);
}

#equipment-select {
    width: 100%;
    padding: 10px;
    background: var(--background);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
}

.equipment-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin: 18px 0 12px;
}

.equipment-state span {
    font-size: 13px;
    color: var(--text-soft);
}

.equipment-state strong {
    font-size: 36px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.equipment-shutter-preview {
    display: flex;
    justify-content: center;
    padding: 8px;
}

.equipment-window {
    position: relative;
    width: 100px;
    height: 100px;
    overflow: hidden;
    border: 5px solid #d5d8d8;
    border-top-width: 10px;
    border-radius: 3px;

    background: linear-gradient(
        135deg,
        #9ec7dc,
        #547c95
    );
}

.equipment-window::before {
    content: '';
    position: absolute;
    left: calc(50% - 2px);
    top: 0;
    bottom: 0;
    width: 4px;
    background: #e2e8f0;
}

#equipment-curtain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;

    background: repeating-linear-gradient(
        to bottom,
        #e5e7eb 0,
        #e5e7eb 6px,
        #aeb1b5 7px,
        #aeb1b5 8px
    );
}

#equipment-range {
    width: 100%;
    margin: 15px 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.equipment-actions {
    display: grid;
    grid-template-columns: repeat(
        3, minmax(0, 1fr)
    );
    gap: 6px;
}

.equipment-actions button {
    padding: 10px 4px;
}

.equipment-note {
    margin: 16px 0 0;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-soft);
}

@media (max-width: 600px) {

    .equipment-panel {
        top: auto;
        bottom: 8px;
        left: 8px;
        right: 8px;
        width: auto;
        max-width: none;
        max-height: 85%;
        padding: 14px;
    }

    .equipment-header h2 {
        font-size: 17px;
    }

    .equipment-shutter-preview {
        display: none;
    }

    .equipment-state {
        margin: 10px 0;
    }

    .equipment-state strong {
        font-size: 28px;
    }

}
