/* PvP standings first; opponent discovery opens only on Enter. */
#view-battles > .pvp-board-panel {
  margin-top: 0;
  margin-bottom: 24px;
}
.pvp-board-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  border-top: 1px solid var(--website-line-70-82-57-1, #465239);
  padding-top: 18px;
  margin-top: 18px;
}
.pvp-board-footer > .outline-button {
  min-height: 46px;
  font-size: 13px;
  justify-content: center;
}
.pvp-board-footer > .quiet-button {
  font-size: 12px;
}
#modal:has(.pvp-rankings-modal) {
  width: min(960px, calc(100% - 40px));
  max-width: 960px;
  max-height: calc(100dvh - 40px);
}
.pvp-rankings-modal {
  margin: 0;
}
.pvp-rankings-modal h2 {
  font-size: 28px;
  margin: 12px 0;
}
.pvp-rankings-modal .pvp-board-controls {
  margin: 16px 0;
}
.pvp-rankings-modal > .subtle {
  font-size: 12px;
  line-height: 1.6;
  color: var(--website-ink-182-195-166-1, #b6c3a6);
}
.pvp-rankings-modal .pvp-rankings-scroll {
  max-height: min(540px, 55dvh);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: #63734f #1a2017;
  margin: 15px 0;
  border: 1px solid var(--website-line-63-75-52-1, #3f4b34);
  border-radius: 9px;
}
.pvp-rankings-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--website-surface-38-46-32-1, #262e20);
  box-shadow: 0 1px var(--website-shade-70-82-57-1, #465239);
}
.pvp-rankings-scroll:focus-visible {
  outline: 2px solid var(--website-line-199-234-147-1, #c7ea93);
  outline-offset: 3px;
}
@media (max-width: 700px) {
  #modal:has(.pvp-rankings-modal) {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 24px);
    padding: 18px 14px;
  }
  .pvp-rankings-modal h2 {
    font-size: 24px;
  }
  .pvp-rankings-modal .pvp-rankings-scroll {
    max-height: 40dvh;
  }
  .pvp-rankings-modal .pvp-board-controls {
    gap: 8px;
    margin: 12px 0;
  }
  .pvp-rankings-modal .table-name > .styled-name {
    gap: 3px;
    flex-wrap: wrap;
  }
  .pvp-board-footer > .outline-button {
    width: 100%;
  }
}
.pvp-entry {
  border: 1px solid var(--website-line-83-104-61-1, #53683d);
  border-radius: 14px;
  background: linear-gradient(115deg, var(--website-surface-40-49-32-1, #283120), var(--website-surface-28-33-27-1, #1c211b));
  margin: 0 0 22px;
  overflow: hidden;
}
.pvp-entry > .pvp-energy {
  border: 0;
  background: none;
  margin: 0;
  border-radius: 0;
}
.pvp-energy-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pvp-energy-heading > .pvp-last-match {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: 44px;
  padding: 6px 11px;
  margin: 0;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
}
.history-panel .pvp-records-open {
  margin-top: 16px;
  min-height: 44px;
}
#modal .pvp-records-modal > h2 {
  margin: 0 0 12px;
}
.pvp-records-scroll {
  max-height: min(520px, calc(var(--review-popup-height, 100dvh) - 160px));
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  padding-inline-end: 6px;
}
.pvp-entry-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--website-line-83-104-61-0_4, #53683d66);
  margin: 0 22px;
  padding: 16px 0;
}
.pvp-entry-footer p {
  font-size: 12px;
  color: var(--website-ink-183-197-168-1, #b7c5a8);
  margin: 0;
  line-height: 1.5;
}
.pvp-entry-footer > .flip-button {
  width: 220px;
  min-height: 48px;
  margin: 0;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.pvp-lobby-resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.pvp-lobby-resume h2 {
  font-size: 18px;
  margin: 9px 0 0;
}
.pvp-lobby-tools {
  margin: 20px 0;
  color: var(--website-ink-170-187-153-1, #aabb99);
  font-size: 12px;
}
.pvp-lobby-tools > summary {
  cursor: pointer;
  padding: 12px 0;
}
.pvp-lobby-tools .lobby-layout {
  display: block;
}
.pvp-lobby-tools .lobby-aside {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
#modal:has(.pvp-player-browser) {
  width: min(780px, calc(100% - 40px));
  max-width: 780px;
  max-height: calc(100dvh - 40px);
}
.pvp-player-browser h2 {
  font-size: 28px;
  margin: 12px 0;
}
.pvp-player-browser .social-panel-heading {
  margin-bottom: 0;
}
.pvp-player-browser > p {
  font-size: 12px;
  line-height: 1.6;
  margin: 0 0 20px;
  color: var(--website-ink-183-197-168-1, #b7c5a8);
}
.pvp-player-browser #online-player-list {
  max-height: min(460px, 49dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 0 10px 12px 0;
  margin-top: 10px;
  scrollbar-color: #63734f #1a2017;
}
.pvp-player-browser .online-player {
  gap: 18px;
  min-height: 120px;
  padding: 20px 0;
}
.pvp-player-browser .online-player-meta {
  display: flex;
  flex-shrink: 0;
}
.pvp-player-browser .member-identity {
  min-width: 0;
  flex: 1;
}
.pvp-player-browser .member-identity strong {
  font-size: 14px;
}
.pvp-player-browser .member-identity .avatar-frame.frame-collection {
  --collection-size: 76px;
  flex-shrink: 0;
}
.pvp-player-browser .online-player > .outline-button {
  min-height: 44px;
  min-width: 104px;
  font-size: 12px;
  justify-content: center;
  flex-shrink: 0;
}
.pvp-player-note {
  display: block;
  font-size: 11px;
  color: var(--website-ink-167-185-151-1, #a7b997);
  padding-top: 14px;
  border-top: 1px solid var(--website-line-69-80-57-1, #455039);
}
@media (max-width: 700px) {
  html:has(#modal[open] .pvp-matchmaking) {
    overflow: hidden;
  }
  #view-battles > .pvp-board-panel {
    margin-bottom: 18px;
  }
  .pvp-entry-footer {
    margin: 0 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .pvp-entry-footer > .flip-button {
    width: 100%;
    min-height: 50px;
  }
  .pvp-entry-footer p {
    font-size: 12px;
  }
  .pvp-lobby-tools .lobby-aside {
    grid-template-columns: 1fr;
  }
  .pvp-lobby-resume {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }
  #modal:has(.pvp-player-browser) {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 24px);
    padding: 18px 14px;
  }
  .pvp-player-browser h2 {
    font-size: 24px;
  }
  .pvp-player-browser #online-player-list {
    max-height: 46dvh;
    padding-right: 5px;
  }
  .pvp-player-browser .online-player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 16px 0;
  }
  .pvp-player-browser .member-identity {
    grid-column: 1/-1;
    grid-row: 1;
  }
  .pvp-player-browser .member-identity strong {
    font-size: 13px;
  }
  .pvp-player-browser .member-identity .avatar-frame.frame-collection {
    --collection-size: 70px;
  }
  .pvp-player-browser .online-player-meta {
    text-align: left;
    gap: 5px;
    padding-left: 0;
    grid-column: 1;
    grid-row: 2;
    flex-direction: column;
    align-items: flex-start;
  }
  .pvp-player-browser .online-player > .outline-button {
    min-width: 124px;
    grid-column: 2;
    grid-row: 2;
  }
}
/* Queue search replaces the manual opponent browser. */
#modal:has(.pvp-matchmaking) {
  width: min(480px, calc(100% - 32px));
  max-width: 480px;
  padding: 22px 26px 26px;
}
.pvp-matchmaking {
  text-align: center;
  padding: 6px 12px 0;
}
.pvp-matchmaking > .eyebrow {
  color: var(--website-ink-181-205-142-1, #b5cd8e);
  letter-spacing: 2px;
  font-size: 9px;
}
.matching-radar {
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
  position: relative;
  margin: 25px auto 18px;
  isolation: isolate;
}
.matching-radar > .avatar-frame {
  --collection-size: 112px;
  z-index: 1;
}
.matching-radar > .avatar-frame:not(.frame-collection) {
  width: 80px;
  height: 80px;
}
.matching-radar > i {
  position: absolute;
  inset: 9px;
  border: 1px solid var(--website-line-159-189-103-0_25098039215686274, #9fbd6740);
  border-radius: 50%;
  border-top: 2px solid var(--website-line-211-245-154-1, #d3f59a);
  border-right: 2px solid var(--website-line-211-245-154-1, #d3f59a);
  animation: queue-orbit 3.6s linear infinite;
  box-shadow: 0 0 30px var(--website-shade-196-236-126-0_047058823529411764, #c4ec7e0c);
}
.matching-radar > i + i {
  inset: 0;
  border: 1px dashed var(--website-line-152-180-94-0_3333333333333333, #98b45e55);
  animation-direction: reverse;
  animation-duration: 12s;
}
.matching-radar:before {
  content: '';
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--website-surface-166-209-89-0_08235294117647059, #a6d15915), transparent 70%);
}
.pvp-matchmaking h2 {
  font: 500 30px var(--display);
  margin: 0 0 10px;
  letter-spacing: -0.7px;
}
.pvp-matchmaking [role='status'] > p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--website-ink-185-198-167-1, #b9c6a7);
  max-width: 310px;
  margin: 0 auto;
}
.matching-meta {
  margin: 22px 0;
  display: grid;
  gap: 9px;
  font-size: 11px;
  color: var(--website-ink-163-183-139-1, #a3b78b);
}
.matching-meta b {
  font-variant-numeric: tabular-nums;
  color: var(--website-ink-228-239-205-1, #e4efcd);
  font-weight: 500;
}
.pvp-matchmaking > .outline-button {
  width: 100%;
  min-height: 46px;
  justify-content: center;
  font-size: 13px;
}
.pvp-matchmaking > .quiet-button {
  font-size: 11px;
  padding: 10px 0;
}
.pvp-matchmaking .matching-note {
  font-size: 10px;
  line-height: 1.7;
  color: var(--website-ink-143-158-126-1, #8f9e7e);
  margin: 16px 0 0;
}
.pvp-matchmaking button:disabled {
  opacity: 0.55;
  cursor: wait;
}
@keyframes queue-orbit {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 700px) {
  #modal:has(.pvp-matchmaking) {
    width: calc(100% - 24px);
    padding: 18px 18px 24px;
    max-height: calc(100dvh - 32px);
  }
  .pvp-matchmaking {
    padding: 4px 0 0;
  }
  .matching-radar {
    width: 164px;
    height: 164px;
    margin: 18px auto;
  }
  .matching-radar > .avatar-frame {
    --collection-size: 100px;
  }
  .pvp-matchmaking h2 {
    font-size: 28px;
  }
  .matching-meta {
    margin: 18px 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .matching-radar > i {
    animation: none;
  }
}

/* Compact phone controls: preserve equal widths and readable touch targets. */
@media (max-width: 700px) {
  #view-battles > .social-heading {
    margin-bottom: 16px;
  }
  #view-battles > .social-heading h1 {
    margin: 0 0 6px;
  }
  #view-battles > .social-heading p {
    font-size: 12px;
    line-height: 18px;
  }
  .pvp-board-panel .pvp-board-controls {
    gap: 7px;
    margin: 12px 0;
  }
  .pvp-board-panel .pvp-board-controls > .segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    width: 100%;
    min-height: 38px;
    padding: 3px;
    border-radius: 10px;
  }
  .pvp-board-panel .pvp-board-controls > .segmented:last-child {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pvp-board-panel .pvp-board-controls > .segmented > button {
    width: 100%;
    min-width: 0;
    height: 32px;
    min-height: 32px;
    padding: 5px 7px;
    font-size: 11px;
    line-height: 18px;
    border-radius: 7px;
    justify-content: center;
  }
  #view-battles .pvp-board-footer {
    gap: 8px;
    padding-top: 12px;
    margin-top: 12px;
  }
  #view-battles .pvp-board-footer > .outline-button {
    height: 38px;
    min-height: 38px;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 18px;
  }
  #view-battles .pvp-board-footer > .quiet-button {
    height: 34px;
    min-height: 34px;
    padding: 6px 4px;
    font-size: 11px;
    line-height: 18px;
  }
  #view-battles .pvp-energy-actions .outline-button {
    height: 38px;
    min-height: 38px;
    padding: 7px 10px;
    font-size: 11px;
    line-height: 18px;
  }
  #view-battles .pvp-entry-footer {
    gap: 9px;
    padding: 12px 0;
  }
  #view-battles .pvp-entry-footer p {
    font-size: 11px;
    line-height: 16px;
  }
  #view-battles .pvp-entry-footer > .flip-button {
    height: 42px;
    min-height: 42px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 18px;
  }
}

/* Battle and matching fit the actual phone viewport, including browser chrome. */
@media (max-width: 700px) {
  #modal:has(.pvp-matchmaking) {
    inset: 0;
    width: calc(100% - 24px);
    max-height: calc(var(--mobile-visible-height, 100dvh) - 24px);
    margin: auto;
    padding: 16px 18px;
    border-bottom: 1px solid var(--website-line-67-82-53-1, #435235);
    border-radius: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  #modal:has(.pvp-matchmaking) .modal-top {
    margin-bottom: 10px;
    align-items: center;
  }
  #modal:has(.pvp-matchmaking) .modal-top .icon-button {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    line-height: 1;
    display: grid;
    place-items: center;
  }
  .pvp-matchmaking {
    padding: 0;
    text-align: center;
  }
  .pvp-matchmaking > .eyebrow {
    justify-content: center;
    font-size: 8px;
    line-height: 12px;
  }
  .pvp-matchmaking .matching-radar {
    width: 136px;
    height: 136px;
    margin: 14px auto;
    place-items: center;
  }
  .pvp-matchmaking .matching-radar > .avatar-frame.frame-collection {
    --collection-size: 106px;
    margin: 0;
    align-self: center;
    justify-self: center;
  }
  #modal .pvp-matchmaking h2 {
    font-size: 26px;
    line-height: 30px;
    margin: 0 0 6px;
  }
  #modal .pvp-matchmaking [role='status'] > p {
    font-size: 12px;
    line-height: 18px;
    max-width: 270px;
    margin: 0 auto;
  }
  .pvp-matchmaking .matching-meta {
    margin: 12px 0;
    gap: 5px;
    font-size: 10px;
    line-height: 14px;
  }
  .pvp-matchmaking > .outline-button {
    height: 38px;
    min-height: 38px;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 18px;
  }
  #modal .pvp-matchmaking .matching-note {
    font-size: 9px;
    line-height: 14px;
    margin: 10px 0 0;
  }
  .pvp-matchmaking > .quiet-button {
    min-height: 30px;
    padding: 5px 0;
    font-size: 10px;
    line-height: 16px;
  }

  body.battle-page:not(.pvp-ending) {
    height: var(--mobile-visible-height, 100dvh);
    min-height: 0;
    overflow: hidden;
  }
  body.battle-page:not(.pvp-ending) .workspace,
  body.battle-page:not(.pvp-ending):not(:has(.arena-voting)) .workspace {
    height: calc(var(--mobile-visible-height, 100dvh) - var(--mobile-top) - var(--mobile-bottom));
    min-height: 0;
    display: block;
  }
  body.battle-page:not(.pvp-ending) main {
    height: 100%;
    min-height: 0;
    padding: 7px 12px;
  }
  body.battle-page:not(.pvp-ending) #view-battle,
  body.battle-page:not(.pvp-ending) #view-battle .arena-layout {
    height: 100%;
    min-height: 0;
    display: block;
  }
  body.battle-page:not(.pvp-ending) #view-battle .arena-card {
    height: 100%;
    min-height: 0 !important;
    display: grid;
    grid-template-rows: 28px minmax(100px, 1fr) auto auto auto auto;
    gap: 7px !important;
    padding: 0 !important;
  }
  body.battle-page #view-battle .arena-round-header {
    min-height: 28px;
    gap: 6px;
    flex-wrap: nowrap;
  }
  body.battle-page #view-battle .round-status {
    font-size: 11px;
    letter-spacing: 0.6px;
  }
  body.battle-page #view-battle .arena-round-header .tiny-pill {
    font-size: 7px;
    padding: 4px 5px;
    white-space: nowrap;
  }
  body.battle-page #view-battle .pvp-sound {
    min-height: 28px;
    font-size: 10px;
    padding: 4px 7px;
  }
  body.battle-page #view-battle .duel-coin-stage {
    min-height: 0;
    flex: none;
    height: 100%;
    container-type: size;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 5px;
    align-items: center;
  }
  body.battle-page #view-battle .personal-coin-slot,
  body.battle-page #view-battle .shared-coin-slot {
    width: 100%;
    height: 100%;
    min-width: 0;
    display: grid;
    place-items: center;
    gap: 0;
  }
  body.battle-page #view-battle .personal-coin-slot .duel-coin {
    width: min(24cqw, 76cqh, 96px);
    height: auto;
    aspect-ratio: 1;
  }
  body.battle-page #view-battle .central-duel-coin {
    width: min(35cqw, 94cqh, 146px);
    height: auto;
    aspect-ratio: 1;
  }
  body.battle-page #view-battle .shared-result {
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    font-size: 10px;
    line-height: 14px;
    text-align: center;
  }
  body.battle-page #view-battle .duel-player-row {
    grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr);
    gap: 5px;
    align-items: stretch;
  }
  body.battle-page #view-battle .duel-vs {
    font-size: 9px;
    align-self: center;
    justify-self: center;
  }
  body.battle-page #view-battle .duel-player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 64px auto auto auto;
    padding: 8px !important;
    gap: 5px !important;
    min-width: 0;
    align-items: center;
  }
  body.battle-page #view-battle .duel-player > .avatar-frame.frame-collection {
    --collection-size: 64px;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: center;
    margin: 0;
  }
  body.battle-page #view-battle .duel-player > .avatar-frame:not(.frame-collection) {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: center;
  }
  body.battle-page #view-battle .duel-player-score {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    text-align: right;
  }
  body.battle-page #view-battle .duel-player-score > strong {
    font-size: 30px;
    line-height: 32px;
  }
  body.battle-page #view-battle .duel-player-score > span {
    font-size: 6px;
    line-height: 9px;
    margin-top: 2px;
    letter-spacing: 0.3px;
  }
  body.battle-page #view-battle .duel-player-name {
    grid-column: 1/-1;
    grid-row: 2;
    padding: 0;
    min-width: 0;
    height: 24px;
    display: flex;
    align-items: center;
  }
  body.battle-page #view-battle .duel-player-name h2 {
    font-size: 12px !important;
    line-height: 18px;
    margin: 0;
  }
  body.battle-page #view-battle .duel-player-name .styled-name {
    max-width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 3px;
  }
  body.battle-page #view-battle .duel-player-name .nickname {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.battle-page #view-battle .duel-player-name .name-badge {
    font-size: 7px;
  }
  body.battle-page #view-battle .duel-player-current {
    grid-column: 1/-1;
    grid-row: 3;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 3px;
    font-size: 9px;
    line-height: 14px;
    padding-top: 5px;
  }
  body.battle-page #view-battle .pvp-current {
    font-size: 10px;
    line-height: 14px;
  }
  body.battle-page #view-battle .duel-call {
    font-size: 9px;
  }
  body.battle-page #view-battle .pvp-flip-record {
    grid-column: 1/-1;
    grid-row: 4;
    min-width: 0;
  }
  body.battle-page #view-battle .pvp-regulation-record {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
  }
  body.battle-page #view-battle .pvp-flip {
    height: 22px;
    min-width: 0;
    font-size: 10px;
  }
  body.battle-page #view-battle .arena-message {
    min-height: 18px !important;
    padding: 0;
    font-size: 11px !important;
    line-height: 16px;
  }
  body.battle-page #view-battle .arena-message.arena-message-empty {
    display: none;
    min-height: 0 !important;
  }
  body.battle-page #view-battle .arena-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    align-self: end;
  }
  body.battle-page #view-battle .duel-choice-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
    max-width: none;
  }
  body.battle-page #view-battle .duel-choice-row > button {
    height: 38px;
    min-height: 38px !important;
    padding: 6px 10px !important;
    font-size: 12px;
    line-height: 18px;
    border-radius: 9px;
    justify-content: center;
  }
  body.battle-page #view-battle .arena-actions > .flip-button {
    height: 42px;
    min-height: 42px !important;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 18px;
    border-radius: 9px;
    justify-content: center;
  }
  body.battle-page #view-battle .auto-round-notice {
    height: 42px;
    min-height: 42px;
    font-size: 11px;
    line-height: 16px;
  }
  body.battle-page #view-battle .arena-meta {
    min-height: 28px !important;
    gap: 8px;
    align-items: center;
  }
  body.battle-page #view-battle .arena-meta .quiet-button {
    min-height: 28px;
    padding: 4px 0;
    font-size: 11px;
    line-height: 18px;
  }
}
@media (max-width: 700px) and (max-height: 590px) {
  .pvp-matchmaking .matching-radar {
    width: 112px;
    height: 112px;
    margin: 9px auto;
  }
  .pvp-matchmaking .matching-radar > .avatar-frame.frame-collection {
    --collection-size: 88px;
  }
  .pvp-matchmaking .matching-meta {
    margin: 9px 0;
  }
  body.battle-page:not(.pvp-ending) #view-battle .arena-card {
    gap: 5px !important;
    grid-template-rows: 26px minmax(86px, 1fr) auto auto auto auto;
  }
  body.battle-page #view-battle .duel-player {
    grid-template-rows: 50px auto auto auto;
    padding: 6px !important;
    gap: 3px !important;
  }
  body.battle-page #view-battle .duel-player > .avatar-frame.frame-collection {
    --collection-size: 50px;
  }
  body.battle-page #view-battle .duel-player-score > strong {
    font-size: 27px;
    line-height: 29px;
  }
  body.battle-page #view-battle .pvp-flip {
    height: 20px;
  }
}

/* Compact result cards on phones and short landscape screens. */
@media (max-width: 700px), (max-width: 950px) and (max-height: 500px) {
  body.battle-page #view-battle .pvp-result {
    max-width: 560px;
    padding: 12px;
    gap: 8px;
    border-radius: 14px;
  }
  body.battle-page #view-battle .pvp-result-heading {
    min-height: 14px;
    gap: 6px;
    align-items: center;
  }
  body.battle-page #view-battle .pvp-result-heading .eyebrow {
    font-size: 8px;
    line-height: 12px;
    letter-spacing: 1px;
  }
  body.battle-page #view-battle .pvp-result-heading .tiny-pill {
    font-size: 7px;
    line-height: 10px;
    padding: 4px 5px;
  }
  body.battle-page #view-battle .pvp-result-mark {
    display: none;
  }
  body.battle-page #view-battle .pvp-result-hero h1 {
    font-size: 40px;
    line-height: 44px;
    margin: 2px 0 6px;
  }
  body.battle-page #view-battle .pvp-result-hero p {
    font-size: 11px;
    line-height: 16px;
    max-width: 300px;
    margin: 0 auto;
  }
  body.battle-page #view-battle .pvp-result-scoreline {
    gap: 10px;
    flex-wrap: nowrap;
    font-size: 9px;
  }
  body.battle-page #view-battle .pvp-result-scoreline > strong {
    font-size: 34px;
    line-height: 38px;
    white-space: nowrap;
  }
  body.battle-page #view-battle .pvp-result-scoreline small {
    font-size: 9px;
    white-space: nowrap;
  }
  body.battle-page #view-battle .pvp-result-players {
    min-height: 0;
    gap: 8px;
    align-items: stretch;
  }
  body.battle-page #view-battle .pvp-result-player {
    min-height: 0;
    padding: 10px 8px;
    display: grid;
    grid-template-rows: auto auto auto auto;
    gap: 7px;
    align-items: center;
  }
  body.battle-page #view-battle .pvp-result-coin {
    height: clamp(64px, 13dvh, 108px);
    container-type: size;
    overflow: visible;
  }
  body.battle-page #view-battle .pvp-result-coin .duel-coin {
    width: min(76cqw, 86cqh, 120px);
    height: auto;
    aspect-ratio: 1;
  }
  body.battle-page #view-battle .pvp-result-identity {
    min-width: 0;
    gap: 5px;
    align-items: center;
    justify-content: flex-start;
    height: 40px;
    min-height: 40px;
  }
  body.battle-page #view-battle .pvp-result-identity > .avatar-frame {
    display: inline-flex;
    --collection-size: 36px;
    flex-shrink: 0;
  }
  body.battle-page #view-battle .pvp-result-identity strong {
    font-size: 11px;
    line-height: 16px;
    min-width: 0;
  }
  body.battle-page #view-battle .pvp-result-identity .styled-name {
    max-width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 3px;
  }
  body.battle-page #view-battle .pvp-result-identity .nickname {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.battle-page #view-battle .pvp-result-identity .name-badge {
    font-size: 6px;
  }
  body.battle-page #view-battle .pvp-result-identity small {
    font-size: 9px;
    line-height: 12px;
    margin-top: 2px;
  }
  body.battle-page #view-battle .pvp-result-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
    font-size: 9px;
    line-height: 14px;
  }
  body.battle-page #view-battle .pvp-result-stats strong {
    font-size: 12px;
  }
  body.battle-page #view-battle .pvp-result .pvp-flip {
    height: 24px !important;
    font-size: 10px;
  }
  body.battle-page #view-battle .pvp-result .pvp-regulation-record {
    gap: 3px;
  }
  body.battle-page #view-battle .pvp-result-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  body.battle-page #view-battle .pvp-result-actions > .flip-button {
    max-width: none;
    height: 42px;
    min-height: 42px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 18px;
  }
  body.battle-page #view-battle .pvp-result-actions > .outline-button {
    height: 42px;
    min-height: 42px;
    max-width: none;
    padding: 6px 4px;
    font-size: 10px;
    line-height: 16px;
  }
  body.battle-page #view-battle .pvp-result-footnote {
    font-size: 9px;
    line-height: 13px;
    margin: 0;
  }
}

/* Full rankings: the list owns the remaining dialog height, without table margins. */
html:has(#modal[open] .pvp-rankings-modal) {
  overflow: hidden;
}
#pvp-rankings-help {
  display: none;
}
#modal[open]:has(.pvp-rankings-modal) {
  inset: 0;
  margin: auto;
  display: flex;
  flex-direction: column;
  height: min(800px, calc(var(--mobile-visible-height, 100dvh) - 32px));
  max-height: calc(var(--mobile-visible-height, 100dvh) - 32px);
  padding: 16px;
  border-radius: 16px;
  border-bottom: 1px solid var(--website-line-83-99-68-1, #536344);
  overflow: hidden;
}
#modal:has(.pvp-rankings-modal) > .modal-top {
  flex-shrink: 0;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
}
#modal:has(.pvp-rankings-modal) .modal-top .icon-button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}
#modal:has(.pvp-rankings-modal) #pvp-rankings-help {
  display: grid;
  margin-left: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#modal:has(.pvp-rankings-modal) #pvp-rankings-help:focus-visible {
  outline: 2px solid var(--lime, var(--website-line-212-249-155-1, #d4f99b));
  outline-offset: 2px;
}
#modal:has(.pvp-rankings-modal) #modal-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#modal .pvp-rankings-modal {
  height: 100%;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 8px;
  margin: 0;
}
#modal .pvp-rankings-modal h2 {
  font-size: 26px;
  line-height: 30px;
  margin: 0;
}
#modal .pvp-rankings-modal .pvp-board-controls {
  margin: 0;
  gap: 6px;
}
#modal .pvp-rankings-modal > [data-pvp-period-label] {
  font-size: 11px;
  line-height: 16px;
  margin: 0;
}
#modal .pvp-rankings-modal .pvp-rankings-scroll {
  min-height: 0;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: auto;
  scrollbar-width: none;
  border-radius: 8px;
}
/* Keep the table flush to its border; touch, wheel and keyboard scrolling remain available. */
#modal .pvp-rankings-modal .pvp-rankings-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.pvp-rankings-scroll table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
  margin: 0;
  border-collapse: collapse;
  border-spacing: 0;
  white-space: normal;
}
.pvp-rankings-scroll :is(th, td) {
  text-align: center;
  vertical-align: middle;
  padding: 10px 4px;
  font-variant-numeric: tabular-nums;
}
.pvp-rankings-scroll :is(th, td):nth-child(2) {
  text-align: left;
}
.pvp-rankings-scroll th {
  font-size: 8px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  height: 32px;
  padding: 8px 4px;
}
.pvp-rankings-modal #pvp-board-body .table-name {
  min-height: 44px;
  width: 100%;
  font-size: 12px;
  gap: 4px;
}
.pvp-rankings-modal #pvp-board-body .table-name > .avatar-frame.frame-collection {
  --collection-size: 52px;
}
.pvp-rankings-modal #pvp-board-body .styled-name {
  max-width: 100%;
  gap: 3px;
  flex-wrap: wrap;
}
.pvp-rankings-modal #pvp-board-body .nickname {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pvp-rankings-modal #pvp-board-body > tr > td {
  font-size: 12px;
  line-height: 16px;
}
.pvp-rankings-modal #pvp-board-body > tr > td:nth-child(3) {
  font-size: 19px;
  line-height: 22px;
}
.pvp-rankings-modal #pvp-board-body .leader-rank-number {
  min-width: 24px;
  min-height: 24px;
  font-size: 13px;
  letter-spacing: 0;
}
.pvp-ranking-rules {
  position: absolute;
  z-index: 5;
  inset: 0 0 auto;
  padding: 15px;
  border: 1px solid var(--website-line-130-152-94-1, #82985e);
  border-radius: 10px;
  background: var(--website-surface-41-51-33-1, #293321);
  box-shadow: 0 10px 35px var(--website-shade-0-0-0-0_5333333333333333, #0008);
}
.pvp-ranking-rules[hidden] {
  display: none;
}
.pvp-ranking-rules > strong {
  font-size: 14px;
  color: var(--website-ink-228-242-209-1, #e4f2d1);
}
#modal .pvp-ranking-rules > p {
  font-size: 12px;
  line-height: 18px;
  margin: 7px 0 0;
}
@media (max-width: 700px) {
  #modal[open]:has(.pvp-rankings-modal) {
    width: calc(100% - 20px);
    height: calc(var(--mobile-visible-height, 100dvh) - 20px);
    max-height: calc(var(--mobile-visible-height, 100dvh) - 20px);
    padding: 12px;
  }
  #modal:has(.pvp-rankings-modal) > .modal-top {
    margin-bottom: 7px;
  }
  #modal:has(.pvp-rankings-modal) #pvp-rankings-help {
    min-width: 44px;
    min-height: 44px;
  }
  #modal .pvp-rankings-modal {
    gap: 6px;
  }
  #modal .pvp-rankings-modal h2 {
    font-size: 23px;
    line-height: 27px;
  }
  #modal .pvp-rankings-modal .pvp-board-controls {
    gap: 5px;
  }
  #modal .pvp-rankings-modal .pvp-board-controls > .segmented {
    min-height: 34px;
    padding: 3px;
    gap: 2px;
    border-radius: 8px;
  }
  #modal .pvp-rankings-modal .pvp-board-controls > .segmented > button {
    height: 28px;
    min-height: 28px;
    font-size: 10px;
    line-height: 16px;
    padding: 4px 6px;
    border-radius: 6px;
  }
}
@media (max-width: 700px) and (max-height: 590px) {
  body.battle-page #view-battle .pvp-result {
    padding: 9px;
    gap: 5px;
  }
  body.battle-page #view-battle .pvp-result-hero h1 {
    font-size: 32px;
    line-height: 35px;
    margin: 0 0 3px;
  }
  body.battle-page #view-battle .pvp-result-hero p {
    font-size: 10px;
    line-height: 14px;
  }
  body.battle-page #view-battle .pvp-result-scoreline > strong {
    font-size: 27px;
    line-height: 29px;
  }
  body.battle-page #view-battle .pvp-result-player {
    padding: 7px 6px;
    gap: 4px;
  }
  body.battle-page #view-battle .pvp-result-identity > .avatar-frame {
    --collection-size: 28px;
  }
  body.battle-page #view-battle .pvp-result-identity {
    height: 36px;
    min-height: 36px;
  }
  body.battle-page #view-battle .pvp-result-identity strong {
    font-size: 10px;
    line-height: 14px;
  }
  body.battle-page #view-battle .pvp-result .pvp-flip {
    height: 20px !important;
  }
  body.battle-page #view-battle .pvp-result-actions > .flip-button {
    height: 38px;
    min-height: 38px;
    font-size: 12px;
  }
  body.battle-page #view-battle .pvp-result-actions > .outline-button {
    height: 38px;
    min-height: 38px;
  }
  body.battle-page #view-battle .pvp-result-footnote {
    font-size: 8px;
    line-height: 11px;
  }
}

/* Full standings keep desktop-readable type and the same centered columns. */
@media (min-width: 701px) {
  #modal .pvp-rankings-modal .pvp-rankings-scroll th {
    font-size: 11px;
    line-height: 16px;
    height: 42px;
    padding: 10px 8px;
  }
  #modal .pvp-rankings-modal #pvp-board-body > tr > td {
    font-size: 14px;
    line-height: 20px;
    padding: 12px 8px;
  }
  #modal .pvp-rankings-modal #pvp-board-body > tr > td:nth-child(3) {
    font-size: 23px;
  }
  #modal .pvp-rankings-modal #pvp-board-body .table-name {
    min-height: 64px;
    gap: 10px;
    font-size: 14px;
    align-items: center;
  }
  #modal .pvp-rankings-modal #pvp-board-body .table-name > .avatar-frame.frame-collection {
    --collection-size: 64px;
    flex-shrink: 0;
  }
  #modal .pvp-rankings-modal #pvp-board-body .styled-name {
    font-size: 14px;
    flex: 0 1 auto;
    max-width: 260px;
    gap: 7px;
  }
  #modal .pvp-rankings-modal #pvp-board-body .leader-rank-number {
    min-width: 32px;
    min-height: 30px;
    font-size: 16px;
  }
}
