: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; }
.related-game {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  padding: 14px;
  border: 1px solid rgba(255, 173, 69, .3);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 173, 69, .1), rgba(12, 20, 15, .96) 62%);
}
.related-game-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; filter: drop-shadow(0 4px 10px rgba(255, 173, 69, .16)); }
.related-game-mark svg { display: block; width: 100%; height: 100%; }
.related-game-copy { min-width: 0; }
.related-game-kicker { color: var(--accent-bright); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.related-game h2 { margin: 5px 0 6px; color: var(--text); font-size: 15px; line-height: 1.25; }
.related-game p { margin: 0 0 11px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.related-game a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; padding: 8px 11px; border: 1px solid rgba(255, 196, 111, .4); border-radius: 8px; color: #17140f; background: var(--accent); font-size: 11px; font-weight: 800; text-decoration: none; }
.related-game a::after { content: "↗"; font-size: 14px; }
.related-game a:hover { background: var(--accent-bright); }
.related-game a:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.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: 10px; padding: 5px 4px 7px; border: 1px solid transparent; }
.ad-banner-slot.ad-requested, .ad-banner-slot.has-ad { display: grid; }
.ad-banner-slot.ad-requested .ad-label { display: block; }
.ad-banner-slot.ad-requested, .ad-banner-slot.has-ad { min-height: 82px; }
#ad-banner-wide-slot, #ad-banner-mobile-slot, #ad-loading-slot, #ad-side-tall-slot { display: flex; width: 100%; align-items: center; justify-content: center; overflow: hidden; }
#ad-sidebar-300-slot { display: flex; width: 100%; min-height: 250px; 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-sidebar-300-slot iframe, #ad-side-tall-slot iframe, #ad-side-left-slot iframe { max-width: 100%; }
#ad-banner-mobile-slot { display: none; }
.ad-rail { display: none; min-width: 0; }
.ad-sidebar-slot { display: none; justify-items: center; gap: 7px; margin-top: 12px; padding: 8px; overflow: hidden; color: var(--muted); background: rgba(7, 12, 10, .5); border: 1px solid var(--line); border-radius: 10px; }
.ad-sidebar-slot.ad-requested, .ad-sidebar-slot.has-ad { display: grid; }
.ad-sidebar-slot .ad-label { display: block !important; padding: 2px 0 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-tall-slot { min-height: 300px; }
#ad-side-left-slot { min-height: 300px; }
.sponsor-feature {
  display: grid;
  gap: 14px;
  padding: 12px;
  overflow: hidden;
  background: linear-gradient(150deg, rgba(255,173,69,.105), rgba(14,22,18,.98) 58%);
  border: 1px solid rgba(255,173,69,.34);
  border-radius: 13px;
  box-shadow: 0 14px 38px rgba(0,0,0,.2);
}
.sponsor-creative {
  position: relative;
  display: flex;
  min-height: 205px;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  padding: 22px;
  isolation: isolate;
  background: radial-gradient(ellipse at 78% 20%, rgba(255,196,111,.23), transparent 33%), linear-gradient(135deg, #18251d, #080d0b 74%);
  border: 1px solid rgba(255,196,111,.28);
  border-radius: 9px;
}
.sponsor-creative::before, .sponsor-creative::after { position: absolute; z-index: -1; content: ""; border: 1px solid rgba(255,196,111,.14); border-radius: 50%; }
.sponsor-creative::before { width: 240px; height: 240px; right: -55px; top: -100px; }
.sponsor-creative::after { width: 165px; height: 165px; right: -18px; top: -62px; }
.sponsor-creative-kicker, .sponsor-creative-footer { color: #c4aa82; font-size: 9px; font-weight: 800; letter-spacing: 1.7px; }
.sponsor-creative strong { max-width: 240px; color: #fff6e8; font-size: clamp(23px, 2vw, 29px); line-height: 1.08; letter-spacing: -.7px; }
.sponsor-creative-footer { margin-top: 8px; color: #91a197; font-size: 8px; letter-spacing: 2.2px; }
.sponsor-creative-orbit { position: absolute; top: 22px; right: 34px; color: var(--accent-bright); font-size: 34px; text-shadow: 0 0 24px rgba(255,196,111,.55); }
.sponsor-copy h2 { margin: 0 0 7px; color: #f4f7f3; font-size: 14px; line-height: 1.35; letter-spacing: 0; text-transform: none; }
.sponsor-copy p { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.sponsor-button { display: flex; min-height: 42px; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; color: #21180d; background: var(--accent-bright); border: 1px solid #ffd48e; border-radius: 7px; font-size: 12px; font-weight: 800; text-decoration: none; transition: background .16s ease, transform .16s ease; }
.sponsor-button:hover { color: #21180d; background: #ffd18b; transform: translateY(-1px); }
.sponsor-button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.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; }
/* Set briefly by ads.js whenever the loading ad appears over the game. */
.loading-ad.ad-click-guard iframe { pointer-events: 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(1100px, 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-bottom {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px 28px;
  margin: 0 auto;
  text-align: left;
}
.footer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 16px; color: #b8c3bb; font-size: 10px; line-height: 1.6; }
.footer-bottom-links { display: grid; justify-items: end; gap: 9px; }
.footer-bottom .legal-links { position: relative; z-index: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 13px; width: auto; margin: 0; font-size: 10px; }
.footer-bottom .legal-links a { color: #c9d4cc; }
.footer-bottom .legal-links a:hover { color: var(--accent-bright); }
.footer-creator-link { display: inline-flex; align-items: center; gap: 6px; color: #e6eee8; font-size: 11px; line-height: 1.4; }
.footer-creator-link strong { color: var(--accent-bright); font-weight: 750; }
.footer-creator-link:hover strong { color: #ffe0a8; }

@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; }
  #ad-banner-wide-slot { display: none; }
  #ad-banner-mobile-slot { display: flex; }
  #ad-banner-mobile-slot { min-height: 50px; }
}
@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.ad-requested, .ad-banner-slot.has-ad { min-height: 65px; }
  #ad-banner-wide-slot { display: none; }
  #ad-banner-mobile-slot { 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; }
  .sponsor-feature { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; padding: 12px; }
  .sponsor-creative { min-height: 190px; }
  .sponsor-copy { display: flex; flex-direction: column; justify-content: center; }
  .sponsor-copy h2 { font-size: 15px; }
  .sponsor-copy p { font-size: 12px; }
  .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-bottom { grid-template-columns: 1fr; gap: 12px; }
  .footer-bottom-links { justify-items: start; gap: 8px; }
  .footer-bottom .legal-links { justify-content: flex-start; }
  .footer-meta { gap: 4px 12px; }
  .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) {
  .sponsor-feature { grid-template-columns: 1fr; }
  .sponsor-creative { min-height: 168px; }
  .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; } }

/* Catalog card: copy first, no game logo. */
.related-game-catalog { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.related-game-catalog .related-game-copy { display: block; grid-column: 1; }
.related-game-catalog .related-game-kicker { font-size: 11px; letter-spacing: .14em; }
.related-game-catalog h2 { margin: 5px 0 6px; font-size: 19px; }
.related-game-catalog p { margin: 0 0 11px; }
.related-game-catalog a { margin-top: 0; }
