/* ==========================================================================
   DADDYKEYS — Ultra-Performant Glassmorphism & Cyber Vault Styling
   Optimisé pour 60/120 FPS constants sans saccades ni surchauffe GPU
   ========================================================================== */

:root {
    --bg-dark: #0a0c14;
    --glass-bg: rgba(18, 22, 36, 0.75);
    --glass-card: rgba(24, 28, 48, 0.65);
    --glass-input: rgba(12, 16, 28, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-focus: rgba(99, 102, 241, 0.5);
    --glass-highlight: rgba(255, 255, 255, 0.1);
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --cyan: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.35);
    --emerald: #10b981;
    --emerald-glow: rgba(16, 185, 129, 0.35);
    --rose: #f43f5e;
    --rose-glow: rgba(244, 63, 94, 0.35);
    --amber: #f59e0b;
    --amber-glow: rgba(245, 158, 11, 0.35);
    --purple: #a855f7;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(99, 102, 241, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 90% 90%, rgba(244, 63, 94, 0.10) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 55%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Grille de fond cybernétique ultra-légère */
.grid-overlay {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 1;
}

/* Structure Principale */
.app-container {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px 48px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 100vh;
}

/* Glassmorphism Classes de base */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35), inset 0 1px 1px var(--glass-highlight);
    border-radius: 24px;
}

.glass-card {
    background: var(--glass-card);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* En-tête Glass UI */
.glass-header {
    background: rgba(18, 22, 36, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3), inset 0 1px 0 var(--glass-highlight);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
    border: 1px solid rgba(168, 85, 247, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon {
    width: 22px;
    height: 22px;
    color: #fff;
    filter: drop-shadow(0 0 6px var(--primary-glow));
}

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

.brand-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gradient-text {
    background: linear-gradient(135deg, #a5b4fc, #c084fc, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.version-tag {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.device-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.secret-trigger {
    cursor: pointer;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.25);
    transition: var(--transition-smooth);
}

.secret-trigger:hover {
    color: var(--cyan);
    border-bottom-color: var(--cyan);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emerald);
    box-shadow: 0 0 8px var(--emerald);
}

.status-dot.pulsating {
    animation: statusPulse 2s infinite ease-in-out;
}

@keyframes statusPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

/* Télémétrie hardware factice */
.hardware-telemetry {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(10, 14, 26, 0.5);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 14px;
}

.telemetry-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.telemetry-icon {
    width: 16px;
    height: 16px;
    color: var(--cyan);
}

.tamper-badge {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 3px 8px;
    border-radius: 8px;
    color: #34d399;
    font-size: 0.72rem;
    font-weight: 700;
}

.shield-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    display: inline-block;
    box-shadow: 0 0 6px #34d399;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Bouton de langue EN/FR */
.lang-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.lang-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.lang-toggle-btn svg {
    width: 16px;
    height: 16px;
    color: var(--cyan);
}

/* Boutons Glassmorphism */
.glass-btn {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: var(--transition-smooth);
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.glass-btn:active {
    transform: translateY(1px);
}

.glass-btn.primary-glow {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.85), rgba(139, 92, 246, 0.85));
    border-color: rgba(165, 180, 252, 0.4);
    box-shadow: 0 4px 16px var(--primary-glow);
}

.glass-btn.primary-glow:hover {
    box-shadow: 0 6px 22px rgba(99, 102, 241, 0.55);
}

.glass-btn.danger-glow {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.85), rgba(225, 29, 72, 0.85));
    border-color: rgba(254, 202, 202, 0.3);
    box-shadow: 0 4px 16px var(--rose-glow);
}

.glass-btn.danger-glow:hover {
    box-shadow: 0 6px 22px rgba(239, 68, 68, 0.6);
}

.glass-btn.success-glow {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.85), rgba(5, 150, 105, 0.85));
    border-color: rgba(167, 243, 208, 0.3);
    box-shadow: 0 4px 16px var(--emerald-glow);
}

.glass-btn.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.glass-btn.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.09);
}

.glass-btn.danger-outline {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.glass-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.glass-icon-btn svg {
    width: 18px;
    height: 18px;
}

.glass-icon-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Disposition Principale */
.main-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 24px;
    align-items: stretch;
}

/* ==========================================================================
   COLONNE 1 : La Boîte Sécurisée 3D (Pur Code CSS / SVG)
   ========================================================================== */
.box-stage-card {
    display: flex;
    flex-direction: column;
    padding: 28px;
    position: relative;
    overflow: hidden;
}

.stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    z-index: 5;
    flex-wrap: wrap;
    gap: 10px;
}

.stage-badges-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
    transition: var(--transition-smooth);
}

.pill-badge .badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
}

.badge-icon {
    width: 14px;
    height: 14px;
}

.pill-badge.locked {
    background: rgba(244, 63, 94, 0.14);
    border-color: rgba(244, 63, 94, 0.45);
    color: #fb7185;
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.25);
}

.pill-badge.countdown-active {
    background: rgba(168, 85, 247, 0.14);
    border-color: rgba(168, 85, 247, 0.45);
    color: #c084fc;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.25);
}

/* Badge Capteur de Présence de Clé */
.key-badge.key-detected {
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(6, 182, 212, 0.35);
    color: #38bdf8;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.key-badge.key-missing {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.secure-protocol {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* Viewport 3D de la boîte */
.box-viewport {
    position: relative;
    width: 100%;
    height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
    margin: 8px 0 16px;
}

#particlesCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.box-3d {
    position: relative;
    width: 340px;
    height: 340px;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
    will-change: transform;
}

/* Châssis métallique du coffre */
.box-chassis {
    width: 100%;
    height: 100%;
    border-radius: 34px;
    background: linear-gradient(145deg, #181d2e 0%, #0d101c 100%);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.65),
        inset 0 2px 4px rgba(255, 255, 255, 0.12),
        inset 0 -4px 10px rgba(0, 0, 0, 0.8);
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.08);
    padding: 14px;
}

.box-face.front {
    width: 100%;
    height: 100%;
    border-radius: 24px;
    background: radial-gradient(circle at 50% 30%, #1c2237 0%, #0e111d 85%);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.6);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    overflow: hidden;
}

/* Bordure laser lumineuse de scellé */
.laser-border {
    position: absolute;
    inset: 6px;
    border-radius: 18px;
    border: 2px solid var(--emerald);
    opacity: 0.6;
    box-shadow: 0 0 12px var(--emerald), inset 0 0 12px var(--emerald);
    pointer-events: none;
    transition: var(--transition-smooth);
}

.box-3d.locked .laser-border {
    border-color: var(--rose);
    opacity: 0.85;
    box-shadow: 0 0 18px var(--rose), inset 0 0 18px var(--rose);
}

/* Pênes motorisés */
.motorized-bolt {
    position: absolute;
    top: 50%;
    width: 40px;
    height: 66px;
    background: linear-gradient(to bottom, #818cf8, #4f46e5, #312e81);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3), inset 0 2px 2px rgba(255, 255, 255, 0.5);
    transform: translateY(-50%);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

.bolt-left {
    left: -18px;
    transform: translateY(-50%) translateX(-25px);
}

.bolt-right {
    right: -18px;
    transform: translateY(-50%) translateX(25px);
}

.box-3d.locked .bolt-left {
    transform: translateY(-50%) translateX(10px);
    background: linear-gradient(to bottom, #fb7185, #e11d48, #881337);
    box-shadow: 0 0 16px var(--rose-glow), inset 0 2px 2px rgba(255, 255, 255, 0.5);
}

.box-3d.locked .bolt-right {
    transform: translateY(-50%) translateX(-10px);
    background: linear-gradient(to bottom, #fb7185, #e11d48, #881337);
    box-shadow: 0 0 16px var(--rose-glow), inset 0 2px 2px rgba(255, 255, 255, 0.5);
}

/* Fenêtre de visualisation du coffre */
.vault-window {
    width: 100%;
    height: 160px;
    border-radius: 16px;
    background: rgba(5, 7, 15, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.85);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vault-window::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 45%);
    pointer-events: none;
    z-index: 4;
}

.grid-mesh {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 14px 14px;
    opacity: 0.35;
    pointer-events: none;
}

.vault-interior {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

/* Clé détectée */
.stored-key-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    transition: var(--transition-smooth);
}

.item-halo {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.3) 0%, transparent 70%);
    transition: var(--transition-smooth);
}

.box-3d.locked .item-halo {
    background: radial-gradient(circle, rgba(244, 63, 94, 0.35) 0%, transparent 70%);
}

.master-key-svg {
    width: 80px;
    height: 80px;
    color: #6ee7b7;
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.5));
    transition: var(--transition-smooth);
}

.box-3d.locked .master-key-svg {
    color: #fda4af;
    filter: drop-shadow(0 0 10px rgba(244, 63, 94, 0.65));
}

.hologram-scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.7), transparent);
    animation: scanAnim 3s linear infinite;
    pointer-events: none;
}

@keyframes scanAnim {
    0% { top: 0%; opacity: 0; }
    30% { opacity: 0.8; }
    70% { opacity: 0.8; }
    100% { top: 100%; opacity: 0; }
}

/* Chambre vide (Clé absente / non détectée) */
.empty-chamber-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: fadeInEmpty 0.3s ease;
}

@keyframes fadeInEmpty {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.empty-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px dashed rgba(245, 158, 11, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--amber);
}

.empty-icon-box svg {
    width: 26px;
    height: 26px;
}

.empty-chamber-title {
    font-size: 0.82rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: #fde68a;
    letter-spacing: 0.5px;
}

.empty-chamber-sub {
    font-size: 0.68rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* Cadran motorisé rotatif central */
.vault-dial-container {
    position: relative;
    margin-top: 8px;
    z-index: 5;
}

.vault-dial {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: linear-gradient(135deg, #242b45, #121626);
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.55),
        inset 0 2px 3px rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dial-core {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0f1322;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dial-lock-icon {
    width: 24px;
    height: 24px;
    color: var(--emerald);
    transition: var(--transition-smooth);
}

.box-3d.locked .dial-lock-icon {
    color: var(--rose);
}

.dial-indicator {
    position: absolute;
    top: 5px;
    width: 4px;
    height: 9px;
    border-radius: 2px;
    background: var(--emerald);
    box-shadow: 0 0 6px var(--emerald);
    transition: var(--transition-smooth);
}

.box-3d.locked .dial-indicator {
    background: var(--rose);
    box-shadow: 0 0 8px var(--rose);
}

.box-3d.locked .vault-dial {
    transform: rotate(180deg);
}

/* Barre d'actionneur et capteurs physiques */
.actuator-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.sensor-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
}

#ledActuator {
    background: var(--cyan);
}

#ledKeySensor {
    background: var(--cyan);
    box-shadow: 0 0 6px var(--cyan);
    transition: var(--transition-smooth);
}

#ledKeySensor.missing {
    background: var(--amber);
    box-shadow: 0 0 6px var(--amber);
}

.box-3d.locked #ledActuator {
    background: var(--rose);
    box-shadow: 0 0 6px var(--rose);
}

.actuator-label {
    font-size: 0.60rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    letter-spacing: 0.8px;
}

/* Statut & Compteur */
.lock-summary-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 8px;
    gap: 6px;
}

.status-headline {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    transition: var(--transition-smooth);
}

.status-subline {
    font-size: 0.84rem;
    color: var(--text-secondary);
    max-width: 420px;
}

/* Minuteur Déroulant */
.countdown-widget {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.countdown-circle-wrap {
    position: relative;
    width: 74px;
    height: 74px;
}

.countdown-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 7;
}

.circle-progress {
    fill: none;
    stroke: var(--purple);
    stroke-width: 7;
    stroke-linecap: round;
    stroke-dasharray: 339.29;
    stroke-dashoffset: 0;
    filter: drop-shadow(0 0 5px var(--purple));
    transition: stroke-dashoffset 0.8s ease;
}

.countdown-center-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.time-label {
    font-size: 0.52rem;
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0 4px;
}

.countdown-units {
    display: flex;
    align-items: center;
    gap: 8px;
}

.unit-box {
    background: rgba(14, 18, 32, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.09);
    padding: 6px 10px;
    border-radius: 12px;
    min-width: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.unit-val {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 800;
    color: #e0e7ff;
}

.unit-tag {
    font-size: 0.56rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.unit-sep {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--purple);
    margin-top: -10px;
}

/* ==========================================================================
   COLONNE 2 : Panneau de Contrôle (Sub / Maître)
   ========================================================================== */
.control-stage-card {
    display: flex;
    flex-direction: column;
}

.panel-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 16px;
}

.header-titles h3 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.header-titles p {
    font-size: 0.80rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

.role-tag {
    font-size: 0.70rem;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.sub-tag {
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.35);
    color: var(--cyan);
}

.master-tag {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.45);
    color: #a5b4fc;
}

/* Section secrète de contrôle de clé */
.key-override-card {
    border-color: rgba(6, 182, 212, 0.25);
    background: rgba(14, 20, 36, 0.75);
}

.secret-link-box {
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.secret-link-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.secret-icon {
    width: 16px;
    height: 16px;
    color: var(--cyan);
}

.secret-link-title {
    font-size: 0.76rem;
    font-weight: 700;
    color: #e0e7ff;
}

.secret-shortcuts-list {
    list-style: none;
    font-size: 0.74rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 4px;
}

.secret-shortcuts-list code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--cyan);
    font-family: var(--font-mono);
}

.secret-shortcuts-list a {
    color: var(--cyan);
    text-decoration: underline;
    font-family: var(--font-mono);
}

/* Règle Sub : Quota d'ouverture */
.rule-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rule-title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.rule-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan);
    flex-shrink: 0;
}

.rule-icon-box svg {
    width: 18px;
    height: 18px;
}

.rule-headline {
    font-size: 0.92rem;
    font-weight: 700;
}

.rule-desc {
    font-size: 0.80rem;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.4;
}

.rule-status-meter {
    background: rgba(10, 14, 26, 0.5);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.meter-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.80rem;
    font-weight: 600;
}

.meter-value {
    color: var(--cyan);
    font-family: var(--font-mono);
}

.progress-bar-track {
    width: 100%;
    height: 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--cyan), var(--primary));
    box-shadow: 0 0 8px var(--cyan-glow);
    transition: width 0.4s ease;
}

.meter-cooldown {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* Console de télémétrie matérielle */
.terminal-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(8, 10, 18, 0.65);
}

.terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
}

.terminal-dots {
    display: flex;
    gap: 5px;
}

.terminal-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.terminal-dots span:nth-child(1) { background: #ef4444; }
.terminal-dots span:nth-child(2) { background: #f59e0b; }
.terminal-dots span:nth-child(3) { background: #10b981; }

.terminal-title {
    font-size: 0.70rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.terminal-body {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
    height: 130px;
    overflow-y: auto;
    padding-right: 4px;
}

.terminal-body::-webkit-scrollbar {
    width: 4px;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.log-line {
    line-height: 1.4;
    word-break: break-all;
}

.log-t {
    color: var(--text-muted);
    font-weight: 700;
}

.log-line.info { color: #94a3b8; }
.log-line.success { color: #34d399; }
.log-line.warn { color: #fcd34d; }
.log-line.error { color: #f87171; }

/* Commandes Maître */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.action-large {
    padding: 14px 12px;
    font-size: 0.88rem;
    font-weight: 700;
    flex-direction: column;
    gap: 8px;
}

.action-large svg {
    width: 22px;
    height: 22px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.setting-title {
    font-size: 0.92rem;
    font-weight: 700;
}

.setting-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.4;
}

/* Formulaires & Inputs Glassmorphism */
.glass-input {
    background: var(--glass-input);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.86rem;
    padding: 9px 12px;
    outline: none;
    transition: var(--transition-smooth);
    width: 100%;
}

.glass-input:focus {
    border-color: var(--glass-border-focus);
    box-shadow: 0 0 12px var(--primary-glow);
}

.glass-input.pin-input {
    font-family: var(--font-mono);
    letter-spacing: 6px;
    text-align: center;
    font-size: 1.05rem;
}

.timer-inputs-grid, .inputs-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.input-block {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-block label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.timer-actions-row, .pin-change-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-svg {
    width: 16px;
    height: 16px;
}

.apply-btn {
    margin-top: 10px;
    align-self: flex-start;
}

/* Switch Toggle Glass */
.glass-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.glass-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    transition: var(--transition-smooth);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.glass-toggle input:checked + .toggle-slider {
    background: var(--primary);
    border-color: rgba(255, 255, 255, 0.3);
}

.glass-toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.sub-rule-config {
    transition: opacity 0.3s ease;
}

/* ==========================================================================
   MODALE DU CODE PIN MAÎTRE (4 CHIFFRES)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 16, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pin-modal-card {
    width: 90%;
    max-width: 400px;
    padding: 28px 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.modal-close-btn:hover {
    color: #fff;
}

.shield-icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(168, 85, 247, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: #c084fc;
}

.shield-icon-circle svg {
    width: 24px;
    height: 24px;
}

.modal-icon-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.modal-icon-header p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
    max-width: 300px;
}

/* Bulles du PIN */
.pin-display {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 20px 0 8px;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    transition: var(--transition-smooth);
}

.pin-dot.filled {
    background: var(--primary);
    border-color: #a5b4fc;
    box-shadow: 0 0 10px var(--primary-glow);
    transform: scale(1.15);
}

.pin-error-text {
    font-size: 0.80rem;
    font-weight: 600;
    color: var(--rose);
    height: 18px;
    opacity: 0;
    transition: opacity 0.2s;
}

.pin-error-text.visible {
    opacity: 1;
}

/* Clavier Numérique Virtuel */
.numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 260px;
    margin-top: 8px;
}

.numpad-btn {
    font-family: var(--font-sans);
    font-size: 1.3rem;
    font-weight: 700;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.numpad-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.numpad-btn:active {
    background: rgba(99, 102, 241, 0.3);
}

.numpad-btn.special {
    font-size: 1.05rem;
    color: var(--text-muted);
}

.modal-hint {
    margin-top: 16px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.modal-hint strong {
    color: var(--text-secondary);
}

/* Notifications Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    background: rgba(18, 22, 36, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 18px;
    color: #fff;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.25s ease, toastOut 0.3s ease 3.6s forwards;
}

.toast.success { border-color: rgba(16, 185, 129, 0.4); }
.toast.danger { border-color: rgba(244, 63, 94, 0.4); }
.toast.info { border-color: rgba(99, 102, 241, 0.4); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Responsive */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .hardware-telemetry {
        display: none;
    }

    .timer-inputs-grid, .inputs-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .app-container {
        padding: 14px;
    }

    .glass-header {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        justify-content: space-between;
    }

    .box-viewport {
        height: 320px;
    }

    .box-3d {
        width: 280px;
        height: 280px;
    }
}
