/* Réseau — styles propres au jeu.
   Réutilise les variables d'identité (assets/identite.css, chargée avant).
   Style éditorial : papier froid, marine, or, angles nets, Cormorant + Montserrat. */

main { width: 100%; max-width: var(--largeur); margin: 0 auto; padding: 1rem clamp(1.2rem, 4vw, 3rem) 1rem; }

/* Tableau de bord (fond/bordure des cartes via .oa-card) */
.tableau {
  display: grid; grid-template-columns: 2fr 1.4fr 1fr 1fr 1fr; gap: 2px;
  margin: 0.6rem 0 1rem;
}
.ind { padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.ind-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.ind-titre { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.22em; color: var(--gold); }
.ind-val { font-weight: 500; color: var(--ink); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.ind-grand { font-family: var(--serif); font-size: 2.4rem; font-weight: 400; color: var(--brand); line-height: 1; font-variant-numeric: tabular-nums; }
.ind-grand.invalide { color: var(--alerte); }
.ind-moyen { font-family: var(--serif); font-size: 1.7rem; font-weight: 400; color: var(--brand); line-height: 1.1; font-variant-numeric: tabular-nums; }
.ind-note { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.02em; }
.ind-note.alerte { color: var(--alerte); font-weight: 500; }

.jauge { height: 6px; background: var(--paper-hover); overflow: hidden; margin: 0.25rem 0; }
.jauge-remplie {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width .3s ease;
}
.jauge-remplie.depasse { background: linear-gradient(90deg, #9a3325, var(--alerte)); }

/* Barre d'outils */
.outils {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.6rem;
  align-items: center; margin-bottom: 0.5rem;
}
.groupe { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.groupe-lbl { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; }
.segmente { display: inline-flex; border: 1px solid var(--line); background: transparent; }
.seg {
  border: none; background: transparent; color: var(--ink);
  padding: 0.42rem 1rem; cursor: pointer; font-size: 0.72rem; font-family: var(--sans);
  letter-spacing: 0.1em; text-transform: uppercase; transition: background .2s, color .2s;
}
.seg + .seg { border-left: 1px solid var(--line); }
.seg.actif { background: var(--gold); color: var(--ink); font-weight: 500; }
.btn-outil {
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  padding: 0.42rem 0.9rem; cursor: pointer; font-size: 0.74rem; font-family: var(--sans);
  letter-spacing: 0.04em; transition: border-color .2s, color .2s, background .2s;
}
.btn-outil:hover { border-color: var(--gold); color: var(--gold); }
.btn-outil.actif { border-color: var(--gold); background: var(--paper-dark); color: var(--brand); }

.astuce { color: var(--muted); font-size: 0.8rem; margin: 0.2rem 0 0.5rem; min-height: 1.2rem; letter-spacing: 0.02em; }
.astuce.flash { color: var(--gold); }

/* Carte */
.carte-zone { background: var(--paper); padding: 0.5rem; overflow: hidden; position: relative; }
#carte { width: 100%; height: auto; display: block; touch-action: none; cursor: grab; }
#carte:active { cursor: grabbing; }

/* Contrôles de zoom (superposés en haut à droite de la carte) */
.zoom-ctrl { position: absolute; top: 0.7rem; right: 0.7rem; display: flex; flex-direction: column; gap: 4px; z-index: 5; }
.zoom-ctrl button {
  width: 30px; height: 30px; border: 1px solid var(--line); background: var(--paper);
  color: var(--brand); font-size: 1.05rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.zoom-ctrl button:hover { border-color: var(--gold); color: var(--gold); }

/* Menu « Options » (regroupe tous les réglages) */
.options-wrap { position: relative; }
#btn-options.actif { border-color: var(--gold); color: var(--gold); }
.menu-options {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 20;
  min-width: 250px; background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 14px 34px rgba(26, 24, 20, 0.12);
  padding: 0.6rem 0.7rem; display: flex; flex-direction: column; gap: 0.5rem;
}
/* Sinon `display:flex` écraserait l'attribut [hidden] → menu toujours visible */
.menu-options[hidden] { display: none; }
.opt-ligne { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--ink); letter-spacing: 0.02em; cursor: pointer; }
.opt-ligne input { accent-color: var(--gold); cursor: pointer; }
.opt-sep { border: 0; border-top: 1px solid var(--line); margin: 0.15rem 0; width: 100%; }
.opt-btn { text-align: left; background: transparent; border: none; color: var(--ink); font-family: var(--sans); font-size: 0.8rem; padding: 0.3rem 0.1rem; cursor: pointer; letter-spacing: 0.02em; }
.opt-btn:hover { color: var(--gold); }

/* Noms des villes affichés en permanence (option) */
#carte.noms-visibles .ville-label { opacity: 1; }

.frontiere { fill: rgba(29, 58, 95, 0.05); stroke: rgba(184, 154, 90, 0.4); stroke-width: 1.1; stroke-linejoin: round; }

/* Zones de relief (surcoût de construction), délimitées sur la carte */
.zone-relief { pointer-events: none; stroke-linejoin: round; }
.zone-faible { fill: rgba(180, 130, 70, 0.12); stroke: rgba(180, 130, 70, 0.45); stroke-width: 0.9; stroke-dasharray: 3 2; }
.zone-fort   { fill: rgba(150, 60, 45, 0.17);  stroke: rgba(150, 60, 45, 0.55);  stroke-width: 1.0; stroke-dasharray: 3 2; }
.zone-label  { pointer-events: none; fill: rgba(120, 78, 48, 0.75); font-family: var(--sans); font-size: 6.5px; text-anchor: middle; letter-spacing: 0.03em; }

.arete { stroke-linecap: round; cursor: pointer; transition: stroke .15s; }
.arete-standard { stroke: var(--brand); }
.arete-lgv { stroke: var(--gold); }
.arete-sat { stroke: var(--alerte); }
.arete-sel { filter: drop-shadow(0 0 3px var(--gold)); }
.arete-hit { stroke: transparent; stroke-width: 12; cursor: pointer; }

.ville { cursor: pointer; }
.ville-hit { fill: transparent; }
.ville-pt { fill: #ffffff; stroke: var(--brand); stroke-width: 1.4; transition: fill .15s, stroke .15s; }
.ville:hover .ville-pt { fill: var(--gold-light); }
.ville-sel .ville-pt { fill: var(--gold); stroke: var(--ink); stroke-width: 2; }
/* Étiquettes : cachées par défaut, révélées au survol (ou si sélectionnée) */
.ville-label {
  font-family: var(--sans);
  paint-order: stroke; stroke: var(--paper); stroke-width: 2.6px; stroke-linejoin: round;
  pointer-events: none; user-select: none;
  opacity: 0; transition: opacity .12s;
}
.ville:hover .ville-label, .ville-sel .ville-label { opacity: 1; }
.ville-label.gauche { text-anchor: end; }
.vl-nom { fill: var(--brand); font-size: 9px; font-weight: 600; }
.vl-pop { fill: var(--muted); font-size: 7px; }

/* Gares intermédiaires (losange) */
.gare { cursor: grab; }
.gare:active { cursor: grabbing; }
.gare-hit { fill: transparent; }
.gare-pt { fill: var(--paper); stroke: var(--brand); stroke-width: 1.6; transition: fill .15s, stroke .15s; }
.gare:hover .gare-pt { fill: var(--gold-light); }
.gare-sel .gare-pt { fill: var(--gold); stroke: var(--ink); stroke-width: 2; }
.gare-label {
  font-family: var(--sans); font-size: 7.5px; fill: var(--brand);
  paint-order: stroke; stroke: var(--paper); stroke-width: 2.4px; stroke-linejoin: round;
  pointer-events: none; user-select: none; opacity: 0; transition: opacity .12s;
}
.gare:hover .gare-label, .gare-sel .gare-label { opacity: 1; }

/* Panneau tronçon (base via .oa-card ; on accentue la bordure en or) */
.panneau { margin: 0.7rem 0; overflow: hidden; border-color: rgba(184, 154, 90, 0.5); }
.panneau-tete {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 1rem; background: var(--paper); border-bottom: 1px solid var(--line);
}
.panneau-tete strong { font-family: var(--serif); font-weight: 400; color: var(--brand); font-size: 1.25rem; }
.pa-x { background: none; border: none; color: var(--muted); font-size: 1rem; cursor: pointer; }
.pa-x:hover { color: var(--ink); }
.pa-corps { padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.8rem; }
.pa-ligne { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: 0.85rem; }
.voies-ctrl { display: flex; align-items: center; gap: 0.7rem; }
.voies-ctrl strong { min-width: 1ch; text-align: center; color: var(--brand); font-size: 1.2rem; font-family: var(--serif); font-variant-numeric: tabular-nums; }
.rond {
  width: 28px; height: 28px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); font-size: 1.1rem; cursor: pointer; line-height: 1;
}
.rond:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.rond:disabled { opacity: 0.35; cursor: default; }
.pa-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem 1.2rem; margin: 0.2rem 0; }
.pa-stats div { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--line); padding: 0.2rem 0; }
.pa-stats dt { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.04em; margin: 0; text-transform: uppercase; }
.pa-stats dd { margin: 0; font-size: 0.82rem; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.pa-stats dd.alerte { color: var(--alerte); }
.btn-suppr {
  align-self: flex-start; background: transparent; border: 1px solid var(--alerte); color: var(--alerte);
  padding: 0.45rem 1rem; cursor: pointer; font-size: 0.7rem; font-family: var(--sans);
  letter-spacing: 0.12em; text-transform: uppercase; transition: background .2s, color .2s;
}
.btn-suppr:hover { background: var(--alerte); color: #fff; }

/* Légende */
.legende {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; margin-top: 1rem;
  color: var(--muted); font-size: 0.76rem; letter-spacing: 0.02em;
}
.legende span { display: inline-flex; align-items: center; gap: 0.45rem; }
.ll { width: 20px; height: 3px; display: inline-block; }
.ll-standard { background: var(--brand); }
.ll-lgv { background: var(--gold); }
.ll-sat { background: var(--alerte); }
.ll-ville { width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 1.4px solid var(--brand); }
.ll-gare { width: 9px; height: 9px; background: var(--paper); border: 1.5px solid var(--brand); transform: rotate(45deg); }
.ll-relief-faible { width: 12px; height: 12px; background: rgba(180, 130, 70, 0.25); border: 1px dashed rgba(180, 130, 70, 0.6); }
.ll-relief-fort   { width: 12px; height: 12px; background: rgba(150, 60, 45, 0.28); border: 1px dashed rgba(150, 60, 45, 0.7); }

/* Échelle de population dans la légende */
.echelle { display: inline-flex; align-items: center; gap: 0.35rem; }
.echelle em { font-style: italic; color: var(--muted); }
.pop { display: inline-block; border-radius: 50%; background: #fff; border: 1.4px solid var(--brand); }
.pop-s { width: 6px; height: 6px; }
.pop-m { width: 11px; height: 11px; }
.pop-l { width: 17px; height: 17px; }

/* Section « méthode » (calcul des scores) */
.methodo { margin-top: 1.2rem; }
.methodo > summary {
  cursor: pointer; list-style: none; padding: 0.9rem 1.1rem;
  font-family: var(--serif); font-size: 1.25rem; color: var(--brand);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.methodo > summary::-webkit-details-marker { display: none; }
.methodo > summary::after {
  content: "+"; color: var(--gold); font-family: var(--sans); font-size: 1.3rem; line-height: 1;
}
.methodo[open] > summary::after { content: "−"; }
.methodo[open] > summary { border-bottom: 1px solid var(--line); }
.methodo-corps { padding: 0.6rem 1.1rem 1.1rem; max-width: 70ch; }
.methodo-corps h3 {
  font-family: var(--sans); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--gold); margin: 1.3rem 0 0.4rem; font-weight: 600;
}
.methodo-corps h3 span { text-transform: none; letter-spacing: 0.02em; color: var(--muted); font-weight: 400; }
.methodo-corps p { margin: 0.4rem 0; font-size: 0.86rem; line-height: 1.6; color: var(--texte, var(--ink)); }
.methodo-intro { color: var(--muted) !important; }
.methodo-liste { margin: 0.5rem 0; padding-left: 1.1rem; font-size: 0.86rem; line-height: 1.6; color: var(--texte, var(--ink)); }
.methodo-liste li { margin: 0.25rem 0; }
.methodo-liste b { font-weight: 600; color: var(--ink); }
.methodo-corps b { font-weight: 600; color: var(--ink); }
.formule {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  background: var(--paper); border-left: 2px solid var(--gold);
  padding: 0.5rem 0.8rem; font-size: 0.82rem !important; color: var(--brand) !important;
}
.formule span { display: block; font-family: var(--sans); color: var(--muted); font-size: 0.75rem; margin-top: 0.2rem; }
.methodo-note { margin-top: 1.2rem !important; font-size: 0.78rem !important; color: var(--muted) !important; font-style: italic; }

/* Curseur du prix du billet (dans le menu Options) */
.opt-slider { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.1rem 0; }
.opt-slider-tete { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.8rem; color: var(--ink); letter-spacing: 0.02em; }
.opt-slider-tete b { font-family: var(--serif); font-size: 1.05rem; color: var(--brand); font-weight: 400; font-variant-numeric: tabular-nums; }
.opt-slider input[type="range"] { width: 100%; accent-color: var(--gold); cursor: pointer; }
.opt-hint { font-size: 0.68rem; color: var(--muted); line-height: 1.4; }

/* Panneau de simulation temporelle */
.temporel { margin: 0.7rem 0; padding: 1rem 1.1rem 1.1rem; border-color: rgba(184, 154, 90, 0.5); }
.tp-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.tp-tete strong { font-family: var(--serif); font-weight: 400; color: var(--brand); font-size: 1.25rem; }
.tp-etat { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); }
.tp-etat.ok { color: #2e7d52; }
.tp-etat.alerte { color: #b5462f; }
.tp-intro { font-size: 0.82rem; line-height: 1.55; color: var(--muted); margin: 0.5rem 0 0.9rem; max-width: 68ch; }
.tp-chiffres { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; margin-bottom: 1rem; }
.tp-chiffres > div { display: flex; flex-direction: column; gap: 0.25rem; background: var(--paper); padding: 0.6rem 0.7rem; }
.tp-lbl { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--gold); }
.tp-val { font-family: var(--serif); font-size: 1.25rem; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1.1; }
.tp-graphe { margin: 0; }
.tp-graphe svg { width: 100%; height: auto; display: block; background: var(--paper); border: 1px solid var(--line); }
.tp-graphe figcaption { font-size: 0.7rem; color: var(--muted); margin-top: 0.4rem; line-height: 1.4; }
/* éléments SVG du graphe */
.tp-aire { fill: var(--gold); opacity: 0.14; }
.tp-courbe { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
.tp-capline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.8; }
.tp-axe0 { stroke: var(--line); stroke-width: 1; }
.tp-tick { font-family: var(--sans); font-size: 9px; fill: var(--muted); }
.tp-marque { stroke-width: 1.2; stroke-dasharray: 3 2; }
.tp-marque.fin { stroke: var(--brand); }
.tp-marque.rent { stroke: var(--gold); }
.tp-marque-lbl { font-family: var(--sans); font-size: 8.5px; fill: var(--brand); }

/* Responsive */
@media (max-width: 720px) {
  .tableau { grid-template-columns: 1fr 1fr; }
  .tp-chiffres { grid-template-columns: 1fr 1fr; }
  .ville-label { font-size: 10px; }
}
@media (max-width: 560px) {
  /* Barre d'outils en colonne pleine largeur : le menu Options peut alors
     s'ancrer au bord DROIT de l'écran et ne jamais déborder. */
  .outils { flex-direction: column; align-items: stretch; }
  .options-wrap { flex: 1; text-align: right; }
  .menu-options { max-width: calc(100vw - 1.6rem); }
}
@media (max-width: 440px) {
  .tableau { grid-template-columns: 1fr; }
  .tp-chiffres { grid-template-columns: 1fr; }
}
