:root {
  --bg-top: #07111e;
  --bg-mid: #0a1f2f;
  --bg-bottom: #05080f;
  --hud-text: #dbecff;
  --alert: #ff5938;
  --ok: #7df27d;
  --brand: #f26522;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, var(--bg-mid), var(--bg-bottom) 60%);
  color: var(--hud-text);
  font-family: "Trebuchet MS", "Lucida Console", Monaco, monospace;
}

#game-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 85%);
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 14px 16px;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

#hud h1 {
  margin: 0 0 8px;
  font-size: clamp(14px, 2.3vw, 22px);
  letter-spacing: 0.08em;
}

#hud p {
  margin: 0 0 6px;
  font-size: clamp(11px, 1.65vw, 16px);
}

#prompt {
  min-height: 1.4em;
  color: #ffe9a3;
  font-weight: 700;
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      rgba(0, 0, 0, 0.05) 3px,
      rgba(0, 0, 0, 0.05) 4px
    ),
    rgba(1, 4, 10, 0.58);
  transition: opacity 180ms ease;
}

#overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#overlay-card {
  width: min(760px, calc(100% - 28px));
  border: 2px solid rgba(242, 101, 34, 0.75);
  background: linear-gradient(160deg, rgba(4, 16, 28, 0.96), rgba(7, 13, 22, 0.93));
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  padding: 18px 20px;
}

#overlay-title {
  margin: 0 0 8px;
  font-size: clamp(18px, 2.8vw, 30px);
  letter-spacing: 0.06em;
}

#overlay-text {
  margin: 0;
  line-height: 1.6;
  font-size: clamp(12px, 1.9vw, 17px);
}

#touch-controls {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.control {
  border: 1px solid rgba(242, 101, 34, 0.5);
  background: linear-gradient(180deg, rgba(6, 24, 39, 0.95), rgba(7, 13, 21, 0.95));
  color: #d9ecff;
  border-radius: 8px;
  min-height: 40px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  touch-action: none;
}

.control:active,
.control.active {
  background: linear-gradient(180deg, rgba(242, 101, 34, 0.75), rgba(165, 63, 21, 0.75));
}

@media (hover: hover) and (pointer: fine) {
  #touch-controls {
    display: none;
  }
}
