/* Training (client/grounds.ts, client/duels.ts; Battle > Training). The page fills the window as the Arena does: a banner
   with the two sides standing across the field and the one big button between them, then three cards. Spar, Cup drill
   and Duels share the pieces. Nothing scrolls: long lists page (data-fit), short windows and phones take the banner and
   the cards in turn (Match / Result). Colours on the banner are the Arena banner's own. */
.page[data-view="training"]:has(.tg) .page-inner { height: 100%; box-sizing: border-box; display: flex; flex-direction: column; padding-bottom: 14px; }
.page[data-view="training"]:has(.tg) #pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.page[data-view="training"]:has(.tg) #pane > div { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.tg { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.tg > .psec-tabs { margin-bottom: -4px; flex: none; }
.tg > .psec.on:has(> .tg-hero) { display: contents; }

/* ---- the banner ---- */
.tg-hero { position: relative; flex: 1 1 250px; min-height: 0; max-height: 400px; container-type: size; isolation: isolate; overflow: hidden; border-radius: 4px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, 230px) minmax(0, 1fr); align-items: stretch; gap: 18px; padding: 16px 20px; box-sizing: border-box; color: #f4ead2;
  box-shadow: 0 0 0 1px var(--edge), 0 0 0 3px var(--gilt-lo), 0 0 0 4px var(--edge), 0 12px 26px rgba(0, 0, 0, .45); }
.tg-hero::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(18, 11, 5, .82) 0%, rgba(18, 11, 5, .3) 30%, rgba(18, 11, 5, 0) 48%, rgba(18, 11, 5, 0) 74%, rgba(18, 11, 5, .55) 100%),
    radial-gradient(60% 90% at 50% 50%, rgba(18, 11, 5, .45), rgba(18, 11, 5, 0) 70%); }
.tg-side { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "plate power" "team team"; gap: 8px 12px; min-width: 0; min-height: 0; text-shadow: 0 1px 2px rgba(0, 0, 0, .85); }
.tg-them { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "power plate" "team team"; }
.tg-plate { grid-area: plate; align-self: start; display: grid; justify-items: start; gap: 4px; min-width: 0; }
.tg-them .tg-plate { justify-items: end; text-align: right; }
.tg-plate small { font: 700 11px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: #e8cf94; white-space: nowrap; }
.tg-plate b { max-width: 100%; font: italic 700 26px/1.05 var(--display); color: #fff3d6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-plate i { font: 500 12.5px/1.2 var(--sans); font-style: normal; color: #d9c8a2; white-space: nowrap; }
.tg-side .ra-power { grid-area: power; align-self: start; padding: 5px 14px 6px; }
.tg-side .ra-power b { font-size: 26px; }
.tg-side .ra-power small { font-size: 10px; }
.tg-side .ra-team { grid-area: team; align-self: end; padding-bottom: 2cqh; }
.tg-side .ra-mon { --h: min(46cqh, 150px, calc(118cqw / var(--n, 4))); }
.tg-them .ra-mon img { transform: scaleX(-1); }
[data-theme="codex"] .tg-change { height: 26px; min-height: 26px; margin-top: 2px; padding: 0 12px; border: 1px solid rgba(232, 207, 148, .55); border-radius: 3px; background: rgba(18, 11, 5, .62); color: #f6d987;
  font: 700 12px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
[data-theme="codex"] .tg-change:hover { border-color: #f6d987; background: rgba(40, 26, 12, .8); }

/* The plaque between the sides: the rules and the one button. */
.tg-mid { align-self: center; display: grid; gap: 7px; justify-items: stretch; text-align: center; padding: 12px 12px 10px; border-radius: 4px;
  background: rgba(18, 11, 5, .74); box-shadow: inset 0 0 0 1px rgba(232, 207, 148, .34), 0 8px 20px rgba(0, 0, 0, .4); }
.tg-rules { display: grid; gap: 4px; text-align: left; min-width: 0; }
.tg-rules > span { font: 700 10.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: #bfa979; }
.tg-rules select { width: 100%; min-width: 0; }
.tg-rline { font: 500 12px/1.3 var(--sans); color: #d9c8a2; }
[data-theme="codex"] .tg-go { height: 52px; min-height: 52px; margin-top: 2px; padding: 0 18px; border: 0; border-radius: 3px; font: 700 17px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: #fbeed2;
  background: linear-gradient(180deg, #a83325, #6e1d14); box-shadow: inset 0 1px 0 rgba(255, 220, 180, .35), 0 0 0 1px var(--edge), 0 0 0 3px var(--gilt), 0 0 0 4px var(--edge), 0 8px 18px rgba(0, 0, 0, .5);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; }
[data-theme="codex"] .tg-go:hover { background: linear-gradient(180deg, #bb3c2c, #7c2217); }
[data-theme="codex"] .tg-go:disabled { opacity: 1; filter: none; color: #b9ab8c; background: linear-gradient(180deg, #3a2a1a, #21160c); cursor: default; }
.tg-note { min-height: 15px; font: 600 12px/1.25 var(--sans); color: #e8dcc0; }
.tg-note.warn { color: #ffb9a6; }
.tg-note .good-text { color: #9be38a; } .tg-note .bad-text { color: #ff9a86; }

/* ---- the cards ---- */
.tg-row { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.tg > .psec.on:has(> .tg-row) { display: contents; }
.tg-card { min-height: 0; }
.tg-hint { margin: 0; font: italic 600 15.5px/1.3 var(--display); color: var(--ink); }
.tg-fine { margin: 0; font-size: 12px; line-height: 1.35; color: var(--muted); }
.tg-card.none { justify-content: flex-start; }
.tg-card.none .tg-fine { margin-top: auto; }
.tg-mons { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.tg-mons li { display: flex; align-items: center; gap: 8px; min-height: 27px; min-width: 0; font-size: 13px; }
.tg-mons li + li { border-top: 1px solid var(--rule-soft, var(--rule)); }
.tg-mons img { flex: none; width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.tg-mons b { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-mons em { flex: none; min-width: 3.9em; text-align: right; font: 600 12px/1 var(--sans); font-style: normal; color: var(--muted); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.tg-mons em.bad { color: var(--bad); font-weight: 700; }
.tg-mons li.out b, .tg-mons li.out img { opacity: .5; }
.tg-mons em.tg-out { min-width: 0; font-style: italic; }
.tg-bar { flex: none; display: block; width: 72px; height: 7px; border-radius: 2px; overflow: hidden; background: rgba(0, 0, 0, .22); box-shadow: inset 0 0 0 1px var(--rule); }
.tg-bar i { display: block; height: 100%; background: linear-gradient(180deg, #e2b84e, #b07f1c); }
.tg-theirs .tg-bar i { background: linear-gradient(180deg, #c8553f, #8a2a1c); }
.tg-syn { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.tg-syn .syn-chips { margin: 0; flex-wrap: nowrap; }
.tg-foe { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 32px; }
.tg-foe b { font: italic 700 17px/1 var(--display); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-foe .muted { font-size: 12px; white-space: nowrap; }
.tg-carry { font-size: 12.5px; color: var(--muted); }
.tg-carry b { color: var(--ink); }
.tg-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
[data-theme="codex"] .tg-rank button { width: 100%; display: grid; grid-template-columns: 16px minmax(0, 1fr) 84px 3.2em; align-items: center; gap: 8px; min-height: 28px; padding: 0 8px; border: 1px solid var(--rule-soft, var(--rule)); border-radius: 2px;
  background: var(--inlay); color: var(--ink); font: 600 13px/1 var(--sans); text-align: left; cursor: pointer; }
[data-theme="codex"] .tg-rank button:hover { border-color: var(--gilt-lo); background: var(--inlay-hi); }
.tg-rank li.on button { border-color: var(--rg-ink); box-shadow: inset 0 0 0 1px var(--rg-ink); }
.tg-rank button > i { font-style: normal; color: var(--muted); font-size: 12px; }
.tg-rank button > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-rank button > em { font-style: normal; text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.tg-rank .tg-bar { width: 100%; }

/* The result: the count, big, and what it means. */
.tg-score { display: flex; align-items: flex-end; gap: 10px; min-width: 0; }
.tg-score > b { font: italic 700 58px/.82 var(--display); color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.tg-score > span { display: grid; gap: 2px; font: 600 15px/1 var(--sans); color: var(--ink); white-space: nowrap; }
.tg-score > span small { font: 700 10.5px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tg-score > em { margin-left: auto; font: italic 700 19px/1.05 var(--display); text-align: right; }
.tg-res.good .tg-score > b, .tg-res.good .tg-score > em { color: var(--good); }
.tg-res.bad .tg-score > b, .tg-res.bad .tg-score > em { color: var(--bad); }
.tg-meter { height: 10px; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, var(--bad) 55%, transparent); box-shadow: inset 0 0 0 1px var(--rule); }
.tg-meter i { display: block; height: 100%; background: color-mix(in srgb, var(--good) 88%, #000); box-shadow: 1px 0 0 var(--edge); }
.tg-watch { gap: 8px; }
.tg-watch .tg-s, .tg-card .ra-h .tg-s { display: none; }
.tg-card .ra-h .btn { white-space: nowrap; flex: none; }
.tg-notes { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 0; }
.tg-notes li { display: grid; grid-template-columns: 6.2em minmax(0, 1fr) auto; align-items: baseline; gap: 8px; min-height: 25px; padding-top: 5px; font-size: 13px; }
.tg-notes li + li { border-top: 1px solid var(--rule-soft, var(--rule)); }
.tg-notes small { font: 700 10.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.tg-notes b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-notes span { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
/* The team switch under the banner: phones and short windows only (elsewhere it is in the Your side card). */
.tg-teams { display: none; flex: none; align-items: center; gap: 8px; min-width: 0; }
.tg-teams .ra-chips { flex: 1 1 auto; min-width: 0; }
.tg-teams .btn { flex: none; }
.tg > .psec.on:has(> .tg-teams) { display: contents; }
.tg-card .ra-acts .btn { flex: none; white-space: nowrap; }

/* ---- the opponent picker ---- */
.tg.picking .tg-hero { flex: 0 0 clamp(150px, 27vh, 230px); }
.tg.picking:has(.tg-mk.editing) .tg-hero { display: none; }
.tg-picker:has(.tg-mk.editing) .tg-ph [data-act="tg-pick-x"] { display: none; }
.tg-picker { flex: 1 0 auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; margin: 0; min-width: 0; }
.tg-ph { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.tg-ph h4 { margin: 0; font: 700 12px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--rg-ink, var(--accent)); white-space: nowrap; }
.tg-ph .tg-rules { display: flex; align-items: center; gap: 8px; }
.tg-ph .tg-rules > span { color: var(--muted); }
.tg-ptabs .tg-s { display: none; }
.tg-opps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 7px; }
[data-theme="codex"] .tg-opp { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 5px 10px; border: 1px solid var(--rule); border-radius: 3px; background: var(--inlay); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; min-width: 0; }
[data-theme="codex"] .tg-opp:hover { border-color: var(--gilt-lo); background: var(--inlay-hi); }
[data-theme="codex"] .tg-opp.on { border-color: var(--rg-ink); box-shadow: inset 0 0 0 1px var(--rg-ink); }
[data-theme="codex"] .tg-opp.lock { cursor: help; }
.tg-opp.lock > * { opacity: .45; }
.tg-on { flex: 1 1 auto; display: grid; gap: 2px; min-width: 0; }
.tg-on b { font: 700 14px/1.15 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-on small { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-faces { flex: none; display: flex; }
.tg-faces img { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.tg-faces img + img { margin-left: -5px; }
.tg-opp > em { flex: none; font-style: normal; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tg-opp > em:empty { display: none; }
.tg-opp > em b { color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }

/* The made-up team: slots, then (editing one) the creature list. */
.tg-mk { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tg-made { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
[data-theme="codex"] .tg-slot { display: grid; justify-items: center; align-content: center; gap: 3px; min-width: 0; min-height: 104px; padding: 8px 4px; border: 1px solid var(--rule); border-radius: 3px; background: var(--inlay); color: var(--ink); font: inherit; cursor: pointer; }
[data-theme="codex"] .tg-slot:hover:not(:disabled) { border-color: var(--gilt-lo); background: var(--inlay-hi); }
[data-theme="codex"] .tg-slot.on { border-color: var(--rg-ink); box-shadow: inset 0 0 0 1px var(--rg-ink); }
[data-theme="codex"] .tg-slot.empty { border-style: dashed; color: var(--muted); background: none; }
[data-theme="codex"] .tg-slot:disabled { opacity: .45; cursor: default; }
.tg-slot img { width: 48px; height: 48px; object-fit: contain; image-rendering: pixelated; }
.tg-slot > b { max-width: 100%; font: 700 13px/1.15 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-slot > span { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.tg-slot > span i { font-style: normal; font-weight: 700; }
.tg-slot .aura-tag { color: var(--gold); }
.tg-slot.empty > i { font: 700 24px/1 var(--sans); font-style: normal; }
.tg-mk.editing .tg-slot { min-height: 44px; grid-auto-flow: column; justify-content: center; align-items: center; gap: 6px; padding: 3px 6px; }
.tg-mk.editing .tg-slot img { width: 30px; height: 30px; }
.tg-mk.editing .tg-slot > span { display: none; }
.tg-mk.editing .tg-slot.empty > i { font-size: 16px; }
.tg-mk-foot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tg-mk-foot .muted { font-size: 12.5px; }
.tg-mk-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.tg-mk-tools input[type="search"] { flex: 1 1 130px; min-width: 100px; max-width: 220px; }
.tg-mk-tools > select { flex: 0 1 140px; min-width: 0; }
.tg-grades button { min-width: 30px; padding: 0 7px; }
.tg-stars, .tg-aura { display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px/1 var(--sans); color: var(--ink); white-space: nowrap; }
.tg-species { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 6px; }
[data-theme="codex"] .tg-species button { width: 100%; display: grid; justify-items: center; gap: 2px; min-width: 0; padding: 5px 3px; border: 1px solid var(--rule-soft, var(--rule)); border-radius: 3px; background: var(--inlay); color: var(--ink); font: 600 11.5px/1.15 var(--sans); cursor: pointer; }
[data-theme="codex"] .tg-species button:hover { border-color: var(--gilt-lo); background: var(--inlay-hi); }
[data-theme="codex"] .tg-species button.on { border-color: var(--rg-ink); box-shadow: inset 0 0 0 1px var(--rg-ink); }
.tg-species button.lock { opacity: .4; cursor: help; }
.tg-species img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.tg-species b { max-width: 100%; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-species .hint { grid-column: 1 / -1; }

/* ---- cup drill: two sixes, a ban on each ---- */
.tg-cup { flex-basis: 300px; max-height: 440px; }
.tg-cup .tg-side, .tg-cup .tg-them { grid-template-columns: minmax(0, 1fr); grid-template-areas: "plate" "team"; }
.tg-cup .tg-plate { display: flex; align-items: baseline; gap: 10px; }
.tg-cup .tg-them .tg-plate { justify-content: flex-end; }
.tg-cup .tg-plate .tg-change { margin: 0 0 0 4px; align-self: center; }
.tg-cup .tg-plate .tg-vsel { width: auto; min-width: 0; max-width: 100%; align-self: center; }
.tg-plate .tg-cap { flex: 0 1 auto; min-width: 0; font: italic 600 13px/1 var(--display); color: #e8dcc0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-cup .tg-plate > b, .tg-cup .tg-plate > small, .tg-cup .tg-plate > .tg-change, .tg-cup .tg-plate > .tg-vsel { flex: none; }
.tg-picker:has(> .tg-mk:not(.editing)) { flex: none; }
.tg-crow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tg-cupmade .tg-ph .tg-vsel { width: auto; }
.tg-sixes { grid-area: team; align-self: end; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; min-width: 0; }
[data-theme="codex"] .tg-six { position: relative; display: grid; justify-items: center; align-content: end; gap: 1px; min-width: 0; padding: 12px 4px 5px; border: 0; border-radius: 3px; color: #f4ead2; font: inherit;
  background: rgba(18, 11, 5, .56); box-shadow: inset 0 0 0 1px rgba(232, 207, 148, .26); text-shadow: 0 1px 2px rgba(0, 0, 0, .85); }
[data-theme="codex"] button.tg-six { cursor: pointer; }
[data-theme="codex"] button.tg-six:disabled { opacity: 1; filter: none; cursor: default; }
[data-theme="codex"] button.tg-six:hover:not(:disabled) { box-shadow: inset 0 0 0 1px #f6d987; background: rgba(40, 26, 12, .7); }
.tg-six .ra-mon { --h: min(19cqh, 72px); margin: 0; }
.tg-six > b { max-width: 100%; font: 600 12px/1.2 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-six > em { min-height: 16px; font: 700 15px/1.05 var(--sans); font-style: normal; color: #fff3d6; font-variant-numeric: lining-nums tabular-nums; cursor: help; }
.tg-six > em.good { color: #9be38a; } .tg-six > em.bad { color: #ff9a86; }
.tg-tag { position: absolute; top: -1px; left: 50%; transform: translateX(-50%); padding: 2px 7px 3px; border-radius: 0 0 3px 3px; font: 700 9.5px/1 var(--sans); font-style: normal; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; text-shadow: none; }
.tg-tag.best { background: #3d7a33; color: #f0ffe6; }
.tg-tag.fear { background: #9a2f22; color: #ffeee6; }
[data-theme="codex"] .tg-six.fear { box-shadow: inset 0 0 0 1px rgba(255, 154, 134, .75); }
[data-theme="codex"] .tg-six.ban { box-shadow: inset 0 0 0 2px #d0503c; background: rgba(60, 14, 8, .62); }
.tg-six.ban .ra-mon img { filter: grayscale(.9) brightness(.6); }
.tg-x { position: absolute; left: 50%; top: 12px; width: min(19cqh, 72px); height: min(19cqh, 72px); transform: translateX(-50%); pointer-events: none;
  background: linear-gradient(45deg, transparent 46%, #e0563f 46%, #e0563f 54%, transparent 54%), linear-gradient(-45deg, transparent 46%, #e0563f 46%, #e0563f 54%, transparent 54%); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .7)); }
.tg-cmid { align-self: center; }
.tg-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.tg-lines li { display: grid; grid-template-columns: 3.3em minmax(0, 1fr); align-items: baseline; gap: 8px; font-size: 13px; line-height: 1.3; color: var(--ink); }
.tg-lines li > b { font: italic 700 24px/1 var(--display); text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.tg-lines li.good > b { color: var(--good); } .tg-lines li.bad > b { color: var(--bad); }
.tg-lines li i { font-style: normal; font-weight: 700; }
.tg-vs .tg-rules > span { color: var(--muted); }
.tg-g { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
[data-theme="codex"] .tg-g button { width: 100%; display: grid; grid-template-columns: 4.6em 3.2em minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 32px; padding: 0 10px; border: 1px solid var(--rule-soft, var(--rule)); border-left: 4px solid var(--good); border-radius: 2px;
  background: var(--inlay); color: var(--ink); font: 600 13px/1 var(--sans); text-align: left; cursor: pointer; }
[data-theme="codex"] .tg-g li.loss button { border-left-color: var(--bad); }
[data-theme="codex"] .tg-g button:hover { background: var(--inlay-hi); }
.tg-g button i { font-style: normal; color: var(--muted); }
.tg-g li.win b { color: var(--good); } .tg-g li.loss b { color: var(--bad); }
.tg-g button em { font-style: normal; color: var(--rg-ink, var(--accent)); font-weight: 700; }

/* ---- duels ---- */
.tg-hero.tg-dhero { flex: 0 0 clamp(120px, 24vh, 210px); grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: stretch; }
.tg-dhero::after { background: linear-gradient(90deg, rgba(18, 11, 5, .9) 0%, rgba(18, 11, 5, .6) 34%, rgba(18, 11, 5, 0) 62%), linear-gradient(180deg, rgba(18, 11, 5, 0) 60%, rgba(18, 11, 5, .5) 100%); }
.tg-dtext { align-self: center; display: grid; gap: 6px; min-width: 0; text-shadow: 0 1px 2px rgba(0, 0, 0, .85); }
.tg-dtext small { font: 700 11px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: #e8cf94; }
.tg-dtext b { font: italic 700 32px/1 var(--display); color: #fff3d6; }
.tg-dtext span { max-width: 34em; font: 500 13.5px/1.35 var(--sans); color: #e8dcc0; }
.tg-dhero .tg-side { grid-template-columns: minmax(0, 1fr); grid-template-areas: "team"; grid-template-rows: minmax(0, 1fr); }
.tg-dhero .ra-mon { --h: min(78cqh, 150px, calc(118cqw / var(--n, 4))); }
.tg-drow { flex: 1 1 auto; align-items: start; }
.tg-fl { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.tg-fl > li { display: flex; align-items: center; gap: 9px; min-height: 44px; min-width: 0; padding: 3px 8px; border-radius: 3px; background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft, var(--rule)); }
.tg-fl > li:not(.on):not(.in):not(.win):not(.loss):not(.held) .tg-on b { color: var(--muted); }
.tg-fl > li.in { box-shadow: inset 0 0 0 1px var(--rg-ink), inset 3px 0 0 var(--rg-ink); }
.tg-fl .gdot { display: inline-block; }
.tg-dl > li { padding-left: 0; border-left: 4px solid var(--good); }
.tg-dl > li.loss { border-left-color: var(--bad); }
.tg-dl > li.held { border-left-color: var(--gilt); }
[data-theme="codex"] .tg-dm { flex: 1 1 auto; display: grid; grid-template-columns: 3em minmax(0, 1fr) auto auto; align-items: baseline; gap: 8px; min-width: 0; min-height: 38px; padding: 0 0 0 10px; border: 0; background: none; color: var(--ink); font: 600 13px/1 var(--sans); text-align: left; cursor: pointer; }
.tg-dm > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-dm small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tg-dm em { font-style: normal; font-weight: 700; color: var(--rg-ink, var(--accent)); }
.tg-dl li.win .tg-dm > b { color: var(--good); } .tg-dl li.loss .tg-dm > b { color: var(--bad); } .tg-dl li.held .tg-dm > b { color: var(--gold); }
.tg-watching .ar-recent > li { border-left: 4px solid var(--good); }
.tg-watching .ar-recent > li.loss { border-left-color: var(--bad); }
.tg-watching .ar-recent > li.held { border-left-color: var(--line, #8a7a55); }
.tg-watching .ar-recent .ar-m { min-height: 42px; padding: 6px 14px; }

/* ---- narrower: the side plates tighten ---- */
@media (min-width: 761px) and (max-width: 1100px) {
  .tg-hero { grid-template-columns: minmax(0, 1fr) minmax(170px, 200px) minmax(0, 1fr); gap: 12px; padding: 12px 14px; }
  .tg-plate b { font-size: 21px; }
  .tg-side .ra-power { padding: 4px 10px 5px; }
  .tg-side .ra-power b { font-size: 21px; }
  .tg-opps { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .tg-watch .tg-l { display: none; } .tg-watch .tg-s { display: inline; }
  .tg-plate .tg-cap { display: none; }
  /* Three cards in under 1100px: shorter bars and labels leave the names their room. */
  .tg-mons li { gap: 6px; }
  .tg-mons .tg-bar { width: 44px; }
  .tg-mons em { min-width: 3.3em; }
  .tg-notes li { grid-template-columns: 6em minmax(0, 1fr) auto; gap: 6px; }
  .tg-notes span { font-size: 11.5px; }
  .tg-card .ra-h .tg-l { display: none; } .tg-card .ra-h .tg-s { display: inline; }
  .tg-mine .ra-chip { padding-inline: 4px; font-size: 11.5px; }
  [data-theme="codex"] .tg-rank button { grid-template-columns: 14px minmax(0, 1fr) 44px 3em; gap: 6px; padding: 0 6px; }
  .tg-mk-tools { gap: 6px; }
  .tg-mk-tools input[type="search"] { flex-basis: 96px; min-width: 80px; }
  .tg-mk-tools > select { flex-basis: 118px; }
}
/* ---- short windows: the banner and the cards take turns (Match / Result), as on a phone ---- */
@media (min-width: 761px) and (max-height: 820px) {
  .tg { gap: 10px; }
  .tg-hero { padding: 12px 16px; flex-basis: 200px; }
  [data-theme="codex"] .tg-go { height: 46px; min-height: 46px; font-size: 15px; }
  .tg-mons li { min-height: 25px; }
  .tg-score > b { font-size: 48px; }
}
@media (min-width: 761px) and (max-height: 700px) {
  .tg-spar > .psec-tabs { display: grid; justify-content: start; grid-template-columns: repeat(var(--n), max-content); gap: 22px; margin: 0; }
  .tg-spar > .psec:not(.on) { display: none; }
  .tg-spar .tg-hero { max-height: none; }
  .tg-spar .tg-row { flex: 1 1 auto; align-items: start; }
  .tg.picking .tg-hero { display: none; }
  .tg-spar:not(.picking) .tg-teams { display: flex; }
  .tg-notes li { min-height: 22px; padding-top: 3px; }
  .tg-cupdrill > .psec-tabs { display: grid; justify-content: start; grid-template-columns: repeat(var(--n), max-content); gap: 22px; margin: 0; }
  .tg-cupdrill > .psec:not(.on) { display: none; }
  .tg-cupdrill .tg-row { flex: 1 1 auto; align-items: start; }
  .tg-cup { max-height: none; }
  .tg-six .ra-mon { --h: min(17cqh, 60px); }
  .tg-x { width: min(17cqh, 60px); height: min(17cqh, 60px); }
  [data-theme="codex"] .tg-six { padding-top: 10px; }
  .tg-hero.tg-dhero { flex-basis: 124px; padding-top: 10px; padding-bottom: 10px; }
  .tg-dtext { gap: 4px; }
  .tg-dtext b { font-size: 26px; }
  .tg-dtext span { font-size: 12.5px; }
}

/* ---- phones: one column. Yours over the plaque over theirs; the cards under Result. ---- */
@media (max-width: 760px) {
  .tg { gap: 8px; }
  .tg > .psec-tabs { margin-bottom: 0; }
  .tg-row { display: flex; flex-direction: column; gap: 8px; }
  .tg-hero { flex: 1 1 auto; max-height: none; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; padding: 10px 12px; }
  .tg-hero::after { background: linear-gradient(180deg, rgba(18, 11, 5, .8) 0%, rgba(18, 11, 5, .15) 22%, rgba(18, 11, 5, .1) 78%, rgba(18, 11, 5, .6) 100%); }
  .tg-plate b { font-size: 21px; }
  .tg-side .ra-power { position: static; padding: 3px 10px 4px; }
  .tg-side .ra-power b { font-size: 20px; }
  .tg-side .ra-power small { font-size: 9px; }
  .tg-side .ra-mon { --h: min(22cqh, 110px, calc(118cqw / var(--n, 4))); }
  .tg-mid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: 5px 10px; padding: 8px 10px; }
  .tg-mid .tg-rline, .tg-mid .tg-note { grid-column: 1 / -1; }
  .tg-mid .tg-rline { order: 3; } .tg-mid .tg-note { order: 4; min-height: 0; }
  [data-theme="codex"] .tg-go { height: 42px; min-height: 42px; margin: 0; font-size: 15px; }
  .tg-card { padding: 9px 12px; gap: 6px; flex: none; }
  .tg-mons li { min-height: 24px; }
  .tg-mons img { width: 22px; height: 22px; }
  .tg-score > b { font-size: 44px; }
  .tg-score > em { font-size: 16px; }
  .tg-spar .tg-syn, .tg-res .tg-fine { display: none; }
  .tg-spar:not(.picking) .tg-teams { display: flex; }
  .tg-teams .ra-chip .ra-cl { display: none; } .tg-teams .ra-chip .ra-cs { display: inline; }
  /* Result: the count first, then the two sides (their team switch and names are on Match). */
  .tg-row > .tg-res { order: -1; }
  .tg-mine .ra-chips, .tg-mine .ra-acts, .tg-theirs .ra-acts, .tg-theirs .tg-foe { display: none; }
  .tg-notes li { min-height: 21px; padding-top: 3px; font-size: 12.5px; }
  /* Picking: the picker takes the page. */
  .tg.picking .tg-hero { display: none; }
  .tg-picker { padding: 10px 10px; gap: 8px; }
  /* The picker's head: its title and Done on one line, the tabs across the next. */
  .tg-picker > .tg-ph { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
  .tg-picker > .tg-ph > .spacer { display: none; }
  .tg-picker > .tg-ph > .tg-ptabs { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tg-picker > .tg-ph > [data-act="tg-pick-x"] { grid-column: 2; grid-row: 1; }
  .tg-cupmade > .tg-ph > .muted { display: none; }
  .tg-ptabs .tg-l { display: none; } .tg-ptabs .tg-s { display: inline; }
  .tg-opps { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  [data-theme="codex"] .tg-opp { min-height: 46px; padding: 3px 8px; gap: 8px; }
  .tg-faces img { width: 24px; height: 24px; }
  .tg-made { gap: 5px; }
  [data-theme="codex"] .tg-slot { min-height: 84px; padding: 5px 2px; }
  .tg-slot img { width: 36px; height: 36px; }
  .tg-slot > b { font-size: 11.5px; }
  .tg-mk.editing .tg-slot > b { display: none; }
  .tg-mk-foot { flex-wrap: wrap; }
  .tg-mk-foot .muted { flex: 1 1 100%; }
  .tg-mk-tools input[type="search"] { max-width: none; flex-basis: 45%; }
  .tg-species { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 4px; }
  .tg-species img { width: 34px; height: 34px; }
  /* Cup drill: the two sixes side by side would be too small: yours over theirs, three across. */
  .tg-cup { flex: 1 1 0; max-height: 560px; grid-template-rows: auto auto auto; align-content: space-between; }
  .tg-cup .tg-side { grid-template-rows: auto auto; gap: 6px; }
  .tg-cup .tg-sixes { gap: 5px; align-self: start; }
  .tg-six .ra-mon { --h: 46px; }
  .tg-x { width: 46px; height: 46px; top: 10px; }
  [data-theme="codex"] .tg-six { padding: 10px 2px 4px; }
  .tg-six > b { font-size: 11px; }
  .tg-six > em { font-size: 13px; min-height: 14px; }
  .tg-cup .tg-plate b { font-size: 19px; }
  .tg-cmid .tg-rline, .tg-plate .tg-cap { display: none; }
  .tg-spar .tg-row.tg-crow, .tg-crow { display: flex; flex-direction: column; }
  .tg-lines li > b { font-size: 20px; }
  .tg-hero.tg-dhero { flex: 0 0 104px; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .tg-dhero .tg-side, .tg-dtext small { display: none; }
  .tg-dtext { gap: 4px; }
  .tg-dtext b { font-size: 24px; }
  .tg-dtext span { font-size: 12.5px; }
  .tg-drow { flex: none; align-items: stretch; }
  .tg-fl > li { min-height: 40px; }
}
@media (max-width: 760px) {
  /* Result on a phone: the two sides side by side, each creature its face, its share and its falls. */
  .tg-spar .tg-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tg-row > .tg-res { grid-column: 1 / -1; }
  .tg-spar .tg-mons li > b { display: none; }
  .tg-spar .tg-mons li.out > b { display: block; font-size: 11.5px; }
  .tg-spar .tg-mons .tg-out { display: none; }
  .tg-spar .tg-mons .tg-bar { flex: 1 1 auto; width: auto; min-width: 24px; }
  .tg-spar .tg-mons em { min-width: 3.4em; font-size: 11.5px; }
  .tg-spar .tg-mons li:not(:has(.tg-bar)) > b { display: block; }
  .tg-theirs .ra-h .linkbtn { display: none; }
  .tg-card .ra-h .tg-l { display: none; } .tg-card .ra-h .tg-s { display: inline; }
  .tg-mine .ra-h { position: relative; }
  .tg-mine .ra-h .linkbtn { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
  /* Every team tried: the ranking takes the row, names and all. */
  .tg-spar .tg-row:has(.tg-rank) > .tg-mine { grid-column: 1 / -1; }
  .tg-spar .tg-row:has(.tg-rank) > .tg-theirs { display: none; }
  .tg-watch .btn { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .tg-spar .tg-row { gap: 6px; }
  .tg-score > b { font-size: 36px; }
  /* A short phone: each side on one line, its name and power beside its creatures. */
  .tg-spar .tg-side { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto auto; grid-template-areas: "plate team" "power team"; align-content: center; gap: 3px 8px; }
  .tg-spar .tg-them { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-areas: "team plate" "team power"; }
  .tg-spar .tg-side .ra-power { justify-self: start; display: flex; align-items: baseline; gap: 5px; padding: 0; border: 0; background: none; box-shadow: none; }
  .tg-spar .tg-them .ra-power { justify-self: end; }
  .tg-spar .tg-side .ra-power small { font-size: 8.5px; }
  .tg-spar .tg-side .ra-power b { font-size: 15px; }
  .tg-spar .tg-side .ra-team { align-self: center; padding-bottom: 0; }
  .tg-spar .tg-side .ra-mon { --h: min(24cqh, 84px, calc(118cqw / var(--n, 4))); }
  .tg-plate { gap: 3px; }
  .tg-plate b { font-size: 18px; }
  .tg-plate i { display: none; }
  .tg-mid .tg-rline { display: none; }
  [data-theme="codex"] .tg-change { height: 24px; min-height: 24px; margin-top: 0; padding: 0 10px; }
  .tg-spar .tg-hero::after { background: linear-gradient(180deg, rgba(18, 11, 5, .78) 0%, rgba(18, 11, 5, .42) 30%, rgba(18, 11, 5, .42) 70%, rgba(18, 11, 5, .78) 100%); }
  /* A creature being chosen for a made-up team: its slots, the search and the creatures. */
  .tg-picker:has(.tg-mk.editing) > .tg-ph { display: none; }
  /* A short phone: each six in one row, faces and numbers. */
  .tg-cup .tg-sixes { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .tg-six .ra-mon { --h: 38px; }
  .tg-x { width: 38px; height: 38px; }
  .tg-six > b { display: none; }
  .tg-tag { font-size: 8px; padding: 2px 3px; letter-spacing: 0; }
  /* Duels on a short phone: the lists, not the banner. */
  .tg-hero.tg-dhero { display: none; }
  .tg-fl > li { min-height: 36px; }
}
@media (max-width: 760px) and (max-height: 600px) {
  /* The smallest phones: the count and the read; the sides are on Match. */
  .tg-spar .tg-row > .tg-mine, .tg-spar .tg-row > .tg-theirs { display: none; }
  .tg-spar .tg-mid .tg-rules > span, .tg-spar .tg-plate small, .tg-spar .tg-side .ra-power small { display: none; }
  [data-theme="codex"] .tg-opp { min-height: 40px; }
  /* Choosing a creature: the search with Remove and Done, the grade row, two rows of creatures. */
  .tg-mk-tools > select[data-tg="qel"] { display: none; }
  .tg-mk-tools input[type="search"] { flex: 1 1 80px; min-width: 60px; order: -3; }
  .tg-mk-tools > [data-act="tg-m-remove"] { order: -2; }
  .tg-mk-tools > [data-act="tg-m-done"] { order: -1; }
  .tg-mk-tools > .spacer { display: none; }
  .tg-species img { width: 30px; height: 30px; }
  .tg-mk-tools { gap: 5px; }
  .tg-grades button { min-width: 24px; padding: 0 3px; }
  .tg-stars, .tg-aura { gap: 4px; font-size: 12px; }
  .tg-stars select { width: 44px; padding-left: 6px; padding-right: 2px; }
  /* Cup drill and Duels: no room for the small print or the banner. */
  .tg-cup .tg-note, .tg-inv .tg-fine { display: none; }
  .tg-cup .tg-rules > span { display: none; }
  [data-theme="codex"] .tg-cmid .tg-go { padding: 0 6px; font-size: 12.5px; letter-spacing: .03em; white-space: nowrap; }
}

/* ---- made-up teams: Easy / Advanced, saved teams (shared/made.ts) ---- */
.tg-mbar { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.tg-mode button { min-width: 76px; }
.tg-saved { flex: 0 1 220px; min-width: 0; width: auto; }
.tg-slot .tg-hi { display: inline-flex; }
.tg-slot .tg-hi img { width: 16px; height: 16px; }
.tg-slot .tg-rw { font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; }
/* One creature's build. */
.tg-ed { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; flex: 1 1 auto; }
.tg-ed-h { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tg-ed-h > img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; flex: none; }
.tg-ed-n { display: grid; gap: 3px; min-width: 0; }
.tg-ed-n > b { font: 700 15px/1.1 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-ed-n > small { display: flex; align-items: center; gap: 8px; color: var(--muted); font: 600 12px/1 var(--sans); white-space: nowrap; }
.tg-ed-n > small b { color: var(--ink); }
.tg-ed-h .tg-s { display: none; }
.tg-advtabs { display: none; }
.tg-adv { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 12px; min-width: 0; min-height: 0; }
[data-theme="codex"] .tg-col { display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 10px 12px; border: 1px solid var(--rule-soft, var(--rule)); border-radius: 3px; background: var(--inlay); }
.tg-col > h5 { display: flex; align-items: center; gap: 8px; margin: 0 0 2px; font: 700 11.5px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--rg-ink, var(--accent)); min-height: 24px; }
.tg-quick { letter-spacing: 0; text-transform: none; }
.tg-quick button { min-width: 0; padding: 0 6px; height: 24px; font-size: 11.5px; }
.tg-tals { display: grid; gap: 5px; }
.tg-sl, .tg-f { display: grid; grid-template-columns: 6.2em minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; font: 600 12.5px/1 var(--sans); color: var(--ink); }
.tg-f { grid-template-columns: 6.2em minmax(0, 1fr); }
.tg-f > :nth-child(n+3) { grid-column: 2; }
.tg-sl > span, .tg-f > span { color: var(--muted); white-space: nowrap; }
.tg-sl input[type="range"] { width: 100%; min-width: 0; margin: 0; accent-color: var(--rg-ink, var(--accent)); }
.tg-num { width: 3.6em; height: 26px; padding: 0 4px; text-align: center; font: 700 12.5px/1 var(--sans); -moz-appearance: textfield; }
.tg-num::-webkit-inner-spin-button, .tg-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.tg-f select { width: 100%; min-width: 0; }
.tg-f .seg { justify-self: start; }
.tg-bl button, .tg-starseg button { min-width: 0; padding: 0 8px; }
.tg-rfs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.tg-rfs label { display: grid; justify-items: center; gap: 3px; min-width: 0; }
.tg-rfs small { color: var(--muted); font: 600 10.5px/1 var(--sans); }
.tg-rfs .tg-num { width: 100%; }
.tg-f .rw-tg { justify-self: start; }
.tg-f .rw-reach { justify-self: start; }
.tg-fx { margin: -2px 0 0; padding-left: calc(6.2em + 8px); font-size: 11.5px; line-height: 1.3; color: var(--muted); }
.tg-namef { display: grid; gap: 6px; }
.tg-namef input { width: 100%; }
/* Not room for three groups side by side: one at a time, picked by tabs. */
@media (max-width: 1180px), (max-height: 700px) {
  .tg-advtabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tg-adv { grid-template-columns: minmax(0, 1fr); }
  .tg-adv[data-tab="rolls"] > .tg-col:not(.rolls), .tg-adv[data-tab="growth"] > .tg-col:not(.growth), .tg-adv[data-tab="kit"] > .tg-col:not(.kit) { display: none; }
  .tg-adv > .tg-col > h5 { display: none; }
}
/* A short window: the editor rises over the strip's big tiles. */
@media (max-height: 700px) {
  .tg-col { padding: 8px 10px; gap: 5px; }
  .tg-tals { gap: 3px; }
  .tg-sl input[type="range"] { height: 18px; }
  .tg-num { height: 24px; }
  .tg-ed { gap: 7px; }
  .tg-ed-h > img { width: 32px; height: 32px; }
}
@media (max-width: 760px) {
  .tg-mbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; }
  .tg-mode button { min-width: 0; padding: 0 10px; }
  .tg-saved { width: 100%; }
  .tg-mk-tip { display: none; }
  .tg-ed-h { gap: 6px; }
  .tg-ed-h .tg-l { display: none; } .tg-ed-h .tg-s { display: inline; }
  .tg-sl, .tg-f { grid-template-columns: 5.4em minmax(0, 1fr) auto; gap: 6px; }
  .tg-f { grid-template-columns: 5.4em minmax(0, 1fr); }
  .tg-fx { padding-left: calc(5.4em + 6px); }
}
.tg-rowf { display: inline-flex; align-items: center; gap: 10px; color: var(--ink) !important; }
.tg-ed-h .tg-advtabs button { min-width: 84px; }
@media (max-width: 1180px), (max-height: 700px) {
  .tg-ed-h .tg-advtabs { display: inline-grid; margin-right: 6px; }
}
@media (min-width: 761px) and (max-height: 700px) {
  .tg-tals { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
  .tg-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
}
@media (max-width: 760px) {
  .tg-ed-h { flex-wrap: wrap; }
  .tg-ed-h .tg-advtabs { order: 9; flex: 1 1 100%; margin: 0; display: grid; }
  .tg-ed-h .tg-advtabs button { min-width: 0; }
}

.tg-pair { display: grid; gap: 7px; min-width: 0; }
.tg-quick button[data-act="tg-m-max"] { padding: 0 8px; }
@media (max-width: 760px) {
  .tg-ed-n > b { display: none; }
  .tg-ed-h { flex-wrap: wrap; }
  .tg-ed-h > .spacer { display: none; }
  .tg-ed-h > .tg-ed-n { margin-right: auto; }
  .tg-tals { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; row-gap: 4px; }
  .tg-tals .tg-sl { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; row-gap: 2px; }
  .tg-tals .tg-sl > span { grid-column: 1; grid-row: 1; }
  .tg-tals .tg-sl > .tg-num { grid-column: 2; grid-row: 1; height: 22px; width: 3em; }
  .tg-tals .tg-sl > input[type="range"] { grid-column: 1 / -1; grid-row: 2; }
  .tg-num { height: 28px; min-height: 0; font-size: 13px; }
  .tg-col .seg button { min-height: 30px; height: 30px; }
}
@media (min-width: 761px) and (max-height: 820px) {
  .tg-tals { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .tg-tals .tg-sl { grid-template-columns: 4.6em minmax(0, 1fr) auto; gap: 6px; }
}
@media (max-width: 760px) {
  .tg-col input.tg-num { min-height: 0; height: 26px; }
  .tg-col input[type="range"] { min-height: 0; height: 22px; }
  .tg-tals .tg-sl > input.tg-num { height: 22px; }
}
@media (max-width: 760px) {
  .tg-slot > span { gap: 3px; flex-wrap: wrap; justify-content: center; }
  .tg-slot .tg-hi, .tg-slot .tg-rw { display: none; }
  .tg-slot .aura-tag { font-size: 0; padding: 0; background: none; border: 0; }
  .tg-slot .aura-tag::before { content: '✦'; font-size: 12px; }
}
/* Phones: Their side's Change button stuck out past its card's right edge (a 390 px phone), and with one team the
   team switch on Match showed only its initial ("H") across the whole row. */
@media (max-width: 760px) {
  .tg-card .ra-h { gap: 6px; }
  .tg-card .ra-h h4 { min-width: 0; font-size: 16px; }
  .tg-card .ra-h .btn { padding-inline: 8px; }
  .tg-teams .ra-chips:not(:has(> :nth-child(3))) .ra-chip .ra-cl { display: inline; }
  .tg-teams .ra-chips:not(:has(> :nth-child(3))) .ra-chip .ra-cs { display: none; }
}
