* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: #8fd3ff;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  overflow-x: hidden;
}

#gameWrap {
  position: relative;
  width: 100%;
  max-width: 1280px;
  height: 820px;
  margin: 0 auto;
  overflow: hidden;
  background: #8fd3ff;
  border-left: 4px solid #004e95;
  border-right: 4px solid #004e95;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #004e95 0%, #004e95 56%, #ffffff 56%, #ffffff 100%);
  color: #ffffff;
  text-align: center;
  padding: 20px;
}

.hidden {
  display: none !important;
}

.logo {
  width: 150px;
  max-width: 34vw;
  margin-bottom: 12px;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.28));
}

h1 {
  background: #004e95;
  border: 4px solid #ffffff;
  border-radius: 24px;
  padding: 14px 26px;
  margin: 10px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
}

h2,
p {
  background: rgba(0,78,149,.92);
  color: #ffffff;
  border-radius: 16px;
  padding: 10px 18px;
  max-width: 820px;
  margin: 8px;
}

.small {
  font-size: 15px;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

button,
select {
  background: #004e95;
  color: #ffffff;
  border: 3px solid #ffffff;
  border-radius: 15px;
  padding: 10px 18px;
  margin: 5px;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
}

button:hover,
select:hover {
  filter: brightness(1.12);
}

#hud {
  position: absolute;
  z-index: 20;
  top: 10px;
  left: 10px;
  right: 145px;
  display: none;
  flex-wrap: wrap;
  gap: 7px;
}

#hud span {
  background: #ffffff;
  color: #004e95;
  border: 3px solid #004e95;
  border-radius: 13px;
  padding: 7px 10px;
  font-weight: bold;
}

#menu {
  position: absolute;
  z-index: 30;
  top: 10px;
  right: 10px;
  width: 130px;
  display: none;
}

#menuButton {
  width: 100%;
  margin: 0;
  padding: 8px;
  font-size: 14px;
  box-shadow: 0 4px 0 rgba(0,0,0,.18);
}

#menuPanel {
  display: none;
  margin-top: 7px;
  background: rgba(255,255,255,.97);
  border: 3px solid #004e95;
  border-radius: 15px;
  padding: 9px;
  box-shadow: 0 8px 20px rgba(0,0,0,.22);
}

#menu.open #menuPanel {
  display: block;
}

#menuPanel label {
  display: block;
  color: #004e95;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 5px;
}

#menuPanel select,
#menuPanel button {
  width: 100%;
  margin: 4px 0;
  padding: 7px;
  min-height: 36px;
  font-size: 13px;
  border-radius: 11px;
}

#winScreen,
#gameOverScreen {
  background: rgba(0,78,149,.94);
}

.big {
  font-size: 110px;
}

@media (max-width: 768px) {
  #gameWrap {
    height: 700px;
    border-left: 0;
    border-right: 0;
  }

  #hud {
    top: 52px;
    right: 8px;
    transform: scale(.86);
    transform-origin: top left;
  }

  #menu {
    width: 120px;
  }

  .screen {
    padding-bottom: 80px;
  }

  .buttons button {
    width: calc(50% - 12px);
  }
}

@media (max-width: 480px) {
  #gameWrap {
    height: 640px;
  }

  .logo {
    width: 95px;
  }

  h1 {
    font-size: 24px;
  }

  p {
    font-size: 14px;
  }

  .buttons button {
    width: 100%;
    max-width: 240px;
  }
}
