:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #0b111a;
  color: #edf3fa;
}

body {
  margin: 0;
}

main {
  width: min(60rem, calc(100% - 3rem));
  margin: clamp(1.75rem, 7vw, 4.5rem) auto;
}

main.match-layout {
  width: 100%;
  margin: 0;
}

.match-layout header,
.match-layout #source-version,
.match-layout:has(#viewport[data-playable="true"]) #engine-status {
  display: none;
}

.match-layout #engine-status {
  position: fixed;
  inset-inline: 1rem;
  inset-block-start: 1rem;
  margin: 0;
  text-align: center;
}

header {
  margin-bottom: 1.5rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.5rem);
  letter-spacing: -0.045em;
  line-height: 1.05;
}

p {
  margin: 0.6rem 0 0;
  color: #b3c2d4;
  line-height: 1.5;
}

#viewport {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #070b11;
  border-radius: 0.5rem;
  outline: 1px solid #344253;
}

main:not(.match-layout) #viewport:focus-visible {
  outline: 2px solid #69dac4;
  outline-offset: 4px;
}

.match-layout #game-screen,
#game-screen:fullscreen {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #000;
}

.match-layout #viewport,
#game-screen:fullscreen #viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  outline: none;
}

.match-layout #game-overlay {
  position: absolute;
  inset-inline: 0.75rem;
  inset-block-end: 0.75rem;
  width: fit-content;
  max-width: calc(100% - 1.5rem);
  margin-inline: auto;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  background: rgb(11 17 26 / 92%);
}

.match-layout #game-overlay:has(#status[data-state="loading"]) {
  inset-block: 50% auto;
  transform: translateY(-50%);
}

.match-layout #viewport[data-aiming="true"] + #game-overlay:has(#status[data-state="ready"]) {
  visibility: hidden;
}

.match-layout #game-overlay #status {
  margin: 0;
}

#controls:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.75rem;
}

#controls p {
  flex: 1 1 24rem;
  margin: 0;
}

#controls button {
  border: 1px solid #42536a;
  border-radius: 0.375rem;
  padding: 0.375rem 0.75rem;
  color: #edf3fa;
  background: #182434;
  font: inherit;
  cursor: pointer;
}

#controls button[aria-pressed="true"] {
  border-color: #76dfca;
}

#controls button:disabled {
  cursor: default;
  opacity: 0.65;
}

#match-sign-in h2 {
  margin: 0.5rem 0;
  color: #edf3fa;
}

#match-sign-in a {
  display: inline-block;
  margin-bottom: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  color: #07111a;
  background: #76dfca;
  text-decoration: none;
  font-weight: 600;
}

#match-profile:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-wrap: anywhere;
}

#match-profile img,
#match-players img {
  border-radius: 50%;
  object-fit: cover;
}

#match-players {
  margin-top: 0.5rem;
}

#match-players summary {
  cursor: pointer;
}

#match-players ul {
  display: grid;
  gap: 0.375rem;
  max-height: 30dvh;
  margin: 0.5rem 0 0;
  padding: 0;
  overflow-y: auto;
}

#match-players li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#status {
  margin-top: 1rem;
}

#status[data-state="ready"] {
  color: #76dfca;
}

#status[data-state="error"],
#status[data-state="warning"] {
  color: #ffba98;
}
