/*
 * K2 : Le Sommet du Management
 * Styles principaux — Layout Split Desktop
 */

/* =====================================================
   RESET & VARIABLES
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-dark: #0B1120;
    --bg-card: #111827;
    --bg-surface: #1E293B;
    --bg-hover: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --green: #22C55E;
    --orange: #F97316;
    --red: #EF4444;
    --blue: #3B82F6;
    --purple: #8B5CF6;
    --gold: #FFD700;
    --border: #1E293B;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
}

.theme-light {
    --bg-dark: #F0F8FF;
    --bg-card: #FFFFFF;
    --bg-surface: #E0F2FE;
    --bg-hover: #BAE6FD;
    --text-primary: #0F172A;
    --text-secondary: #334155;
    --text-muted: #475569;
    --border: #BAE6FD;
    --shadow: 0 4px 24px rgba(186,230,253,0.5);
    --shadow-lg: 0 8px 40px rgba(186,230,253,0.7);
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

.hidden { display: none !important; }

/* =====================================================
   SCREENS
   ===================================================== */
.screen { display: none; width: 100%; height: 100vh; overflow-y: auto; }
.screen.active { display: flex; flex-direction: column; }

/* =====================================================
   ÉCRAN D'ACCUEIL
   ===================================================== */
#screen-home {
    align-items: center; justify-content: center;
    background: linear-gradient(180deg, #0B1120 0%, #1a1a3e 40%, #2d1b4e 70%, #0B1120 100%);
    position: relative; overflow: hidden;
}
.theme-light #screen-home {
    background: linear-gradient(180deg, #F0F8FF 0%, #E0F2FE 40%, #BAE6FD 70%, #F0F8FF 100%);
}
.mountain-bg {
    position: absolute; bottom: 0; left: 0; right: 0; height: 50%;
    background: linear-gradient(135deg, transparent 33%, #1a2744 33%, #1a2744 34%, transparent 34%),
                linear-gradient(225deg, transparent 33%, #162035 33%, #162035 34%, transparent 34%);
    opacity: 0.5;
}
.theme-light .mountain-bg {
    background: linear-gradient(135deg, transparent 33%, #bae6fd 33%, #bae6fd 34%, transparent 34%),
                linear-gradient(225deg, transparent 33%, #7dd3fc 33%, #7dd3fc 34%, transparent 34%);
    opacity: 0.6;
}
.home-content { z-index: 2; text-align: center; }
.logo-container { margin-bottom: 3rem; }
.mountain-icon { font-size: 5rem; margin-bottom: 1rem; animation: float 4s ease-in-out infinite; }
.game-title {
    font-family: 'Orbitron', sans-serif; font-size: 5rem; font-weight: 900; letter-spacing: 0.2em;
    background: linear-gradient(135deg, #fff 0%, #94A3B8 50%, #fff 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1;
}
.game-subtitle { font-size: 1.5rem; font-weight: 300; color: var(--text-secondary); margin-top: 0.5rem; letter-spacing: 0.1em; }
.game-tagline { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.5rem; letter-spacing: 0.15em; text-transform: uppercase; }

.snow-particles { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.snowflake { position: absolute; top: -20px; color: white; animation: snowfall linear infinite; pointer-events: none; }
@keyframes snowfall { 0% { transform: translateY(-20px) rotate(0deg); } 100% { transform: translateY(100vh) rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }

/* =====================================================
   BOUTONS
   ===================================================== */
.btn-primary {
    display: inline-flex; align-items: center; gap: 0.75rem;
    padding: 0.9rem 2rem; background: linear-gradient(135deg, var(--blue), var(--purple));
    color: white; border: none; border-radius: var(--radius); font-size: 1rem; font-weight: 700;
    cursor: pointer; transition: all 0.3s; font-family: inherit;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(59,130,246,0.4); }

.btn-secondary {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.8rem 2rem; background: var(--bg-surface); color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; font-weight: 500;
    cursor: pointer; transition: all 0.3s; font-family: inherit;
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-glow { animation: glow 2s ease-in-out infinite alternate; }
@keyframes glow { from { box-shadow: 0 4px 20px rgba(59,130,246,0.3); } to { box-shadow: 0 4px 40px rgba(139,92,246,0.5); } }

/* Sélection de mode — Accueil */
.mode-selection { margin-bottom: 1.5rem; }
.mode-title { text-align: center; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--text-muted); margin-bottom: 0.75rem; }
.mode-cards { display: flex; gap: 1.25rem; justify-content: center; }
.mode-card {
    width: 220px; padding: 1.5rem 1.25rem; border-radius: var(--radius-lg);
    border: 2px solid var(--border); background: var(--bg-card);
    cursor: pointer; transition: all 0.3s; text-align: center;
    font-family: inherit; color: var(--text-primary); position: relative; overflow: hidden;
}
.mode-card:hover { transform: translateY(-4px); }
.mode-online:hover { border-color: var(--blue); box-shadow: 0 8px 30px rgba(59,130,246,0.25); }
.mode-hybrid:hover { border-color: var(--purple); box-shadow: 0 8px 30px rgba(139,92,246,0.25); }
.mode-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.mode-label { font-weight: 800; font-size: 1.1rem; margin-bottom: 0.3rem; }
.mode-desc { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }

/* Bouton Quitter */
.btn-quit {
    display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.75rem;
    background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); border-radius: 6px;
    color: var(--red); font-size: 0.75rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s; font-family: inherit;
}
.btn-quit:hover { background: rgba(239,68,68,0.3); }

/* Barre supérieure du jeu */
.game-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.4rem 0.75rem; background: var(--bg-card); border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.game-mode-badge {
    font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.6rem;
    border-radius: 20px; text-transform: uppercase; letter-spacing: 0.05em;
}
.game-mode-badge.badge-online { background: rgba(59,130,246,0.15); color: var(--blue); }
.game-mode-badge.badge-hybrid { background: rgba(139,92,246,0.15); color: var(--purple); }

/* Info tour dans la topbar — masquée en mode online (déjà dans game-header) */
.topbar-turn-info { display: none; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.topbar-turn { color: var(--text-secondary); }
.topbar-turn strong { color: var(--text-primary); font-family: 'Orbitron', sans-serif; font-size: 1rem; }
.topbar-sep { color: var(--text-muted); }
.topbar-team { font-weight: 700; }

#screen-game.hybrid-mode .topbar-turn-info { display: flex; }

/* =====================================================
   MODE HYBRIDE — Plein écran questions uniquement
   ===================================================== */
#screen-game.hybrid-mode .game-col-right { display: none; }
#screen-game.hybrid-mode .game-col-left { width: 100%; border-right: none; }
#screen-game.hybrid-mode .game-header { display: none; }

/* En mode hybride, agrandir le panel d'action */
#screen-game.hybrid-mode .action-panel { padding: 1.5rem 2rem; flex: 1; }
#screen-game.hybrid-mode .card-display { max-width: 800px; margin: 0 auto; }
#screen-game.hybrid-mode .deck-choices { justify-content: center; gap: 1.5rem; }
#screen-game.hybrid-mode .deck-btn { min-width: 160px; max-width: 220px; padding: 1.5rem 1rem; }
#screen-game.hybrid-mode .card-situation { font-size: 1.05rem; padding: 1rem 1.5rem; }
#screen-game.hybrid-mode .choice-btn { padding: 0.8rem 1rem; }
#screen-game.hybrid-mode .choice-text { font-size: 0.95rem; }
#screen-game.hybrid-mode .result-all-choices { max-width: 800px; margin: 0 auto 0.75rem; }
#screen-game.hybrid-mode .rc-choice { padding: 0.75rem 1rem; }
#screen-game.hybrid-mode .rc-text { font-size: 0.9rem; }

/* Bouton Valider */
.btn-validate {
    display: flex; align-items: center; justify-content: center; gap: 0.6rem; width: 100%;
    padding: 0.85rem 1.5rem; background: linear-gradient(135deg, var(--green), #16A34A);
    color: white; border: none; border-radius: var(--radius); font-size: 1.05rem; font-weight: 800;
    cursor: pointer; transition: all 0.3s; font-family: inherit; letter-spacing: 0.02em;
}
.btn-validate:disabled { opacity: 0.3; cursor: not-allowed; background: var(--bg-surface); }
.btn-validate:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(34,197,94,0.4); }

.card-validate-bar { padding: 0.75rem; border-top: 1px solid var(--border); }

/* =====================================================
   ÉCRAN ADMIN / CONFIGURATION AVANCÉE
   ===================================================== */
#screen-admin { padding: 0; overflow-y: auto; }
#screen-admin.active { display: block; }

.admin-container { max-width: 960px; margin: 0 auto; padding: 1.5rem; }

.admin-header {
    display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem;
    position: sticky; top: 0; z-index: 10; background: var(--bg-dark); padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.admin-title { flex: 1; font-size: 1.3rem; font-weight: 800; }
.admin-header-actions { display: flex; gap: 0.5rem; }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }

.admin-section {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 1.25rem; margin-bottom: 1.25rem;
}
.admin-section-title { font-size: 1.05rem; font-weight: 800; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.admin-hint { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }

.admin-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.6rem; }
.admin-row label { flex: 1; font-size: 0.85rem; color: var(--text-secondary); }
.cfg-input {
    width: 80px; padding: 0.4rem 0.6rem; background: var(--bg-dark); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary); font-size: 0.95rem; font-weight: 700;
    text-align: center; font-family: 'Orbitron', monospace; transition: border-color 0.3s;
}
.cfg-input:focus { outline: none; border-color: var(--blue); }

/* Tableau de résolution */
.cfg-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.cfg-table th { padding: 0.5rem 0.3rem; color: var(--text-muted); font-weight: 700; text-align: center; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
.cfg-table td { padding: 0.4rem 0.2rem; text-align: center; }
.cfg-table td:first-child { text-align: left; font-weight: 700; font-size: 0.85rem; white-space: nowrap; padding-left: 0.5rem; }
.cfg-cell {
    width: 58px; padding: 0.35rem; background: var(--bg-dark); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text-primary); font-size: 0.85rem; font-weight: 700;
    text-align: center; font-family: 'Orbitron', monospace; transition: border-color 0.3s;
}
.cfg-cell:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
.cfg-row-green .cfg-cell:focus { border-color: var(--green); }
.cfg-row-orange .cfg-cell:focus { border-color: var(--orange); }
.cfg-row-red .cfg-cell:focus { border-color: var(--red); }

.cfg-save-feedback { font-size: 0.85rem; color: var(--green); font-weight: 700; margin-left: 1rem; }

/* Cards info */
.admin-cards-info { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1rem; padding: 0.75rem; background: var(--bg-surface); border-radius: var(--radius); }

/* Action cards */
.admin-cards-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.admin-action-card {
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
}
.admin-action-icon { font-size: 2rem; }
.admin-action-card h4 { font-size: 0.9rem; font-weight: 700; }
.admin-action-card p { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; flex: 1; }

.admin-import-result { padding: 0.75rem; border-radius: var(--radius); margin-top: 1rem; font-size: 0.85rem; line-height: 1.5; white-space: pre-line; }
.admin-import-result.result-success { background: rgba(34,197,94,0.1); border: 1px solid var(--green); color: var(--green); }
.admin-import-result.result-error { background: rgba(239,68,68,0.1); border: 1px solid var(--red); color: var(--red); }

/* JSON preview */
.json-preview-details summary { font-size: 0.85rem; color: var(--blue); cursor: pointer; font-weight: 600; }
.json-preview { background: var(--bg-dark); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; font-size: 0.72rem; line-height: 1.5; color: var(--text-secondary); overflow-x: auto; max-height: 400px; overflow-y: auto; margin-top: 0.5rem; font-family: 'Courier New', monospace; white-space: pre; }

.btn-config-home { margin-top: 1rem; }

@media (max-width: 700px) {
    .admin-cards-actions { grid-template-columns: 1fr; }
    .admin-header { flex-wrap: wrap; }
    .cfg-table { font-size: 0.7rem; }
    .cfg-cell { width: 46px; font-size: 0.75rem; }
}

/* =====================================================
   ÉCRAN CONFIGURATION DES ÉQUIPES
   ===================================================== */
#screen-setup { align-items: center; justify-content: center; background: var(--bg-dark); padding: 2rem; }
.setup-container { max-width: 800px; width: 100%; }
.setup-title { text-align: center; font-size: 1.8rem; margin-bottom: 2rem; }
.teams-setup { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.team-card { background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: border-color 0.3s; }
.team-card-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: var(--bg-surface); }
.team-number { font-weight: 700; font-size: 1.1rem; }
.team-icon { font-size: 2rem; }
.team-card-body { padding: 1.5rem; }
.team-card-body label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.team-card-body input { width: 100%; padding: 0.75rem 1rem; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); font-size: 1rem; font-family: inherit; margin-bottom: 1rem; transition: border-color 0.3s; }
.team-card-body input:focus { outline: none; border-color: var(--blue); }
.color-picker { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.color-btn { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: all 0.2s; }
.color-btn:hover { transform: scale(1.15); }
.color-btn.selected { border-color: white; box-shadow: 0 0 15px rgba(255,255,255,0.3); transform: scale(1.15); }
.setup-actions { display: flex; justify-content: center; gap: 1.5rem; }

/* =====================================================
   ÉCRAN DE JEU — LAYOUT SPLIT DESKTOP
   ===================================================== */
#screen-game { overflow: hidden; }
#screen-game.active { display: flex; }

.game-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* ----- Colonne Gauche (50%) ----- */
.game-col-left {
    width: 50%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

/* HUD — max 1/3 hauteur */
.game-header {
    flex-shrink: 0;
    max-height: 33.33vh;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.team-hud {
    flex: 1;
    background: var(--bg-surface);
    border-radius: var(--radius);
    padding: 0.65rem 0.85rem;
    border: 2px solid var(--border);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
}
.team-hud.active-team {
    box-shadow: 0 0 20px rgba(59,130,246,0.15);
}

.hud-top-row { display: flex; justify-content: space-between; align-items: center; }
.hud-name { font-weight: 800; font-size: 0.95rem; }

.hud-o2 { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-secondary); }
.o2-bar-container { flex: 1; height: 10px; background: var(--bg-dark); border-radius: 5px; overflow: hidden; }
.o2-bar { height: 100%; background: linear-gradient(90deg, var(--green), #86EFAC); border-radius: 5px; transition: width 0.8s ease, background 0.5s; }
.o2-bar.o2-warning { background: linear-gradient(90deg, var(--orange), #FDBA74); }
.o2-bar.o2-critical { background: linear-gradient(90deg, var(--red), #FCA5A5); animation: pulse-bar 1s ease-in-out infinite; }
@keyframes pulse-bar { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.o2-value { font-weight: 800; font-size: 1.05rem; min-width: 2ch; text-align: right; color: var(--text-primary); }

.hud-position { font-size: 0.8rem; color: var(--text-secondary); }
.hud-position span { font-weight: 700; color: var(--text-primary); }

.hud-shield { font-size: 1.1rem; color: var(--gold); animation: float 2s ease-in-out infinite; }

.game-turn-info { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 90px; }
.turn-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--text-muted); }
.turn-number { font-family: 'Orbitron', sans-serif; font-size: 1.8rem; font-weight: 900; }
.current-team-indicator { font-size: 0.75rem; font-weight: 700; text-align: center; white-space: nowrap; }

/* Action Panel — min 2/3 hauteur, scrollable */
.action-panel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
}

.action-state { flex: 1; display: flex; flex-direction: column; }

.action-title { font-size: 1.15rem; font-weight: 800; text-align: center; margin-bottom: 0.25rem; }
.action-subtitle { text-align: center; color: var(--text-secondary); font-size: 0.8rem; margin-bottom: 0.75rem; }

/* Deck buttons */
.deck-choices { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.deck-btn {
    flex: 1; min-width: 130px; max-width: 180px; padding: 1.1rem 0.75rem;
    border-radius: var(--radius-lg); border: 2px solid var(--border); background: var(--bg-card);
    cursor: pointer; transition: all 0.3s; text-align: center; font-family: inherit; color: var(--text-primary);
    position: relative; overflow: hidden;
}
.deck-btn:hover:not(:disabled) { transform: translateY(-3px); box-shadow: var(--shadow); }
.deck-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.deck-green:hover:not(:disabled) { border-color: var(--green); box-shadow: 0 4px 20px rgba(34,197,94,0.2); }
.deck-orange:hover:not(:disabled) { border-color: var(--orange); box-shadow: 0 4px 20px rgba(249,115,22,0.2); }
.deck-red:hover:not(:disabled) { border-color: var(--red); box-shadow: 0 4px 20px rgba(239,68,68,0.2); }
.deck-icon { font-size: 2rem; margin-bottom: 0.3rem; }
.deck-label { font-weight: 800; font-size: 1rem; margin-bottom: 0.15rem; }
.deck-info { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.3rem; }
.deck-remaining { font-size: 0.7rem; color: var(--text-muted); font-style: italic; }

/* Card / Question */
.card-display {
    background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden; width: 100%; display: flex; flex-direction: column;
}
.card-header-bar { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.85rem; background: var(--bg-surface); }
.card-id { padding: 0.2rem 0.6rem; border-radius: 6px; font-weight: 800; font-size: 0.8rem; color: white; }
.card-title-text { flex: 1; font-weight: 700; font-size: 0.9rem; }

.timer-container { flex-shrink: 0; }
.timer-ring { position: relative; width: 36px; height: 36px; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-bg { fill: none; stroke: var(--bg-dark); stroke-width: 3; }
.timer-progress { fill: none; stroke: var(--green); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.5s; }
.timer-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-weight: 800; font-size: 0.7rem; color: var(--green); }

.card-situation { padding: 0.75rem 1rem; font-size: 0.88rem; line-height: 1.55; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.card-choices { padding: 0.6rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }

/* Choice buttons — sélection avant validation */
.choice-btn {
    display: flex; align-items: flex-start; gap: 0.6rem;
    padding: 0.6rem 0.85rem; background: var(--bg-surface); border: 2px solid var(--border);
    border-radius: var(--radius); cursor: pointer; transition: all 0.25s;
    text-align: left; font-family: inherit; color: var(--text-primary); width: 100%;
}
.choice-btn:hover:not(:disabled):not(.selected) { border-color: var(--blue); background: rgba(59,130,246,0.08); }
.choice-btn.selected { border-color: var(--blue); background: rgba(59,130,246,0.15); box-shadow: 0 0 0 1px var(--blue); }
.choice-btn:disabled { cursor: default; }
.choice-btn.correct { border-color: var(--green) !important; background: rgba(34,197,94,0.15) !important; }
.choice-btn.wrong { border-color: var(--red) !important; background: rgba(239,68,68,0.15) !important; }

.choice-letter {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 7px; background: var(--bg-dark);
    font-weight: 800; font-size: 0.8rem; flex-shrink: 0; color: var(--text-secondary);
}
.choice-btn.selected .choice-letter { background: var(--blue); color: white; }
.choice-btn.correct .choice-letter { background: var(--green); color: white; }
.choice-btn.wrong .choice-letter { background: var(--red); color: white; }
.choice-text { font-size: 0.85rem; line-height: 1.4; padding-top: 0.15rem; }

/* Result */
.result-container { width: 100%; }
.result-icon { font-size: 2.5rem; text-align: center; margin-bottom: 0.3rem; }
.result-title { text-align: center; font-size: 1.3rem; font-weight: 800; margin-bottom: 0.5rem; }
.result-title.result-perfect { color: var(--green); }
.result-title.result-adjacent { color: var(--orange); }
.result-title.result-error { color: var(--red); }

.result-profile { text-align: center; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.6rem; }

/* ===== Toutes les réponses colorées ===== */
.result-all-choices { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }

.rc-choice {
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
    border-left: 5px solid;
    transition: all 0.3s;
    position: relative;
}
/* Vert — Bonne réponse */
.rc-correct { background: rgba(34,197,94,0.1); border-color: var(--green); }
/* Jaune — Adjacent */
.rc-adjacent { background: rgba(249,115,22,0.08); border-color: var(--orange); }
/* Rouge — Éloigné / Opposé */
.rc-error { background: rgba(239,68,68,0.08); border-color: var(--red); }

/* Surbrillance du choix de l'équipe */
.rc-chosen {
    outline: 3px solid white;
    outline-offset: -1px;
    box-shadow: 0 0 16px rgba(255,255,255,0.25);
}
.rc-chosen::after {
    content: '';
    position: absolute;
    top: -2px; right: -2px; bottom: -2px; left: -2px;
    border: 2px dashed rgba(255,255,255,0.6);
    border-radius: var(--radius);
    pointer-events: none;
    animation: pulse-outline 1.5s ease-in-out infinite;
}
@keyframes pulse-outline { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.rc-header { display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.3rem; }
.rc-letter {
    display: flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 6px; font-weight: 800; font-size: 0.8rem; flex-shrink: 0;
}
.rc-correct .rc-letter { background: var(--green); color: white; }
.rc-adjacent .rc-letter { background: var(--orange); color: white; }
.rc-error .rc-letter { background: var(--red); color: white; }
.rc-text { font-size: 0.82rem; line-height: 1.4; flex: 1; color: var(--text-primary); }
.rc-chosen-badge {
    flex-shrink: 0; font-size: 0.7rem; font-weight: 800; padding: 0.15rem 0.5rem;
    border-radius: 20px; background: white; color: var(--bg-dark);
    white-space: nowrap; animation: pulse 1.5s ease-in-out infinite;
}

.rc-footer { display: flex; align-items: center; gap: 0.5rem; margin: 0.25rem 0 0.2rem 2.1rem; }
.rc-style-badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 20px; font-size: 0.7rem; font-weight: 700; color: white; }
.rc-category { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); }

.rc-explanation { font-size: 0.8rem; line-height: 1.4; color: var(--text-secondary); margin-left: 2.1rem; font-style: italic; }

.impacts-grid { display: flex; gap: 0.75rem; justify-content: center; margin: 0.75rem 0; flex-wrap: wrap; }
.impact-item { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem; border-radius: var(--radius); font-weight: 700; font-size: 0.95rem; }
.impact-positive { background: rgba(34,197,94,0.15); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.impact-negative { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.impact-shield { background: rgba(255,215,0,0.15); color: var(--gold); border: 1px solid rgba(255,215,0,0.3); }
#btn-next-turn { display: block; margin: 0.75rem auto 0; }

/* ----- Colonne Droite (50%) ----- */
.game-col-right {
    width: 50%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Répartition droite : Plateau 2/3 — Journal 1/3 */
.game-col-right > .mountain-board {
    flex: 2;
    min-height: 0;
}
.game-col-right > .event-log-panel {
    flex: 1;
    min-height: 0;
}

/* Carte K2 — remplit 2/3 de la colonne droite */
.mountain-board {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.board-map-container {
    position: relative; width: 100%; height: 100%;
    border-radius: var(--radius-lg); overflow: hidden; border: 2px solid var(--border);
    box-shadow: var(--shadow); background: #0a1628;
}
.theme-light .board-map-container { background: #bae6fd; }

.board-map-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; background: #0a1628; }
.theme-light .board-map-img { background: #bae6fd; }

/* Pions HTML — positionnés en % absolu dans le conteneur */
.pion-html {
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid white;
    z-index: 10;
    transform: translate(-50%, -50%);
    transition: left 0.8s cubic-bezier(0.34,1.56,0.64,1), top 0.8s cubic-bezier(0.34,1.56,0.64,1);
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.7));
    display: none;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
}

/* Journal de bord — 1/3 bas de la colonne droite */
.event-log-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    overflow: hidden;
}
.log-header {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.log-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
}.cfg-table th.cfg-column-adjacent.disabled,
.cfg-table td.cfg-column-adjacent.disabled {
    opacity: 0.2;
    background: rgba(0,0,0,0.3);
    pointer-events: none;
    cursor: not-allowed;
}

.cfg-table .cfg-column-adjacent.disabled input {
    background: transparent;
    border-color: transparent;
}
.log-entry {
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    border-radius: 4px;
    background: var(--bg-surface);
    line-height: 1.4;
}
.log-time { color: var(--text-muted); margin-right: 0.4rem; font-size: 0.68rem; }

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s; backdrop-filter: blur(4px);
}
.modal-overlay.show { opacity: 1; }
.modal-content {
    background: var(--bg-card); border: 2px solid var(--gold); border-radius: var(--radius-lg);
    padding: 2rem; max-width: 500px; width: 90%; text-align: center;
    transform: scale(0.8); transition: transform 0.3s;
}
.modal-overlay.show .modal-content { transform: scale(1); }
.modal-icon { font-size: 3rem; margin-bottom: 1rem; }
.modal-content h3 { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.75rem; color: var(--gold); }
.modal-content p { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 1.5rem; }
.btn-modal-action {
    display: block; width: 100%; padding: 0.75rem 1rem; margin-bottom: 0.5rem;
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text-primary); font-weight: 600; font-size: 0.9rem; cursor: pointer;
    transition: all 0.2s; font-family: inherit;
}
.btn-modal-action:hover { background: var(--bg-hover); border-color: var(--gold); }

/* =====================================================
   OVERLAY ANIMATIONS
   ===================================================== */
.overlay-animation {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    z-index: 500; pointer-events: none; opacity: 0; transition: opacity 0.3s;
}
.overlay-animation.animate-in { opacity: 1; }
.advance-display { font-size: 3rem; font-weight: 900; color: var(--green); text-shadow: 0 4px 20px rgba(34,197,94,0.5); animation: zoom-bounce 1.5s ease; }
.o2-loss-display { font-size: 3rem; font-weight: 900; color: var(--red); text-shadow: 0 4px 20px rgba(239,68,68,0.5); animation: shake-fade 1.5s ease; }
@keyframes zoom-bounce { 0% { transform: scale(0); opacity: 0; } 30% { transform: scale(1.3); opacity: 1; } 60% { transform: scale(1); } 100% { transform: scale(1); opacity: 0; } }
@keyframes shake-fade { 0% { transform: scale(0); opacity: 0; } 20% { transform: scale(1.2); opacity: 1; } 30% { transform: translateX(-10px); } 50% { transform: translateX(10px); } 70% { transform: translateX(0); } 100% { opacity: 0; } }
.particle { position: absolute; font-size: 1.5rem; pointer-events: none; animation: particle-float 2s ease-out forwards; }
@keyframes particle-float { 0% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-80px) scale(0); opacity: 0; } }

/* =====================================================
   ÉCRAN DE VICTOIRE
   ===================================================== */
#screen-victory { align-items: center; justify-content: center; background: linear-gradient(180deg, #0B1120, #1a1a3e, #0B1120); position: relative; overflow: hidden; }
.theme-light #screen-victory { background: linear-gradient(180deg, #F0F8FF, #E0F2FE, #BAE6FD); }
.victory-container { z-index: 2; text-align: center; padding: 2rem; width: 100%; max-width: 700px; }
.victory-fireworks { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.firework-particle { position: absolute; bottom: -20px; font-size: 2rem; animation: firework-rise linear forwards; }
@keyframes firework-rise { 0% { transform: translateY(0) scale(0.5); opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-100vh) scale(1.5); opacity: 0; } }
.victory-content { position: relative; z-index: 2; }
.trophy { font-size: 5rem; margin-bottom: 1rem; animation: float 3s ease-in-out infinite; }
.victory-title { font-family: 'Orbitron', sans-serif; font-size: 2.5rem; font-weight: 900; margin-bottom: 0.5rem; background: linear-gradient(135deg, #FFD700, #FFA500); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.victory-team { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 2rem; }
.stats-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 2rem; }
.stat-team { background: var(--bg-card); border-radius: var(--radius); padding: 1.25rem; border: 2px solid var(--border); }
.stat-team h4 { font-size: 1rem; margin-bottom: 0.75rem; }
.stat-row { display: flex; justify-content: space-between; padding: 0.3rem 0; font-size: 0.85rem; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.stat-row strong { color: var(--text-primary); }

/* =====================================================
   RESPONSIVE — Mobile
   ===================================================== */
@media (max-width: 900px) {
    .game-layout { flex-direction: column; height: auto; overflow-y: auto; }
    .game-col-left { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
    .game-col-right { width: 100%; height: auto; }
    .game-col-right > .mountain-board { flex: none; max-height: 40vh; }
    .game-col-right > .event-log-panel { flex: none; max-height: 200px; }
    .game-header { max-height: none; }
    .teams-setup { grid-template-columns: 1fr; }
    .game-title { font-size: 3rem; }
    .stats-comparison { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .game-title { font-size: 2.5rem; }
    .deck-choices { flex-direction: column; align-items: center; }
    .deck-btn { max-width: 100%; }
    .mode-cards { flex-direction: column; align-items: center; }
    .mode-card { width: 100%; max-width: 280px; }
}

/* =====================================================
   ÉCRAN ÉDITEUR DE QUESTIONS
   ===================================================== */
#screen-cards-editor { background: var(--bg-dark); }
.editor-layout { display: flex; width: 100%; height: 100vh; overflow: hidden; }

/* Sidebar gauche */
.editor-sidebar {
    width: 320px; flex-shrink: 0; background: var(--bg-card); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; height: 100%; z-index: 10;
}
.editor-sidebar-header {
    padding: 1rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.75rem;
}
.editor-sidebar-header h3 { font-size: 1.1rem; font-weight: 800; display: flex; align-items: center; justify-content: space-between; }
.editor-header-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.editor-sidebar-filters { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); background: var(--bg-surface); }

.editor-sidebar-list { flex: 1; overflow-y: auto; padding: 0.5rem; }
.editor-list-item {
    padding: 0.75rem; border-radius: var(--radius); margin-bottom: 0.5rem; cursor: pointer;
    border: 1px solid transparent; transition: all 0.2s; background: var(--bg-surface);
    display: flex; flex-direction: column; gap: 0.25rem;
}
.editor-list-item:hover { background: var(--bg-hover); }
.editor-list-item.selected { border-color: var(--blue); background: rgba(59,130,246,0.1); }
.editor-list-item.inactive { opacity: 0.6; filter: grayscale(0.5); border-left: 4px solid var(--text-muted); }
.editor-list-item-header { display: flex; justify-content: space-between; align-items: center; }
.editor-list-item-id { font-size: 0.7rem; font-weight: 800; padding: 0.15rem 0.4rem; border-radius: 4px; color: white; }
.id-green { background: var(--green); }
.id-orange { background: var(--orange); }
.id-red { background: var(--red); }
.editor-list-item-title { font-size: 0.85rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; margin-left: 0.5rem; }
.editor-list-item-desc { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main Panel droite */
.editor-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-dark); }
.editor-empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-secondary); }

.editor-form-container { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.editor-form-header {
    padding: 1rem 2rem; border-bottom: 1px solid var(--border); background: var(--bg-card);
    display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.editor-form-header h2 { font-size: 1.3rem; font-weight: 800; }
.editor-form-actions { display: flex; gap: 1rem; }

.editor-form { flex: 1; overflow-y: auto; padding: 2rem; max-width: 900px; margin: 0 auto; width: 100%; }
.form-row { display: flex; gap: 1rem; margin-bottom: 1rem; }
.form-group { margin-bottom: 1.25rem; display: flex; flex-direction: column; }
.form-group label { font-size: 0.85rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 0.4rem; }
.editor-form input[type="text"], .editor-form textarea, .editor-form select {
    width: 100%; padding: 0.75rem; background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary); font-family: inherit; font-size: 0.95rem; transition: border-color 0.2s;
}
.editor-form input[type="text"]:focus, .editor-form textarea:focus, .editor-form select:focus { outline: none; border-color: var(--blue); }
.editor-form textarea { resize: vertical; min-height: 80px; }

.choice-editor-block {
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem; margin-bottom: 1rem; position: relative;
}
.choice-editor-block .btn-remove-choice { position: absolute; top: 1rem; right: 1rem; color: var(--red); background: transparent; border: none; cursor: pointer; font-size: 1.2rem; }
.choice-editor-block .btn-remove-choice:hover { opacity: 0.7; }

/* Résolution Conflit Import */
.import-conflict-list { max-height: 40vh; overflow-y: auto; text-align: left; margin-top: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface); }
.conflict-item { padding: 1rem; border-bottom: 1px solid var(--border); }
.conflict-item:last-child { border-bottom: none; }
.conflict-item-header { font-weight: 800; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.conflict-options { display: flex; gap: 1rem; }
.conflict-option {
    flex: 1; padding: 0.75rem; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer;
    background: var(--bg-dark); transition: all 0.2s;
}
.conflict-option:hover { border-color: var(--text-muted); }
.conflict-option.selected { border-color: var(--blue); background: rgba(59,130,246,0.1); }
.conflict-option-title { font-weight: 700; font-size: 0.85rem; margin-bottom: 0.25rem; color: var(--blue); }
.conflict-option-desc { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; }

/* =====================================================
   CHRONOMÈTRE OPPRESSANT (JEU)
   ===================================================== */
#stress-timer-container {
    margin: 1rem auto;
    transition: transform 0.1s;
    display: none; /* hidden if time=0 */
}
#stress-timer-container.urgent {
    animation: Heartbeat 0.5s infinite;
}
#stress-timer-container.urgent .timer-bg {
    stroke: rgba(239, 68, 68, 0.3);
}
#stress-timer-container.urgent .timer-progress {
    stroke: var(--red) !important;
}
#stress-timer-container.urgent .timer-text {
    color: var(--red) !important;
    font-weight: 900;
}

@keyframes Heartbeat {
    0% { transform: scale(1); }
    15% { transform: scale(1.15); }
    30% { transform: scale(1); }
    45% { transform: scale(1.15); }
    60% { transform: scale(1); }
}
