/* Grandes Lignes : le nouveau style de table (d'après Chromo). Chargé après table.css. Préfixe glx-.
   Une grande table en noyer sous la lampe ; dessus, la carte de France en relief (img/rail/plateau.webp, Blender),
   les lignes peintes par-dessus, les petits wagons en plastique des joueurs, et des billets cartonnés à l'ancienne.
   La table reste sombre même en thème clair. Les sélecteurs passent par html[data-game] : la tuile du salon n'est pas touchée. */
html[data-game="rail"], html[data-theme="light"][data-game="rail"] {
  --bg: oklch(0.17 0.03 50); --surface: oklch(0.23 0.035 50); --surface-2: oklch(0.28 0.04 50); --line: oklch(0.42 0.04 55 / .6);
  --ink: oklch(0.97 0.01 80); --ink-2: oklch(0.86 0.02 75); --mute: oklch(0.76 0.025 70);
  --acc: oklch(0.85 0.14 82); --acc-soft: oklch(0.91 0.1 85); --on-acc: oklch(0.25 0.06 60); --neg: oklch(0.63 0.21 28); --pos: oklch(0.84 0.14 155); --gold: var(--acc);
  --glass-tint: oklch(0.2 0.03 50 / .5); --glass-tint-thick: oklch(0.17 0.03 50 / .84);
  --glass-hi: rgba(255, 255, 255, .3); --glass-rim: rgba(255, 255, 255, .14); --glass-edge: rgba(0, 0, 0, .35);
  --glass-ink: var(--ink); --glass-ink-2: var(--ink-2); --glass-field: rgba(255, 255, 255, .1);
  --felt-hi: oklch(0.42 0.06 55); --felt-mid: oklch(0.27 0.045 50); --felt-lo: oklch(0.12 0.022 45);
}
:root { --glx-paper: oklch(0.93 0.035 88); --glx-paper-2: oklch(0.88 0.045 80); --glx-paper-ink: oklch(0.3 0.045 45); --glx-paper-red: oklch(0.52 0.17 28); --glx-paper-ok: oklch(0.48 0.13 150); }
#s-rail { padding-bottom: 0; }
#s-rail button.tb-chip { min-height: 44px; min-width: 44px; justify-content: center; }
#s-rail .tb-opps { height: 100px; }
#s-rail .tb-btn.danger { animation: none; }
#gl-main:not(.desk-split) > :is(.glx-side, .glx-log) { display: none; }
.glx-final:empty, .glx-log:empty { display: none; }
.glx-sub { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.glx-dot { display: inline-block; width: 16px; height: 9px; border-radius: 2px; flex: none; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .35); }
.tb-e .glx-dot { position: absolute; right: -4px; bottom: -1px; }
.tb-e { position: relative; }

/* la carte */
.glx-mid { display: flex; flex-direction: column; gap: 10px; }
.glx-map { position: relative; flex: none; border-radius: 20px; overflow: hidden; touch-action: none; background: #173f52; aspect-ratio: 1035 / 1010; width: 100%;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .2), 0 0 0 4px rgba(0, 0, 0, .25), 0 18px 40px -12px rgba(0, 0, 0, .7); }
.glx-map svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.glx-map svg.drag { cursor: grabbing; }
.glx-map svg.gare { cursor: crosshair; }
.glx-zoom { position: absolute; left: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.glx-zoom button { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; font: 600 21px/1 var(--font); color: var(--ink);
  background: var(--tb-glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: inset 0 1px 0 var(--tb-hi), inset 0 0 0 .5px var(--tb-rim), 0 4px 10px rgba(0, 0, 0, .35); }
.glx-rt rect.k { stroke: rgba(20, 14, 8, .82); stroke-width: 1.6; }
.glx-rt.tun rect.k { stroke: #120c06; stroke-width: 2.4; stroke-dasharray: 5 3; }
.glx-rt.sel rect.k { stroke: #fff; stroke-width: 3; filter: drop-shadow(0 0 5px rgba(255, 220, 120, .95)); }
.glx-rt.sel.taken rect:first-child { stroke: #fff; stroke-width: 2.5; }
svg.picking .glx-rt:not(.sel):not(.mine) { opacity: .5; }
.glx-rt image { filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, .55)); }
.glx-rt rect.base { fill: rgba(14, 9, 4, .78); stroke: rgba(255, 255, 255, .92); stroke-width: 1.8; }
.glx-rt.mine rect.base { stroke: var(--acc); stroke-width: 2.4; }
@media (prefers-reduced-motion: no-preference) { .glx-rt.flash { animation: glx-flash 1.5s ease-out; transform-box: fill-box; } }
@keyframes glx-flash { 0%, 30% { filter: drop-shadow(0 0 8px rgba(255, 230, 150, 1)) brightness(1.4); } 100% { filter: none; } }
.glx-city circle { fill: #f6efdf; stroke: #3a2a1c; stroke-width: 2.4; }
.glx-city.goal circle { fill: var(--acc); }
.glx-city.done circle { fill: var(--pos); }
.glx-city.sel circle, .glx-city.sel path { stroke: #fff; stroke-width: 3.5; filter: drop-shadow(0 0 5px rgba(255, 220, 120, .95)); }
.glx-city text { font-family: var(--font); font-weight: 700; fill: #fff; stroke: rgba(22, 15, 8, .88); stroke-width: 4.5px; paint-order: stroke; stroke-linejoin: round; letter-spacing: -.01em; pointer-events: none; }
.glx-city.goal text { fill: oklch(0.93 0.12 88); }
.glx-city.offer circle { fill: #fff; stroke: var(--acc); stroke-width: 4; }
.glx-city.offer text { fill: oklch(0.93 0.12 88); }
@media (prefers-reduced-motion: no-preference) { .glx-city.offer circle { animation: glx-blink 1.1s ease-in-out infinite alternate; } }
@keyframes glx-blink { to { stroke-width: 9; stroke-opacity: .5; } }
.glx-offerw { display: flex; flex-direction: column; gap: 8px; }
.glx-offerw:empty { display: none; }

/* les cartes wagon : la couleur, le nom, le wagon rendu dans Blender */
.glx-card { position: relative; flex: none; display: block; border-radius: 9px; overflow: hidden; border: 0; padding: 0; cursor: pointer; color: #fff;
  background: radial-gradient(120% 90% at 30% 10%, color-mix(in oklab, var(--c), white 28%), var(--c) 55%, color-mix(in oklab, var(--c), black 30%));
  box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, .9), inset 0 0 0 4px rgba(0, 0, 0, .14), 0 6px 14px -4px rgba(0, 0, 0, .55), 0 2px 3px rgba(0, 0, 0, .25); }
.glx-card::before { content: ""; position: absolute; inset: 4px; border-radius: 6px; background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .07) 0 3px, transparent 3px 7px); }
.glx-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(118deg, rgba(255, 255, 255, .4) 0 12%, transparent 30%); }
.glx-card img { position: absolute; left: 50%; bottom: 5%; transform: translateX(-50%); height: 72%; width: auto; max-width: 92%; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .4)); }
.glx-card .lb { position: absolute; left: 4px; right: 4px; top: 4px; padding: 2px 3px 1px; border-radius: 5px 5px 2px 2px; font: 700 9.5px/1.2 var(--font); letter-spacing: -.025em; color: #fff; background: rgba(0, 0, 0, .32); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1; }
.glx-card.loco { background: conic-gradient(from 200deg at 50% 60%, #d8423a, #ef7d2a, #f0c22f, #3a9a52, #2f6fd0, #8a4cc4, #d8423a); }
.glx-card.loco::before { background: radial-gradient(90% 80% at 50% 45%, rgba(25, 20, 15, .35), rgba(25, 20, 15, .82)); }
.glx-card.off { filter: saturate(.4) brightness(.55); cursor: default; }
.glx-card.empty { background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .15); cursor: default; }
.glx-card.empty::before, .glx-card.empty::after { display: none; }
.glx-card.back { background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .14), transparent 60%), repeating-linear-gradient(45deg, oklch(0.4 0.09 40) 0 4px, oklch(0.34 0.08 40) 4px 8px); }
.glx-card.tkb { background: linear-gradient(180deg, var(--glx-paper), var(--glx-paper-2)); }
.glx-card.back::before { display: none; }
.glx-card.tkb::before { inset: 3px; border: 1.5px dashed rgba(80, 50, 20, .35); background: none; }
.glx-card.back > span, .glx-card.tkb > span { position: absolute; inset: 0; display: grid; place-content: center; font: 750 11px/1.15 var(--font); text-align: center; }
.glx-card.tkb > span { color: var(--glx-paper-ink); }
.glx-card > span small { display: block; font-weight: 600; font-size: 10px; opacity: .75; font-variant-numeric: tabular-nums; }
.glx-card.hit { box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, .9), 0 0 0 3px var(--neg), 0 6px 14px -4px rgba(0, 0, 0, .55); }
@media (prefers-reduced-motion: no-preference) {
  .glx-card { transition: transform .25s cubic-bezier(.3, 1.3, .5, 1), filter .2s; }
  .glx-hc.new .glx-card { animation: glx-pop .45s cubic-bezier(.3, 1.4, .5, 1); }
}
@keyframes glx-pop { from { transform: translateY(-30px) scale(.7); opacity: 0; } }
.glx-river { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; align-items: stretch; }
.glx-river:empty { display: none; }
.glx-river > .glx-card { width: 100%; aspect-ratio: 3 / 2.4; }

/* le plateau : ta main, ce que tu fais */
.glx-tray .tb-tray-top { font-variant-numeric: tabular-nums; }
.glx-body { display: flex; flex-direction: column; gap: 8px; }
.glx-hand { display: flex; gap: 6px; overflow-x: auto; padding: 12px 6px 4px; margin: -6px -6px 0; scrollbar-width: none; }
.glx-hand::-webkit-scrollbar { display: none; }
.glx-hc { position: relative; flex: none; display: block; }
.glx-hc .glx-card { width: 64px; height: 48px; cursor: default; }
.glx-hc .n { position: absolute; right: -5px; top: -7px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #fff; color: #111; font: 750 13px/22px var(--font); font-variant-numeric: tabular-nums; text-align: center; z-index: 2; box-shadow: 0 2px 5px rgba(0, 0, 0, .35); }
.glx-hc.ok { transform: translateY(-6px); transition: transform .25s cubic-bezier(.3, 1.3, .5, 1); }
.glx-hc.ok .glx-card { box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, .9), 0 0 0 2.5px var(--acc), 0 0 18px 2px color-mix(in oklab, var(--acc) 50%, transparent), 0 8px 16px -4px rgba(0, 0, 0, .6); }
.glx-hint { margin: 0 4px; font-size: 13.5px; color: var(--ink-2); }
.glx-pick { display: flex; align-items: center; gap: 10px; padding: 2px 4px; }
.glx-pick .sw, .glx-pay .sw, .glx-lines .sw { width: 34px; height: 20px; border-radius: 4px; flex: none; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .35); }
.glx-pick .sw.gare { background: var(--acc); clip-path: polygon(0 45%, 50% 0, 100% 45%, 100% 100%, 0 100%); }
.glx-pick .t { flex: 1; min-width: 0; }
.glx-pick .t b { display: block; font-size: 16px; }
.glx-pick .t small { color: var(--ink-2); font-size: 13px; }
.glx-pays { display: flex; gap: 6px; flex-wrap: wrap; }
.glx-pay { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px 0 8px; border: 0; border-radius: 999px; font: 600 13px var(--font); color: var(--ink); cursor: pointer; background: var(--tb-field); box-shadow: inset 0 0 0 .5px var(--tb-rim); }
.glx-pay .sw { width: 22px; height: 13px; }
.glx-pay.on { background: color-mix(in oklab, var(--acc) 26%, transparent); box-shadow: inset 0 0 0 1.5px var(--acc); }
.glx-shown { display: flex; gap: 8px; justify-content: center; }
.glx-shown .glx-card { width: 78px; height: 58px; cursor: default; }

/* les billets : des tickets cartonnés, perforés, numérotés */
.glx-tickets { display: flex; flex-direction: column; gap: 9px; }
.glx-ticket { position: relative; display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 80px; padding: 8px 14px 8px 20px; border-radius: 6px; border: 0; text-align: left; color: var(--glx-paper-ink); font: inherit; width: 100%;
  background: linear-gradient(180deg, var(--glx-paper), var(--glx-paper-2)); box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(80, 50, 20, .18);
  -webkit-mask: radial-gradient(circle 7px at 0 50%, transparent 97%, #000 100%); mask: radial-gradient(circle 7px at 0 50%, transparent 97%, #000 100%); }
.glx-ticket::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; border-left: 2px dotted rgba(80, 50, 20, .35); }
.glx-ticket svg { width: 70px; height: 66px; }
.glx-ticket svg .f { fill: rgba(80, 50, 20, .16); stroke: rgba(80, 50, 20, .5); stroke-width: 14; stroke-linejoin: round; }
.glx-ticket svg .l { stroke: var(--glx-paper-red); stroke-width: 16; stroke-dasharray: 34 22; stroke-linecap: round; }
.glx-ticket svg .c { fill: var(--glx-paper-red); }
.glx-ticket .v { display: block; font: 750 16px/1.15 var(--font); letter-spacing: -.01em; overflow-wrap: anywhere; }
.glx-ticket .v i { font-style: normal; font-weight: 500; opacity: .6; padding: 0 4px; }
.glx-ticket .m { display: block; margin-top: 3px; font: 600 11.5px var(--font); opacity: .72; font-variant-numeric: tabular-nums; }
.glx-ticket .p { font: 800 26px/1 var(--font); font-variant-numeric: tabular-nums; color: var(--glx-paper-red); text-align: right; }
.glx-ticket .p small { display: block; font: 650 10.5px var(--font); color: var(--glx-paper-ink); opacity: .7; }
.glx-ticket.done .p { color: var(--glx-paper-ok); }
.glx-ticket .stamp { position: absolute; left: 24px; top: 50%; transform: translateY(-50%) rotate(-14deg); background: color-mix(in oklab, var(--glx-paper) 80%, transparent); padding: 2px 8px; border: 2px solid var(--glx-paper-ok); color: var(--glx-paper-ok); border-radius: 6px; font: 800 12px var(--font); opacity: .88; }
.glx-ticket .stamp.no { border-color: var(--glx-paper-red); color: var(--glx-paper-red); }
.glx-ticket.long { background: linear-gradient(180deg, oklch(0.9 0.05 70), oklch(0.84 0.06 62)); }
button.glx-ticket { cursor: pointer; }
button.glx-ticket[aria-pressed="false"] { opacity: .5; filter: saturate(.5); }
button.glx-ticket[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--acc), 0 6px 16px -6px rgba(0, 0, 0, .6); }
.glx-tickets.small .glx-ticket { min-height: 64px; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 10px; }
.glx-tickets.small .glx-ticket svg { width: 54px; height: 50px; }
.glx-tickets.small .glx-ticket .v { font-size: 14.5px; }
.glx-tickets.small .glx-ticket .p { font-size: 21px; }
.glx-tickets.small .glx-ticket .stamp { left: 18px; font-size: 11px; }
.glx-final { display: flex; flex-direction: column; gap: 8px; }

/* les lignes possibles (feuille) */
.glx-lines { list-style: none; margin: 0; padding: 0; }
.glx-lines li + li { border-top: .5px solid rgba(255, 255, 255, .12); }
.glx-lines button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 6px 2px; border: 0; background: none; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.glx-lines .t { flex: 1; min-width: 0; }
.glx-lines .t b { display: block; font-weight: 600; }
.glx-lines .t small { color: var(--ink-2); font-size: 13px; }
.glx-lines .pts { font: 700 18px var(--font); font-variant-numeric: tabular-nums; color: var(--acc); }

/* la tuile du salon, en attendant l'icône 3D : une ligne de wagons sur deux villes */
.glx-art { position: relative; display: block; width: 46px; height: 30px; }
.glx-art i { position: absolute; top: 12px; width: 11px; height: 6px; border-radius: 1.5px; background: #d8423a; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.glx-art i:nth-child(1) { left: 7px; } .glx-art i:nth-child(2) { left: 18px; } .glx-art i:nth-child(3) { left: 29px; }
.glx-art::before, .glx-art::after { content: ""; position: absolute; top: 10px; width: 9px; height: 9px; border-radius: 50%; background: #f6efdf; box-shadow: 0 0 0 2px #3a2a1c; }
.glx-art::before { left: -3px; } .glx-art::after { right: -3px; }

/* PC : la carte au centre, la rivière en colonne à droite de la carte */
@media (min-width: 1100px) {
  #gl-main.desk-split .desk-main { display: flex; flex-direction: column; gap: 10px; min-height: calc(100dvh / var(--z, 1) - 90px); }
  .glx-desk .glx-mid { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 14px; align-items: start; }
  .glx-desk .glx-map { width: auto; height: min(calc(100dvh / var(--z, 1) - 360px), 760px); min-height: 420px; justify-self: center; }
  .glx-desk .glx-river { display: flex; flex-direction: column; gap: 8px; }
  .glx-desk .glx-river > .glx-card { aspect-ratio: auto; height: 70px; }
  .glx-desk .glx-river .lb { font-size: 11.5px; padding: 3px 4px 2px; }
  .glx-desk .glx-hc .glx-card { width: 88px; height: 64px; }
  .glx-desk .glx-hc .lb { font-size: 11px; }
  .glx-desk .glx-hand { justify-content: center; }
  .glx-desk .tb-opps { height: 96px; }
}
@media (prefers-reduced-motion: reduce) { .glx-hc.ok { transition: none; } }
