.arena-page {
  color: var(--ink);
  background: var(--paper);
}
.arena {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 260px;
}
.arena-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 58px;
  padding-top: env(safe-area-inset-top);
  padding-inline: clamp(14px, 2.8vw, 44px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.sound-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid #b6c3e2;
  border-radius: 5px;
  color: var(--blue);
  background: var(--paper);
  cursor: pointer;
}
.sound-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.sound-toggle[aria-pressed="true"] .sound-muted,
.sound-toggle[aria-pressed="false"] .sound-waves {
  display: none;
}
.sound-toggle[aria-pressed="false"] {
  color: var(--muted);
}
.arena-bar .brand {
  font-size: 27px;
}
.inline-court .arena {
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
}
.inline-court .arena-bar {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 2;
  padding: 0;
  height: auto;
  min-height: 0;
  gap: 5px;
  background: transparent;
  border: 0;
}
.inline-court .difficulty span {
  display: none;
}
.inline-court .difficulty select {
  min-height: 44px;
  font-size: 12px;
  padding: 2px 5px;
}
.inline-court .scorebug {
  left: 8px;
  top: 8px;
  transform: none;
}
.inline-court .score-row {
  gap: 4px;
  padding: 3px 6px;
}
.inline-court .score-row b {
  font-size: 20px;
}
.inline-court .score-name {
  font-size: 11px;
}
.inline-court .move-hint {
  bottom: 6px;
  max-width: 100%;
  font-size: 11px;
}
.exit,
.difficulty,
.invite-actions,
.join-row,
.desktop-guide {
  display: flex;
  align-items: center;
}
.exit {
  margin-left: auto;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  padding: 10px 0;
  min-height: 44px;
}
.exit:hover {
  color: var(--blue);
}
.difficulty {
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}
.difficulty select {
  color: var(--blue);
  font:
    650 13px DM,
    Arial,
    sans-serif;
  background: var(--paper);
  border: 1px solid #b6c3e2;
  border-radius: 5px;
  min-height: 44px;
  padding: 4px 8px;
  cursor: pointer;
}
.difficulty select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.difficulty + .exit {
  margin-left: 0;
}
.arena-stage {
  min-height: 0;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: #dce7fb;
}
.environment {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    url("/art/court-lines.svg") center / 100% 100% no-repeat,
    radial-gradient(ellipse at 50% 36%, #f4f7ff 0%, #dce7fb 52%, #c2d3f4 100%);
}
#match,
#match canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#match canvas {
  display: block;
  touch-action: none;
  cursor: crosshair;
  outline-offset: -3px;
}
#match canvas:focus:not(:focus-visible) {
  outline: none;
}
.scorebug {
  position: absolute;
  top: clamp(12px, 3vh, 28px);
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #b6c8e7;
  border-radius: 6px;
  box-shadow: 0 2px 5px #253a6912;
}
.score-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
}
.score-name {
  font-size: 13px;
  font-weight: 650;
}
.score-name.yours {
  color: #a13e28;
}
.score-name.opponent {
  color: var(--blue);
}
.score-row b,
.score-divider {
  font: var(--sport);
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  line-height: 1;
  text-align: center;
}
.score-divider {
  color: #8a94a9;
  font-size: 17px;
}
.match-event {
  position: absolute;
  top: clamp(66px, 11%, 92px);
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 6px;
  pointer-events: none;
  white-space: nowrap;
}
#game-message:not(:empty) {
  color: #223c74;
  font: var(--sport);
  font-size: clamp(19px, 2vw, 27px);
  text-transform: uppercase;
}
#again {
  pointer-events: auto;
}
.move-hint {
  position: absolute;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  border-radius: 4px;
  background: #fbfbf7dc;
  color: #344366;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}
.desktop-guide {
  gap: 4px;
}
kbd {
  font:
    650 12px/1 DM,
    Arial,
    sans-serif;
  padding: 2px 4px;
  border: 1px solid #b6c3da;
  border-radius: 3px;
}
.touch-guide,
.arena:not([data-view="match"]) .move-hint {
  display: none;
}
.arena[data-view="match"] .room-content {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  pointer-events: none;
}
.arena:not([data-view="match"]) .arena-stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  padding: clamp(24px, 16vw, 260px);
}
.room-content {
  max-width: 490px;
}
.room-content h1 {
  font: var(--sport);
  font-size: clamp(44px, 5.2vw, 82px);
  margin: 0 0 18px;
}
.room-content p {
  color: #354769;
  margin: 0 0 14px;
}
.arena-primary,
.arena-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 5px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 750;
  min-height: 44px;
}
.arena-primary {
  background: var(--blue);
  color: white;
  border: 1px solid var(--blue);
}
.arena-outline {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #a5b7d7;
}
.arena button:hover:enabled {
  filter: brightness(0.94);
}
#join-form {
  margin-top: 24px;
}
#join-form label {
  display: block;
  font-weight: 650;
  margin-bottom: 6px;
}
.join-row,
.invite-actions {
  gap: 8px;
}
#room-code {
  width: 154px;
  padding: 10px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #a5b7d7;
  text-transform: uppercase;
}
#invite-code {
  display: block;
  color: var(--blue);
  font: 700 36px/1.3 monospace;
  letter-spacing: 0.14em;
  margin: 12px 0;
}
#invite-link {
  display: block;
  width: min(100%, 28rem);
  margin-top: 10px;
  padding: 8px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #a5b7d7;
}
#status:not(:empty) {
  max-width: 480px;
  margin-top: 12px;
  overflow-wrap: anywhere;
}
.arena[data-view="match"] #status:not(:empty) {
  position: absolute;
  left: 50%;
  bottom: 15px;
  transform: translateX(-50%);
  background: var(--paper);
  padding: 6px 11px;
  border-radius: 4px;
  text-align: center;
}
@media (pointer: coarse) {
  .desktop-guide {
    display: none;
  }
  .touch-guide {
    display: inline;
  }
}
@media (max-width: 650px) {
  .arena-bar {
    min-height: 54px;
    gap: 8px;
    padding-inline: max(10px, env(safe-area-inset-left));
  }
  .arena-bar .brand {
    font-size: 23px;
  }
  .arena-bar .brand img {
    width: 26px;
    height: 26px;
  }
  .difficulty span {
    display: none;
  }
  .exit {
    font-size: 12px;
    min-width: 44px;
    justify-content: center;
  }
  .arena:not([data-view="match"]) .arena-stage {
    padding: 24px;
  }
}
@media (max-width: 440px) {
  .arena-bar .brand > span,
  .exit > span {
    display: none;
  }
  .arena-bar .brand {
    width: 36px;
    min-height: 44px;
    justify-content: center;
  }
  .inline-court .score-name {
    font-size: 10px;
  }
  .inline-court .score-row {
    min-height: 44px;
  }
  .invite-actions {
    flex-wrap: wrap;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .arena-bar {
    min-height: 48px;
  }
  .difficulty select {
    min-height: 44px;
  }
  .scorebug {
    top: 8px;
  }
  .score-row {
    padding: 3px 8px;
    gap: 4px;
  }
  .score-row b {
    font-size: 21px;
  }
  .score-name {
    font-size: 12px;
  }
  .match-event {
    top: 39px;
  }
  .move-hint {
    bottom: 7px;
  }
  .room-content h1 {
    font-size: 35px;
    margin-bottom: 5px;
  }
  #join-form {
    margin-top: 10px;
  }
  .arena:not([data-view="match"]) .arena-stage {
    padding: 10px 12vw;
  }
}
