/* Stop Requested, the web game */
@font-face { font-family: "Cabin"; src: url("/fonts/Cabin-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Cabin"; src: url("/fonts/Cabin-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Cabin"; src: url("/fonts/Cabin-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Cabin"; src: url("/fonts/Cabin-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --bg: #f4f1ea;
  --panel: #ffffff;
  --ink: #1d1f22;
  --muted: #6b6f76;
  --line: #ddd8cc;
  --accent: #d0312d;
  --accent-ink: #ffffff;
  --ok: #2f8a3e;
  --bad: #c0392b;
  --you: #ffffff;
  --you-edge: #1d1f22;
  --bot: #1d1f22;
  --bot-edge: #ffffff;
  --header: 48px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.4 Cabin, system-ui, sans-serif; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1 { font-size: 28px; margin: 0 0 8px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.muted { color: var(--muted); }

header.site { height: var(--header); display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--ink); color: #fff; }
header.site .brand { font-weight: 700; text-decoration: none; font-size: 17px; }
header.site nav { margin-left: auto; display: flex; gap: 16px; }
header.site nav a { text-decoration: none; opacity: .85; }
header.site nav a:hover { opacity: 1; text-decoration: underline; }

/* Plain pages: the list of boards, starting a game, rules */
.page { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.game-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.game-list a { display: block; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 18px; }
.game-list a:hover { border-color: var(--ink); }
form.start fieldset { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin: 0 0 16px; padding: 12px 16px; }
form.start legend { font-weight: 700; padding: 0 4px; }
form.start label { display: block; padding: 6px 0; }
button.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 10px 18px; font-weight: 700; cursor: pointer; }
button.primary:disabled { opacity: .5; cursor: default; }
.rules table { border-collapse: collapse; }
.rules td, .rules th { border: 1px solid var(--line); padding: 4px 8px; }

/* The game: the board, with the player's side panel */
.table { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: calc(100vh - var(--header)); }
.board-wrap { position: relative; overflow: hidden; background: #fbfaf7; }
.board { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.board.dragging { cursor: grabbing; }
.board svg { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
.zoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.zoom button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-size: 18px; cursor: pointer; }
/* The computer's move, over the board's top left corner until you click OK */
.move-card { position: absolute; left: 12px; top: 12px; z-index: 4; width: min(360px, calc(100% - 72px)); max-height: calc(100% - 24px); overflow-y: auto;
  background: var(--panel); border: 2px solid var(--ink); border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); display: grid; gap: 10px; }
.move-card[hidden] { display: none; }
.move-card.low { top: auto; bottom: 12px; }
.move-card h3 { margin: 0; font-size: 16px; }
.move-card .move-item { display: flex; gap: 10px; align-items: center; }
.move-card .move-item.claim { align-items: flex-start; }
.move-card .move-item.note { color: var(--muted); font-style: italic; font-size: 13px; }
.move-card .muted { font-size: 13px; }
.move-card .points { font-weight: 700; color: var(--accent); font-size: 14px; }
.move-card .swatch { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0,0,0,.3); flex: none; margin-top: 2px; }
.move-card .thumbs { display: flex; gap: 4px; flex: none; }
.move-card .thumb { width: 34px; aspect-ratio: 44 / 67; object-fit: cover; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.move-card button.primary { justify-self: end; min-width: 96px; }
.toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: min(560px, 90%); background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.error { background: var(--bad); }

.side { overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 12px 14px 32px; display: flex; flex-direction: column; gap: 16px; }

.players { display: grid; gap: 6px; }
.player { display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.player .piece { width: 22px; height: 12px; border-radius: 3px; border: 2px solid; grid-row: span 2; }
.player .piece.you { background: var(--you); border-color: var(--you-edge); }
.player .piece.bot { background: var(--bot); border-color: var(--bot); }
.player .name { font-weight: 700; }
.player .score { font-weight: 700; font-size: 20px; grid-row: span 2; }
.player .meta { color: var(--muted); font-size: 13px; }
.player.active { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }

.status { padding: 10px 12px; border-radius: 10px; background: #fff6d6; border: 1px solid #f0d77a; font-weight: 600; }
.status.waiting { background: #eef1f6; border-color: #d3d9e4; color: var(--muted); }
.status.over { background: #e6f4e8; border-color: #a9d4b0; }

.market { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.card { position: relative; padding: 0; border: 2px solid transparent; border-radius: 7px; background: none; cursor: pointer; aspect-ratio: 44 / 67; overflow: hidden; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 5px; }
.card:not(:disabled):hover { border-color: var(--accent); transform: translateY(-2px); }
.card:disabled { cursor: default; opacity: .45; }
.card .count { position: absolute; right: 3px; bottom: 3px; background: var(--ink); color: #fff; font-weight: 700; font-size: 13px; min-width: 22px; padding: 1px 5px; border-radius: 10px; text-align: center; }
.draw-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.draw-actions button { padding: 9px 8px; border-radius: 8px; border: 1px solid var(--ink); background: var(--panel); font-weight: 600; cursor: pointer; }
.draw-actions button:disabled { opacity: .4; cursor: default; border-color: var(--line); }
.draw-actions button:not(:disabled):hover { background: var(--ink); color: #fff; }

.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.hand .card { cursor: default; }
.hand .empty { color: var(--muted); grid-column: 1 / -1; }

.tickets { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tickets li { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; cursor: default; }
.tickets li:hover { border-color: var(--ink); }
.tickets .pts { margin-left: auto; font-weight: 700; }
.tickets .done { color: var(--ok); font-weight: 700; }
.tickets .empty { border: 0; color: var(--muted); padding: 0; }

.log { margin: 0; padding: 0 0 0 22px; font-size: 13px; display: grid; gap: 3px; max-height: 260px; overflow-y: auto; }
.log li.you { color: var(--ink); }
.log li.bot { color: #3d4e7a; }
.log li.note { color: var(--muted); font-style: italic; }

/* The board: claimable routes, the players' pieces, station tokens and highlights */
svg .route.can { cursor: pointer; }
svg .route.can rect.car { stroke: var(--ink); stroke-width: 3.5; }
svg .route.can:hover rect.car { stroke: var(--accent); stroke-width: 5; }
svg .route.closed { opacity: .25; }
svg .move-glow { fill: var(--accent); fill-opacity: .35; stroke: var(--accent); stroke-width: 5; pointer-events: none; animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 50% { fill-opacity: .15; stroke-opacity: .5; } }
@media (prefers-reduced-motion: reduce) { svg .move-glow { animation: none; } }
svg .piece { pointer-events: none; }
svg .piece.you { fill: var(--you); stroke: var(--you-edge); stroke-width: 3; }
svg .piece.bot { fill: var(--bot); stroke: var(--bot-edge); stroke-width: 3; }
svg .token-disc { pointer-events: none; }
svg .ring { fill: none; stroke: var(--accent); stroke-width: 6; pointer-events: none; }

.popover { position: fixed; z-index: 10; background: var(--panel); border: 1px solid var(--ink); border-radius: 10px; padding: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); min-width: 220px; max-width: 300px; }
.popover.drawn { min-width: 0; max-width: none; z-index: 7; text-align: center; padding: 10px 12px 8px; }
.popover.drawn h3 { font-size: 14px; margin-bottom: 6px; }
.drawn-cards { display: flex; gap: 8px; }
.drawn-cards figure { margin: 0; }
.drawn-cards img { display: block; width: 120px; aspect-ratio: 44 / 67; object-fit: cover; border-radius: 7px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.drawn-cards figcaption { font-size: 13px; font-weight: 600; margin-top: 4px; }
.hand .card.new { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.popover h3 { margin: 0 0 2px; font-size: 16px; }
.popover p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.popover .pay { display: grid; gap: 6px; }
.popover .pay button { text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; display: flex; gap: 8px; align-items: center; }
.popover .pay button:hover { border-color: var(--ink); }
.popover .swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.3); flex: none; }
.popover .cancel { margin-top: 8px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }

dialog { border: 1px solid var(--ink); border-radius: 12px; padding: 16px; max-width: min(440px, calc(100vw - 32px)); box-shadow: 0 12px 32px rgba(0,0,0,.25); }
#ticket-dialog { position: fixed; left: 16px; bottom: 16px; top: auto; margin: 0; z-index: 5; }
dialog h3 { margin: 0 0 4px; }
dialog p { margin: 0 0 10px; color: var(--muted); }
.offered { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.offered label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.offered label:hover { border-color: var(--ink); }
.offered .pts { margin-left: auto; font-weight: 700; }
#end-dialog table { border-collapse: collapse; width: 100%; margin: 8px 0 12px; }
#end-dialog th, #end-dialog td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: right; }
#end-dialog th:first-child, #end-dialog td:first-child { text-align: left; }
#end-dialog tr.total td { font-weight: 700; font-size: 17px; border-bottom: 0; }
#end-dialog .ticket-results { font-size: 13px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#end-dialog .ticket-results ul { margin: 4px 0 0; padding: 0; list-style: none; }
#end-dialog .actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
#end-dialog .actions button, #end-dialog .actions a { padding: 9px 14px; border-radius: 8px; border: 1px solid var(--ink); background: var(--panel); cursor: pointer; text-decoration: none; font-weight: 600; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }

@media (max-width: 900px) {
  .table { grid-template-columns: 1fr; height: auto; }
  .board-wrap { height: auto; aspect-ratio: var(--board-aspect, 3 / 2); max-height: 75vh; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  #ticket-dialog { left: 8px; right: 8px; bottom: 8px; max-width: none; }
  /* Phones: the move card sits at the bottom of the screen, leaving the board above it to look at */
  .move-card, .move-card.low { position: fixed; left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 45vh; z-index: 6; }
}

/* The live game's network map (live-network.php, live.js) */
.live-net { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: calc(100vh - var(--header)); }
.live-map { min-height: 300px; z-index: 0; }
.live-side section { display: grid; gap: 6px; }
.live-modes { display: grid; gap: 2px; }
.live-modes label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.live-modes .swatch { width: 22px; height: 5px; border-radius: 3px; flex: none; }
.live-modes .n { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.live-info-title { font-weight: 700; font-size: 16px; color: var(--ink); }
.live-info table { border-collapse: collapse; width: 100%; font-size: 13px; color: var(--ink); }
.live-info td { padding: 3px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.live-info td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.live-info tr.seg { cursor: pointer; }
.live-info tr.seg:hover td { background: #f6f3ec; }
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.live-trip { display: grid; gap: 6px; }
.live-trip label { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 6px; }
.live-trip label.check { display: flex; }
.live-trip input:not([type=checkbox]), .live-find { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; width: 100%; }
.live-trip button { justify-self: start; }
.live-legs { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.live-legs li { padding: 6px 8px; border-left: 4px solid var(--line); background: #faf8f3; border-radius: 0 6px 6px 0; }
.live-legs .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.live-hub-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; font-size: 14px; }
.live-hub-list li { padding: 4px 6px; border-radius: 6px; cursor: pointer; display: flex; gap: 6px; }
.live-hub-list li:hover { background: #f6f3ec; }
.live-hub-list .n { margin-left: auto; color: var(--muted); }
.leaflet-tooltip.live-label { background: rgba(255,255,255,.85); border: 0; box-shadow: none; padding: 0 3px; font: 600 11px Cabin, sans-serif; color: var(--ink); }
.leaflet-tooltip.live-label::before { display: none; }
@media (max-width: 900px) {
  .live-net { grid-template-columns: 1fr; grid-template-rows: 60vh auto; height: auto; }
  .live-side { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
}
.live-tiles { filter: grayscale(1) contrast(.8) brightness(1.08); }

/* The live game's hands (live-hand.js) and sign-up (live-try.php, live-team.php, live-rsvp.php) */
.hand-cards { display: grid; gap: 8px; }
.ticket-card { border-radius: 12px; background: #fffaf0; border: 2px solid #1d1f22; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.12); padding: 0; text-align: left; font: inherit; color: inherit; }
button.ticket-card { cursor: pointer; width: 100%; }
button.ticket-card:hover { border-color: var(--accent); }
.ticket-head { display: flex; align-items: center; justify-content: space-between; background: #1d1f22; color: #fff; padding: 6px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ticket-pts { background: var(--accent); color: #fff; border-radius: 50%; min-width: 34px; height: 34px; display: grid; place-items: center; font-size: 17px; font-weight: 700; letter-spacing: 0; margin: -2px -4px -2px 0; border: 2px solid #fff; }
.ticket-body { padding: 8px 12px 10px; display: grid; gap: 2px; }
.ticket-to { font-size: 18px; font-weight: 700; line-height: 1.2; }
.ticket-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ticket-card.final .ticket-head { background: #6b2c91; }
.ticket-card.small .ticket-pts { min-width: 30px; height: 30px; font-size: 15px; }
.hand-end span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font: 700 12px Cabin, sans-serif; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.hand-plan { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hand-plan > li { cursor: pointer; }
.hand-plan .hand-step { font-size: 14px; }
.hand-plan .when { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 4px; }
.hand-plan .live-legs { margin-top: 4px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; justify-self: start; }
.live-rsvp { display: grid; gap: 10px; }
.live-rsvp label { display: grid; gap: 4px; font-weight: 600; }
.live-rsvp input, .live-rsvp textarea, .live-rsvp select { font: inherit; font-weight: 400; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; width: 100%; }
.live-rsvp button { justify-self: start; }
.try-warn { color: var(--bad); font-weight: 600; margin: 0; }
.party-pin { background: #6b2c91; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px #6b2c91, 0 2px 6px rgba(0,0,0,.4); }
.live-side section[hidden] { display: none; }
.ticket-party { font-weight: 600; color: #6b2c91; }
.party-pin { background: #6b2c91; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px #6b2c91, 0 2px 6px rgba(0,0,0,.4); }
/* Narrow screens: the header wraps instead of squeezing the title */
@media (max-width: 600px) {
  header.site { height: auto; min-height: var(--header); flex-wrap: wrap; padding: 8px 12px; gap: 2px 14px; }
  header.site .brand { font-size: 15px; }
  header.site nav { margin-left: 0; gap: 14px; flex-wrap: wrap; font-size: 14px; }
}

/* Game day on a team's page (live-day.js) */
#team-day:not([hidden]) { display: grid; gap: 16px; }
.day-hub { display: grid; gap: 4px; font-weight: 600; }
.day-hub select { font: inherit; font-weight: 400; padding: 8px; border: 1px solid var(--line); border-radius: 6px; width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.chip.on { border-color: var(--ink); background: #f6f3ec; font-weight: 600; }
.day-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
button.secondary { background: var(--panel); border: 1px solid var(--ink); border-radius: 8px; padding: 9px 14px; font-weight: 600; cursor: pointer; }
button.secondary.party { border-color: #6b2c91; color: #6b2c91; }
.day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; }
.day-list button { width: 100%; text-align: left; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; }
.day-list button:hover { border-color: var(--ink); }
.day-list .when, .day-standings .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.day-status { margin: 0; padding: 10px 12px; border-left: 5px solid var(--line); background: #faf8f3; border-radius: 0 8px 8px 0; }
.day-status.party { border-color: #6b2c91; }
.day-score { border-collapse: collapse; width: 100%; font-size: 14px; }
.day-score td { padding: 3px 4px; border-bottom: 1px solid var(--line); }
.day-score td.num { text-align: right; font-variant-numeric: tabular-nums; }
.day-score tr.total td { font-weight: 700; border-bottom: 0; font-size: 16px; }
.day-standings { margin: 6px 0 0; padding-left: 22px; display: grid; gap: 2px; }
.day-standings li span { float: right; }
.day-standings li.you { font-weight: 700; }
.ticket-card.done { opacity: .6; }
.ticket-card.done .ticket-to::before { content: '✓ '; color: var(--ok); }
@media (max-width: 900px) {
  .live-net:has(#team-day:not([hidden])) { grid-template-rows: 38vh auto; }
}
.score-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.score-row { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.score-row .num { margin-left: auto; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.score-swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.score-list .small { font-size: 12px; }

/* The board view of the live map (live.js, src/Live/Board.php) */
.live-map.leaflet-container { background: #fbf8f2; }
.board-svg .hub, .board-svg .lane { cursor: pointer; }
.board-svg .lane.hi .car { stroke-width: 4.5; }
.board-svg .lane.hi path { stroke-width: 5; opacity: 1; }
.board-svg.hide-max [data-mode=max], .board-svg.hide-streetcar [data-mode=streetcar], .board-svg.hide-tram [data-mode=tram], .board-svg.hide-wes [data-mode=wes],
.board-svg.hide-frequent [data-mode=frequent], .board-svg.hide-bus [data-mode=bus], .board-svg.hide-bike [data-mode=bike] { display: none; }
.live-view-switch { background: var(--panel); display: flex; align-items: center; font: 600 13px Cabin, sans-serif; }
.live-view-switch button { border: 0; background: none; padding: 6px 10px; cursor: pointer; color: var(--muted); }
.live-view-switch button.on { color: var(--ink); background: #f0ece2; }
.live-view-switch label { padding: 0 10px 0 6px; display: flex; gap: 4px; align-items: center; border-left: 1px solid var(--line); cursor: pointer; }
