/* All Aboard. Laid out for tablets and computers first; phones still work. */
:root {
  --navy: #16324f; --ink: #1c2530; --muted: #5d6b7a; --paper: #f6f3ea; --line: #d9d3c3;
  --accent: #e0672b; --ok: #2e7d4f; --bad: #b3261e;
  --red: #d6453d; --orange: #e8852b; --yellow: #e6c229; --green: #4c9f50;
  --teal: #2aa5a0; --blue: #3b6fd4; --purple: #8a56c2; --brown: #8b5e3c; --any: #9aa0a6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--paper); -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
button { font: inherit; cursor: pointer; border: 1px solid var(--navy); background: #fff; color: var(--navy); border-radius: 10px; padding: 10px 14px; min-height: 44px; font-weight: 600; }
button.primary { background: var(--navy); color: #fff; width: 100%; margin-top: 14px; font-size: 17px; }
button.small { min-height: 34px; padding: 4px 10px; font-size: 14px; float: right; }
button.link { border: 0; background: none; color: var(--muted); text-decoration: underline; width: 100%; margin-top: 6px; font-weight: 400; }
button.link.inline { width: auto; min-height: 0; padding: 0; margin: 0; }
button.wide { width: 100%; margin-top: 10px; }
button.pill { background: #fff; flex: none; border-radius: 22px; padding: 0 16px; }
button.round { width: 44px; padding: 0; border-radius: 50%; font-size: 22px; line-height: 1; }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input { font: inherit; font-size: 17px; width: 100%; padding: 10px 12px; border: 1px solid #b8b2a3; border-radius: 10px; min-height: 44px; background: #fff; }
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }
.error { color: var(--bad); min-height: 1.4em; margin: 10px 0 0; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0; }

/* Home and lobby */
#home { max-width: 440px; margin: 0 auto; padding: 28px 16px 40px; }
#lobby { max-width: 900px; margin: 0 auto; padding: 20px 16px 40px; }
.lobbyGrid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 14px; }
@media (min-width: 760px) { .lobbyGrid { grid-template-columns: 1fr 1fr; align-items: start; } }
.tag.foot { font-size: 14px; margin-top: 14px; }
.logo { font-size: 44px; letter-spacing: -1px; color: var(--navy); text-align: center; }
.logo.small { font-size: 28px; }
.tag { text-align: center; color: var(--muted); margin: 6px 0 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.or { text-align: center; color: var(--muted); margin: 18px 0 0; font-size: 14px; }
#code { text-transform: uppercase; letter-spacing: 6px; font-weight: 700; text-align: center; }
.codeLabel { text-align: center; color: var(--muted); font-size: 14px; }
.bigCode { text-align: center; font-size: 56px; font-weight: 800; letter-spacing: 10px; color: var(--navy); margin: 0 0 10px 10px; }
.card h2 { font-size: 16px; margin-top: 18px; }
.card h2.first { margin-top: 0; }
.players { list-style: none; padding: 0; margin: 8px 0; }
.players li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #eee9dc; }
.avatar { flex: none; display: block; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #222; flex: none; display: inline-block; }
.players .off { color: var(--muted); font-size: 13px; margin-left: auto; }
.colorPick { display: flex; gap: 10px; margin: 6px 0 4px; }
.colorPick button { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 3px solid #222; }
.colorPick button[aria-pressed="true"] { box-shadow: 0 0 0 4px var(--accent); }
.avatarPick { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; margin: 8px 0 4px; }
.avatarPick button { padding: 3px; min-height: 0; border: 3px solid transparent; border-radius: 50%; background: none; aspect-ratio: 1; }
.avatarPick button .avatar { width: 100%; height: 100%; }
.avatarPick button[aria-pressed="true"] { border-color: var(--accent); }
.mapPick { display: grid; gap: 8px; margin-top: 8px; }
.mapPick button, .mapPick .chosen { display: flex; flex-direction: column; gap: 1px; text-align: left; padding: 8px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); min-height: 0; font-weight: 400; }
.mapPick b { font-size: 16px; }
.mapPick span { font-size: 13px; color: var(--muted); }
.mapPick [aria-pressed="true"], .mapPick .chosen { border-color: var(--navy); background: #eef3f8; }

/* Game */
#game { display: flex; flex-direction: column; min-height: 100%; }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; background: var(--navy); }
.brand { color: #fff; font-weight: 800; font-size: 19px; letter-spacing: -.3px; white-space: nowrap; display: none; }
.brand span { font-weight: 400; font-size: 13px; opacity: .8; margin-left: 8px; letter-spacing: 0; }
.scores { display: flex; gap: 6px; overflow-x: auto; flex: 1; }
.score { background: #fff; border-radius: 10px; padding: 3px 8px 3px 4px; font-size: 13px; white-space: nowrap; border: 3px solid transparent; opacity: .85; display: flex; align-items: center; gap: 6px; }
.score.turn { border-color: var(--accent); opacity: 1; }
.score b { font-size: 15px; }
.score .dot { width: 12px; height: 12px; border-width: 1.5px; vertical-align: -1px; margin-right: 4px; }
.score .off { color: var(--bad); }
header .round { background: #fff; flex: none; }
.status { order: 9; flex: 0 0 calc(100% + 20px); margin: 0 -10px -6px; padding: 8px 12px; font-weight: 600; background: #fff; border-bottom: 1px solid var(--line); }
.status.mine { animation: turnPulse 1.2s ease-out 1; }
@keyframes turnPulse { 0% { background: #ffc48f; } 100% { background: #fff3e6; } }
.playerList { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.playerList li { display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 5px; border-radius: 12px; border: 2px solid transparent; }
.playerList li.turn { border-color: var(--accent); background: #fff3e6; }
.playerList .who { flex: 1; min-width: 0; }
.playerList .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playerList .who span { font-size: 12.5px; color: var(--muted); }
.playerList .pts { font-size: 22px; font-weight: 800; }
.playerList .off, .log .off { color: var(--bad); font-weight: 400; }
.status.mine { background: #fff3e6; color: #8a3b0c; }
.status.final { background: #fde8e6; color: var(--bad); }

.boardWrap { position: relative; background: #cfe3ee; border-bottom: 1px solid var(--line); }
/* The board fills the space between the status line and the card tray (sized in app.js). */
.boardScroll { overflow: auto; max-height: 62vh; touch-action: pan-x pan-y; display: flex; }
#board { display: block; margin: auto; flex: none; }
.zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; }
.zoom button { background: rgba(255,255,255,.92); }
#board .land { fill: #f1ecdf; stroke: #b9b29f; stroke-width: .8; }
#board .focus { fill: #fbf6e6; stroke: #a79f88; stroke-width: 1.2; }
#board .borders { fill: none; stroke: #d8d1bf; stroke-width: .6; }
/* Open routes are flat track tiles in the route's color. */
#board .slot { stroke: #333; stroke-width: .5; }
#board .route.can .slot { stroke: #000; stroke-width: 1.3; }
/* Claimed routes are chunky train cars in the player's color, with a white rim so they stand out. */
#board .car { stroke: #fff; stroke-width: 1.5; paint-order: stroke; }
#board .car.edge { fill: none; stroke: #10161d; stroke-width: .8; }
#board .roof { fill: #fff; opacity: .5; }
#board .roof.dk { fill: #10161d; opacity: .3; }
#board .route.fresh .wagon { animation: roll .45s cubic-bezier(.2, 1.4, .4, 1) both; transform-box: fill-box; transform-origin: center; }
@keyframes roll { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#board .hit { stroke: transparent; stroke-width: 15; fill: none; cursor: pointer; }
#board .route.sel .slot { stroke: #000; stroke-width: 1.8; }
#board .route.hinted .slot { stroke: var(--accent); stroke-width: 2.4; }
#board .city circle { fill: #fff; stroke: #222; stroke-width: 1.5; }
#board .city text { font: 600 10px system-ui, sans-serif; text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 2.6px; fill: #111; }
#board .city.goal circle { fill: var(--accent); stroke: #000; stroke-width: 2.2; r: 8px; }
#board .city.goal text { font-size: 12px; }

.panel { padding: 8px 10px 28px; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); align-content: start; }
.sideOnly { display: none; }
/* Wide screens: the board on the left, players, tickets and the log beside it, nothing to scroll. */
@media (min-width: 1000px) {
  .brand { display: block; }
  header .scores { display: none; }
  .status { order: 0; flex: 1 1 0; min-width: 0; margin: 0 6px; padding: 5px 12px; border: 0; border-radius: 10px; font-size: 15px; line-height: 1.3; }
  .play { display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
  .panel { overflow-y: auto; overflow-x: hidden; padding: 8px; border-left: 1px solid var(--line); }
  .sideOnly { display: block; }
  /* Right side: the cards to draw, big, in a 3 by 2 grid with the deck. */
  .panel .cardRow { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 2px; }
  .panel .drawBox h3 { font-size: 15px; }
  /* Bottom: your own cards, centered and large. */
  .tray .handBox { max-width: 1100px; margin: 0 auto; }
  .tray .handBox h3 { text-align: center; }
  .tray .handRow { justify-content: center; }
  .tray .handRow .tc { flex: 0 0 116px; max-width: 116px; }
}
}
@media (min-width: 620px) and (max-width: 999px) { .panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.group { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.group h3 { font-size: 14px; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
.group h3 button.small { float: none; }
.group h3 .sub { font-weight: 400; }
/* Train cards: a cream card with a colored frame, a train car and a name strip. */
.tc { --c: #999; position: relative; aspect-ratio: 1.42; min-height: 0; padding: 0; border-radius: 9px; border: 4px solid var(--c); background: #fff8e8;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; overflow: hidden; outline: 1.5px solid var(--ink); outline-offset: -1px;
  color: #fff; font-weight: 700; font-size: 12px; line-height: 1.15; transition: transform .12s ease; }
.tc svg { width: 90%; flex: 1; min-height: 0; display: block; overflow: visible; }
.tc .lab { width: 100%; text-align: center; background: var(--c); padding: 2px 0 1px; text-shadow: 0 1px 1px rgba(0,0,0,.4); white-space: nowrap; }
.c-red { --c: var(--red); } .c-orange { --c: var(--orange); } .c-yellow { --c: var(--yellow); } .c-green { --c: var(--green); }
.c-teal { --c: var(--teal); } .c-blue { --c: var(--blue); } .c-purple { --c: var(--purple); } .c-brown { --c: var(--brown); } .c-any { --c: var(--any); }
.tc.c-yellow .lab { color: #222; text-shadow: none; }
.tc.c-wild { --rainbow: linear-gradient(120deg, #d6453d, #e8852b, #e6c229, #4c9f50, #2aa5a0, #3b6fd4, #8a56c2); border-color: transparent;
  background: linear-gradient(#fff8e8, #fff8e8) padding-box, var(--rainbow) border-box; }
.tc.c-wild .lab { background: var(--rainbow); }
.tc.c-wild .puffs circle { animation: puff 2.6s ease-in-out infinite; }
.tc.c-wild .puffs circle:nth-child(2) { animation-delay: .5s; } .tc.c-wild .puffs circle:nth-child(3) { animation-delay: 1s; }
@keyframes puff { 0%, 100% { transform: translate(0, 0); opacity: .95; } 50% { transform: translate(3px, -3px); opacity: .45; } }
.tc.deck { border-color: #16324f; background: repeating-linear-gradient(45deg, #16324f, #16324f 7px, #1f4670 7px, #1f4670 14px); justify-content: center; font-size: 13px; }
.tc.deck .n { font-size: 22px; line-height: 1; }
.tc.empty { background: #eee; border: 2px dashed #bbb; outline: 0; color: #999; justify-content: center; }
.tc .count { position: absolute; top: -1px; right: -1px; background: var(--ink); color: #fff; border-radius: 0 5px 0 9px; min-width: 21px; padding: 0 5px 1px; font-size: 14px; text-align: center; }
.handRow .tc svg { width: 78%; margin-right: 14%; }
button.tc { cursor: pointer; }
button.tc:disabled { opacity: 1; cursor: default; }
button.tc.no { opacity: .35; }
.tray.go button.tc:not(:disabled) { box-shadow: 0 0 0 3px var(--accent); }
.tray.go button.tc:not(:disabled):hover { transform: translateY(-4px); }
.tc.deal { animation: deal .38s ease-out both; }
@keyframes deal { from { transform: translateY(-26px) rotate(-5deg); opacity: 0; } to { transform: none; opacity: 1; } }
.tc.gain { animation: gain .5s ease-out both; }
@keyframes gain { 0% { transform: scale(1); } 40% { transform: scale(1.16) translateY(-5px); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .tc.deal, .tc.gain, .tc.c-wild .puffs circle, .status.mine, #board .route.fresh .wagon { animation: none; } }
.tray { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: #fff; border-top: 3px solid var(--line);
  padding: 4px 10px calc(8px + env(safe-area-inset-bottom)); box-shadow: 0 -3px 14px rgba(0,0,0,.14); }
.tray.go { border-top-color: var(--accent); }
.tray h3 { font-size: 13px; color: var(--muted); margin: 4px 0; font-weight: 600; }
.tray.go #drawLabel { color: #8a3b0c; font-size: 15px; }
.cardRow { display: grid; grid-template-columns: repeat(6, minmax(0, 104px)); gap: 7px; padding: 4px; }
.handRow { display: flex; gap: 7px; overflow-x: auto; padding: 4px; min-height: 30px; }
.handRow .tc { flex: 0 0 calc((100% - 35px) / 6); max-width: 104px; }
@media (min-width: 700px) { .handRow .tc { flex-basis: calc((100% - 56px) / 9); } }
.trayHalf { min-width: 0; }
.tickets, .log { list-style: none; margin: 0; padding: 0; }
.tickets { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
/* A ticket: a small map with the trip on it, the two cities, and what it is worth. */
.ticket { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border: 2px solid #cdbf9f; border-radius: 12px; background: #fffaf0; cursor: pointer; position: relative; }
.ticket.on { border-color: var(--accent); background: #fff3e6; }
.ticket.done { border-color: var(--ok); background: #eef7f0; }
.ticket .mini { flex: none; width: 92px; border-radius: 7px; overflow: hidden; border: 1px solid #b9b29f; background: var(--land) center / 100% 100% no-repeat #cfe3ee; }
.ticket .mini svg { display: block; width: 100%; height: 100%; }
.ticket .trip { flex: 1; min-width: 0; font-weight: 700; line-height: 1.25; }
.ticket .trip span { display: block; overflow-wrap: anywhere; }
.ticket .trip .to::before { content: "to "; font-weight: 400; color: var(--muted); }
.ticket .trip .state { font-weight: 600; font-size: 13px; color: var(--ok); }
.ticket .pts { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; font-size: 17px; display: grid; place-items: center; }
.ticket.done .pts { background: var(--ok); }
.ticket input { width: 24px; height: 24px; min-height: 24px; flex: none; }
label.ticket { margin: 0; color: var(--ink); font-size: 16px; }
.log li { font-size: 14px; padding: 3px 0; color: #3a4654; }
.log .dot { width: 10px; height: 10px; border-width: 1.5px; margin-right: 6px; vertical-align: 0; }

/* Bottom sheet and toast */
.sheet { position: fixed; inset: 0; background: rgba(15, 25, 35, .35); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet.clear { background: none; pointer-events: none; }
.sheet.clear .sheetBody { pointer-events: auto; box-shadow: 0 -4px 24px rgba(0,0,0,.25); }
.sheetBody { background: #fff; width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 16px 16px 22px; max-height: 80vh; overflow: auto; }
.sheetBody h2 { font-size: 19px; margin-bottom: 4px; }
.sheetBody p { margin: 6px 0; }
.sheetBody .opts { display: grid; gap: 8px; margin-top: 12px; }
.sheetBody .opts button { text-align: left; }
.sheetBody .pick { color: var(--ink); font-size: 16px; margin-bottom: 0; display: flex; gap: 10px; align-items: center; padding: 12px 10px; border: 2px solid var(--line); border-radius: 12px; margin-top: 8px; cursor: pointer; }
.sheetBody .pick.on { border-color: var(--navy); background: #eef3f8; }
.sheetBody .pick input { width: 22px; min-height: 22px; height: 22px; flex: none; }
.sheetBody .pick .pts { margin-left: auto; font-weight: 700; }
.sheetBody table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 15px; }
.sheetBody th, .sheetBody td { padding: 6px 4px; text-align: right; border-bottom: 1px solid #eee9dc; }
.sheetBody th:first-child, .sheetBody td:first-child { text-align: left; }
.sheetBody .win td { font-weight: 800; background: #fff3e6; }
.sheetBody ol { padding-left: 20px; } .sheetBody li { margin: 6px 0; }
/* "Your turn" choices float over the map so the card tray underneath stays usable. */
.sheet.center { align-items: flex-start; padding: 118px 12px 0; } /* top padding is set from the board's position */
.sheet.center .sheetBody { border-radius: 18px; max-width: 440px; border: 3px solid var(--accent); max-height: calc(100vh - 300px); }
.choices { display: grid; gap: 8px; margin-top: 8px; }
.choices button { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 14px; border-width: 2px; }
.choices button b { font-size: 17px; }
.choices button span { font-weight: 400; font-size: 14px; color: var(--muted); }
.quiet { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 8px 0 0; font-size: 13px; }
.quiet input { width: 18px; min-height: 18px; height: 18px; }
.status button.small { float: none; margin-left: 8px; }
#board.claiming .route.can .slot { stroke: var(--accent); stroke-width: 2.6; }
@keyframes trayFlash { 0%, 100% { background: #fff; } 25%, 75% { background: #ffe2c4; } }
.tray.flash { animation: trayFlash 1.6s ease-in-out 1; }
@media (prefers-reduced-motion: reduce) { .tray.flash { animation: none; } }
.sheetBody .kinds { display: flex; gap: 8px; margin: 10px 0; }
.sheetBody .kinds button { flex: 1; min-height: 40px; padding: 4px; }
.sheetBody .kinds button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.sheetBody textarea { font: inherit; width: 100%; min-height: 110px; padding: 10px 12px; border: 1px solid #b8b2a3; border-radius: 10px; resize: vertical; }
.sheetBody .shot { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.sheetBody .shot img { width: 132px; border: 1px solid var(--line); border-radius: 6px; }
.sheetBody .shot label { display: flex; gap: 8px; align-items: center; margin: 0; color: var(--ink); font-size: 15px; }
.sheetBody .shot input { width: 20px; height: 20px; min-height: 20px; }
.sheetBody .ticketPick { display: grid; gap: 8px; margin-top: 8px; }
.sheetBody h2 .avatar { display: inline-block; vertical-align: -9px; margin-right: 8px; }
/* Wide screens: tickets to choose, a route to claim and the helper open over the side panel, so the map stays in view. */
@media (min-width: 1000px) {
  .sheet.clear:not(.center) { justify-content: flex-end; align-items: flex-start; padding: 108px 8px 0 0; }
  .sheet.clear:not(.center) .sheetBody { max-width: 400px; border-radius: 18px; max-height: calc(100vh - 124px); border: 2px solid var(--navy); }
}
.sheetBody h3 { font-size: 15px; color: var(--muted); margin: 16px 0 6px; }
.hintBox { background: #fff3e6; border: 1px solid #f1c9a5; border-radius: 12px; padding: 10px 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 36px; padding: 4px 12px; border-radius: 18px; font-weight: 400; font-size: 14px; }
.sheetBody .q { font-weight: 600; margin-top: 12px; }
.sheetBody .a { background: #eef3f8; border-radius: 12px; padding: 8px 12px; }
.sheetBody .a.wait { color: var(--muted); }
#askForm { margin-top: 12px; }
.players li button { margin-left: auto; float: none; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid #222; vertical-align: -2px; margin-right: 4px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: 90vw; }

/* "Your turn" banner: pops over the top of the map for a couple of seconds. */
.turnBanner { position: fixed; left: 50%; bottom: 200px; z-index: 12; transform: translateX(-50%); pointer-events: none;
  display: flex; align-items: center; gap: 12px; padding: 10px 22px 10px 12px; border-radius: 40px;
  background: var(--accent); color: #fff; font-size: 26px; font-weight: 800; letter-spacing: -.3px;
  box-shadow: 0 6px 24px rgba(0,0,0,.3); border: 3px solid #fff; white-space: nowrap; }
.turnBanner .avatar { background: #fff; border-radius: 50%; }
.turnBanner.show { animation: bannerPop 2.4s ease both; }
@keyframes bannerPop { 0% { transform: translate(-50%, -30px) scale(.7); opacity: 0; } 12% { transform: translate(-50%, 0) scale(1.06); opacity: 1; }
  20% { transform: translate(-50%, 0) scale(1); } 82% { opacity: 1; } 100% { transform: translate(-50%, -10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .turnBanner.show { animation: none; } }
#soundBtn[aria-pressed="false"] { opacity: .75; }

/* A ticket's way across the map: a glowing band under the route, open links dashed. */
#board .route .glow { fill: none; stroke: #ffe14d; stroke-width: 16; stroke-linecap: round; opacity: .9; pointer-events: none; animation: glow 1.6s ease-in-out infinite; filter: drop-shadow(0 0 3px rgba(122, 74, 0, .9)); }
#board.tracing .route:not(.onpath) { opacity: .3; }
#board .route { transition: opacity .25s; }
#board .route.onpath:not(.done) .slot { stroke: #7a4a00; stroke-width: 1.4; stroke-dasharray: 3 2; }
#board .route.onpath.done .glow { stroke: #fff4b8; opacity: .9; animation: none; }
@keyframes glow { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #board .route .glow { animation: none; } }
.ticket .trip .state.todo { color: var(--muted); font-weight: 400; }
.ticket .trip .state.bad { color: var(--bad); }
/* Terrain maps: the picture is the land; a thin line marks the state's edge. */
#board .terrain { pointer-events: none; }
#board .water { fill: #cfe3ee; stroke: #9fbfd0; stroke-width: .6; }
#board .bordersOnTerrain { fill: none; stroke: #4b5a3a; stroke-width: .9; stroke-dasharray: 4 3; opacity: .35; pointer-events: none; }
#board .focusLine { fill: none; stroke: #3d5a2a; stroke-width: 1.4; opacity: .55; pointer-events: none; }
#board .hit { fill: none; }

/* The cards to draw, wherever they sit: on your turn they get an orange frame. */
.drawBox.go { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.drawBox.go h3 { color: #8a3b0c; }
.drawBox.go button.tc:not(:disabled) { box-shadow: 0 0 0 3px var(--accent); }
.drawBox.go button.tc:not(:disabled):hover { transform: translateY(-4px); }
.drawBox.flash { animation: trayFlash 1.6s ease-in-out 1; }
.tray .drawBox { border: 0; padding: 0; background: none; box-shadow: none; }
.handRow { justify-content: center; }
.handBox h3 { margin: 4px 0; }
.group h3 button.link-ish { min-height: 26px; padding: 0 10px; font-size: 13px; font-weight: 600; }

/* Tickets: a floating button on the left of the map, and the drawer it opens. */
.ticketFab { position: absolute; left: 10px; top: 10px; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 26px;
  background: #fffaf0; border: 2px solid var(--navy); box-shadow: 0 3px 12px rgba(0,0,0,.25); font-size: 16px; }
.ticketFab .ico { font-size: 22px; line-height: 1; }
.ticketFab b { background: var(--navy); color: #fff; border-radius: 12px; min-width: 26px; padding: 1px 7px; font-size: 15px; }
.ticketFab.new { animation: fabPop 1.2s ease-out 2; }
@keyframes fabPop { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(224,103,43,.35); } }
.ticketDrawer { position: absolute; left: 10px; top: 10px; z-index: 3; width: 320px; max-width: calc(100% - 80px); overflow-y: auto;
  background: #fff; border: 2px solid var(--navy); border-radius: 16px; padding: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.28); }
.ticketDrawer h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ticketDrawer h3 .small { float: none; margin-left: auto; }
.ticketDrawer .x { min-height: 34px; width: 34px; padding: 0; border-radius: 50%; font-size: 22px; line-height: 1; }
.ticketDrawer .tip { margin: 0 0 8px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .ticketFab.new { animation: none; } }

/* Paused: a veil over the map. */
.pausedVeil { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgba(22, 50, 79, .45); }
.pausedVeil > div { background: #fff; border-radius: 18px; padding: 20px 26px; text-align: center; display: grid; gap: 6px; max-width: 360px; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.pausedVeil b { font-size: 24px; color: var(--navy); }
.pausedVeil .primary { margin-top: 8px; }

/* The ⚙ menu opens at the top right, under the gear. */
header .gear { font-size: 24px; }
@media (min-width: 1000px) { .sheet.clear.side { justify-content: flex-end; align-items: flex-start; padding: 64px 10px 0 0; } }
.menuList { display: grid; gap: 8px; margin-top: 6px; }
.menuList button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; border-width: 2px; }
.menuList button span { font-weight: 400; font-size: 13.5px; color: var(--muted); }
label.toggle { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 15px; margin: 8px 0; }
label.toggle input { width: 22px; height: 22px; min-height: 22px; flex: none; }

/* One player's trains picked out on the map (tap a player). */
#board.spotlight .route:not(.spot) { opacity: .22; }
#board .route.spot .car { stroke: #ffe14d; stroke-width: 2.6; }
#board.spotlight .route.spot .wagon { animation: spotBob 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spotBob { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { #board.spotlight .route.spot .wagon { animation: none; } }
.playerList li[data-seat], .score[data-seat] { cursor: pointer; }
.playerList li[data-seat]:hover { background: #f4f1e8; }
.playerList li.spot { border-color: var(--navy); background: #eef3f8; box-shadow: 0 0 0 2px var(--navy); }
.score.spot { border-color: #ffe14d; }
.spotCard { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 3; width: 360px; max-width: calc(100% - 20px);
  background: #fff; border: 3px solid var(--pc, var(--navy)); border-radius: 16px; padding: 10px 12px; box-shadow: 0 6px 24px rgba(0,0,0,.28); }
.spotHead { display: flex; align-items: center; gap: 10px; }
.spotHead > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.spotHead b { font-size: 17px; }
.spotHead span { font-size: 13px; color: var(--muted); }
.spotCard .x { min-height: 34px; width: 34px; padding: 0; border-radius: 50%; font-size: 22px; line-height: 1; flex: none; }
.spotStats { font-size: 13px; margin: 8px 0 4px; color: var(--ink); }
.spotList { list-style: none; margin: 0; padding: 0; max-height: 150px; overflow-y: auto; font-size: 14px; }
.spotList li { display: flex; align-items: center; gap: 6px; padding: 2px 0; border-top: 1px solid #f0ece0; }
.spotList b { margin-left: auto; color: var(--ok); }

.spotCard .spotHead .x + .x { margin-left: -4px; }
.spotCard .spotList { max-height: 120px; }
/* The chosen player's details, opened inside the Players list. */
.playerList li.spotIn { display: block; border: 2px solid var(--navy); border-top: 0; border-radius: 0 0 12px 12px; margin-top: -8px; padding: 6px 10px 4px; font-size: 13px; color: var(--muted); background: #fff; cursor: default; }
.playerList li.spot { border-radius: 12px 12px 0 0; }
.playerList li.spotIn .spotStats { color: var(--ink); }
.playerList li.spotIn .spotList { max-height: 220px; }
.playerList li.spotIn .link { margin-top: 2px; font-size: 13px; min-height: 32px; }

/* Accounts: sign-in button, account chip, account sheet, picture maker */
.account { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.center { text-align: center; }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; border: 1px solid #c7c2b4; border-radius: 10px; background: #fff; color: #1f1f1f; font-weight: 600; text-decoration: none; }
.gbtn:hover { background: #f7f7f7; }
.meChip { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border-color: var(--line); padding: 8px 12px; }
.meChip span { flex: 1; display: flex; flex-direction: column; }
.meChip small { color: var(--muted); font-weight: 400; font-size: 13px; }
.meChip i { font-style: normal; font-size: 24px; color: var(--muted); }
.myGames { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.myGames button { width: 100%; text-align: left; display: flex; gap: 10px; align-items: baseline; border-color: var(--line); min-height: 40px; padding: 6px 12px; }
.myGames b { letter-spacing: 2px; }
.myGames span { color: var(--muted); font-weight: 400; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheetBody h3 { font-size: 15px; margin: 16px 0 6px; color: var(--navy); }
.badge { display: inline-block; vertical-align: 3px; background: #b8862b; color: #fff; font-size: 12px; border-radius: 10px; padding: 1px 8px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; margin-top: 10px; }
.picCell { position: relative; }
.picCell > button[data-use] { padding: 3px; min-height: 0; border: 3px solid transparent; border-radius: 50%; background: none; width: 100%; aspect-ratio: 1; }
.picCell > button[data-use] .avatar { width: 100%; height: 100%; }
.picCell.on > button[data-use] { border-color: var(--accent); }
.picCell .del { position: absolute; top: -2px; right: -2px; min-height: 0; width: 24px; height: 24px; padding: 0; border-radius: 12px; font-size: 15px; line-height: 1; background: #fff; }
.picCell .del.sure { width: auto; padding: 0 8px; background: var(--bad); color: #fff; border-color: var(--bad); font-size: 12px; }
.statGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.statGrid div { background: var(--paper); border-radius: 10px; padding: 8px; text-align: center; font-size: 13px; color: var(--muted); }
.statGrid b { display: block; font-size: 22px; color: var(--ink); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.dangerBg { background: var(--bad); border-color: var(--bad); }
.photoPick { display: block; position: relative; width: 168px; height: 168px; margin: 12px auto 4px; border-radius: 50%; border: 3px dashed var(--navy); overflow: hidden; cursor: pointer; background: var(--paper); color: var(--navy); font-size: 16px; font-weight: 600; text-align: center; }
.photoPick span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1.6; }
.photoPick img { width: 100%; height: 100%; object-fit: cover; }
.photoPick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 38px; padding: 6px 12px; border-color: var(--line); font-weight: 500; }
.chips button[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.bigPic { display: flex; justify-content: center; margin: 12px 0; }
.making { display: flex; justify-content: center; padding: 24px 0 8px; }
.making .tc { width: 180px; animation: chug 1.2s ease-in-out infinite; }
@keyframes chug { 0%, 100% { transform: translateX(-12px); } 50% { transform: translateX(12px); } }
.avatarPick .makeMine { border: 2px dashed var(--navy); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 20px; line-height: 1; }
.avatarPick .makeMine span { font-size: 10px; margin-top: 3px; }

/* The ticket being shown: a slim bar across the top of the map, so the trip itself stays in view. */
.tripBar { position: absolute; left: 10px; top: 10px; z-index: 3; max-width: calc(100% - 76px); display: flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 5px; border-radius: 30px; background: rgba(255,250,240,.96); border: 2px solid var(--accent); box-shadow: 0 3px 12px rgba(0,0,0,.25); }
.tripBar.done { border-color: var(--ok); }
.tripBar .tripList { min-height: 40px; padding: 0 10px; border-radius: 22px; display: flex; align-items: center; gap: 6px; font-size: 18px; background: #fff; border: 1.5px solid var(--navy); }
.tripBar .tripList b { background: var(--navy); color: #fff; border-radius: 10px; min-width: 22px; padding: 0 6px; font-size: 14px; }
.tripBar .tripText { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.tripBar .tripText b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tripBar .tripText .arrow { color: var(--accent); }
.tripBar .tripText span { font-size: 13px; color: var(--muted); }
.tripBar .tripText .ok { color: var(--ok); font-weight: 600; }
.tripBar .tripText .bad { color: var(--bad); font-weight: 600; }
.tripBar .pts { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; font-size: 15px; display: grid; place-items: center; }
.tripBar .x { flex: none; min-height: 40px; width: 40px; padding: 0; border-radius: 50%; font-size: 24px; line-height: 1; }
.zoom button[disabled] { opacity: .45; }

/* Account sheet: upload your own photo, or make an AI one */
.picButtons { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.picButtons > * { flex: 1 1 200px; }
.btnLike { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--navy); background: #fff; color: var(--navy); font-weight: 600; cursor: pointer; margin: 0; }
.btnLike.primaryLike { background: var(--navy); color: #fff; }
.tag.foot.legal { margin-top: 4px; font-size: 13px; } .tag.foot.legal a { color: inherit; }
