:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #080d0b;
  --panel: rgba(14, 22, 18, .96);
  --panel-soft: rgba(12, 19, 15, .9);
  --line: rgba(210, 233, 218, .14);
  --line-strong: rgba(210, 233, 218, .24);
  --text: #f3f6f2;
  --muted: #b2bdb5;
  --subtle: #84938a;
  --accent: #ffad45;
  --accent-bright: #ffc46f;
  --mint: #72d9b2;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: -30px;
  z-index: 0;
  background: linear-gradient(145deg, rgba(5, 16, 12, .68), rgba(5, 10, 8, .88)), url('/arena.svg') center / cover;
  filter: blur(12px) saturate(.78);
  transform: scale(1.04);
}

header {
  position: relative;
  z-index: 1;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px max(4vw, calc((100vw - 1360px) / 2));
  background: rgba(7, 12, 10, .88);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .16);
}

.brand {
  position: relative;
  padding-left: 47px;
  color: var(--text);
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
  font-style: italic;
  font-weight: 950;
  letter-spacing: -1.15px;
  text-shadow: 0 2px 18px rgba(255, 173, 69, .12);
}

.brand::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 35px;
  height: 35px;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 196, 111, .68);
  border-radius: 11px;
  background: url('/favicon.png?v=3') center / cover, #111a15;
  box-shadow: 0 0 20px rgba(255, 173, 69, .12), inset 0 0 12px rgba(255, 255, 255, .06);
}

.brand span { color: var(--accent); }
.brand small {
  display: block;
  margin-top: 6px;
  color: #a5b6aa;
  font-size: 8px;
  font-style: normal;
  letter-spacing: 4px;
}

.header-note {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .02em;
}
.header-note::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 12px rgba(114, 217, 178, .48);
}
.header-tools { display: flex; align-items: center; gap: 20px; }
.language-picker { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.language-picker select {
  min-height: 34px;
  padding: 5px 28px 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(17, 27, 22, .92);
  color: var(--text);
  font: inherit;
}
.language-picker select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


.layout {
  position: relative;
  z-index: 1;
  width: min(1360px, 94vw);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  align-items: start;
  gap: 22px;
  margin: 32px auto 54px;
  flex: 1;
}

.screen {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #020403;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 13px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .46), 0 0 0 1px rgba(255, 173, 69, .035);
}
.gamepad-hint {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 10px 0 0;
  padding: 11px 14px;
  border: 1px solid rgba(255, 190, 94, .42);
  border-radius: 9px;
  background: linear-gradient(105deg, rgba(255, 177, 68, .13), rgba(255, 255, 255, .025));
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.gamepad-hint strong { color: var(--accent-bright); }
.gamepad-hint-icon { flex: 0 0 auto; font-size: 19px; }

#fullscreen-exit {
  display: none;
  position: absolute;
  z-index: 20;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(7, 12, 10, .82);
  border-color: rgba(255, 255, 255, .32);
  font-size: 30px;
  line-height: 1;
  touch-action: manipulation;
}
.screen.fullscreen-active #fullscreen-exit { display: block; }
.screen.fullscreen-active {
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: var(--bt3-viewport-height, 100dvh);
  max-width: none;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #000;
}
.screen.fullscreen-active iframe { width: 100%; height: 100%; }
.screen.fullscreen-active canvas { width: 100%; height: 100%; max-width: 100%; object-fit: contain; }

/* iOS Safari has no general element Fullscreen API. This fills its visible
   viewport and hides page chrome while keeping an on-screen exit control. */
body.pseudo-fullscreen { min-height: 0; overflow: hidden; overscroll-behavior: none; }
body.pseudo-fullscreen::before,
body.pseudo-fullscreen > header,
body.pseudo-fullscreen > footer,
body.pseudo-fullscreen .settings-panel,
body.pseudo-fullscreen .gamepad-hint,
body.pseudo-fullscreen .player-status,
body.pseudo-fullscreen .player-actions,
body.pseudo-fullscreen .about { display: none !important; }
body.pseudo-fullscreen .layout {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: block;
  width: 100vw;
  width: 100dvw;
  height: var(--bt3-viewport-height, 100vh);
  height: var(--bt3-viewport-height, 100dvh);
  margin: 0;
}
body.pseudo-fullscreen .player-column { width: 100%; height: 100%; }
body.pseudo-fullscreen .screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body.pseudo-fullscreen .screen iframe { width: 100%; height: 100%; }

canvas {
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  outline: none;
  image-rendering: auto;
}
canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

#start-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 28px 20px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 43%, rgba(31, 58, 44, .78), transparent 49%),
    radial-gradient(ellipse at 50% 120%, rgba(255, 173, 69, .11), transparent 43%),
    linear-gradient(155deg, #09120e, #030605 66%);
}

#start-panel::before,
#start-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
#start-panel::before {
  inset: 16px;
  border: 1px solid rgba(255, 255, 255, .055);
  border-radius: 10px;
  mask-image: linear-gradient(to bottom, #000, transparent 42%, transparent 68%, #000);
}
#start-panel::after {
  width: min(54vw, 540px);
  height: 1px;
  top: 25%;
  background: linear-gradient(90deg, transparent, rgba(255, 173, 69, .38), transparent);
  box-shadow: 0 0 30px rgba(255, 173, 69, .12);
}

#start-panel > * { position: relative; z-index: 1; }
#start-panel h1 {
  margin: 12px 0 0;
  color: #fff;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
  letter-spacing: -.8px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, .38);
}
#start-panel p {
  margin: 12px 0 23px;
  color: #c2cec5;
  font-size: 14px;
}
#start-panel button {
  width: min(360px, 90%);
  min-height: 49px;
  margin: 5px 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 760;
}
#start-panel small {
  margin-top: 17px;
  color: #a2b0a6;
  font-size: 11px;
  letter-spacing: .04em;
}
.emblem {
  color: var(--accent-bright);
  font-size: 17px;
  letter-spacing: 9px;
  padding-left: 9px;
  text-shadow: 0 0 22px rgba(255, 173, 69, .4);
}

button, select, input, .file-button { font: inherit; }
button, .file-button {
  color: var(--text);
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease;
}
button:hover:not(:disabled), .file-button:hover {
  background: rgba(255, 255, 255, .09);
  border-color: rgba(255, 196, 111, .5);
}
button:active:not(:disabled) { transform: translateY(1px); }
button.primary {
  color: #17140f;
  background: linear-gradient(135deg, #ffc36b, #ffa53b);
  border: 1px solid #ffd18f;
  box-shadow: 0 7px 24px rgba(255, 155, 48, .2), inset 0 1px rgba(255, 255, 255, .45);
}
button.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #ffd18a, #ffb253);
  box-shadow: 0 9px 30px rgba(255, 155, 48, .3), inset 0 1px rgba(255, 255, 255, .55);
}
button:disabled { opacity: .48; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
summary:focus-visible, .file-button:focus-within {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

.player-status {
  min-height: 42px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 2px 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
#status { display: inline-flex; align-items: center; gap: 8px; }
#status::before {
  content: "";
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px rgba(114, 217, 178, .32);
}
#fps { flex: 0 0 auto; color: #c8d2cb; white-space: nowrap; font-variant-numeric: tabular-nums; }

.player-actions { display: flex; gap: 10px; }
.player-actions button {
  flex: 1;
  min-height: 40px;
  background: rgba(10, 16, 12, .76);
}
.settings-panel {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .3), inset 0 1px rgba(255, 255, 255, .025);
  backdrop-filter: blur(16px);
}
.sidebar-column { position: sticky; top: 18px; align-self: start; display: grid; gap: 12px; }
.ad-slot { min-width: 0; color: var(--muted); border-radius: 10px; }
.ad-slot.has-ad { background: rgba(7, 12, 10, .45); border: 1px solid rgba(160, 182, 168, .18); }
.ad-label { display: block; padding: 6px 9px 0; color: #8f9d93; font-size: 9px; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.ad-slot:not(.has-ad) .ad-label { display: none; }
.ad-banner-slot { display: none; justify-items: center; gap: 5px; margin-top: 12px; padding: 5px 8px 10px; }
.ad-banner-slot.ad-requested, .ad-banner-slot.has-ad { display: grid; }
.ad-banner-slot.has-ad { min-height: 82px; }
#ad-banner-wide-slot, #ad-banner-mobile-slot, #ad-loading-slot, #ad-side-300-slot, #ad-side-tall-slot { display: flex; width: 100%; align-items: center; justify-content: center; overflow: hidden; }
#ad-banner-wide-slot, #ad-banner-mobile-slot { min-height: 60px; }
#ad-loading-slot { min-height: 90px; }
#ad-banner-wide-slot iframe, #ad-banner-mobile-slot iframe, #ad-loading-slot iframe, #ad-side-300-slot iframe, #ad-side-tall-slot iframe, #ad-side-left-slot iframe { max-width: 100%; }
.ad-banner-mobile { display: none; }
.ad-rail { display: none; min-width: 0; }
.ad-side-slot { display: none; justify-items: center; gap: 7px; padding: 8px; overflow: hidden; color: var(--muted); background: rgba(7, 12, 10, .5); border: 1px solid var(--line); border-radius: 10px; }
.ad-side-slot.ad-requested, .ad-side-slot.has-ad { display: grid; }
.ad-side-slot .ad-label { display: block !important; padding: 2px 0 0; }
#ad-side-300-slot { min-height: 250px; }
#ad-side-tall-slot { min-height: 300px; }
#ad-side-left-slot { min-height: 300px; }
.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .018);
}
.tabs button {
  min-height: 46px;
  padding: 12px 5px 10px;
  color: #9ba89f;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: .8px;
  font-size: 10px;
  font-weight: 750;
}
.tabs button + button { border-left: 1px solid rgba(210, 233, 218, .055); }
.tabs button:hover { color: #e7eee8; background: rgba(255, 255, 255, .035); }
.tabs button[aria-selected="true"] {
  color: #fff;
  border-bottom-color: var(--accent);
  background: linear-gradient(180deg, transparent, rgba(255, 173, 69, .065));
}
.tab-panel { min-height: 300px; padding: 18px; }
h2 {
  margin: 23px 0 8px;
  color: #9bad9f;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.25px;
}
.tab-panel h2:first-child { margin-top: 4px; }
.save-backup { margin: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.save-backup summary { padding: 13px 0; color: #e4eae5; cursor: pointer; font-size: 12px; font-weight: 650; }
.save-backup[open] { padding-bottom: 8px; }
.keymap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px 14px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.keymap kbd { min-width: 92px; text-align: center; }
.binding-button { min-width: 132px; min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 8px; }
.binding-button kbd { min-width: 36px; padding: 3px 6px; }
.binding-button.listening { border-color: var(--accent); color: var(--accent-bright); box-shadow: 0 0 0 2px rgba(255, 173, 69, .12); }
.hint { margin: 0 0 13px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.setting {
  min-height: 49px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: #e4eae5;
  font-size: 13px;
}
.setting > select { max-width: 190px; }
.range-control { display: flex; align-items: center; gap: 10px; }
.range-control input { width: 126px; accent-color: var(--accent); }
output { min-width: 34px; color: var(--muted); text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
select, input[type="text"], #room-code {
  padding: 8px 10px;
  color: var(--text);
  background: #18231c;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font-size: 12px;
}
.value { color: #c0d0c4; font-size: 12px; }
.wide { display: block; width: 100%; margin: 12px 0; text-align: center; }
.online-note { display: grid; gap: 5px; margin: 10px 0 14px; padding: 12px 13px; border: 1px solid var(--line-strong); border-left: 3px solid var(--accent); border-radius: 9px; background: rgba(255, 173, 69, .055); font-size: 12px; line-height: 1.55; }
.online-note strong { color: var(--accent-bright); font-size: 12px; }
.online-note span { color: var(--muted); }
.online-note .online-presence { padding-top: 7px; border-top: 1px solid var(--line); color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.online-name-control { display: grid; gap: 7px; margin: 12px 0 4px; color: #e4eae5; font-size: 12px; }
.online-name-control > div { display: flex; gap: 7px; }
.online-name-control input { flex: 1; min-width: 0; }
.online-name-control button { padding: 7px 12px; }
.online-presence[data-state="active"] { color: var(--accent-bright); }
.online-presence[data-state="error"] { color: var(--muted); font-weight: 400; }
.leaderboard-rail { grid-column: 1 / -1; display: grid; align-content: start; gap: 12px; min-width: 0; margin-top: 22px; }
.leaderboard { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(12, 20, 15, .94); }
.leaderboard-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.leaderboard-heading h2 { margin: 0 0 4px; color: var(--text); font-size: 15px; }
.leaderboard-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.leaderboard-heading button { flex: 0 0 auto; padding: 6px 9px; font-size: 11px; }
.leaderboard-period { display: flex; gap: 6px; }
.leaderboard-period button[aria-pressed="true"] { border-color: var(--accent); color: #17140f; background: var(--accent); font-weight: 750; }
.leaderboard #leaderboard-status { margin: 5px 0 8px; }
.leaderboard-scroll { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.leaderboard table { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.leaderboard th, .leaderboard td { padding: 8px 7px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.leaderboard thead { position: sticky; top: 0; color: var(--muted); background: #121b16; }
.leaderboard tbody tr:last-child > * { border-bottom: 0; }
.leaderboard tbody th { color: var(--text); font-weight: 650; }
.leaderboard tbody td:nth-child(1) { color: var(--muted); }
.leaderboard tbody td:last-child { color: var(--accent-bright); font-weight: 750; }
.leaderboard-footnote { margin: 10px 0 0; font-size: 10px; }
@media (min-width: 1800px) {
  .layout { width: min(1360px, calc(100vw - 644px)); }
  .layout > .leaderboard-rail { position: absolute; top: 0; right: calc(100% + 14px); width: 250px; margin: 0; }
  .layout > .leaderboard-rail .leaderboard { max-height: 760px; overflow: auto; padding: 14px; }
  .layout > .leaderboard-rail .leaderboard-heading { display: grid; gap: 12px; }
  .layout > .leaderboard-rail .leaderboard-period button { flex: 1; }
  .layout > .leaderboard-rail .leaderboard-scroll { max-height: 410px; }
  .layout > .leaderboard-rail .leaderboard-footnote { line-height: 1.5; }
  .layout > .ad-rail { display: block; position: absolute; top: 0; left: calc(100% + 14px); width: 300px; }
}
.room-heading { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 8px; }
.room-heading h2 { margin: 0; }
.room-heading button { padding: 6px 10px; font-size: 11px; }
.room-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
#rooms { max-height: 180px; overflow: auto; }
#rooms p { color: var(--muted); font-size: 12px; line-height: 1.6; }
#join-form { margin-top: 20px; }
#join-form label { color: var(--muted); font-size: 12px; }
.join-row { display: flex; gap: 8px; margin-top: 8px; }
#room-code { width: 100%; letter-spacing: 3px; text-transform: uppercase; }
#room-label { color: var(--accent-bright); font-size: 13px; }
.chat-messages { display: flex; flex-direction: column; gap: 8px; height: 220px; margin: 14px 0 10px; padding: 10px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: rgba(0, 0, 0, .18); }
.chat-messages > .hint { margin: auto; text-align: center; }
.chat-message { max-width: 92%; padding: 8px 10px; border-radius: 9px; background: rgba(255, 255, 255, .055); overflow-wrap: anywhere; }
.chat-message.mine { align-self: flex-end; background: rgba(255, 173, 69, .12); }
.chat-message strong { display: block; margin-bottom: 3px; color: var(--accent-bright); font-size: 10px; }
.chat-message p { margin: 0; color: var(--text); font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.chat-form input { min-width: 0; padding: 9px 10px; color: var(--text); background: #18231c; border: 1px solid var(--line-strong); border-radius: 7px; font: inherit; font-size: 12px; }
.chat-form button { padding: 8px 12px; }
.chat-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.chat-modes button { min-height: 34px; padding: 7px 8px; font-size: 11px; }
.chat-modes button[aria-selected="true"] { border-color: var(--accent); color: var(--accent-bright); }
.public-chat-presence { margin: 0; color: var(--accent-bright); font-size: 11px; }
.public-chat-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-mute { min-height: 23px; padding: 2px 6px; border: 0; color: var(--muted); background: transparent; font-size: 10px; }
.chat-mute:hover { color: #ff9e8d; }
.control-steps { margin: 12px 0 16px; padding-left: 20px; color: var(--text); font-size: 12px; line-height: 1.65; }
.control-steps li + li { margin-top: 8px; }
.control-steps kbd { padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: rgba(255,255,255,.06); font: inherit; font-weight: 700; }
.controls-reference { display: grid; grid-template-columns: minmax(82px, .65fr) minmax(0, 1.35fr); gap: 9px 12px; margin: 12px 0 18px; font-size: 12px; }
.controls-reference dt { color: var(--muted); }
.controls-reference dd { margin: 0; line-height: 1.6; }
.controls-reference kbd { padding: 2px 5px; border: 1px solid var(--line-strong); border-radius: 4px; background: rgba(255,255,255,.06); font: inherit; font-weight: 700; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
#loading-indicator {
  position: absolute;
  bottom: 24px;
  left: 50%;
  width: max-content;
  max-width: min(90%, 600px);
  transform: translateX(-50%);
  padding: 14px 20px;
  color: #f3f6f2;
  background: rgba(15, 24, 19, .96);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .42);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}
.screen[data-booting] #loading-indicator { bottom: 122px; }
.screen[data-booting][data-runtime-visible] iframe { opacity: 1 !important; }
.screen[data-booting]:not([data-match-loading]) .loading-ad { display: none !important; }
.screen[data-match-loading] .loading-ad { display: grid; }
.screen.fullscreen-active[data-booting] #loading-indicator {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  max-width: min(88%, 560px);
  background: rgba(7, 12, 10, .9);
  z-index: 15;
}
.loading-ad {
  display: none;
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: 16px;
  width: min(760px, 94%);
  min-height: 104px;
  transform: translateX(-50%);
  justify-items: center;
  gap: 4px;
  padding: 4px 8px 8px;
  border: 1px solid rgba(160, 182, 168, .2);
  border-radius: 8px;
  background: rgba(7, 12, 10, .92);
}
.screen[data-booting] .loading-ad { display: grid; }
.screen[data-booting] #loading-ad iframe { opacity: 1 !important; }
.loading-ad .ad-label { padding-top: 0; }
.screen[data-booting][data-loading-ad] #loading-indicator { bottom: 122px; }
#ad-loading-slot { min-height: 90px; }
#ad-loading-slot iframe { max-width: 100%; }
.loading-ad:not(.has-ad):not(.ad-requested) #ad-loading-slot { display: none; }
.loading-ad-fallback { display: flex; min-height: 68px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 100%; padding: 8px; color: var(--text); text-align: center; text-decoration: none; background: linear-gradient(120deg, rgba(255,173,69,.16), rgba(15,24,19,.98)); border: 1px solid rgba(255,196,111,.3); border-radius: 6px; }
.loading-ad-fallback strong { color: var(--accent-bright); font-size: 15px; }
.loading-ad-fallback span { color: var(--muted); font-size: 11px; }
.loading-ad.has-ad .loading-ad-fallback { display: none; }

pre {
  max-height: 460px;
  overflow: auto;
  margin: 16px 0;
  color: #c0cec4;
  font-size: 10px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
dialog {
  width: min(470px, 90vw);
  padding: 24px;
  color: var(--text);
  background: #111a15;
  border: 1px solid #536458;
  border-radius: 13px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .48);
}
dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.dialog-heading h2 { margin: 0; color: #fff; font-size: 16px; letter-spacing: 0; text-transform: none; }
dialog p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.keys { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 12px; font-size: 13px; }
kbd { display: inline-block; padding: 4px 7px; color: #edf3ee; background: #ffffff09; border: 1px solid var(--line-strong); border-radius: 5px; font-size: 12px; }
footer {
  position: relative;
  z-index: 1;
  padding: 22px max(4vw, calc((100vw - 1360px) / 2));
  color: #b8c3bb;
  background: rgba(5, 10, 7, .86);
  border-top: 1px solid var(--line-strong);
  text-align: center;
  font-size: 12px;
  line-height: 1.9;
}
footer a { color: #aabbb0; text-decoration: none; }
footer a:hover { color: var(--accent-bright); }
.footer-contact {
  width: min(900px, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 18px;
  padding: 15px 18px;
  text-align: left;
  background: linear-gradient(110deg, rgba(255, 173, 69, .08), rgba(255, 255, 255, .025));
  border: 1px solid var(--line-strong);
  border-radius: 11px;
}
.footer-contact-copy { flex: 1; display: grid; gap: 2px; }
.footer-contact-copy strong { color: #eef3ef; font-size: 13px; }
.footer-contact-copy span { color: var(--muted); font-size: 11px; }
a.footer-action {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  color: #20180e;
  background: var(--accent-bright);
  border: 1px solid #ffdaa0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  transition: background .16s ease, transform .16s ease;
}
a.footer-action:hover { color: #20180e; background: #ffd18b; transform: translateY(-1px); }
a.footer-action-secondary { color: #e7eee8; background: rgba(255, 255, 255, .045); border-color: var(--line-strong); }
a.footer-action-secondary:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.footer-support-note { width: min(900px, 100%); margin: -10px auto 14px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.footer-meta { color: #b8c3bb; }
.legal-links { position: relative; z-index: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; width: min(900px, 100%); margin: 0 auto 12px; font-size: 11px; }
.legal-links a { color: #c9d4cc; }
.legal-links a:hover { color: var(--accent-bright); }

@media (min-width: 1500px) { .layout { margin-top: 40px; } }
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; width: 96vw; }
  .tab-panel { padding: 15px; }
  .setting { gap: 9px; font-size: 12px; }
  .range-control input { width: 105px; }
  .setting > select { max-width: 160px; }
}
@media (max-width: 740px) {
  header { gap: 12px; }
  .header-tools { gap: 10px; }
  .language-picker span { display: none; }
  .language-picker select { max-width: 116px; }
  header { min-height: 64px; padding: 11px 5vw; }
  .brand { padding-left: 42px; font-size: 21px; }
  .brand::before { width: 32px; height: 32px; border-radius: 10px; }
  .header-note { display: none; }
  .layout { grid-template-columns: 1fr; width: 92vw; gap: 14px; margin: 20px auto 34px; }
  .ad-banner-slot.has-ad { min-height: 65px; }
  .ad-banner-wide { display: none; }
  .ad-banner-mobile { display: flex; }
  #ad-banner-mobile-slot { min-height: 50px; }
  #loading-ad { bottom: 8px; min-height: 70px; padding: 6px; }
  #ad-loading-slot { min-height: 50px; }
  .loading-ad-fallback { min-height: 56px; }
  .screen { border-radius: 10px; }
  #start-panel { padding: 16px; }
  #start-panel h1 { font-size: clamp(20px, 6vw, 27px); }
  #start-panel p { margin: 8px 0 12px; font-size: 12px; }
  #start-panel button { min-height: 42px; padding: 10px; font-size: 13px; }
  #start-panel small, .emblem { display: none; }
  .player-actions { gap: 7px; }
  .player-actions button { min-height: 40px; padding: 8px 5px; font-size: 11px; }
  .sidebar-column { position: static; }
  .settings-panel { position: static; }
  .tab-panel { min-height: unset; padding: 16px; }
  .tabs button { min-height: 44px; padding-inline: 2px; font-size: 8px; letter-spacing: .35px; }
  footer { padding: 18px 4vw; }
  .footer-contact { flex-wrap: wrap; justify-content: flex-start; gap: 8px; padding: 13px; }
  .footer-contact-copy { flex: 1 1 100%; padding-bottom: 3px; }
  a.footer-action { flex: 1; }
}
@media (max-width: 420px) {
  .player-status { font-size: 11px; }
  .range-control { gap: 6px; }
  .range-control input { width: 90px; }
  .join-row { align-items: stretch; }
  .join-row button { flex: 0 0 auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

/* FIFA Street 2 theme: concrete, chain-link and street orange over the shared layout. */
:root {
  --bg: #0c0c0e;
  --panel: rgba(22, 22, 25, .96);
  --panel-soft: rgba(18, 18, 21, .9);
  --line: rgba(228, 222, 210, .13);
  --line-strong: rgba(228, 222, 210, .23);
  --muted: #bab4aa;
  --subtle: #8f8a82;
  --accent: #ff7a1a;
  --accent-bright: #ffa04d;
  --mint: #2ec4d6;
}
body::before { background: linear-gradient(145deg, rgba(10, 10, 12, .62), rgba(8, 8, 10, .9)), url('/arena.svg') center / cover; filter: blur(10px) saturate(.9); }
header { background: rgba(12, 12, 14, .9); }
.brand { text-transform: uppercase; letter-spacing: -.6px; text-shadow: 0 2px 18px rgba(255, 122, 26, .18); }
.brand::before { background: url('/favicon.svg') center / cover, #141414; border-color: rgba(255, 160, 77, .7); box-shadow: 0 0 20px rgba(255, 122, 26, .16); }
.brand small { color: #b8b0a4; }
.header-note::before { box-shadow: 0 0 12px rgba(46, 196, 214, .5); }
.language-picker select { background: rgba(26, 26, 30, .92); }
.screen { background: #050506; box-shadow: 0 22px 70px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 122, 26, .05); }
.screen iframe { width: 100%; height: 100%; border: 0; display: block; }
.screen[data-booting]:not([data-runtime-visible]) iframe { opacity: 0; }
.screen[data-booting] #loading-indicator { display: block; }
.gamepad-hint { border-color: rgba(255, 140, 60, .42); background: linear-gradient(105deg, rgba(255, 122, 26, .13), rgba(255, 255, 255, .025)); }
#start-panel {
  background:
    linear-gradient(180deg, rgba(8, 8, 10, .55), rgba(8, 8, 10, .92) 72%),
    url('/arena.svg') center 40% / cover;
}
#start-panel::after { background: linear-gradient(90deg, transparent, rgba(255, 122, 26, .5), transparent); box-shadow: 0 0 30px rgba(255, 122, 26, .16); }
#start-panel h1 { font-style: italic; font-weight: 950; text-transform: uppercase; letter-spacing: -.5px; }
#start-panel h1 span { color: var(--accent); }
#start-panel p { color: #d6cfc4; }
.emblem { letter-spacing: 4px; text-shadow: 0 0 22px rgba(255, 122, 26, .45); }
.binding-button.listening { box-shadow: 0 0 0 2px rgba(255, 122, 26, .14); }
.online-note { background: rgba(255, 122, 26, .06); }
.leaderboard-period button[aria-pressed="true"] { color: #170f08; }
.ad-native-slot { display: none; gap: 5px; margin-top: 12px; padding: 5px 8px 8px; }
.ad-native-slot.ad-requested, .ad-native-slot.has-ad { display: grid; }
#ad-native-slot { width: 100%; overflow: hidden; }
.touch-controls { display: none; position: absolute; z-index: 8; inset: 0; overflow: hidden; pointer-events: none; touch-action: none; user-select: none; -webkit-user-select: none; }
body.touch-device .screen[data-runtime-visible] .touch-controls { display: block; }
.touch-controls button { position: absolute; display: flex; align-items: center; justify-content: center; padding: 0; color: #fff; background: rgba(18, 22, 27, .48); border: 1px solid rgba(255,255,255,.35); box-shadow: 0 2px 10px rgba(0,0,0,.22); font-size: 12px; font-weight: 750; line-height: 1; pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.touch-controls button.pressed { background: rgba(255, 122, 26, .76); border-color: rgba(255,220,180,.9); transform: scale(.96); }
.touch-shoulders button { top: 10px; width: clamp(42px, 10vw, 60px); height: 34px; border-radius: 12px 12px 6px 6px; }
.touch-left-shoulders button:first-child { left: max(10px, env(safe-area-inset-left)); }
.touch-left-shoulders button:last-child { left: max(58px, calc(10px + env(safe-area-inset-left) + 48px)); }
.touch-right-shoulders button:first-child { right: max(58px, calc(10px + env(safe-area-inset-right) + 48px)); }
.touch-right-shoulders button:last-child { right: max(10px, env(safe-area-inset-right)); }
.touch-center { position: absolute; top: 10px; left: 50%; display: flex; gap: 6px; transform: translateX(-50%); pointer-events: none; }
.touch-center button { position: static; min-width: 52px; height: 30px; padding: 0 8px; border-radius: 16px; font-size: 9px; pointer-events: auto; }
.touch-stick { width: 96px; height: 96px; border-radius: 50%; background: rgba(15,19,24,.34) !important; }
.touch-stick-knob { display: flex; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,.33); border: 1px solid rgba(255,255,255,.38); font-size: 16px; transform: translate(0,0); pointer-events: none; }
.touch-move { left: 14px; bottom: 16px; }
.touch-tricks { left: calc(50% - 40px); bottom: 16px; width: 80px; height: 80px; }
.touch-face { position: absolute; right: 10px; bottom: 10px; display: grid; grid-template-columns: repeat(3, 36px); grid-template-rows: repeat(3, 36px); gap: 2px; pointer-events: none; }
.touch-face button { position: static; border-radius: 50%; font-size: 18px; pointer-events: auto; }
.touch-triangle { grid-area: 1 / 2; } .touch-square { grid-area: 2 / 1; }
.touch-circle { grid-area: 2 / 3; } .touch-cross { grid-area: 3 / 2; }
@media (orientation: landscape) and (pointer: coarse) {
  .touch-move { left: max(18px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); width: 106px; height: 106px; }
  .touch-tricks { left: 57%; bottom: max(18px, env(safe-area-inset-bottom)); width: 88px; height: 88px; }
  .touch-face { right: max(16px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); grid-template-columns: repeat(3, 42px); grid-template-rows: repeat(3, 42px); }
  .touch-shoulders button { top: max(12px, env(safe-area-inset-top)); width: 60px; height: 38px; }
}
@media (max-width: 360px) and (orientation: portrait) {
  .touch-move { width: 80px; height: 80px; left: 8px; }
  .touch-tricks { width: 70px; height: 70px; left: calc(50% - 35px); }
  .touch-face { right: 6px; grid-template-columns: repeat(3, 31px); grid-template-rows: repeat(3, 31px); }
  .touch-face button { font-size: 15px; }
}
.control-table { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 14px; font-size: 13px; }
.control-table dt { color: var(--muted); }
.control-table dd { margin: 0; }
