/* Crystal ball — mobile-first, large hold/shake target, no horizontal overflow */
.crystal-page {
  max-width: 640px;
  margin: 0 auto;
}

.crystal-page h1 {
  margin: 0.15rem 0 0.35rem;
}

.crystal-stage,
.crystal-stage.bezel,
#bezel.crystal-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: min(70dvh, 520px);
  margin: 0.85rem 0 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line-silver);
  background: radial-gradient(ellipse at 50% 28%, #24143a 0%, #0b1026 72%);
  box-shadow: var(--shadow-glow);
  touch-action: none;
}

.crystal-stage canvas#crystal-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  position: relative;
  z-index: 0;
}

.crystal-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.crystal-fx[hidden] {
  display: none;
}

.crystal-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  pointer-events: none;
}

.crystal-fallback[hidden] {
  display: none;
}

.crystal-orb {
  width: min(42vw, 168px);
  height: min(42vw, 168px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 10vw, 3.4rem);
  font-weight: 700;
  color: #fff8e8;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.55);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.78), transparent 38%),
    conic-gradient(from 20deg, #ff5a7a, #ffd166, #7dffb3, #66d4ff, #b388ff, #ff8ad8, #ff5a7a);
  box-shadow:
    0 0 28px rgba(180, 120, 255, 0.55),
    inset 0 -16px 22px rgba(20, 10, 40, 0.35);
}

.crystal-answer {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  z-index: 4;
  pointer-events: none;
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 12vw, 3.8rem);
  font-weight: 700;
  color: #fff8e8;
  text-shadow:
    0 1px 0 #1a1030,
    0 0 18px rgba(255, 240, 210, 0.7);
}

.crystal-answer[hidden] {
  display: none;
}

.crystal-roll {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  box-sizing: border-box;
  min-height: 80px;
  height: auto;
  width: min(82%, 300px);
  min-width: min(82%, 220px);
  padding: 0.85rem 1.1rem;
  margin: 0;
  border: 3px solid #ffd6d6;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff5a5a 0%, #e11d1d 48%, #b10d0d 100%);
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(1.18rem, 5.2vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-shadow: 0 1px 0 rgba(80, 0, 0, 0.45);
  box-shadow:
    0 10px 28px rgba(140, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.crystal-roll:hover,
.crystal-roll:focus-visible {
  background: linear-gradient(180deg, #ff6e6e 0%, #ef2424 48%, #c10f0f 100%);
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.crystal-roll:active {
  transform: translate(-50%, -50%) scale(0.98);
}

.crystal-stage.is-rolling .crystal-roll,
.crystal-stage.is-settling .crystal-roll {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.crystal-stage.is-revealed .crystal-roll {
  top: auto;
  bottom: 0.55rem;
  transform: translateX(-50%);
  min-height: 68px;
  width: min(86%, 300px);
  font-size: clamp(1.12rem, 4.8vw, 1.4rem);
}

.crystal-stage.is-revealed .crystal-roll:active {
  transform: translateX(-50%) scale(0.98);
}

.crystal-actions {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.crystal-mute,
.crystal-geo-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.85rem;
}

.crystal-consent {
  margin: 0.35rem 0 0.7rem;
}

.crystal-consent label {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  min-height: 44px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.crystal-consent input {
  width: 22px;
  height: 22px;
  margin-top: 0.2rem;
  flex: 0 0 auto;
}

.crystal-status {
  min-height: 44px;
  margin: 0.35rem 0 0;
}

.crystal-how {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.crystal-disclaimer {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
}

@media (max-width: 400px) {
  .crystal-roll {
    min-height: 84px;
    width: min(88%, 320px);
  }

  .crystal-stage.is-revealed .crystal-roll {
    min-height: 64px;
  }
}

@media (min-width: 600px) {
  .crystal-stage {
    aspect-ratio: 5 / 4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .crystal-orb,
  .crystal-roll,
  .crystal-answer,
  .anim-fade-up {
    animation: none;
    transition: none;
  }

  .crystal-fx {
    display: none;
  }
}
