html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #101319;
  color: #f5f0df;
  font-family: Arial, sans-serif;
  touch-action: none;
}

body .content {
  width: 100vw;
  max-width: none;
  margin: 0;
  padding: 0;
}

.monster-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #141923;
}

#game {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  transform: translate(-50%, -50%);
  image-rendering: auto;
}

.hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(100px, 180px) auto auto auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.home-link,
.screen a,
.screen button,
.mobile-actions button {
  border: 0;
  border-radius: 8px;
  background: #f2c14e;
  color: #17130a;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
}

.home-link {
  padding: 9px 12px;
}

.meter {
  height: 16px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}

.meter span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #36c069, #e1d94e, #e45b47);
  transform-origin: left center;
}

#scoreText,
#objectiveText,
#livesText,
#dayText {
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.46);
  text-shadow: 0 1px 1px #000;
}

.hud-actions { display: flex; gap: 6px; pointer-events: auto; }
.hud-actions button { min-height: 36px; padding: 0 10px; border: 1px solid rgba(255,255,255,.25); border-radius: 7px; background: rgba(0,0,0,.64); color: #fff; font-weight: 700; cursor: pointer; }
.start-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 14px; }
.start-options label { display: grid; gap: 5px; color: #f7e6aa; font-size: 13px; font-weight: 700; }
.start-options select { width: 100%; min-height: 42px; border: 1px solid #76643b; border-radius: 6px; padding: 0 9px; background: #242630; color: #fff; font: inherit; }
.screen .controls-copy { margin: 0 0 14px; font-size: 13px; }

.screen {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: rgba(7, 8, 12, 0.72);
}

.screen.hidden {
  display: none;
}

.screen > div {
  width: calc(100vw - 28px);
  max-width: 460px;
  box-sizing: border-box;
  padding: 22px;
  border: 2px solid rgba(242, 193, 78, 0.65);
  border-radius: 8px;
  background: rgba(18, 20, 27, 0.94);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45);
}

.screen h1,
.screen h2 {
  margin: 6px 0 8px;
  color: #f7e6aa;
  font-size: clamp(28px, 7vw, 48px);
}

.screen p {
  margin: 0 0 18px;
  line-height: 1.45;
  color: #dfd7c2;
}

.screen button,
.screen a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  margin: 4px 8px 0 0;
  padding: 0 18px;
}

.kicker {
  color: #f2c14e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mobile-stick {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 6;
  display: none;
  width: 136px;
  height: 136px;
  touch-action: none;
  pointer-events: auto;
}

.stick-ring,
.stick-knob {
  position: absolute;
  border-radius: 50%;
}

.stick-ring {
  inset: 0;
  border: 3px solid rgba(255, 255, 255, 0.34);
  background: rgba(0, 0, 0, 0.18);
}

.stick-knob {
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  background: rgba(242, 193, 78, 0.82);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.mobile-actions {
  position: absolute;
  right: 16px;
  bottom: 18px;
  z-index: 6;
  display: none;
  grid-template-columns: repeat(2, 76px);
  gap: 10px;
}

.mobile-actions button {
  width: 76px;
  height: 56px;
  padding: 0;
}

.mobile-actions button:nth-child(2) {
  grid-row: auto;
  height: 56px;
}

@media (hover: none) and (pointer: coarse) {
  .mobile-stick,
  .mobile-actions {
    display: grid;
  }

  .hud {
    grid-template-columns: auto minmax(70px, 1fr) auto auto auto;
    right: 8px;
    left: 8px;
    gap: 5px;
  }

  #objectiveText {
    display: none;
  }
  .hud-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 680px) {
  .mobile-stick,
  .mobile-actions { display: grid; }
  .hud { grid-template-columns: auto minmax(70px, 1fr) auto; }
  #livesText, #dayText { grid-row: 2; }
  .hud-actions { grid-column: 3; grid-row: 2; }
  .hud {
    font-size: 13px;
    gap: 7px;
  }

  .home-link {
    padding: 8px 9px;
  }

  #objectiveText {
    display: none;
  }
  #dayText, #livesText { padding: 6px 7px; font-size: 11px; }
}

@media (max-width: 520px) {
  .start-options { grid-template-columns: 1fr; }
  .screen > div { max-height: calc(100vh - 24px); overflow: auto; padding: 17px; }
  .controls-copy { font-size: 12px !important; }
  .hud-actions button { min-height: 32px; }
}

@media (max-aspect-ratio: 1 / 1) {
  #game {
    width: 100vw;
    height: calc(100vw * 9 / 16);
  }
}
