@import url("./mathbhoot-experience-polish.css");

.cosmic-prototype-surface {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 20rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 52% 46%, rgba(196, 181, 253, 0.13), transparent 32%),
    radial-gradient(ellipse at 24% 72%, rgba(125, 211, 252, 0.08), transparent 26%),
    #030108;
}

.cosmic-prototype-surface,
.cosmic-prototype-surface *,
.cosmic-prototype-surface *::before,
.cosmic-prototype-surface *::after {
  box-sizing: border-box;
}

.cosmic-prototype-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.cosmic-prototype-fallback {
  display: grid;
  min-height: 20rem;
  place-items: center;
  padding: 2rem;
  color: #f3f4f6;
  background: radial-gradient(circle, #221039, #030108 70%);
  text-align: center;
}

.cosmic-gateway-panel {
  position: absolute;
  inset: calc(var(--site-header-height, 58px) + 1rem) auto auto 50%;
  z-index: 2;
  width: auto;
  padding: 0;
  transform: translateX(-50%);
  border: 0;
  background: transparent;
  color: #f3f4f6;
}

.cosmic-gateway-phase {
  margin: 0 0 0.75rem;
  color: #fbbf24;
  font: 600 0.85rem/1.4 "Courier New", monospace;
}

.cosmic-gateway-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.cosmic-gateway-button {
  min-height: 2.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid #a855f7;
  border-radius: 0.4rem;
  background: rgba(124, 58, 237, 0.14);
  color: #f3f4f6;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.cosmic-gateway-button--primary {
  min-width: min(18rem, 100%);
  border-color: #fbbf24;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cosmic-gateway-button:is(:hover, :focus-visible):not(:disabled) {
  border-color: #f8fafc;
  color: #f8fafc;
  background: rgba(168, 85, 247, 0.24);
  box-shadow: 0 0 0.65rem rgba(248, 250, 252, 0.45), 0 0 1.25rem rgba(168, 85, 247, 0.46);
  transform: translateY(-1px);
}

.cosmic-gateway-button[hidden] { display: none; }

.cosmic-gateway-button:focus-visible {
  outline: 3px solid #38bdf8;
  outline-offset: 3px;
}

.cosmic-gateway-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.cosmic-solar-panel {
  position: absolute;
  z-index: 3;
  inset: calc(var(--site-header-height, 58px) + 1rem) auto auto 50%;
  width: auto;
  padding: 0;
  transform: translateX(-50%);
  border: 0;
  background: transparent;
  color: #f3f4f6;
}

.cosmic-solar-panel[hidden] { display: none; }

.cosmic-solar-button {
  min-height: 2.75rem;
  padding: 0.5rem;
  border: 1px solid color-mix(in srgb, var(--body-colour, #a855f7) 72%, #ffffff 28%);
  border-radius: 0.4rem;
  background: rgba(124, 58, 237, 0.16);
  color: #f3f4f6;
  cursor: pointer;
}

.cosmic-solar-button--earth {
  min-width: min(18rem, calc(100vw - 2rem));
  border-color: #fbbf24;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.cosmic-solar-button--earth:is(:hover, :focus-visible):not(:disabled) {
  border-color: #f8fafc;
  color: #f8fafc;
  background: rgba(168, 85, 247, 0.24);
  box-shadow: 0 0 0.65rem rgba(248, 250, 252, 0.45), 0 0 1.25rem rgba(168, 85, 247, 0.46);
  transform: translateY(-1px);
}
.cosmic-solar-button:focus-visible { outline: 3px solid #38bdf8; outline-offset: 2px; }
.cosmic-solar-button:disabled { cursor: not-allowed; opacity: 0.45; }

.cosmic-earth-handoff {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #f3f4f6;
  pointer-events: none;
  background: rgba(3, 1, 8, calc(var(--handoff-progress, 0) * 0.84));
}

.cosmic-earth-handoff[hidden] { display: none; }

.cosmic-earth-handoff__shell {
  position: relative;
  width: min(72vmin, 40rem);
  aspect-ratio: 1;
  border: 0;
  border-radius: 46% 54% 58% 42% / 52% 44% 56% 48%;
  background:
    radial-gradient(circle at 38% 35%, rgba(255, 253, 247, 0.72), transparent 12%),
    radial-gradient(ellipse at 52% 50%, rgba(196, 181, 253, 0.42), rgba(139, 92, 246, 0.16) 48%, transparent 72%);
  opacity: calc(0.18 + var(--handoff-progress, 0) * 0.82);
  transform: scale(calc(0.42 + var(--handoff-progress, 0) * 0.58));
  box-shadow: 0 0 6rem rgba(196, 181, 253, 0.42), inset 0 0 5rem rgba(248, 247, 255, 0.18);
  filter: blur(1px);
}

.cosmic-earth-handoff__shell::before,
.cosmic-earth-handoff__shell::after {
  position: absolute;
  inset: 16%;
  border: 0;
  border-radius: 55% 45% 48% 52%;
  content: "";
  background: radial-gradient(ellipse, rgba(125, 211, 252, 0.22), transparent 68%);
  filter: blur(8px);
  transform: translate(-12%, 8%) scale(1.15);
}

.cosmic-earth-handoff__shell::after {
  background: radial-gradient(ellipse, rgba(244, 197, 255, 0.24), transparent 68%);
  transform: translate(14%, -10%) scale(1.08);
}

.cosmic-earth-handoff__status,
.cosmic-earth-handoff__time {
  position: absolute;
  inset: auto auto max(4rem, calc(env(safe-area-inset-bottom) + 3rem));
  margin: 0;
  color: #fbbf24;
  font: 600 clamp(0.72rem, 1.5vw, 0.9rem)/1.4 "Courier New", monospace;
  text-align: center;
}

.cosmic-earth-handoff__time { inset-block-end: max(2.4rem, calc(env(safe-area-inset-bottom) + 1.4rem)); color: #38bdf8; }
.cosmic-earth-handoff[data-state="occluded"] { background: #030108; }
.cosmic-earth-handoff[data-state="ready"] { opacity: 0; transition: opacity 420ms cubic-bezier(0.22, 1, 0.36, 1); }

.cosmic-earth-handoff__fallback {
  position: absolute;
  width: min(30rem, calc(100% - 2rem));
  padding: 1.25rem;
  border: 1px solid #a855f7;
  border-radius: 0.75rem;
  background: #0d0716;
  text-align: center;
  pointer-events: auto;
}

.cosmic-earth-handoff__fallback[hidden] { display: none; }
.cosmic-earth-handoff__fallback button,
.cosmic-earth-handoff__fallback a { display: inline-flex; min-height: 2.75rem; align-items: center; margin: 0.4rem; padding: 0.6rem 0.9rem; border: 1px solid #fbbf24; border-radius: 0.4rem; color: #fbbf24; background: transparent; }

.cosmic-prototype-surface::before,
.cosmic-prototype-surface::after {
  position: absolute;
  z-index: 1;
  width: 22%;
  height: 58%;
  content: "";
  pointer-events: none;
  opacity: 0.28;
  filter: blur(30px);
  background: radial-gradient(ellipse, rgba(196, 181, 253, 0.48), rgba(139, 92, 246, 0.2) 42%, transparent 72%);
  animation: cosmic-peripheral-anomaly 9s ease-in-out infinite alternate;
}

.cosmic-prototype-surface::before { inset: 8% auto auto -9%; }
.cosmic-prototype-surface::after { inset: auto -9% 5% auto; animation-delay: -4.5s; }

@keyframes cosmic-peripheral-anomaly {
  from { transform: translate3d(0, -2%, 0) scale(0.9); }
  to { transform: translate3d(4%, 3%, 0) scale(1.08); }
}

@media (max-width: 600px) {
  .cosmic-gateway-panel {
    inset: calc(var(--site-header-height, 58px) + 0.75rem) auto auto 50%;
    width: auto;
    transform: translateX(-50%);
  }
  .cosmic-gateway-actions { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr); }
  .cosmic-gateway-button { width: 100%; max-width: 100%; min-width: 0; padding-inline: 0.5rem; }
  .cosmic-solar-panel {
    inset: calc(var(--site-header-height, 58px) + 0.75rem) auto auto 50%;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cosmic-prototype-surface::before,
  .cosmic-prototype-surface::after,
  .cosmic-earth-handoff[data-state="ready"] { transition: none; }
}
