:root {
  color-scheme: only light;
  font-family: "Courier New", Courier, monospace;
  background: #111217;
  --ink: #17181c;
  --paper: #fffde0;
  --accent: #f26b2b;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #111217;
  touch-action: none;
  user-select: none;
}

button {
  font: inherit;
}

#app {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #111217;
}

#game {
  display: block;
  width: min(100vw, calc(100vh * 4 / 3));
  height: min(100vh, calc(100vw * 3 / 4));
  background: var(--paper);
  image-rendering: pixelated;
}

.game-menu-button {
  position: absolute;
  z-index: 10;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  min-width: 76px;
  padding: 7px 12px;
  translate: -50% 0;
  border: 3px solid currentColor;
  color: #777;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: rgb(255 255 255 / 78%);
  cursor: pointer;
}

.game-menu-button:active {
  translate: -50% 2px;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vh, 22px);
  color: var(--paper);
  text-align: center;
  background: var(--accent);
}

.screen--visible {
  display: flex;
}

.menu-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(330px, 0.9fr);
  width: min(1120px, 94vw);
  max-height: 94vh;
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
}

.menu-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: clamp(7px, 1.5vh, 15px);
}

.menu-main h1 {
  font-size: clamp(38px, 7vw, 88px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 92vw;
  color: var(--paper);
  font-size: clamp(42px, 10vw, 112px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-shadow: 5px 0 var(--ink), -5px 0 var(--ink), 0 5px var(--ink), 0 -5px var(--ink);
}

h2 {
  font-size: clamp(28px, 6vw, 64px);
  letter-spacing: 0.04em;
}

.tagline,
.instruction {
  font-size: clamp(13px, 2vw, 24px);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.instruction {
  opacity: 0.78;
}

.player-label {
  margin-top: 0.15em;
  font-size: clamp(12px, 1.4vw, 18px);
  font-weight: 900;
  letter-spacing: 0.14em;
}

.player-name {
  width: min(360px, 70vw);
  padding: 0.38em 0.65em;
  border: 4px solid var(--paper);
  border-radius: 0;
  outline: none;
  color: var(--paper);
  font: inherit;
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  background: transparent;
}

.player-name::placeholder {
  color: rgb(255 253 224 / 58%);
}

.player-name:focus {
  color: var(--accent);
  background: var(--paper);
}

.player-error {
  min-height: 1em;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.campaign-picker {
  width: min(360px, 70vw);
}

.campaign-picker label {
  display: block;
  margin-bottom: 5px;
  font-size: clamp(12px, 1.4vw, 18px);
  font-weight: 900;
  letter-spacing: 0.14em;
}

.campaign-select {
  width: 100%;
  padding: 0.38em 0.65em;
  border: 4px solid var(--paper);
  border-radius: 0;
  outline: none;
  color: var(--accent);
  font: inherit;
  font-size: clamp(15px, 2vw, 23px);
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  background: var(--paper);
}

.personal-best {
  font-size: clamp(17px, 2vw, 25px);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.hall-of-fame {
  min-height: 390px;
  padding: clamp(14px, 2.5vw, 26px);
  border: 5px solid var(--paper);
  color: var(--ink);
  text-align: left;
  background: var(--paper);
}

.hall-of-fame h2 {
  color: var(--accent);
  font-size: clamp(24px, 3.4vw, 42px);
  text-align: center;
}

.hall-status {
  padding: 18px 0;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.hall-list {
  margin: 14px 0 0;
  padding-left: 2.4em;
  font-size: clamp(11px, 1.25vw, 16px);
  font-weight: 900;
}

.hall-entry {
  padding: 5px 0 5px 4px;
}

.hall-entry::marker {
  color: var(--accent);
}

.hall-entry-line {
  display: grid;
  grid-template-columns: minmax(85px, 1fr) auto;
  gap: 8px;
}

.hall-entry-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hall-entry-date {
  display: block;
  margin-top: 1px;
  color: #777;
  font-size: 0.78em;
  font-weight: 700;
}

.menu-button {
  min-width: min(360px, 70vw);
  padding: 0.6em 1.1em;
  border: 5px solid var(--paper);
  color: var(--accent);
  font-size: clamp(19px, 3vw, 34px);
  font-weight: 900;
  letter-spacing: 0.08em;
  background: var(--paper);
  cursor: pointer;
}

.menu-button:active {
  translate: 0 3px;
}

.menu-button--secondary {
  color: var(--paper);
  background: transparent;
}

#complete-screen {
  justify-content: space-around;
  padding: clamp(18px, 5vh, 48px) 24px;
  color: var(--accent);
  background: linear-gradient(
    to bottom,
    #fff 0 33%,
    var(--accent) 33% 67%,
    #fff 67% 100%
  );
}

#complete-screen.screen--visible {
  animation: complete-in 420ms steps(7, end);
}

#complete-title {
  color: #fff;
  font-size: clamp(42px, 9vw, 96px);
  line-height: 0.9;
  -webkit-text-stroke: clamp(2px, 0.5vw, 5px) var(--accent);
  paint-order: stroke fill;
  text-shadow: none;
}

#final-score {
  color: #fff;
  font-size: clamp(28px, 5vw, 58px);
  font-weight: 900;
}

#complete-screen .menu-button {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

#new-best-screen {
  z-index: 12;
  color: var(--ink);
  background: var(--paper);
}

#new-best-screen.screen--visible {
  animation: new-best-in 480ms steps(7, end);
}

#new-best-title {
  color: var(--accent);
  font-size: clamp(52px, 12vw, 132px);
  line-height: 0.9;
  text-shadow: 5px 0 var(--ink), -5px 0 var(--ink), 0 5px var(--ink), 0 -5px var(--ink);
}

#new-best-score {
  color: var(--ink);
  font-size: clamp(30px, 6vw, 64px);
  font-weight: 900;
}

#new-best-screen .menu-button {
  color: var(--paper);
  background: var(--accent);
}

@keyframes new-best-in {
  from { opacity: 0; transform: scale(1.16) rotate(-2deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes complete-in {
  from { opacity: 0; transform: scale(1.08); }
  to { opacity: 1; transform: scale(1); }
}

#rotate-screen {
  z-index: 20;
  padding: 24px;
  background: var(--ink);
}

.rotate-icon {
  color: var(--accent);
  font-size: 72px;
  font-weight: 900;
}

@media (orientation: portrait) {
  #rotate-screen {
    display: flex;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .menu-layout {
    grid-template-columns: minmax(290px, 0.9fr) minmax(330px, 1.1fr);
  }

  .menu-main {
    gap: 5px;
  }

  .menu-main h1 {
    font-size: clamp(34px, 6vw, 62px);
  }

  .hall-of-fame {
    min-height: 0;
    padding: 10px 16px;
  }

  .hall-list {
    margin-top: 6px;
    columns: 2;
    column-gap: 28px;
  }

  .hall-entry {
    break-inside: avoid;
    padding: 3px 0 3px 3px;
  }
}
