/* The Battle Frontier window (client/js/ui/frontier/; boards f2-f6 of the
   frontier preview), in the Territories window's frame (territory.css
   .tr-win): the head (◀ Hub, the tower, the title and kicker, the BP chip,
   ? and ✕); on a computer the six facility cards in a 2 × 3 grid on the
   left and the all-time leaderboard in a 452 px column on the right, each
   scrolling on its own (one scroller below 1100 px); on a phone, or a screen
   520 px tall or less (a phone on its side), a bottom sheet under the bar,
   one column that scrolls: the BP, your best, the cards stacked, the board
   with 44 px pickers. 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. */

/* ------------------------------------------------------------------ the window */
.pxui.fr-win { width: min(1340px, calc(100% - 24px)); height: min(920px, calc(100% - 16px)); display: flex; flex-direction: column; padding: 12px 14px 14px; overflow: hidden; font-variant-ligatures: none; }
.fr-win :where(h1, h2, h3, p, dl, dd, table) { margin: 0; }
.fr-win .hub-pix svg, .fr-win .px-face img { display: block; }
.fr-win .hub-pix { flex: none; line-height: 0; }
.fr-kick { color: var(--ink-3); font-size: 13px; letter-spacing: .07em; text-transform: uppercase; }

/* the head: ◀ Hub, the tower, BATTLE FRONTIER and its kicker, the BP chip, ? and ✕ */
.fr-head { flex: none; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0 0 10px; border-bottom: 2px dashed var(--rule); }
.fr-back { flex: none; height: 38px; padding: 0 10px; border-color: var(--sel-line); background: var(--sel); font-size: 14px; }
.fr-mark { flex: none; }
.fr-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 14px; }
.fr-win h1 { font-size: 22px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.fr-title .fr-kick { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-bp { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px 0 8px; border: 3px solid var(--blue); border-radius: 8px; background: #fff; font-size: 15px; white-space: nowrap; }
.fr-bp-note { color: var(--ink-2); font-size: 13px; }
.fr-help, .fr-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) { .fr-help:hover, .fr-x:hover { border-color: var(--sel-line); } }

/* the body: two columns on a computer, each scrolling (4 px round them: a focus ring isn't cut) */
.fr-main { flex: 1; min-height: 0; }
.fr-win.desk .fr-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 452px); grid-template-rows: minmax(0, 1fr); gap: 14px; padding-top: 8px; }
.fr-win.desk .fr-left { min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 4px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ring) transparent; }
.fr-win.desk .fr-side { min-height: 0; display: flex; flex-direction: column; padding: 4px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ring) transparent; }

/* your records not got: why, Try again */
.fr-rec, .fr-fail { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 10px; border: 2px solid #e8b070; border-radius: 8px; background: #fff8ec; color: #7a3a08; font-size: 14px; line-height: 1.35; }
.fr-retry { flex: none; height: 32px; padding: 0 12px; font-size: 13px; }

/* the facilities' head and the level key (f2) */
.fr-sect { flex: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 0 2px; }
.fr-sect h2 { font-size: 15px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.fr-sect .fr-kick { font-size: 12px; }
.fr-lvline { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 0 2px; color: var(--ink-2); font-size: 13px; line-height: 1.3; }
.fr-lvk { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 6px; border: 2px solid var(--frame); border-radius: 5px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.fr-lvk small, .fr-sg small, .fr-bt th small { font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.fr-lvr + .fr-lvk { margin-left: 8px; }

/* the six cards: a 2 × 3 grid; each row as tall as its tallest card */
.fr-cards { flex: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fr-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 8px 11px 9px; border: 3px solid var(--blue); border-radius: 12px; background: var(--slot); cursor: pointer; }
.fr-card.on { border-color: var(--sel-line); background: #fff3df; box-shadow: inset 0 0 0 2px #fff; }
@media (hover: hover) { .fr-card:not(.on):hover { border-color: var(--sel-line); } }
.fr-ft { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fr-fi { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 3px solid var(--frame); border-radius: 9px; background: #fff; }
.fr-tt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.25; }
.fr-nm { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.fr-win h3 { display: block; margin: 0; font-size: 17px; }
.fr-cardbtn { display: inline-flex; align-items: center; min-height: 28px; padding: 0 2px; border: 0; border-radius: 4px; background: none; color: var(--ink); font: inherit; font-weight: 700; letter-spacing: .05em; text-align: left; text-transform: uppercase; cursor: pointer; }
.fr-pays { flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 6px; border: 2px solid; border-radius: 5px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.fr-pays.p-bp { border-color: #8a5a00; background: #fff1c2; color: #6a4a00; }
.fr-pays.p-money { border-color: #2e7d32; background: #e3f4e1; color: #1e5a22; }
.fr-pays.p-cafe { border-color: #8a5a30; background: #f6e7d8; color: #5a3a20; }
.fr-what { color: var(--ink-2); font-size: 13px; }
/* Where, Rules, Enter, Pays */
.fr-facts { display: grid; grid-template-columns: 44px minmax(0, 1fr); row-gap: 3px; column-gap: 8px; font-size: 13px; line-height: 1.3; }
.fr-facts dt { padding-top: 2px; color: var(--ink-3); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.fr-facts dd { display: flex; align-items: flex-start; gap: 4px; min-width: 0; color: var(--ink-2); }
.fr-facts dd svg { flex: none; margin-top: 1px; }
/* your bests: a head with a dashed rule, then the table */
.fr-bests { display: flex; flex-direction: column; gap: 5px; margin-top: auto; }
.fr-bh { display: flex; align-items: center; gap: 8px; }
.fr-bh .fr-kick { font-size: 11px; }
.fr-rule { flex: 1; height: 0; border-top: 2px dashed var(--rule); }
.fr-bt { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; border: 2px solid var(--rule); border-radius: 8px; background: #fff; overflow: hidden; font-size: 13px; }
.fr-bt th, .fr-bt td { height: 22px; padding: 1px 8px; border-top: 1px solid #e3ecf6; text-align: left; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-bt thead th { height: auto; padding-top: 3px; padding-bottom: 3px; border-top: 0; background: #f3f7fc; color: var(--ink-3); font-size: 11px; line-height: 1.2; letter-spacing: .06em; text-transform: uppercase; white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
.fr-bt thead th:first-child { width: 76px; }
.fr-bt tbody th { background: #f3f7fc; color: var(--ink-2); }
.fr-n { font: 16px/1 "PokemonGBA", monospace; letter-spacing: 0; color: var(--ink); }
.fr-val small, .fr-bt td small { color: var(--ink-3); font-size: 12px; }
.fr-none { color: var(--ink-3); font-size: 12px; }
/* Champion-only, for a non-Champion: greyed, dashed, the lock and why */
.fr-card.locked { border: 3px dashed var(--plain-line); background: var(--plain); }
.fr-card.locked.on { border-color: var(--sel-line); }
.fr-card.locked .fr-fi { border-color: var(--plain-line); background: #f7f7f0; }
.fr-card.locked .fr-fi svg { filter: grayscale(1); opacity: .6; }
.fr-card.locked .fr-cardbtn { color: var(--ink-2); }
.fr-lock { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 2px solid var(--plain-line); border-radius: 8px; background: #fff; color: var(--ink-2); font-size: 13px; line-height: 1.3; }
.fr-lock b { color: var(--ink); }

/* ------------------------------------------------------------------ the all-time leaderboard (f2, f3) */
.fr-board { flex: none; display: flex; flex-direction: column; border: 3px solid var(--frame); border-radius: 12px; background: #fff; overflow: hidden; }
.fr-board-h { flex: none; display: flex; align-items: center; gap: 8px; padding: 7px 12px 6px; border-bottom: 3px solid var(--rule); background: linear-gradient(#cfe6fa, #eef6fd); }
.fr-board-h h2 { font-size: 15px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.fr-board-h .fr-kick { margin-left: auto; min-width: 0; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.fr-board-b { display: flex; flex-direction: column; gap: 7px; padding: 9px 10px 10px; }
/* the six facilities: three a row, an icon and its short name (a phone: six icons) */
.fr-pickers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.fr-fpk { display: flex; align-items: center; justify-content: flex-start; gap: 6px; min-width: 0; height: 40px; padding: 0 8px 0 4px; border: 3px solid var(--plain-line); border-radius: 8px; background: var(--plain); color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; }
.fr-fpk-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fr-fpk[aria-pressed="true"], .fr-sg[aria-pressed="true"] { border-color: var(--sel-line); background: var(--sel); }
@media (hover: hover) { .fr-fpk:not([aria-pressed="true"]):hover, .fr-sg:not([aria-pressed="true"]):hover { border-color: var(--sel-line); } }
.fr-pickers.icons { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.fr-pickers.icons .fr-fpk { justify-content: center; padding: 0; }
/* Battle (or the Café's Mode) and Level */
.fr-seg { display: flex; align-items: center; gap: 4px; padding: 3px; border: 3px solid var(--blue); border-radius: 8px; background: var(--sky); }
.fr-sl { flex: none; width: 52px; padding-left: 2px; color: var(--ink-3); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.fr-sg { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 5px; height: 34px; padding: 0 4px; border: 2px solid var(--plain-line); border-radius: 6px; background: var(--plain); color: var(--ink); font-size: 14px; font-weight: 600; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the board's name, then its rows */
.fr-mname { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin-top: 2px; padding-top: 7px; border-top: 2px dashed var(--rule); font-size: 15px; }
.fr-mname .fr-kick { margin-left: auto; font-size: 11px; }
.fr-lrows { display: flex; flex-direction: column; }
.fr-lhead, .fr-lrow, .fr-lrow-me { display: grid; grid-template-columns: 30px minmax(0, 1fr) 74px 96px; align-items: center; column-gap: 8px; padding: 1px 8px 1px 4px; border-radius: 6px; }
.fr-lhead { min-height: 22px; color: var(--ink-3); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.fr-lhead .fr-r { text-align: right; }
.fr-lrow, .fr-lrow-me { min-height: 35px; font-size: 15px; }
.fr-lrows .fr-lrow:nth-child(even) { background: #f3f7fc; }
.fr-lrow.me, .fr-lrow-me { background: var(--sel) !important; box-shadow: inset 0 0 0 2px var(--sel-line); }
.fr-rk { color: var(--ink-3); font: 16px/1 "PokemonGBA", monospace; text-align: center; }
.fr-tn { display: flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; }
.fr-tn b { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fr-faceslot { flex: none; display: flex; line-height: 0; }
.fr-faceslot .px-face { width: 28px; height: 28px; border-radius: 5px; font-size: 13px; }
.fr-you { flex: none; display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border: 2px solid var(--sel-line); border-radius: 4px; background: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.fr-gc { min-width: 0; overflow: hidden; }
.fr-gc .gd-tag { height: 20px; padding: 0 5px; font-size: 12px; }
.fr-nog { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.fr-val { text-align: right; white-space: nowrap; }
.fr-gap { margin: -4px 0 -6px; color: var(--ink-3); text-align: center; letter-spacing: .3em; }
.fr-meline { display: block; padding: 0 4px; color: var(--ink-2); font-size: 13px; line-height: 1.35; }
.fr-meline b { color: var(--ink); }
.fr-meline.in { padding: 6px 8px; border: 2px solid var(--sel-line); border-radius: 8px; background: #fff8ec; }
.fr-loading, .fr-empty { padding: 10px 4px; color: var(--ink-2); font-size: 14px; text-align: center; }
.fr-hidn { display: flex; align-items: flex-start; gap: 8px; padding: 6px 9px; border: 2px dashed var(--rule); border-radius: 8px; background: #f7fbff; color: var(--ink-2); font-size: 13px; line-height: 1.35; }
.fr-hidn .hub-pix { margin-top: 3px; }
.fr-hidn b { color: var(--ink); }

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

/* a smaller computer: one scroller, the cards then the board under them */
@media (max-width: 1099px) {
  .fr-win.desk .fr-main { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ring) transparent; }
  .fr-win.desk .fr-main > .fr-left, .fr-win.desk .fr-main > .fr-side { flex: none; min-height: auto; overflow: visible; }
  .fr-win.desk .fr-title .fr-kick { display: none; }
}
@media (max-width: 1279px) {
  .fr-bp-note { display: none; }
}

/* ------------------------------------------------------------------ a phone (f5, f6) */
/* a bottom sheet under the bar (#windows starts under it), a grab handle;
   one column that scrolls; the cards stacked (two a row on a wide short
   screen); 44 px pickers and segments, the board's full name under them */
.pxui.fr-win.phone { left: 0; right: 0; top: 4px; bottom: 0; width: auto; height: auto; max-width: none; max-height: none; transform: none; padding: 0 10px; border-bottom-width: 0; border-radius: 16px 16px 0 0; }
.fr-grab { flex: none; width: 48px; height: 6px; margin: 7px auto 6px; border-radius: 3px; background: var(--rule); }
.fr-win.phone .fr-head { gap: 6px; padding-bottom: 8px; }
.fr-win.phone h1 { font-size: 16px; letter-spacing: .03em; }
.fr-win.phone .fr-title { overflow: hidden; }
.fr-win.phone .fr-back { height: 44px; padding: 0 9px; font-size: 14px; }
.fr-win.phone .fr-help, .fr-win.phone .fr-x { width: 44px; height: 44px; }
.fr-win.phone .fr-main { display: flex; flex-direction: column; gap: 8px; margin: 0 -4px; padding: 8px 4px 14px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ring) transparent; }
.fr-win.phone .fr-main > * { flex: none; }
.fr-win.phone .fr-bp { align-self: flex-start; min-height: 0; padding: 0; border: 0; background: none; font-size: 14px; }
.fr-win.phone .fr-bp-note { display: inline; font-size: 12px; }
.fr-best { display: flex; align-items: flex-start; gap: 8px; padding: 7px 9px; border: 2px solid var(--rule); border-radius: 8px; background: #fff; font-size: 13px; line-height: 1.35; }
.fr-best .hub-pix { margin-top: 2px; }
.fr-win.phone .fr-lvline { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; row-gap: 5px; padding: 6px 8px; border: 2px solid var(--rule); border-radius: 8px; background: #fff; font-size: 12px; }
.fr-win.phone .fr-lvr + .fr-lvk { margin-left: 0; }
.fr-win.phone .fr-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.fr-win.phone .fr-what { font-size: 12px; }
.fr-win.phone .fr-fpk, .fr-win.phone .fr-sg { height: 44px; }
.fr-win.phone .fr-sg { font-size: 13px; }
.fr-win.phone .fr-sl { width: 44px; font-size: 10px; }
.fr-win.phone .fr-board-b { gap: 6px; padding: 7px 8px 8px; }
.fr-win.phone .fr-lhead, .fr-win.phone .fr-lrow, .fr-win.phone .fr-lrow-me { grid-template-columns: 24px minmax(0, 1fr) 56px 72px; column-gap: 6px; padding: 1px 4px 1px 2px; }
.fr-win.phone .fr-lrow, .fr-win.phone .fr-lrow-me { min-height: 31px; font-size: 14px; }
.fr-win.phone .fr-lhead { font-size: 10px; letter-spacing: .03em; white-space: nowrap; }
.fr-win.phone .fr-tn { gap: 5px; }
.fr-win.phone .fr-hidn { font-size: 12px; }
@media (max-width: 360px) {
  .fr-win.phone .fr-mark { display: none; }
  .fr-win.phone .fr-lhead, .fr-win.phone .fr-lrow, .fr-win.phone .fr-lrow-me { grid-template-columns: 22px minmax(0, 1fr) 50px 66px; }
}

/* a short screen (1280 × 600, a phone on its side): the head compact */
@media (max-height: 520px) {
  .pxui.fr-win.desk { padding: 8px 10px 10px; }
  .fr-head { gap: 8px; padding-bottom: 6px; }
  .fr-win.phone .fr-grab { margin: 4px auto 3px; }
}

/* ------------------------------------------------------------------ touch: 44 px targets */
@media (pointer: coarse) {
  .fr-win .px-btn, .fr-fpk, .fr-sg, .fr-cardbtn, .fr-x, .fr-help, .fr-back { min-height: 44px; }
  .fr-x, .fr-help, .fr-back { min-width: 44px; }
}
