:root {
  color-scheme: dark;
  background: #050505;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #050505;
}

body {
  display: grid;
  place-items: center;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  font-family: monospace;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  position: relative;
  width: min(100vw, 56.25dvh);
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #000;
  box-shadow:
    0 0 0 2px #1d1d1d,
    0 0 0 5px #080808,
    0 18px 48px rgb(0 0 0 / 65%);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  outline: none;
  cursor: pointer;
  touch-action: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

canvas:focus-visible {
  box-shadow: inset 0 0 0 3px #ff9f00;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-aspect-ratio: 9 / 16) {
  .game-shell {
    width: 100%;
    height: auto;
  }
}

.initials-panel {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 10%;
  background: rgb(0 0 0 / 52%);
  touch-action: manipulation;
}

.initials-panel[hidden] {
  display: none;
}

.initials-card {
  width: 100%;
  max-width: 390px;
  padding: 8% 7% 7%;
  text-align: center;
  color: #f4f4f4;
  background: #080808;
  border: 4px solid #858585;
  box-shadow:
    inset 0 0 0 4px #1d1d1d,
    inset 0 0 0 8px #030303,
    0 10px 0 #020202;
}

.initials-card p,
.initials-card label {
  margin: 0;
  font-family: "Courier New", monospace;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.initials-kicker {
  font-size: clamp(15px, 4.1vw, 23px);
  color: #fff06a;
  text-shadow: 2px 2px #5a0b00;
}

.initials-score-label {
  margin-top: 5% !important;
  font-size: clamp(14px, 3.6vw, 20px);
  color: #ffb52e;
}

.initials-score-label strong {
  color: #ff3c00;
  font-size: 1.35em;
}

.initials-card label {
  display: block;
  margin-top: 8%;
  font-size: clamp(12px, 3.1vw, 17px);
  color: #f2f2f2;
}

#initials-input {
  display: block;
  width: 5.2ch;
  margin: 5% auto 7%;
  padding: 0.18em 0.1em 0.12em;
  border: 4px solid #6e6e6e;
  border-radius: 0;
  outline: none;
  color: #ff3c00;
  background: #020202;
  box-shadow: inset 0 0 0 3px #171717;
  font-family: "Courier New", monospace;
  font-size: clamp(34px, 10vw, 56px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  caret-color: #fff06a;
  user-select: text;
  -webkit-user-select: text;
}

#initials-input:focus {
  border-color: #fff06a;
}

.initials-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4%;
}

.initials-actions button {
  min-height: 44px;
  padding: 0.65em 0.8em;
  border: 3px solid #721302;
  border-radius: 0;
  color: #fff4d6;
  background: #c82e09;
  box-shadow: inset 0 4px #f05213, 0 5px #4d0900;
  font-family: "Courier New", monospace;
  font-size: clamp(11px, 2.8vw, 16px);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

.initials-actions button:last-child {
  color: #d0d0d0;
  background: #292929;
  border-color: #151515;
  box-shadow: inset 0 4px #555, 0 5px #080808;
}

.initials-actions button:active {
  transform: translateY(3px);
  box-shadow: inset 0 2px #f05213, 0 2px #4d0900;
}

.initials-actions button:disabled,
#initials-input:disabled {
  opacity: 0.55;
  cursor: wait;
}

.initials-message {
  min-height: 1.4em;
  margin-top: 7% !important;
  color: #ffb52e;
  font-size: clamp(9px, 2.4vw, 13px);
}

#initials-input::selection {
  color: #020202;
  background: #fff06a;
}
