:root {
  color-scheme: dark;
  --ink: #f7f0e8;
  --muted: rgba(247, 240, 232, 0.68);
  --glass: rgba(8, 8, 10, 0.68);
  --line: rgba(255, 255, 255, 0.18);
  --cyan: #08f7fe;
  --pink: #ff4ec7;
  --gold: #f7c84b;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #050505;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
a {
  font: inherit;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  outline: none;
}

#gridCanvas {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.hud {
  position: fixed;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
  backdrop-filter: blur(16px);
  box-shadow: 0 0 22px rgba(8, 247, 254, 0.14);
}

.hud-top {
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  width: fit-content;
  max-width: calc(100vw - 32px);
  min-height: 62px;
  padding: 10px 18px;
  border-radius: 8px;
}

.hud-bottom {
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  justify-content: space-between;
  align-items: flex-start;
  min-height: 90px;
  padding: 14px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.hud-bottom.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 1.1rem + 1.1vw, 2.15rem);
  line-height: 1;
  letter-spacing: 0;
  text-shadow:
    0 0 14px rgba(255, 78, 199, 0.55),
    0 0 24px rgba(8, 247, 254, 0.28);
}

.play-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  max-width: 280px;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid rgba(247, 200, 75, 0.55);
  border-radius: 999px;
  background: rgba(247, 200, 75, 0.12);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  box-shadow: 0 0 16px rgba(247, 200, 75, 0.16);
}

.selected {
  min-width: 0;
  padding-left: 2px;
  padding-right: 14px;
}

.selected strong {
  display: block;
  max-width: min(54vw, 620px);
  overflow: hidden;
  font-size: 1.08rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected p {
  max-width: min(58vw, 720px);
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.reticle {
  position: fixed;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 10px rgba(8, 247, 254, 0.75),
    inset 0 0 8px rgba(255, 78, 199, 0.45);
  pointer-events: none;
}

.reticle::before,
.reticle::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 1px;
  background: rgba(255, 255, 255, 0.8);
  content: "";
  transform: translate(-50%, -50%);
}

.reticle::after {
  width: 1px;
  height: 4px;
}

.tap-pulse {
  position: fixed;
  z-index: 3;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 92px));
  width: 54px;
  height: 54px;
  border: 2px solid rgba(8, 247, 254, 0.88);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.84);
  pointer-events: none;
}

.tap-pulse.is-active {
  animation: pulse 700ms ease-in-out infinite alternate;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes pulse {
  from {
    opacity: 0.5;
    transform: scale(0.86);
    box-shadow: 0 0 8px rgba(8, 247, 254, 0.45);
  }
  to {
    opacity: 0.95;
    transform: scale(1.04);
    box-shadow: 0 0 24px rgba(8, 247, 254, 0.85);
  }
}

@media (max-width: 680px) {
  .hud-top,
  .hud-bottom {
    left: 10px;
    right: 10px;
  }

  .hud-top {
    right: auto;
    min-height: 60px;
    padding: 9px 13px;
  }

  .hud-bottom {
    bottom: max(10px, env(safe-area-inset-bottom));
    flex-direction: column;
    gap: 12px;
  }

  .play-pill {
    width: 100%;
    max-width: none;
    min-height: 40px;
  }

  .selected strong {
    max-width: 100%;
    font-size: 1rem;
  }

  .selected p {
    max-width: 100%;
    font-size: 0.85rem;
  }

  .reticle {
    width: 16px;
    height: 16px;
  }
}
