/* Stable game viewport. Android supplies physical screen cutouts in CSS pixels. */
:root {
  --safe-top: max(env(safe-area-inset-top, 0px), var(--fiske-cutout-top, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--fiske-cutout-right, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--fiske-cutout-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--fiske-cutout-left, 0px));
}
html:has(.arcade), body.arcade {
  margin: 0; width: 100%; height: 100%; min-height: 0; overflow: hidden;
  overscroll-behavior: none;
}
.arcade :is(button, [role="button"], #board, .scoreboard, .throw-stage-wrap, .table-caption, .board-view, .view-pad, .skill-label) {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.arcade :is(button, [role="button"]) { touch-action: manipulation }
.arcade :is(input, textarea, [contenteditable="true"], .room-code) { -webkit-user-select: text; user-select: text }
.arcade button img, .arcade button svg { -webkit-user-drag: none }
.arcade :is(#board, [role="button"]):focus-visible { outline: 2px solid #67e8f9; outline-offset: -2px }

/* The middle track owns the exact space left after the HUD is measured. */
.arcade #match-screen {
  --frame-ratio: 1.10;
  /* The sticks are generous where there is room and compact where there is not,
     because the board must stay playable before the controls are comfortable. */
  --view-strip: clamp(54px, 10dvh, 88px);
  position: fixed; inset: 0; width: 100%; height: 100%; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: "nav" "scores" "table" "actions" "hint";
  align-items: center; justify-items: center; align-content: stretch; justify-content: stretch;
  gap: clamp(3px, .75dvh, 8px);
  padding: max(6px, var(--safe-top)) max(8px, var(--safe-right)) max(7px, var(--safe-bottom)) max(8px, var(--safe-left));
}
#match-screen .arena-chrome {
  grid-area: nav; position: static; inset: auto; width: min(100%, 900px);
  display: grid; grid-template-columns: 48px 48px minmax(0, 1fr) 48px 48px; align-items: center;
  gap: clamp(2px, 1vw, 8px); margin: 0; justify-self: center; align-self: auto;
}
#match-screen .arena-chrome .metal-button { width: 48px; height: 48px; margin: 0; order: initial }
#match-screen .table-caption { justify-content: center; flex-wrap: wrap; gap: 3px 6px; text-align: center; min-width: 0; line-height: 1.18 }
#match-screen .table-caption :is(span, b) { min-width: 0; overflow-wrap: anywhere }
#match-screen .scoreboard {
  grid-area: scores; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  width: min(100%, 540px); min-width: 0; gap: clamp(3px, 1vw, 8px);
}
#match-screen .plate { width: 100%; padding: 3px; gap: 5px; min-height: 0 }
#match-screen .plate-info { padding-inline: 1px 3px }
#match-screen .avatar-ring { padding: 2px }
#match-screen .portrait { width: 48px; height: 48px }
#match-screen .clash { min-width: 32px }
#shot-clock:not([hidden]) { min-width: 54px; min-height: 6px; height: 6px; padding: 0; margin: 2px auto 0 }
#match-screen .table-surround {
  grid-area: table; position: relative; align-self: stretch; justify-self: stretch; width: 100%; max-width: none; height: 100%; min-height: 0;
  container-type: size; display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto var(--view-strip);
  align-content: center; align-items: center; justify-items: center;
}
#match-screen .table-card {
  width: min(100cqw, calc((100cqh - var(--view-strip)) * var(--frame-ratio)), 900px); min-width: 0;
}
#match-screen .board-shell { --rim: clamp(7px, 1.4vw, 15px); --crown-room: 0px; width: 100%; height: auto; aspect-ratio: var(--frame-ratio); padding: 0 }
#match-screen .board-shell:not(.three-active) { --crown-room: clamp(13px, 4cqw, 32px) }
#match-screen #board {
  position: absolute; inset: calc(var(--rim) + var(--crown-room)) var(--rim) var(--rim);
  width: calc(100% - 2 * var(--rim)); height: calc(100% - 2 * var(--rim) - var(--crown-room));
  aspect-ratio: auto;
}
#match-screen .board-view { margin: 0; width: min(100%, 520px); max-width: 100% }
/* Portrait phones cap the board on width, so the frame is given extra height:
   that headroom is what zoom grows into instead of clipping the far rank. */
@media (orientation: portrait) and (max-width: 560px) {
  .arcade #match-screen { --frame-ratio: .95 }
}
#match-screen .controls-tray, #match-screen .aim-ribbon { width: min(100%, 550px); max-width: 100%; margin: 0 }
#match-screen .controls-tray { grid-area: actions; align-self: end; display: flex; gap: 8px; padding: 6px 8px; border-radius: 14px }
#match-screen .controls-tray:not([data-variant]), #match-screen .controls-tray[data-variant=""] { justify-content: center }
#match-screen .controls-tray[data-variant=""]:has(#powers-panel[hidden]) { display: none }
#match-screen .skill-group { flex: 1 }
#match-screen .skill-slot { min-height: 48px; min-width: 0; flex-direction: row; justify-content: center; text-align: start; gap: 6px; padding: 2px 6px }
#match-screen .power-socket { width: 35px; height: 35px }
#match-screen .power-name { max-width: none; font-size: 13px }
#match-screen .variant-match-bar button, #match-screen :is(.siege-command,.siege-ult-btn) { min-height: 48px; min-width: 48px }
#match-screen .aim-ribbon, #match-screen .aim-ribbon.has-pull {
  grid-area: hint; position: relative; inset: auto; display: grid; grid-template-columns: minmax(0,1fr) 48px;
  padding: 0 0 0 8px; min-height: 48px; gap: 3px; border-radius: 13px; pointer-events: auto;
}
#match-screen .aim-ribbon .aim-text { display: block; font-size: 12px }
#match-screen .aim-ribbon .aim-help {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; box-shadow: none;
  background: transparent; border: 0; border-inline-start: 1px solid #38475d;
}
#match-screen .aim-help::after { content: none }
#match-screen .aim-ribbon:not(.has-pull) .force { visibility: hidden }
#match-screen .aim-ribbon.has-pull .force { visibility: visible }
#match-screen .controls-tray[data-variant="siege"] .variant-match-bar { flex: 0 1 auto }
#match-screen .controls-tray[data-variant="siege"] .variant-score { font-size: 16px }
#match-screen .controls-tray[data-variant="siege"] .variant-match-bar button { padding-inline: 6px }
#match-screen .controls-tray[data-variant="siege"] .power-socket { width: 27px; height: 27px }
#match-screen .controls-tray[data-variant="siege"] .skill-slot { gap: 3px; padding-inline: 3px }
#match-screen .controls-tray[data-variant="siege"] .power-name { font-size: 12px }
.in-siege #match-screen .controls-tray { display: grid; grid-template-columns: 1fr }
.in-siege #match-screen .siege-actions { display: grid; grid-template-columns: minmax(0,1fr) auto; width: 100%; min-width: 0; gap: 6px }
.in-siege #match-screen .siege-ult-wrap { width: auto; min-width: 0; gap: 4px }
.in-siege #match-screen .siege-ult-bar { min-width: 36px }
.in-siege #match-screen .siege-meta-row { width: auto; gap: 4px }
.in-siege #match-screen :is(.siege-ult-btn,.siege-command) { padding-inline: 6px }

@media (orientation: landscape) and (min-width: 540px) {
  .arcade #match-screen {
    --frame-ratio: 1.22;
    grid-template-columns: clamp(84px, 16vw, 190px) minmax(0, 1fr) clamp(105px, 20vw, 230px);
    grid-template-rows: auto minmax(0,1fr) auto minmax(0,1fr);
    grid-template-areas: "nav nav nav" "scores table ." "scores table actions" "scores table hint";
    gap: 5px clamp(3px, 1vw, 12px);
  }
  #match-screen .scoreboard { display: flex; flex-direction: column; grid-column: 1; grid-row: 2 / -1; justify-self: stretch; width: 100%; gap: 8px }
  #match-screen .scoreboard .plate { display: grid; justify-items: center; text-align: center; grid-template-columns: minmax(0,1fr); padding: 4px 2px }
  #match-screen .plate-info { width: 100%; padding: 0; align-items: center }
  #match-screen .plate .pips { width: 85%; justify-content: center }
  #match-screen .table-surround { grid-column: 2; grid-row: 2 / -1 }
  #match-screen .controls-tray { flex-direction: column; justify-content: start; align-items: stretch; padding: 5px; gap: 6px }
  #match-screen .skill-slots { grid-template-columns: 1fr }
  #match-screen .skill-slot { min-height: 48px; justify-content: start }
  #match-screen .variant-match-bar { flex-direction: column; align-items: stretch; text-align: center }
  #match-screen .aim-ribbon { align-self: start }
  #match-screen .aim-ribbon .aim-text { font-size: 11px }
  #match-screen .aim-ribbon, #match-screen .aim-ribbon.has-pull { grid-template-columns: minmax(0,1fr); padding: 3px; gap: 1px }
  #match-screen .aim-ribbon .aim-text, #match-screen .aim-ribbon .force { grid-area: 1/1 }
  #match-screen .aim-ribbon .aim-help { grid-area: 2/1; justify-self: center; border: 0 }
  #match-screen .force { min-width: 0; gap: 2px }
  #match-screen .force .meter { width: 44px }
  .in-siege #match-screen .siege-actions { display: flex; flex-direction: column }
  .in-siege #match-screen .siege-ult-wrap { flex: initial; width: 100%; flex-wrap: wrap; justify-content: center }
  .in-siege #match-screen .siege-ult-bar { width: 100%; flex-basis: 100% }
}
@media (orientation: landscape) and (max-height: 500px) {
  #match-screen .controls-tray { flex-direction: column }
  #match-screen .power-socket { width: 29px; height: 29px }
  #match-screen .aim-ribbon .aim-text { display: none }
  #match-screen .aim-ribbon, #match-screen .aim-ribbon.has-pull { min-height: 48px; grid-template-columns: minmax(0,1fr); padding: 0 }
  #match-screen .aim-ribbon .aim-help { grid-area: 1/1; justify-self: stretch; width: 100% }
  #match-screen .aim-ribbon.has-pull .aim-help { visibility: hidden }
  .arcade.in-siege #match-screen { grid-template-rows: 48px minmax(0,1fr) auto auto }
  .in-siege #match-screen .controls-tray { grid-row: 3; align-self: end; gap: 4px }
  .in-siege #match-screen .skill-slots { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px }
  .in-siege #match-screen .skill-slot { flex-direction: column; justify-content: center; padding: 2px; gap: 2px; text-align: center }
  .in-siege #match-screen .power-name { font-size: 11px }
  .in-siege #match-screen .siege-ult-wrap { display: grid; grid-template-columns: minmax(0,1fr) auto }
  .in-siege #match-screen .siege-actions { justify-content: center; gap: 3px }
}
/* Scrolling is local to the surface that needs it. Horizontal carousels keep
   their own scroll range while the lobby dock and the room actions stay put. */
#home-screen, #table-select-screen { overflow: hidden; -webkit-user-select: none; user-select: none }
#home-screen { touch-action: pan-y }
#home-screen #pool-carousel, #home-screen #pool-carousel * { touch-action: pan-x }
#home-screen .home-dock, #home-screen .home-dock * { touch-action: none }
#table-select-screen { animation: none }
.home-shell, .ts-shell {
  min-width: 0; min-height: 0; height: 100%; grid-template-columns: minmax(0,1fr);
  padding: max(8px,var(--safe-top)) max(clamp(8px,2.5vw,24px),var(--safe-right)) max(8px,var(--safe-bottom)) max(clamp(8px,2.5vw,24px),var(--safe-left));
}
.home-shell { grid-template-rows: auto minmax(0,1fr) auto; gap: clamp(4px,1dvh,12px) }
.home-main { min-height: 0; grid-template-rows: auto minmax(0,auto); gap: 4px; align-content: center }
.home-main .pool-carousel { min-width: 0; min-height: 0; max-height: 100%; padding-block: 5px 10px; overscroll-behavior-x: contain }
.home-shell .lobby-profile, .home-shell :is(.currency-pill,.home-chip,.pool-nav-btn,.home-dock button), .ts-shell :is(button:not(.city-card),input) { min-height: 48px }
.home-shell :is(.home-chip,.pool-nav-btn) { min-width: 48px }
.home-dock button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
#login-screen {
  padding: max(12px,var(--safe-top)) max(16px,var(--safe-right)) max(12px,var(--safe-bottom)) max(16px,var(--safe-left));
  overflow-y: auto; overflow-x: hidden;
}
.login-socials { grid-template-columns: minmax(0,1fr) }
#table-select-screen .ts-shell { grid-template-rows: auto auto minmax(100px,1fr) auto; gap: clamp(4px,1.2dvh,12px); overflow-y:auto }
.ts-shell > *, .ts-footer .ts-friend-bar, .ts-top .ts-rules, .ts-friend-bar input { min-width: 0 }
.ts-top .ts-rules { max-width: 100% }
.ts-shell .ts-carousel { min-height: 0; align-items: center; padding-block: 5px 10px }
.ts-carousel .city-card { flex-shrink: 0; height: min(100%, 450px); min-height: min(100%,240px) }
.ts-shell .ts-footer { gap: 4px; padding: 6px; align-content: start }
.ts-footer #net-msg:empty { display: none }
.ts-shell .ts-friend-bar { width: 100%; display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 5px }
.ts-friend-bar input { width: 100% }
@media (orientation: portrait) and (max-height:500px) {
  #table-select-screen:has(#room-code:focus) .ts-top .ts-rules,
  #table-select-screen:has(#room-code:focus) .ts-shell > .muted-note { display: none }
  #table-select-screen:has(#room-code:focus) .ts-shell { grid-template-rows: auto minmax(60px,1fr) auto }
}
.ts-shell .ts-rules button { flex: 1; padding-inline: 6px; overflow-wrap: anywhere; line-height: 1.1 }
@media (max-width: 600px) and (orientation: portrait) {
  .ts-top { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 5px; padding: 5px }
  .ts-top .ts-title { justify-content: center; text-align: center }
  .ts-top .ts-title h2 { font-size: 22px }
  .ts-top .ts-rules { grid-area: 2/1/3/-1; width: 100%; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 2px; padding: 2px }
  .ts-top .ts-rules button { padding-inline: 2px; font-size: 12px }
  .ts-shell .ts-friend-bar { grid-template-columns: 1fr 1fr }
  .ts-friend-bar input { grid-column: 1/-1 }
  .ts-friend-bar button { padding-inline: 4px }
  .home-shell .home-main { align-content:stretch; grid-template-rows:auto minmax(0,1fr) }
  .home-shell .pool-carousel { align-items:stretch }
  .home-shell .pool-card { flex-basis:min(340px,86%); min-height:0; height:auto }
}
@media (orientation: landscape) and (max-height: 520px) {
  .home-shell, .ts-shell { padding-block: max(4px,var(--safe-top)) max(4px,var(--safe-bottom)); gap: 3px }
  .home-shell .pool-card { min-height: 0; height: clamp(132px,45dvh,210px); padding: 7px 11px }
  .home-shell .pool-card-body { padding-top: 2px; gap: 2px }
  .pool-card-body small { min-height: 0 }
  .home-shell .pool-card-top { line-height: 1 }
  .home-shell .lobby-top, .home-shell .home-dock { padding-block: 3px }
  .home-shell .pool-carousel-head { min-height: 16px }
  .home-shell .pool-nav-btns { display: none }
  .ts-top { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 4px; padding: 3px }
  .ts-top .ts-title { display: none }
  .ts-top .ts-rules { display: flex; order: 0; width: 100%; padding: 1px }
  .ts-top .ts-back, .ts-top .ts-rules button, .ts-top .currency-pill { padding-inline: 4px }
  .ts-carousel .city-card { padding: 7px 10px; justify-content: center; gap: 2px }
  .city-body { gap: 2px }
  .city-card .city-stats { padding-block: 3px }
  .ts-shell .ts-footer { padding: 3px }
}
@media (max-width: 400px) {
  .home-shell .lobby-top { display: grid; grid-template-columns: minmax(0,1fr); gap: 3px }
  .home-shell .lobby-profile { justify-self: start }
  .home-shell .lobby-currencies { flex-wrap: wrap }
}

/* The modal's close button shares a grid cell with the content. A float here
   used to shrink the sticky collection header to the remaining line width. */
.arcade dialog, .arcade dialog:has(.collection-gallery), .arcade dialog:has(.collection-detail), .arcade dialog:has(.football-planner) {
  --dialog-x: max(6px, var(--safe-left)); --dialog-r: max(6px, var(--safe-right));
  --dialog-t: max(6px, var(--safe-top)); --dialog-b: max(6px, var(--safe-bottom));
  inset: var(--dialog-t) var(--dialog-r) var(--dialog-b) var(--dialog-x);
  margin: auto; max-width: calc(100% - var(--dialog-x) - var(--dialog-r));
  max-height: min(820px, calc(100% - var(--dialog-t) - var(--dialog-b)));
  overscroll-behavior: contain; overflow-x: hidden; scrollbar-gutter: auto;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.arcade dialog :is(button, [role="button"]) { touch-action: manipulation }
.arcade dialog :is(.gallery-tabs, .gallery-tabs *, .sub-cat-bar, .sub-cat-bar *, .tr-track, .tr-track *, .finger-picker, .finger-picker *, .throw-acc-row > div, .throw-acc-row > div *) { touch-action: pan-x pan-y }
.arcade dialog :is(.home-dock, .home-dock *, .player-tabs, .player-tabs *) { touch-action: none }
/* Unified docked hub panels: fixed width & height across Takimlar, Magaza,
   Gorevler, Liderlik and Arkadaslar so the bottom dock never shifts or resizes. */
.arcade dialog:has(.has-dock) {
  width: min(780px, calc(100% - var(--dialog-x) - var(--dialog-r)));
  height: min(740px, calc(100% - var(--dialog-t) - var(--dialog-b)));
  scroll-padding-block: 128px 92px;
}
.arcade dialog > .modal { --pad: clamp(14px, 3vw, 24px); display: grid; grid-template-columns: minmax(0,1fr) }
.arcade dialog > .modal.has-dock {
  min-height: 100%;
  grid-template-rows: 1fr auto;
  padding: var(--pad) var(--pad) 0;
}
.arcade dialog:has(.collection-gallery) > .modal.has-dock,
.arcade dialog:has(.collection-detail) > .modal.has-dock {
  padding: 0 var(--pad) 0;
}
.arcade dialog #dialog-content, .arcade dialog .close { grid-area: 1/1 }
.arcade dialog #dialog-content { min-width: 0 }
.arcade dialog .close, html[dir="rtl"] .arcade dialog .close {
  float: none; position: sticky; z-index: 10; align-self: start; justify-self: end;
  top: 8px; left: auto; right: auto; inset-inline-end: auto;
  margin-block: -8px 0; margin-inline: 0 -8px; width: 48px; height: 48px;
}
.arcade dialog:has(.collection-gallery) .close, .arcade dialog:has(.collection-detail) .close,
html[dir="rtl"] .arcade dialog:has(.collection-gallery) .close, html[dir="rtl"] .arcade dialog:has(.collection-detail) .close {
  margin-block: 8px 0; margin-inline: 0 calc(8px - var(--pad));
}
.arcade dialog .gallery-head { min-width: 0; padding-inline: var(--pad); min-height: 60px; background: rgba(11,17,30,0.98) }
.arcade dialog .gallery-head-top { min-width: 0; padding-inline-end: 52px }
.arcade dialog .gallery-wallet { flex: none; padding-inline: 9px }
.arcade .gallery-tabs button.choice { min-height: 48px }
.arcade .modal h2 { padding-inline-end: 52px }
.arcade .gallery-head h2 { padding-inline-end: 0 }
@media (max-height: 450px) {
  .arcade dialog .gallery-head { gap: 6px; padding-block: 6px }
  .home-dock.modal-dock { margin-top: 10px; padding-block: 4px }
}
#rps-arena-stage, #matchmaking-stage {
  animation: none; padding: max(6px,var(--safe-top)) max(8px,var(--safe-right)) max(7px,var(--safe-bottom)) max(8px,var(--safe-left));
  overflow-x: hidden; overflow-y: auto; align-items: safe center;
}
:is(#rps-arena-stage,#matchmaking-stage) .mm-rays { inset: 0; overflow: hidden; animation: none; background: none }
:is(#rps-arena-stage,#matchmaking-stage) .mm-rays::before {
  content: ""; position: absolute; inset: -55%; animation: mmSpin 22s linear infinite;
  background: repeating-conic-gradient(from 0deg,rgba(6,182,212,.3) 0deg 10deg,transparent 10deg 24deg);
}
:is(#rps-arena-stage,#matchmaking-stage) .mm-radar { overflow: hidden }
@media (prefers-reduced-motion: reduce) {
  :is(#rps-arena-stage,#matchmaking-stage) .mm-rays::before { animation: none }
}
.rps-shell, .rps-controls, .mm-shell { min-width: 0; width: min(100%, 900px); grid-template-columns: minmax(0,1fr) }
.rps-arena-grid, .rps-controls > *, .throw-tools .throw-tool { min-width: 0 }
.mm-card strong, .mm-card small { min-width: 0; max-width: 100% }
.mm-card small, .mm-tip { overflow-wrap: anywhere }
.cup-bracket { grid-template-columns: repeat(2,minmax(0,1fr)) }
.cup-bracket section { min-width: 0; overflow-wrap: anywhere }
@media (max-width: 540px) {
  #matchmaking-stage .mm-shell { gap: clamp(8px,2dvh,15px) }
  #matchmaking-stage .mm-clash {
    grid-template: "self vs foe" auto "status status status" auto / minmax(0,1fr) minmax(30px,12%) minmax(0,1fr);
    gap: 12px 5px; padding: 14px 7px 10px;
  }
  #matchmaking-stage .mm-card.self { grid-area: self }
  #matchmaking-stage .mm-card.foe { grid-area: foe }
  #matchmaking-stage .mm-mid { display: contents }
  #matchmaking-stage .mm-vs-badge { grid-area: vs; justify-self: center; font-size: clamp(28px,8vw,41px) }
  #matchmaking-stage .mm-coin-stream { display: none }
  #matchmaking-stage .mm-status { grid-area: status; justify-self: center; max-width: 100%; line-height: 1.25 }
  #matchmaking-stage .mm-portrait-wrap { width: min(100%,clamp(68px,23vw,108px)); height: auto; aspect-ratio: 1 }
  #matchmaking-stage .mm-err:empty { display: none }
}
@media (pointer: coarse) {
  #login-screen .login-rays { inset: 0; animation: none }
  .login-emblem::after,.login-btn.primary::after,.pool-cta::after { content: none }
  #rps-arena-stage .wave-hand { animation-iteration-count: 1 }
  /* Keep the resting board idle. The cast, impact and socket feedback still
     animate when the player actually selects or releases a power. */
  #match-screen.screen-zoom { animation: none }
  #match-screen .skill-slot :is(.sigil-core,.sigil-detail),
  #match-screen .skill-slot[data-state="armed"] .power-socket::after { animation: none }
  :is(#rps-arena-stage,#matchmaking-stage) .mm-rays::before { animation: none; inset: 0 }
  :is(#rps-arena-stage,#matchmaking-stage) .mm-radar i:not(:first-child) { display: none }
  #matchmaking-stage .mm-card.searching .mm-portrait-wrap img { animation: none }
}
@media (orientation: landscape) and (max-height: 450px) {
  #matchmaking-stage .mm-shell { gap: 5px }
  #matchmaking-stage .mm-top { display:flex; justify-content: center; gap: 9px; align-items:center; flex-wrap:wrap }
  #matchmaking-stage .mm-top h2 { font-size: 21px }
  #matchmaking-stage .mm-clash { padding: 7px 12px }
  #matchmaking-stage .mm-portrait-wrap { width: 54px; height: 54px }
  #matchmaking-stage .mm-card { gap: 3px }
  #matchmaking-stage .mm-tip { padding: 5px 10px }
  #matchmaking-stage .mm-err:empty { display: none }
}
#vs-splash { padding: max(6px,var(--safe-top)) max(8px,var(--safe-right)) max(6px,var(--safe-bottom)) max(8px,var(--safe-left)) }
#vs-splash .vs-card { max-width: 100% }
#rps-arena-stage .throw-tools { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:5px }
#rps-arena-stage .throw-tool { min-height: 48px; padding-inline: 4px }
#rps-arena-stage .throw-picks .choice { min-width: 0 }
#rps-arena-stage .throw-result > div { min-width: 0; max-width: 42% }
@media (orientation: portrait) and (max-height: 720px) {
  #rps-arena-stage .rps-shell, #rps-arena-stage .rps-controls { gap: 6px }
  #rps-arena-stage .rps-arena-grid { gap: 5px; padding: 6px }
  #rps-arena-stage .rps-head, #rps-arena-stage .rps-fighter { gap: 4px }
  #rps-arena-stage .rps-avatar { width: 48px; height: 48px }
  #rps-arena-stage .rps-wide :is(fiske-throw-stage,fiske-duel-hands) { height: clamp(95px,25dvh,174px); min-height: 0 }
  #rps-arena-stage .throw-picks { gap: 5px }
  #rps-arena-stage .throw-picks .choice { min-height: 54px; padding: 3px }
  #rps-arena-stage .throw-picks .choice b { font-size: 26px }
}
@media (orientation: landscape) and (max-height: 520px) {
  #rps-arena-stage .rps-shell { grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); align-content: center; gap: 5px 10px }
  #rps-arena-stage .rps-head { grid-column: 1/-1; gap: 3px }
  #rps-arena-stage .rps-head h2 { font-size: 24px }
  #rps-arena-stage .rps-arena-grid { grid-template: auto auto / repeat(2,minmax(0,1fr)); padding: 5px; gap: 3px }
  #rps-arena-stage .rps-fighter { grid-row: 1; display: flex; justify-content: center; flex-wrap: wrap; gap: 4px }
  #rps-arena-stage .rps-fighter.self { grid-column: 1 }
  #rps-arena-stage .rps-fighter.foe { grid-column: 2 }
  #rps-arena-stage .rps-fighter strong { font-size: 13px }
  #rps-arena-stage .rps-avatar { width: 36px; height: 36px }
  #rps-arena-stage .rps-stage-center { grid-area: 2/1/3/-1 }
  #rps-arena-stage .rps-wide :is(fiske-throw-stage,fiske-duel-hands) { min-height: 65px; height: clamp(65px,35dvh,190px) }
  #rps-arena-stage .rps-controls { align-self: center; gap: 5px }
  #rps-arena-stage .throw-picks { gap: 4px }
  #rps-arena-stage .throw-picks .choice { min-height: 52px; padding: 3px }
}
.quick-chat-tray {
  top: calc(var(--safe-top) + 56px); inset-inline-end: max(8px,var(--safe-right));
  max-height: calc(100% - var(--safe-bottom) - var(--safe-top) - 62px); overflow-y: auto;
}
