html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #132018;
  color: #f2f7ed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 800;
  color: #102015;
  background: linear-gradient(180deg, #ffe08a, #dcae46);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

button.demo-action {
  color: #09231d;
  background: linear-gradient(180deg, #7ff0c6, #2cb37c);
  border: 1px solid rgba(196, 255, 229, 0.74);
  box-shadow: 0 10px 28px rgba(21, 122, 86, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: #0d1813;
  color: #fff3c4;
  font-size: 18px;
  font-weight: 800;
}

body:not(.is-loading) .loading-screen {
  display: none;
}

body.is-loading #hud,
body.is-loading #screen,
body.is-loading .crosshair,
body.is-loading .draw-gauge,
body.is-loading #message {
  visibility: hidden;
  pointer-events: none;
}

.hud {
  position: fixed;
  inset: 14px 14px auto 14px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hud-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.hud-row.lower {
  justify-content: space-between;
  align-items: center;
}

.hud-panel,
.stealth {
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(19, 36, 31, 0.86), rgba(11, 20, 18, 0.78));
  border: 1px solid rgba(255, 238, 187, 0.18);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.hud-panel {
  min-width: 92px;
  padding: 9px 12px;
}

.label,
.stealth span {
  display: block;
  color: #d8c991;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hud-panel strong {
  display: block;
  margin-top: 2px;
  color: #fff6cf;
  font-size: 18px;
  line-height: 1.1;
  white-space: nowrap;
}

.stealth {
  display: grid;
  grid-template-columns: auto 110px;
  gap: 5px 8px;
  align-items: center;
  padding: 10px 12px;
}

meter {
  width: 110px;
  height: 9px;
}

.crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.crosshair span {
  position: absolute;
  background: rgba(255, 244, 202, 0.9);
  box-shadow: 0 0 8px rgba(36, 21, 8, 0.74);
}

.crosshair span:nth-child(1),
.crosshair span:nth-child(2) {
  width: 10px;
  height: 2px;
  top: 14px;
}

.crosshair span:nth-child(1) {
  left: 0;
}

.crosshair span:nth-child(2) {
  right: 0;
}

.crosshair span:nth-child(3),
.crosshair span:nth-child(4) {
  width: 2px;
  height: 10px;
  left: 14px;
}

.crosshair span:nth-child(3) {
  top: 0;
}

.crosshair span:nth-child(4) {
  bottom: 0;
}

.draw-gauge {
  position: fixed;
  left: 50%;
  bottom: 64px;
  width: min(260px, 52vw);
  height: 8px;
  transform: translateX(-50%);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(16, 28, 24, 0.42);
  pointer-events: none;
}

.draw-gauge > div {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #9fd7ff, #f1d172, #e66a4c);
  box-shadow: 0 0 14px rgba(241, 209, 114, 0.32);
}

@media (max-width: 520px) {
  .draw-gauge {
    bottom: 162px;
    width: min(100px, 56vw);
  }
}

.message {
  position: fixed;
  left: 50%;
  top: 25%;
  transform: translateX(-50%);
  max-width: min(420px, 82vw);
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(22, 31, 24, 0.84);
  border: 1px solid rgba(255, 232, 167, 0.24);
  color: #fff8d6;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
}

.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(20, 39, 31, 0.66), rgba(7, 16, 13, 0.88)),
    linear-gradient(110deg, rgba(108, 144, 98, 0.24), rgba(82, 132, 150, 0.18)),
    #0d1813;
  -webkit-overflow-scrolling: touch;
}

.screen-content {
  width: min(560px, 92vw);
  max-height: calc(100vh - 48px);
  max-height: calc(100svh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  text-align: center;
  -webkit-overflow-scrolling: touch;
}

.screen h1 {
  margin: 0 0 16px;
  max-width: 100%;
  overflow: visible;
  font-size: clamp(30px, 8vw, 72px);
  line-height: 1.08;
  letter-spacing: 0;
  white-space: nowrap;
  color: #fff3c4;
  text-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.screen p {
  margin: 0 auto 18px;
  max-width: 520px;
  color: #dfebd8;
  font-size: 17px;
  line-height: 1.45;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 18px;
}

.controls span {
  padding: 7px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #f4f8ed;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 750;
}

.controls kbd {
  color: #fff3c4;
  font: inherit;
  font-weight: 850;
}

.start-panel {
  margin: 0 auto;
}

.mode-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.start-panel .mode-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(300px, 100%);
  margin: 0 auto;
}

.start-panel .mode-actions button {
  width: 100%;
  min-width: 0;
  border: 0;
  color: #102015;
  background: linear-gradient(180deg, #ffe08a, #dcae46);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
}

.start-panel .mode-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.screen .gameblocks-credit {
  margin: 18px auto 0;
  color: rgba(223, 235, 216, 0.72);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}

.gameblocks-credit a {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .hud {
    inset: 8px 8px auto 8px;
  }

  .hud-panel {
    min-width: 72px;
    padding: 8px 9px;
  }

  .hud-panel strong {
    font-size: 15px;
  }

  .stealth {
    grid-template-columns: auto 90px;
  }

  meter {
    width: 90px;
  }
}
