:root {
  --paper: #f8f5e9;
  --ink: #2334ab;
  --muted: #6e78a5;
  --red: #df3d4f;
  --gold: #ecac39;
  --line: #253aab28;
  --hand: "Kaiti SC", "STKaiti", "KaiTi", ui-serif, serif;
  --body: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background-image: repeating-linear-gradient(
    transparent 0 31px,
    #607fbd13 31px 32px
  );
  min-height: 100vh;
}
button,
input {
  font: inherit;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
a {
  color: inherit;
  text-decoration: none;
}
.masthead {
  height: 92px;
  max-width: 1600px;
  margin: auto;
  padding: 22px 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--hand);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -1px;
  transform: rotate(-1deg);
  white-space: nowrap;
}
.wordmark b {
  color: var(--red);
}
.wordmark span {
  margin-left: 18px;
  font-family: var(--body);
  font-size: 14px;
  letter-spacing: 2px;
  font-weight: 500;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}
.connection {
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.connection:before {
  content: "";
  background: var(--muted);
  border-radius: 50%;
  height: 6px;
  width: 6px;
}
.connection.online:before {
  background: #4a9a66;
}
.icon-button {
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 50% 45% 46% 49%/48%;
  padding: 8px 12px;
  font-size: 20px;
}
.icon-button span {
  font-size: 13px;
}
.workspace {
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr);
  gap: 40px;
  max-width: 1600px;
  margin: auto;
  padding: 36px 42px 10px;
}
.sidebar {
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.eyebrow {
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--muted);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  position: relative;
  font-family: var(--hand);
  font-size: 66px;
  line-height: 1.15;
  letter-spacing: 3px;
  margin: 18px 0 20px;
  transform: rotate(-2deg);
}
h1 em {
  font-style: normal;
  color: var(--red);
}
.title-star {
  position: absolute;
  font-size: 48px;
  right: 0;
  top: 8px;
  color: var(--gold);
  transform: rotate(15deg);
}
.intro {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 24px;
}
.field-label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
}
.panel input {
  width: 100%;
  height: 46px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: #fff7;
  color: var(--ink);
  padding: 10px 12px;
  outline-offset: 0;
}
.panel input::placeholder {
  color: #7f87ad;
}
.button {
  background: var(--paper);
  border: 1.8px solid var(--ink);
  border-radius: 5px 9px 4px 8px;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 650;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  transition:
    transform 0.13s,
    box-shadow 0.13s;
}
.button:hover {
  transform: translateY(-2px);
  box-shadow: 3px 4px 0 #2639ab26;
}
.button:active {
  transform: translateY(1px);
}
.button.primary {
  margin-top: 18px;
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  box-shadow: 4px 4px 0 #2334ab25;
}
.button span {
  font-size: 12px;
  font-weight: 450;
}
.join-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.join-row input {
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 14px;
}
.button.small {
  width: 72px;
  justify-content: center;
  padding: 9px;
}
.or-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
}
.or-line:before,
.or-line:after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--line);
}
.practice {
  border-color: var(--red);
  color: var(--red);
  background: transparent;
}
.status {
  font-size: 14px;
  line-height: 1.6;
  color: var(--red);
  margin-top: 12px;
  min-height: 1em;
}
.howto {
  border-top: 1.5px solid var(--ink);
  padding-top: 16px;
}
.howto h3 {
  font-size: 12px;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
}
.howto > div:not(.pickup-key) {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
  font-size: 13px;
}
kbd {
  font: 12px var(--body);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 3px 6px;
  min-width: 66px;
  text-align: center;
  box-shadow: 0 2px 0 #2334ab18;
}
.howto p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  margin-top: 12px;
}
.pickup-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 12px;
  font-size: 12px;
}
.arena-section {
  min-width: 0;
}
.arena-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 42px;
  margin-bottom: 12px;
  font-size: 14px;
}
.arena-top > span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.arena-top > div {
  display: flex;
  align-items: center;
  gap: 22px;
}
.arena-top b {
  font-weight: 500;
}
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}
#timer {
  font: 26px var(--hand);
  letter-spacing: 2px;
}
#alive-count {
  color: var(--muted);
  font-size: 13px;
}
.arena-frame {
  position: relative;
  aspect-ratio: 1.13;
  max-height: calc(100vh - 230px);
  min-height: 360px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 13px 5px 12px 6px;
  background: var(--paper);
  box-shadow: 7px 8px 0 #2334ab0d;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}
.paper-label {
  position: absolute;
  bottom: 10px;
  right: 16px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  pointer-events: none;
}
.arena-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 15px;
  font-size: 12px;
  color: var(--muted);
}
.arena-bottom > span:first-child {
  font-family: var(--hand);
  font-size: 17px;
  color: var(--ink);
  transform: rotate(-1deg);
}
.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--paper);
  font: 24px var(--hand);
}
.countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 900 100px var(--hand);
  color: var(--red);
  background: #f8f5e966;
  pointer-events: none;
  text-shadow: 4px 4px var(--paper);
}
.arena-message {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%) rotate(-2deg);
  padding: 18px 28px;
  max-width: 90%;
  border: 2px solid var(--ink);
  background: #fffdf3f5;
  box-shadow: 5px 5px 0 #2334ab22;
  white-space: nowrap;
  font: 32px var(--hand);
  text-align: center;
  pointer-events: none;
}
.panel h2 {
  font: 40px var(--hand);
  margin: 16px 0 24px;
}
.room-ticket {
  border: 1px dashed var(--ink);
  padding: 16px;
  text-align: center;
  margin: 20px 0;
  background: #fff8;
  transform: rotate(-1deg);
}
.room-ticket > span {
  font-size: 12px;
  display: block;
}
.room-ticket strong {
  display: block;
  font: 38px var(--hand);
  letter-spacing: 6px;
  margin: 8px 0;
}
.text-button {
  border: 0;
  background: none;
  padding: 10px 0;
  text-align: left;
  font-size: 14px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 5px;
}
.room-ticket .text-button {
  color: var(--red);
  font-size: 13px;
}
.roster {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}
.roster-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 15px;
}
.roster-name > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
  background: var(--player-color);
  flex-shrink: 0;
  transform: rotate(-8deg);
}
.roster-row small {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.roster-row.out {
  opacity: 0.4;
  text-decoration: line-through;
}
.roster-row .remove-bot {
  border: 0;
  background: none;
  font-size: 18px;
  color: var(--muted);
}
.lobby-actions {
  margin-top: 20px;
}
.small-note {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  margin-top: 16px;
}
.player-stats {
  display: flex;
  justify-content: space-between;
  margin: 24px 0;
  padding: 13px 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-size: 15px;
}
.round-result {
  margin: 20px 0;
  padding: 18px;
  background: #ecd04721;
  border: 1px dashed var(--gold);
}
.round-result h3 {
  font: 26px var(--hand);
  margin-bottom: 10px;
}
.round-result p {
  font-size: 14px;
  line-height: 1.6;
}
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) rotate(-1deg);
  padding: 12px 24px;
  background: var(--ink);
  color: white;
  border-radius: 4px;
  font-size: 14px;
  z-index: 20;
  max-width: 90vw;
  text-align: center;
}
.touch-controls {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 46px);
  grid-template-rows: repeat(2, 42px);
  gap: 5px;
}
.dpad button {
  font-size: 24px;
  background: #fff7;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  touch-action: none;
  user-select: none;
}
.dpad button[data-dir="up"] {
  grid-column: 2;
}
.dpad button[data-dir="left"] {
  grid-column: 1;
  grid-row: 2;
}
.dpad button[data-dir="down"] {
  grid-column: 2;
  grid-row: 2;
}
.dpad button[data-dir="right"] {
  grid-column: 3;
  grid-row: 2;
}
.bomb-button {
  height: 78px;
  width: 78px;
  background: var(--red);
  color: var(--paper);
  border: 0;
  border-radius: 50% 46% 49% 47%;
  font: 30px var(--hand);
  box-shadow: 4px 4px 0 #df3d4f25;
  touch-action: none;
}
.bomb-button small {
  display: block;
  font: 11px var(--body);
  letter-spacing: 2px;
}
footer {
  max-width: 1600px;
  margin: auto;
  padding: 26px 42px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 1px;
}
footer span {
  margin: 0 12px;
}
@media (min-width: 1500px) {
  .workspace {
    gap: 60px;
    grid-template-columns: 300px minmax(0, 1fr);
  }
}
@media (max-width: 1050px) {
  .workspace {
    padding: 24px;
    gap: 24px;
    grid-template-columns: 245px minmax(0, 1fr);
  }
  .masthead {
    padding: 20px 24px;
  }
  .arena-frame {
    min-height: 350px;
    max-height: none;
  }
  h1 {
    font-size: 56px;
  }
  .arena-top > div {
    gap: 12px;
  }
  .arena-bottom {
    flex-direction: column;
    gap: 6px;
  }
  #alive-count {
    display: none;
  }
}
@media (max-width: 760px) {
  .masthead {
    height: 72px;
    padding: 16px;
  }
  .wordmark {
    font-size: 24px;
  }
  .wordmark span {
    display: none;
  }
  .header-actions {
    gap: 12px;
  }
  .connection {
    font-size: 12px;
  }
  .icon-button span {
    display: none;
  }
  .workspace {
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    gap: 20px;
  }
  .sidebar {
    padding-top: 0;
    display: contents;
  }
  .panel {
    order: 2;
  }
  .home-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
  }
  .home-panel .eyebrow,
  .home-panel .intro,
  .home-panel h1,
  .home-panel .status,
  .home-panel .or-line {
    grid-column: 1/-1;
  }
  .home-panel h1 {
    font-size: 42px;
    margin: 4px 0;
  }
  .home-panel h1 br {
    display: none;
  }
  .home-panel .title-star {
    font-size: 32px;
    right: 20px;
  }
  .home-panel .intro {
    font-size: 14px;
    margin: 0 0 5px;
  }
  .home-panel .field-label {
    align-self: center;
    margin: 0;
  }
  .home-panel > .primary {
    grid-column: 1/-1;
    margin-top: 2px;
  }
  .join-row {
    grid-column: 1/-1;
    margin: 0;
  }
  .practice {
    grid-column: 1/-1;
  }
  .or-line {
    margin: 3px 0;
  }
  .howto {
    order: 3;
  }
  .arena-section {
    order: 1;
  }
  .arena-top {
    height: 30px;
    margin-bottom: 8px;
  }
  .arena-frame {
    min-height: 0;
    aspect-ratio: 1.1;
  }
  .arena-bottom {
    display: none;
  }
  .panel h2 {
    font-size: 30px;
    margin: 10px 0;
  }
  .roster {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
  }
  .player-stats {
    margin: 12px 0;
  }
  .room-ticket {
    margin: 12px 0;
  }
  .room-ticket strong {
    font-size: 32px;
  }
  footer {
    padding: 12px 16px;
  }
  .touch-controls {
    display: flex;
  }
  body[data-mode="home"] .touch-controls,
  body[data-mode="lobby"] .touch-controls {
    display: none;
  }
  .home-panel .eyebrow {
    display: none;
  }
  .arena-message {
    font-size: 24px;
  }
  .countdown {
    font-size: 72px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* A match takes over the viewport; the home/lobby keep their notebook layout. */
body[data-mode="game"] {
  height: 100dvh;
  overflow: hidden;
}
body[data-mode="game"] .masthead {
  height: 42px;
  max-width: none;
  padding: 5px 16px;
}
body[data-mode="game"] .wordmark {
  font-size: 21px;
}
body[data-mode="game"] .wordmark span {
  font-size: 11px;
}
body[data-mode="game"] .icon-button {
  padding: 2px 9px;
  font-size: 18px;
}
body[data-mode="game"] .workspace {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: calc(100dvh - 42px);
  padding: 8px 12px 12px;
  gap: 8px;
}
body[data-mode="game"] .sidebar {
  display: contents;
}
body[data-mode="game"] .howto,
body[data-mode="game"] footer {
  display: none;
}
body[data-mode="game"] #game-panel {
  order: 0;
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr) 194px;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
}
.match-heading .eyebrow {
  font-size: 11px;
  letter-spacing: 1px;
}
#game-panel .match-heading h2 {
  font-size: 23px;
  margin: 3px 0 0;
}
body[data-player-state="out"] #game-title {
  color: var(--red);
}
body[data-mode="game"] #game-roster {
  display: flex;
  flex-direction: row;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 2px;
}
#game-roster .roster-row {
  flex: 1 0 86px;
  max-width: 150px;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff9;
}
#game-roster .roster-name {
  max-width: 100%;
  font-size: 13px;
  gap: 6px;
}
#game-roster .life-status {
  font-size: 11px;
}
#game-roster .self {
  border: 2px solid var(--ink);
  padding: 6px 8px;
}
#game-roster .self .roster-name small {
  color: var(--ink);
  font-weight: 800;
}
#game-roster .out {
  opacity: 1;
  background: #8a8b9820;
  text-decoration: none;
}
#game-roster .out .roster-name {
  color: #71717c;
  text-decoration: line-through;
}
#game-roster .out .life-status {
  color: #b32b3c;
  font-weight: 750;
}
body[data-mode="game"] .player-stats {
  border: 0;
  padding: 0;
  margin: 0;
  gap: 8px;
  font-size: 12px;
}
.match-actions {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
}
.match-actions .text-button {
  font-size: 11px;
  padding: 6px 0 0;
}
body[data-mode="game"] .arena-section {
  order: 1;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}
body[data-mode="game"] .arena-top {
  flex: 0 0 26px;
  height: 26px;
  margin: 0 3px 5px;
  font-size: 12px;
}
body[data-mode="game"] #alive-count {
  display: inline;
}
body[data-mode="game"] #timer {
  font-size: 23px;
}
body[data-mode="game"] .arena-frame {
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  box-shadow: none;
}
body[data-mode="game"] .arena-bottom,
body[data-mode="game"] .paper-label {
  display: none;
}
body[data-mode="game"] .round-result {
  position: fixed;
  z-index: 20;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-1deg);
  width: min(380px, calc(100vw - 36px));
  max-height: 75dvh;
  overflow: auto;
  padding: 26px;
  margin: 0;
  background: #fffdf4;
  border: 2px solid var(--ink);
  box-shadow: 7px 8px 0 #2334ab30;
  text-align: center;
}
body[data-mode="game"] .round-result h3 {
  font-size: 30px;
}
body[data-mode="game"] .countdown {
  inset: 12px auto auto 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 10px 20px;
  z-index: 5;
  background: #fffdf4ee;
  border: 2px solid var(--red);
  border-radius: 8px;
  font: 700 19px var(--body);
  text-shadow: none;
  text-align: center;
}
.player-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}
.player-label {
  position: absolute;
  transform: translate(-50%, -100%);
  margin-top: -6px;
  padding: 2px 7px;
  border: 1.5px solid var(--player-color);
  border-radius: 4px;
  background: #fffdf4ee;
  color: #343952;
  font: 600 11px var(--body);
  line-height: 1.4;
  white-space: nowrap;
  max-width: 140px;
  text-overflow: ellipsis;
  overflow: hidden;
  box-shadow: 0 2px 0 #25283815;
}
.player-label.is-you {
  background: var(--player-color);
  color: white;
  font-size: 14px;
  font-weight: 800;
  border: 2px solid white;
  outline: 2px solid var(--player-color);
  overflow: visible;
  max-width: none;
  z-index: 2;
}
.player-label.is-you::after {
  content: "";
  position: absolute;
  top: 100%;
  left: calc(50% - 5px);
  border: 5px solid transparent;
  border-top: 7px solid var(--player-color);
}
.player-label.locating {
  animation: locate-player 0.8s ease-in-out infinite alternate;
}
@keyframes locate-player {
  from {
    transform: translate(-50%, -100%) scale(1);
    box-shadow: 0 0 0 4px #fff8;
  }
  to {
    transform: translate(-50%, calc(-100% - 9px)) scale(1.07);
    box-shadow: 0 0 0 9px #fff3;
  }
}
.player-label.is-dead {
  background: #b52d40;
  border-color: white;
  color: white;
  font-size: 13px;
  font-weight: 800;
  z-index: 4;
}
.elimination-feed {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(290px, 46%);
  pointer-events: none;
}
.elimination-entry {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  background: #fffdf4ee;
  border-left: 3px solid var(--red);
  border-radius: 3px;
  font-size: 12px;
  box-shadow: 0 2px 7px #202c6714;
}
.elimination-entry strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.elimination-entry > span {
  color: #b52d40;
  white-space: nowrap;
}
.elimination-entry.own {
  background: #b52d40;
  color: white;
}
.elimination-entry.own > span {
  color: white;
}
.player-notice {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 10px 18px;
  border-radius: 5px;
  color: white;
  background: #b52d40ed;
  font-size: 14px;
  text-align: center;
  max-width: 90%;
  width: max-content;
  pointer-events: none;
}
@media (max-width: 1100px) {
  body[data-mode="game"] #game-panel {
    grid-template-columns: minmax(0, 1fr) 175px;
    gap: 10px;
  }
  body[data-mode="game"] .match-heading {
    display: none;
  }
}
@media (max-width: 760px) {
  body[data-mode="game"] .masthead {
    height: 36px;
    padding: 3px 10px;
  }
  body[data-mode="game"] .workspace {
    height: calc(100dvh - 36px);
    padding: 5px 7px 7px;
    gap: 5px;
  }
  body[data-mode="game"] #game-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  #game-roster .roster-row {
    flex-basis: 82px;
    padding: 4px 6px;
  }
  #game-roster .self {
    padding: 3px 5px;
  }
  .match-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }
  .match-actions .text-button {
    padding: 0;
  }
  body[data-mode="game"] .arena-top {
    flex-basis: 23px;
    height: 23px;
    font-size: 11px;
  }
  body[data-mode="game"] #alive-count {
    font-size: 11px;
  }
  body[data-mode="game"] .countdown {
    font-size: 13px;
    padding: 7px 10px;
    top: 8px;
  }
  .player-label {
    font-size: 9px;
    padding: 1px 4px;
    max-width: 85px;
  }
  .player-label.is-you {
    font-size: 11px;
  }
  .player-label.is-dead {
    font-size: 11px;
  }
  .elimination-feed {
    top: 7px;
    right: 7px;
    max-width: 48%;
    gap: 3px;
  }
  .elimination-entry {
    font-size: 10px;
    padding: 5px 7px;
    gap: 4px;
  }
  .player-notice {
    font-size: 12px;
    bottom: 10px;
    padding: 7px 10px;
  }
  body[data-mode="game"] .touch-controls {
    flex: 0 0 88px;
    padding: 7px 12px 0;
  }
  body[data-mode="game"] .dpad {
    grid-template-columns: repeat(3, 42px);
    grid-template-rows: repeat(2, 34px);
  }
  body[data-mode="game"] .bomb-button {
    height: 67px;
    width: 67px;
  }
}
@media (pointer: coarse) and (min-width: 761px) {
  body[data-mode="game"] .touch-controls {
    display: flex;
    flex: 0 0 86px;
    padding: 6px 18px 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .player-label.locating {
    animation: none;
  }
}

/* Put the match information in the unused wings on wide screens. */
.match-players {
  display: contents;
}
.match-clock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.match-section-label,
.match-hint {
  display: none;
}
body[data-mode="game"] .arena-top {
  display: none;
}
@media (max-width: 760px) {
  body[data-mode="game"] .match-tools {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 3px 8px;
  }
  .match-clock {
    margin: 0;
  }
  body[data-mode="game"] #timer {
    font-size: 18px;
    letter-spacing: 0;
  }
  body[data-mode="game"] .player-stats {
    justify-content: flex-end;
    gap: 6px;
    font-size: 11px;
  }
  .match-actions {
    grid-column: 1 / -1;
  }
}
@media (min-width: 1100px) and (min-aspect-ratio: 3/2) {
  body[data-mode="game"] {
    --match-rail: clamp(124px, calc(50vw - 58.6dvh - 8px), 220px);
  }
  body[data-mode="game"] .masthead {
    display: contents;
  }
  body[data-mode="game"] .wordmark {
    position: fixed;
    z-index: 7;
    top: 15px;
    left: 16px;
    width: calc(var(--match-rail) - 16px);
    white-space: normal;
    font-size: 18px;
    line-height: 1.1;
  }
  body[data-mode="game"] .wordmark span {
    display: none;
  }
  body[data-mode="game"] .header-actions {
    position: fixed;
    z-index: 7;
    right: 16px;
    top: 14px;
    width: calc(var(--match-rail) - 16px);
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  body[data-mode="game"] .connection {
    font-size: 12px;
  }
  body[data-mode="game"] .icon-button {
    font-size: 15px;
  }
  body[data-mode="game"] .workspace {
    display: grid;
    grid-template-columns: var(--match-rail) minmax(0, 1fr) var(--match-rail);
    grid-template-rows: minmax(0, 1fr);
    height: 100dvh;
    padding: 8px;
    gap: 12px;
  }
  body[data-mode="game"] #game-panel {
    display: contents;
  }
  body[data-mode="game"] .match-players {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 56px 4px 0;
    gap: 16px;
  }
  body[data-mode="game"] .match-heading {
    display: block;
    padding: 0 4px;
  }
  body[data-mode="game"] #game-roster {
    flex-direction: column;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
  }
  body[data-mode="game"] #game-roster .roster-row {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    padding: 9px 8px;
  }
  body[data-mode="game"] #game-roster .self {
    padding: 8px 7px;
  }
  body[data-mode="game"] .arena-section {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }
  body[data-mode="game"] .match-tools {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 84px 8px 8px;
    gap: 12px;
  }
  body[data-mode="game"] .match-clock {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
  }
  body[data-mode="game"] #timer {
    font-size: 36px;
    font-variant-numeric: tabular-nums;
  }
  body[data-mode="game"] #alive-count {
    font-size: 12px;
  }
  body[data-mode="game"] .match-section-label {
    display: block;
    font-size: 11px;
    color: var(--muted);
  }
  body[data-mode="game"] .player-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px 14px;
    font-size: 13px;
  }
  body[data-mode="game"] .match-hint {
    display: block;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    line-height: 2.2;
  }
  body[data-mode="game"] .match-hint kbd {
    padding: 1px 3px;
    font-size: 10px;
  }
  body[data-mode="game"] .match-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  body[data-mode="game"] .elimination-feed {
    position: fixed;
    top: 290px;
    right: 16px;
    width: calc(var(--match-rail) - 16px);
    max-width: none;
    max-height: max(0px, calc(100dvh - 500px));
    overflow: hidden;
  }
  body[data-mode="game"] .elimination-entry {
    flex-wrap: wrap;
    gap: 2px 6px;
    padding: 7px;
    font-size: 11px;
  }
  body[data-mode="game"] .player-notice {
    position: fixed;
    right: 16px;
    bottom: 160px;
    left: auto;
    transform: none;
    width: calc(var(--match-rail) - 16px);
    max-width: none;
    font-size: 12px;
    padding: 10px;
  }
}

/* The landing page is a map chooser, not an idle match. */
body[data-mode="home"] .masthead {
  height: 70px;
  padding-top: 14px;
  padding-bottom: 14px;
}
body[data-mode="home"] .workspace {
  padding-top: 24px;
}
body[data-mode="home"] .home-panel {
  display: block;
  padding: 22px;
  background: #fffaf0cc;
  border: 2px solid var(--ink);
  border-radius: 8px 16px 6px 10px;
  box-shadow: 5px 6px 0 #2334ab12;
}
body[data-mode="home"] h1 {
  font-size: 43px;
  margin: 12px 0;
}
body[data-mode="home"] .intro {
  font-size: 13px;
  margin-bottom: 18px;
}
body[data-mode="home"] .eyebrow {
  font-size: 11px;
  letter-spacing: 1px;
}
.start-guide {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.start-guide strong {
  font-size: 20px;
}
.start-guide span,
.selected-map {
  font-size: 12px;
  color: var(--muted);
}
.selected-map {
  margin: 12px 0;
}
.selected-map strong {
  color: var(--ink);
}
.selected-map a {
  display: inline-block;
  margin-left: 8px;
  border-bottom: 1px solid currentColor;
  color: var(--ink);
}
#home-panel #practice {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin: 0 0 12px;
  font-size: 22px;
  padding: 13px 16px;
}
#home-panel #create-room {
  margin-top: 0;
}
.join-label {
  margin: 18px 0 0;
  font-size: 12px;
}
#home-panel .join-row {
  margin-top: 6px;
}
.map-picker {
  margin-bottom: 16px;
}
.map-picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.map-picker-heading h2 {
  font: 700 29px var(--hand);
}
.map-picker-heading > span,
#map-picker-hint,
#map-description {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
#map-picker-hint {
  margin: 6px 0 12px;
}
#map-description {
  margin-top: 10px;
}
.map-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.map-option {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 10px;
  color: var(--ink);
  background: #fffc;
  border: 2px solid var(--line);
  border-radius: 6px 9px 5px 8px;
  min-width: 0;
}
.map-option svg {
  width: 55px;
  flex: 0 0 55px;
  background: var(--paper);
}
.map-option > span {
  font-size: 14px;
  font-weight: 700;
}
.map-option small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 4px;
}
.map-option[aria-pressed="true"] {
  border-color: var(--ink);
  background: #e9ebfc;
  box-shadow: 2px 3px 0 #2334ab20;
}
.map-option[aria-pressed="true"] > span::before {
  content: "✓ ";
}
.map-option:disabled {
  opacity: 1;
  cursor: default;
}
body:not([data-mode="game"]) .arena-frame {
  height: clamp(280px, 49dvh, 560px);
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
}
body:not([data-mode="game"]) #arena {
  pointer-events: none;
}
body:not([data-mode="game"]) .arena-top {
  height: auto;
  min-height: 25px;
  font-size: 12px;
  margin-bottom: 7px;
}
.preview-notice {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  z-index: 5;
  padding: 10px 18px;
  background: #fffdf4f5;
  border: 2px solid var(--ink);
  border-radius: 5px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}
.round-clock {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.round-clock > span {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0;
}
body[data-mode="game"] .countdown {
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 220px;
  padding: 20px 14px 14px;
  background: #fffdf4f5;
  box-shadow: 5px 7px 0 #2334ab26;
}
.countdown-title {
  font: 700 18px var(--body);
  letter-spacing: 2px;
}
#countdown-number {
  font: 800 88px/1.1 var(--body);
  color: var(--red);
  font-variant-numeric: tabular-nums;
}
.countdown-unit {
  font: 500 12px var(--body);
  color: var(--muted);
}
.countdown p {
  font: 500 12px/1.7 var(--body);
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}
@media (min-width: 900px) {
  body[data-mode="home"] .workspace {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 30px;
    padding-left: 28px;
    padding-right: 28px;
  }
  body[data-mode="home"] .sidebar {
    padding-top: 0;
  }
}
@media (min-width: 1350px) {
  .map-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .map-option {
    gap: 8px;
  }
  .map-option svg {
    width: 40px;
    flex-basis: 40px;
  }
}
@media (max-width: 760px) {
  body[data-mode="home"] .home-panel {
    order: 0;
    padding: 18px;
  }
  body[data-mode="home"] h1 {
    font-size: 35px;
  }
  body[data-mode="home"] h1 br {
    display: none;
  }
  body[data-mode="home"] .title-star {
    display: none;
  }
  body[data-mode="home"] .arena-section {
    order: 1;
  }
  body[data-mode="home"] .howto {
    order: 2;
  }
  body[data-mode="game"] .countdown {
    width: 190px;
    padding: 13px 10px;
  }
  #countdown-number {
    font-size: 64px;
  }
}
@media (max-width: 480px) {
  .map-option {
    gap: 7px;
    padding: 8px;
  }
  .map-option svg {
    flex-basis: 32px;
    width: 32px;
  }
  .map-option > span {
    font-size: 12px;
  }
}

.practice-settings {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff9;
  font-size: 13px;
}
.practice-settings select {
  min-width: 110px;
  padding: 6px 8px;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 4px;
}
.practice-settings select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
#practice-size {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--muted);
}
