/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, sans-serif;
}

body {
    background: #1a1a2e;
    color: white;
    min-height: 100vh;
}

/* ===== SCREENS ===== */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* ===== BOUTONS GENERIQUES ===== */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.1s, opacity 0.2s;
    margin-top: 10px;
}

.btn:hover    { transform: scale(1.05); }
.btn:active   { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-green  { background: #2ecc71; color: white; }
.btn-orange { background: #e67e22; color: white; }
.btn-red    { background: #e74c3c; color: white; }
.btn-big    { font-size: 1.3rem; padding: 18px 40px; width: 100%; max-width: 400px; }

.btn-primary {
    padding: 14px 35px;
    font-size: 1.1rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover  { transform: scale(1.05); box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6); }
.btn-primary:active { transform: scale(0.96); }

/* ===== BOUTON VALIDER ===== */
#validate-btn {
    display: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
    transition: transform 0.1s, box-shadow 0.1s;
    margin-top: 10px;
}

#validate-btn:hover  { transform: scale(1.05); box-shadow: 0 6px 20px rgba(46, 204, 113, 0.6); }
#validate-btn:active { transform: scale(0.96); }

/* ===== PAGE ACCUEIL ===== */
.home-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.logo h1 {
    font-size: 3.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.logo p {
    color: #aaa;
    font-size: 1.1rem;
    margin-bottom: 40px;
}

.home-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.card {
    background: #16213e;
    border-radius: 20px;
    padding: 30px;
    width: 320px;
    border: 2px solid #0f3460;
    transition: transform 0.2s;
}

.card:hover { transform: translateY(-5px); }
.card-icon  { font-size: 3rem; margin-bottom: 15px; }
.card h2    { font-size: 1.5rem; margin-bottom: 8px; }
.card p     { color: #aaa; margin-bottom: 20px; }

.pin-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pin-input-group input {
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #0f3460;
    background: #0f3460;
    color: white;
    font-size: 1rem;
    text-align: center;
}

.pin-input-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* ===== BANDEAU POINTS (accueil) ===== */
.points-info-banner {
    margin-top: 30px;
    background: linear-gradient(135deg, #f5a623, #e94560);
    padding: 12px 25px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95em;
    font-weight: bold;
    color: white;
    box-shadow: 0 4px 15px rgba(245, 166, 35, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(245, 166, 35, 0.3); }
    50%       { box-shadow: 0 4px 25px rgba(245, 166, 35, 0.7); }
}

/* ===== PAGE HÔTE ===== */
.host-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

.host-container h1 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 20px;
}

.question-form {
    background: #16213e;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid #0f3460;
}

.question-form h3 { margin-bottom: 15px; }

.input-full {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #0f3460;
    background: #0f3460;
    color: white;
    font-size: 1rem;
    margin-bottom: 15px;
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.answer-input {
    padding: 10px;
    border-radius: 8px;
    border: none;
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
}

.answer-input.red    { background: #c0392b; }
.answer-input.blue   { background: #2980b9; }
.answer-input.green  { background: #27ae60; }
.answer-input.yellow { background: #d35400; }

.correct-select,
.timer-select {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.correct-select select,
.timer-select select {
    padding: 8px;
    border-radius: 8px;
    background: #0f3460;
    color: white;
    border: 1px solid #667eea;
}

/* ===== SÉLECTEUR DE POINTS ===== */
.points-select {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.points-select label {
    font-weight: bold;
    font-size: 0.95em;
}

.points-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.point-btn {
    padding: 10px 20px;
    border: 3px solid #555;
    border-radius: 12px;
    background: #2a2a3e;
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.point-btn:hover {
    border-color: #f5a623;
    background: #3a3a4e;
}

.point-btn.active {
    border-color: #f5a623;
    background: linear-gradient(135deg, #f5a623, #e94560);
    box-shadow: 0 4px 15px rgba(245, 166, 35, 0.4);
    transform: scale(1.05);
}

.points-custom {
    display: flex;
    align-items: center;
    gap: 8px;
}

.points-custom input {
    width: 150px;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #555;
    background: #2a2a3e;
    color: white;
    font-size: 1em;
    text-align: center;
}

.points-custom input:focus {
    border-color: #f5a623;
    outline: none;
}

.points-custom span {
    font-weight: bold;
    font-size: 1.1em;
    color: #f5a623;
}

/* ===== BADGE POINTS (écran question hôte) ===== */
.question-points-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #f5a623, #e94560);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(245, 166, 35, 0.3);
}

/* ===== POINTS GAGNÉS DANS LE CLASSEMENT ===== */
.pts-gained {
    font-weight: bold;
    color: #2ecc71;
    font-size: 1em;
    min-width: 60px;
    text-align: center;
}

.pts-gained.wrong { color: #e74c3c; }

/* ===== LISTE QUESTIONS ===== */
.question-card {
    background: #16213e;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.question-card .q-text { font-weight: bold; }
.question-card .q-meta { color: #aaa; font-size: 0.85rem; margin-top: 4px; }

.delete-btn {
    background: #e74c3c;
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}

/* ===== LOBBY ===== */
.lobby-container {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    padding: 20px;
    width: 100%;
}

.pin-display {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 20px;
    padding: 25px;
    margin: 20px 0;
}

.pin-number {
    font-size: 4rem;
    font-weight: bold;
    letter-spacing: 10px;
    margin: 10px 0;
}

.pin-hint { opacity: 0.8; font-size: 0.9rem; }

.players-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}

.player-chip {
    background: #16213e;
    border: 2px solid #667eea;
    border-radius: 25px;
    padding: 8px 18px;
    font-weight: bold;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* ===== ÉCRAN QUESTION HÔTE ===== */
.question-screen {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.timer-circle {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
}

.question-box {
    background: white;
    color: #333;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-box h2 { font-size: 1.5rem; }

.answers-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.answer-box {
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: bold;
}

.answer-box.red    { background: #e74c3c; }
.answer-box.blue   { background: #3498db; }
.answer-box.green  { background: #2ecc71; color: #333; }
.answer-box.yellow { background: #f39c12; color: #333; }

.answer-count {
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* ===== RÉSULTATS ===== */
.results-container,
.end-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 20px;
    width: 100%;
}

.scoreboard,
.final-scores { margin: 20px 0; }

.score-row {
    background: #16213e;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.1rem;
}

.score-row:nth-child(1) { border-left: 5px solid gold; }
.score-row:nth-child(2) { border-left: 5px solid silver; }
.score-row:nth-child(3) { border-left: 5px solid #cd7f32; }

.rank-num    { font-size: 1.5rem; min-width: 40px; }
.player-name { flex: 1; text-align: left; font-weight: bold; }
.player-pts  { color: #667eea; font-weight: bold; }

/* ===== PAGE JOUEUR ===== */
.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #16213e;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.player-timer {
    background: #e74c3c;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: bold;
    transition: background 0.3s;
}

.player-question-box {
    background: white;
    color: #333;
    padding: 25px;
    margin-top: 90px;
    margin-bottom: 20px;
    margin-left: 15px;
    margin-right: 15px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 15px;
}

.player-question-box h2 { font-size: 1.3rem; }

.player-answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 15px;
}

.player-answer-btn {
    border: none;
    border-radius: 12px;
    padding: 20px 10px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 100px;
    transition: transform 0.1s, outline 0.1s, opacity 0.2s;
}

.player-answer-btn:active   { transform: scale(0.95); }
.player-answer-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.player-answer-btn.red    { background: #e74c3c; }
.player-answer-btn.blue   { background: #3498db; }
.player-answer-btn.green  { background: #2ecc71; }
.player-answer-btn.yellow { background: #f39c12; }

.btn-icon { font-size: 1.5rem; }

/* ===== AVATAR GRID ===== */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    max-width: 320px;
    margin: 20px auto;
}

.avatar-option {
    width: 65px;
    height: 65px;
    object-fit: cover;
    border-radius: 50%;
    cursor: pointer;
    border: 4px solid transparent;
    transition: all 0.2s;
}

.avatar-option:hover {
    transform: scale(1.1);
    border-color: #aaa;
}

.avatar-option.selected {
    border-color: #6c63ff;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(108, 99, 255, 0.6);
}

/* ===== AVATAR EN ATTENTE ===== */
.player-avatar-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #6c63ff;
    margin-bottom: 15px;
}

/* ===== CENTRE BOX ===== */
.center-box {
    text-align: center;
    padding: 30px;
    max-width: 400px;
    width: 100%;
}

.player-avatar { font-size: 5rem; margin-bottom: 15px; }

/* ===== SPINNER ===== */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #16213e;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== WAITING DOTS ===== */
.waiting-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.waiting-dots span {
    width: 12px;
    height: 12px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ===== FEEDBACK RÉPONSE ===== */
.answer-feedback { text-align: center; }
.feedback-icon   { font-size: 4rem; margin-bottom: 15px; }
.result-icon     { font-size: 5rem; margin-bottom: 20px; }

.points-gained {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2ecc71;
    margin: 15px 0;
}

.total-score {
    font-size: 1.1rem;
    color: #aaa;
}

.final-rank {
    background: #16213e;
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
    font-size: 1.2rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
    .home-cards      { flex-direction: column; align-items: center; }
    .answers-display { grid-template-columns: 1fr; }
    .player-answers  { grid-template-columns: 1fr 1fr; }
    .logo h1         { font-size: 2.5rem; }
    .pin-number      { font-size: 2.5rem; letter-spacing: 5px; }
    .points-buttons  { gap: 6px; }
    .point-btn       { padding: 8px 14px; font-size: 1em; }
    .avatar-grid     { grid-template-columns: repeat(3, 1fr); }
}
/* ===== PODIUM ===== */
.end-container {
    text-align: center;
    padding: 30px 20px;
    max-width: 700px;
    width: 100%;
}

.podium-wrapper {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 15px;
    margin: 20px auto 40px;
}

.podium-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.podium-player.podium-animate {
    opacity: 1;
    transform: translateY(0);
}

.podium-crown {
    font-size: 2rem;
    margin-bottom: 5px;
}

.podium-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    margin-bottom: 8px;
}

.podium-first .podium-avatar {
    width: 90px;
    height: 90px;
    border-color: #f1c40f;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
}

.podium-name {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 4px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium-first .podium-name {
    font-size: 1.2rem;
}

.podium-score {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 8px;
}

.podium-block {
    width: 80px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.podium-block-1 {
    height: 120px;
    background: linear-gradient(180deg, #f1c40f, #d4a017);
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.5);
}

.podium-block-2 {
    height: 90px;
    background: linear-gradient(180deg, #95a5a6, #7f8c8d);
    box-shadow: 0 0 15px rgba(149, 165, 166, 0.4);
}

.podium-block-3 {
    height: 65px;
    background: linear-gradient(180deg, #cd7f32, #a0522d);
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.4);
}

/* ===== CLASSEMENT COMPLET ===== */
.full-ranking {
    max-width: 450px;
    margin: 0 auto;
}

.final-scores {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.final-score-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #16213e;
    border-radius: 12px;
    padding: 12px 16px;
    border: 1px solid #0f3460;
}

.final-rank-medal {
    font-size: 1.3rem;
    min-width: 35px;
    text-align: center;
}

.final-rank-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
}

.final-rank-name {
    flex: 1;
    font-weight: bold;
    text-align: left;
}

.final-rank-score {
    font-weight: bold;
    color: #f1c40f;
    font-size: 1.1rem;
}
