:root {
  color-scheme: light;
  --bg: #a3b4c6;
  --bg-deep: #93a6ba;
  --paper: #c9d1d9;
  --paper-dark: #aeb8c2;
  --panel: #c5d2df;
  --panel-2: #b7c6d5;
  --panel-3: #a9bacb;
  --line: #6d8096;
  --line-strong: #5f7186;
  --line-soft: rgba(47, 66, 87, 0.22);
  --bevel-light: rgba(255, 255, 255, 0.8);
  --bevel-dark: rgba(64, 80, 98, 0.3);
  --ink: #16283c;
  --muted: #3d5670;
  --faint: #56718c;
  --blue-hi: #8fb7e6;
  --blue-lo: #5d87c0;
  --blue-border: #2c4a72;
  --olive: #33567c;
  --olive-bright: #33567c;
  --yellow: #f2c531;
  --gold-ink: #8a6c14;
  --rust: #9e4d36;
  --red: #b03a28;
  --cyan: #1e6b72;
  --green: #3f7a34;
  --well: #0d0f12;
  --well-line: #1c232b;
  --well-text: #9fd3f2;
  --well-text-dim: #6fa4c6;
  --sel-bg: #bcd9ef;
  --sel-ink: #10304f;
  --shadow: 0 12px 30px rgba(43, 58, 74, 0.32);
  --radius: 12px;
  --radius-small: 7px;
  --font: Verdana, Tahoma, "Trebuchet MS", system-ui, sans-serif;
  --mono: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #101a28; }
/* Dark blue-steel backdrop behind the centered game plate (Flash-embed look). */
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.35;
  background:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(180deg, #2a3b52 0%, #1a2838 52%, #101a28 100%);
  background-attachment: fixed;
  background-size: 64px 64px, 64px 64px, auto;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .14;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}
button, input, select { font: inherit; }
button { color: inherit; }
button, input, select, canvas { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible {
  outline: 2px solid #1d5cab;
  outline-offset: 2px;
}
button:disabled { cursor: not-allowed; opacity: .48; }
.hidden { display: none !important; }
.muted-copy { color: var(--muted); }
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Centered game plate: tabs mount on the top edge, content lives inside. */
.game-plate { width: min(1200px, calc(100% - 28px)); margin: 8px auto 14px; }
.plate-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: -1px;
  padding: 0 14px;
}
body.in-game #site-header { display: none; }
.brand-button {
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 0 9px;
  background: transparent;
  cursor: pointer;
}
.brand-crest {
  position: relative;
  width: 39px;
  height: 39px;
  display: inline-block;
  border: 2px solid #2b3d52;
  border-radius: 50%;
  background: #dfe8f1;
  box-shadow: inset 0 0 0 4px #b7c7d7, 0 1px 0 rgba(255,255,255,.7);
}
.brand-crest::before, .brand-crest::after, .brand-crest i, .brand-crest b {
  content: "";
  position: absolute;
  background: #2b3d52;
  transform-origin: center;
}
.brand-crest::before { width: 3px; height: 22px; left: 18px; top: 9px; transform: rotate(-7deg); }
.brand-crest::after { width: 16px; height: 3px; left: 11px; top: 17px; transform: rotate(20deg); }
.brand-crest i { width: 12px; height: 12px; left: 13px; top: 3px; border-radius: 50%; }
.brand-crest b { width: 16px; height: 3px; left: 11px; top: 28px; transform: rotate(-32deg); }
.brand-crest { transform: scale(.68); transform-origin: left center; margin-right: -8px; }
.brand-copy { display: grid; text-align: left; line-height: 1; }
.brand-copy strong { color: #dfe9f3; font-size: 12px; font-weight: 900; letter-spacing: .2em; text-shadow: 0 1px 2px rgba(0,0,0,.55); }

/* Main nav as chunky lobby tabs mounted on the plate edge. */
.main-nav { display: flex; align-items: flex-end; gap: 5px; padding: 9px 8px 0; }
.main-nav button {
  min-width: 88px;
  padding: 9px 15px 10px;
  border: 1px solid #46586d;
  border-bottom: 0;
  border-radius: 11px 11px 0 0;
  background: linear-gradient(180deg, #b0bfcf 0%, #96a9bc 100%);
  color: #24384e;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -4px 6px rgba(52,68,86,.22);
}
.main-nav button:last-child { border-right: 1px solid #46586d; }
.main-nav button:hover { background: linear-gradient(180deg, #c2d0de 0%, #a4b6c8 100%); }
.main-nav button.active {
  padding-bottom: 13px;
  margin-bottom: -1px;
  border-color: #3c4e63;
  background: linear-gradient(180deg, #e5edf4 0%, #c8d6e3 100%);
  color: var(--ink);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.85), 0 -3px 8px rgba(31,45,61,.18);
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; padding: 0 0 8px; }
.network-chip { display: inline-flex; align-items: center; padding: 3px; }
#network-dot { width: 8px; height: 8px; border-radius: 50%; background: #63798f; box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
#network-dot.connected { background: #3f8a34; box-shadow: 0 0 0 3px rgba(63,138,52,.2); }
#network-dot.connecting, #network-dot.disconnected { background: #c79a12; animation: blink 1s steps(2,end) infinite; }
#network-dot.error, #network-dot.closed { background: var(--red); }
@keyframes blink { 50% { opacity: .35; } }
.profile-chip {
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 9px 3px 4px;
  background: linear-gradient(180deg, #dbe4ee, #bfcddc);
  cursor: pointer;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 1px 3px rgba(0,0,0,.35);
}
.profile-chip:hover { border-color: #3c5b82; background: linear-gradient(180deg, #e6eef6, #ccd9e6); }
.profile-chip > span:last-child { min-width: 0; display: grid; }
.profile-chip strong { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.rank-emblem, .mini-rank, .chat-rank {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #22364d;
  border-radius: 5px;
  background: linear-gradient(180deg, #3d5a7d, #2b4260);
  color: #eaf2fb;
  font: 800 10px var(--mono);
  box-shadow: inset 0 0 0 2px rgba(214, 228, 242, .35), 0 1px 0 rgba(255,255,255,.5);
}
.rank-emblem { width: 26px; height: 26px; border-radius: 4px; }
.mini-rank, .chat-rank { width: 27px; height: 27px; font-size: 8px; }

/* The plate body: one beveled panel holding every screen. */
#screens {
  position: relative;
  width: 100%;
  min-height: 700px;
  border: 1px solid #3c4e63;
  border-radius: 14px;
  background: linear-gradient(180deg, #ccd8e4 0%, #b9c8d7 55%, #a9bacb 100%);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.8),
    inset 2px 0 0 rgba(255,255,255,.35),
    inset 0 -3px 0 rgba(64,80,98,.32),
    inset -2px 0 0 rgba(64,80,98,.16),
    0 26px 80px rgba(0,0,0,.55);
}
.screen {
  display: none;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 12px 14px 14px;
}
.screen.active { display: block; }
.screen.game-screen { display: none; }
.screen.game-screen.active { display: block; }
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: clamp(26px, 3.4vw, 42px);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: .015em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255,255,255,.55);
}
h2 { margin-bottom: 8px; font-size: 18px; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; }
h3 { margin-bottom: 6px; font-weight: 800; }
.eyebrow, .panel-kicker {
  margin-bottom: 8px;
  color: var(--olive-bright);
  font: 900 10px var(--font);
  letter-spacing: .18em;
  text-transform: uppercase;
}
.panel {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ccd8e4 0%, #b9c8d7 55%, #a9bacb 100%);
  box-shadow:
    inset 0 2px 0 var(--bevel-light),
    inset 2px 0 0 rgba(255,255,255,.35),
    inset 0 -2px 0 var(--bevel-dark),
    inset -2px 0 0 rgba(64,80,98,.16),
    var(--shadow);
}
.panel-title-row, .section-heading, .realm-heading, .profile-title-row, .saved-map-heading, .skin-card-heading, .weapon-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.realm-heading, .section-heading { margin-bottom: 28px; }
.realm-heading h1, .section-heading h1 { margin-bottom: 0; }
.section-heading > div > p:last-child { max-width: 750px; margin: 8px 0 0; color: var(--muted); }
.realm-stats-line { display: block; margin-bottom: 3px; color: var(--muted); font: 700 10px var(--font); letter-spacing: .05em; text-align: right; text-transform: uppercase; }
.realm-stats-line b { color: var(--ink); font-family: var(--mono); }

.button, .icon-button {
  border: 2px solid var(--blue-border);
  border-radius: 13px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.85) 0%, rgba(255,255,255,.3) 12%, rgba(255,255,255,0) 48%),
    linear-gradient(180deg, var(--blue-hi) 0%, #6f9ad0 52%, var(--blue-lo) 100%);
  color: #12304f;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  text-shadow: 0 1px rgba(255,255,255,.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 -3px 5px rgba(24, 48, 80, .32), 0 2px 4px rgba(30,44,60,.32);
  transition: transform 80ms ease, background 120ms ease, border-color 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}
.button { min-height: 40px; padding: 9px 16px; font-size: 11px; }
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { border-color: #234b7e; filter: brightness(1.08) saturate(1.05); }
.button:active:not(:disabled), .icon-button:active:not(:disabled) {
  transform: translateY(1px);
  filter: brightness(.93);
  box-shadow: inset 0 3px 6px rgba(16, 36, 62, .45), 0 1px 2px rgba(30,44,60,.25);
}
.button-primary {
  border-color: var(--blue-border);
  background:
    linear-gradient(180deg, rgba(255,255,255,.95) 0%, rgba(255,255,255,.4) 12%, rgba(255,255,255,0) 50%),
    linear-gradient(180deg, #b9d7f2 0%, #8fb4dd 52%, #6d99cc 100%);
  color: #10243e;
  text-shadow: 0 1px rgba(255,255,255,.55);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95), inset 0 -3px 5px rgba(35, 64, 102, .3), 0 2px 5px rgba(30,44,60,.32);
}
.button-primary:hover:not(:disabled) { border-color: #234b7e; filter: brightness(1.05); }
.button-primary:active:not(:disabled) { filter: brightness(.95); box-shadow: inset 0 3px 7px rgba(24, 46, 76, .4), 0 1px 2px rgba(30,44,60,.25); }
.button-secondary {
  border-color: #4c5f75;
  background:
    linear-gradient(180deg, rgba(255,255,255,.8) 0%, rgba(255,255,255,.28) 12%, rgba(255,255,255,0) 48%),
    linear-gradient(180deg, #c3cfdb 0%, #a7b8c8 52%, #8ea1b4 100%);
  color: #1d3247;
}
.button-ghost { background: transparent; box-shadow: none; border-color: #47617f; color: #24466c; text-shadow: none; }
.button-ghost:hover:not(:disabled) { background: rgba(143, 183, 230, .28); filter: none; }
.button-small { min-height: 33px; padding: 7px 11px; font-size: 9px; border-radius: 10px; }
.button-large { min-height: 52px; font-size: 12px; border-radius: 15px; }
.button-full { width: 100%; }
.button.danger, .icon-button.danger { border-color: #8a3a2a; color: #7c2415; }
.icon-button { width: 34px; height: 34px; padding: 0; font-size: 17px; border-radius: 10px; }
.compact-actions { display: flex; align-items: center; gap: 7px; }
.field-label { display: block; margin: 14px 0 6px; color: var(--muted); font: 800 9px var(--font); letter-spacing: .12em; text-transform: uppercase; }
.text-input, .select-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #63788e;
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: #eef3f8;
  box-shadow: inset 0 2px 4px rgba(43, 60, 78, .22), 0 1px 0 rgba(255,255,255,.55);
}
.text-input::placeholder { color: #7288a0; }
.text-input:focus, .select-input:focus { border-color: #2f6cb4; }
.large-input { min-height: 49px; font-size: 18px; font-weight: 800; }
.code-input { font: 800 16px var(--mono); letter-spacing: .2em; text-transform: uppercase; }

/* Lobby (Stick Arena proportions): chat well left ~60%, games/players wells + buttons right. */
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 16px; align-items: stretch; }
.lobby-side { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.lobby-block { display: flex; flex-direction: column; min-width: 0; }
.well-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.well-label { color: #33506e; font: 900 10px var(--font); letter-spacing: .16em; text-transform: uppercase; text-shadow: 0 1px 0 rgba(255,255,255,.55); }
.well-tools { display: flex; align-items: center; gap: 5px; }
.icon-button-small { width: 29px; height: 29px; font-size: 14px; border-radius: 8px; }
.well-toggle { display: flex; gap: 3px; }
.well-toggle button {
  width: 25px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #7d90a4;
  border-radius: 5px;
  background: linear-gradient(180deg, #d7e1ea, #becbd9);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}
.well-toggle button.active, .well-toggle button:hover {
  border-color: #b28f1e;
  background: linear-gradient(180deg, #eaf1f7, #d2dfeb);
  box-shadow: 0 0 0 1px rgba(242, 197, 49, .35);
}
.lobby-chat { display: flex; flex-direction: column; min-width: 0; }
.lobby-chat .chat-list {
  flex: 1;
  min-height: 380px;
  max-height: none;
  border: 1px solid #55687e;
  border-radius: 8px 8px 0 0;
  padding: 8px 10px;
  background: #edf2f7;
  box-shadow: inset 0 2px 6px rgba(43,60,78,.25);
}
.lobby-chat .chat-form {
  grid-template-columns: auto 1fr auto;
  padding: 8px 10px;
  border: 1px solid #55687e;
  border-top: 0;
  border-radius: 0;
  background: linear-gradient(180deg, #cbd7e2, #b3c2d2);
}
.chat-globe { display: grid; place-items: center; width: 28px; font-size: 15px; filter: saturate(.75); }
.chat-weapon-strip {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 3px 12px;
  border: 1px solid #55687e;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #b9c6d4, #a2b3c4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
}
.chat-weapon-strip canvas { height: 34px; width: auto; display: block; filter: drop-shadow(0 1px 1px rgba(30,44,60,.4)); }
.lobby-buttons { display: grid; gap: 8px; }
.lobby-buttons .button-large { min-height: 40px; font-size: 11px; }
.rank-progress { height: 9px; overflow: hidden; margin: 9px 0 6px; border: 1px solid #55687e; border-radius: 5px; background: var(--well); box-shadow: inset 0 2px 4px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.5); }
.rank-progress span { display: block; width: 100%; height: 100%; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, #4f79ab, var(--yellow)); transition: transform 220ms ease; }

/* Profile screen: compact Stick Arena service record, no page scroll. */
.profile-name-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 2px 0 8px; }
.profile-screen-name { margin: 0; color: #1d5cab; font-size: 25px; font-weight: 900; letter-spacing: .03em; text-shadow: 0 1px 0 rgba(255,255,255,.6); }
.profile-edit-name {
  width: 26px;
  height: 26px;
  border: 1px solid #7d90a4;
  border-radius: 6px;
  background: linear-gradient(180deg, #d7e1ea, #becbd9);
  color: #33506e;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.profile-edit-name:hover { border-color: #3c5b82; color: var(--ink); }
.profile-name-editor { display: flex; justify-content: center; gap: 6px; width: min(320px, 100%); margin: 0 auto 8px; }
.profile-banner {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(220px, 1fr) 200px;
  gap: 14px;
  align-items: center;
  min-height: 264px;
  margin-bottom: 10px;
  padding: 10px 20px;
  border: 1px solid #1d2836;
  border-radius: 10px;
  color: #d9e5f0;
  background: linear-gradient(180deg, #24364a 0%, #182634 58%, #111c28 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -2px 0 rgba(0,0,0,.45), 0 4px 14px rgba(0,0,0,.3);
}
#identity-avatar { width: 100%; max-width: 300px; height: 200px; display: block; justify-self: center; }
.profile-alt-portrait { width: 180px; height: 150px; display: block; justify-self: center; }
.profile-rank-block { display: grid; justify-items: center; gap: 3px; text-align: center; }
.profile-badge-row { display: flex; align-items: center; gap: 9px; margin-bottom: 3px; }
.badge-arrow {
  width: 24px;
  height: 34px;
  border: 1px solid #3a4d63;
  border-radius: 6px;
  background: linear-gradient(180deg, #2d4258, #1d2f42);
  color: #9db7cc;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.badge-arrow:hover { border-color: #b28f1e; color: #ffd93b; }
.profile-rank-badge { display: inline-grid; place-items: center; filter: drop-shadow(0 3px 6px rgba(0,0,0,.5)); }
.profile-rank-badge .rank-badge svg, .profile-rank-badge svg { width: 58px; height: 58px; }
.profile-test-tag { padding: 2px 5px; border: 1px solid #b28f1e; border-radius: 4px; color: #ffd93b; font: 900 8px var(--font); letter-spacing: .12em; }
.profile-rank-line { color: #ffd93b; font: 900 22px var(--font); letter-spacing: .03em; text-shadow: 0 2px 0 rgba(0,0,0,.55); }
.profile-rank-block strong { color: #cfe0ef; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.profile-rank-block small { color: #87a3bc; font: 800 10px var(--mono); letter-spacing: .08em; }
.profile-rank-progress { width: 240px; max-width: 100%; margin: 8px 0 2px; }
.profile-progress-copy { color: #9db7cc; font-size: 10px; letter-spacing: 0; text-transform: none; }
.profile-columns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 12px; align-items: stretch; }
.profile-skins-panel { display: flex; flex-direction: column; height: 322px; padding: 0 12px 12px; }
.profile-tabs { display: flex; gap: 4px; margin: 0 -12px 8px; padding: 7px 10px 0; border-bottom: 1px solid var(--line); }
.profile-tabs button {
  border: 1px solid #7d90a4;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  padding: 6px 16px 7px;
  background: linear-gradient(180deg, #b0bfcf, #96a9bc);
  color: #24384e;
  cursor: pointer;
  font: 900 10px var(--font);
  letter-spacing: .06em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.profile-tabs button.active { margin-bottom: -1px; padding-bottom: 8px; background: linear-gradient(180deg, #e5edf4, #c8d6e3); color: var(--ink); }
.profile-tabs button:disabled { cursor: not-allowed; opacity: .55; }
.career-line { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.career-line b { color: var(--gold-ink); }
.profile-skins-panel .skin-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
  padding-right: 2px;
}
.profile-skins-panel .skin-card { padding: 6px; border-radius: 7px; box-shadow: inset 0 1px 0 rgba(255,255,255,.5); }
.profile-skins-panel .skin-card canvas { width: calc(100% + 12px); margin: -6px -6px 4px; }
.profile-skins-panel .skin-card p { display: none; }
.profile-skins-panel .skin-card .rarity { display: none; }
.profile-skins-panel .skin-card-heading strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.profile-skins-panel .skin-card .button { min-height: 22px; margin-top: 4px; padding: 2px 3px; border-width: 1px; border-radius: 5px; font-size: 7px; }
/* Cosmetic tabs (Spinners / Pets): SA-style carousel with animated preview. */
.profile-tab-view { display: none; flex-direction: column; flex: 1; min-height: 0; }
.profile-tab-view.active { display: flex; }
.cosmetic-carousel { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 4px; }
.cosmetic-carousel canvas {
  width: 220px;
  height: 128px;
  border: 1px solid #1d2836;
  border-radius: 8px;
  background: linear-gradient(180deg, #24364a 0%, #16232f 60%, #101a24 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -2px 0 rgba(0,0,0,.4);
}
.carousel-arrow {
  width: 28px;
  height: 52px;
  border: 1px solid #7d90a4;
  border-radius: 7px;
  background: linear-gradient(180deg, #d7e1ea, #becbd9);
  color: #33506e;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.carousel-arrow:hover { border-color: #3c5b82; color: var(--ink); }
.cosmetic-meta { margin: 7px 0 5px; text-align: center; }
.cosmetic-meta strong { display: block; font-size: 13px; }
.cosmetic-meta small { color: var(--muted); font: 800 9px var(--mono); letter-spacing: .09em; }
.cosmetic-controls { display: flex; align-items: center; justify-content: center; gap: 10px; }
.cosmetic-color { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font: 900 10px var(--font); }
.cosmetic-color input {
  width: 36px;
  height: 26px;
  padding: 1px;
  border: 1px solid #7d90a4;
  border-radius: 6px;
  background: #e7edf3;
  cursor: pointer;
}
.cosmetic-controls .button { min-height: 26px; padding: 4px 14px; font-size: 9px; }
.profile-stats-well {
  height: 322px;
  overflow-y: auto;
  border: 1px solid #55687e;
  border-radius: 8px;
  padding: 10px 14px;
  color-scheme: dark;
  color: #d7e4ef;
  background: var(--well);
  box-shadow: inset 0 3px 8px rgba(0,0,0,.65), 0 1px 0 rgba(255,255,255,.4);
}
.stats-well-title { display: block; margin-bottom: 7px; color: #9db7cc; font: 900 10px var(--font); letter-spacing: .2em; }
/* Tight SA stat lines, shared by the profile screen and the player dialog. */
.profile-stat-list { margin: 0; display: grid; gap: 1px; }
.profile-stat-list > div { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; }
.profile-stat-list dt { color: #cfe0ef; font-size: 13px; font-weight: 700; }
.profile-stat-list dt::after { content: ":"; }
.profile-stat-list dd { margin: 0; color: #eaf2fb; font: 800 13px var(--mono); }
.profile-stat-list dd.stat-positive { color: #7ed36a; }
.profile-stat-list dd.stat-negative { color: #ff6d5a; }
.account-line { margin-top: 6px; display: flex; align-items: center; gap: 8px; padding: 5px 10px; }
.account-line b { flex: 0 0 auto; font-size: 10px; }
.account-line small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 9px; }

.room-filter-select {
  width: auto;
  min-height: 29px;
  max-width: 140px;
  padding: 4px 7px;
  font: 800 9px var(--font);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.room-list {
  height: 195px;
  overflow: auto;
  border: 1px solid #55687e;
  border-radius: 8px;
  color-scheme: dark;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='260'%3E%3Ctext x='24' y='12' fill='rgba(255,255,255,0.09)' font-family='Verdana,sans-serif' font-size='24' font-weight='900' letter-spacing='7' transform='rotate(90 24 12)'%3EGAMES%3C/text%3E%3C/svg%3E") right 6px top 12px no-repeat,
    var(--well);
  box-shadow: inset 0 3px 8px rgba(0,0,0,.65), 0 1px 0 rgba(255,255,255,.55);
}
/* Compact two-line room row for the narrow games well. */
.room-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 3px 10px;
  align-items: center;
  min-height: 62px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--well-line);
  background: transparent;
  color: var(--well-text);
}
.room-identity { grid-column: 1; grid-row: 1; }
.room-player-cell { grid-column: 2; grid-row: 1; justify-self: end; }
.room-row > .button { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
.room-map-cell { grid-column: 1; grid-row: 2; }
.room-mode-cell { grid-column: 2; grid-row: 2; justify-self: end; text-align: right; }
.room-row:nth-child(even) { background: #12161b; }
.room-row:hover { background: var(--sel-bg); color: var(--sel-ink); }
.room-row.live { opacity: .66; }
.room-identity, .room-map-cell, .room-mode-cell { min-width: 0; display: grid; }
.room-identity strong, .room-map-cell strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.room-identity small, .room-map-cell small, .room-mode-cell small { color: var(--well-text-dim); font: 9px var(--mono); }
.room-row:hover .room-identity small, .room-row:hover .room-map-cell small, .room-row:hover .room-mode-cell small { color: #33566f; }
.room-player-cell { display: flex; align-items: center; gap: 8px; }
.room-player-cell b { font: 12px var(--mono); }
.player-dots { width: 31px; height: 6px; background: repeating-linear-gradient(90deg, #4c749f 0 4px, transparent 4px 6px); opacity: .75; }
.status-pill { width: fit-content; padding: 3px 5px; border: 1px solid #3f5a7e; border-radius: 4px; font: 800 7px var(--font); letter-spacing: .08em; }
.status-pill.ranked { border-color: #a8862a; color: #e6cf72; }
.status-pill.casual { color: #9db4c6; }
.room-row:hover .status-pill { border-color: #4c6a8c; color: #2c4763; }
.room-row:hover .status-pill.ranked { border-color: #8a6c14; color: #7a5c0e; }
.browser-empty { min-height: 160px; display: grid; place-content: center; padding: 8px; color: #7fa5c4; font-size: 12px; text-align: center; }
.browser-empty.small { min-height: 150px; }
.join-code-strip { display: grid; grid-template-columns: auto 160px auto; align-items: center; gap: 9px; margin-top: 12px; }
.join-code-strip label { color: var(--muted); font: 800 9px var(--font); letter-spacing: .06em; text-transform: uppercase; }

.social-view { display: none; min-height: 0; }
.social-view.active { display: block; }
.chat-list { flex: 1; min-height: 360px; max-height: 530px; overflow-y: auto; padding: 10px; background: rgba(255,255,255,.28); box-shadow: inset 0 2px 5px rgba(43,60,78,.14); }
/* Stick Arena chat line: [badge] <Name> message */
.chat-row { padding: 3px 4px 4px; border-bottom: 1px solid rgba(22, 40, 60, .1); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.chat-rank-badge { vertical-align: -6px; margin-right: 5px; }
.chat-name { display: inline; padding: 0; border: 0; background: transparent; cursor: pointer; color: var(--ink); font-size: 13px; font-weight: 900; letter-spacing: .01em; }
.chat-name:hover { text-decoration: underline; }
.chat-text { margin-left: 6px; color: #1c3a5c; font-weight: 700; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 10px; border-top: 1px solid var(--line); background: rgba(148, 168, 188, .35); border-radius: 0 0 11px 11px; }
.online-player-list, .leaderboard-list {
  height: 220px;
  overflow-y: auto;
  border: 1px solid #55687e;
  border-radius: 8px;
  padding: 5px;
  color-scheme: dark;
  color: var(--well-text);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='300'%3E%3Ctext x='24' y='12' fill='rgba(255,255,255,0.09)' font-family='Verdana,sans-serif' font-size='24' font-weight='900' letter-spacing='7' transform='rotate(90 24 12)'%3EPLAYERS%3C/text%3E%3C/svg%3E") right 6px top 12px no-repeat,
    var(--well);
  box-shadow: inset 0 3px 8px rgba(0,0,0,.65);
}
.player-list-row, .roster-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 0;
  border-bottom: 1px solid var(--well-line);
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.player-list-row:hover, .roster-row:hover { background: var(--sel-bg); color: var(--sel-ink); }
.roster-identity { min-width: 0; display: grid; }
.roster-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.roster-identity small { color: var(--well-text-dim); font: 8px var(--mono); }
.roster-row:hover small { color: #33566f; }
.player-list-row { padding: 6px 8px; gap: 8px; }
.player-list-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 900; }
.player-list-rating { color: var(--well-text-dim); font: 9px var(--mono); }
.player-list-row:hover .player-list-rating { color: #33566f; }
.presence { color: #5f89ab; font: 800 7px var(--font); letter-spacing: .08em; }
.presence.online { color: #8fd07a; }
.player-list-row:hover .presence, .roster-row:hover .presence { color: #3c5a74; }
.player-list-row:hover .presence.online, .roster-row:hover .presence.online { color: #2e7a2a; }

.setup-layout { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 16px; align-items: start; }
.setup-main, .setup-sidebar { padding: 20px; }
.setup-sidebar { position: sticky; top: 14px; }
.setup-sidebar .button-large { margin-top: 22px; }
.map-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 15px; }
.map-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid #7d90a4;
  border-radius: 9px;
  background: linear-gradient(180deg, #d7e1ea, #bccadb);
  color: inherit;
  cursor: pointer;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 2px 6px rgba(43,58,74,.2);
}
.map-card:hover { border-color: #3c5b82; }
.map-card.selected { border-color: #b28f1e; box-shadow: 0 0 0 2px rgba(242, 197, 49, .35), inset 0 1px 0 rgba(255,255,255,.65); }
.map-card canvas { width: 100%; aspect-ratio: 16/9; display: block; filter: saturate(.85) contrast(1.04); }
.map-card-copy { display: grid; padding: 10px 11px; }
.map-card-copy strong { font-size: 12px; }
.map-card-copy small { color: var(--muted); font: 9px var(--mono); }
.map-card > i { position: absolute; top: 7px; right: 7px; padding: 3px 5px; border-radius: 4px; background: rgba(14,20,28,.8); color: #ccd6e2; font: 700 7px var(--font); font-style: normal; letter-spacing: .06em; }
.map-card.compact { width: 100%; }
.map-card.compact .map-card-copy { padding: 7px 9px; }
.host-mode-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 14px 0 24px; }
.choice-card { position: relative; min-height: 82px; display: flex; align-items: center; gap: 9px; padding: 12px; border: 1px solid #7d90a4; border-radius: 9px; background: linear-gradient(180deg, #d3dde7, #bac8d6); cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
.choice-card:has(input:checked) { border-color: #b28f1e; background: linear-gradient(180deg, #e8eff6, #cfdcea); box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 0 0 2px rgba(242,197,49,.3); }
.choice-card input { accent-color: #b28f1e; }
.choice-card span { display: grid; gap: 4px; }
.choice-card small { color: var(--muted); font-size: 10px; }
.selected-custom-map-card { margin-top: 16px; padding: 13px; display: grid; gap: 3px; border: 1px solid #6d8bad; border-radius: 9px; background: #d9e4ee; }
.selected-custom-map-card small { color: var(--muted); }

.lobby-heading { align-items: flex-end; }
.lobby-layout { display: grid; grid-template-columns: 330px minmax(430px,1fr) 360px; gap: 16px; }
.lobby-roster, .lobby-map-panel, .lobby-chat-panel { padding: 18px; }
.roster-list {
  margin: 12px 0;
  border: 1px solid #55687e;
  border-radius: 8px;
  overflow: hidden;
  color-scheme: dark;
  color: var(--well-text);
  background: var(--well);
  box-shadow: inset 0 3px 8px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.5);
}
.roster-row.local { background: rgba(188, 217, 239, .18); }
.roster-row.local:hover { background: var(--sel-bg); }
.bot-slot-note { color: var(--muted); font-size: 11px; }
#copy-room-code { font-family: var(--mono); letter-spacing: .12em; }
#lobby-map-preview { margin: 12px 0; }
#lobby-map-grid { grid-template-columns: repeat(3, 1fr); }
.lobby-controls-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 0 12px; }
.lobby-chat-panel { display: flex; flex-direction: column; min-height: 570px; }
.room-chat-list { min-height: 400px; max-height: 470px; }

.editor-layout { display: grid; grid-template-columns: 190px minmax(600px,1fr) 270px; gap: 12px; align-items: start; }
.editor-tools, .editor-inspector { padding: 14px; }
.editor-tools, .editor-inspector { position: sticky; top: 14px; }
.editor-tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.editor-tool-grid button {
  min-height: 58px;
  display: grid;
  place-items: center;
  gap: 3px;
  border: 1px solid #7d90a4;
  border-radius: 8px;
  background: linear-gradient(180deg, #d7e1ea, #becbd9);
  color: var(--muted);
  cursor: pointer;
  font: 800 8px var(--font);
  letter-spacing: .05em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.editor-tool-grid button b { color: var(--ink); font-size: 18px; }
.editor-tool-grid button:hover, .editor-tool-grid button.active { border-color: #b28f1e; background: linear-gradient(180deg, #eaf1f7, #d2dfeb); color: #24466c; box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 0 0 2px rgba(242,197,49,.28); }
.editor-history-row, .editor-primary-actions, .editor-file-actions { display: flex; gap: 6px; margin-top: 12px; }
.editor-history-row .button, .editor-primary-actions .button, .editor-file-actions .button { flex: 1; }
.editor-stage-wrap { position: relative; aspect-ratio: 16 / 9; min-height: 0; overflow: hidden; border: 2px solid #55687e; border-radius: 10px; background: #0a0e14; box-shadow: inset 0 3px 8px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.5), var(--shadow); }
.editor-canvas { width: 100%; height: 100%; min-height: 0; display: block; touch-action: none; }
.editor-stage-hint { position: absolute; left: 10px; bottom: 10px; padding: 6px 8px; border-radius: 5px; background: rgba(13,19,27,.83); color: #b4bac1; font: 8px var(--mono); pointer-events: none; }
.editor-validation { margin-top: 14px; padding: 10px; border: 1px solid #7d90a4; border-radius: 8px; background: #d9e3ec; font-size: 10px; }
.editor-validation strong, .editor-validation span { display: block; }
.editor-validation span { margin-top: 3px; color: var(--muted); }
.editor-validation.valid { border-color: #4f7a3f; }
.editor-validation.valid strong { color: #2e6323; }
.editor-validation.invalid { border-color: #9c4a3a; }
.editor-validation.invalid strong { color: #93301c; }
.editor-validation ul { margin: 6px 0 0; padding-left: 17px; color: var(--muted); }
.file-button { position: relative; display: inline-grid; place-items: center; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.saved-map-heading { margin-top: 18px; }
.saved-map-heading h3 { margin: 0; font-size: 13px; }
.saved-map-heading span { min-width: 22px; padding: 3px; text-align: center; border-radius: 4px; background: #e3eaf1; border: 1px solid #8fa2b5; font: 800 9px var(--mono); }
.saved-map-list { margin-top: 8px; max-height: 190px; overflow-y: auto; }
.saved-map-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 2px; border-bottom: 1px solid rgba(47,66,87,.25); }
.saved-map-row > div:first-child { min-width: 0; display: grid; }
.saved-map-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.saved-map-row small { color: var(--muted); font: 7px var(--mono); }
.saved-map-empty { padding: 16px 4px; color: var(--muted); font-size: 10px; text-align: center; }


.skin-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.skin-card { position: relative; overflow: hidden; padding: 12px; border: 1px solid #7d90a4; border-radius: 10px; background: linear-gradient(180deg, #d3dde7, #b7c6d5); box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 8px 20px rgba(43,58,74,.22); }
.skin-card.selected { border-color: #b28f1e; box-shadow: inset 0 0 0 2px rgba(242, 197, 49, .4), 0 8px 20px rgba(43,58,74,.22); }
.skin-card.locked { filter: grayscale(.65); }
.skin-card canvas { width: 100%; aspect-ratio: 14/11; display: block; margin: -12px -12px 10px; width: calc(100% + 24px); background: #c4ccd5; }
.skin-card-heading strong { font-size: 14px; }
.rarity { padding: 3px 5px; border: 1px solid #63788e; border-radius: 4px; color: var(--muted); font: 800 7px var(--font); letter-spacing: .06em; }
.skin-card.rare .rarity { color: #135f66; border-color: #2f8189; }
.skin-card.epic .rarity { color: #63308a; border-color: #8a5cab; }
.skin-card.legendary .rarity { color: #7a5c0e; border-color: #b28f1e; }
.skin-card p { min-height: 47px; margin: 8px 0 12px; color: var(--muted); font-size: 11px; }

.weapon-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.weapon-card { overflow: hidden; padding: 16px; border: 1px solid #7d90a4; border-radius: 10px; background: linear-gradient(180deg, #d3dde7, #b7c6d5); box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 8px 20px rgba(43,58,74,.2); }
.weapon-card.super { border-color: #b28f1e; background: linear-gradient(145deg, #e2e5d4, #c9d2dd); }
.weapon-card canvas { width: calc(100% + 32px); height: 150px; margin: -16px -16px 10px; display: block; background: radial-gradient(circle, #e2e7ec, #bfc9d3); }
.weapon-card-heading strong { font-size: 15px; }
.weapon-card-heading span { color: var(--olive-bright); font: 800 8px var(--font); letter-spacing: .08em; }
.weapon-card p { min-height: 48px; color: var(--muted); font-size: 11px; }
.weapon-detail-grid { display: grid; gap: 5px; }
.weapon-stat { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 7px; }
.weapon-stat span { color: var(--muted); font: 800 8px var(--font); letter-spacing: .04em; text-transform: uppercase; }
.weapon-stat i { height: 6px; overflow: hidden; border-radius: 3px; background: var(--well); box-shadow: inset 0 1px 3px rgba(0,0,0,.6); }
.weapon-stat b { display: block; width: 100%; height: 100%; transform-origin: left; background: linear-gradient(180deg, #6f9ad0, #4c71a2); }
.weapon-ammo { display: block; margin-top: 12px; color: var(--gold-ink); font: 800 9px var(--mono); }

.game-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100% !important;
  min-height: 100vh !important;
  padding: 0 !important;
  color: #e9eef5;
  background: #070a0e;
  overflow: hidden;
}
#game-canvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.game-topbar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; pointer-events: none; }
.hud-block { min-width: 128px; padding: 8px 12px; display: grid; text-align: center; border: 1px solid rgba(181,199,220,.4); background: rgba(15,20,28,.84); box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.hud-block span { color: #9ca3ae; font: 8px var(--mono); letter-spacing: .12em; }
.hud-block b { font: 900 24px var(--mono); }
.hud-room-block b { font-size: 14px; letter-spacing: .18em; }
.hud-room-block small { color: #6381a7; font: 8px var(--mono); }
.hud-bottom-left { position: absolute; left: 16px; bottom: 16px; width: min(350px, calc(100vw - 32px)); padding: 11px; border: 1px solid rgba(184,201,222,.42); background: rgba(15,20,28,.87); box-shadow: 0 8px 30px rgba(0,0,0,.4); pointer-events: none; }
.hud-top-left { position: absolute; top: 12px; left: 16px; display: flex; align-items: center; gap: 9px; pointer-events: none; }
.hud-heart { flex: 0 0 auto; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); transform-origin: 50% 42%; }
.hud-heart.low { animation: heart-pulse .55s ease-in-out infinite alternate; }
@keyframes heart-pulse { from { transform: scale(1); } to { transform: scale(1.12); } }
.health-shell { display: flex; align-items: center; gap: 8px; }
.health-shell span { color: #dbe4ee; font: 700 10px var(--mono); text-shadow: 0 1px 2px #000; white-space: nowrap; }
.hud-score { color: #bbc0c7; font: 9px var(--mono); }
.health-shell i {
  display: block;
  width: min(260px, calc(100vw - 190px));
  height: 15px;
  overflow: hidden;
  border: 1px solid #10151d;
  border-radius: 3px;
  background: #05070b;
  box-shadow: 0 2px 6px rgba(0,0,0,.45), inset 0 1px 3px rgba(0,0,0,.65);
}
.health-shell b {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left;
  background: linear-gradient(180deg, #d5453a 0%, #b5271f 55%, #8c1a13 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28);
  transition: transform 120ms ease-out;
}
.hud-placement { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 1px; pointer-events: none; text-align: center; }
#hud-leader { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-size: 13px; font-weight: 800; letter-spacing: .04em; text-shadow: 0 1px 3px #000, 0 0 8px rgba(0,0,0,.65); }
#hud-place {
  color: #ffd93b;
  font: 900 26px var(--font);
  letter-spacing: .02em;
  -webkit-text-stroke: 1px #171101;
  text-shadow: -2px 0 #171101, 2px 0 #171101, 0 -2px #171101, 0 2px #171101, -1px -1px #171101, 1px -1px #171101, -1px 1px #171101, 1px 1px #171101, 0 3px 6px rgba(0,0,0,.55);
}
.damage-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(180,20,10,.22) 70%, rgba(180,20,10,.45) 100%);
}
.weapon-shell { display: flex; justify-content: space-between; margin-top: 7px; font-size: 12px; font-weight: 800; }
.weapon-shell b { color: #d6c15e; font-family: var(--mono); }
.hud-score { margin-top: 3px; }
.kill-feed { position: absolute; top: 132px; right: 12px; width: 300px; display: grid; gap: 4px; pointer-events: none; }
.kill-feed-item {
  padding: 5px 8px;
  border-left: 3px solid #2c4a72;
  background: rgba(12,17,24,.6);
  color: #fff;
  font: 700 14px/1.25 var(--font);
  text-align: right;
  text-shadow: -1px 0 #000, 1px 0 #000, 0 -1px #000, 0 1px #000, 0 2px 3px rgba(0,0,0,.6);
  animation: kill-feed-life 5s linear forwards;
}
.kill-feed-item .kf-killer { color: #c9a2ff; }
.kill-feed-item .kf-victim { color: #9adcff; }
@keyframes kill-feed-life { 0%, 78% { opacity: 1; } 100% { opacity: 0; } }
.ingame-chat-shell { position: absolute; left: 16px; bottom: 118px; width: min(430px, calc(100vw - 32px)); pointer-events: auto; }
.ingame-chat-list { max-height: 130px; overflow-y: auto; padding: 6px; background: rgba(11,15,21,.55); mask-image: linear-gradient(transparent, black 25%); }
.ingame-chat-list .chat-row { padding: 3px; border: 0; font-size: 11px; }
.ingame-chat-list .chat-text { color: #d9dce0; text-shadow: 0 1px 2px #000; }
.ingame-chat-form { display: grid; grid-template-columns: 1fr auto; opacity: .22; transition: opacity 120ms ease; }
.ingame-chat-form:focus-within { opacity: 1; }
.ingame-chat-form input { min-width: 0; height: 31px; border: 1px solid #3d5370; padding: 5px 8px; color: #fff; background: rgba(11,15,21,.9); color-scheme: dark; }
.ingame-chat-form button { border: 1px solid #395478; background: #324a6a; color: #e6f0fb; font-size: 9px; font-weight: 800; }
.respawn-banner { position: absolute; inset: 0; display: grid; place-content: center; gap: 5px; background: rgba(14,11,11,.35); text-align: center; pointer-events: none; }
.respawn-banner strong { color: #d85e4c; font: 900 54px var(--mono); letter-spacing: .12em; }
.respawn-banner span { font: 12px var(--mono); }
.pause-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(4,7,10,.7); backdrop-filter: blur(5px); }
.pause-card { width: min(430px, calc(100% - 32px)); padding: 24px; border: 1px solid #4a6890; background: #19232f; box-shadow: 0 22px 65px rgba(0, 0, 0, 0.42); }
.pause-card .panel-kicker { color: #8fb1d8; }
.pause-card p { color: #97a2ae; }
.pause-card .button { margin-top: 7px; width: 100%; }

.results-wrap { max-width: 1120px; margin: 0 auto; }
.results-heading { margin-bottom: 25px; }
.results-heading p:last-child { color: var(--muted); }
.results-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 16px; }
.results-layout > .panel { padding: 16px; }
.results-table-head, .result-row { display: grid; grid-template-columns: 40px minmax(150px,1fr) 40px 40px 70px 130px; gap: 8px; align-items: center; }
.results-table-head { padding: 8px; color: var(--muted); font: 800 8px var(--font); letter-spacing: .06em; text-transform: uppercase; }
.result-row { min-height: 58px; padding: 8px; border-top: 1px solid rgba(47,66,87,.28); }
.result-row.local { background: rgba(188, 217, 239, .55); }
.result-row.winner { color: var(--gold-ink); }
.result-identity { display: grid; }
.result-identity small { color: var(--muted); font: 8px var(--mono); }
.result-place { font: 900 16px var(--mono); }
.rating-change { font-family: var(--mono); font-size: 10px; }
.rating-change.positive { color: var(--green); }
.rating-change.negative { color: #a83a22; }
.reward-card { align-self: start; position: sticky; top: 14px; }
.reward-title { display: block; margin-top: 18px; font-size: 20px; }
.reward-rating { margin: 8px 0; color: var(--gold-ink); font: 900 44px var(--mono); }
.reward-card p { color: var(--muted); }
.reward-card .button { margin-top: 8px; }

.settings-fab { position: fixed; right: 16px; bottom: 16px; z-index: 70; width: 42px; height: 42px; border: 1px solid var(--line-strong); border-radius: 50%; background: linear-gradient(180deg, #dbe4ee, #b8c7d7); color: #33506e; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 6px 16px rgba(43,58,74,.35); }
body.in-game .settings-fab { display: none; }
dialog { color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius); background: linear-gradient(180deg, #d3dde8, #b3c2d2); box-shadow: inset 0 2px 0 rgba(255,255,255,.75), 0 30px 80px rgba(20,30,42,.55); }
dialog::backdrop { background: rgba(30, 42, 56, .55); backdrop-filter: blur(5px); }
.settings-dialog { width: min(440px, calc(100% - 28px)); padding: 24px; }
.profile-dialog {
  width: min(420px, calc(100% - 28px));
  padding: 16px 18px 18px;
  border-color: #1d2836;
  color: #d9e5f0;
  background: linear-gradient(180deg, #24364a 0%, #182634 58%, #111c28 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 30px 80px rgba(0,0,0,.6);
}
.profile-dialog .dialog-close { color: #9db7cc; }
.dialog-close { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 24px; }
.range-field, .toggle-field { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 15px; color: var(--muted); }
.range-field input { width: 190px; accent-color: #b28f1e; }
.toggle-field { justify-content: flex-start; }
.toggle-field input { accent-color: #b28f1e; }
.profile-dialog-avatar { width: 200px; height: 130px; display: block; margin: 0 auto; }
.profile-dialog-name-row { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 8px 0 2px; }
.profile-dialog-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; font-weight: 900; }
.profile-dialog-presence { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: #5a7186; }
.profile-dialog-presence.online { background: #7ed36a; box-shadow: 0 0 0 3px rgba(126, 211, 106, .16); }
.profile-dialog-sub { margin: 0 0 10px; color: #9db7cc; font-size: 11px; text-align: center; }

.toast-stack { position: fixed; right: 16px; top: 16px; z-index: 200; width: min(340px, calc(100vw - 32px)); display: grid; gap: 7px; pointer-events: none; }
.toast { transform: translateX(30px); opacity: 0; padding: 11px 13px; border: 1px solid #7d90a4; border-left: 4px solid #c79a12; border-radius: 8px; background: linear-gradient(180deg, #e2eaf2, #c8d5e2); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 10px 26px rgba(43,58,74,.35); font-size: 12px; font-weight: 600; transition: 160ms ease; }
.toast.show { transform: translateX(0); opacity: 1; }
.toast.leaving { transform: translateX(20px); opacity: 0; }
.toast.success { border-left-color: #3f7a34; }
.toast.error { border-left-color: #b03a28; }
.loading-overlay { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(36, 50, 66, .55); backdrop-filter: blur(4px); }
.loading-card { min-width: 240px; display: flex; align-items: center; justify-content: center; gap: 13px; padding: 19px; border: 1px solid var(--line-strong); border-radius: 12px; background: linear-gradient(180deg, #dbe4ee, #bccadb); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.75), var(--shadow); text-transform: uppercase; font: 800 10px var(--font); letter-spacing: .08em; }
.loading-spinner { width: 20px; height: 20px; border: 2px solid #8fa2b5; border-top-color: #b28f1e; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1240px) {
  .game-plate { width: calc(100% - 20px); }
  .main-nav button { min-width: 74px; padding-left: 9px; padding-right: 9px; }
  .lobby-grid { grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr); }
  .lobby-chat .chat-list { min-height: 400px; }
  .profile-banner { grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); }
  .profile-alt-portrait { display: none; }
  .lobby-layout { grid-template-columns: 300px 1fr; }
  .lobby-chat-panel { grid-column: 1 / -1; min-height: 430px; }
  .room-chat-list { min-height: 280px; max-height: 340px; }
  .editor-layout { grid-template-columns: 170px minmax(520px,1fr); }
  .editor-inspector { position: static; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4,1fr); gap: 8px 12px; }
  .editor-inspector > .panel-kicker, .editor-inspector > .editor-validation, .editor-inspector > .editor-primary-actions, .editor-inspector > .button-full, .editor-inspector > .editor-file-actions, .editor-inspector > .saved-map-heading, .editor-inspector > .saved-map-list { grid-column: span 2; }
  .skin-grid { grid-template-columns: repeat(3,1fr); }
}

@media (max-width: 900px) {
  .game-plate { width: calc(100% - 12px); margin: 8px auto 20px; }
  #screens { min-height: 0; }
  .plate-top { padding: 0 8px; }
  .main-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    height: 56px;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: linear-gradient(180deg, #cdd9e5, #aebdcd);
    border-top: 1px solid var(--line-strong);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 -6px 18px rgba(43,58,74,.28);
  }
  .main-nav button, .main-nav button.active {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 9px;
  }
  .main-nav button.active {
    background: linear-gradient(180deg, #e5edf4, #c8d6e3);
    box-shadow: inset 0 3px 0 var(--yellow);
    color: var(--ink);
  }
  .screen { padding: 12px 12px 70px; }
  .realm-heading, .section-heading { align-items: flex-start; flex-direction: column; }
  .lobby-grid, .setup-layout, .lobby-layout, .results-layout, .profile-columns { grid-template-columns: 1fr; }
  /* Play actions above the chat on mobile. */
  .lobby-side { order: -1; }
  .lobby-chat .chat-list { min-height: 260px; max-height: 340px; }
  .profile-banner { grid-template-columns: 1fr; gap: 12px; min-height: 0; justify-items: center; text-align: center; }
  .profile-skins-panel, .profile-stats-well { height: auto; }
  .profile-skins-panel .skin-grid { max-height: 320px; }
  .profile-stats-well { max-height: 300px; }
  .setup-sidebar, .reward-card { position: static; }
  .host-mode-row { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-tools { position: static; }
  .editor-tool-grid { grid-template-columns: repeat(4,1fr); }
  .editor-stage-wrap { min-height: 0; }
  .editor-canvas { height: 100%; min-height: 0; }
  .editor-inspector { grid-column: auto; display: block; }
  .skin-grid { grid-template-columns: repeat(2,1fr); }
  .weapon-grid { grid-template-columns: repeat(2,1fr); }
  .kill-feed { width: 210px; }
  .settings-fab { bottom: 70px; }
  body.in-game .main-nav { display: none; }
}

@media (max-width: 620px) {
  h1 { font-size: 26px; }
  .brand-copy { display: none; }
  #identity-avatar { height: 170px; }
  .profile-rank-line { font-size: 20px; }
  .join-code-strip { grid-template-columns: 1fr auto; }
  .join-code-strip label { grid-column: 1 / -1; }
  .map-grid, .skin-grid, .weapon-grid { grid-template-columns: 1fr; }
  #lobby-map-grid { grid-template-columns: 1fr 1fr; }
  .lobby-controls-grid { grid-template-columns: 1fr; }
  .editor-tool-grid { grid-template-columns: repeat(2,1fr); }
  .editor-canvas { min-height: 0; height: 100%; }
  .results-table-head { display: none; }
  .result-row { grid-template-columns: 34px minmax(100px,1fr) 28px 28px; }
  .result-row > :nth-child(5), .result-row > :nth-child(6) { display: none; }
  .game-topbar { top: 6px; }
  .hud-block { min-width: 102px; padding: 5px 7px; }
  .hud-block b { font-size: 18px; }
  .hud-top-left { top: 56px; left: 7px; }
  .hud-heart { width: 28px; height: auto; }
  .health-shell i { width: min(190px, calc(100vw - 130px)); }
  .hud-placement { top: 104px; }
  #hud-place { font-size: 21px; }
  .kill-feed { top: 210px; right: 6px; width: 190px; }
  .kill-feed-item { font-size: 12px; }
  .hud-bottom-left { left: 7px; bottom: 7px; width: 265px; }
  .ingame-chat-shell { left: 7px; bottom: 101px; width: min(330px, calc(100vw - 14px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  /* The feed animation ends at opacity 0; without a real duration items would vanish instantly. */
  .kill-feed-item { animation: none !important; opacity: 1; }
  .hud-heart.low { animation: none !important; }
  .damage-vignette { transition-duration: 240ms !important; }
}

/* Lobby class aliases used by the live markup. */
.lobby-code-strip {
  width: fit-content;
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 9px;
  margin: -12px 0 14px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(180deg, #d7e1ea, #becbd9);
  color: var(--muted);
  font: 800 8px var(--font);
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}
.room-code {
  border: 1px solid #313c48;
  border-radius: 6px;
  padding: 3px 7px;
  color: #ffd93b;
  background: #10151c;
  cursor: pointer;
  font: 900 15px var(--mono);
  letter-spacing: .16em;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.5);
}
.roster-panel, .lobby-center, .lobby-chat-panel { padding: 18px; }
.lobby-center { min-width: 0; }
.lobby-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin: 14px 0;
}
.lobby-controls label { min-width: 0; }
.lobby-controls label > span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font: 800 8px var(--font);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.compact-map-grid .map-card-copy small { display: none; }
.compact-map-grid .map-card > i { display: none; }
#lobby-ranked-label { color: var(--gold-ink); font: 800 8px var(--font); letter-spacing: .08em; text-transform: uppercase; }
@media (max-width: 620px) {
  .lobby-controls { grid-template-columns: 1fr 1fr; }
  .lobby-code-strip { width: 100%; grid-template-columns: auto 1fr auto; }
}

/* v3 account, quick actions and usability */
.account-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, #dbe4ee, #bfcddc);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 1px 3px rgba(0,0,0,.35);
}
.account-button:hover { border-color: #3c5b82; background: linear-gradient(180deg, #e6eef6, #ccd9e6); }
.account-avatar, #account-dialog-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid #4c688e;
  background: #e6edf4;
  color: #24466c;
  font: 900 12px var(--font);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.account-avatar { width: 26px; height: 26px; font-size: 11px; }
.account-button.signed-in .account-avatar { border-color: #3f7a34; box-shadow: 0 0 0 3px rgba(63,122,52,.16); }

.identity-account-strip {
  width: 100%;
  display: grid;
  grid-template-columns: 9px 1fr;
  gap: 1px 8px;
  align-items: center;
  margin-top: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.35);
  cursor: pointer;
  text-align: left;
}
.identity-account-strip:hover { border-color: #3c5b82; }
.identity-account-strip > span { grid-row: 1 / span 2; width: 8px; height: 8px; border-radius: 50%; background: #63798f; }
.identity-account-strip > span.online { background: #3f8a34; box-shadow: 0 0 0 3px rgba(63,138,52,.18); }
.identity-account-strip b { font-size: 10px; }
.identity-account-strip small { color: var(--muted); font-size: 9px; }

.settings-note, .account-help { display: block; margin: 5px 0 12px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.settings-dialog .select-input { width: 100%; }
.account-dialog, .controls-dialog { width: min(500px, calc(100% - 28px)); padding: 26px; }
.account-dialog h2, .controls-dialog h2 { margin-bottom: 8px; font-size: 24px; }
.account-dialog p { color: var(--muted); }
.google-mark { display: inline-grid; place-items: center; width: 23px; height: 23px; margin-right: 7px; border-radius: 50%; background: #f7f7f8; color: #292929; }
.account-identity { display: flex; align-items: center; gap: 12px; margin: 10px 0 18px; }
#account-dialog-avatar { width: 48px; height: 48px; font-size: 18px; }
.account-identity > div { display: grid; min-width: 0; }
.account-identity strong { font-size: 17px; }
.account-identity small { max-width: 350px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.account-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-bottom: 13px; border: 1px solid #8fa2b5; border-radius: 8px; overflow: hidden; background: #8fa2b5; }
.account-status-grid > div { display: grid; min-width: 0; padding: 11px; background: #d5dfe9; }
.account-status-grid span { color: var(--muted); font: 800 8px var(--font); letter-spacing: .06em; text-transform: uppercase; }
.account-status-grid b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.account-dialog .button { margin-top: 8px; }
.danger-zone { margin-top: 18px; padding-top: 12px; border-top: 1px solid rgba(47,66,87,.3); }
.danger-zone summary { color: #a03522; cursor: pointer; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.danger-zone p { margin: 10px 0 4px; font-size: 10px; }
.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.controls-grid > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid #8fa2b5; border-radius: 8px; background: rgba(255,255,255,.4); }
kbd { min-width: 76px; padding: 5px 7px; border: 1px solid #7d8fa3; border-bottom-width: 3px; border-radius: 6px; background: linear-gradient(180deg, #f0f4f9, #d5dfe9); color: var(--ink); font: 800 9px var(--mono); text-align: center; box-shadow: 0 1px 0 rgba(255,255,255,.6); }
.controls-grid span { color: var(--muted); font-size: 10px; }
#editor-publish-copy { display: block; margin-top: 5px; line-height: 1.35; }

@media (max-width: 620px) {
  .controls-grid, .account-status-grid { grid-template-columns: 1fr; }
}
