@font-face {
  font-family: PTSans;
  src: url('/assets/PTSans-Regular.woff') format('woff');
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: PTSans, "Segoe UI", sans-serif;
  color: #fff;
  background: #22101a;
  --blue: #26c6da;
  --orange: #f7941d;
  --green: #8bc34a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #fff4b9;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#arena { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; outline: none; }
#hud { position: fixed; inset: 0; pointer-events: none; }
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  align-items: safe center;
  justify-items: center;
  padding: 16px;
  overflow-y: auto;
  background: #0008;
}
.lobby-overlay { background: transparent; }
.lobby { width: min(100%, 320px); text-align: center; }
.lobby h1 { margin: 0; }
.lobby h1 img, .loading-box img { display: block; width: 100%; height: 60px; object-fit: contain; }
.loading-box { width: min(100%, 320px); text-align: center; }
.edition { height: 40px; display: grid; place-items: center; margin: 0; font-size: 12px; }
.skin-picker {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 50px;
  align-items: center;
  height: 60px;
}
#skin { width: 100%; max-width: 200px; display: block; margin: 0 auto; }
.arrow {
  width: 50px;
  height: 40px;
  border: 0;
  padding: 0;
  color: var(--orange);
  background: transparent;
  font-size: 54px;
  line-height: 32px;
}
.arrow:hover { color: #f9ab4e; }
.match-options {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  margin-top: 20px;
}
.match-options input, .match-options select {
  width: 100%;
  height: 35px;
  border: 0;
  border-radius: 4px;
  padding: 0 7px;
  font-size: 20px;
  text-align: center;
}
#nickname { color: #806102; background: #fff; }
#nickname::placeholder { color: #786a57; }
.match-options select { color: #fff; background-color: var(--blue); text-shadow: 0 0 1px #000; }
.match-actions, .lobby-tools, .result-actions { display: flex; gap: 12px; }
.match-actions { margin-top: 15px; }
.primary, .blue-button, .orange-button, .secondary {
  min-height: 46px;
  padding: 4px 12px;
  border: 0;
  border-radius: 5px;
  color: #fff;
  font-size: 20px;
  text-shadow: 0 0 1px #000;
  box-shadow: 0 1px 2px #0004;
}
.primary { background: var(--green); }
.primary:hover { background: #a4d070; }
.blue-button { background: var(--blue); }
.blue-button:hover { background: #52d1e1; }
.orange-button { background: var(--orange); }
.orange-button:hover { background: #f9ab4e; }
.secondary { background: #45313f; }
.secondary:hover { background: #5d3e55; }
#play { flex: 3; }
#login { flex: 2; }
.controls { min-height: 34px; margin: 12px 0 0; font-size: 14px; display: grid; place-items: center; }
.touch-controls { display: none; }
.local-note { margin: 0 0 12px; color: #ebcbdc; font-size: 13px; }
.local-note strong { color: #fff; font-variant-numeric: tabular-nums; }
.lobby-tools { justify-content: center; gap: 12px; }
.lobby-tools button { flex: 1; }
.profile-strip {
  position: absolute;
  top: 16px;
  left: max(16px, calc((100% - 940px) / 2));
  right: max(16px, calc((100% - 940px) / 2));
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.player-chip {
  border: 0;
  border-radius: 5px;
  color: #fff;
  background: #0003;
  padding: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  text-align: left;
}
.player-chip img { object-fit: contain; border-radius: 4px; }
.player-chip > span { padding-right: 6px; }
#player-level { display: block; font-size: 13px; color: #ffe49c; }

.map-panel { position: absolute; top: 10px; left: 20px; display: flex; align-items: flex-start; gap: 10px; }
#minimap { display: block; width: 80px; height: 80px; margin-top: 10px; }
.effects { display: flex; }
.effects canvas { display: block; width: 40px; height: 40px; }
.leaderboard {
  position: absolute;
  top: 1px;
  right: 5px;
  width: 220px;
  color: #fff;
  font-size: 12px;
  line-height: 12px;
  text-shadow: 0 1px 2px #000;
}
.leader-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-left: 35px;
}
.leader-heading h2 { margin: 0; font: inherit; }
#teams { display: grid; margin-top: 9px; }
#teams div { display: grid; }
#leaders { list-style: none; padding: 0; margin: 9px 0 0; }
#leaders li, #placement, #teams div {
  display: grid;
  grid-template-columns: 30px minmax(0, 100px) 1fr;
  column-gap: 5px;
  align-items: center;
  min-height: 12px;
  font-variant-numeric: tabular-nums;
}
#leaders li span:nth-child(2), #placement span:nth-child(2), #teams div span:nth-child(2) {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
#leaders li span:first-child, #placement span:first-child, #teams div span:first-child,
#leaders li span:last-child, #placement span:last-child, #teams div span:last-child { text-align: right; }
#leaders li.player { margin: 9px 0; }
#placement { margin-top: 9px; }
.pause {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 38px;
  height: 38px;
  border: 1px solid #ffffff38;
  border-radius: 5px;
  background: #0004;
  color: #fff;
  pointer-events: auto;
}
.pause:hover { background: #0008; }
.dialog {
  width: min(100%, 350px);
  padding: 24px;
  border-radius: 8px;
  background: #241522;
  box-shadow: 0 20px 70px #0009;
  text-align: center;
}
.dialog h2 { margin: 0 0 15px; font-size: 28px; }
.dialog > button { width: 100%; }
.dialog > .secondary { margin-top: 10px; }
.result-dialog {
  width: min(100%, 480px);
  padding: 0 15px 15px;
  overflow: hidden;
  color: #2a2528;
  background: #fff;
  color-scheme: light;
}
.result-dialog h2 {
  margin: 0 -15px 15px;
  padding: 8px;
  line-height: 44px;
  color: #fff;
  background: var(--orange);
  font-size: clamp(24px, 5vw, 32px);
  letter-spacing: 1.5px;
}
.result-dialog p { margin: 6px 0; }
#result-score { color: #2d92bd; font-size: 34px; }
#result-placement { color: #b55c00; font-size: 19px; min-height: 26px; }
#result-description { color: #66595b; margin-bottom: 13px; }
.result-actions { margin-top: 10px; }
.result-actions button { flex: 1; border: 1px solid #517ad1; background: #fff; color: #2f53a1; text-shadow: none; }
.result-actions button:hover { background: #eef2fc; }

@media (pointer: coarse) {
  .mouse-controls { display: none; }
  .touch-controls { display: inline; }
}
@media (max-width: 520px) {
  .profile-strip { top: 8px; left: 8px; right: 8px; }
  .lobby-overlay:has(.profile-strip:not([hidden])) { padding-top: 68px; }
  .leaderboard { width: 165px; }
  #leaders li, #placement, #teams div { grid-template-columns: 17px minmax(0, 82px) 1fr; }
  .leader-heading { padding-left: 22px; }
  .map-panel { top: 5px; left: 6px; flex-direction: column; gap: 2px; }
  #minimap { margin-top: 0; width: 72px; height: 72px; }
  .effects { flex-wrap: wrap; max-width: 120px; }
}
