:root {
  color-scheme: dark;
  --ink: #f8f4d8;
  --field: #246d3a;
  --field-dark: #174729;
  --wall: #d7c073;
  --line: #f7edb0;
  --red: #f04f45;
  --blue: #42a5ff;
  --gold: #ffd75a;
  --shadow: #101820;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    #111924;
  background-size: 18px 18px;
  color: var(--ink);
  font-family: "Courier New", Courier, monospace;
  image-rendering: pixelated;
}

.shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 620px;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

.side-panel {
  position: fixed;
  left: 14px;
  top: 14px;
  z-index: 3;
  width: min(290px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  display: grid;
  gap: 10px;
  overflow: auto;
}

.scorebar,
.controls,
.online {
  border: 4px solid var(--wall);
  background: #182432;
  box-shadow: 0 8px 0 #080c11;
}

.scorebar {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: stretch;
  gap: 12px;
  padding: 10px 16px;
  text-transform: uppercase;
}

.team {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  white-space: nowrap;
}

.team-right {
  justify-content: flex-start;
}

.team-dot {
  width: 18px;
  height: 18px;
  display: inline-block;
  border: 3px solid var(--ink);
}

.team-left .team-dot {
  background: var(--red);
}

.team-right .team-dot {
  background: var(--blue);
}

.score {
  min-width: 0;
  text-align: center;
  color: var(--gold);
  font-size: 52px;
  line-height: 1;
  text-shadow: 4px 4px 0 #6b3d1e;
}

.arena-wrap {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  border: 0;
  background: var(--field-dark);
  box-shadow: none;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--field);
  image-rendering: pixelated;
}

#game.three-source {
  display: none;
}

.three-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #101820;
  image-rendering: auto;
}

.banner {
  position: absolute;
  inset: auto 0 42%;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: var(--gold);
  font-size: clamp(28px, 7vw, 78px);
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 5px 5px 0 #7d352f;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 160ms steps(2, end), transform 160ms steps(2, end);
}

.banner.show {
  opacity: 1;
  transform: translateY(0);
}

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.online {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.online-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

button,
input {
  min-height: 38px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: #101820;
  color: var(--ink);
  font: 700 13px "Courier New", Courier, monospace;
}

button {
  padding: 0 12px;
  cursor: pointer;
  text-transform: uppercase;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  background: #28435d;
  color: var(--gold);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

input {
  min-width: 0;
  padding: 0 10px;
  text-transform: uppercase;
}

.net-status {
  min-height: 18px;
  color: var(--gold);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.controls div {
  min-width: 0;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  border-right: 0;
  border-bottom: 4px solid var(--wall);
}

.controls div:last-child {
  border-bottom: 0;
}

.controls strong {
  color: var(--gold);
  font-size: 15px;
  text-transform: uppercase;
}

.controls span {
  overflow-wrap: anywhere;
  font-size: 13px;
}

@media (max-width: 720px) {
  .shell {
    min-height: 100vh;
    padding: 6px;
    place-items: start center;
  }

  .side-panel {
    position: relative;
    left: auto;
    top: auto;
    order: 2;
    width: min(100%, 420px);
    max-height: none;
    margin-top: 8px;
  }

  .arena-wrap {
    position: relative;
    width: 100%;
    height: 64vh;
    min-height: 420px;
  }

  .scorebar {
    min-height: 58px;
    padding: 8px;
  }

  .team {
    font-size: 12px;
  }

  .score {
    min-width: 108px;
    font-size: 32px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .online-actions {
    grid-template-columns: 1fr;
  }

  .controls div,
  .controls div:last-child {
    border-right: 0;
    border-bottom: 4px solid var(--wall);
  }

  .controls div:last-child {
    border-bottom: 0;
  }
}
