/*
 * 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 !important; }

/* =====================================================
   MODE HYBRIDE — Plein écran questions uniquement
   ===================================================== */
#screen-game.hybrid-mode .mountain-board { display: none; }
#screen-game.hybrid-mode .topbar-center-hud { 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: 900px; 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: 240px; padding: 1.5rem 1rem; }
#screen-game.hybrid-mode .result-all-choices { max-width: 900px; margin: 0 auto 0.75rem; }

/* 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 PLEIN ÉCRAN ONLINE / HYBRIDE
   ===================================================== */
#screen-game { overflow: hidden; }
#screen-game.active { display: flex; }

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

/* Barre supérieure du jeu (Navigation + Scores + Actions unifiés) */
.game-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.85rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 0.5rem;
    height: 48px;
}

.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.topbar-center-hud {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    flex: 1;
    max-width: 820px;
}

.btn-quit {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    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: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-quit:hover { background: rgba(239,68,68,0.3); }

.btn-topbar-log {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-topbar-log:hover {
    background: var(--bg-hover);
    border-color: var(--blue);
}

.btn-actions-anim {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--blue);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    transition: all 0.2s;
    font-family: inherit;
}
.btn-actions-anim:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

/* Team HUD ultra-compact */
.team-hud {
    flex: 1;
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 0.25rem 0.6rem;
    border: 1.5px solid var(--border);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    height: 34px;
    position: relative;
    max-width: 310px;
}
.team-hud.active-team {
    border-color: var(--blue);
    box-shadow: 0 0 12px rgba(59,130,246,0.25);
}

.hud-top-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}
.hud-name {
    font-weight: 800;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.hud-o2 {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.o2-bar-container {
    width: 65px;
    height: 7px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}
.o2-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--green), #86EFAC);
    border-radius: 4px;
    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: 0.85rem;
    min-width: 2ch;
    text-align: right;
    color: var(--text-primary);
}

.hud-position {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.hud-position span { font-weight: 800; color: var(--text-primary); }

.hud-shield { font-size: 0.9rem; color: var(--gold); }

/* Game Turn Info compact */
.game-turn-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    line-height: 1.1;
    flex-shrink: 0;
}
.turn-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}
.turn-label strong {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--text-primary);
}
.current-team-indicator {
    font-size: 0.7rem;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

/* Action Panel — Pleine largeur et pleine hauteur restante */
.action-panel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.action-state {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* =====================================================
   ÉTAT 1 : CHOIX DU DECK & CARTE K2
   ===================================================== */
#state-choose-deck {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
}

/* Carte K2 — Grande et centrée sous les scores */
.mountain-board {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 1rem 0.2rem;
    overflow: hidden;
}
.board-map-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1100px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    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 */
.pion-html {
    position: absolute;
    width: 28px;
    height: 28px;
    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: 13px;
    line-height: 22px;
    text-align: center;
}

/* Choix sous la carte */
.choose-deck-bottom {
    flex-shrink: 0;
    padding: 0.35rem 1rem 0.65rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.action-title { font-size: 1.25rem; font-weight: 800; text-align: center; margin-bottom: 0.2rem; }
.action-subtitle { text-align: center; color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 0.5rem; }

/* Boutons de deck — Cartes modernes avec pastilles lumineuses */
.deck-choices {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    width: 100%;
    max-width: 850px;
}
.deck-btn {
    flex: 1;
    min-width: 150px;
    max-width: 260px;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 2px solid var(--border);
    background: #0f172a;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    font-family: inherit;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.deck-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.deck-sphere-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.2rem;
}
.deck-sphere {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-block;
}
.sphere-green {
    background: radial-gradient(circle at 35% 35%, #86efac, #22c55e 60%, #15803d);
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.7);
}
.sphere-orange {
    background: radial-gradient(circle at 35% 35%, #fdba74, #f97316 60%, #c2410c);
    box-shadow: 0 0 14px rgba(249, 115, 22, 0.7);
}
.sphere-red {
    background: radial-gradient(circle at 35% 35%, #fca5a5, #ef4444 60%, #b91c1c);
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.7);
}

.deck-label { font-weight: 800; font-size: 1.05rem; color: #ffffff; }
.deck-info { font-size: 0.8rem; color: #94A3B8; font-weight: 600; }
.deck-remaining { font-size: 0.75rem; color: #64748B; font-style: italic; }

.deck-green:hover:not(:disabled) {
    border-color: var(--green);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(34,197,94,0.3);
    background: #112217;
}
.deck-orange:hover:not(:disabled) {
    border-color: var(--orange);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(249,115,22,0.3);
    background: #231911;
}
.deck-red:hover:not(:disabled) {
    border-color: var(--red);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(239,68,68,0.3);
    background: #241111;
}

/* =====================================================
   ÉTAT 2 : QUESTION GRAND FORMAT (PLEIN ÉCRAN)
   ===================================================== */
#state-question {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0.4rem 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-display {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    flex: 1;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.card-header-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1.5rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.card-id {
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-weight: 900;
    font-size: 1rem;
    color: white;
    letter-spacing: 0.05em;
}
.card-title-text {
    flex: 1;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.timer-container { flex-shrink: 0; }
.timer-ring { position: relative; width: 48px; height: 48px; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-bg { fill: none; stroke: var(--bg-dark); stroke-width: 4; }
.timer-progress { fill: none; stroke: var(--green); stroke-width: 4; 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: 1.05rem;
    color: var(--green);
    font-family: 'Orbitron', monospace;
}

.card-situation {
    padding: 0.75rem 1.5rem;
    font-size: clamp(1rem, 1.3vw, 1.22rem);
    line-height: 1.5;
    color: var(--text-primary);
    background: rgba(0,0,0,0.18);
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    flex-shrink: 0;
}

.card-choices {
    padding: 0.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    justify-content: center;
}

/* Boutons de proposition grand format */
.choice-btn {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 1rem;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    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.1);
    transform: translateX(4px);
}
.choice-btn.selected {
    border-color: var(--blue);
    background: rgba(59,130,246,0.2);
    box-shadow: 0 0 0 1px var(--blue), 0 0 15px rgba(59,130,246,0.25);
}
.choice-btn:disabled { cursor: default; }
.choice-btn.correct { border-color: var(--green) !important; background: rgba(34,197,94,0.2) !important; }
.choice-btn.wrong { border-color: var(--red) !important; background: rgba(239,68,68,0.2) !important; }

.choice-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-dark);
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.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: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.4;
    font-weight: 600;
    flex: 1;
}

/* Validation — Toujours visible */
.card-validate-bar {
    padding: 0.6rem 1.5rem 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

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

/* =====================================================
   ÉTAT 3 : RÉSULTAT
   ===================================================== */
#state-result {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.result-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.result-icon { font-size: 2.8rem; text-align: center; margin-bottom: 0.3rem; }
.result-title { text-align: center; font-size: 1.5rem; 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.95rem; color: var(--text-secondary); margin-bottom: 0.75rem; }

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

.rc-choice {
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    border-left: 5px solid;
    transition: all 0.3s;
    position: relative;
}
.rc-correct { background: rgba(34,197,94,0.12); border-color: var(--green); }
.rc-adjacent { background: rgba(249,115,22,0.1); border-color: var(--orange); }
.rc-error { background: rgba(239,68,68,0.1); border-color: var(--red); }

.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;
}

.rc-header { display: flex; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.3rem; }
.rc-letter {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 6px; font-weight: 800; font-size: 0.9rem; 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.95rem; line-height: 1.4; flex: 1; color: var(--text-primary); font-weight: 500; }
.rc-chosen-badge {
    flex-shrink: 0; font-size: 0.75rem; font-weight: 800; padding: 0.2rem 0.6rem;
    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.2rem; }
.rc-style-badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 700; color: white; }
.rc-category { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }

.rc-explanation { font-size: 0.88rem; line-height: 1.45; color: var(--text-secondary); margin-left: 2.2rem; 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 1.2rem; border-radius: var(--radius); font-weight: 700; font-size: 1rem; }
.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; font-size: 1.1rem; padding: 0.8rem 2rem; font-weight: 800; }

/* =====================================================
   JOURNAL DE BORD DANS LA MODALE
   ===================================================== */
.log-content-modal {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.log-entry {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-radius: 6px;
    background: var(--bg-dark);
    line-height: 1.45;
}
.log-time { color: var(--text-muted); margin-right: 0.5rem; font-size: 0.72rem; }

.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;
}

/* =====================================================
   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 { height: 100vh; }
    .mountain-board { padding: 0.2rem; }
    .deck-choices { gap: 0.75rem; }
    .deck-btn { padding: 0.6rem 0.8rem; min-width: 120px; }
    .card-situation { font-size: 1.1rem; padding: 1rem 1.25rem; }
    .card-choices { padding: 0.75rem 1.25rem; gap: 0.5rem; }
    .choice-btn { padding: 0.65rem 1rem; }
    .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; }
    .game-header { flex-direction: column; gap: 0.5rem; }
    .deck-choices { flex-direction: column; align-items: center; width: 100%; }
    .deck-btn { max-width: 100%; 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); }
}

/* =====================================================
   ÉCRAN DES RÈGLES DU JEU
   ===================================================== */
#screen-rules {
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #0B1120 0%, #111e36 50%, #0B1120 100%);
    padding: 2rem;
}
.theme-light #screen-rules {
    background: linear-gradient(180deg, #F0F8FF 0%, #d4eaf7 50%, #F0F8FF 100%);
}

.rules-container {
    width: 100%;
    max-width: 900px;
    height: 85vh;
    max-height: 720px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}
.rules-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

.rules-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar onglets */
.rules-sidebar {
    width: 220px;
    background: rgba(0,0,0,0.15);
    border-right: 1px solid var(--border);
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}
.theme-light .rules-sidebar {
    background: rgba(255,255,255,0.4);
}

.rules-tab-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: all 0.25s;
}
.rules-tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}
.rules-tab-btn.active {
    color: white;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    box-shadow: 0 4px 12px rgba(59,130,246,0.25);
}
.tab-icon {
    font-size: 1.1rem;
}

/* Zone de contenu des slides */
.rules-content-panel {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: var(--bg-card);
}

.rules-slide {
    display: none;
    flex-direction: column;
    height: 100%;
}
.rules-slide.active {
    display: flex;
}

.slide-header {
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}
.slide-header h3 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.slide-icon {
    font-size: 1.6rem;
}

.slide-desc {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Grilles explicatives */
.rules-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.rules-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.rules-card h4 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
}
.rules-card p {
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.rules-alert {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    line-height: 1.45;
    align-items: flex-start;
}
.rules-alert.info {
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.2);
    color: var(--text-primary);
}
.rules-alert.info i {
    color: var(--blue);
    font-size: 1.1rem;
    margin-top: 2px;
}

/* Decks Voies presentation */
.decks-presentation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.deck-explain {
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.deck-expheader {
    padding: 0.75rem;
    font-weight: 800;
    font-size: 0.95rem;
    text-align: center;
    color: white;
}
.green-deck { border-color: rgba(34,197,94,0.3); }
.green-deck .deck-expheader { background: rgba(34,197,94,0.2); color: var(--green); border-bottom: 1px solid rgba(34,197,94,0.3); }
.orange-deck { border-color: rgba(249,115,22,0.3); }
.orange-deck .deck-expheader { background: rgba(249,115,22,0.2); color: var(--orange); border-bottom: 1px solid rgba(249,115,22,0.3); }
.red-deck { border-color: rgba(239,68,68,0.3); }
.red-deck .deck-expheader { background: rgba(239,68,68,0.2); color: var(--red); border-bottom: 1px solid rgba(239,68,68,0.3); }

.deck-expbody {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    flex: 1;
}
.deck-exppos {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}
.deck-expbody p {
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

/* Management & Adjacency Slide */
.styles-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.styles-list li {
    font-size: 0.8rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: var(--text-primary);
}
.adjacency-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}
.adjacency-card h4 {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}
.adjacency-schema {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
    background: var(--bg-dark);
    padding: 0.75rem;
    border-radius: 8px;
}
.adj-node {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
}
.adj-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    max-width: 40px;
}
.adj-expl {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.78rem;
}
.green-text { color: var(--green); }
.orange-text { color: var(--orange); }
.red-text { color: var(--red); }

/* Zones */
.zones-presentation-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
.zone-explain {
    background: var(--bg-surface);
    border-left: 5px solid;
    border-radius: 4px var(--radius) var(--radius) 4px;
    padding: 1rem;
}
.green-zone { border-left-color: var(--green); }
.orange-zone { border-left-color: var(--orange); }
.red-zone { border-left-color: var(--red); }
.zone-expheader {
    font-weight: 800;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}
.zone-expbody {
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

/* Footer rules */
.rules-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
}
.rules-progress {
    display: flex;
    gap: 0.5rem;
}
.rules-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    cursor: pointer;
    transition: background 0.3s;
}
.rules-dot:hover {
    background: var(--text-muted);
}
.rules-dot.active {
    background: var(--blue);
    box-shadow: 0 0 8px rgba(59,130,246,0.6);
}

/* Adaptation Responsive Rules */
@media (max-width: 768px) {
    #screen-rules {
        padding: 0.5rem;
    }
    .rules-container {
        height: 100vh;
        max-height: none;
        border-radius: 0;
        border: none;
    }
    .rules-layout {
        flex-direction: column;
    }
    .rules-sidebar {
        width: 100%;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        white-space: nowrap;
        padding: 0.5rem;
    }
    .rules-tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    .rules-content-panel {
        padding: 1rem;
    }
    .rules-grid-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .decks-presentation-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}
