/* =============================================================================
   view-timer.css — Layout TV / projecteur salle, partagé pour TD et public.
   Mai 2026 : repris du défunt tv-timer.css (design jugé meilleur) + ajouts
   propres à view-timer (admin overlay, menu joueur, modale, TIME penalty).
   ============================================================================= */

* { box-sizing: border-box; }

/* Le body view-timer reçoit déjà .timer-page-body via timer.css.
   On surcharge le fond + on désactive le scroll global. */
.timer-page-body {
    margin-top: 0 !important;
    height: 100vh !important;
    width: 100vw;
    color: #fff;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: radial-gradient(circle at 50% 50%, #1a1a1a 0%, #000 90%);
    overflow: hidden;
    position: relative;
}

/* Curseur masqué par défaut (mode TV) — réapparaît au mouvement via .show-cursor */
body.timer-page-body { cursor: none; }
body.show-cursor, body.show-nav { cursor: default !important; }

/* État offline (perte SSE) */
body.is-offline .tv-layout { filter: saturate(0.4) brightness(0.7); }

/* =============================================================================
   LAYOUT — grille 2 colonnes : main + sidebar
   ============================================================================= */
.tv-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header header"
        "main   sidebar"
        "footer sidebar";
    width: 100vw;
    height: 100vh;
    gap: 0;
    transition: padding-top 0.4s ease;
}
/* Quand la nav du header.php glisse en place (mousemove), on libère sa hauteur
   en haut pour ne pas qu'elle masque le tv-header. !important pour gagner
   contre timer.css qui fixe height:100vh sur .timer-page-body. */
body.show-nav .tv-layout { padding-top: 68px !important; }
/* La nav doit toujours être devant le tv-header (filet de sécurité au cas où
   un autre stylesheet créerait un stacking context au-dessus). */
.main-nav { z-index: 100000 !important; }
.tv-header { position: relative; z-index: 1; }

@media (min-width: 2200px) {
    .tv-layout { grid-template-columns: 1fr 480px; }
}

/* =============================================================================
   HEADER : nom du tournoi + niveau + heure
   ============================================================================= */
.tv-header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 36px;
    background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 100%);
    border-bottom: 2px solid rgba(241, 196, 15, 0.5);
}
.tv-title {
    font-size: clamp(1.4rem, 2vw, 2.6rem);
    font-weight: 700;
    color: #f1c40f;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.tv-level {
    font-size: clamp(1.4rem, 2vw, 2.6rem);
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 4px 22px;
    background: rgba(241, 196, 15, 0.15);
    border: 2px solid #f1c40f;
    border-radius: 12px;
}
.tv-wall-clock {
    font-size: clamp(1.4rem, 2vw, 2.6rem);
    font-weight: 700;
    color: #ecf0f1;
    font-family: 'Inter', 'Segoe UI', sans-serif; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "zero" 0;
}

/* Status bar (PAUSE / PROTECTION / ATTENTE) */
.tv-status-bar {
    text-align: center;
    padding: 6px 0;
    font-size: clamp(1rem, 1.5vw, 1.8rem);
    font-weight: bold;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: pulse-status 2s infinite;
}
@keyframes pulse-status {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* =============================================================================
   MAIN : chrono géant + blinds + ante + next
   ============================================================================= */
.tv-main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 40px;
    overflow: hidden;
    position: relative;
}
.timer-active-display, .timer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.tv-clock {
    font-size: clamp(8rem, 22vw, 26rem);
    font-weight: 900;
    line-height: 0.9;
    /* Inter en tabular-nums : chiffres alignés sans le "point dans le zéro"
       qu'ajoutent JetBrains Mono / Roboto Mono par défaut. */
    font-family: 'Inter', 'Segoe UI', 'Arial Black', sans-serif;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "zero" 0;
    letter-spacing: -0.04em;
    color: #fff;
    text-shadow: 0 0 60px rgba(255, 255, 255, 0.12);
    transition: color 0.4s ease;
}
.tv-clock.warning    { color: #f39c12; text-shadow: 0 0 80px rgba(243, 156, 18, 0.45); }
.tv-clock.critical   { color: #e74c3c; text-shadow: 0 0 80px rgba(231, 76, 60, 0.55); animation: pulse-critical 1s infinite; }
.tv-clock.paused     { color: #e74c3c; opacity: 0.8; }
/* Compte à rebours avant lancement : chaîne plus longue (HH:MM:SS, « Nj HH:MM »)
   que le « MM:SS » du chrono -> police réduite pour éviter le débordement. */
.tv-clock.pre-launch { font-size: clamp(3rem, 13vw, 14rem); color: #2ecc71; }
/* Protection moyenne : blinds gelées, chrono tenu à 00:00. Bleu « glace », distinct
   de l'orange (bientôt fini) et du rouge (pause/critique), avec une pulsation douce. */
.tv-clock.avg-frozen { color: #4fc3f7; text-shadow: 0 0 90px rgba(79, 195, 247, 0.6); animation: pulse-frozen 1.6s ease-in-out infinite; }
@keyframes pulse-critical {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.02); }
}
@keyframes pulse-frozen {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

.tv-blinds-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 24px;
    margin-top: 10px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "zero" 0;
}
.tv-blinds {
    font-size: clamp(3rem, 7vw, 9rem);
    font-weight: 700;
    color: #ecf0f1;
    letter-spacing: -0.02em;
}
.tv-blinds .sep { color: #555; padding: 0 10px; }
.tv-break-text {
    font-size: clamp(4rem, 9vw, 11rem);
    font-weight: 900;
    color: #f1c40f;
    text-transform: uppercase;
    letter-spacing: 8px;
}
.tv-ante {
    margin-top: 6px;
    font-size: clamp(1.4rem, 2.5vw, 2.8rem);
    color: #f1c40f;
    letter-spacing: 4px;
    text-transform: uppercase;
}
.tv-ante .ante-label { opacity: 0.7; margin-right: 8px; }

.tv-next-line {
    margin-top: 20px;
    font-size: clamp(1.2rem, 2vw, 2rem);
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-align: center;
}
.tv-next-line strong, .tv-next-line span[style*="color"] { color: #fff; font-weight: 700; }
.tv-next-line .bubble {
    margin-left: 24px;
    color: #2980b9;
    font-weight: 700;
    animation: pulse-status 1.4s infinite;
}

/* Special-info-box (niveau nommé / description) */
.special-info-container {
    margin-bottom: 10px;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    border-left: 4px solid #f1c40f;
    display: inline-block;
    min-width: 300px;
    text-align: center;
}
.special-title {
    font-size: clamp(1.2rem, 2vw, 2rem);
    font-weight: 800;
    color: #f1c40f;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.special-description {
    font-size: clamp(0.85rem, 1.2vw, 1.1rem);
    color: #bdc3c7;
    font-style: italic;
    margin-top: 4px;
}

/* =============================================================================
   FOOTER : 4 stats
   ============================================================================= */
.tv-footer {
    grid-area: footer;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    padding: 18px 36px 22px;
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 100%);
    border-top: 2px solid rgba(241, 196, 15, 0.5);
}
.tv-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}
.tv-stat .label {
    font-size: clamp(0.7rem, 1vw, 1rem);
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 6px;
}
.tv-stat .value {
    font-size: clamp(1.6rem, 2.6vw, 3.2rem);
    font-weight: 700;
    color: #fff;
    font-family: 'Inter', 'Segoe UI', sans-serif; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "zero" 0;
}
.tv-stat .value .accent, .tv-stat .value #players-count, .tv-stat .value #avg-stack { color: #f1c40f; }
.tv-stat .sub {
    font-size: clamp(0.7rem, 1vw, 1rem);
    color: #7f8c8d;
    margin-top: 2px;
}

/* =============================================================================
   SIDEBAR : leaderboard scrolling + QR code optionnel
   ============================================================================= */
.tv-sidebar {
    grid-area: sidebar;
    background: rgba(0, 0, 0, 0.5);
    border-left: 2px solid rgba(241, 196, 15, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.tv-sidebar-header {
    padding: 12px;
    text-align: center;
    color: #f1c40f;
    font-size: clamp(0.9rem, 1.1vw, 1.3rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    border-bottom: 1px solid rgba(241, 196, 15, 0.2);
}
.tv-sidebar .qr-block {
    text-align: center;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.tv-sidebar .qr-block img {
    width: 120px;
    height: 120px;
    border: 4px solid #fff;
    border-radius: 8px;
}
.tv-sidebar .qr-block .qr-label {
    margin-top: 6px;
    font-size: 0.75rem;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.scroll-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}
.scroll-content { position: relative; }
@keyframes scrollLeaderboard {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

.ranking-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: clamp(0.9rem, 1.1vw, 1.3rem);
    background: transparent;
    margin: 0;
    border-left: none;
    border-radius: 0;
}
.ranking-row .rank-col {
    flex: 0 0 70px;
    color: #95a5a6;
    font-weight: 700;
    font-family: 'Inter', 'Segoe UI', sans-serif; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "zero" 0;
    font-size: 0.95em;
    min-width: 70px;
}
.ranking-row .name-col {
    flex: 1;
    color: #ecf0f1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ranking-row .pts-col {
    flex: 0 0 50px;
    text-align: right;
    color: #2ecc71;
    font-weight: 700;
    font-family: 'Inter', 'Segoe UI', sans-serif; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "zero" 0;
}
.ranking-row .player-name-active { color: #f1c40f; font-weight: 600; }

/* =============================================================================
   WINNER (fin de tournoi) — affiché via JS sur body.tournament-winner
   ============================================================================= */
#winner-section {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* La modale de contrôle (.td-overlay, z-index:10001, position:fixed) est
       large sur mobile et recouvrait le bas de la carte → le pavé "Partager"
       (le plus bas) tombait SOUS la modale et c'est elle qui captait le clic
       (avatar/nom, plus hauts, fonctionnaient). On passe donc AU-DESSUS de la
       modale, mais en pointer-events:none : les taps sur le vide / trophée /
       titre traversent (la modale reste révélable pour l'undo via ACTIONS TD),
       et seule la carte (règle ci-dessous) capte réellement le clic → partage. */
    position: relative;
    z-index: 10002;
    pointer-events: none;
}
body.tournament-winner #timer-section,
body.tournament-winner .tv-next-line { display: none !important; }
body.tournament-winner #winner-section { display: flex !important; }
/* Écran vainqueur : la nav ne doit pas décaler le contenu centré (sinon le bas
   du pavé — l'indice "Partager" — est coupé, l'écran n'étant pas scrollable). */
body.tournament-winner.show-nav .tv-layout { padding-top: 0 !important; }

/* timer.css fait `header, .navbar, .main-nav { position:fixed !important;
   transform:translateY(-100%) }` pour auto-masquer la barre de nav — mais le
   sélecteur `header` capture AUSSI notre <header class="tv-header"> (nom du
   tournoi / niveau / heure). Résultat : sur l'écran de fin il réapparaissait au
   tap (body.show-nav → translateY(0)), fixé en haut, PAR-DESSUS le trophée
   (fond semi-transparent → trophée visible en transparence sur la photo). On le
   refixe dans le flux de la grille sur l'écran vainqueur (2 classes + !important
   pour battre le `header`/`body.show-nav header` de timer.css). */
body.tournament-winner .tv-header {
    position: relative !important;
    transform: none !important;
    z-index: 1;
}

/* Appliqué (par view-timer.js) uniquement PENDANT la capture de partage.
   html2canvas rend mal la grille 2 colonnes du bureau (l'en-tête, étendu sur
   "header header", finit par-dessus le vainqueur). On bascule en flux vertical
   fiable le temps de la photo : titre → vainqueur → classement. L'écran vivant
   (2 colonnes sur grand écran / TV) n'est pas modifié. */
/* Mode TV : porte de sortie (cf. view-timer.php). Fermée par défaut, et ouverte
   par un tap SUR PETIT ÉCRAN seulement — la télévision doit rester inerte. */
.tv-exit {
    display: none;
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    gap: 10px;
    padding: 10px 14px;
    background: rgba(7, 9, 13, 0.94);
    border: 1px solid #333;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    z-index: 2147483000;
}
.tv-exit.is-open { display: flex; }

.tv-layout.share-capture-mode {
    display: block !important;
    height: auto !important;
}
.tv-layout.share-capture-mode .tv-sidebar {
    max-height: 30vh !important;
    overflow: hidden !important;
    border-left: none !important;
    border-top: 2px solid rgba(241, 196, 15, 0.3);
}
.tv-layout.share-capture-mode .scroll-content {
    animation: none !important;
    transform: none !important; /* classement figé en haut (pas au milieu du défilement) */
}
/* Sur la photo : on retire la ligne opérationnelle (nom/niveau/heure) et on
   affiche à la place un titre propre (nom du tournoi + date) qui identifie
   ce que le vainqueur a gagné, et quand. */
.tv-layout.share-capture-mode .tv-header { display: none !important; }
#share-capture-title { display: none; }
.tv-layout.share-capture-mode #share-capture-title {
    display: block;
    text-align: center;
    padding: 18px 24px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.45) 100%);
    border-bottom: 2px solid rgba(241, 196, 15, 0.5);
}
#share-capture-title .sct-name {
    font-size: clamp(1.6rem, 3vw, 3rem);
    font-weight: 800;
    color: #f1c40f;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.15;
}
#share-capture-title .sct-date {
    font-size: clamp(0.95rem, 1.6vw, 1.4rem);
    color: #bbb;
    margin-top: 6px;
}

#winner-section .winner-trophy {
    font-size: clamp(6rem, 12vw, 14rem);
    margin-bottom: 20px;
    animation: bounce-trophy 1.6s ease-in-out infinite;
}
@keyframes bounce-trophy {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}
#winner-section .winner-title {
    font-size: clamp(2rem, 4vw, 4.5rem);
    font-weight: 900;
    color: #f1c40f;
    text-transform: uppercase;
    letter-spacing: 4px;
}
#winner-section .winner-card {
    margin-top: 20px;
    padding: 30px 60px;
    border: 4px solid #f1c40f;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 80px rgba(241, 196, 15, 0.4);
}
#winner-section .winner-name {
    font-size: clamp(3rem, 6vw, 7rem);
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
}
/* Pavé Vainqueur cliquable → partage du résultat.
   pointer-events:auto : réactive les clics (le parent #winner-section est en
   pointer-events:none pour laisser passer les taps vers la modale/undo). */
#winner-section .winner-card {
    cursor: pointer;
    position: relative;
    pointer-events: auto;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}
#winner-section .winner-card:hover {
    box-shadow: 0 0 100px rgba(241, 196, 15, 0.6);
    transform: translateY(-3px);
}
#winner-section .winner-card:active { transform: scale(0.99); }
.winner-share-hint {
    margin-top: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #f1c40f;
    font-size: clamp(0.9rem, 1.4vw, 1.2rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
/* Souris : révélé au survol du pavé */
#winner-section .winner-card:hover .winner-share-hint { opacity: 1; }
/* Tactile (pas de survol) : affordance toujours visible, stylée comme un bouton */
@media (hover: none) {
    .winner-share-hint {
        opacity: 1;
        background: rgba(241, 196, 15, 0.15);
        border: 1px solid rgba(241, 196, 15, 0.55);
        padding: 10px 22px;
        border-radius: 999px;
    }
}

/* Écrans courts (mobile paysage) : réduit le pavé pour que l'indice "Partager"
   ne soit pas coupé (l'écran vainqueur n'est pas scrollable). */
@media (max-height: 560px) {
    #winner-section .winner-trophy { font-size: clamp(3rem, 8vh, 6rem); margin-bottom: 8px; }
    #winner-section .winner-title  { font-size: clamp(1.4rem, 4vh, 2.4rem); letter-spacing: 2px; }
    #winner-section .winner-card   { margin-top: 10px; padding: 16px 32px; }
    #winner-section .winner-name   { font-size: clamp(2rem, 7vh, 4rem); }
}

/* =============================================================================
   APERÇU DE PARTAGE (image générée → Partager / Enregistrer) — plein écran,
   au-dessus des contrôles admin (z-index 10001) et de l'alerte TF (9999).
   ============================================================================= */
.share-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.93);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.share-preview-modal.visible { display: flex; }
.share-preview-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    max-width: 100%;
    max-height: 100%;
}
#share-preview-img {
    max-width: min(92vw, 900px);
    max-height: 66vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    border: 2px solid #f1c40f;
    box-shadow: 0 0 60px rgba(241, 196, 15, 0.35);
    object-fit: contain;
}
.share-preview-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}
.share-preview-actions button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 24px;
    border-radius: 999px;
    border: none;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease;
}
.share-preview-actions button:active { transform: scale(0.96); }
#share-preview-share-btn    { background: #f1c40f; color: #111; }
#share-preview-download-btn { background: #2980b9; color: #fff; }
.share-preview-close        { background: #333;    color: #fff; }
.share-preview-hint { color: #aaa; font-size: 0.85rem; text-align: center; }
/* L'astuce "appui long" ne concerne que le tactile. */
@media (hover: hover) { .share-preview-hint { display: none; } }

/* =============================================================================
   ALERTE TF (tirage au sort en cours) — overlay plein écran
   ============================================================================= */
#tf-alert {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #f1c40f;
    text-align: center;
}
#tf-alert h1 {
    font-size: clamp(4rem, 8vw, 10rem);
    margin: 0;
    text-shadow: 0 0 30px rgba(241, 196, 15, 0.6);
}
#tf-alert p {
    font-size: clamp(1.5rem, 3vw, 3rem);
    color: #ecf0f1;
}
#tf-alert .spinner {
    margin-top: 30px;
    width: 120px;
    height: 120px;
    border: 12px solid #f1c40f;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================================
   ALERTE OFFLINE
   ============================================================================= */
#offline-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(231, 76, 60, 0.95);
    color: #fff;
    padding: 12px 30px;
    border-radius: 8px;
    z-index: 5000;
    font-size: 1.3rem;
    font-weight: 700;
    box-shadow: 0 6px 30px rgba(231, 76, 60, 0.4);
}

/* =============================================================================
   TABLE FINALE — ovale poker (mode TF active)
   On rapatrie ici car le bloc vit dans .tv-main et timer.css gérait l'ancien layout.
   ============================================================================= */
#tf-table-display { width: 100%; max-width: 1100px; }

/* =============================================================================
   RESPONSIVE — sidebar passe en bas sur petits écrans
   ============================================================================= */
@media (max-width: 1023px) {
    .tv-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
        grid-template-areas:
            "header"
            "main"
            "sidebar"
            "footer";
    }
    .tv-sidebar { max-height: 30vh; border-left: none; border-top: 2px solid rgba(241, 196, 15, 0.3); }
    .tv-sidebar .qr-block { display: none; }
}
@media (max-width: 768px) {
    .tv-footer { grid-template-columns: repeat(2, 1fr); }
    .tv-header { padding: 10px 18px; }
    .tv-main { padding: 10px 20px; }
}

/* =============================================================================
   ADMIN / PLAYER / TIME OVERLAYS — propres à view-timer
   ============================================================================= */

/* --- Overlay GHOST-UI (menu joueur en bas) --- */
.ghost-ui {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: rgba(20, 30, 48, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
    opacity: 0;
    z-index: 1000;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
}
.ghost-ui.visible { bottom: 0; opacity: 1; }

.player-menu-container h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-align: center;
    font-family: 'Segoe UI', sans-serif;
}
.player-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.player-grid button, .player-grid .btn-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 15px 10px;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    font-size: 0.9rem;
}
.player-grid button i, .player-grid .btn-link i {
    font-size: 1.4rem;
    margin-bottom: 8px;
    color: #3498db;
}
.player-grid button:active { background: #3498db; }

/* --- Modale joueur (Mon Siège / Stacks / Structure / Bustouts) --- */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
}
.modal-content.large {
    background: #1a1a2e;
    color: white;
    width: 95%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid #30363d;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.close-modal {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #8b949e;
}

.structure-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.structure-table th { background: #161b22; padding: 12px; text-align: left; color: #8b949e; }
.structure-table td { padding: 12px; border-bottom: 1px solid #30363d; }
.row-active { background: rgba(52, 152, 219, 0.2) !important; color: #3498db; font-weight: bold; border-left: 4px solid #3498db; }
.break-row { background-color: #e1f5fe !important; }
.break-row td { color: #0288d1 !important; font-weight: bold; text-align: center; }
.break-row-active { background: #e67e22 !important; color: #ffffff; font-weight: bold; border-left: 4px solid #e67e22; }
.break-row-active td { color: #e67e22 !important; font-weight: bold; text-align: center; }
.me { background: #f1c40f; color: #000; padding: 2px 6px; border-radius: 4px; font-weight: bold; }

.modal-seating-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}
.modal-table-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid #334155;
    border-radius: 10px;
}
.modal-table-card h4 {
    background: #1e293b;
    padding: 8px;
    margin: 0;
    text-align: center;
    color: #3498db;
}
.modal-table-card ul { list-style: none; padding: 0; margin: 0; }
.modal-table-card li {
    display: flex; align-items: center;
    padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.modal-table-card li .seat-num {
    display: inline-block; width: 20px; height: 20px;
    background: #334155; border-radius: 50%;
    text-align: center; line-height: 20px;
    font-size: 0.7rem; margin-right: 10px;
    color: #fff; border: none;
}
.me-highlight { background: #f1c40f !important; color: #000 !important; font-weight: bold; }
/* Ligne « c'est moi » du plan de table qui défile : les colonnes portent une
   couleur en style inline (orange « placé » / bleu « à placer »), illisible sur
   le fond jaune. !important d'une feuille de style prime sur un style inline
   non-important : on force donc le texte en noir sur toute la ligne. */
.ranking-row.me-highlight .rank-col,
.ranking-row.me-highlight .name-col { color: #000 !important; }

.bustouts-container { padding: 5px; animation: fadeIn 0.3s ease; }
.bustouts-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; color: #e2e8f0; }
.bustouts-table th { text-align: left; padding: 10px 15px; color: #94a3b8; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; border: none; }
.bustouts-table tbody tr { background: rgba(30, 41, 59, 0.5); transition: transform 0.2s; }
.bustouts-table td { padding: 12px 15px; border-top: 1px solid rgba(255,255,255,0.05); border-bottom: 1px solid rgba(255,255,255,0.05); }
.bustouts-table td:first-child { border-left: 1px solid rgba(255,255,255,0.05); border-radius: 8px 0 0 8px; }
.bustouts-table td:last-child { border-right: 1px solid rgba(255,255,255,0.05); border-radius: 0 8px 8px 0; text-align: right; }
.rank-badge {
    display: inline-flex; align-items: center; justify-content: center;
    background: #334155; color: #f8fafc;
    width: 35px; height: 24px;
    border-radius: 4px; font-weight: bold;
    font-family: 'Roboto Mono', monospace; font-size: 0.85rem;
}
.bustouts-table tr.rank-1 { border-left: 4px solid #f1c40f; }
.bustouts-table tr.rank-1 .rank-badge { background: #f1c40f; color: #000; }
.bustouts-table tr.rank-2 { border-left: 4px solid #bdc3c7; }
.bustouts-table tr.rank-2 .rank-badge { background: #bdc3c7; color: #000; }
.bustouts-table tr.rank-3 { border-left: 4px solid #cd7f32; }
.bustouts-table tr.rank-3 .rank-badge { background: #cd7f32; color: #000; }
.bust-time { color: #64748b; font-size: 0.8rem; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-stacks-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.modal-stacks-table th { color: #888; font-size: 0.8rem; text-transform: uppercase; padding: 10px; border-bottom: 1px solid #444; }
.modal-stacks-table td { padding: 12px 10px; border-bottom: 1px solid #222; }
.modal-stacks-table tr.me-highlight { background: rgba(52, 152, 219, 0.2); }
.modal-stacks-table .p-table { font-size: 0.75rem; color: #666; }
.modal-scrollable-area { max-height: 60vh; overflow-y: auto; padding-right: 5px; }

/* --- Admin overlay (auto-hide) — bouton TIME, prev/next, pause, +/-1m --- */
.td-overlay {
    position: fixed;
    bottom: 50px;
    right: 50px;
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 20px;
    border: 2px solid #444;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 10001;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.4s ease;
}
body.show-nav .td-overlay { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* Témoin « sorties à valider » — visible en permanence sur l'écran de salle, où
   les contrôles TD (.td-overlay) restent masqués faute de mouvement de souris.
   Il n'apparaît que s'il y a quelque chose à traiter, donc jamais le reste du
   temps ; et il renseigne aussi la salle : un joueur qui vient de se déclarer
   voit que sa sortie est bien en attente. */
#claims-flag {
    position: fixed;
    top: 84px;
    left: 24px;
    z-index: 10000;
    /* L'affichage est piloté par le JS en style EN LIGNE (comme la pastille du
       bouton ACTIONS TD). Surtout pas de bascule par classe ici : l'élément porte
       style="display:none" dans le HTML, et un style en ligne l'emporte sur une
       règle de feuille de style — la classe restait donc sans effet. */
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(192, 57, 43, 0.92);
    border: 2px solid #e74c3c;
    color: #fff;
    font-weight: 800;
    font-size: clamp(0.95rem, 1.3vw, 1.4rem);
    text-decoration: none;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
#claims-flag i { font-size: 0.95em; }

/* Témoin « chrono arrêté ». Même facture que #claims-flag, mais posé en dessous
   pour que les deux puissent coexister, et en orange : c'est un état à
   comprendre, pas une action à faire. Affichage piloté en style EN LIGNE, comme
   son voisin — une bascule par classe resterait sans effet face au
   style="display:none" porté par l'élément. */
#pause-flag {
    position: fixed;
    top: 144px;
    left: 24px;
    z-index: 10000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(211, 126, 20, 0.92);
    border: 2px solid #e67e22;
    color: #fff;
    font-weight: 800;
    font-size: clamp(0.95rem, 1.3vw, 1.4rem);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
#pause-flag i { font-size: 0.95em; }

/* Témoin « inscriptions à confirmer ». Troisième de la pile, en bleu : c'est une
   demande qui attend, pas une alerte. Affichage en style EN LIGNE comme ses
   voisins — l'élément porte style="display:none", qu'une classe ne battrait pas. */
#invites-flag {
    position: fixed;
    top: 204px;
    left: 24px;
    z-index: 10000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(41, 128, 185, 0.92);
    border: 2px solid #3498db;
    color: #fff;
    font-weight: 800;
    font-size: clamp(0.95rem, 1.3vw, 1.4rem);
    text-decoration: none;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
#invites-flag i { font-size: 0.95em; }

.ctrl-group { display: flex; gap: 15px; justify-content: center; }
.ctrl-btn {
    background: #222; color: white; border: 1px solid #444;
    width: 70px; height: 70px; border-radius: 14px;
    cursor: pointer; font-size: 2rem;
    display: flex; align-items: center; justify-content: center;
}
.ctrl-btn:hover { background: #333; }
.btn-play { color: #2ecc71; }
.btn-pause { color: #e74c3c; }

.td-overlay .time-adjusters {
    display: flex !important;
    justify-content: center !important;
    flex-wrap: wrap;
    gap: 10px !important;
    margin-top: 10px !important;
}
.td-overlay .btn-small {
    min-height: 44px;
    min-width: 100px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    border: none !important;
    margin: 0 !important;
    color: #fff;
}
.td-overlay .btn-small:active { transform: scale(0.95) !important; filter: brightness(1.2); }
/* Contrôles timer désactivés sur l'écran de fin (tournoi terminé). */
.td-overlay .ctrl-btn:disabled,
.td-overlay .btn-small:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(0.6);
    pointer-events: none;
}
.td-overlay a[href*="td-actions.php"] { background-color: #e67e22 !important; min-width: 140px !important; }
.td-overlay a[href*="admin-tournament-manage.php"] { background-color: #2980b9 !important; }

.close-ctrl-btn {
    position: absolute;
    top: 10px; right: 12px;
    background: none; border: none;
    color: #fff; font-size: 1.3rem; cursor: pointer;
    opacity: 0.6;
}
.close-ctrl-btn:hover { opacity: 1; }

/* --- Bouton plein écran circulaire en haut à droite --- */
.ghost-ui-overlay {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.ghost-ui-overlay.visible { opacity: 1; visibility: visible; }
.fs-toggle-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(44, 62, 80, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #3498db;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease-in-out;
}
.fs-toggle-btn:hover { background: rgba(52, 152, 219, 0.7); border-color: #3498db; }

/* --- Status text (PAUSE / PROTECTION) au-dessus du chrono --- */
#timer-status-text {
    text-transform: uppercase;
    letter-spacing: 4px;
    font-size: clamp(1rem, 1.6vw, 1.8rem);
    font-weight: bold;
    margin-bottom: 8px;
    animation: pulse-status 2s infinite;
}

/* --- Overlay TIME (penalty countdown) --- */
.timeout-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    cursor: pointer;
}
#timeout-countdown {
    font-size: 60vh;
    font-weight: 900;
    color: #e74c3c;
    text-shadow: 0 0 50px rgba(231, 76, 60, 0.6);
    transition: all 0.2s ease;
    user-select: none;
    font-family: 'Inter', 'Segoe UI', 'Arial Black', sans-serif;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "zero" 0;
}
@media (max-width: 768px) {
    #timeout-countdown { font-size: 38vh; }
}
.fold-active {
    font-size: 30vh !important;
    color: #ffffff !important;
    text-shadow: 0 0 80px #ff0000 !important;
}
@media (max-width: 768px) {
    .fold-active { font-size: 22vh !important; }
}

/* ---------------------------------------------------------------------------
   Tapis DÉCLARÉ par les joueurs, dans le plan de table. Volontairement discret :
   c'est une indication, pas une donnée officielle — le tapis du directeur de
   tournoi reste ailleurs. L'âge est toujours montré, et estompé quand il vieillit.
   --------------------------------------------------------------------------- */
.tapis-declare {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    margin-left: auto;
    font-size: 0.9em;
    color: #2ecc71;
    white-space: nowrap;
}
.tapis-declare .tapis-vide { color: #666; }
.tapis-declare .tapis-age  { color: #8a8a8a; font-size: 0.82em; font-style: italic; }
.tapis-declare .tapis-age.est-vieux { color: #c0742a; }
.tapis-declare .tapis-edit {
    background: none;
    border: none;
    color: #8a8a8a;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.9em;
}
.tapis-declare .tapis-edit:hover { color: #f1c40f; }

