@import url('https://fonts.googleapis.com/css2?family=Rajdhani:ital,wght@0,500;0,700;1,800&family=Roboto+Mono:wght@700&display=swap');

#gameCanvas #turbo-wrapper {
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    width: 100%;
    min-height: 600px;
    padding: 20px;
    display: flex; justify-content: center; align-items: center;
    position: relative;
    font-family: 'Rajdhani', sans-serif;
    box-sizing: border-box;
}

#gameCanvas #turbo-wrapper:fullscreen {
    width: 100vw; height: 100vh; padding: 0; align-items: center; justify-content: center;
}

#gameCanvas .ts-container {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.25);
    width: 100%; max-width: 650px;
    height: 85vh; max-height: 850px;
    display: flex; flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 4px solid #fff;
}

#gameCanvas #turbo-wrapper:fullscreen .ts-container {
    width: 100%; max-width: 900px; height: 100vh; max-height: none; border: none; border-radius: 0;
}

/* HEADER */
#gameCanvas .ts-main-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px; background: #f8f9fa; border-bottom: 1px solid #e9ecef; flex-shrink: 0;
}
#gameCanvas .ts-title {
    margin: 0; font-size: 1.6rem; font-weight: 800; font-style: italic;
    color: #2c3e50; text-transform: uppercase; line-height: 1;
}
#gameCanvas .ts-version { font-size: 0.7rem; color: #ff9900; background: #fff3cd; padding: 2px 5px; border-radius: 4px; }
#gameCanvas .ts-subtitle { margin: 0; font-size: 0.8rem; color: #6c757d; font-weight: 600; }

/* MENU */
#gameCanvas .ts-screen { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
#gameCanvas .hidden { display: none !important; }
#gameCanvas .active { display: flex !important; }

#gameCanvas .ts-menu-content {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 15px; padding: 20px;
}
#gameCanvas .instruction-box {
    background: #e3f2fd; color: #0d47a1; padding: 12px; border-radius: 8px;
    display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 0.9rem;
    border-left: 4px solid #2196f3; margin-bottom: 10px; width: 100%;
}
#gameCanvas .ts-label-diff { font-size: 0.8rem; color: #888; letter-spacing: 1px; font-weight: bold; margin-bottom: 5px; }

#gameCanvas .difficulty-grid { 
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-bottom: 20px;
}
#gameCanvas .diff-btn {
    background: #f8f9fa; border: 2px solid #dee2e6; padding: 15px;
    border-radius: 10px; cursor: pointer; font-family: 'Rajdhani'; font-weight: 700;
    font-size: 1rem; color: #495057; transition: 0.2s;
}
#gameCanvas .diff-btn:hover { transform: translateY(-2px); border-color: #ced4da; }
#gameCanvas .diff-btn.selected { transform: scale(1.02); }
#gameCanvas .diff-btn[data-diff="easy"].selected { background: #d4edda; border-color: #28a745; color: #155724; }
#gameCanvas .diff-btn[data-diff="medium"].selected { background: #fff3cd; border-color: #ffc107; color: #856404; }
#gameCanvas .diff-btn[data-diff="hard"].selected { background: #f8d7da; border-color: #dc3545; color: #721c24; }
#gameCanvas .diff-btn[data-diff="extreme"].selected { background: #e2e3e5; border-color: #343a40; color: #1d2124; }

/* GAME UI */
#gameCanvas .ts-scoreboard {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 15px; background: #151520; color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); z-index: 10; flex-shrink: 0;
}
#gameCanvas .label { font-size: 0.6rem; opacity: 0.7; letter-spacing: 1px; }
#gameCanvas .value { font-size: 1.4rem; font-weight: 700; font-family: 'Roboto Mono'; line-height: 1; }
#gameCanvas .team-blue .value { color: #00d2ff; text-shadow: 0 0 10px rgba(0, 210, 255, 0.5); }
#gameCanvas .team-orange .value { color: #ff5e57; }

/* ZONE DE JEU : Hauteur Min pour éviter l'écrasement */
#gameCanvas .game-area-wrapper {
    flex: 1; position: relative; background: #101015; overflow: hidden;
    min-height: 450px; /* IMPORTANT : Empêche le jeu d'être trop plat */
}
#gameCanvas #ts-game-canvas { width: 100%; height: 100%; display: block; }

#gameCanvas .ts-btn-primary {
    background: linear-gradient(90deg, #ff9900, #ff5e57);
    color: white; border: none; padding: 15px 40px; border-radius: 5px;
    font-family: 'Rajdhani'; font-weight: 800; font-size: 1.4rem; font-style: italic;
    cursor: pointer; transform: skewX(-10deg); box-shadow: 3px 3px 0 #c0392b;
    transition: 0.1s; text-transform: uppercase; width: 100%;
}
#gameCanvas .ts-btn-primary:active { transform: skewX(-10deg) translate(2px, 2px); box-shadow: none; }
#gameCanvas .ts-btn-secondary {
    background: transparent; border: 2px solid #adb5bd; color: #6c757d;
    padding: 10px 20px; border-radius: 5px; font-weight: bold; cursor: pointer; transform: skewX(-10deg);
}
#gameCanvas .ts-btn-icon, #gameCanvas .ts-btn-mini {
    background: rgba(0,0,0,0.05); border: none; width: 36px; height: 36px;
    border-radius: 50%; cursor: pointer; color: #333; font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center; transition: 0.2s;
}
#gameCanvas .ts-btn-mini { background: rgba(255,255,255,0.2); color: white; width: 30px; height: 30px; }

/* TYPING DISPLAY */
#gameCanvas #ts-typing-wrapper {
    position: absolute; bottom: 20%; left: 50%; transform: translateX(-50%);
    text-align: center; pointer-events: none; transition: opacity 0.2s; opacity: 1;
    z-index: 20;
}
#gameCanvas #ts-typing-wrapper.invisible { opacity: 0; }

#gameCanvas #ts-typing-display {
    background: rgba(0, 0, 0, 0.85); padding: 8px 20px;
    border-radius: 6px; border: 2px solid #00d2ff;
    font-family: 'Roboto Mono', monospace; font-size: 1.8rem; font-weight: bold; color: #fff;
    white-space: nowrap; margin-bottom: 5px; box-shadow: 0 0 25px rgba(0, 210, 255, 0.6);
}
#gameCanvas .highlight { color: #00d2ff; text-shadow: 0 0 10px #00d2ff; }
#gameCanvas #ts-remain { color: rgba(255,255,255,0.5); }
#gameCanvas .ts-boost-bar-bg { width: 100%; height: 5px; background: rgba(0,0,0,0.5); border-radius: 2px; overflow: hidden; }
#gameCanvas #ts-boost-bar { width: 0%; height: 100%; background: #ff9900; transition: width 0.1s; }

#gameCanvas #ts-hidden-input { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }

#gameCanvas .ts-modal-overlay {
    position: absolute; inset: 0; background: rgba(16, 16, 21, 0.95);
    display: flex; align-items: center; justify-content: center; z-index: 50;
    backdrop-filter: blur(4px);
}
#gameCanvas .ts-modal {
    background: #fff; padding: 25px; border-radius: 10px; width: 85%; max-width: 320px;
    text-align: center; border-top: 5px solid #ff9900;
}
#gameCanvas .ts-result-box { background: #f8f9fa; padding: 15px; border-radius: 8px; margin: 15px 0; }
#gameCanvas .score-final { font-size: 2.5rem; font-weight: 800; color: #2c3e50; font-family: 'Rajdhani'; }
#gameCanvas .stats-row { display: flex; justify-content: space-between; font-size: 0.9rem; color: #555; }
#gameCanvas .ts-modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 15px; }

@media (max-width: 600px) {
    #gameCanvas .ts-title { font-size: 1.3rem; }
    #gameCanvas .ts-subtitle { display: none; }
    #gameCanvas .difficulty-grid { grid-template-columns: 1fr; }
}