/* Territories (client/js/ui/territory/; previews t2-t5, p1-p3, battle b6
   and b7): the spot panel (docked right on a computer so the flag stays in
   view, a bottom sheet on a phone), the pickers and their confirm (the
   Guild's confirm card, guild.css), the result card, the Territories window
   (Task 7). The pixel kit's frames and tokens (social-ui.css .pxui
   .px-win); the guild colours' tints (guild-rules.js COLOR_HEX); 44 px
   targets on touch screens. Each window scrolls its body; its head and its
   foot (the picker's Challenge) stay in view. */

/* ------------------------------------------------------------------ the windows */
:where(.tr-spot, .tr-pick, .tr-result) :where(h2, h3, p, ol, ul) { margin: 0; }
.tr-spot, .tr-pick, .tr-result { font-variant-ligatures: none; }
/* (the panel takes the focus as it opens, no button: no ring round the whole panel) */
.tr-spot:focus { outline: none; }
.pxui.tr-spot, .pxui.tr-pick { display: flex; flex-direction: column; padding: 12px 14px 14px; overflow: hidden; }
.pxui.tr-spot.desk { top: 8px; right: 8px; width: min(560px, calc(100% - 16px)); max-height: calc(100% - 16px); }
.pxui.tr-pick.desk { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(780px, calc(100% - 16px)); max-height: calc(100% - 16px); }
.pxui.tr-spot.sheet, .pxui.tr-pick.sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; max-height: 86%; transform: none; padding: 10px 10px 12px; border-bottom-width: 0; border-radius: 12px 12px 0 0; }

/* the head: the flag, the name and its kicker, ? and ✕ */
.tr-head { flex: none; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 0 10px; border-bottom: 2px dashed var(--rule); }
.tr-flagslot, .tr-flag { flex: none; display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.tr-flag canvas { display: block; image-rendering: pixelated; }
.tr-flag .hub-pix svg { display: block; }
.tr-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tr-title h2 { font-size: 22px; font-weight: 700; line-height: 1.15; letter-spacing: .04em; text-transform: uppercase; overflow-wrap: anywhere; }
.tr-kick { overflow: hidden; color: var(--ink-2); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.tr-help, .tr-x { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 3px solid var(--frame); border-radius: 8px; background: #fff; font-size: 18px; font-weight: 700; }
@media (hover: hover) { .tr-help:hover, .tr-x:hover { border-color: var(--sel-line); } }

/* the body: it scrolls (4 px round it: a focus ring isn't cut) */
.tr-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; margin: 0 -4px; padding: 10px 4px 4px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ring) transparent; }
.tr-loading, .tr-empty { color: var(--ink-2); font-size: 15px; }

/* the state: the shield, a challenge under way */
.tr-state { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-state:empty { display: none; }
.tr-shield, .tr-busy { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border: 2px solid var(--blue); border-radius: 6px; background: var(--sky); font-size: 14px; font-weight: 600; white-space: nowrap; }
.tr-busy { border-color: var(--sel-line); background: var(--sel); }

/* the defenders: they battle in this order */
.tr-sec { display: flex; flex-direction: column; gap: 6px; }
/* (style.css .window h3 is a flex row of 20 px: the section heads here are the kit's small caps) */
.tr-spot h3.tr-sechead { display: flex; justify-content: flex-start; align-items: baseline; gap: 8px; margin: 0; color: var(--ink); font-size: 13px; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.tr-secn { overflow: hidden; color: var(--ink-3); letter-spacing: 0; text-overflow: ellipsis; text-transform: none; }
.tr-defs { display: flex; flex-direction: column; gap: 6px; padding: 0; list-style: none; }
.tr-def { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 4px 10px 4px 4px; border: 3px solid var(--blue); border-radius: 12px; background: var(--slot); }
.tr-def.mine { border-color: var(--sel-line); background: var(--sel); }
.tr-def-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; line-height: 1.25; }
.tr-def-n { display: flex; align-items: center; gap: 7px; min-width: 0; }
.tr-def-n b { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.tr-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
.tr-lv { display: inline-flex; align-items: center; height: 20px; padding: 0 5px; border: 2px solid var(--frame); border-radius: 4px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.tr-mine { flex: none; display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 2px solid var(--sel-line); border-radius: 6px; background: #fff3dc; color: var(--ink); font-size: 12px; font-weight: 700; white-space: nowrap; }
.tr-by { flex: none; display: flex; flex-direction: column; align-items: flex-end; max-width: 42%; color: var(--ink-2); font-size: 13px; line-height: 1.25; text-align: right; }
.tr-who { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.tr-dot { display: none; }
.tr-held { white-space: nowrap; }
.tr-owner { min-height: 26px; padding: 0 2px; border: 0; border-radius: 4px; background: none; color: var(--blue-dk); font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
@media (hover: hover) { .tr-owner:hover { color: var(--sel-line); } }
.tr-open { padding: 6px 10px; border: 3px dashed var(--plain-line); border-radius: 12px; background: var(--plain); color: var(--ink-3); font-size: 14px; text-align: center; }
.tr-rules { padding: 6px 0; border-top: 2px dashed var(--rule); border-bottom: 2px dashed var(--rule); color: var(--ink-2); font-size: 14px; text-align: center; }

/* a Pokémon's icon in its box */
.tr-mon { position: relative; flex: none; display: inline-block; overflow: hidden; }
.tr-mon i { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -56%); background-repeat: no-repeat; image-rendering: pixelated; }
.tr-def .tr-mon, .tr-pickrow .tr-mon, .tr-foe .tr-mon { border: 2px solid var(--frame); border-radius: 8px; background: #eef6fd; }

/* the buttons: each with the server's reason beside it (under it on a phone) */
.tr-acts { display: flex; flex-direction: column; gap: 8px; }
.tr-act { display: grid; grid-template-columns: 210px minmax(0, 1fr); align-items: center; column-gap: 12px; }
.tr-act .px-btn { width: 100%; height: 44px; font-size: 16px; }
.tr-why { color: var(--red-dk); font-size: 13px; line-height: 1.35; }
.tr-spot .px-btn[aria-disabled="true"], .tr-pick .px-btn[aria-disabled="true"], .tr-win .px-btn[aria-disabled="true"] { border-color: var(--plain-line); background: var(--plain); color: var(--ink-3); box-shadow: none; cursor: default; }
.tr-spot.sheet .tr-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tr-spot.sheet .tr-act { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
.tr-spot.sheet .tr-act.has-why { grid-column: 1 / -1; }
.tr-spot.sheet .tr-act .px-btn { font-size: 15px; }

/* ------------------------------------------------------------------ the pickers */
.tr-pick h3 { display: block; margin: 0 0 6px; color: var(--ink); font-size: 14px; letter-spacing: .07em; text-transform: uppercase; }
.tr-pick section + section { padding-top: 8px; border-top: 2px dashed var(--rule); }
.tr-hint { margin-bottom: 6px; color: var(--ink-2); font-size: 13px; line-height: 1.35; }
/* (room above and right of each row for its order badge: never cut by the scrolling body) */
.tr-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; padding: 10px 6px 2px 0; }
.tr-pickrow { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 60px; padding: 5px 10px 5px 5px; border: 3px solid var(--blue); border-radius: 12px; background: var(--slot); font-size: 15px; text-align: left; }
.tr-pickrow[aria-pressed="true"] { border-color: var(--sel-line); background: var(--sel); }
.tr-pickrow[aria-disabled="true"] { border-style: dashed; border-color: var(--plain-line); background: var(--plain); color: var(--ink-3); cursor: default; }
.tr-pickrow[aria-disabled="true"] .tr-mon i { filter: grayscale(1); opacity: .55; }
@media (hover: hover) { .tr-pickrow:not([aria-disabled="true"]):hover { border-color: var(--sel-line); } }
.tr-pick-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.25; }
.tr-pick-tx b { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.tr-pick-sub { color: var(--ink-2); font-size: 13px; }
.tr-pickrow[aria-disabled="true"] b { color: var(--ink-3); }
.tr-ord { position: absolute; top: -9px; right: -6px; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: 3px solid var(--frame); border-radius: 50%; background: var(--blue); color: #fff; font-size: 14px; font-weight: 700; line-height: 1; }
.tr-foes { display: flex; flex-wrap: wrap; gap: 10px; }
.tr-foe { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink-2); font-size: 13px; }
.tr-foot { flex: none; display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 2px dashed var(--rule); }
.tr-foot .tr-hint { margin: 0; }
.tr-note { padding: 7px 12px; border: 3px solid var(--frame); border-radius: 12px; background: #fff; color: var(--ink); font-size: 15px; font-weight: 700; }
.tr-pick .tr-act { grid-template-columns: minmax(0, 1fr) 240px; }
.tr-pick .tr-act .px-btn { grid-column: 2; grid-row: 1; }
.tr-pick .tr-act .tr-why { grid-column: 1; grid-row: 1; text-align: right; }
.tr-pick.sheet .tr-act { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
.tr-pick.sheet .tr-act .px-btn { grid-column: 1; grid-row: 1; }
.tr-pick.sheet .tr-act .tr-why { grid-column: 1; grid-row: 2; text-align: left; }
.tr-pick.sheet .tr-rows { grid-template-columns: minmax(0, 1fr); }

/* ------------------------------------------------------------------ the result card (b6, b7) */
.window.tr-scrim { inset: 0; max-width: none; max-height: none; padding: 16px; display: flex; align-items: center; justify-content: center; background: #0b122280; }
.pxui.tr-result { flex: none; width: min(460px, 100%); max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; }
.tr-result-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 8px; padding-bottom: 8px; border-bottom: 2px dashed var(--rule); }
.tr-result-h h2 { font-size: 17px; letter-spacing: .05em; text-transform: uppercase; }
.tr-result-h .tr-kick { color: var(--ink-3); font-size: 12px; letter-spacing: .07em; text-transform: uppercase; }
.tr-result-head { font-size: 16px; font-weight: 600; line-height: 1.5; }
.tr-result-head .gd-tag { vertical-align: 1px; }
.tr-result-lines { display: flex; flex-direction: column; gap: 6px; padding: 0; list-style: none; }
.tr-result-lines li { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 10px; font-size: 15px; line-height: 1.35; }
.tr-result-lines .tr-mon { width: 32px; height: 32px; }
.tr-dia { justify-self: center; width: 11px; height: 11px; border: 2px solid var(--frame); background: var(--blue); transform: rotate(45deg); }
.tr-result .tr-acts { display: flex; flex-direction: row; justify-content: flex-end; }
.tr-result .tr-acts .px-btn { min-width: 120px; height: 42px; font-size: 16px; }

/* the guild colours: a tag chip (guild/parts.js tagChip) outside the Guild window */
:where(.tr-spot, .tr-pick, .tr-result, .tr-win) .c-red { --c: #e0523f; --o: #7c2216; --l: #f38775; --t: #b0362a; }
:where(.tr-spot, .tr-pick, .tr-result, .tr-win) .c-orange { --c: #f08a2c; --o: #7a3a08; --l: #f7b268; --t: #b0560e; }
:where(.tr-spot, .tr-pick, .tr-result, .tr-win) .c-yellow { --c: #e8c23a; --o: #6e5608; --l: #f5dc78; --t: #8a6a00; }
:where(.tr-spot, .tr-pick, .tr-result, .tr-win) .c-green { --c: #4caf50; --o: #22602a; --l: #80d080; --t: #2e7d32; }
:where(.tr-spot, .tr-pick, .tr-result, .tr-win) .c-teal { --c: #2ba8a0; --o: #0f4e4a; --l: #62cbc3; --t: #18766f; }
:where(.tr-spot, .tr-pick, .tr-result, .tr-win) .c-blue { --c: #3f7fd0; --o: #1e467e; --l: #74a8ec; --t: #2a5ea8; }
:where(.tr-spot, .tr-pick, .tr-result, .tr-win) .c-purple { --c: #8a5cc7; --o: #452a70; --l: #ad89e2; --t: #6b3fa0; }
:where(.tr-spot, .tr-pick, .tr-result, .tr-win) .c-pink { --c: #e0609a; --o: #7a1f4a; --l: #f08fbb; --t: #b0366e; }

/* ------------------------------------------------------------------ the Territories window (t5, p2) */
/* A computer (board t5, the owner's call): on the left the 16 spots in two
   columns by town, the spot picked in a card under them (spot.js spotCard),
   scrolling together; on the right yours (your defenders, the Pokémon
   waiting, the guilds), scrolling on its own. Below 1100 px one scroller.
   On a phone (p2) one column scrolls, yours first and the board last, each
   row with its line under the name; a pick opens the spot's sheet.
   (style.css's .window h3 is a 20 px flex row: the heads here are the kit's
   small caps.) */
.pxui.tr-win { width: min(1330px, calc(100% - 24px)); height: min(840px, calc(100% - 16px)); display: flex; flex-direction: column; padding: 12px 14px 14px; overflow: hidden; font-variant-ligatures: none; }
.tr-win :where(h1, h2, p, ol, ul) { margin: 0; }
.tr-win h3 { display: block; margin: 0; font-size: 14px; letter-spacing: .07em; text-transform: uppercase; }
.tr-win .tr-head { gap: 12px; }
.tr-win .tr-head .tr-title { flex-direction: row; align-items: baseline; gap: 14px; }
.tr-win h1 { font-size: 22px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.tr-win .tr-head .tr-kick { min-width: 0; color: var(--ink-3); font-size: 13px; letter-spacing: .07em; text-transform: uppercase; }
.tr-mark { flex: none; }
.tr-back { flex: none; height: 38px; padding: 0 10px; border-color: var(--sel-line); background: var(--sel); font-size: 14px; }
.tr-stand { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border: 3px solid var(--blue); border-radius: 8px; background: #fff; font-size: 15px; white-space: nowrap; }
.tr-stand .gd-tag { flex: none; }
.tr-win .tr-main { flex: 1; min-height: 0; padding-top: 12px; }
.tr-win.desk .tr-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); grid-template-rows: minmax(0, 1fr); gap: 14px; }
/* (4 px round what scrolls: a focus ring isn't cut) */
.tr-win.desk .tr-left { min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 4px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ring) transparent; }
.tr-win.desk .tr-side { min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 4px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ring) transparent; }
/* the spots: the head with the marks told, the towns in two columns */
.tr-spots { flex: none; display: flex; flex-direction: column; gap: 6px; }
.tr-listhead { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 0 2px; }
.tr-legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-left: auto; color: var(--ink-3); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.tr-legend[hidden] { display: none; }
.tr-legend .tr-chip + .tr-chip, .tr-legend .tr-chip:not(:first-child) { margin-left: 8px; }
.tr-cols, .tr-col { display: flex; flex-direction: column; gap: 6px; }
.tr-win.desk .tr-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 14px; }
.tr-town { display: flex; flex-direction: column; gap: 5px; }
.tr-win h3.tr-town-h { display: flex; align-items: center; gap: 8px; margin: 4px 2px 0; color: var(--ink-3); font-size: 12px; font-weight: 400; white-space: nowrap; }
.tr-town-h::after { content: ''; flex: 1; min-width: 12px; border-top: 2px dashed var(--rule); }
.tr-town-list { display: flex; flex-direction: column; gap: 5px; padding: 0; list-style: none; }
.tr-row { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 3px 8px 3px 4px; border: 3px solid var(--blue); border-radius: 10px; background: #fff; color: var(--ink); text-align: left; }
.tr-row.ours { background: #eef5fc; }
.tr-row.unc { border-style: dashed; border-color: var(--plain-line); background: #fbfbf6; }
.tr-row[aria-current="true"] { border-style: solid; border-color: var(--sel-line); background: var(--sel); }
@media (hover: hover) { .tr-row:hover { border-color: var(--sel-line); } }
.tr-row .tr-flagslot { width: 36px; }
.tr-row-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.tr-row-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tr-row-n { min-width: 0; overflow: hidden; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tr-row-sub { overflow: hidden; color: var(--ink-2); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.tr-row.unc .tr-row-n { color: var(--ink-2); }
/* a row's marks (t5): the shield's minutes, a challenge, "you", the tag; "Unclaimed" */
.tr-chips { flex: none; display: flex; align-items: center; gap: 5px; }
.tr-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 6px; border: 2px solid var(--blue); border-radius: 6px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.tr-chip-shield { color: var(--blue-dk); }
.tr-chip-shield::before { content: ''; flex: none; width: 8px; height: 10px; background: currentColor; clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); }
.tr-chip-busy { border-color: var(--sel-line); background: var(--sel); }
.tr-chip-you { border-color: var(--sel-line); background: #fff3dc; }
.tr-chip-unc { border-color: var(--plain-line); background: var(--plain); color: var(--ink-3); font-weight: 400; }
.tr-chips .gd-tag { flex: none; }
/* a computer's row: one line, the marks at its end (t5); the flag's cloth only */
.tr-win.desk .tr-row { min-height: 44px; padding: 2px 8px 2px 4px; }
.tr-win.desk .tr-row .tr-flagslot { width: 26px; height: 32px; overflow: hidden; }
.tr-win.desk .tr-row .tr-row-sub, .tr-win.desk .tr-row-top .tr-mine { display: none; }
.tr-win.phone .tr-chips { display: none; }
/* the spot picked: a card under the list (t5) */
.tr-detail { flex: none; display: flex; flex-direction: column; padding: 10px 14px 12px; border: 3px solid var(--sel-line); border-radius: 12px; background: #fff; }
.tr-card-in { display: flex; flex-direction: column; gap: 10px; }
.tr-cardhead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tr-detail .tr-title h2 { font-size: 19px; letter-spacing: .02em; text-transform: none; }
.tr-detail .tr-kick { color: var(--ink-3); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; white-space: normal; }
.tr-deficons { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 50%; margin-left: auto; }
.tr-deficon { display: inline-flex; line-height: 0; }
.tr-deficon .tr-mon { border: 2px solid var(--frame); border-radius: 8px; background: #eef6fd; }
.tr-deficon.mine .tr-mon { border-color: var(--sel-line); background: var(--sel); }
.tr-detail .tr-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: start; gap: 8px 10px; }
.tr-detail .tr-act { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
.tr-flaghint { padding: 6px 10px; border-radius: 8px; background: var(--plain); color: var(--ink-2); font-size: 13px; line-height: 1.35; }
.tr-detail .tr-pickhint, .tr-detail .tr-loading { margin: 6px auto; max-width: 420px; color: var(--ink-2); font-size: 15px; line-height: 1.4; text-align: center; }
.tr-win h3.tr-sechead { display: flex; justify-content: flex-start; align-items: baseline; gap: 8px; color: var(--ink); font-size: 13px; white-space: nowrap; }
/* yours: your guild, your defenders, the Pokémon waiting, the guilds */
.tr-card { flex: none; display: flex; flex-direction: column; border: 3px solid var(--frame); border-radius: 12px; background: #fff; overflow: hidden; }
.tr-card-h { display: flex; align-items: center; gap: 8px; padding: 7px 12px 6px; border-bottom: 3px solid var(--rule); background: linear-gradient(#cfe6fa, #eef6fd); }
.tr-card-h h3 { white-space: nowrap; }
.tr-cardn { min-width: 0; margin-left: auto; overflow: hidden; color: var(--ink-3); font-size: 12px; letter-spacing: .06em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.tr-listhead .tr-cardn { margin-left: 0; }
.tr-card-b { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; }
.tr-card .tr-hint { margin: 0; }
.tr-guildcard { gap: 10px; padding: 10px 12px 12px; border-color: var(--sel-line); background: #fff8ec; }
.tr-guildcard p { font-size: 15px; line-height: 1.4; }
.tr-guildcard .px-btn { align-self: flex-start; height: 40px; }
.tr-mines { display: flex; flex-direction: column; gap: 6px; padding: 0; list-style: none; }
.tr-mine-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 56px; padding: 4px 8px 4px 4px; border: 3px solid var(--blue); border-radius: 12px; background: var(--slot); }
.tr-mine-row .tr-mon, .tr-wait .tr-mon { border: 2px solid var(--frame); border-radius: 8px; background: #eef6fd; }
.tr-iconslot { flex: none; display: flex; line-height: 0; }
.tr-mine-row b { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.tr-mine-row .tr-row-sub { font-size: 13px; white-space: normal; }
/* the BP it earned (board t5's chip); a greyed Recall's reason under the whole row */
.tr-bp { display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border: 2px solid #c98a2a; border-radius: 4px; background: #fff3c4; color: var(--ink); font-size: 11px; font-weight: 700; white-space: nowrap; vertical-align: 1px; }
.tr-mine-row .tr-why { grid-column: 1 / -1; margin: 0 2px 2px; font-size: 12px; }
.tr-mine-row .px-btn { height: 38px; padding: 0 12px; }
.tr-today { font-size: 15px; font-weight: 600; }
.tr-wait { flex-direction: row; align-items: center; gap: 10px; padding: 8px 10px; border-color: var(--sel-line); background: #fff8ec; }
.tr-wait-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tr-wait-n { font-size: 15px; font-weight: 600; line-height: 1.35; }
.tr-wait .px-btn { flex: none; height: 40px; }
/* (fixed columns: the table never runs past its card; a long guild name wraps) */
.tr-board { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 14px; }
.tr-board th { padding: 0 3px 4px; color: var(--ink-3); font-size: 11px; font-weight: 400; letter-spacing: .02em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.tr-board th:nth-child(1) { width: 22px; }
.tr-board th:nth-child(2) { width: 44px; }
.tr-board th:nth-child(4) { width: 44px; }
.tr-board th:nth-child(5) { width: 46px; }
.tr-board th:nth-child(6) { width: 64px; }
.tr-board td { padding: 3px; white-space: nowrap; }
.tr-board td:first-child { color: var(--ink-3); text-align: center; }
.tr-board td:nth-child(2) { line-height: 0; }
.tr-board td:nth-child(3) { overflow-wrap: anywhere; font-weight: 600; line-height: 1.25; white-space: normal; }
.tr-board td:nth-child(n+4), .tr-board th:nth-child(n+4) { text-align: right; font-variant-numeric: tabular-nums; }
.tr-board tbody tr:nth-child(even) td { background: #f3f7fc; }
.tr-board tbody tr.me td { background: var(--sel); }
/* a smaller computer: one scroller, the list and its card, then yours */
@media (max-width: 1099px) {
  .tr-win.desk .tr-main { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ring) transparent; }
  .tr-win.desk .tr-main > .tr-left, .tr-win.desk .tr-main > .tr-side { flex: none; min-height: auto; overflow: visible; }
  .tr-win.desk .tr-main > .tr-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
  .tr-win.desk .tr-head .tr-kick, .tr-legend { display: none; }
}
/* a phone (p2): one column that scrolls, yours first, the board last */
.pxui.tr-win.phone { width: calc(100% - 12px); height: calc(100% - 16px); padding: 10px 10px 0; }
.tr-win.phone .tr-head { gap: 8px; padding-bottom: 8px; }
.tr-win.phone h1 { font-size: 19px; }
.tr-win.phone .tr-head .tr-kick { display: none; }
.tr-win.phone .tr-back { height: 44px; padding: 0 8px; font-size: 13px; }
.tr-win.phone .tr-help, .tr-win.phone .tr-x { width: 44px; height: 44px; }
.tr-win.phone .tr-main { display: flex; flex-direction: column; gap: 10px; padding: 8px 4px 12px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ring) transparent; }
.tr-win.phone .tr-main > * { flex: none; }
.tr-win.phone .tr-stand { align-self: flex-start; max-width: 100%; white-space: normal; }
.tr-win.phone .tr-listhead { padding: 0; }

/* ------------------------------------------------------------------ a phone */
@media (max-width: 560px) {
  .tr-title h2 { font-size: 19px; }
  .tr-kick { font-size: 13px; }
  .tr-def { gap: 8px; padding-right: 8px; }
  .tr-def-n b { font-size: 16px; }
  .tr-act { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
}

/* a phone on its side (844 × 390): the head compact, the body scrolls */
@media (max-height: 520px) {
  .pxui.tr-spot, .pxui.tr-pick { padding: 8px 10px 10px; }
  .tr-head { gap: 8px; padding-bottom: 6px; }
  .tr-title h2 { font-size: 18px; }
  .pxui.tr-spot.sheet, .pxui.tr-pick.sheet { max-height: 94%; }
  .pxui.tr-spot.desk, .pxui.tr-pick.desk { max-height: calc(100% - 8px); }
  .pxui.tr-spot.desk { top: 4px; right: 4px; }
  .tr-body { gap: 6px; padding-top: 6px; }
  .tr-def { min-height: 50px; }
  .tr-foot { gap: 6px; padding-top: 6px; }
  .tr-note { padding: 4px 10px; font-size: 14px; }
  .pxui.tr-win.desk { padding: 8px 10px 10px; }
  .tr-win .tr-main { gap: 8px; padding-top: 6px; }
  .tr-win.phone .tr-main { padding-top: 6px; }
}

/* ------------------------------------------------------------------ touch: 44 px targets */
@media (pointer: coarse) {
  .tr-spot .px-btn, .tr-pick .px-btn, .tr-result .px-btn, .tr-win .px-btn, .tr-pickrow, .tr-owner, .tr-row, .tr-x, .tr-help, .tr-back { min-height: 44px; }
  .tr-x, .tr-help, .tr-back { min-width: 44px; }
}
