:root {
  color-scheme: dark;
  --ink: #fff9ff;
  --muted: #d8dcff;
  --hot: #ff2f92;
  --cyan: #19dbff;
  --gold: #ffd24a;
  --lime: #9dff68;
  --violet: #793bff;
  --danger: #ff6048;
  --panel: rgba(10, 15, 43, 0.72);
  --panel-strong: rgba(6, 9, 28, 0.88);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  overflow: auto;
  background:
    radial-gradient(circle at 12% 20%, rgba(25, 219, 255, 0.45), transparent 23rem),
    radial-gradient(circle at 86% 16%, rgba(255, 47, 146, 0.42), transparent 25rem),
    linear-gradient(135deg, #08091d 0%, #17104a 42%, #4a0d62 100%);
  color: var(--ink);
  font-family: Inter, Arial, Helvetica, system-ui, sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(1rem, 2vw, 1.8rem);
}

.stage {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(min-content, 1fr) auto;
  min-height: calc(100vh - clamp(2rem, 4vw, 3.6rem));
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 4rem 4rem,
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 4rem 4rem,
    rgba(5, 8, 29, 0.48);
  box-shadow: 0 1.6rem 5rem rgba(0, 0, 0, 0.45);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.12) 0 2px, transparent 2px 12rem),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.18));
  mix-blend-mode: screen;
  opacity: 0.55;
}

.topbar,
.studio-bar,
.oracle-grid {
  position: relative;
  z-index: 2;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 2vw, 1.8rem);
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--gold);
  font-size: clamp(0.8rem, 1.2vw, 1rem);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(2.1rem, 6vw, 6rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 1.2rem rgba(25, 219, 255, 0.4), 0 0 2.8rem rgba(255, 47, 146, 0.55);
}

.icon-button,
.mini-button,
.mode-button,
.shake-button {
  cursor: pointer;
  border: 0;
  color: var(--ink);
}

.icon-button {
  display: grid;
  width: 3.2rem;
  height: 3.2rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.6rem;
}

.oracle-grid {
  display: grid;
  grid-template-columns: minmax(18rem, 0.9fr) minmax(18rem, 1.1fr);
  align-items: center;
  gap: clamp(1rem, 3vw, 3rem);
  padding: 0 clamp(1rem, 3vw, 3rem) clamp(1rem, 2vw, 2rem);
}

.ball-zone {
  display: grid;
  justify-items: center;
  gap: 1.2rem;
}

.ball {
  position: relative;
  display: grid;
  width: min(43vw, 30rem);
  min-width: 18rem;
  aspect-ratio: 1;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.98) 0 7%, rgba(255, 255, 255, 0) 16%),
    radial-gradient(circle at 64% 70%, rgba(255, 47, 146, 0.95), transparent 26%),
    radial-gradient(circle at 35% 75%, rgba(25, 219, 255, 0.95), transparent 28%),
    radial-gradient(circle at 50% 48%, #3b2dff 0, #140744 42%, #030511 72%);
  box-shadow:
    inset -1.8rem -2.4rem 4rem rgba(0, 0, 0, 0.72),
    inset 1rem 1rem 2.3rem rgba(255, 255, 255, 0.22),
    0 0 3rem rgba(25, 219, 255, 0.65),
    0 0 5.8rem rgba(255, 47, 146, 0.48);
  transform: translateZ(0);
}

.ball::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.ball-glow {
  position: absolute;
  inset: -8%;
  z-index: -1;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--hot), var(--gold), var(--cyan), var(--violet), var(--hot));
  filter: blur(2rem);
  opacity: 0.44;
  animation: spin 7s linear infinite;
}

.ball-ring {
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 55%, rgba(255, 210, 74, 0.8) 56% 59%, transparent 60%);
  opacity: 0.75;
}

.ball-window {
  position: relative;
  display: grid;
  width: 38%;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 45% 35%, #fff 0 3%, transparent 10%),
    radial-gradient(circle, #f5f8ff 0 34%, #d2e8ff 36% 48%, #080d31 50%);
  box-shadow: inset 0 0 1.3rem rgba(0, 0, 0, 0.65), 0 0 2rem rgba(255, 255, 255, 0.35);
}

.ball-label {
  width: 64%;
  color: #0b1140;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(1.4rem, 4vw, 3.8rem);
  line-height: 0.9;
  text-align: center;
}

.ball.shaking {
  animation: shake 0.92s cubic-bezier(.36,.07,.19,.97) both;
}

.ball.revealing .ball-window {
  animation: pulse 0.72s ease-out;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}

.shake-button {
  min-height: 4.2rem;
  padding: 0 2rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), #ff8f2a 48%, var(--hot));
  color: #16091f;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 0 0.8rem 2rem rgba(255, 47, 146, 0.28);
}

.mini-button,
.mode-button {
  min-height: 2.6rem;
  padding: 0 0.9rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.13);
  font-weight: 900;
}

.answer-panel {
  display: grid;
  align-content: center;
  min-height: clamp(22rem, 52vh, 40rem);
  padding: clamp(1.4rem, 3.8vw, 4rem);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 47, 146, 0.22), transparent 34%),
    linear-gradient(315deg, rgba(25, 219, 255, 0.2), transparent 38%),
    var(--panel);
  box-shadow: inset 0 0 4rem rgba(255, 255, 255, 0.05), 0 1rem 3rem rgba(0, 0, 0, 0.28);
}

.status {
  margin: 0 0 1rem;
  color: var(--gold);
  font-size: clamp(1rem, 1.8vw, 1.45rem);
  font-weight: 900;
  text-transform: uppercase;
}

.answer {
  margin: 0;
  max-width: 12ch;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(2.3rem, 6.8vw, 7.2rem);
  line-height: 0.92;
  letter-spacing: 0;
  text-transform: uppercase;
  text-wrap: balance;
}

.answer-panel.good {
  border-color: rgba(157, 255, 104, 0.58);
  box-shadow: 0 0 4rem rgba(157, 255, 104, 0.24);
}

.answer-panel.bad {
  border-color: rgba(255, 96, 72, 0.58);
  box-shadow: 0 0 4rem rgba(255, 96, 72, 0.24);
}

.answer-panel.chaos {
  border-color: rgba(255, 210, 74, 0.72);
  box-shadow: 0 0 4rem rgba(255, 210, 74, 0.25);
}

.answer.reveal {
  animation: answerPop 0.52s ease-out both;
}

.verdict-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.verdict,
.confidence {
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.14);
  font-size: clamp(0.9rem, 1.4vw, 1.1rem);
  font-weight: 900;
  text-transform: uppercase;
}

.studio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 2vw, 1.8rem);
  background: rgba(0, 0, 0, 0.26);
}

.mode-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-weight: 900;
}

.mode-button.active {
  background: var(--cyan);
  color: #04101f;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.light {
  position: absolute;
  bottom: -22%;
  width: 26vw;
  height: 120vh;
  pointer-events: none;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.28), transparent 72%);
  filter: blur(0.5rem);
  opacity: 0.55;
  transform-origin: bottom center;
}

.light-left {
  left: 9%;
  transform: rotate(23deg);
  animation: sweepLeft 6s ease-in-out infinite alternate;
}

.light-right {
  right: 7%;
  transform: rotate(-24deg);
  animation: sweepRight 5.4s ease-in-out infinite alternate;
}

.sparkles::before,
.sparkles::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.9) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(255,210,74,0.95) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(25,219,255,0.85) 0 2px, transparent 3px);
  background-position: 8% 22%, 78% 30%, 24% 84%;
  background-size: 11rem 11rem, 14rem 14rem, 17rem 17rem;
  opacity: 0.65;
  animation: sparkle 4.5s steps(3, end) infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shake {
  10%, 90% { transform: translateX(-4px) rotate(-2deg); }
  20%, 80% { transform: translateX(8px) rotate(3deg); }
  30%, 50%, 70% { transform: translateX(-13px) rotate(-4deg); }
  40%, 60% { transform: translateX(13px) rotate(4deg); }
}

@keyframes pulse {
  0% { transform: scale(0.88); filter: brightness(1); }
  55% { transform: scale(1.08); filter: brightness(1.8); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes answerPop {
  from { opacity: 0; transform: translateY(1.2rem) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sweepLeft {
  to { transform: rotate(38deg); }
}

@keyframes sweepRight {
  to { transform: rotate(-39deg); }
}

@keyframes sparkle {
  50% { opacity: 1; transform: translateY(-0.4rem); }
}

@media (max-width: 880px) {
  .app-shell {
    min-height: 100svh;
    padding: 0;
  }

  .stage {
    min-height: 100svh;
    border: 0;
    border-radius: 0;
  }

  .oracle-grid {
    grid-template-columns: 1fr;
  }

  .ball {
    width: min(78vw, 24rem);
    min-width: 14rem;
  }

  .answer-panel {
    min-height: 18rem;
  }

  .answer {
    max-width: 15ch;
  }

  .studio-bar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-height: 760px) and (min-width: 881px) {
  .app-shell {
    padding: 0.75rem;
  }

  .stage {
    min-height: calc(100vh - 1.5rem);
  }

  .topbar {
    padding: 0.85rem 1rem;
  }

  h1 {
    font-size: clamp(2rem, 4.5vw, 4.4rem);
  }

  .oracle-grid {
    gap: 1rem;
    padding: 0 1rem 1rem;
  }

  .ball-zone {
    gap: 0.8rem;
  }

  .ball {
    width: min(34vw, 22rem);
    min-width: 15rem;
  }

  .shake-button {
    min-height: 3.5rem;
    padding: 0 1.4rem;
  }

  .answer-panel {
    min-height: clamp(16rem, 42vh, 28rem);
    padding: clamp(1rem, 2.4vw, 2.4rem);
  }

  .answer {
    font-size: clamp(2rem, 5.2vw, 5.4rem);
  }

  .studio-bar {
    padding: 0.75rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
