/* ---------------------------------------------------------------------------
   Coaching → Coach Abilities (src/abilities_view.js): the coach on the left,
   the web of his six archetypes in the middle, what you tapped on the right.
   The room kit's windows (src/room.css); the badge medals are the player
   badges' shiny tier medals (src/skilltree.js badgeIcon, .skb-med). Every tap target is 44px or more.
--------------------------------------------------------------------------- */
.ab .ab-grid { display: grid; grid-template-columns: minmax(150px, 172px) minmax(0, 1fr) minmax(206px, 248px); gap: 10px; align-items: start; }
.ab .ab-grid.ab-vac { grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); }
.ab .rm-win > .rm-wb { padding: 8px; }

/* ---- left: the coach ---- */
.ab-tabs { display: grid; gap: 4px; margin-bottom: 8px; }
.ab-tab { min-height: 44px; padding: 4px 8px; border: 0; cursor: pointer; text-align: left;
  font: 800 12px/1.1 var(--sans); letter-spacing: .02em; text-transform: uppercase;
  background: var(--ink-2); color: #fff; box-shadow: var(--frame-2); }
.ab-tab.on { background: var(--gold); color: var(--ink); }
.ab-vac .ab-tab { display: block; width: 100%; margin-bottom: 6px; }
.ab-who { display: flex; gap: 8px; align-items: center; }
.ab-who .rm-fc { flex: none; }
.ab-id { display: grid; gap: 2px; min-width: 0; }
.ab-nm { font: 400 18px/1 var(--disp); letter-spacing: .4px; text-transform: uppercase; color: #fff; overflow-wrap: anywhere; }
.ab-rl { font: 700 11px/1.1 var(--sans); color: var(--soft); }
.ab-gr { justify-self: start; min-width: 34px; padding: 3px 6px; text-align: center; font: 400 20px/1 var(--disp);
  background: #fff; color: var(--ink); box-shadow: var(--frame-2); }
.ab-wear { margin-top: 8px; padding: 6px 8px; display: grid; gap: 2px; background: var(--win-2); box-shadow: var(--frame-2); }
.ab-wear .k, .ab-perk .k { font: 900 10px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.ab-wear b { font: 400 18px/1 var(--disp); letter-spacing: .4px; text-transform: uppercase; color: #fff; }
.ab-wear.on b { color: var(--gold); }
.ab-pk { font: 700 12px/1.25 var(--sans); color: #fff; }
.ab-pts { margin-top: 8px; display: flex; gap: 6px; align-items: baseline; font: 700 12px/1 var(--sans); color: var(--soft); }
.ab-pts b { font: 400 24px/1 var(--disp); color: #fff; }
.ab-pts.on b { color: var(--gold); }

/* ---- middle: the web ----
   The box is a size container: a tile's place is the middle plus --c/--s
   (its direction) times --rx/--ry, the room left once a tile's half-size
   (--hw/--hh) is kept inside, so nothing is cut off at any size. */
.ab-mid { min-width: 0; }
.ab .ab-mid > .rm-wb { display: flex; flex-direction: column; padding: 6px; width: 100%; }
.ab-focus { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.ab-wheel { position: relative; flex: 1 1 auto; width: 100%; min-height: 330px; container-type: size; }
.ab-wheel > * { --ry: min(calc(50cqh - var(--hh) - 4px), 175px);
  --rx: min(calc(50cqw - var(--hw) - 4px), calc(var(--ry) * 1.6 + 20px)); }
/* a tile's half-size, set on what sits in the box (the box's own size is
   only known inside it), larger when the phone gives more room */
.ab-six > * { --hw: 64px; --hh: 39px; }
.ab-fan > * { --hw: 50px; --hh: 43px; }
.ab-web { position: absolute; left: calc(50% - var(--rx)); top: calc(50% - var(--ry)); width: calc(2 * var(--rx)); height: calc(2 * var(--ry));
  overflow: visible; pointer-events: none; }
.ab-rings polygon { fill: none; stroke: var(--rule); stroke-width: 2; }
.ab-rings polygon:first-child { fill: rgba(7, 13, 28, .55); }
.ab-spokes line { stroke: var(--rule); stroke-width: 2; stroke-dasharray: 4 3; }
.ab-fan .ab-spokes line { stroke: color-mix(in srgb, var(--gold) 55%, var(--rule)); stroke-dasharray: none; }
.ab-radar { fill: color-mix(in srgb, var(--tm, #1e63d6) 62%, transparent); stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.ab-rdot { position: absolute; width: 7px; height: 7px; background: var(--gold); box-shadow: 0 0 0 1px var(--ink);
  left: calc(50% + var(--c) * var(--rx) * var(--f) - 3.5px); top: calc(50% + var(--s) * var(--ry) * var(--f) - 3.5px); }
.ab-node { position: absolute; padding: 0; border: 0; cursor: pointer; background: transparent; -webkit-tap-highlight-color: transparent;
  width: calc(2 * var(--hw)); height: calc(2 * var(--hh));
  left: calc(50% + var(--c) * var(--rx) - var(--hw)); top: calc(50% + var(--s) * var(--ry) - var(--hh)); }
.ab-node.sel { outline: 3px solid var(--gold); outline-offset: 2px; z-index: 2; }
.ab-node.pop { animation: abPop .45s steps(3); }
@keyframes abPop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* an archetype tile: its icon, its name, a bar of the tiers he holds, and
   whether it is his, open or locked */
.ab-cat, .ab-hub { display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; gap: 4px 7px;
  align-items: center; padding: 6px 7px 5px; text-align: left; color: #fff;
  background: linear-gradient(180deg, #1d3557, #142640); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px #3c5a82, 0 4px 0 0 rgba(0,0,0,.35); }
.ab-cat:hover, .ab-cat:focus-visible { filter: brightness(1.12); }
.ab-cat:active { transform: translateY(2px); }
.ab-ci { grid-row: 1; grid-column: 1; width: 34px; height: 34px; display: grid; place-items: center; background: #fff;
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px #b9c3cf; }
.ab-ci .ab-gl { width: 24px; height: 24px; }
.ab-cn { grid-row: 1; grid-column: 2; font: 400 14px/1.02 var(--disp); letter-spacing: .4px; text-transform: uppercase; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ab-cb { grid-column: 1 / -1; height: 7px; background: rgba(0,0,0,.45); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.ab-cb > i { display: block; height: 100%; background: var(--gold); }
.ab-cm { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 4px; font: 900 11px/1 var(--sans); }
.ab-cm small { font-size: 9px; color: var(--soft); }
.ab-cm em { font-style: normal; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; padding: 2px 4px; display: inline-flex; gap: 3px; align-items: center; }
.ab-cm .ab-lk { position: static; width: 8px; height: 9px; color: var(--soft); }
.ab-cat.open .ab-ci, .ab-hub.open .ab-ci { background: #a7f3c0; box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px #5fcf8a; }
.ab-cat.open em, .ab-hub.open em { background: #a7f3c0; color: var(--ink); }
.ab-cat.worn, .ab-hub.worn { background: linear-gradient(180deg, #2b4a78, #1b335a); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--gold), 0 0 12px 2px rgba(255,211,77,.45), 0 4px 0 0 rgba(0,0,0,.35); }
.ab-cat.worn .ab-ci, .ab-hub.worn .ab-ci { background: var(--gold); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px #fff3b0; }
.ab-cat.worn .ab-cn, .ab-hub.worn .ab-cn { color: var(--gold); }
.ab-cat.worn em, .ab-hub.worn em { background: var(--gold); color: var(--ink); }
.ab-cat.shut .ab-ci, .ab-hub.shut .ab-ci { background: var(--ink-2); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--rule); }
.ab-cat.shut em, .ab-hub.shut em { color: var(--soft); background: rgba(0,0,0,.3); }

/* one archetype open: it sits in the middle, its badges round it */
.ab-hub { position: absolute; left: calc(50% - 60px); top: calc(50% - 30px); width: 120px; height: 60px; z-index: 1;
  grid-template-rows: minmax(0, 1fr) auto; padding: 5px 7px 6px; }
.ab-fbar { flex: none; display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.ab-back { min-height: 44px; padding: 0 12px; border: 0; cursor: pointer; white-space: nowrap; background: #fff; color: var(--ink);
  font: 400 15px/1 var(--disp); letter-spacing: .4px; text-transform: uppercase; box-shadow: 0 0 0 2px var(--ink), 0 3px 0 0 rgba(0,0,0,.4); }
.ab-back span { font-size: 11px; margin-right: 2px; }
.ab-minis { display: flex; gap: 4px; min-width: 0; }
.ab-mini { width: 44px; height: 44px; padding: 0; border: 0; cursor: pointer; display: grid; place-items: center; flex: none;
  background: #fff; box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px #b9c3cf; }
.ab-mini .ab-gl { width: 22px; height: 22px; }
.ab-mini.open { background: #a7f3c0; box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px #5fcf8a; }
.ab-mini.worn { background: var(--gold); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px #fff3b0; }
.ab-mini.shut { background: var(--ink-2); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--rule); }
.ab-mini.on { outline: 3px solid var(--gold); outline-offset: 2px; position: relative; z-index: 1; }
.ab-mini.shut.on { outline-color: #fff; }

/* a badge: its tier medal, its name, its tier */
.ab-bn { display: grid; grid-template-rows: 44px minmax(0, 1fr) auto; justify-items: center; align-items: center; gap: 1px; padding: 1px 3px 5px;
  background: linear-gradient(180deg, #13243d, #0b1729); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 1px rgba(255,255,255,.14), 0 3px 0 0 rgba(0,0,0,.35); color: #fff; }
.ab-bn:hover { background: linear-gradient(180deg, #1d3557, #142640); }
.ab-md { position: relative; display: grid; place-items: center; width: 44px; height: 44px; }
.ab-md .skb-med { width: 38px; height: 42px; }
.ab-md .skb-ico .skt-bdg { width: 36px; height: 36px; }
.ab-md .ab-lk { position: absolute; right: 1px; bottom: 1px; width: 12px; height: 14px; color: var(--gold); }
.ab-bnm { font: 800 11px/1.1 var(--sans); text-align: center; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ab-bn .ab-tn { font-size: 8px; padding: 2px 4px; }
.ab-bn.t0 .ab-md { opacity: .9; }
.ab-bn.sel { background: linear-gradient(180deg, #3a3110, #241e08); }
.ab-fanin .ab-bn { animation: abFan .32s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i) * 35ms); }
.ab-fanin .ab-spokes { animation: abIn .3s ease-out both; }
@container (min-width: 500px) and (min-height: 320px) {
  .ab-six > * { --hw: 74px; --hh: 44px; }
  .ab-six .ab-cn { font-size: 16px; }
  .ab-six .ab-cat { grid-template-columns: 38px minmax(0, 1fr); padding: 7px 8px 6px; }
  .ab-six .ab-ci { width: 38px; height: 38px; }
  .ab-six .ab-ci .ab-gl { width: 26px; height: 26px; }
  .ab-fan > * { --hw: 56px; --hh: 47px; }
  .ab-fan .ab-bnm { font-size: 12px; }
  .ab-fan .ab-bn { grid-template-rows: 48px minmax(0, 1fr) auto; }
  .ab-fan .ab-md { width: 48px; height: 48px; }
  .ab-fan .ab-md .skb-med { width: 42px; height: 46px; }
  .ab-fan .ab-hub { left: calc(50% - 68px); top: calc(50% - 32px); width: 136px; height: 64px; }
  .ab-fan .ab-hub .ab-cn { font-size: 15px; }
}
@keyframes abFan { from { opacity: 0; transform: translate(calc(var(--c) * var(--rx) * -1), calc(var(--s) * var(--ry) * -1)) scale(.35); } }
@keyframes abIn { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ab-fanin .ab-bn, .ab-fanin .ab-spokes, .ab-node.pop { animation: none; } }

/* ---- right: what you tapped ---- */
.ab-side .rm-wb { max-height: calc(100dvh - 120px); overflow-y: auto; }
.ab-h { display: flex; gap: 8px; align-items: center; }
.ab-h > div { display: grid; gap: 3px; justify-items: start; }
.ab-h .ab-gl { width: 32px; height: 32px; }
.ab-t { font: 400 20px/1 var(--disp); letter-spacing: .4px; text-transform: uppercase; color: #fff; }
.ab-does { margin: 6px 0; font: 700 13px/1.3 var(--sans); color: #fff; }
.ab-perk { margin: 6px 0; padding: 6px 8px; display: grid; gap: 3px; background: var(--win-2); box-shadow: var(--frame-2);
  font: 700 13px/1.3 var(--sans); color: #fff; }
.ab-tiers { display: grid; gap: 3px; margin: 6px 0; }
.ab-tr { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 4px 6px;
  background: var(--card); color: var(--card-ink); font: 700 11px/1.2 var(--sans); }
.ab-tr.nx { background: var(--gold); }
.ab-tr.got .ab-tx::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: var(--green); box-shadow: 0 0 0 1px var(--ink); }
.ab-tr .ab-lk { width: 11px; height: 13px; color: var(--ink); }
.ab-tn { font: 900 9px/1 var(--sans); letter-spacing: .04em; text-transform: uppercase; padding: 3px 4px; text-align: center; color: #fff; background: var(--ink-2); }
/* the player badges' tier colours (src/pbadges.css) */
.ab-tn.t1 { background: #d08a45; color: #1a1206; } .ab-tn.t2 { background: #d6dde6; color: #1a1206; } .ab-tn.t3 { background: #f6c945; color: #1a1206; }
.ab-tn.t4 { background: #a66bff; } .ab-tn.t5 { background: linear-gradient(90deg, #ff4f8b, #ffb13b, #3be3ff, #a66bff); text-shadow: 0 1px 0 rgba(0,0,0,.5); }
.ab-sub { margin: 8px 0 4px; font: 900 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.ab-req { display: flex; justify-content: space-between; gap: 6px; font: 700 12px/1.2 var(--sans); color: #fff; }
.ab-req b { font-weight: 900; }
.ab-bar { height: 10px; margin: 3px 0 6px; background: var(--rule); box-shadow: var(--frame-2); }
.ab-bar > i { display: block; height: 100%; background: var(--orange); }
.ab-bar.ok > i { background: var(--green); }
.ab .ab-up, .ab .ab-wearb { min-height: 44px; width: calc(100% - 6px); margin-top: 8px; white-space: normal; text-align: center;
  font-size: 17px; line-height: 1.05; padding: 6px 8px; }
/* what the next tier takes and Upgrade stay in sight at the foot of the
   panel while the tiers above scroll (a phone is short) */
.ab-foot { position: sticky; bottom: -8px; z-index: 1; margin: 0 -8px; padding: 2px 8px 8px; background: var(--win, #0f1e38);
  box-shadow: 0 -6px 8px -4px rgba(0,0,0,.55); }
.ab-foot .ab-sub { margin-top: 6px; }
.ab-foot .ab-up { margin-top: 4px; }
.ab-why { margin-top: 4px; font: 700 11px/1.3 var(--sans); color: var(--soft); }
.ab-why.ok { color: #a7f3c0; }
.ab-done { margin-top: 8px; font: 800 13px/1.3 var(--sans); color: #a7f3c0; }
.ab-use { margin-top: 4px; font: 700 12px/1.2 var(--sans); color: #fff; }
.ab-in { margin-top: 8px; font: 700 12px/1 var(--sans); color: var(--soft); display: flex; gap: 6px; align-items: center; }
.ab-link { min-height: 44px; padding: 0 10px; border: 0; cursor: pointer; background: var(--ink-2); color: var(--gold);
  font: 800 12px/1 var(--sans); box-shadow: var(--frame-2); }
.ab-list { display: grid; gap: 4px; }
.ab-row { min-height: 44px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 2px 6px;
  border: 0; cursor: pointer; text-align: left; background: var(--card); color: var(--card-ink); font: 800 12px/1.15 var(--sans); }
.ab-row:hover, .ab-row.on { background: var(--gold); color: var(--ink); }
.ab-row span { font: 900 10px/1 var(--sans); text-transform: uppercase; color: var(--card-ink); opacity: .75; }
.ab-row:hover span, .ab-row.on span { color: var(--ink); opacity: 1; }
.ab-row .skb-ico .skt-bdg { width: 30px; height: 30px; }
.ab-row .skb-med { width: 28px; height: 31px; justify-self: center; }
.ab-h .skb-med { width: 44px; height: 48px; flex: none; }
.ab-row.on { background: var(--gold); }
.ab-arow .ab-gl { width: 24px; height: 24px; justify-self: center; }
.ab-arow > b { display: grid; gap: 4px; }
.ab-bar.mini { height: 5px; margin: 0; box-shadow: none; background: rgba(255,255,255,.14); }
.ab-bar.mini > i { background: var(--gold); }
.ab-row:hover .ab-bar.mini > i, .ab-row.on .ab-bar.mini > i { background: var(--ink); }
.ab-arow.worn { box-shadow: inset 4px 0 0 var(--gold); }
.ab-err { margin-bottom: 6px; padding: 6px 8px; background: var(--red); color: #fff; font: 800 12px/1.3 var(--sans); }

/* a phone held sideways: the three windows fill the screen under the menus
   and each scrolls inside itself, so the panel on the right is as tall as
   the web (heights x1.25: the page is drawn at .8 zoom, src/phone.css) */
@media (orientation: landscape) and (max-height: 520px) {
  .ab .ab-grid { height: calc((100vh - 104px) * 1.25); height: calc((100dvh - 104px) * 1.25); min-height: 300px; align-items: stretch; }
  .ab .ab-grid > .rm-win { min-height: 0; display: flex; flex-direction: column; }
  .ab .ab-grid > .rm-win > .rm-wb { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; }
  .ab .ab-mid > .rm-wb { overflow: hidden; }
  .ab-wheel { min-height: 0; }
}

/* a phone held the other way, or a narrow window: the web on top */
@media (max-width: 760px) and (orientation: portrait) {
  .ab .ab-grid { grid-template-columns: minmax(0, 1fr); }
}
