:root {
  color-scheme: dark;
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #08070b;
  color: #ffe96a;
  touch-action: manipulation;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(255, 232, 76, 0.05) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(rgba(255, 232, 76, 0.05) 1px, transparent 1px) 0 0 / 32px 32px,
    #08070b;
}

button {
  font: inherit;
  border: 0;
  color: #140f05;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  width: min(100%, 460px);
}

.cabinet {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 3px solid #ffe143;
  background: #17110a;
  box-shadow: 0 0 0 4px #4b3510, 0 18px 60px rgba(0, 0, 0, 0.55);
}

.marquee {
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 2px solid #8f650d;
  background: repeating-linear-gradient(90deg, #2b210d 0 10px, #211808 10px 20px);
  color: #fff4a6;
  text-align: center;
  font-weight: 900;
  text-shadow: 2px 2px 0 #b71c20;
}

.screen-wrap {
  position: relative;
  overflow: hidden;
  border: 3px solid #514017;
  background: #050509;
  aspect-ratio: 39 / 70;
  width: 100%;
  max-height: calc(100svh - 148px);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  background: #050509;
}

.hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  color: #fff8b8;
  font-size: 14px;
  font-weight: 900;
  text-shadow: 2px 2px 0 #000;
}

.hit-text {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  background: #d71920;
  border: 3px solid #fff267;
  padding: 8px 12px;
  font-size: 18px;
  font-weight: 900;
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
}

.back-button {
  position: absolute;
  top: 34px;
  right: 8px;
  min-width: 70px;
  min-height: 34px;
  padding: 4px 8px;
  border: 2px solid #fff267;
  border-radius: 0;
  background: #1d1d24;
  color: #fff3b4;
  font-size: 13px;
  font-weight: 900;
  text-shadow: 2px 2px 0 #000;
  box-shadow: 3px 3px 0 #000;
  z-index: 2;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 5, 9, 0.8);
}

.panel {
  width: min(100%, 318px);
  padding: 18px;
  border: 3px solid #ffdf3c;
  background: #171006;
  text-align: center;
  box-shadow: 8px 8px 0 #000;
}

.panel h1,
.panel h2 {
  margin: 0 0 10px;
  color: #ffec5c;
  font-size: 24px;
  line-height: 1.25;
  text-shadow: 2px 2px 0 #b71c20;
}

.panel p {
  margin: 0 0 14px;
  color: #fff3b4;
  line-height: 1.55;
}

.panel .rule-text {
  font-size: 11px;
  line-height: 1.4;
  margin-bottom: 10px;
}

.start-eggmans {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 2px;
  margin: 4px 0 10px;
}

.start-eggmans img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  image-rendering: pixelated;
}

.result-label {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
}

.result-panel {
  padding: 10px;
}

.result-panel h2 {
  margin-bottom: 4px;
  font-size: 19px;
}

.result-panel .result-label {
  margin-bottom: 5px;
  font-size: 14px;
}

.result-image {
  display: block;
  width: min(100%, 132px);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  margin: 4px auto 6px;
  border: 2px solid #5d4714;
  image-rendering: pixelated;
  background: #090806;
}

dl {
  display: grid;
  gap: 5px;
  margin: 8px 0 8px;
}

dl div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 5px 7px;
  border: 2px solid #5d4714;
  background: #090806;
}

.result-panel dl {
  font-size: 12px;
}

.result-panel .primary-button,
.result-panel .secondary-button {
  min-height: 34px;
  margin-top: 5px;
  padding: 5px 8px;
  font-size: 12px;
}

.result-panel .share-status {
  min-height: 14px;
  margin-top: 5px;
  font-size: 10px;
}

dt {
  color: #fff3ad;
}

dd {
  margin: 0;
  color: #fff;
  font-weight: 900;
}

.primary-button,
.secondary-button,
.shoot-button,
.move-button,
.back-button {
  border: 3px solid #4b3510;
  border-radius: 0;
  font-weight: 900;
  box-shadow: 4px 4px 0 #000;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 8px 10px;
}

.primary-button {
  background: #ffe143;
}

.secondary-button {
  background: #ffffff;
}

.share-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: #8fffc1;
  font-size: 12px;
}

.mobile-controls {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 8px;
  min-height: 58px;
}

.move-button,
.shoot-button {
  min-height: 58px;
  background: #ffec5c;
  font-size: 18px;
}

.shoot-button {
  background: #ff3d37;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
}

button:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 #000;
}

[hidden] {
  display: none !important;
}

@media (min-width: 760px) {
  body {
    padding: 18px;
  }

  .mobile-controls {
    display: none;
  }

  .screen-wrap {
    max-height: calc(100svh - 86px);
  }
}

@media (max-width: 360px) {
  .panel h1,
  .panel h2 {
    font-size: 20px;
  }

  .hud {
    font-size: 12px;
  }
}
