/* The /games pages: game frame, overlay cards, score tiles, share box, game cards on /games.
   Uses the site.css tokens (--navy, --red, --gold, --paper ...), so it follows the site theme.
   Loaded only by games.html and games/*.html; site.css stays untouched. */

/* ---------- game frame ---------- */
.game { position: relative; max-width: 480px; margin: 0 auto; scroll-margin-top: 90px; }
.game__stage { position: relative; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); background: var(--navy-deep); }
.game canvas { display: block; width: 100%; height: auto; aspect-ratio: 480 / 720; outline: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.game canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--gold-soft); }
#fraud-game canvas { aspect-ratio: 480 / 600; }
.game.game--house { max-width: 640px; }
.game--house canvas { aspect-ratio: 640 / 480; }
.game__bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: .9rem; }
.game__bar .btn { white-space: nowrap; }
.game__pad { display: none; gap: 8px; margin-top: 10px; }
@media (pointer: coarse) { .game__pad { display: flex; } .game__keys { display: none; } }
.pad { flex: 1; min-height: 58px; border: 0; border-radius: 6px; background: var(--navy); color: #fff; font: 600 1.4rem var(--head);
  cursor: pointer; touch-action: none; -webkit-user-select: none; user-select: none; }
.pad:active { background: var(--red); }
.pad--wide { flex: 1.6; font-size: 1.1rem; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- overlay cards (title, pause, results) ---------- */
.tg-over { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 14px; overflow-y: auto;
  background: rgba(20, 34, 58, .72); -webkit-overflow-scrolling: touch; z-index: 5; }
.tg-over[hidden] { display: none; }
.tg-card { margin: auto; background: var(--paper); border-radius: 6px; padding: 18px 18px 14px; max-width: 440px; width: 100%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .3); }
.tg-card h2 { font-size: clamp(1.35rem, 5vw, 1.8rem); margin-bottom: .35em; }
.tg-card h2::after { display: none !important; }
.tg-card p { margin: 0 0 .7em; font-size: .95rem; line-height: 1.5; }
.tg-kicker { font-family: var(--head); text-transform: uppercase; letter-spacing: .08em; color: var(--red); font-weight: 600; font-size: .85rem !important; margin-bottom: .2em !important; }
.tg-keys, .tg-small, .tg-card .tg-small { color: var(--muted); font-size: .84rem !important; }
.tg-keys kbd { display: inline-block; min-width: 1.6em; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 3px;
  border-radius: 4px; background: #fff; font: 600 .8rem var(--font); text-align: center; }
.tg-score { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 6px; margin: 4px 0 12px; }
.tg-score div { background: var(--navy); color: #d9dfe8; border-radius: 4px; padding: 6px 4px; text-align: center; font-size: .72rem; line-height: 1.2; }
.tg-score span { display: block; font: 700 1.35rem var(--head); color: #fff; }
.tg-big { font-family: var(--head); font-size: 1.2rem !important; color: var(--navy); line-height: 1.25 !important; }
.tg-big strong { color: var(--red); }
.tg-fix { background: #fbf3dc; border: 1px solid #e7d19a; border-left: 5px solid var(--gold); border-radius: 4px; padding: 8px 10px; font-size: .88rem !important; }
.tg-card .btn-row { gap: 8px; margin-top: 10px; }
.tg-card a:focus-visible, .tg-card .btn:focus-visible, .game .btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Beat the Tolls: route picker and cost table */
.tg-routes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 12px; }
.tg-route { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 4px; padding: 6px 8px; cursor: pointer; font: inherit; line-height: 1.25; }
.tg-route strong { display: block; font-family: var(--head); font-size: .92rem; font-weight: 600; color: var(--navy); }
.tg-route span { color: var(--muted); font-size: .76rem; }
.tg-route.is-on { border-color: var(--red); background: #fbeeee; box-shadow: inset 0 0 0 1px var(--red); }
.tg-cost { width: 100%; border-collapse: collapse; margin: 6px 0 4px; font-size: .86rem; }
.tg-cost caption { text-align: left; font: 600 .9rem var(--head); color: var(--navy); text-transform: uppercase; margin-bottom: 4px; }
.tg-cost th, .tg-cost td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.tg-cost th:first-child { text-align: left; }
.tg-cost thead th { font-size: .76rem; color: var(--muted); font-weight: 600; }
.tg-cost td:last-child { color: var(--red); font-weight: 700; }

/* Follow the Money: case cards */
.fg-amt { font: 700 2rem/1 var(--head) !important; color: var(--red); margin: .1em 0 .2em !important; }
.fg-amt--clean { color: #2e6b3f; }
.fg-who { font-size: .85rem !important; color: var(--muted); }
.fg-out { font-size: .9rem !important; }
.fg-top { margin: 0 0 12px; padding-left: 20px; font-size: .88rem; }

/* ---------- share ---------- */
.share-box { margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); }
.share-box label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
.share-box textarea { width: 100%; font: .88rem/1.4 var(--font); padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; resize: none; }
.share-box__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }
.share-box__ok { font-size: .85rem; color: #2e6b3f; font-weight: 600; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 12px 0 0; }
.share-row__label { font: 600 .85rem var(--head); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 4px; }

.srcline { max-width: 640px; margin: 14px auto 0; font-size: .86rem; color: var(--muted); border-left: 3px solid var(--gold-soft); padding: 4px 0 4px 10px; }
.game-note { max-width: 760px; margin: 0 auto; }
.game-note h3 { margin-top: 1.4em; }
.game-note .src { font-size: .88rem; color: var(--muted); }
.scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.facts { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--paper); }
table.facts th, table.facts td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
table.facts thead th { font-family: var(--head); text-transform: uppercase; letter-spacing: .04em; font-size: .82rem; color: var(--navy); }
table.facts td.num { text-align: right; white-space: nowrap; }
table.facts td:first-child { white-space: nowrap; font-weight: 700; color: var(--red-dark); }
.games-disclosure { max-width: 760px; margin: 0 auto; font-size: .86rem; color: var(--muted); text-align: center; }

/* ---------- full screen ---------- */
.game:fullscreen, .game.game--full { max-width: none; width: 100vw; height: 100vh; margin: 0; padding: 12px; background: var(--navy-deep);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.game.game--full { position: fixed; inset: 0; z-index: 99999; height: 100dvh; }
html.has-game-full, html.has-game-full body { overflow: hidden; overscroll-behavior: none; }
.game:fullscreen .game__stage, .game.game--full .game__stage { height: calc(100% - 84px); width: auto; aspect-ratio: 480 / 720; max-width: 100%; }
#fraud-game:fullscreen .game__stage, #fraud-game.game--full .game__stage { aspect-ratio: 480 / 600; }
.game--house:fullscreen .game__stage, .game--house.game--full .game__stage { aspect-ratio: 640 / 480; height: auto; width: min(100%, calc((100dvh - 90px) * 4 / 3)); }
.game:fullscreen canvas, .game.game--full canvas { width: 100%; height: 100%; }
.game:fullscreen .game__bar, .game.game--full .game__bar { width: min(100%, 520px); color: #d9dfe8; margin: 0; justify-content: center; }
.game:fullscreen .game__bar .btn--outline, .game.game--full .game__bar .btn--outline { color: #fff; border-color: rgba(255, 255, 255, .5); }
.game:fullscreen .game__keys, .game.game--full .game__keys { display: none; }
.game:fullscreen .game__pad, .game.game--full .game__pad { width: min(100%, 520px); margin: 0; }
.game__offer { display: none; }
@media (pointer: coarse) {
  .game__offer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; padding: 10px 12px;
    background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 4px; font-size: .9rem; }
}
.game:fullscreen .game__offer, .game.game--full .game__offer { display: none; }
.game__exit { display: none; }
.game:fullscreen .game__exit, .game.game--full .game__exit { display: block; position: absolute; top: 8px; right: 8px; z-index: 9; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: rgba(20, 34, 58, .85); color: #fff; font-size: 1.3rem; cursor: pointer; }

/* ---------- /games: game cards ---------- */
.gcards { gap: 26px; }
.gcard { display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform .15s ease; }
.gcard:hover, .gcard:focus-visible { transform: translateY(-3px); }
.gcard:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.gcard__img { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--navy-deep); }
.gcard__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gcard__body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px 18px 18px; flex: 1; }
.gcard__title { font: 700 1.5rem/1.05 var(--head); text-transform: uppercase; color: var(--navy); }
.gcard__where { font: 600 .78rem var(--head); text-transform: uppercase; letter-spacing: .06em; color: var(--red); }
.gcard__blurb { font-size: .96rem; line-height: 1.5; color: var(--muted); }
.gcard .btn { margin-top: auto; }

@media (max-width: 480px) {
  .tg-over { padding: 8px; }
  .tg-card { padding: 12px 12px 10px; }
  .tg-card p { font-size: .84rem; line-height: 1.4; margin-bottom: .5em; }
  .tg-routes { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .gcard { transition: none; } }
