:root {
  --bg-1: #030712;
  --bg-2: #101a36;
  --panel: rgba(15, 23, 42, 0.85);
  --text: #e2e8f0;
  --muted: #93c5fd;
  --accent: #22d3ee;
  --danger: #fb7185;
  --button: #1e3a8a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% -20%, #1e293b, #020617 60%, #000 100%);
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#hud {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: calc(10px + env(safe-area-inset-left));
  right: calc(10px + env(safe-area-inset-right));
  display: flex;
  gap: 0.55rem;
  z-index: 3;
  flex-wrap: wrap;
  pointer-events: none;
}

.chip {
  background: var(--panel);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  min-width: 90px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.35);
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.3), rgba(2, 6, 23, 0.6));
}

.card {
  width: min(520px, 100%);
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 20px;
  padding: clamp(1rem, 3vw, 1.5rem);
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

#title {
  margin: 0;
  font-size: clamp(1.65rem, 6vw, 2.2rem);
}

#message {
  margin: 0.9rem 0 1.2rem;
  color: var(--muted);
  line-height: 1.4;
}

#action {
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.2rem;
  font-size: 1rem;
  font-weight: 800;
  color: #ecfeff;
  background: linear-gradient(180deg, #0891b2, #0e7490);
}

#controls {
  position: fixed;
  left: calc(10px + env(safe-area-inset-left));
  right: calc(10px + env(safe-area-inset-right));
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
  padding: 0.65rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.35);
  backdrop-filter: blur(6px);
  -webkit-tap-highlight-color: transparent;
}

.control {
  flex: 1;
  min-height: 58px;
  border-radius: 12px;
  border: none;
  font-size: 1.3rem;
  font-weight: 800;
  color: #e0f2fe;
  background: linear-gradient(180deg, #1d4ed8, var(--button));
  touch-action: manipulation;
}

.control.primary {
  max-width: 42%;
  background: linear-gradient(180deg, #be123c, #9f1239);
}

.control:active {
  transform: scale(0.98);
}

@media (pointer: fine) {
  #controls {
    width: min(420px, calc(100% - 20px));
    left: auto;
  }
}

@media (max-height: 540px) {
  .control {
    min-height: 48px;
    font-size: 1.1rem;
  }

  #message {
    margin: 0.55rem 0 0.9rem;
  }
}
