:root {
  color-scheme: dark;
  --bg: #071115;
  --panel: #0d1b20;
  --soft: #14262d;
  --line: #2a4249;
  --text: #edf5ef;
  --muted: #a0b7ba;
  --accent: #b5eb50;
  --ink: #15210c;
  --cyan: #57d3dc;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
body[data-game="alien-swarm"] {
  --accent: #ffb45d;
  --ink: #2a1908;
}
button,
input {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--soft);
  border-radius: 7px;
  padding: 10px 13px;
  min-height: 42px;
  font-weight: 650;
}
button:hover:not(:disabled) {
  border-color: var(--accent);
  filter: brightness(1.08);
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button:focus-visible,
input:focus-visible,
summary:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
a {
  color: var(--cyan);
}
[hidden] {
  display: none !important;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
}
.secondary {
  background: transparent;
}
.quiet {
  font-size: 11px;
  background: transparent;
}
.text-button {
  background: none;
  border: 0;
  padding: 4px;
  min-height: 36px;
  font-size: 12px;
  color: var(--cyan);
}
.game-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.game-top {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  background: #091419;
}
.acre {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 23px;
  font-weight: 850;
  font-style: italic;
  color: var(--accent);
  text-decoration: none;
}
.acre span {
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.game-identity {
  font-size: 11px;
  letter-spacing: 0.15em;
  font-weight: 750;
  display: flex;
  gap: 18px;
  align-items: center;
}
.game-identity span {
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 500;
}
.game-top button {
  min-height: 32px;
  padding: 5px 10px;
}
.game-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 302px;
}
.arena {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #040b10;
}
canvas#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline-offset: -3px;
}
.control-panel {
  min-height: 0;
  overflow-y: auto;
  padding: 24px 22px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: #35545c var(--panel);
}
.eyebrow {
  font:
    600 10px/1.5 ui-monospace,
    SFMono-Regular,
    monospace;
  letter-spacing: 0.16em;
  color: var(--accent);
}
h2 {
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin: 10px 0 14px;
}
h3 {
  font-size: 13px;
  margin: 0;
}
.muted {
  color: var(--muted);
  line-height: 1.65;
  font-size: 12px;
}
.control-panel label:not(.check) {
  display: block;
  font:
    600 10px ui-monospace,
    monospace;
  letter-spacing: 0.13em;
  margin: 23px 0 8px;
  color: var(--muted);
}
input[type="text"],
input:not([type]) {
  width: 100%;
  min-width: 0;
  background: #061217;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  color: var(--text);
  font-size: 15px;
}
#room-code {
  font-family: ui-monospace, monospace;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  font-size: 11px;
  color: var(--muted);
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}
.join-row {
  display: flex;
  gap: 8px;
}
.divider {
  font-size: 9px;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #7e979e;
  margin: 24px 0 0;
}
.divider:before,
.divider:after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}
.rooms-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 23px;
}
.open-room {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: 7px;
  margin: 7px 0;
  gap: 8px;
}
.open-room div {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.open-room small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.open-room button {
  min-height: 32px;
  font-size: 11px;
  padding: 6px 10px;
}
.notice {
  font-size: 12px;
  line-height: 1.5;
  color: var(--accent);
  min-height: 0;
  margin-top: 14px;
  overflow-wrap: anywhere;
}
.notice.error {
  color: #ffaaa4;
  border-left: 2px solid #e96666;
  padding-left: 10px;
}
.instructions {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 20px;
  font-size: 12px;
  line-height: 1.75;
  color: var(--muted);
}
.instructions summary {
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
}
.instructions b {
  color: var(--cyan);
}
.panel-foot {
  font:
    9px/1.9 ui-monospace,
    monospace;
  letter-spacing: 0.06em;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 22px;
  color: var(--muted);
}
.panel-foot span {
  letter-spacing: 0;
  color: #87a0a8;
}
.attract-copy {
  position: absolute;
  left: 6%;
  bottom: 9%;
  max-width: 510px;
  pointer-events: none;
  text-shadow: 0 3px 30px #000;
}
.attract-copy h1 {
  font-size: clamp(60px, 8vw, 118px);
  line-height: 0.86;
  letter-spacing: -0.075em;
  margin: 20px 0;
  color: #eff8ee;
  font-weight: 850;
}
.attract-copy h1 em {
  font-style: normal;
  color: var(--accent);
}
.attract-copy p {
  font-size: 16px;
  color: #b9ced0;
  line-height: 1.5;
}
.feature-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 25px;
}
.feature-tags span {
  border: 1px solid #466268;
  background: #0a191ed9;
  color: #c3d6d7;
  padding: 7px 10px;
  border-radius: 4px;
  font:
    10px ui-monospace,
    monospace;
}
.game-tip {
  position: absolute;
  bottom: 13px;
  left: 0;
  right: 0;
  text-align: center;
  padding: 0 12px;
  pointer-events: none;
  font:
    9px ui-monospace,
    monospace;
  letter-spacing: 0.13em;
  color: #789b9f;
}
.room-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.room-title h2 {
  font-family: ui-monospace, monospace;
  font-size: 27px;
  letter-spacing: 0.1em;
}
.room-title button {
  font-size: 10px;
  min-height: 32px;
  padding: 6px 8px;
}
.player-row {
  border: 1px solid var(--line);
  border-left: 3px solid var(--player);
  padding: 12px 10px;
  background: #08171c;
  border-radius: 6px;
  margin: 9px 0;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.player-row strong {
  font-size: 12px;
  overflow-wrap: anywhere;
  display: block;
}
.player-row small {
  font-size: 10px;
  color: var(--muted);
}
.player-row .ready-label {
  color: var(--accent);
  font-size: 10px;
  align-self: center;
  white-space: nowrap;
}
#room-actions {
  display: grid;
  gap: 8px;
  margin-top: 19px;
}
.leave {
  margin-top: 15px;
  color: #fca49e;
}
#mission-brief {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 16px;
}
.brief-step {
  margin: 12px 0;
  display: flex;
  gap: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.brief-step b {
  font:
    12px ui-monospace,
    monospace;
  color: var(--accent);
}
.role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}
.role-card {
  padding: 10px 8px;
  text-align: left;
  min-height: 66px;
  background: #09161b;
}
.role-card b {
  font-size: 11px;
  display: block;
}
.role-card span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
  line-height: 1.5;
  margin-top: 4px;
}
.role-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: #293023;
}
.role-card[aria-pressed="true"] b {
  color: var(--accent);
}
.match-hud {
  position: absolute;
  inset: 0 0 auto;
  pointer-events: none;
  padding: 14px 18px;
  background: linear-gradient(#041016e8, transparent);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 100px;
}
.hud-main {
  font-size: 14px;
  letter-spacing: 0.05em;
  font-weight: 750;
}
.hud-main small {
  display: block;
  font:
    10px/1.8 ui-monospace,
    monospace;
  letter-spacing: 0.05em;
  color: var(--accent);
}
.hud-stats {
  text-align: right;
  font:
    11px/1.8 ui-monospace,
    monospace;
  color: #b9d5d5;
}
.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  background: #04101466;
  color: var(--accent);
  font:
    800 110px/1 ui-sans-serif,
    system-ui;
  pointer-events: none;
}
.countdown span {
  font:
    11px ui-monospace,
    monospace;
  color: #edf5ef;
  letter-spacing: 0.15em;
  margin-top: 20px;
}
.event-toast {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #0b1a21ed;
  border: 1px solid #52767b;
  border-radius: 5px;
  padding: 9px 16px;
  text-align: center;
  font:
    12px/1.4 ui-monospace,
    monospace;
  max-width: 90%;
  width: max-content;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  color: #e4f9e9;
}
.event-toast.active {
  opacity: 1;
}
.result-overlay {
  position: absolute;
  inset: 48px 0 0;
  background: #020a10cc;
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
  backdrop-filter: blur(7px);
}
.result-card {
  max-width: 590px;
  width: 100%;
  max-height: 100%;
  overflow: auto;
  border: 1px solid #4c7775;
  border-radius: 15px;
  background: linear-gradient(140deg, #16282b, #08151b);
  padding: 36px;
  box-shadow: 0 25px 100px #000a;
}
.result-card h2 {
  font-size: 48px;
  letter-spacing: -0.055em;
  margin: 16px 0;
}
.result-card p {
  color: var(--muted);
  line-height: 1.6;
}
.score-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.score-row span {
  color: var(--muted);
  font:
    11px ui-monospace,
    monospace;
}
.result-card button {
  margin-top: 25px;
}
.health-line {
  height: 5px;
  background: #21353b;
  border-radius: 4px;
  margin-top: 6px;
  overflow: hidden;
}
.health-line i {
  display: block;
  height: 100%;
  background: var(--player);
  transition: width 0.1s;
}
.weapon-info {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.weapon-info b {
  font-size: 26px;
  font-weight: 600;
}
.weapon-info small {
  color: var(--muted);
  font:
    11px ui-monospace,
    monospace;
  display: block;
  margin: 6px 0;
}
.objective-status {
  font-size: 12px;
  line-height: 1.65;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #091a20;
  margin: 14px 0;
}
.objective-status .complete {
  color: var(--accent);
}
.skill-status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 11px;
  margin-top: 14px;
}
.skill-status > div {
  border: 1px solid var(--line);
  padding: 9px;
  border-radius: 6px;
  color: var(--muted);
}
.skill-status b {
  display: block;
  color: var(--accent);
  margin-top: 6px;
}
.touch-controls {
  display: none;
  position: absolute;
  bottom: 26px;
  left: 14px;
  right: 14px;
  pointer-events: none;
  z-index: 4;
}
.touch-controls button,
.stick {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.block-controls {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.playing .touch-controls.block-controls {
  display: flex;
}
.block-controls button {
  background: #152a32ed;
  border-color: #719098;
  min-width: 40px;
  padding: 8px;
}
.block-controls .drop {
  background: var(--accent);
  color: var(--ink);
}
.stick {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 1px solid #79919877;
  background: #203a4255;
  position: absolute;
  bottom: 0;
  left: 0;
  display: grid;
  place-items: center;
}
.stick.aim {
  left: auto;
  right: 0;
}
.stick i {
  width: 42px;
  height: 42px;
  border: 1px solid #a0ccc9;
  border-radius: 50%;
  background: #3c66738c;
  position: absolute;
  pointer-events: none;
}
.stick span {
  font:
    9px ui-monospace,
    monospace;
  color: #a4d2d1;
  margin-top: 75px;
  pointer-events: none;
}
.swarm-buttons {
  display: flex;
  justify-content: center;
  gap: 5px;
  position: absolute;
  bottom: 12px;
  left: 116px;
  right: 116px;
  flex-wrap: wrap;
}
.swarm-buttons button {
  font-size: 10px;
  min-height: 36px;
  padding: 6px 8px;
  background: #152a32ed;
}
.spectator {
  color: #ffbca5;
}
.playing .control-panel {
  padding-top: 16px;
}
.playing .attract-copy {
  display: none;
}
.playing #game-tip {
  font-size: 9px;
}
.playing .instructions {
  margin-top: 12px;
}
@media (min-width: 1500px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 330px;
  }
  .control-panel {
    padding: 28px;
  }
}
@media (max-width: 1000px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 265px;
  }
  .control-panel {
    padding: 20px 16px;
  }
  .acre span {
    display: none;
  }
  .game-identity span {
    display: none;
  }
  .attract-copy h1 {
    font-size: 76px;
  }
  .feature-tags {
    gap: 5px;
  }
  .feature-tags span {
    font-size: 9px;
    padding: 6px;
  }
  .attract-copy p {
    font-size: 14px;
  }
}
@media (max-width: 700px) {
  .game-shell {
    overflow: auto;
    height: auto;
    min-height: 100dvh;
  }
  .game-top {
    padding-inline: 14px;
    gap: 12px;
  }
  .game-identity {
    font-size: 10px;
  }
  .game-layout {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }
  .arena {
    height: 380px;
    flex-shrink: 0;
  }
  .control-panel {
    overflow: visible;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 24px;
  }
  .attract-copy {
    bottom: 14%;
    left: 7%;
  }
  .attract-copy h1 {
    font-size: 74px;
    margin: 12px 0;
  }
  .attract-copy p {
    font-size: 13px;
  }
  .attract-copy .eyebrow {
    font-size: 9px;
  }
  .feature-tags {
    margin-top: 16px;
  }
  .game-tip {
    font-size: 8px;
  }
  .role-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .role-card {
    padding: 9px 6px;
  }
  .role-card b {
    font-size: 10px;
  }
  .playing.game-shell {
    height: 100dvh;
    overflow: hidden;
    min-height: 0;
  }
  .playing .game-layout {
    min-height: 0;
    overflow: hidden;
    flex: 1;
  }
  .playing .arena {
    height: auto;
    flex: 1;
    min-height: 0;
  }
  .playing .control-panel {
    display: none;
  }
  .playing .touch-controls {
    display: block;
  }
  .match-hud {
    padding: 10px 12px;
  }
  .hud-main {
    font-size: 11px;
  }
  .hud-main small {
    font-size: 9px;
  }
  .hud-stats {
    font-size: 9px;
  }
  .event-toast {
    top: 60px;
    font-size: 10px;
  }
  .result-overlay {
    position: fixed;
  }
  .result-card {
    padding: 25px;
  }
  .result-card h2 {
    font-size: 38px;
  }
  .countdown {
    font-size: 80px;
  }
  .result-card .score-row {
    font-size: 12px;
  }
  .game-shell:not(.playing) #room-panel #mission-brief {
    display: block;
  }
  .game-shell:not(.playing) .control-panel {
    max-height: none;
  }
}
@media (pointer: coarse) {
  .playing .touch-controls {
    display: block;
  }
  .playing #game-tip {
    display: none;
  }
}
@media (max-width: 400px) {
  .role-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stick {
    width: 82px;
    height: 82px;
  }
  .stick span {
    margin-top: 58px;
  }
  .swarm-buttons {
    left: 88px;
    right: 88px;
    bottom: 0;
  }
  .swarm-buttons button {
    font-size: 9px;
    min-height: 33px;
    padding: 5px;
  }
  .touch-controls {
    left: 8px;
    right: 8px;
  }
  .block-controls button {
    min-width: 36px;
    font-size: 12px;
    padding: 7px;
  }
  .arena {
    height: 355px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.match-menu {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 10;
  font-size: 10px;
  min-height: 30px;
  padding: 5px 9px;
  background: #0b2029e8;
}
.match-hud .hud-stats {
  padding-right: 57px;
}
.playing.menu-open .control-panel {
  display: block;
  position: absolute;
  right: 0;
  top: 48px;
  bottom: 0;
  width: 302px;
  max-width: 100%;
  z-index: 9;
  overflow: auto;
  background: #0d1b20fa;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px #0008;
}
.playing.menu-open .match-menu {
  right: 315px;
}
@media (max-width: 400px) {
  .playing.menu-open .control-panel {
    width: calc(100% - 60px);
  }
  .playing.menu-open .match-menu {
    left: 7px;
    right: auto;
  }
}
#mission-brief select {
  width: 100%;
  background: #07171f;
  color: #edf5ef;
  border: 1px solid #46626c;
  border-radius: 6px;
  padding: 12px;
  margin-top: 10px;
  font:
    12px ui-sans-serif,
    system-ui;
}
