/* ===========================================================================
   HELIOS LIVE — live.css
   ---------------------------------------------------------------------------
   Feuille de style des pages Live / Relecture.

   Organisation :
   01. Variables et base
   02. Structure générale
   03. Navigation haute
   04. En-tête Live
   05. Grille et panneaux
   06. Coup affiché et métriques
   07. Boutons d'action du coup
   08. Ligne du temps des coups
   09. Tête du classement
   10. Fil live et pertes
   11. Top 10 compact
   12. Fenêtre modale scores / négatifs
   13. Pied de page
   14. Responsive
   =========================================================================== */


/* ===========================================================================
   01. Variables et base
   =========================================================================== */

:root{
  --bg:#f5f1e8;
  --panel:#fffdfa;
  --panel2:#f1ece2;

  --text:#2b2b2b;
  --muted:#6b7280;
  --accent:#0078d4;

  --gold:#d8a100;
  --silver:#7c8795;
  --bronze:#b56d34;

  --danger:#c62828;
  --ok:#0b8f55;
  --warning:#d97706;
  --line:#d9d5cb;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family:Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
}


/* ===========================================================================
   02. Structure générale
   =========================================================================== */

.live-shell{
    max-width:1380px;
    margin:0 auto;
    padding:16px 48px 24px 48px;
}

.grid{
  display:grid;
  grid-template-columns:1.25fr .85fr;
  gap:18px;
}


/* ===========================================================================
   03. Navigation haute
   ---------------------------------------------------------------------------
   Liens de retour vers l'accueil Live et l'accueil général du tournoi.
   =========================================================================== */


/* ===========================================================================
   03. Accueil Live
   ---------------------------------------------------------------------------
   Page d'accueil du module Live.
   =========================================================================== */

.shell{
    max-width:1200px;
    margin:0 auto;
    padding:24px;
}

.subtitle{
    margin-bottom:24px;
    color:var(--muted);
    font-size:18px;
}

.parts-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:20px;
  margin-top:24px;
}

.part-card{
  display:block;
  padding:24px;
  border-radius:22px;
  background:var(--panel);
  border:1px solid var(--line);
  color:inherit;
  text-decoration:none;
  box-shadow:0 3px 12px rgba(0,0,0,.08);
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.part-card:hover{
  transform:translateY(-2px);
  border-color:var(--accent);
  box-shadow:0 8px 20px rgba(0,0,0,.12);
}

.card-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

.part-title{
  font-size:28px;
  font-weight:900;
}

.part-subtitle{
  margin-top:14px;
  color:var(--muted);
  line-height:1.35;
}

.mode-badge{
    padding:6px 12px;
    border-radius:999px;
    font-size:12px;
    font-weight:900;
}

.mode-badge.live{
    background:#e3f2fd;
    color:#1565c0;
}

.mode-badge.replay{
    background:#fff8e1;
    color:#c77700;
}

.live-nav{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:18px;
  font-size:15px;
}

.live-nav a{
  color:var(--accent);
  text-decoration:none;
  font-weight:700;
}

.live-nav a:hover{
  color:#005ea8;
  text-decoration:underline;
}

.live-nav .separator{
  color:var(--muted);
}


/* ===========================================================================
   04. En-tête Live
   ---------------------------------------------------------------------------
   Titre de l'épreuve, partie/coup courant et badge Live/Relecture.
   =========================================================================== */

.live-topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:22px;
}

.live-title h1{
  margin:0;
  font-size:28px;
  letter-spacing:.2px;
}

.live-subtitle{
  margin-top:6px;
  color:var(--muted);
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 13px;
  border-radius:999px;
  background:#eef6fd;
  border:1px solid #8ecaf2;
  color:#005ea8;
  font-weight:700;
}

.badge.replay{
  background:#fff4d6;
  border-color:#e6c15a;
  color:#7a5600;
}


/* ===========================================================================
   05. Grille et panneaux
   ---------------------------------------------------------------------------
   Cartes principales : coup affiché, tête du classement, commentaires, pertes.
   =========================================================================== */

.panel{
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:22px;
  background:var(--panel);
  box-shadow:0 3px 14px rgba(0,0,0,.08);
}

.panel-header{
  padding:16px 18px;
  border-bottom:1px solid var(--line);
  color:#4b5563;
  font-weight:700;
  letter-spacing:.3px;
}

.panel-body{
  padding:18px;
}


/* ===========================================================================
   06. Coup affiché et métriques
   ---------------------------------------------------------------------------
   Mot au top, référence, tirage, score, nombre de tops, perte moyenne,
   difficulté.
   =========================================================================== */

.current-move{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.move-word-zone{
    min-height:120px;
    display:flex;
    flex-direction:column;
    justify-content:center;
}

.scrabble-word{
    display:flex;
    flex-wrap:wrap;
    align-items:flex-end;
    gap:6px;
    min-height:64px;
}

.ref{
  margin-top:10px;
  color:var(--muted);
  font-size:15px;
}

.metric{
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:14px;
  min-height:96px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#faf8f2;
}

.metric-label{
  color:var(--muted);
  font-size:13px;
}

.metric-value{
  margin-top:6px;
  font-size:28px;
  font-weight:800;
}

.metrics-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
  margin-top:14px;
}

/* ---------------------------------------------------------------------------
   Tuiles Scrabble
--------------------------------------------------------------------------- */

.scrabble-tile{

    position:relative;

    width:54px;
    height:54px;

    display:flex;
    justify-content:center;
    align-items:center;

    border-radius:8px;

    background:
        linear-gradient(
            180deg,
            #f8e7bf 0%,
            #ecd79c 100%
        );

    border:1px solid #d2b56b;

    box-shadow:
        0 3px 8px rgba(0,0,0,.25),
        inset 0 1px 0 rgba(255,255,255,.45);

    color:#222;

    user-select:none;
}

.tile-letter{

    font-size:31px;
    font-weight:900;

    line-height:1;
}

.tile-value{

    position:absolute;

    right:5px;
    bottom:3px;

    font-size:11px;
    font-weight:900;
}

.scrabble-tile.joker .tile-letter{

    color:#c62828;
}

.scrabble-tile.joker .tile-value{

    display:none;
}

/* ===========================================================================
   07. Boutons d'action du coup
   ---------------------------------------------------------------------------
   Ouverture de la modale : classement par table / répartition des négatifs.
   =========================================================================== */

.score-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:14px;
}

.score-actions button{
  cursor:pointer;
  padding:8px 12px;
  border:1px solid #9dcced;
  border-radius:999px;
  background:#eef6fd;
  color:#005ea8;
  text-decoration:none;
  font-size:13px;
  font-weight:800;
}

.score-actions button:hover{
  background:#dff0fb;
}


/* ===========================================================================
   08. Ligne du temps des coups
   ---------------------------------------------------------------------------
   Frise de navigation : boutons début/précédent/suivant/fin + boule mobile
   indiquant le coup courant. Les jalons sont volontairement limités.
   =========================================================================== */

.timeline-nav{
  margin-top:18px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#fbf8f0;
}

.timeline-controls{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin-bottom:12px;
}

.timeline-controls a,
.timeline-controls span{
  color:#005ea8;
  text-decoration:none;
  font-weight:800;
}

.timeline-controls span{
  padding:6px 14px;
  border:1px solid #8ecaf2;
  border-radius:999px;
  background:#e6f2fb;
  color:#003f73;
}

.timeline-track{
  position:relative;
  height:62px;
  margin:8px 18px 2px 18px;
}

.timeline-line{
  position:absolute;
  left:0;
  right:0;
  top:30px;
  height:4px;
  border-radius:999px;
  background:#cfd8dc;
}

.timeline-progress{
  position:absolute;
  left:0;
  top:30px;
  height:4px;
  border-radius:999px;
  background:var(--accent);
}

.timeline-ball{
    position:absolute;
    top:16px;
    transform:translateX(-50%);
    z-index:3;

    display:flex;
    align-items:center;
    justify-content:center;

    width:42px;
    height:42px;

    border-radius:50%;

    background:var(--accent);
    color:white;

    font-size:16px;
    font-weight:900;

    box-shadow:0 0 0 6px rgba(56,189,248,.18);

    pointer-events:none;
}

.timeline-mark{
  position:absolute;
  top:36px;
  transform:translateX(-50%);
  color:#4b5563;
  text-decoration:none;
  font-size:12px;
  font-weight:800;
}

.timeline-mark:hover{
  color:#005ea8;
}

.timeline-mark.active{
  color:white;
}

.timeline-slider{
  position:absolute;
  left:0;
  right:0;
  top:17px;
  width:100%;
  height:34px;
  opacity:0;
  cursor:pointer;
  z-index:5;
}

/* Ancienne navigation par pastilles.
   Conservée temporairement pour compatibilité avec de vieux HTML générés. */
.replay-nav{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:14px;
}

.replay-nav a{
  padding:7px 10px;
  border:1px solid rgba(56,189,248,.20);
  border-radius:999px;
  background:#eef6fd;
  color:#005ea8;
  text-decoration:none;
  font-size:13px;
}

.replay-nav a.active{
  background:var(--accent);
  border-color:var(--accent);
  color:white;
  font-weight:900;
}


/* ===========================================================================
   09. Tête du classement
   ---------------------------------------------------------------------------
   Affichage groupé des premiers, avec gestion correcte des ex æquo.
   =========================================================================== */

.podium{
  display:grid;
  gap:10px;
}

.podium-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#faf8f2;
}

.medal{
  display:flex;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  border-radius:50%;
  color:white;
  font-weight:900;
}

.m1{background:var(--gold);}
.m2{background:var(--silver);}
.m3{background:var(--bronze);}

.player-name{
  flex:1;
  font-weight:800;
}

.player-sub{
  margin-top:3px;
  color:var(--muted);
  font-size:13px;
}

.score{
  font-size:24px;
  font-weight:900;
}


/* ===========================================================================
   10. Fil live et pertes
   ---------------------------------------------------------------------------
   Cartes de commentaires automatiques/manuels et répartition des pertes.
   =========================================================================== */

.timeline{
  display:grid;
  gap:10px;
}

.event{
  padding:13px 14px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#faf8f2;
  color:#2b2b2b;
}

.event.manual{
  border-color:#0b8f55;
  background:#eefaf4;
}


/* ===========================================================================
   11. Top 10 compact
   ---------------------------------------------------------------------------
   Ancien bloc encore disponible si réutilisé ultérieurement.
   =========================================================================== */

.top10 table{
  width:100%;
  border-collapse:collapse;
}

.top10 td{
  padding:8px 6px;
  border-bottom:1px solid var(--line);
}

.top10 tr:last-child td{
  border-bottom:0;
}

.rank{
  width:40px;
  color:var(--muted);
}


/* ===========================================================================
   12. Fenêtre modale scores / négatifs
   ---------------------------------------------------------------------------
   Tableau complet du coup, soit par table, soit par groupes de négatifs.
   =========================================================================== */

.score-modal{
  display:none;
  position:fixed;
  inset:0;
  z-index:9999;
  padding:30px;
  background:rgba(0,0,0,.35);
}

.score-modal-box{
  position:relative;
  max-width:920px;
  max-height:88vh;
  overflow:auto;
  margin:0 auto;
  padding:24px;
  border:1px solid var(--line);
  border-radius:20px;
  background:var(--panel);
}

.score-modal-close{
  position:absolute;
  right:16px;
  top:14px;
  cursor:pointer;
  border:none;
  background:none;
  color:white;
  font-size:24px;
}

.score-modal-subtitle{
  margin-top:-6px;
  margin-bottom:14px;
  color:#4b5563;
}

.score-modal-tabs{
  display:flex;
  gap:10px;
  margin:14px 0;
}

.score-modal-tabs button{
  cursor:pointer;
  padding:8px 12px;
  border:1px solid #8ecaf2;
  border-radius:999px;
  background:rgba(56,189,248,.12);
  color:#005ea8;
  font-weight:800;
}

.score-modal-table{
  width:100%;
  border-collapse:collapse;
}

.score-modal-table th,
.score-modal-table td{
  padding:8px 6px;
  border-bottom:1px solid var(--line);
}

.score-modal-table th{
  color:#4b5563;
  text-align:left;
}

.score-loss-group{
  margin:18px 0 24px 0;
  padding:14px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#faf8f2;
}

.score-loss-group h3{
  margin:0 0 10px 0;
  color:var(--gold);
  font-size:18px;
}


/* ===========================================================================
   13. Pied de page
   =========================================================================== */

.footer{
  margin-top:18px;
  color:var(--muted);
  text-align:center;
  font-size:12px;
}


/* ===========================================================================
   14. Responsive
   =========================================================================== */

@media (max-width:980px){

    .grid{
        grid-template-columns:1fr;
    }

    .metrics-grid{
        grid-template-columns:repeat(2,1fr);
    }

}

/* ===========================================================================
   Thème clair ivoire — ajustements finaux
   =========================================================================== */

.panel-header{
  background:var(--panel2);
}

.live-title h1{
  color:#1f2937;
}

.score-actions button,
.score-modal-tabs button{
  background:#eef6fd;
  border-color:#9dcced;
  color:#005ea8;
}

.score-actions button:hover,
.score-modal-tabs button:hover{
  background:#dff0fb;
}

.timeline-ball{
  background:var(--accent);
  color:white;
}

.timeline-mark{
  color:#64748b;
}

.timeline-mark:hover,
.timeline-mark.active{
  color:#005ea8;
}

.timeline-controls a{
  color:#005ea8;
}

.timeline-controls a:hover{
  color:#003f73;
}

.event{
  background:#faf8f2;
  border-left:5px solid var(--accent);
}

.event.manual{
  background:#eefaf4;
  border-left:5px solid var(--ok);
}

.medal{
  color:#2b2b2b;
}

.m1{background:#f7d76a;}
.m2{background:#d7dde6;}
.m3{background:#d9a06f;}

.score-modal-close{
  color:#374151;
}

.score-modal-box{
  box-shadow:0 18px 50px rgba(0,0,0,.22);
}

.scrabble-tile{
  color:#222;
}

.scrabble-tile.joker .tile-letter{
  color:var(--danger);
}

/* ===========================================================================
   Identité Helios Live
   =========================================================================== */

.index-header{
    display:grid;
    grid-template-columns:1fr auto 1fr;
    align-items:center;
    gap:24px;
    margin:8px 0 28px 0;
}

.live-brand-main{
    display:flex;
    justify-content:center;
}

.live-brand-main img{
    width:520px;
    max-width:100%;
    height:auto;
}

.index-actions{
    display:flex;
    justify-content:flex-end;
}

.index-actions button{
    cursor:pointer;
    padding:8px 16px;
    border-radius:999px;
    border:1px solid #9dcced;
    background:#eef6fd;
    color:#005ea8;
    font-size:14px;
    font-weight:700;
    transition:.2s;
}

.index-actions button:hover{
    background:#dff0fb;
}

.live-brand-small{
    display:flex;
    justify-content:center;
    margin:10px 0 18px 0;
}

.live-brand-small img{
    width:260px;
    height:auto;
}

/* ===========================================================================
   Fenêtre "Pourquoi Helios ?"
   =========================================================================== */

.info-modal-box{
    position:relative;
    overflow:hidden;

    background:
        linear-gradient(
            rgba(255,253,250,.78),
            rgba(255,253,250,.88)
        ),
        url("helios_background.png");

    background-position:center center;
    background-size:cover;
    background-repeat:no-repeat;
}

.info-modal-box h2{

    margin-bottom:22px;

    font-size:32px;
    text-align:center;

    color:#9c6b00;
}

.info-modal-box p{

    font-size:17px;
    line-height:1.7;

    text-align:justify;
}

.info-modal-footer{
    margin-top:24px;
    padding-top:12px;

    border-top:1px solid rgba(0,0,0,.08);

    text-align:right;

    font-size:12px;
    color:#8a7a5d;

    font-style:italic;
}

/* ===========================================================================
   Entête 3 colonnes
   =========================================================================== */

.live-header-3cols{
    display:grid;
    grid-template-columns:1fr auto 1fr;
    align-items:center;
    gap:18px;
    margin-bottom:10px;
}

.live-header-left{
  display:flex;
  justify-content:flex-start;
}

.live-header-center{
  display:flex;
  justify-content:center;
}

.live-header-center img{
    width:280px;
    max-width:100%;
    height:auto;
}

.live-header-right{
  display:flex;
  justify-content:flex-end;
}

.live-title-block{
    margin-top:-6px;
    margin-bottom:18px;
}

.live-title-block h1{
  margin:0;
  font-size:28px;
  letter-spacing:.2px;
}

@media(max-width:780px){
  .live-header-3cols{
    grid-template-columns:1fr;
  }

  .live-header-left,
  .live-header-center,
  .live-header-right{
    justify-content:center;
  }

  .live-title-block{
    text-align:center;
  }
}