/* ============================================================
   TESLA KARAOKÉ PARTY - Styles
   Design: Sombre, tactile, optimisé écran Tesla Model Y 15" (2200x1300)
   ============================================================ */

/* Variables CSS - Thème sombre par défaut */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a2e;
    --bg-card: #16162a;
    --accent: #e94560;
    --accent-secondary: #0f3460;
    --accent-glow: rgba(233, 69, 96, 0.4);
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --success: #00d9a6;
    --warning: #ffd700;
    --danger: #ff4757;
    --player1: #e94560;
    --player2: #00d9ff;
    --radius: 16px;
    --radius-lg: 24px;
    --touch-target: 64px;
    --transition: 0.2s ease;
}

/* Thème Néon */
body.theme-neon {
    --bg-primary: #0d0221;
    --bg-secondary: #1a0b3d;
    --bg-tertiary: #2d1b69;
    --bg-card: #1e0f4d;
    --accent: #ff00ff;
    --accent-secondary: #00ffff;
    --accent-glow: rgba(255, 0, 255, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #b8b8ff;
}

/* Thème Rétro */
body.theme-retro {
    --bg-primary: #1a0f0a;
    --bg-secondary: #2d1810;
    --bg-tertiary: #4a2818;
    --bg-card: #3d1f12;
    --accent: #ff6b35;
    --accent-secondary: #f7c59f;
    --accent-glow: rgba(255, 107, 53, 0.4);
    --text-primary: #ffe8d6;
    --text-secondary: #c4a77d;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    user-select: none;
    touch-action: manipulation;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* ============================================================
   ÉCRANS
   ============================================================ */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
}

.screen.active {
    display: flex;
}

/* ============================================================
   MENU PRINCIPAL
   ============================================================ */
#screen-menu {
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, var(--bg-secondary) 0%, var(--bg-primary) 70%);
}

.logo {
    text-align: center;
    margin-bottom: 48px;
}

.logo h1 {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 4px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 60px var(--accent-glow);
}

.tagline {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-top: 8px;
    letter-spacing: 2px;
}

.menu-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 900px;
    width: 100%;
}

.btn-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    padding: 24px;
    background: var(--bg-card);
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-primary);
}

.btn-mode:hover, .btn-mode:active {
    border-color: var(--accent);
    background: var(--bg-tertiary);
    transform: scale(1.02);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.btn-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.btn-label {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.btn-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
}

.menu-footer {
    margin-top: 32px;
    display: flex;
    gap: 16px;
}

/* ============================================================
   BOUTONS GÉNÉRAUX
   ============================================================ */
.btn {
    min-height: var(--touch-target);
    padding: 12px 28px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    color: white;
    font-size: 1.3rem;
    padding: 16px 40px;
}

.btn-back {
    background: transparent;
    border: 2px solid var(--bg-tertiary);
    min-height: 48px;
    padding: 8px 20px;
    font-size: 1rem;
}

.btn-small {
    min-height: 44px;
    padding: 8px 20px;
    font-size: 0.95rem;
    background: var(--bg-card);
}

.offset-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin: 0 4px;
}


.btn-mic {
    background: var(--danger);
    color: white;
    min-width: 140px;
}

.btn-mic.active {
    background: var(--success);
    animation: pulse-mic 1.5s infinite;
}

@keyframes pulse-mic {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 217, 166, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(0, 217, 166, 0); }
}

.btn-record {
    background: var(--danger);
    color: white;
}

.btn-record.recording {
    animation: pulse-record 1s infinite;
}

@keyframes pulse-record {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================================
   EN-TÊTES D'ÉCRAN
   ============================================================ */
.screen-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    flex-shrink: 0;
}

.screen-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 16px;
    flex-shrink: 0;
}

.game-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.song-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent);
}

.score {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--warning);
}

.game-controls {
    display: flex;
    gap: 12px;
}

.game-footer {
    padding: 16px;
    flex-shrink: 0;
}

/* ============================================================
   LISTE DES CHANSONS
   ============================================================ */
.song-search {
    padding: 8px 8px 0 8px;
}

.song-search input {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius);
    outline: none;
    box-sizing: border-box;
}

.song-search input:focus {
    border-color: var(--accent);
}

.song-list-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 40px 0;
}

.song-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    overflow-y: auto;
    padding: 8px;
}

.song-card {
    background: var(--bg-card);
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
    min-height: var(--touch-target);
}

.song-card:hover, .song-card:active {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.song-card .song-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.song-card .song-artist {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.song-card .song-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.song-card .difficulty {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.difficulty.easy { background: rgba(0, 217, 166, 0.2); color: var(--success); }
.difficulty.medium { background: rgba(255, 215, 0, 0.2); color: var(--warning); }
.difficulty.hard { background: rgba(255, 71, 87, 0.2); color: var(--danger); }

/* ============================================================
   PAROLES (LYRICS)
   ============================================================ */
.karaoke-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.lyrics-display {
    text-align: center;
    width: 100%;
    max-width: 1000px;
    padding: 24px;
}

.lyrics-display.small {
    font-size: 0.7em;
}

.lyric-line {
    font-size: 2.2rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 8px 0;
    transition: all 0.3s ease;
}

.lyric-line.upcoming {
    color: var(--text-muted);
    opacity: 0.5;
}

.lyric-line.active {
    color: var(--text-primary);
    font-size: 2.8rem;
    text-shadow: 0 0 30px var(--accent-glow);
    transform: scale(1.05);
}

.lyric-line.passed {
    color: var(--text-muted);
    opacity: 0.3;
}

/* Tailles de paroles réglables */
body.lyrics-large .lyric-line { font-size: 2.8rem; }
body.lyrics-large .lyric-line.active { font-size: 3.5rem; }
body.lyrics-xlarge .lyric-line { font-size: 3.5rem; }
body.lyrics-xlarge .lyric-line.active { font-size: 4.2rem; }

/* ============================================================
   BARRE DE PROGRESSION
   ============================================================ */
.progress-container {
    width: 100%;
    max-width: 800px;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-secondary) 100%);
    border-radius: 4px;
    transition: width 0.1s linear;
}

/* ============================================================
   VISUALISEUR AUDIO
   ============================================================ */
.audio-visualizer {
    width: 100%;
    max-width: 800px;
    margin-top: 16px;
}

.audio-visualizer canvas {
    width: 100%;
    height: 100px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

/* ============================================================
   FEEDBACK
   ============================================================ */
.feedback {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
    min-height: 40px;
    color: var(--warning);
}

.feedback.good { color: var(--success); }
.feedback.bad { color: var(--danger); }

/* ============================================================
   DUEL
   ============================================================ */
.duel-container {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    min-height: 0;
}

.player-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    border: 3px solid transparent;
    transition: all var(--transition);
}

.player-panel.active {
    border-color: var(--accent);
    box-shadow: 0 0 40px var(--accent-glow);
}

.player-1.active { border-color: var(--player1); box-shadow: 0 0 40px rgba(233, 69, 96, 0.3); }
.player-2.active { border-color: var(--player2); box-shadow: 0 0 40px rgba(0, 217, 255, 0.3); }

.player-name {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 8px 24px;
    border-radius: var(--radius);
}

.player-1 .player-name { background: var(--player1); color: white; }
.player-2 .player-name { background: var(--player2); color: #000; }

.player-score {
    font-size: 3rem;
    font-weight: 900;
}

.player-1 .player-score { color: var(--player1); }
.player-2 .player-score { color: var(--player2); }

.player-indicator {
    font-size: 1rem;
    color: var(--text-secondary);
    text-align: center;
}

.player-panel.active .player-indicator {
    color: var(--success);
    font-weight: 700;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.duel-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.turn-indicator {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 16px;
    padding: 12px 32px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
}

.turn-indicator.p1 { color: var(--player1); }
.turn-indicator.p2 { color: var(--player2); }

.player-panel canvas {
    width: 100%;
    height: 60px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

/* ============================================================
   BLIND TEST
   ============================================================ */
.blindtest-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.blind-visual {
    text-align: center;
}

.equalizer {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    height: 120px;
    margin-bottom: 24px;
}

.equalizer .bar {
    width: 24px;
    background: linear-gradient(0deg, var(--accent) 0%, var(--accent-secondary) 100%);
    border-radius: 4px 4px 0 0;
    animation: eq-bounce 0.5s ease-in-out infinite alternate;
}

.equalizer .bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.equalizer .bar:nth-child(2) { height: 80%; animation-delay: 0.1s; }
.equalizer .bar:nth-child(3) { height: 60%; animation-delay: 0.2s; }
.equalizer .bar:nth-child(4) { height: 100%; animation-delay: 0.3s; }
.equalizer .bar:nth-child(5) { height: 50%; animation-delay: 0.4s; }
.equalizer .bar:nth-child(6) { height: 90%; animation-delay: 0.5s; }
.equalizer .bar:nth-child(7) { height: 70%; animation-delay: 0.6s; }
.equalizer .bar:nth-child(8) { height: 30%; animation-delay: 0.7s; }
.equalizer .bar:nth-child(9) { height: 55%; animation-delay: 0.8s; }

@keyframes eq-bounce {
    from { transform: scaleY(0.3); }
    to { transform: scaleY(1); }
}

.blind-hint {
    font-size: 1.4rem;
    color: var(--text-secondary);
}

.blind-choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 700px;
    width: 100%;
}

.blind-choice {
    min-height: 80px;
    padding: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    background: var(--bg-card);
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-primary);
}

.blind-choice:hover, .blind-choice:active {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.blind-choice.correct {
    border-color: var(--success);
    background: rgba(0, 217, 166, 0.2);
}

.blind-choice.wrong {
    border-color: var(--danger);
    background: rgba(255, 71, 87, 0.2);
}

.blind-choice:disabled {
    cursor: default;
}

.blind-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--warning);
}

/* ============================================================
   FREE STYLE
   ============================================================ */
.freestyle-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 16px;
}

.beat-selector {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-beat {
    min-width: 120px;
    background: var(--bg-card);
    border: 2px solid var(--bg-tertiary);
}

.btn-beat.active {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.effects-panel {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-effect {
    min-width: 100px;
    background: var(--bg-card);
    border: 2px solid var(--bg-tertiary);
    font-size: 0.95rem;
}

.btn-effect.active {
    border-color: var(--accent-secondary);
    background: var(--accent-secondary);
    color: white;
}

.lyrics-hint {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 600px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

/* ============================================================
   RÉSULTATS
   ============================================================ */
.results-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.results-container h2 {
    font-size: 2.5rem;
}

.results-content {
    font-size: 1.3rem;
    text-align: center;
    color: var(--text-secondary);
}

.results-stars {
    font-size: 4rem;
    letter-spacing: 8px;
}

/* ============================================================
   RÉGLAGES & À PROPOS
   ============================================================ */
.settings-container, .about-container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    gap: 20px;
}

.setting-item label {
    font-size: 1.1rem;
    font-weight: 600;
}

.setting-item input[type="range"] {
    flex: 1;
    max-width: 200px;
    height: 8px;
    -webkit-appearance: none;
    background: var(--bg-tertiary);
    border-radius: 4px;
    cursor: pointer;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.setting-item select {
    padding: 10px 16px;
    font-size: 1rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius);
    cursor: pointer;
    min-height: 44px;
}

.about-container {
    text-align: center;
}

.about-container h3 {
    font-size: 2rem;
    margin-bottom: 16px;
    color: var(--accent);
}

.about-container p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.tech-stack {
    margin-top: 24px;
    padding: 12px 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
    display: inline-block;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* ============================================================
   OVERLAYS
   ============================================================ */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    padding: 48px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 500px;
}

.overlay-content h3 {
    font-size: 1.8rem;
    margin-bottom: 16px;
}

.overlay-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   RESPONSIVE - Écran Tesla 15" (2200x1300) et plus petit
   ============================================================ */
@media (max-width: 1200px) {
    .logo h1 { font-size: 3rem; }
    .btn-mode { min-height: 140px; }
    .btn-icon { font-size: 2.8rem; }
    .lyric-line { font-size: 1.8rem; }
    .lyric-line.active { font-size: 2.2rem; }
    .duel-container { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
    .player-panel { flex-direction: row; justify-content: space-around; padding: 12px; }
    .player-score { font-size: 2rem; }
    .player-panel canvas { display: none; }
}

@media (max-width: 768px) {
    .screen { padding: 12px; }
    .logo h1 { font-size: 2.2rem; }
    .menu-buttons { grid-template-columns: 1fr; }
    .btn-mode { min-height: 100px; flex-direction: row; text-align: left; }
    .btn-icon { font-size: 2rem; margin-bottom: 0; margin-right: 16px; }
    .lyric-line { font-size: 1.4rem; }
    .lyric-line.active { font-size: 1.7rem; }
    .blind-choices { grid-template-columns: 1fr; }
    .game-header { flex-wrap: wrap; }
}

/* Mode paysage forcé pour Tesla */
@media (orientation: landscape) and (max-height: 600px) {
    .screen { padding: 8px 16px; }
    .logo { margin-bottom: 16px; }
    .logo h1 { font-size: 2rem; }
    .menu-buttons { gap: 12px; }
    .btn-mode { min-height: 90px; padding: 12px; }
    .btn-icon { font-size: 1.8rem; margin-bottom: 4px; }
    .btn-label { font-size: 1.1rem; }
    .btn-desc { font-size: 0.8rem; }
}

/* Désactiver les animations si préférence réduite */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
