.q { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.q-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 19px; line-height: 1.3; color: var(--ink); margin: 0; }
.q-w { white-space: nowrap; }
.q-cl { display: contents; }
.q-punct { margin-left: -7px; }

.cf { position: relative; display: inline-flex; align-items: center; border: 1.5px solid var(--n-hi); background: #000; padding: 0 10px; min-height: 38px; min-width: 0; max-width: 100%; }
/* A field sized by `size` is drawn 10px narrower here than in the prototype at every length (the
   browser adds a term from the font's metrics, and the self-hosted subset's differ), so the frame
   gives it those 10px on the right: the same width as the prototype's for the same name. */
.cf { padding-right: 20px; }
.cf:hover { background: var(--n-lift); }
.cf:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
.cf input { border: 0; outline: 0; background: none; color: var(--white); font: 600 18px/1.2 var(--body); padding: 6px 0; min-width: 0; max-width: 100%; }
.cf .blk { display: none; height: 20px; width: 9px; margin-left: 2px; }
.cf:focus-within .blk { display: inline-block; }
.cf:has(input:placeholder-shown) .blk { order: -1; margin: 0 2px 0 0; }
.cf input:placeholder-shown { caret-color: transparent; }
@supports (field-sizing: content) {
  .cf { padding-right: 10px; }
  .cf input { field-sizing: content; }
}
.cf:has(input[aria-invalid="true"]) { border-style: dashed; }
.deck-search-note { font: 400 13px/1.45 var(--body); color: var(--n-hi); }
.deck-search-note[hidden] { display: none; }

.cf .player-search-results { position: absolute; z-index: 30; left: -1.5px; top: calc(100% + 6px); width: max(calc(100% + 3px), 22rem); max-width: calc(100vw - 2 * var(--gut)); }
.cf .player-suggestions {
  display: flex; flex-direction: column; max-height: min(26rem, calc(100vh - 160px)); overflow-y: auto; overscroll-behavior: contain;
  background: var(--raised); border: 1.5px solid var(--n-hi); padding: 4px; box-shadow: 0 0 0 4px var(--field); text-align: left;
}
.cf .player-suggestions[hidden] { display: none; }
.cf .player-search-results:empty { display: none; }
.cf .pk-row { grid-template-columns: 7px minmax(0, 1fr); cursor: pointer; }
.cf .pk-row:focus { outline: 2px solid #000; outline-offset: -2px; }
.cf .pk-row:focus::before { display: block; }
.cf .pk-row:focus .il { background: #000; outline: 0; }
.cf .pk-row:focus, .cf .pk-row:focus span { color: #000; }

.card-sr .cn { position: relative; }


.rm { position: relative; display: inline-block; text-align: center; text-decoration: none; width: 30px; height: 30px; border: 1.5px solid var(--n-mid); background: #000; padding: 0; }
.rm span::before, .rm span::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 2px; margin: -1px 0 0 -7px; background: var(--n-hi); transform: rotate(45deg); }
.rm span::after { transform: rotate(-45deg); }
.rm:hover { background: var(--n-hi); border-color: var(--n-hi); }
.rm:hover span::before, .rm:hover span::after { background: #000; }
.rm:active { background: var(--n-dim); }

.addc { text-align: center; display: inline-flex; align-items: stretch; border: 1.5px solid var(--n-mid); background: #000; padding: 0; color: var(--n-hi); font: 600 16px/1 var(--body); text-decoration: none; }
.addc > span:last-child { display: flex; align-items: center; padding: 7px 12px; }
.addc-p { display: flex; align-items: center; justify-content: center; width: 32px; border-right: 1.5px solid var(--n-mid); font: 700 20px/1 var(--label); }
.addc:hover { background: var(--n-hi); color: #000; }
.addc:hover .addc-p { border-color: #000; }
.addc:active { background: var(--n-dim); }
.addc[hidden] { display: none; }

.go { display: flex; align-items: stretch; border: 0; border-left: 1px solid var(--n-hi); background: var(--n-hi); color: #000; padding: 0; cursor: pointer; }
.go .sq-y { --sx: .6; --fs: 22px; }
.go > span:first-child { display: flex; align-items: center; padding: 0 18px; }
.go-a { display: flex; align-items: center; padding: 0 12px; border-left: 1px solid #000; font-family: var(--body); }
.go:hover { background: var(--ink); }
.go:active { background: var(--n-dim); }
.go:focus-visible { outline: 2px solid #000; outline-offset: -5px; }
.q-go { min-height: 44px; margin-left: 6px; }
.q-go .sq-y { --sx: .6; --fs: 22px; }

.pair-res { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.ctrs-res { --n: 1; max-width: 260px; margin-bottom: 4px; }
.grps { display: flex; flex-direction: column; gap: 22px; margin-top: 18px; }
.grp { border: 1px solid var(--n-mid); padding: 12px; position: relative; }
.grp::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border: 0 solid var(--n-hi); border-width: 0 3px 3px 0; }
.grp-h { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.grp-chip { width: 64px; height: 40px; }
.grp-t { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.grp-n { color: var(--white); font: inherit; line-height: 1; margin: 0; }
.grp-n .sq-y { --sx: .6; --fs: 22px; }
.grp-n > a { color: inherit; text-decoration: none; }
.grp-n > a .sq-y { text-decoration: underline dotted var(--n-dim); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.grp-n > a:hover .sq-y { color: var(--n-hi); text-decoration-style: solid; text-decoration-color: var(--n-hi); }
.grp-n > a:focus-visible { outline-offset: 3px; }
.grp-n .sq-y { max-width: 100%; white-space: normal; }
.bank-none .bs { border-style: dotted; }
.grp-d { font-size: 12px; color: var(--ink-2); }
.grp-c { display: flex; align-items: baseline; gap: 6px; color: var(--val); margin: 0; }
.grp-cn { --fs: 30px; }
.grp-cw { font: 700 12px/1 var(--label); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.grp-bar { display: flex; align-items: center; gap: 10px; margin: 10px 0 8px; }
.gbar { flex: 1; height: 12px; border: 1px solid var(--n-line); position: relative; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), var(--n-line) calc(10% - 1px) 10%); }
.gbar > i { position: absolute; left: 0; top: 0; bottom: 0; min-width: 2px; background: repeating-linear-gradient(90deg, var(--val) 0 5px, transparent 5px 7px); }
.grp-top .gbar > i { background: repeating-linear-gradient(90deg, var(--n-hi) 0 5px, transparent 5px 7px); }
.grp-s { width: 34px; text-align: right; font-size: 13px; color: var(--ink); }
.pk-s .pk-row { grid-template-columns: 7px 46px minmax(0, 1fr) auto; padding: 6px 8px; }
.grp-more { margin-top: 10px; }
.grp > .pk-list[hidden]:target { display: block; }
.grp-more + .pk-list { margin-top: 10px; }

@media (scripting: none) { .pair-res > .inst-deck { display: block; } }
@media (scripting: none) { .tc-search .ttl-l { overflow-wrap: anywhere; } }
@media (max-width: 1240px) { .pair-res { grid-template-columns: minmax(0, 1fr); } }

@media (max-width: 640px) {
  .go { flex-basis: 100%; border-left: 0; border-top: 1px solid var(--n-hi); justify-content: space-between; min-height: 44px; }
  .q-line { font-size: 17px; gap: 10px; }
  .q-cl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-basis: 100%; min-width: 0; }
  .q-cl > .q-punct { margin-left: -5px; }
  .q-go { margin-left: 0; }
  .dc-b, .dc-s, .cf input { font-size: 16px; }
  .dc-pop { max-width: calc(100vw - 60px); }
  .q-cl:has(> .cf) { position: relative; }
  .q-cl > .cf { position: static; }
  .cf .player-search-results { left: 0; right: 0; width: auto; max-width: none; top: calc(100% + 6px); }
  .grp-chip { width: 48px; height: 32px; }
  .grp-n .sq-y { --fs: 20px; }
  .pk-s .pk-row { grid-template-columns: 7px 40px minmax(0, 1fr); }
  .pk-s .pk-tags { display: none; }
}

@media (prefers-reduced-motion: no-preference) and (scripting: enabled) {
  [data-qi="1"] { --qi: 1; } [data-qi="2"] { --qi: 2; } [data-qi="3"] { --qi: 3; } [data-qi="4"] { --qi: 4; }
  [data-qi="5"] { --qi: 5; } [data-qi="6"] { --qi: 6; } [data-qi="7"] { --qi: 7; } [data-qi="8"] { --qi: 8; }
  [data-qi="9"] { --qi: 9; } [data-qi="10"] { --qi: 10; } [data-qi="11"] { --qi: 11; } [data-qi="12"] { --qi: 12; }
  [data-qi="13"] { --qi: 13; } [data-qi="14"] { --qi: 14; } [data-qi="15"] { --qi: 15; } [data-qi="16"] { --qi: 16; }
  [data-qi="17"] { --qi: 17; } [data-qi="18"] { --qi: 18; } [data-qi="19"] { --qi: 19; } [data-qi="20"] { --qi: 20; }
  [data-qi="21"] { --qi: 21; } [data-qi="22"] { --qi: 22; } [data-qi="23"] { --qi: 23; } [data-qi="24"] { --qi: 24; }
  [data-qi="25"] { --qi: 25; } [data-qi="26"] { --qi: 26; } [data-qi="27"] { --qi: 27; } [data-qi="28"] { --qi: 28; }
  [data-qi="29"] { --qi: 29; } [data-qi="30"] { --qi: 30; } [data-qi="31"] { --qi: 31; } [data-qi="32"] { --qi: 32; }
  [data-qi]:not([data-qi="0"], [data-qi="1"], [data-qi="2"], [data-qi="3"], [data-qi="4"], [data-qi="5"], [data-qi="6"], [data-qi="7"], [data-qi="8"], [data-qi="9"], [data-qi="10"], [data-qi="11"], [data-qi="12"], [data-qi="13"], [data-qi="14"], [data-qi="15"], [data-qi="16"], [data-qi="17"], [data-qi="18"], [data-qi="19"], [data-qi="20"], [data-qi="21"], [data-qi="22"], [data-qi="23"], [data-qi="24"], [data-qi="25"], [data-qi="26"], [data-qi="27"], [data-qi="28"], [data-qi="29"], [data-qi="30"], [data-qi="31"]) { --qi: 32; }
  html:not([data-arrived]) .inst-q.arr .q-part { animation: arr-off calc(var(--arr-d, 240ms) + 200ms + var(--qi, 0) * 35ms) steps(1, end); }

  .grps > .grp:nth-child(2) { --gi: 1; } .grps > .grp:nth-child(3) { --gi: 2; } .grps > .grp:nth-child(4) { --gi: 3; }
  .grps > .grp:nth-child(5) { --gi: 4; } .grps > .grp:nth-child(6) { --gi: 5; } .grps > .grp:nth-child(7) { --gi: 6; }
  .grps > .grp:nth-child(8) { --gi: 7; } .grps > .grp:nth-child(9) { --gi: 8; } .grps > .grp:nth-child(n+10) { --gi: 9; }
  html:not([data-arrived]) .inst-res.arr .grp-chip img { animation: arr-wipe-down 200ms steps(5, end) calc(var(--arr-d, 360ms) + 220ms + var(--gi, 0) * 60ms) backwards; }
  html:not([data-arrived]) .inst-res.arr .grp-chip .fw-br { animation: arr-snap 100ms steps(2, end) calc(var(--arr-d, 360ms) + 340ms + var(--gi, 0) * 60ms) backwards; }
  html:not([data-arrived]) .inst-res.arr .grp-h .bs.lit { animation: arr-off calc(var(--arr-d, 360ms) + 280ms + var(--gi, 0) * 22ms + var(--bi, 0) * 40ms) steps(1, end); }
  html:not([data-arrived]) .inst-res.arr .gbar > i { animation: arr-type 200ms steps(8, end) calc(var(--arr-d, 360ms) + 320ms + var(--gi, 0) * 60ms) backwards; }
  html:not([data-arrived]) .pair-res .inst-deck.arr .dk-feed .fw img { animation: none; }
  html:not([data-arrived]) .inst-res.arr .pk-list > li { animation: arr-off calc(var(--arr-d, 360ms) + 240ms + (var(--pk-o, 0) + var(--pk-i, 19)) * var(--pk-step, 24ms)) steps(1, end); }
}
