:root {
  color-scheme: light;
  --ink: #273044;
  --cream: #f5eedc;
  --paper: #fffcf3;
  --muted: #72717a;
  --orange: #ffa16c;
  --purple: #b59bfa;
  --yellow: #ffce54;
  --world-accent: #aadf76;
  --display: Impact, "Arial Black", "Helvetica Neue", sans-serif;
  --shadow: 4px 5px 0 var(--ink);
  --control-radius: 9px;
  --panel-radius: 14px;
  --header-control-height: 42px;
}
body[data-screen="online"] .scoreboard,
body[data-screen="online"] .turn-info,
body[data-screen="online"] .arena,
body[data-screen="online"] .controls,
body[data-screen="online"] footer,
body[data-screen="online"] #worlds-button,
body[data-screen="online"] #help,
body[data-screen="online"] #restart,
body[data-screen="online"] .header-game-actions,
body[data-screen="online"] .connection-status,
body[data-screen="menu"] .header-game-actions {
  display: none;
}
.online-panel {
  --online-space: 24px;
  padding: 32px 0;
}
.connection-status {
  padding: 12px 16px;
  border: 2px solid var(--ink);
  border-radius: var(--control-radius);
  background: #fff1bd;
  font-size: 13px;
}
.online-panel .menu-heading {
  margin-bottom: var(--online-space);
}
.online-panel:not([data-stage="choose"]) .menu-heading h1 {
  font-size: clamp(36px, 4.6vw, 64px);
  line-height: 1.05;
  margin: 12px 0;
  transform: none;
}
.online-panel[data-stage="room"] .menu-heading h1 {
  font-size: clamp(32px, 3.2vw, 46px);
}
.online-choices,
.online-room-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--online-space);
  align-items: start;
}
#online-room {
  display: grid;
  gap: var(--online-space);
}
.online-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding: 28px;
  border: 3px solid var(--ink);
  border-radius: var(--panel-radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.online-card .eyebrow {
  margin: 0;
  font:
    850 10px/1.5 ui-sans-serif,
    system-ui,
    sans-serif;
  letter-spacing: 0.18em;
}
.online-choice {
  text-align: left;
  color: var(--ink);
  width: 100%;
  cursor: pointer;
}
.online-choice strong {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font: 32px/1.1 var(--display);
  text-transform: uppercase;
}
.online-choice > span:last-child {
  font:
    14px/1.6 ui-sans-serif,
    system-ui,
    sans-serif;
}
.online-choice:hover {
  background: #fff1bd;
}
.online-entry-form {
  width: 100%;
  max-width: 560px;
}
.online-invited-room,
.online-map-summary,
.online-card-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
.online-invited-room strong {
  letter-spacing: 0.14em;
}
.online-text-button {
  align-self: flex-start;
  padding: 4px 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.online-text-button:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}
.online-tag {
  padding: 5px 10px;
  background: var(--cream);
  border-radius: var(--control-radius);
  font-size: 13px;
  white-space: nowrap;
}
.online-room-footer {
  display: grid;
  justify-items: start;
  gap: 16px;
}
.online-room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.online-room-actions .online-danger {
  background: #ffe0ce;
}
.online-close-confirm {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 560px;
  padding: 20px;
  border: 2px solid var(--ink);
  border-radius: var(--panel-radius);
  background: var(--paper);
}
.online-close-confirm p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}
.online-card .primary {
  margin-top: 8px;
  width: 100%;
  min-height: 56px;
  border-radius: var(--control-radius);
}
.online-panel label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 750;
}
.online-panel input,
.online-panel select {
  width: 100%;
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: var(--control-radius);
  height: 52px;
  padding: 10px 14px;
  background: white;
  color: var(--ink);
  font: inherit;
}
.online-panel select {
  appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m3 6 5 5 5-5' fill='none' stroke='%23273044' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
}
.online-panel input:focus-visible,
.online-panel select:focus-visible {
  outline: 3px solid #477cb4;
  outline-offset: 3px;
}
#online-code {
  font-size: 24px;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.online-card small,
.online-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.online-status {
  margin: 0;
  font-weight: 650;
}
.online-status:empty {
  display: none;
}
.online-status:not(:empty) {
  padding: 14px 18px;
  margin-bottom: var(--online-space);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--control-radius);
}
.online-status[data-tone="warning"]:not(:empty) {
  background: #fff1bd;
}
.online-invite {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 22px;
  background: var(--purple);
  border: 3px solid var(--ink);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow);
}
.online-invite > div {
  flex: 0 0 auto;
}
.online-invite label {
  flex: 1;
  min-width: 0;
}
.online-copy-action {
  display: grid;
  gap: 8px;
  font-size: 12px;
}
#online-copy-feedback:empty {
  display: none;
}
#online-room-code {
  display: block;
  font: 38px var(--display);
  letter-spacing: 0.12em;
}
.online-players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.online-players li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: var(--control-radius);
  background: var(--cream);
  overflow-wrap: anywhere;
}
.online-players li.ready {
  background: #c9e9b8;
}
.online-players li span {
  font-size: 13px;
}
#online-preview {
  width: 100%;
  height: auto;
}
.online-card p {
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}
.online-card .online-start-order {
  color: var(--muted);
  font-size: 13px;
}
.team-setup .local-start-order {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.online-map-notice {
  padding: 12px;
  background: var(--cream);
  border-radius: var(--control-radius);
}
@media (max-width: 740px) {
  .online-panel {
    --online-space: 16px;
    padding-top: 18px;
  }
  .online-choices,
  .online-room-grid {
    grid-template-columns: 1fr;
  }
  .online-card {
    padding: 20px;
  }
  .online-invite {
    flex-wrap: wrap;
    gap: 16px;
    padding: 18px;
  }
  .online-invite label {
    flex-basis: 100%;
    order: 3;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--cream);
  background-image: radial-gradient(#27304413 0.8px, transparent 0.8px);
  background-size: 8px 8px;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #477cb4;
  outline-offset: 5px;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button[hidden],
[hidden] {
  display: none !important;
}
svg {
  display: block;
  width: 100%;
  height: 100%;
}
i[data-icon] {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex: none;
  font-style: normal;
}
button {
  transition:
    transform 0.12s,
    box-shadow 0.12s,
    background 0.12s;
}
button:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}
.shell {
  max-width: 1440px;
  margin: auto;
  padding: 22px 32px 18px;
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}
.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 16px;
  margin: -14px 0 12px;
  font: 650 13px system-ui, sans-serif;
}
.legal-links a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  text-decoration: underline;
}
.legal-page {
  max-width: 48rem;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 32px);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.legal-page h1 {
  margin: 16px 0;
  font-size: clamp(26px, 5vw, 42px);
  line-height: 1.12;
}
.legal-page h2 {
  margin: 24px 0 8px;
  font-size: 18px;
}
.legal-page a {
  text-decoration: underline;
}
.legal-page address {
  font-style: normal;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--display);
  font-size: 32px;
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.5px;
}
.brand-icon {
  width: 58px;
  height: 57px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 15px 17px 14px 8px;
  transform: rotate(-8deg);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 5px;
  flex: none;
}
.brand-light {
  color: #d57551;
}
.brand small {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font: 700 8px system-ui;
  letter-spacing: 1px;
}
.brand small b {
  background: var(--yellow);
  padding: 3px 6px;
  border: 1px solid var(--ink);
  transform: rotate(-2deg);
  letter-spacing: 0.7px;
}
.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.header-preferences,
.header-game-actions {
  display: flex;
  align-items: center;
  flex: none;
  gap: 10px;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--control-radius);
  box-shadow: 2px 3px 0 var(--ink);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 750;
}
.icon-button:hover {
  background: #ffe7a8;
  transform: translateY(-2px);
}
.eyebrow {
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 1.5px;
}
.menu-heading {
  display: flex;
  align-items: center;
  gap: 40px;
  margin: 35px 0 26px;
  position: relative;
}
.menu-heading .eyebrow {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  padding: 7px 11px;
  transform: rotate(-2deg);
}
h1,
h2 {
  margin: 0;
}
h1 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-size: 54px;
  letter-spacing: -0.5px;
  line-height: 1.02;
}
h1 em {
  font-style: inherit;
  background: var(--world-accent);
  padding: 0 7px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.menu-heading h1 {
  font-size: clamp(44px, 4.5vw, 68px);
  text-transform: uppercase;
  margin: 14px 0 14px;
  position: relative;
  width: max-content;
  max-width: 100%;
}
.heading-spark {
  font-size: 55px;
  color: #da7b48;
  position: absolute;
  right: -76px;
  bottom: 0;
  font-style: normal;
  transform: rotate(15deg);
}
.menu-heading p {
  font-size: 12px;
  color: #64646c;
  margin: 0;
}
.menu-sticker {
  margin-left: auto;
  margin-right: 50px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 16px 21px;
  border-radius: 50%;
  width: 144px;
  height: 144px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  font-family: var(--display);
  font-size: 21px;
  line-height: 0.95;
  transform: rotate(10deg);
}
.menu-sticker b {
  font-weight: 900;
  color: #bb603e;
  margin-top: 4px;
}
.section-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 13px;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 1px;
}
.section-caption b,
.setting-label b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-size: 9px;
  margin-right: 8px;
}
.section-caption small {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}
.map-rows {
  display: grid;
  gap: 16px;
}
.world-row-heading {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}
.world-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.world-card {
  position: relative;
  padding: 0;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 4px 0 #27304480;
  overflow: hidden;
}
.world-card:hover {
  transform: translateY(-4px);
  box-shadow: 4px 7px 0 var(--ink);
}
.world-card.selected {
  transform: translateY(-4px) rotate(-1deg);
  box-shadow: 4px 7px 0 var(--ink);
  background: var(--card-accent);
}
canvas {
  width: 100%;
  display: block;
  aspect-ratio: 1280/680;
  outline: none;
  touch-action: none;
}
.world-card canvas {
  aspect-ratio: 2;
  border-bottom: 2px solid var(--ink);
  pointer-events: none;
}
.world-card > span {
  display: block;
  padding: 10px 12px;
}
.world-card strong {
  font-size: 15px;
  font-family: var(--display);
  letter-spacing: 0.2px;
  font-weight: 700;
  margin-bottom: 5px;
  display: block;
}
.world-card small {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
}
.world-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  opacity: 0;
}
.selected .world-check {
  opacity: 1;
}
.world-details {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 28px;
  align-items: start;
  margin-top: 25px;
}
.world-preview {
  position: relative;
  border: 3px solid var(--ink);
  border-radius: 13px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.preview-label,
.map-label,
#wind {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 8px 11px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.7px;
  box-shadow: 2px 2px 0 var(--ink);
}
.preview-label {
  position: absolute;
  left: 15px;
  top: 14px;
  transform: rotate(-2deg);
}
.preview-sticker {
  position: absolute;
  top: 14px;
  right: 13px;
  transform: rotate(9deg);
  font-family: var(--display);
  font-style: italic;
  text-align: center;
  background: var(--yellow);
  border: 2px solid var(--ink);
  box-shadow: 2px 3px 0 var(--ink);
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
}
.shuffle-map {
  display: flex;
  gap: 7px;
  align-items: center;
  position: absolute;
  right: 13px;
  bottom: 13px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 2px 3px 0 var(--ink);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 750;
  padding: 7px 10px;
}
.shuffle-map i {
  width: 18px;
  height: 18px;
}
.world-settings {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 23px;
  box-shadow: var(--shadow);
  position: relative;
}
.world-settings h2 {
  font-family: var(--display);
  font-size: 39px;
  line-height: 1.05;
  margin: 0 0 14px;
  letter-spacing: 0.5px;
}
.setting-label {
  display: flex;
  align-items: center;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 1px;
  margin: 19px 0 10px;
}
.difficulty-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.difficulty-button {
  position: relative;
  background: #eee9de;
  border: 2px solid var(--ink);
  border-radius: 7px;
  min-height: 44px;
  padding: 9px 6px;
  text-align: center;
  box-shadow: 1px 2px 0 #27304480;
}
.difficulty-button strong {
  display: block;
  font-size: 12px;
  font-weight: 850;
}
.difficulty-button.selected {
  background: var(--world-accent);
  box-shadow: 2px 3px 0 var(--ink);
  transform: translateY(-2px);
}
.world-settings .map-facts {
  margin-top: 14px;
}
.map-facts p,
.online-card .map-facts p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}
.map-facts p + p {
  color: var(--muted);
}
.primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  box-shadow: 4px 5px 0 var(--ink);
  border-radius: 8px;
  padding: 13px 20px;
  font-family: var(--display);
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.primary:hover {
  background: #ffdc7b;
  transform: translateY(-2px);
  box-shadow: 4px 7px 0 var(--ink);
}
.local-crew .primary {
  width: 100%;
}
.primary span {
  font: 700 25px system-ui;
}
.world-menu {
  padding-bottom: 26px;
}
.world-menu[hidden] {
  display: none;
}
body[data-screen="menu"] .scoreboard,
body[data-screen="menu"] .turn-info,
body[data-screen="menu"] .arena,
body[data-screen="menu"] .controls,
body[data-screen="menu"] footer,
body[data-screen="menu"] #worlds-button,
body[data-screen="menu"] #help,
body[data-screen="menu"] #restart {
  display: none;
}
.scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 21px;
  align-items: center;
  margin-bottom: 16px;
}
.team {
  --team-color: var(--orange);
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--ink);
  border-radius: 13px;
  background: var(--paper);
  padding: 12px 17px;
  box-shadow: 3px 4px 0 #27304460;
  position: relative;
  min-width: 0;
}
.team-purple {
  --team-color: var(--purple);
}
.team.is-active {
  background: color-mix(in srgb, var(--team-color) 22%, var(--paper));
  box-shadow: 3px 4px 0 var(--ink);
}
.team-symbol {
  flex: none;
  width: 48px;
  height: 48px;
  background: var(--team-color);
  border: 2px solid var(--ink);
  border-radius: 50%;
  padding: 3px;
}
.team-details {
  flex: 1;
  min-width: 0;
}
.team-details > small {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 8px;
  letter-spacing: 1px;
  font-weight: 800;
}
.active-tag {
  font-size: 7px;
  letter-spacing: 0.5px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 3px;
  padding: 2px 5px;
  visibility: hidden;
}
.is-active .active-tag {
  visibility: visible;
}
.team h2 {
  font-family: var(--display);
  font-size: 21px;
  letter-spacing: 0.3px;
  margin: 3px 0 6px;
  white-space: nowrap;
}
.team-health {
  height: 7px;
  background: #ddd7cc;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  overflow: hidden;
}
.team-health > span {
  display: block;
  background: var(--team-color);
  height: 100%;
  transition: width 0.25s;
}
.roster {
  display: flex;
  gap: 8px;
  margin-top: 7px;
}
.worm-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 8px;
  white-space: nowrap;
  color: #666271;
}
.worm-chip:before {
  content: "";
  height: 5px;
  width: 5px;
  border-radius: 50%;
  background: var(--team-color);
  border: 1px solid var(--ink);
}
.worm-chip.active {
  font-weight: 850;
  color: var(--ink);
}
.worm-chip.out {
  opacity: 0.45;
  text-decoration: line-through;
}
.worm-chip.out:before {
  background: #a59f96;
}
.team > strong {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.team > strong small {
  font: 800 8px system-ui;
  letter-spacing: 1px;
}
.turn-info {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  height: 62px;
  padding: 6px 10px;
  margin-bottom: 8px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
}
.turn-status > span {
  display: inline-block;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.6px;
  background: var(--yellow);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  padding: 3px 6px;
  color: var(--ink) !important;
  transform: rotate(-3deg);
}
.timer-sticker {
  text-align: center;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px 8px 13px 7px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 2px 4px;
  transform: rotate(2deg);
}
#timer {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
#timer > span {
  font: 800 12px system-ui;
  margin-left: 2px;
}
.turn-status > small {
  display: block;
  font-size: 11px;
  line-height: 1.25;
  margin-top: 4px;
  font-weight: 650;
}
#switch-worm {
  min-height: 44px;
  padding: 4px 8px;
  font-size: 11px;
}
.turn-info.urgent .timer-sticker {
  background: #ffaf83;
  animation: tick 0.8s ease-in-out infinite;
}
@media (max-width: 780px) {
  .turn-info {
    position: sticky;
    top: 0;
    z-index: 5;
    grid-template-columns: 49px minmax(0, 1fr) minmax(74px, 100px);
    gap: 7px;
    height: 76px;
    padding-inline: 7px;
  }
  .turn-status > small {
    font-size: 10px;
  }
  .arena {
    scroll-margin-top: 84px;
  }
}
@keyframes tick {
  50% {
    transform: rotate(-2deg);
  }
}
.arena {
  position: relative;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 5px 6px 0 var(--ink);
  background: #849ba5;
}
#game {
  cursor: crosshair;
}
#game:focus-visible {
  outline: 3px solid #477cb4;
  outline-offset: -3px;
}
.arena-top {
  position: absolute;
  top: 15px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  pointer-events: none;
}
.map-label {
  transform: rotate(-1deg);
}
.map-label i {
  display: inline-block;
  background: #83bd60;
  border: 1px solid var(--ink);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 5px;
}
#wind {
  background: #ffe9af;
  transform: rotate(2deg);
}
.toast {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -9px) rotate(-2deg);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 9px;
  box-shadow: 3px 4px 0 var(--ink);
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.15s,
    transform 0.15s;
  white-space: nowrap;
  max-width: 94%;
}
.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0) rotate(-2deg);
}
.toast:after {
  content: "";
  position: absolute;
  bottom: -9px;
  left: 45%;
  width: 13px;
  height: 13px;
  background: var(--paper);
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
}
.controls {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr 110px;
  gap: 24px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 5px 0 var(--ink);
  padding: 15px 18px;
  margin-top: 18px;
  align-items: center;
}
.controls small {
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.8px;
}
.weapon-picker > div {
  display: flex;
  gap: 9px;
  margin-top: 8px;
}
.weapon {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  background: #ede9df;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 9px 11px;
  text-align: left;
  box-shadow: 1px 2px 0 #27304480;
  flex: 1;
  font-family: var(--display);
  font-size: 17px;
  line-height: 1;
}
.weapon:hover {
  background: #fff0ba;
  transform: translateY(-2px);
}
.weapon.selected {
  background: var(--yellow);
  box-shadow: 2px 3px 0 var(--ink);
  transform: translateY(-2px);
}
.weapon.selected:after {
  content: "✓";
  position: absolute;
  top: -9px;
  left: 50%;
  margin-left: -9px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 10px system-ui;
}
.weapon-icon {
  width: 39px;
  height: 40px;
  flex: none;
}
.weapon small {
  display: block;
  font: 700 6px system-ui;
  letter-spacing: 0.8px;
  margin-top: 5px;
  color: #5f5b63;
}
.weapon kbd {
  font-size: 8px;
  padding: 2px 4px;
  margin-left: auto;
}
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fffaf1;
  border: 1.5px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  border-radius: 4px;
  font:
    800 9px ui-monospace,
    monospace;
  padding: 2px 5px;
  line-height: 1.2;
  white-space: nowrap;
}
.power-control {
  min-width: 0;
  border-left: 1px dashed #b7b0a4;
  padding-left: 23px;
}
.power-control > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.power-control strong {
  font-family: var(--display);
  font-size: 23px;
  font-weight: 700;
}
.power-track {
  display: block;
  height: 17px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: repeating-linear-gradient(
    to right,
    #e2ddcf 0,
    #e2ddcf calc(10% - 2px),
    #fff8e7 calc(10% - 2px),
    #fff8e7 10%
  );
  overflow: hidden;
  margin: 5px 0 9px;
  position: relative;
}
.power-track span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(to right, #a6cf72, #ffce54, #ff935e);
}
.power-track:after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(10% - 2px),
    #27304433 calc(10% - 2px),
    #27304433 10%
  );
  pointer-events: none;
}
.fire-button {
  display: grid;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: 60px;
  grid-template-rows: 17px 1fr;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 800;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--yellow);
  padding: 4px 6px;
  touch-action: none;
}
.fire-button .power-track {
  margin: 0;
}
.fire-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.move-pad button {
  touch-action: none;
}
.fire-button:hover {
  color: #ba5838;
}
.fire-button i {
  height: 21px;
  width: 21px;
}
.controls.is-charging .power-track {
  box-shadow: 0 0 0 3px #ffce5455;
}
.controls.is-charging .fire-button {
  color: #ba5838;
}
.move-control {
  border-left: 1px dashed #b7b0a4;
  padding-left: 23px;
  min-width: 0;
}
.move-control > div:first-child {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 2px;
}
.move-control small {
  font-size: 7px;
}
.move-control strong {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 650;
  white-space: nowrap;
}
.move-control strong span {
  font: 600 8px system-ui;
}
.move-pad {
  display: flex;
  gap: 7px;
  margin-top: 9px;
}
.move-pad button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  background: #e8e5db;
  border-radius: 6px;
  box-shadow: 1px 2px 0 var(--ink);
  padding: 4px;
  flex: 1;
  height: 35px;
}
.move-pad button:hover {
  background: #d5eab3;
}
.move-pad button i {
  width: 21px;
  height: 21px;
}
.move-pad button kbd {
  position: absolute;
  bottom: -6px;
  right: -4px;
  font-size: 6px;
  padding: 0 2px;
  border-width: 1px;
  box-shadow: 0 1px 0 var(--ink);
}
/* Keep focus on the button's border, independently of protruding badges. */
.weapon:focus-visible,
.move-pad button:focus-visible {
  outline: none;
}
.weapon:focus-visible::before,
.move-pad button:focus-visible::before {
  content: "";
  position: absolute;
  inset: -6px;
  border: 3px solid #477cb4;
  border-radius: 12px;
  pointer-events: none;
}
.weapon:focus-visible::before {
  border-radius: 14px;
}
.skip {
  display: flex;
  gap: 7px;
  justify-content: space-between;
  align-items: center;
  background: #e9e5da;
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 2px 3px 0 var(--ink);
  padding: 12px;
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.1;
  text-align: left;
}
.skip b {
  font-family: system-ui;
  font-size: 18px;
}
.skip kbd {
  display: none;
}
.skip:hover {
  background: #ffdd8a;
}
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 17px;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 1px;
  color: #6e6b73;
}
footer > span:last-child {
  display: flex;
  align-items: center;
  gap: 6px;
}
footer b {
  background: #fffaf0;
  padding: 2px 5px;
  border: 1px solid #a59b8f;
  font-size: 7px;
}
footer a {
  margin-left: 15px;
  color: var(--ink);
  text-decoration: underline;
  letter-spacing: 0;
}
.divider {
  margin: 0 8px;
}
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #26304455;
  backdrop-filter: blur(4px);
}
.intro-card {
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 7px 8px 0 var(--ink);
  border-radius: 16px;
  padding: 25px 36px;
  max-width: 90%;
  transform: rotate(-2deg);
}
.intro-card .eyebrow {
  background: var(--yellow);
  padding: 5px 9px;
  display: inline-block;
  font-size: 8px;
}
.intro-worms {
  width: 82px;
  height: 82px;
  margin: 9px auto;
}
.intro-card h1 {
  font-size: 36px !important;
  max-width: 450px;
  line-height: 1.05;
}
.intro-card p {
  font-size: 12px;
  line-height: 1.7;
  color: #66636f;
}
.intro-card .primary {
  margin: 19px auto 0;
  min-width: 220px;
}
.intro-card > small {
  display: block;
  font-size: 9px;
  margin-top: 14px;
  color: #7d747b;
}
.help-panel {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-1deg);
  width: 445px;
  max-width: 95%;
  max-height: 94%;
  overflow: auto;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 6px 7px 0 var(--ink);
}
.help-panel .eyebrow {
  background: var(--yellow);
  padding: 5px 9px;
  display: inline-block;
}
.help-panel h2 {
  font: 32px/1.05 var(--display);
  margin: 14px 0 18px;
}
.help-panel h2 em {
  font-style: normal;
  color: #c4764c;
}
.help-panel dl {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 12px;
  font-size: 10px;
  align-items: center;
  margin-bottom: 20px;
}
.help-panel dt {
  font-weight: 800;
}
.help-panel dd {
  margin: 0;
  color: #66626e;
  line-height: 1.4;
}
.help-panel p {
  font-size: 10px;
  line-height: 1.7;
  padding: 12px;
  background: #eeeadd;
  border: 1px dashed #b7ae9f;
  border-radius: 5px;
}
.help-panel .primary {
  width: 100%;
  font-size: 18px;
}
.close {
  position: absolute;
  right: 11px;
  top: 8px;
  font-size: 26px;
  background: none;
  border: 0;
  font-weight: 500;
}
@media (min-width: 1100px) and (min-height: 700px) {
  body[data-screen="game"] .shell {
    max-width: min(1440px, calc((100svh - 340px) * 1.882 + 64px));
  }
}
@media (max-width: 1100px) {
  .shell {
    padding: 20px 22px;
  }
  .header-actions {
    gap: 8px;
  }
  .icon-button {
    padding: 7px 9px;
  }
  .world-cards {
    gap: 10px;
  }
  .world-card strong {
    font-size: 13px;
  }
  .world-card > span {
    padding: 9px;
  }
  .world-details {
    gap: 20px;
  }
  .world-settings {
    padding: 17px;
  }
  .world-settings h2 {
    font-size: 32px;
  }
  .menu-sticker {
    margin-right: 20px;
  }
  .scoreboard {
    gap: 14px;
  }
  .team {
    gap: 9px;
    padding: 10px 12px;
  }
  .team-symbol {
    width: 40px;
    height: 40px;
  }
  .team h2 {
    font-size: 18px;
  }
  .team > strong {
    font-size: 28px;
  }
  .controls {
    gap: 14px;
    padding: 13px;
    grid-template-columns: 1.4fr 1fr 0.8fr 90px;
  }
  .power-control,
  .move-control {
    padding-left: 14px;
  }
  .weapon {
    padding: 8px;
    gap: 4px;
    font-size: 15px;
  }
  .weapon-icon {
    width: 30px;
    height: 33px;
  }
  .move-control small {
    font-size: 6px;
  }
  .skip {
    padding: 9px;
    font-size: 15px;
  }
  .roster {
    gap: 6px;
  }
  .worm-chip {
    font-size: 7px;
  }
}
@media (max-width: 780px) {
  .shell {
    padding: 16px;
  }
  .header {
    margin-bottom: 23px;
    gap: 9px;
  }
  .brand {
    font-size: 25px;
  }
  .brand-icon {
    width: 44px;
    height: 44px;
    padding: 3px;
  }
  .brand small {
    font-size: 6px;
    margin-top: 6px;
    letter-spacing: 0.3px;
  }
  .header-actions {
    gap: 7px;
  }
  .icon-button {
    padding: 6px;
    min-height: 33px;
  }
  .header-actions .icon-button span {
    display: none;
  }
  .icon-button i {
    width: 19px;
    height: 19px;
  }
  .menu-heading {
    margin: 27px 0 25px;
  }
  .menu-heading h1 {
    font-size: 46px;
  }
  .menu-heading p {
    font-size: 10px;
  }
  .menu-sticker {
    width: 104px;
    height: 104px;
    font-size: 16px;
    padding: 12px;
    margin-right: 10px;
  }
  .heading-spark {
    display: none;
  }
  .world-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .world-card strong {
    font-size: 15px;
  }
  .world-card canvas {
    max-height: 100px;
  }
  .world-details {
    grid-template-columns: 1fr;
  }
  .world-settings h2 {
    font-size: 37px;
  }
  .section-caption small {
    display: none;
  }
  .scoreboard {
    gap: 10px;
  }
  .team-symbol {
    display: none;
  }
  .team {
    padding: 9px;
    gap: 8px;
  }
  .team h2 {
    font-size: 16px;
    white-space: normal;
  }
  .team > strong {
    font-size: 25px;
  }
  .team-details > small {
    font-size: 7px;
    letter-spacing: 0.3px;
  }
  .active-tag {
    display: none;
  }
  .roster {
    display: none;
  }
  .controls {
    grid-template-columns: 1.3fr 1fr;
    gap: 17px;
    padding: 16px;
  }
  .move-control {
    border: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .move-control > div:first-child {
    flex-direction: column;
    align-items: start;
    gap: 6px;
  }
  .move-control small {
    font-size: 7px;
  }
  .move-pad {
    margin: 0;
    flex: 1;
  }
  .skip {
    padding: 8px 13px;
    justify-self: stretch;
  }
  .skip span br {
    display: none;
  }
  .skip kbd {
    display: inline-flex;
  }
  .skip b {
    margin-left: auto;
  }
  .controls small {
    font-size: 7px;
  }
  .arena-top {
    top: 10px;
    left: 10px;
    right: 10px;
  }
  .map-label,
  #wind {
    font-size: 7px;
    padding: 5px 7px;
  }
  .toast {
    font-size: 9px;
    padding: 7px 12px;
  }
  .help-panel {
    padding: 16px;
    max-height: 92%;
  }
  .help-panel h2 {
    font-size: 23px;
    margin: 10px 0;
  }
  .help-panel dl {
    gap: 8px;
    font-size: 9px;
    grid-template-columns: 117px 1fr;
    margin: 12px 0;
  }
  .help-panel p {
    font-size: 9px;
    padding: 8px;
  }
  .help-panel .primary {
    font-size: 15px;
    padding: 8px 15px;
  }
  .intro-card {
    padding: 18px 22px;
  }
  .intro-worms {
    width: 50px;
    height: 50px;
  }
  .intro-card h1 {
    font-size: 25px !important;
  }
  .intro-card p {
    font-size: 10px;
  }
  .intro-card .primary {
    font-size: 17px;
    padding: 9px 14px;
    margin-top: 12px;
  }
  .intro-card .eyebrow {
    font-size: 6px;
  }
  footer {
    letter-spacing: 0.3px;
    font-size: 7px;
  }
  footer .divider {
    margin: 0 3px;
  }
  footer a {
    margin-left: 4px;
  }
}
@media (max-width: 480px) {
  .shell {
    padding: 12px;
  }
  .brand {
    font-size: 23px;
  }
  .brand-icon {
    width: 38px;
    height: 40px;
  }
  .header-actions {
    gap: 5px;
  }
  .header-actions .icon-button {
    padding: 4px;
  }
  .menu-sticker {
    display: none;
  }
  .menu-heading {
    gap: 12px;
  }
  #world-menu .menu-heading {
    flex-wrap: wrap;
  }
  .menu-heading h1 {
    font-size: 42px;
  }
  .menu-heading p {
    font-size: 9px;
    max-width: 290px;
  }
  .world-card > span {
    padding: 8px;
  }
  .world-card strong {
    font-size: 12px;
  }
  .world-card small {
    font-size: 8px;
  }
  .world-card canvas {
    max-height: 68px;
  }
  .world-cards {
    gap: 9px;
  }
  .preview-sticker {
    font-size: 12px;
    padding: 7px;
    top: 11px;
    right: 10px;
  }
  .preview-label {
    font-size: 7px;
    padding: 6px 8px;
    left: 10px;
    top: 11px;
  }
  .shuffle-map {
    font-size: 8px;
    bottom: 9px;
    right: 9px;
    padding: 5px 8px;
  }
  .scoreboard {
    gap: 6px;
  }
  .team {
    padding: 8px 6px;
    gap: 5px;
  }
  .team h2 {
    font-size: 13px;
  }
  .team > strong {
    font-size: 22px;
  }
  .controls {
    padding: 11px;
    gap: 13px;
    grid-template-columns: 1fr 1fr;
  }
  .weapon-icon {
    width: 25px;
    height: 29px;
  }
  .weapon {
    padding: 6px;
    gap: 3px;
    font-size: 12px;
  }
  .weapon-picker > div {
    gap: 5px;
  }
  .weapon kbd {
    display: none;
  }
  .weapon small {
    font-size: 5px;
    letter-spacing: 0.2px;
  }
  .power-control {
    padding-left: 11px;
  }
  .fire-button {
    font-size: 10px;
    gap: 3px;
  }
  .fire-button kbd {
    font-size: 7px;
    padding: 2px 3px;
  }
  .fire-button i {
    display: none;
  }
  .move-control {
    gap: 8px;
  }
  .move-control small {
    font-size: 6px;
  }
  .move-pad {
    gap: 5px;
  }
  .move-pad button {
    height: 30px;
  }
  .move-pad button i {
    width: 17px;
    height: 17px;
  }
  .skip {
    font-size: 13px;
  }
  .map-label,
  #wind {
    font-size: 6px;
    padding: 4px 5px;
  }
  .toast {
    font-size: 8px;
  }
  .arena {
    border-width: 2px;
  }
  .help-panel h2 {
    font-size: 18px;
  }
  .help-panel dl {
    font-size: 8px;
    gap: 5px;
    grid-template-columns: 105px 1fr;
  }
  .help-panel p {
    font-size: 8px;
    margin: 8px 0;
  }
  .help-panel kbd {
    font-size: 7px;
  }
  .help-panel .eyebrow {
    font-size: 7px;
  }
  .help-panel {
    padding: 13px;
  }
  .intro-card .eyebrow {
    font-size: 5px;
  }
  .intro-card h1 {
    font-size: 20px !important;
  }
  .intro-worms {
    width: 33px;
    height: 33px;
    margin: 6px auto;
  }
  .intro-card p {
    font-size: 8px;
    margin: 6px 0;
  }
  .intro-card .primary {
    font-size: 14px;
    margin-top: 9px;
    min-width: 160px;
  }
  .intro-card > small {
    font-size: 6px;
    margin-top: 10px;
  }
  footer > span:first-child {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  button,
  .toast,
  .team-health > span {
    transition: none;
  }
  .turn-info.urgent .timer-sticker {
    animation: none;
  }
}
@media (min-width: 1100px) and (min-height: 700px) {
  body[data-screen="game"] .shell {
    max-width: min(1440px, max(800px, calc((100svh - 420px) * 1.882 + 64px)));
  }
}
.shell {
  container-type: inline-size;
}
@media (min-width: 781px) {
  @container (max-width:1000px) {
    .scoreboard {
      gap: 15px;
    }
    .team {
      padding: 10px 12px;
      gap: 10px;
    }
    .team-symbol {
      width: 37px;
      height: 37px;
    }
    .team h2 {
      font-size: 18px;
    }
    .team > strong {
      font-size: 29px;
    }
    .roster {
      gap: 6px;
    }
    .worm-chip {
      font-size: 7px;
    }
    .controls {
      grid-template-columns: 1.45fr 1.1fr 0.85fr 86px;
      gap: 14px;
      padding: 12px;
    }
    .weapon {
      font-size: 14px;
      padding: 8px;
      gap: 5px;
    }
    .weapon-icon {
      width: 27px;
      height: 31px;
    }
    .weapon kbd {
      display: none;
    }
    .power-control,
    .move-control {
      padding-left: 13px;
    }
    .fire-button {
      font-size: 8px;
    }
    .fire-button i {
      width: 16px;
      height: 16px;
    }
    .move-control small {
      font-size: 6px;
    }
    .move-control strong {
      font-size: 19px;
    }
    .skip {
      font-size: 15px;
      padding: 9px;
    }
    .header-actions {
      gap: 8px;
    }
  }
  @container (max-width:790px) {
    .team-symbol {
      display: none;
    }
    .scoreboard {
      gap: 12px;
    }
    .team h2 {
      font-size: 17px;
    }
    .header-actions .icon-button span {
      display: none;
    }
    .header-actions .icon-button {
      padding: 7px;
    }
    .brand {
      font-size: 27px;
    }
    .brand-icon {
      width: 47px;
      height: 47px;
    }
    .controls {
      gap: 12px;
      grid-template-columns: 1.5fr 1.1fr 0.8fr 78px;
    }
    .fire-button i {
      display: none;
    }
    .skip {
      font-size: 14px;
      padding: 8px;
    }
    .move-pad {
      gap: 5px;
    }
    .controls small {
      font-size: 7px;
    }
    .move-control small {
      font-size: 6px;
    }
    .weapon {
      padding: 7px;
      font-size: 13px;
    }
    .weapon-icon {
      width: 24px;
      height: 27px;
    }
    .weapon small {
      font-size: 5px;
    }
  }
  @container (max-width:650px) {
    .controls {
      grid-template-columns: 1.3fr 1fr;
      padding: 13px;
      gap: 16px;
    }
    .move-control {
      padding: 0;
      border: 0;
      display: flex;
      gap: 9px;
      align-items: center;
    }
    .move-control > div:first-child {
      flex-direction: column;
      align-items: start;
    }
    .move-pad {
      flex: 1;
      margin: 0;
    }
    .skip {
      font-size: 17px;
      padding: 10px 13px;
    }
    .skip span br {
      display: none;
    }
    .skip b {
      margin-left: auto;
    }
    .roster {
      display: none;
    }
    .scoreboard {
      gap: 8px;
    }
    .team h2 {
      font-size: 15px;
    }
    .team > strong {
      font-size: 25px;
    }
    .team {
      padding: 9px;
    }
  }
  @container (max-width:1000px) {
    .skip b {
      display: none;
    }
  }
  @container (max-width:650px) {
    .skip b {
      display: block;
    }
  }
}

.help-panel {
  position: fixed;
  max-height: calc(100svh - 36px);
}
.controls > * {
  min-width: 0;
}
@media (min-width: 781px) and (min-height: 700px) {
  body[data-screen="game"] .shell {
    max-width: min(1440px, max(800px, calc((100svh - 420px) * 1.882 + 64px)));
  }
}
@media (max-width: 480px) {
  .controls {
    grid-template-columns: 1.25fr 1.05fr;
  }
  .weapon-icon {
    width: 21px;
    height: 25px;
  }
  .weapon {
    padding: 5px;
    font-size: 11px;
  }
}

/* Swing & Smash: a larger crew and a six-tool kit. */
.team-green {
  --team-color: #91d5a2;
}
.team h2 {
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-setup {
  border: 2px dashed var(--ink);
  border-radius: 10px;
  padding: 12px;
  margin: 14px 0;
}
.team-setup legend {
  font-size: 11px;
  font-weight: 850;
}
.team-setup label {
  display: block;
  font-size: 12px;
  margin: 8px 0;
}
.team-setup select,
.team-setup input:not([type="checkbox"]) {
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 8px;
  font: inherit;
}
.team-setup input[type="checkbox"] {
  accent-color: var(--ink);
}
.team-setup p {
  font-size: 11px;
  line-height: 1.5;
  margin: 10px 0 0;
}
.weapon-picker {
  grid-column: 1 / -1;
}
.weapon-picker > div {
  flex-wrap: wrap;
}
.weapon {
  min-width: 120px;
}
.controls {
  grid-template-columns: 1fr 1fr 110px;
}
.scoreboard.three-teams {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.scoreboard.three-teams .team {
  padding: 10px;
  gap: 8px;
}
.scoreboard.three-teams .team-symbol {
  width: 35px;
  height: 35px;
}
.scoreboard.three-teams .team h2 {
  font-size: 17px;
}
@media (max-width: 780px) {
  .scoreboard.three-teams {
    grid-template-columns: 1fr;
  }
  .controls {
    grid-template-columns: 1fr 1fr;
  }
  .controls .skip {
    grid-column: 2;
  }
  .weapon {
    min-width: 105px;
  }
}

/* One compact weapon rack, with the selected tool's instructions beneath it. */
.controls {
  grid-template-columns: minmax(0, 2.8fr) minmax(0, 0.9fr) minmax(0, 0.8fr) 82px;
  gap: 14px;
  padding: 13px;
}
.weapon-picker {
  grid-column: auto;
  position: relative;
  align-self: center;
}
.weapon-picker > div {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}
.weapon {
  min-width: 0;
  min-height: 55px;
  padding: 7px 4px;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.weapon-icon {
  width: 30px;
  height: 27px;
}
.weapon > span:nth-child(2) {
  white-space: nowrap;
}
.weapon small {
  display: none;
}
.weapon kbd {
  position: absolute;
  right: 3px;
  top: 3px;
  font-size: 6px;
  padding: 1px 2px;
  margin: 0;
}
.power-control,
.move-control {
  padding-left: 14px;
}
.power-control > div:first-of-type {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
}
.power-control strong {
  font-size: 20px;
  white-space: nowrap;
}
.power-control.push-ready .fire-button {
  box-shadow: 0 0 0 3px #f6ce6080;
}
.turn-info.retreat #timer {
  color: #815220;
}
.retreat-controls .move-pad button {
  background: var(--yellow);
}
.retreat-controls #power-label {
  font-size: 12px;
}
body:has(.weapon[data-weapon="push"][aria-pressed="true"]) #power-label {
  font-size: 12px;
}
.power-control.instant-tool .power-track {
  display: none;
}
.power-control.instant-tool .fire-button {
  grid-template-rows: 1fr;
}
.fire-button kbd {
  font-size: 7px;
}
.move-pad {
  gap: 5px;
}
.move-pad button {
  min-width: 0;
  padding: 6px;
}
.skip {
  font-size: 13px;
  padding: 8px;
}
@media (max-width: 780px) {
  .controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 70px;
    gap: 10px;
  }
  .weapon-picker {
    grid-column: 1 / -1;
  }
  .weapon {
    min-height: 53px;
    font-size: 12px;
  }
  .controls .skip {
    grid-column: 3;
    grid-row: 2;
  }
  .power-control {
    padding-left: 0;
    border: 0;
  }
  .move-control {
    padding-left: 10px;
    display: block;
    border-left: 1px dashed #b7b0a4;
  }
  .move-pad {
    margin-top: 6px;
  }
  .move-control > div:first-child {
    flex-direction: row;
    align-items: center;
  }
  .move-control small {
    display: none;
  }
}
@media (max-width: 480px) {
  .weapon-picker > div {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .controls {
    gap: 8px;
    padding: 10px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr) 53px;
  }
  .weapon {
    font-size: 10px;
  }
  .weapon-icon {
    width: 26px;
    height: 24px;
  }
  .power-control strong {
    font-size: 16px;
  }
  .fire-button i,
  .fire-button kbd {
    display: none;
  }
  .skip {
    font-size: 10px;
  }
  .skip kbd,
  .skip b {
    display: none;
  }
}
@media (max-width: 780px) {
  .controls .skip {
    justify-content: center;
    padding: 7px 4px;
  }
  .controls .skip b,
  .controls .skip kbd {
    display: none;
  }
  .controls .skip span br {
    display: block;
  }
}
@media (max-width: 360px) {
  .header {
    gap: 6px;
  }
  .brand {
    font-size: 21px;
    gap: 7px;
  }
  .header-actions {
    gap: 3px;
  }
}

/* Nine tools, with a persistent shared-ammo badge on every button. */
.weapon-picker > div { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.weapon { min-height: 59px; padding-top: 10px; }
.weapon .weapon-ammo {
  position: absolute; left: 3px; top: 3px;
  min-width: 13px; padding: 1px 3px; border-radius: 4px;
  background: #273044; color: #fff4d9;
  font: 800 9px system-ui; text-align: center;
}
.weapon-picker .weapon-hint {
  min-height: calc(2.7em + 12px);
  margin: 9px 0 0;
  padding: 6px 8px;
  border-left: 3px solid var(--yellow);
  background: var(--cream);
  font-size: 12px;
  line-height: 1.35;
}
.weapon-picker .arsenal-note { display: block; font-size: 9px; letter-spacing: 0; line-height: 1.5; margin-top: 4px; font-weight: 600; }
.weapon:disabled { opacity: .58; }
.weapon .weapon-status {
  display: block;
  color: var(--ink);
  margin-top: 4px;
  font: 650 9px/1.2 system-ui, sans-serif;
  letter-spacing: 0;
  text-align: center;
  white-space: normal;
}
.weapon[data-weapon="holy"]:disabled { opacity: 1; }
.weapon[data-weapon="holy"]:disabled:not(.selected) {
  border-color: #8a8379;
  background: #ede9df;
}
.weapon[data-weapon="holy"]:disabled .weapon-icon { opacity: .55; }
@media (min-width: 781px) {
  .controls { grid-template-columns: minmax(0, 2.8fr) minmax(0, .9fr) minmax(0, .8fr) 70px; }
}
@media (min-width: 781px) and (min-height: 700px) {
  body[data-screen="game"] .shell {
    max-width: min(1440px, max(800px, calc((100svh - 500px) * 1.882 + 64px)));
  }
  body[data-screen="game"]:has(.scoreboard.three-teams) .shell {
    max-width: min(1440px, max(800px, calc((100svh - 580px) * 1.882 + 64px)));
  }
}
@media (max-width: 780px) {
  .weapon-picker > div { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .weapon-picker > div { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .weapon { min-height: 53px; }
  .weapon-picker .weapon-hint { min-height: calc(4.05em + 12px); }
}

/* Language stays visible in both the world chooser and a running match. */
.language-switch {
  display: inline-flex;
  flex: none;
  border: 2px solid var(--ink);
  border-radius: var(--control-radius);
  box-shadow: 2px 3px 0 var(--ink);
  background: var(--paper);
  overflow: hidden;
}
.language-switch button {
  min-width: 32px;
  min-height: 0;
  height: 100%;
  padding: 5px 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 800 10px system-ui;
}
.language-switch button + button {
  border-left: 1px solid var(--ink);
}
.language-switch button[aria-pressed="true"] {
  background: var(--yellow);
}
.language-switch button:hover {
  background: #ffe7a8;
}
.language-switch button:focus-visible {
  outline: none;
}
.language-switch:has(button:focus-visible) {
  outline: 3px solid #477cb4;
  outline-offset: 4px;
}
.language-switch button:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}
.header-preferences .language-switch,
.header-actions .icon-button {
  height: var(--header-control-height);
  min-height: var(--header-control-height);
  flex: none;
}
.header-actions .icon-button {
  padding: 8px 12px;
  line-height: 16px;
  white-space: nowrap;
}
#online-button {
  width: 124px;
}
.header-actions .icon-button:hover,
.header-actions .icon-button:active:not(:disabled) {
  transform: none;
}
#restart-confirm {
  width: min(440px, calc(100% - 32px));
  padding: 20px;
  border: 2px solid var(--ink);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 4px 5px 0 var(--ink);
}
#restart-confirm::backdrop {
  background: #27304499;
}
#restart-confirm h2 {
  margin: 0;
  font-family: var(--display);
}
.restart-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
#sound {
  width: 120px;
}
@media (max-width: 780px) {
  .header-preferences,
  .header-game-actions {
    gap: 7px;
  }
  .header-actions .icon-button {
    padding: 8px;
  }
  #sound {
    width: var(--header-control-height);
  }
}
@media (max-width: 620px) {
  .header {
    flex-wrap: wrap;
  }
  .header-actions {
    margin-left: auto;
  }
}
@media (max-width: 480px) {
  .header-actions {
    flex-basis: 100%;
    justify-content: flex-end;
  }
}
