:root {
  --bg: #000; --card: #0d1320; --card2: #121b2c; --line: #1d2a42; --text: #f3f6fb; --soft: #9fb3d4;
  --acc: #3ba4ff; --ok: #2fbf71; --bad: #e0564a; --warn: #f0b429;
  --ocean: #000; --land: #6b2620; --visited: #2fbf71; --bucket: #f0b429; --border: #000;
}
html.light { --bg: #f4f7fc; --card: #fff; --card2: #eef3fb; --line: #d5e0f0; --text: #0c1626; --soft: #4a6285; --ocean: #dceafb; --border: #f4f7fc; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
body { display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
button { font: inherit; border: 0; border-radius: 10px; padding: 9px 14px; background: var(--acc); color: #fff; cursor: pointer; }
button.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--card2); color: var(--text); }
label { display: block; font-size: 13px; color: var(--soft); margin: 10px 0 4px; }
.top { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; }
.tabs a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; white-space: nowrap; user-select: none; }
.tabs a.on { background: var(--acc); border-color: var(--acc); color: #fff; }
main { flex: 1; min-height: 0; position: relative; }
.view { display: none; height: 100%; overflow-y: auto; }
.view.on { display: block; }
#v-map.on { display: flex; flex-direction: column; overflow: hidden; }
.statbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.statbar div { background: var(--bg); text-align: center; padding: 7px 4px; }
.statbar b { display: block; font-size: 18px; }
.statbar span { font-size: 12px; color: var(--soft); }
.mapwrap { flex: 1; position: relative; min-height: 0; touch-action: none; }
#map { width: 100%; height: 100%; display: block; cursor: grab; background: var(--ocean); }
.mapbtns { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.mapbtns button { width: 38px; height: 38px; padding: 0; background: var(--card); color: var(--text); border: 1px solid var(--line); font-size: 18px; }
.fab { position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); padding: 12px 18px; border-radius: 999px; box-shadow: 0 4px 18px rgba(0,0,0,.45); }
.wrap { max-width: 820px; margin: 0 auto; padding: 16px 14px 90px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.card h2 { margin: 0 0 8px; font-size: 17px; }
.soft { color: var(--soft); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 120px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--card2); border-radius: 12px; padding: 12px; }
.tile b { display: block; font-size: 22px; }
.tile span { color: var(--soft); font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.chips a.on { background: var(--acc); border-color: var(--acc); color: #fff; }
.flight { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.flight:last-child { border-bottom: 0; }
.flight .route { font-weight: 700; font-size: 17px; min-width: 112px; }
.flight .meta { flex: 1; color: var(--soft); font-size: 13px; }
.flight .km { text-align: right; font-size: 13px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); color: var(--soft); margin-left: 6px; }
.year { margin: 18px 0 6px; font-weight: 700; color: var(--soft); }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet.hidden { display: none; }
.sheet .in { background: var(--card); border: 1px solid var(--line); border-radius: 18px 18px 0 0; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet .in { border-radius: 18px; } }
.sheet h2 { margin: 0 0 6px; }
.sug { border: 1px solid var(--line); border-radius: 9px; margin-top: 4px; overflow: hidden; }
.sug div { padding: 8px 11px; cursor: pointer; border-bottom: 1px solid var(--line); }
.sug div:last-child { border-bottom: 0; }
.sug div:hover, .sug div.on { background: var(--card2); }
.sug b { margin-right: 8px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg a { flex: 1; text-align: center; padding: 8px 6px; cursor: pointer; font-size: 14px; }
.seg a.on { background: var(--acc); color: #fff; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom)); background: var(--card); border: 1px solid var(--acc); padding: 10px 16px; border-radius: 12px; z-index: 30; max-width: 90vw; }
.toast.hidden { display: none; }
.fact { background: var(--card2); border-left: 3px solid var(--acc); padding: 10px 12px; border-radius: 8px; margin: 10px 0; }
.empty { text-align: center; padding: 40px 10px; color: var(--soft); }
@media (max-width: 560px) { .statbar b { font-size: 15px; } .statbar span { font-size: 11px; } .brand span { display: none; } }

/* stats extras (more.js) */
h3.sec { font-size: 14px; margin: 16px 0 6px; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; }
.bar { display: grid; grid-template-columns: 52px 1fr 44px; gap: 8px; align-items: center; margin: 4px 0; font-size: 13.5px; }
.bar.wide { grid-template-columns: 120px 1fr 64px; }
.bar i, .ach i { display: block; height: 8px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); overflow: hidden; }
.bar em, .ach em { display: block; height: 100%; border-radius: 999px; background: var(--acc); }
.bar b { text-align: right; font-weight: 600; }
.yrow { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.nav, .ff, .ach { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.card h2 + .nav, .card h2 + .ff { border-top: 0; }
.nav { cursor: pointer; } .nav > div, .ff > div, .ach > div { flex: 1; min-width: 0; }
.ic { font-size: 20px; width: 28px; text-align: center; flex: none; }
.chev { color: var(--soft); font-size: 20px; } .tag.pro { color: var(--warn); border-color: var(--warn); }
.ff b { font-size: 17px; } .ach i { margin-top: 5px; } .ach.done em { background: var(--ok); } .ach .val { font-size: 13px; color: var(--soft); white-space: nowrap; }
.pic canvas { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); display: block; }

/* games (games.js) */
.bigflag { font-size: 84px; text-align: center; line-height: 1.2; } h3.q { text-align: center; font-size: 19px; margin: 8px 0 12px; }
.opts { display: grid; gap: 8px; } .opt { text-align: left; padding: 12px 14px; } .opt.right { background: var(--ok); color: #fff; opacity: 1; } .opt.wrong { background: var(--bad); color: #fff; opacity: 1; }
.pair { display: flex; align-items: center; gap: 10px; margin: 10px 0; } .apt { flex: 1; background: var(--card2); border-radius: 12px; padding: 12px; text-align: center; } .apt b { font-size: 24px; display: block; }
input[type=range] { padding: 0; accent-color: var(--acc); }
input[type=range] { -webkit-appearance: none; appearance: none; height: 8px; border-radius: 999px; background: var(--line); border: 0; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--acc); border: 2px solid #fff; cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--acc); border: 2px solid #fff; cursor: pointer; }

/* cities and journeys (cities.js) */
.tick { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 15px; margin: 6px 0; } .tick input { width: auto; }
.crow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
button.small { padding: 4px 10px; font-size: 13px; }

/* Play all (play.js) */
.playhud { position: absolute; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; justify-content: center; pointer-events: none; z-index: 5; }
.playhud.hidden { display: none; } .ph { pointer-events: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; min-width: min(420px, 100%); box-shadow: 0 6px 24px rgba(0,0,0,.45); }
.ph b { font-size: 18px; } .phrow { display: flex; align-items: center; gap: 10px; margin-top: 6px; } .phrow span { font-weight: 600; } .phrow span:nth-child(2) { flex: 1; }
body.playing .fab, body.playing .mapbtns { display: none; }
.nav.sel b { color: var(--acc); } .pic.small canvas { max-height: 46vh; width: auto; margin: 10px auto; }

/* boarding pass (pass.js) */
.bpvid { width: 100%; max-height: 360px; border-radius: 18px; background: #000; object-fit: cover; display: block; margin-bottom: 8px; }

/* ticket import (tickets.js) */
.card2 { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.trow { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); } .trow > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.trow.fl { cursor: pointer; margin: 0; font-size: 15px; color: var(--text); } .trow.fl input { width: auto; margin-top: 4px; } .trow.off { opacity: .6; }
.okline { color: var(--ok); } .warnline { color: var(--warn); } .badline { color: var(--bad); } .trow .soft, .trow .warnline, .trow .okline { font-size: 13px; }
.row.sticky { position: sticky; bottom: -18px; background: var(--card); padding: 10px 0; }
.v .row { flex-wrap: wrap; }

/* right-to-left languages */
[dir=rtl] .opt, [dir=rtl] .trow, [dir=rtl] .nav { text-align: right; } [dir=rtl] .fact { border-left: 0; border-right: 3px solid var(--acc); } [dir=rtl] .tag { margin-left: 0; margin-right: 6px; }
[dir=rtl] .mapwrap, [dir=rtl] canvas { direction: ltr; }

/* scroll bars in the app's own colours (no grey) */
html { scrollbar-color: #2b4a73 transparent; } ::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: #2b4a73; border-radius: 999px; }

/* Groups */ .card > .nav:first-child, .card > .ff:first-child { border-top: 0; } details > summary { list-style: none; cursor: pointer; } details > summary::-webkit-details-marker { display: none; }
