:root {
  color-scheme: dark;
  font-family: "Courier New", monospace;
  background: #0b0915;
  color: #fff8df;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 35%, #292044 0 18%, transparent 46%),
    repeating-linear-gradient(135deg, #0d0a18 0 3px, #100d1d 3px 6px);
}

.cabinet {
  width: min(100vw, 500px);
  height: min(100dvh, 850px);
  padding: 12px 14px max(10px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.screen-frame {
  position: relative;
  max-height: calc(100dvh - 118px);
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border: 5px solid #45385f;
  outline: 3px solid #151124;
  box-shadow: 0 0 0 3px #73618c, 0 12px 35px #000b, inset 0 0 24px #000;
  background: #17152a;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
  cursor: crosshair;
}

.overlay {
  position: absolute;
  inset: 0;
  padding: 44px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(#121024e8, #23193aee);
}

.hidden { display: none !important; }

.logo {
  filter: drop-shadow(4px 5px 0 #090711);
  transform: rotate(-2deg);
  margin-bottom: 4px;
}

.logo span, .logo strong {
  display: block;
  font-weight: 900;
  line-height: .78;
  letter-spacing: -4px;
  text-shadow: 3px 0 #fff8df, -3px 0 #fff8df, 0 3px #fff8df, 0 -3px #fff8df;
}

.logo span { font-size: clamp(36px, 12vw, 60px); color: #ef4f91; }
.logo strong { font-size: clamp(68px, 23vw, 110px); color: #f6c945; }
.tagline { color: #77e6d1; font-weight: bold; letter-spacing: 2px; margin: 20px 0 26px; }

.pixel-button, .control-button {
  font: 700 14px "Courier New", monospace;
  color: #fff8df;
  background: #322747;
  border: 0;
  border-bottom: 5px solid #171122;
  box-shadow: inset 0 0 0 3px #75628b;
  padding: 13px 18px;
  margin: 5px;
  cursor: pointer;
}

.pixel-button:hover, .pixel-button:focus-visible { background: #4b3a66; outline: 3px solid #fff8df; }
.pixel-button:active, .control-button:active { transform: translateY(3px); border-bottom-width: 2px; }
.pixel-button.primary { background: #c43570; box-shadow: inset 0 0 0 3px #ff83b6; min-width: 180px; }

.rules {
  margin-top: 12px;
  padding: 8px 13px;
  text-align: left;
  font-size: 11px;
  line-height: 1.35;
  background: #0c0a16c7;
  border: 2px solid #5b4a70;
}
.rules p { margin: 6px 0; }

.controls { display: flex; justify-content: center; gap: 6px; }
.control-button { margin: 0; padding: 10px 13px; display: flex; align-items: center; gap: 8px; }
.control-button:not(:disabled):hover { background: #4b3a66; }
.control-button:disabled { opacity: .42; cursor: default; }
.control-button .icon { color: #77e6d1; }
.control-button b { color: #f6c945; }
.control-button.sound { min-width: 82px; justify-content: center; }
.hint { text-align: center; font-size: 10px; color: #897c9e; margin: 0; letter-spacing: 1px; }

#result h1 { color: #ef4f91; font-size: 28px; text-shadow: 3px 3px #08060f; }
#resultText { line-height: 1.7; }

@media (max-height: 650px) {
  .cabinet { flex-direction: row; align-items: center; width: min(100vw, 680px); }
  .screen-frame { height: calc(100dvh - 18px); }
  .controls { flex-direction: column; }
  .hint { display: none; }
}

.control-button.selecting {
  background: #5b3d72;
  box-shadow: inset 0 0 0 3px #f6c945;
}
.control-button.selecting .icon,
.control-button.selecting b { color: #fff8df; }
