/* ------------------------------
   Thème SNCF (sobre & tactile)
------------------------------ */
:root{
  --sncf-magenta:#E2003B;
  --sncf-ink:#1C1C1F;
  --sncf-ink-2:#2B2B31;
  --sncf-bg:#F3F4F6;
  --sncf-panel:#FFFFFF;
  --sncf-accent:#C55A11; /* pour la sélection d'horaires, comme avant */
  --sncf-muted:#9CA3AF;
  --radius-xl:18px;
  --radius-md:12px;
  --shadow-1:0 6px 20px rgba(0,0,0,.08);
  --shadow-2:0 12px 30px rgba(0,0,0,.12);
  --tap:0.985;
}

/* Reset minimal */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--sncf-ink);
  background:linear-gradient(180deg,#eef1f5 0%, #e6e9ef 100%);
}

/* Conteneur “machine” */
.machine{
  max-width: 860px;
  margin: clamp(8px,2.5vh,24px) auto;
  padding: 0;
  background: var(--sncf-panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: min(92vh, 980px);
}

/* En-tête style SNCF */
.machine__header{
  display:flex; align-items:center; gap:14px;
  padding: 14px 18px;
  background:
    linear-gradient(90deg, rgba(226,0,59,.12), rgba(226,0,59,0) 50%),
    linear-gradient(180deg, #fff, #f9fafb 70%, #f1f5f9);
  border-bottom: 1px solid #e5e7eb;
}
.brand{
  font-weight:900; letter-spacing:.5px;
  color:#fff; background:var(--sncf-magenta);
  border-radius: 10px;
  padding: 6px 10px; line-height:1;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
}
.title{
  font-size: clamp(18px,2.4vw,24px);
  margin: 0; color: var(--sncf-ink-2);
}

/* Zone “écran” */
.screen{ display:none; }
.screen--active{ display:block; }
.screen__content{
  padding: clamp(16px,2.5vw,24px);
}

/* Carte principale / panneau */
.stack > * + *{ margin-top: 18px; }

/* Tuile d’entrée */
.tile{
  width: 100%;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px;
  min-height: 140px;
  background: linear-gradient(180deg,#fff,#f6f7fb);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1);
  transition: transform .06s ease, box-shadow .15s ease;
  user-select:none;
}
.tile:active{ transform: scale(var(--tap)); }
.tile--primary{
  outline:none; border: 2px solid var(--sncf-magenta);
}
.tile__title{ font-size: clamp(18px,2.4vw,22px); font-weight:700; }
.tile__hint{ font-size: 13px; color: var(--sncf-muted); }

/* Titres de section */
.section-title{
  margin: 2px 0 10px;
  font-size: clamp(18px,2.2vw,22px);
  color: var(--sncf-magenta);
}

/* Boutons */
.btn{
  appearance: none;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-weight: 600;
  background: var(--sncf-magenta);
  color:#fff;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover{ box-shadow: var(--shadow-2); }
.btn:active{ transform: scale(var(--tap)); }
.btn--ghost{
  background: #eef2f7; color: var(--sncf-ink-2);
  border: 1px solid #e5e7eb;
}
.btn--muted{ background:#d1d5db; color:#111827; }

/* Groupe d’actions */
.actions{ margin-top: 16px; display:flex; justify-content:center; }

/* Grilles & rangées */
.row{ display:flex; flex-wrap: wrap; gap: 12px; align-items:center; justify-content:center; }
.row--tight{ gap:8px; }
.grid{
  display:grid; gap:12px;
  grid-template-columns: repeat(2, minmax(0,1fr));
}
@media (min-width: 520px){
  .grid{ grid-template-columns: repeat(4, minmax(0,1fr)); }
}

/* Select stylé */
.select{
  width: 100%;
  max-width: 520px;
  padding: 12px 14px;
  font-size: 16px;
  border-radius: var(--radius-md);
  border: 1px solid #e5e7eb;
  background: #fff;
  box-shadow: var(--shadow-1);
}

/* Pastilles / petits titres */
.chip{ font-weight:700; color:#374151; margin: 8px 0 4px; }

/* Cartes horaires */
.horaire{
  text-align:center;
  padding: 16px 12px;
  background:#f3f4f6;
  border:1px solid #e5e7eb;
  border-radius: var(--radius-md);
  min-width: 98px;
  user-select:none;
  cursor:pointer;
  line-height:1.2;
}
.horaire small{ display:block; color:#6b7280; margin-top:4px; font-size:12px; }
.horaire.selected{
  background: var(--sncf-accent);
  color: #fff;
  border-color: transparent;
}

/* Boutons de classe & passagers */
.classe-btn, .perso-btn{
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border:1px solid #e5e7eb;
  background:#f9fafb;
  cursor:pointer;
  font-weight:700;
}
.classe-btn.is-active, .perso-btn.is-active{
  background: var(--sncf-magenta);
  color:#fff;
  border-color: transparent;
}

/* Affichages prix & code */
#prix-affiche{
  font-weight:800;
  text-align:center;
  margin: 10px 0 2px;
  font-size: clamp(18px,2.2vw,22px);
}
#code-affiche{
  font-weight:800; text-align:center; margin: 6px 0 12px;
  color: var(--sncf-accent);
}

/* Pied de machine */
.machine__footer{
  display:flex; align-items:center; gap:10px;
  padding: 10px 14px;
  border-top: 1px solid #e5e7eb;
  background:#fafafa;
  color:#6b7280;
  font-size: 13px;
}
.status-led{
  width:10px; height:10px; border-radius:999px; background:#22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,.15);
}

/* Accessibilité tactile */
button, .horaire{ touch-action: manipulation; }

/* Responsif serré */
@media (max-width: 420px){
  .horaire{ min-width: 44%; }
}
