:root {
    --bg-dark: #090b14;
    --panel-bg: rgba(18, 22, 38, 0.82);
    --panel-border: rgba(255, 255, 255, 0.15);
    --accent-cyan: #00f2fe;
    --accent-magenta: #f43f5e;
    --accent-purple: #8b5cf6;
    --accent-gold: #fbbf24;
    --accent-green: #10b981;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

/* Thème Cyberpunk Neon */
body.theme-cyberpunk {
    --accent-primary: #00f2fe;
    --accent-secondary: #ec4899;
    --glow-color: rgba(0, 242, 254, 0.8);
    --laser-color: #00f2fe;
}

/* Thème Synthwave 80s */
body.theme-synthwave {
    --accent-primary: #ff007f;
    --accent-secondary: #7928ca;
    --glow-color: rgba(255, 0, 127, 0.8);
    --laser-color: #ff007f;
}

/* Thème Céleste / Stardust */
body.theme-celestial {
    --accent-primary: #fbbf24;
    --accent-secondary: #60a5fa;
    --glow-color: rgba(251, 191, 36, 0.8);
    --laser-color: #fbbf24;
}

/* Thème Matrix Numérique */
body.theme-matrix {
    --accent-primary: #10b981;
    --accent-secondary: #059669;
    --glow-color: rgba(16, 185, 129, 0.9);
    --laser-color: #10b981;
    --bg-dark: #020f08;
}

/* Thème Arcade Rétro 8-Bit */
body.theme-arcade8bit {
    --accent-primary: #facc15;
    --accent-secondary: #ef4444;
    --glow-color: rgba(250, 204, 21, 0.9);
    --laser-color: #facc15;
    --bg-dark: #0f051d;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

/* Header & HUD */
header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: linear-gradient(180deg, rgba(9, 11, 20, 0.95) 0%, rgba(9, 11, 20, 0) 100%);
    backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 50;
    pointer-events: auto;
}

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

.brand-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 12px var(--accent-primary, #00f2fe));
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #00f2fe 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text .badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: rgba(0, 242, 254, 0.15);
    color: #00f2fe;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(0, 242, 254, 0.35);
    margin-left: 6px;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
}

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

/* Controls */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-toggle.active {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    border-color: #ec4899;
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.5);
    color: white;
}

.btn-primary {
    background: linear-gradient(135deg, #00f2fe 0%, #0072ff 100%);
    border: none;
    box-shadow: 0 4px 18px rgba(0, 114, 255, 0.45);
}

.btn-primary:hover {
    box-shadow: 0 6px 25px rgba(0, 114, 255, 0.7);
}

.select-control {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    padding: 7px 11px;
    border-radius: 8px;
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.select-control option {
    background: #121626;
    color: white;
}

/* Score & Combo HUD (Mode Guitar Hero) */
.game-hud {
    position: absolute;
    top: 75px;
    left: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 55;
    pointer-events: none;
    transition: opacity 0.3s;
}

.game-hud.hidden {
    opacity: 0;
}

.hud-score-card {
    background: rgba(18, 22, 38, 0.85);
    border: 1px solid rgba(0, 242, 254, 0.4);
    padding: 8px 18px;
    border-radius: 12px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}

.hud-score-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.hud-score-val {
    font-size: 1.6rem;
    font-weight: 900;
    color: #00f2fe;
    text-shadow: 0 0 12px rgba(0, 242, 254, 0.6);
}

.hud-combo-card {
    background: rgba(236, 72, 153, 0.2);
    border: 1px solid rgba(236, 72, 153, 0.5);
    padding: 4px 14px;
    border-radius: 8px;
    backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
}

.hud-combo-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ec4899;
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.8);
}

/* Floating Hit Rating Animation ("PERFECT !", "SUPER !") */
.hit-rating {
    position: absolute;
    pointer-events: none;
    font-size: 1.4rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    z-index: 58;
    transform: translate(-50%, -50%) scale(0.7);
    opacity: 0;
    transition: all 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hit-rating.show {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1.15);
}

.hit-perfect {
    color: #00f2fe;
    text-shadow: 0 0 20px #00f2fe, 0 0 40px #0072ff;
}

.hit-great {
    color: #10b981;
    text-shadow: 0 0 20px #10b981;
}

.hit-miss {
    color: #ef4444;
    text-shadow: 0 0 15px #ef4444;
}

/* Main Canvas Layer */
main {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#webcam-video {
    display: none;
}

#piano-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 10;
}

/* Hand Status */
.hand-status-pill {
    position: absolute;
    top: 75px;
    right: 20px;
    background: rgba(18, 22, 38, 0.85);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    z-index: 55;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    transition: background 0.3s;
}

.status-dot.active {
    background: #10b981;
    box-shadow: 0 0 12px #10b981;
}

/* Song Practice Banner */
.song-banner {
    position: absolute;
    top: 75px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(18, 22, 38, 0.9);
    border: 1px solid rgba(0, 242, 254, 0.35);
    border-radius: 12px;
    padding: 8px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(14px);
    z-index: 55;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.song-banner.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -20px);
}

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

.song-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #00f2fe;
}

.song-step {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.song-next-note {
    font-size: 1.4rem;
    font-weight: 900;
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    padding: 3px 12px;
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.35);
}

/* Floating Settings Panel */
.floating-panel {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(18px);
    padding: 10px 18px;
    border-radius: 16px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
    z-index: 60;
    max-width: 96vw;
    flex-wrap: wrap;
    justify-content: center;
}

.panel-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.panel-group label {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.slider {
    -webkit-appearance: none;
    width: 80px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #00f2fe;
    cursor: pointer;
    box-shadow: 0 0 10px #00f2fe;
    transition: transform 0.1s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 9, 16, 0.88);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background: linear-gradient(135deg, #161b30 0%, #0d101e 100%);
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: 20px;
    padding: 36px;
    max-width: 540px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 242, 254, 0.15);
}

.modal-card h2 {
    font-size: 1.9rem;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #00f2fe, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 22px;
}

.features-list {
    text-align: left;
    margin: 18px 0 24px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    color: #e2e8f0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(18, 22, 38, 0.96);
    border: 1px solid #00f2fe;
    color: white;
    padding: 10px 22px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 242, 254, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 100;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Air Gestures HUD Badge */
.gesture-pill {
    position: absolute;
    top: 75px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(18, 22, 38, 0.95);
    border: 1px solid var(--accent-primary, #00f2fe);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 0 20px var(--glow-color, rgba(0, 242, 254, 0.5));
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 65;
}

.gesture-pill.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Indicateur Sustain Aérien */
.sustain-indicator {
    position: absolute;
    bottom: 90px;
    right: 24px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.6);
    color: #f59e0b;
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 55;
}

.sustain-indicator.active {
    opacity: 1;
}

/* Mode Kiosque Salon */
body.kiosk-mode header {
    display: none !important;
}

body.kiosk-mode .floating-panel {
    display: none !important;
}

.kiosk-unlock-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    opacity: 0.2;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    z-index: 999;
    display: none;
    transition: opacity 0.2s;
}

body.kiosk-mode .kiosk-unlock-btn {
    display: block;
}

.kiosk-unlock-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,0.8);
}
