
:root {
  --bg: #050711;
  --panel: rgba(8, 12, 25, 0.74);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f2f6ff;
  --muted: #b5bed2;
  --accent: #86f7ff;
  --accent-2: #b797ff;
  --danger: #ff5c7a;
  --shadow: rgba(0, 0, 0, 0.45);
  --glow: rgba(134, 247, 255, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  overflow-x: hidden;
}

a { color: inherit; }

.background-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.09;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.20), transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.16), transparent 1px);
  background-size: 38px 38px, 54px 54px;
  mix-blend-mode: screen;
  z-index: 1;
}

.page {
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

.hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 2rem;
  padding: 4rem 1.2rem 2rem;
  position: relative;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 50% 22%, var(--glow), transparent 24rem),
    radial-gradient(circle at 15% 85%, rgba(183,151,255,0.20), transparent 20rem),
    linear-gradient(145deg, #02030a 0%, #08101c 50%, #050711 100%);
}

/* Landing page background */
.state-dormant .hero::before {
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.86) 0%,
      rgba(0, 0, 0, 0.68) 34%,
      rgba(0, 0, 0, 0.28) 62%,
      rgba(0, 0, 0, 0.18) 100%
    ),
    url("assets/img/land.png");

  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
}

/* Page-specific wallpapers */
.state-ar .hero::before {
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.72) 0%,
      rgba(0, 0, 0, 0.48) 42%,
      rgba(0, 0, 0, 0.22) 68%,
      rgba(0, 0, 0, 0.30) 100%
    ),
    url("assets/img/ar_wall.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.state-fogo .hero::before {
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.72) 0%,
      rgba(0, 0, 0, 0.48) 42%,
      rgba(0, 0, 0, 0.22) 68%,
      rgba(0, 0, 0, 0.30) 100%
    ),
    url("assets/img/fogo_wall.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.state-terra .hero::before {
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.72) 0%,
      rgba(0, 0, 0, 0.48) 42%,
      rgba(0, 0, 0, 0.22) 68%,
      rgba(0, 0, 0, 0.30) 100%
    ),
    url("assets/img/terra_wall.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.state-metal .hero::before {
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.72) 0%,
      rgba(0, 0, 0, 0.48) 42%,
      rgba(0, 0, 0, 0.22) 68%,
      rgba(0, 0, 0, 0.30) 100%
    ),
    url("assets/img/metal_wall.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.state-agua .hero::before {
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.72) 0%,
      rgba(0, 0, 0, 0.48) 42%,
      rgba(0, 0, 0, 0.22) 68%,
      rgba(0, 0, 0, 0.30) 100%
    ),
    url("assets/img/agua_wall.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.state-madeira .hero::before {
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.72) 0%,
      rgba(0, 0, 0, 0.48) 42%,
      rgba(0, 0, 0, 0.22) 68%,
      rgba(0, 0, 0, 0.30) 100%
    ),
    url("assets/img/madeira_wall.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.state-vazio .hero::before {
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.72) 0%,
      rgba(0, 0, 0, 0.48) 42%,
      rgba(0, 0, 0, 0.22) 68%,
      rgba(0, 0, 0, 0.30) 100%
    ),
    url("assets/img/vazio_wall.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.state-origem .hero::before {
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.76) 0%,
      rgba(0, 0, 0, 0.46) 42%,
      rgba(0, 0, 0, 0.22) 68%,
      rgba(0, 0, 0, 0.30) 100%
    ),
    url("assets/img/origem_wall.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.state-salvacao .hero::before {
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.58) 0%,
      rgba(0, 0, 0, 0.34) 42%,
      rgba(0, 0, 0, 0.20) 68%,
      rgba(0, 0, 0, 0.22) 100%
    ),
    url("assets/img/constroi_wall.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.state-destruicao .hero::before {
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.54) 0%,
      rgba(0, 0, 0, 0.30) 42%,
      rgba(0, 0, 0, 0.18) 68%,
      rgba(0, 0, 0, 0.22) 100%
    ),
    url("assets/img/destroi_wall.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(5,7,17,0.08), rgba(5,7,17,0.72)),
    radial-gradient(ellipse at bottom, rgba(255,255,255,0.05), transparent 46%);
}

.panel {
  width: min(720px, 100%);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 28px 80px var(--shadow);
  border-radius: 28px;
  padding: clamp(1.2rem, 4vw, 2.5rem);
}

.panel--main {
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--accent);
  font-size: 0.78rem;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.5rem, 8vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: -0.08em;
  text-transform: uppercase;
}

h2 {
  margin-top: 1.8rem;
  margin-bottom: 0.7rem;
  color: var(--accent);
}

p {
  color: var(--muted);
  line-height: 1.7;
  font-size: clamp(1rem, 2vw, 1.1rem);
}

.lead {
  color: var(--text);
  font-size: clamp(1.14rem, 2.4vw, 1.45rem);
}

.btn {
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 0.9rem 1.25rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
  min-width: 11rem;
  cursor: pointer;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.34);
  box-shadow: 0 12px 32px rgba(0,0,0,0.24);
}

.btn--primary {
  background: linear-gradient(135deg, rgba(134,247,255,0.28), rgba(183,151,255,0.22));
  border-color: rgba(134,247,255,0.48);
}

.btn--ghost {
  background: rgba(255,255,255,0.04);
}

.btn--danger {
  background: linear-gradient(135deg, rgba(255,92,122,0.30), rgba(255,170,70,0.18));
  border-color: rgba(255,92,122,0.52);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-links a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.24);
}

.orb-wrap {
  width: min(42vw, 250px);
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 28px var(--glow));
}

.orb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  animation: pulse 3.6s ease-in-out infinite;
}

.orb-core {
  position: absolute;
  inset: 17%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.86), transparent 0 9%, rgba(255,255,255,0.18) 10%, transparent 28%),
    radial-gradient(circle at 50% 58%, var(--accent), transparent 0 18%, rgba(0,0,0,0.30) 48%, rgba(0,0,0,0.70) 72%),
    linear-gradient(145deg, rgba(255,255,255,0.16), rgba(0,0,0,0.35));
  box-shadow:
    inset 0 0 40px rgba(255,255,255,0.10),
    inset 0 0 80px rgba(0,0,0,0.44),
    0 0 44px var(--glow);
}

.orb-ring {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.28);
  transform: rotateX(62deg) rotateZ(18deg);
}

.orb-ring--two {
  inset: 2%;
  transform: rotateX(68deg) rotateZ(-36deg);
  opacity: 0.55;
}

.orb-particles {
  position: absolute;
  inset: -8%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.9) 0 1px, transparent 2px),
    radial-gradient(circle at 77% 42%, rgba(255,255,255,0.8) 0 1px, transparent 2px),
    radial-gradient(circle at 50% 90%, rgba(255,255,255,0.75) 0 1px, transparent 2px),
    radial-gradient(circle at 84% 76%, rgba(255,255,255,0.65) 0 1px, transparent 2px);
  animation: drift 9s linear infinite;
  opacity: 0.85;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.985); opacity: 0.94; }
  50% { transform: scale(1.035); opacity: 1; }
}

@keyframes drift {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Orb/state colours */
.state-dormant { --accent: #86f7ff; --accent-2: #7c7bff; --glow: rgba(134,247,255,0.34); }
.state-ar { --accent: #9ffaff; --accent-2: #ffffff; --glow: rgba(159,250,255,0.50); }
.state-fogo { --accent: #ff9a57; --accent-2: #ff4f70; --glow: rgba(255,126,75,0.52); }
.state-terra { --accent: #c8a36d; --accent-2: #7bdd8d; --glow: rgba(200,163,109,0.45); }
.state-metal { --accent: #dce8ff; --accent-2: #8bb3ff; --glow: rgba(220,232,255,0.44); }
.state-agua { --accent: #5bd6ff; --accent-2: #4e75ff; --glow: rgba(91,214,255,0.50); }
.state-madeira { --accent: #75ff9a; --accent-2: #d7ff7a; --glow: rgba(117,255,154,0.52); }
.state-vazio { --accent: #d7c5ff; --accent-2: #22233d; --glow: rgba(215,197,255,0.42); }
.state-origem { --accent: #ffffff; --accent-2: #86f7ff; --glow: rgba(255,255,255,0.52); }
.state-salvacao { --accent: #9cffb4; --accent-2: #9ffaff; --glow: rgba(156,255,180,0.54); }
.state-destruicao { --accent: #ff5c7a; --accent-2: #ffae42; --glow: rgba(255,92,122,0.58); }

.state-fogo .orb { animation-duration: 2.35s; }
.state-vazio .orb { animation-duration: 5.5s; }
.state-destruicao .orb { animation-duration: 1.45s; }

.audio-panel {
  margin: 1.6rem auto 0;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

.audio-panel small {
  color: var(--muted);
  line-height: 1.5;
}

code {
  color: var(--accent);
  background: rgba(255,255,255,0.06);
  padding: 0.1rem 0.28rem;
  border-radius: 0.4rem;
}

.puzzle-step {
  display: none;
  opacity: 0;
  transform: translateY(8px);
}

.puzzle-step.is-visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: fadeUp 360ms ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.answer-row {
  display: flex;
  gap: 0.8rem;
  margin-top: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.answer-input {
  width: min(100%, 320px);
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.24);
  color: var(--text);
  padding: 0.95rem 1.15rem;
  font: inherit;
  outline: none;
}

.answer-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.05);
}

.feedback {
  min-height: 1.6rem;
  color: var(--accent);
  font-weight: 700;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 1rem;
  margin: 2rem 0 1rem;
}

@media (max-width: 650px) {
  .hero { padding-top: 2.2rem; }
  .choice-grid { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  h1 { font-size: clamp(2.4rem, 18vw, 4.4rem); }
}
