:root {
  --green: #58cc02;
  --green-dark: #58a700;
  --green-shadow: #46a302;
  --ink: #4b4b4b;
  --muted: #777;
  --line: #e5e5e5;
  --sky: #1cb0f6;
  --bg: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { background: var(--bg); }

/* ---------- Scrollbar: whitish track, Duolingo-green thumb ---------- */
::-webkit-scrollbar { width: 14px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.85); }
::-webkit-scrollbar-thumb {
  background: var(--green);
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--green-shadow); }
::-webkit-scrollbar-button { display: none; }

/* Firefox (Chrome ignores the rules above once scrollbar-color is set, so it's Firefox-only) */
@supports not selector(::-webkit-scrollbar) {
  html { scrollbar-color: var(--green) rgba(255, 255, 255, 0.85); }
}

body {
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Loader ---------- */
body.is-loading { overflow: hidden; }

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  background: #a570ff; /* same purple as the artwork's background */
  color: #fff;
  transition: transform 0.9s cubic-bezier(0.76, 0, 0.24, 1);
}
/* reveal: the whole loader slides off to the right */
.loader.out { transform: translateX(100%); }

.loader-center {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: min(420px, calc(100% - 32px));
  transform: translate(-50%, -78%);
  text-align: center;
}

.loader-title {
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 900;
  letter-spacing: -0.5px;
  text-shadow: 0 4px 0 rgba(60, 20, 140, 0.25);
  margin-bottom: 22px;
}
.loader-dots i {
  font-style: normal;
  display: inline-block;
  animation: dot-bounce 1.2s ease-in-out infinite;
}
.loader-dots i:nth-child(2) { animation-delay: 0.15s; }
.loader-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot-bounce { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-8px); } }

/* Duolingo-style progress bar */
.loader-bar {
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}
.loader-fill {
  position: relative;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}
.loader-fill::after {
  /* the little shine stripe on Duolingo's progress bars */
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 4px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
}

.loader-pct {
  margin-top: 12px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.loader-duo {
  position: absolute;
  left: 50%;
  bottom: 0;
  height: min(56vh, 600px, 95vw);
  width: auto;
  max-width: none;
  transform: translateX(-50%);
  transform-origin: 50% 100%;
  animation: bored 3.2s ease-in-out infinite;
  user-select: none;
  pointer-events: none;
}
@keyframes bored {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.012, 0.99); }
}

/* ---------- Flight (hero -> sky, pinned while scrolling) ---------- */
.flight {
  position: relative;
  height: 380vh; /* scroll distance that drives the transition */
}

.flight-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1899d6 0%, #1cb0f6 45%, #6fd0ff 100%);
  opacity: 0;
  z-index: -1;
}

.streaks, .clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.clouds-back { z-index: 0; }
.clouds-front { z-index: 3; }

.cloud {
  position: absolute;
  top: 0;
  will-change: transform;
}
.cloud svg { display: block; width: 100%; height: auto; position: relative; }

/* ---------- Easter egg: golden Duo perched on the left cloud ---------- */
.cloud.has-egg { pointer-events: none; }
.gold-duo {
  position: absolute;
  left: 51%;              /* over the cloud's big middle bump */
  bottom: 74%;            /* sunk a little into the top of the cloud */
  width: clamp(90px, 18vw, 250px);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  visibility: hidden;
  -webkit-tap-highlight-color: transparent;
}
.gold-duo:focus-visible { outline: 3px solid #fff; outline-offset: 4px; border-radius: 12px; }
/* crops the image's transparent padding (art spans x 30-728, y 286-1093 of 736x1308) */
.gold-duo-inner {
  display: block;
  overflow: visible;
  animation: gold-float 3.4s ease-in-out infinite;
}
.gold-duo img {
  display: block;
  width: calc(100% * 736 / 698);
  max-width: none;
  margin: calc(-100% * 286 / 698) 0 calc(-100% * 215 / 698) calc(-100% * 30 / 698);
  user-select: none;
  animation: gold-glow 2.2s ease-in-out infinite;
}
@keyframes gold-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6%); } }
@keyframes gold-glow {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 220, 60, 0.5)); }
  50% { filter: drop-shadow(0 0 18px rgba(255, 220, 60, 0.9)); }
}
.gold-duo.hop .gold-duo-inner { animation: gold-hop 0.6s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes gold-hop {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-28%) scale(1.06) rotate(-6deg); }
  60% { transform: translateY(0) scale(1.04, 0.94); }
  100% { transform: translateY(0) scale(1); }
}
.clouds-back .cloud { opacity: 0.9; }

.streaks { z-index: 0; opacity: 0; }
.streak {
  position: absolute;
  top: -30%;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: streak linear infinite;
}
@keyframes streak { to { transform: translateY(170vh); } }

.fade-out { will-change: opacity, transform; }

/* ---------- Nav ---------- */
.nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  max-width: 988px;
  margin: 0 auto;
  height: 70px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 900;
  font-size: 32px;
  letter-spacing: -0.8px;
  color: var(--green);
  text-decoration: none;
}

.lang-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 2;
  max-width: 988px;
  height: 100%;
  margin: 0 auto;
  padding: 94px 16px 64px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 48px;
}

.hero-stage {
  width: 100%;
  max-width: 420px;
  justify-self: center;
  transform-origin: 50% 50%;
  will-change: transform;
}

/* The viewBox has 120 extra units on each side (920 vs 680) so flapping wings
   aren't clipped; this keeps Duo's body the same size as the stage. */
.duo {
  display: block;
  width: calc(100% * 920 / 680);
  max-width: none;
  height: auto;
  margin-left: calc(-100% * 120 / 680);
  transform-origin: 50% 100%; /* squash & stretch from the feet */
}

/* ---------- Angry Duo (mouse at the very top, heading for the close button) ---------- */
/* Calming down (these apply when .angry is removed): the brows melt away first, then
   the eyelids lift softly. Never brows over open eyes. */
.duo .lid {
  transform: translateY(-150px);
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.12s;
}
.duo .brows {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.25s ease;
}
/* Getting angry: fast with a little snap */
.duo.angry .lid {
  transform: none;
  transition: transform 0.22s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.duo.angry .brows {
  transform: none;
  opacity: 1;
  transition: opacity 0.12s, transform 0.22s cubic-bezier(0.3, 1.4, 0.5, 1);
}

/* ---------- Ticklish Duo (rub his belly) ---------- */
.duo .cheeks {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0.6);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.duo.tickled .cheeks {
  opacity: 0.85;
  transform: none;
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.duo.giggle .duo-body { animation: giggle 0.7s ease-in-out; }
@keyframes giggle {
  0%, 100% { transform: none; }
  15% { transform: translateY(-3%) rotate(-3deg); }
  30% { transform: translateY(0) rotate(3deg); }
  45% { transform: translateY(-2%) rotate(-2deg); }
  60% { transform: translateY(0) rotate(2deg); }
  80% { transform: translateY(-1%) rotate(0); }
}

/* Speech bubble when the mouse leaves the site */
.hero-stage { position: relative; }
.duo-bubble {
  position: absolute;
  z-index: 5;
  left: 60%;
  bottom: calc(100% + 4px);
  width: max-content;
  max-width: 290px;
  text-wrap: balance;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px) scale(0.6);
  transform-origin: 18px 100%;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.duo-bubble::after {
  /* tail pointing down at Duo */
  content: "";
  position: absolute;
  left: 16px;
  bottom: -13px;
  width: 18px;
  height: 18px;
  background: #fff;
  border: solid var(--line);
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 4px;
  transform: rotate(45deg);
}
.duo-bubble.show {
  opacity: 1;
  transform: none;
  transition: opacity 0.15s ease, transform 0.4s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.duo .duo-body {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.duo.shake .duo-body { animation: grr 0.45s ease-in-out; }
@keyframes grr {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-4deg); }
  40% { transform: rotate(4deg); }
  60% { transform: rotate(-3deg); }
  80% { transform: rotate(2deg); }
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 480px;
  justify-self: center;
}

h1 {
  font-size: 32px;
  line-height: 1.25;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 40px;
}

.cta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 330px;
}

/* Duolingo's chunky 3D button */
.btn {
  --edge: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 16px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
  user-select: none;
}
.btn:active { transform: translateY(var(--edge)); box-shadow: none !important; }

.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 var(--edge) 0 var(--green-shadow);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-secondary {
  background: #fff;
  color: var(--sky);
  border: 2px solid var(--line);
  box-shadow: 0 var(--edge) 0 var(--line);
}
.btn-secondary:hover { background: #f7f7f7; }

.btn:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }

/* ---------- Block 2: "Alcance o maior nível" ---------- */
.level {
  position: absolute;
  left: 0;
  right: 0;
  top: 52%;
  z-index: 4;
  padding: 0 16px;
  text-align: center;
  color: #fff;
  pointer-events: none;
}

.eyebrow {
  display: inline-block;
  padding: 8px 16px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  opacity: 0;
}

.level-title {
  max-width: 820px;
  margin: 0 auto;
  font-size: clamp(36px, 6.4vw, 76px);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: -1px;
  text-wrap: balance;
  text-shadow: 0 5px 0 rgba(10, 90, 140, 0.25);
}
.level-title .word {
  display: inline-block;
  opacity: 0;
  will-change: transform, opacity;
}

/* ---------- Block 3: "Não apenas palavras soltas" ---------- */
.words {
  position: relative;
  z-index: 1;
  height: 260vh; /* scroll distance that drives the sentence */
  background: #fff;
}
/* cloud bumps on the top edge, so the sky of block 2 lands softly on white */
.words::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -68px;
  height: 70px;
  background:
    radial-gradient(circle 70px at 50% 100%, #fff 98%, transparent 100%) 0 100% / 160px 70px repeat-x,
    radial-gradient(circle 46px at 50% 100%, #fff 98%, transparent 100%) 80px 100% / 160px 46px repeat-x;
  pointer-events: none;
}

.words-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.words-head {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto;
  padding: 9vh 16px 0;
  text-align: center;
}
.words-title {
  font-size: clamp(32px, 5.2vw, 60px);
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--ink);
  text-wrap: balance;
}
/* "palavras soltas" drawn as loose word tiles */
.chip {
  display: inline-block;
  padding: 0 0.28em 0.04em;
  border: 3px solid var(--line);
  border-bottom-width: 6px;
  border-radius: 0.3em;
  background: #fff;
  color: var(--sky);
}
.chip-a { transform: rotate(-4deg); }
.chip-b { transform: rotate(3deg) translateY(4px); }

.words-sub {
  max-width: 560px;
  margin: 18px auto 0;
  font-size: clamp(17px, 1.8vw, 21px);
  line-height: 1.45;
  font-weight: 700;
  color: var(--muted);
  text-wrap: balance;
}
.words-sub strong { color: var(--green); font-weight: 900; }

.lesson {
  position: absolute;
  left: 50%;
  top: 40%;
  z-index: 1;
  width: min(640px, calc(100% - 32px));
  transform: translateX(-50%);
}
.lesson-prompt {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #afafaf;
}
/* the two ruled lines of Duolingo's answer area */
.answer {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px 8px;
  min-height: 124px;
  padding-top: 6px;
  background: linear-gradient(transparent 60px, var(--line) 60px, var(--line) 62px, transparent 62px) 0 0 / 100% 62px;
}

.tiles { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

/* Duolingo word-bank tile */
.tile {
  display: inline-block;
  padding: 9px 14px 8px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 13px;
  background: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
}
.tile-ghost { visibility: hidden; }
.tiles .tile {
  position: absolute;
  will-change: transform, opacity;
  transition: color 0.25s, border-color 0.25s, background-color 0.25s;
}
.tile-loose { color: #afafaf; }
.words.is-correct .tile-word {
  color: var(--green-dark);
  border-color: #a5ed6e;
  background: #d7ffb8;
  animation: tile-cheer 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) backwards;
}
.words.is-correct .tile-word:nth-child(2) { animation-delay: 0.04s; }
.words.is-correct .tile-word:nth-child(3) { animation-delay: 0.08s; }
.words.is-correct .tile-word:nth-child(4) { animation-delay: 0.12s; }
.words.is-correct .tile-word:nth-child(5) { animation-delay: 0.16s; }
.words.is-correct .tile-word:nth-child(6) { animation-delay: 0.2s; }
.words.is-correct .tile-word:nth-child(7) { animation-delay: 0.24s; }
@keyframes tile-cheer { 0% { translate: 0 0; } 40% { translate: 0 -10px; } 100% { translate: 0 0; } }

/* "Excelente!" banner, like Duolingo's correct-answer footer */
.feedback {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  background: #d7ffb8;
  transform: translateY(105%);
  will-change: transform;
}
.feedback-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 16px 28px;
}
.feedback-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  color: var(--green);
}
.feedback-title { font-size: 24px; font-weight: 900; color: var(--green-dark); }
.feedback-text { font-size: 17px; font-weight: 700; color: var(--green-dark); opacity: 0.85; }

/* ---------- Block 4: streaks (horizontal scroll) ---------- */
.streaks-block {
  position: relative;
  /* 580vh horizontal part + 650vh globe + 100vh outro (see data-split in index.html) */
  height: 1330vh;
}
.sb-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.sb-track {
  display: flex;
  width: 300%;
  height: 100%;
  will-change: transform;
}
.panel {
  position: relative;
  flex: 0 0 calc(100% / 3);
  height: 100%;
  overflow: hidden;
}

.panel-copy {
  position: absolute;
  z-index: 3;
  left: max(16px, calc(50% - 494px));
  top: 50%;
  width: min(440px, calc(100% - 32px));
  translate: 0 -50%;
}
.panel-title {
  font-size: clamp(34px, 4.6vw, 58px);
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: -1px;
  text-wrap: balance;
}
.panel-sub {
  margin-top: 16px;
  font-size: clamp(17px, 1.7vw, 21px);
  line-height: 1.45;
  font-weight: 700;
  text-wrap: balance;
}
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

/* Panel 1: ice */
.panel-ice {
  background: linear-gradient(180deg, #012c59 0%, #054277 30%, #0d6fb2 62%, #4899d7 82%, #91c1e7 100%);
  color: #fff;
}
.ice-copy .panel-sub { color: #bfe6ff; }
.badge-ice { background: rgba(255, 255, 255, 0.14); color: #baf6ff; }

.snow { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.snow i {
  position: absolute;
  top: -10px;
  border-radius: 50%;
  background: #fff;
  animation: snowfall linear infinite;
}
@keyframes snowfall {
  to { transform: translate(var(--drift), 105vh); }
}

/* frozen Duo (transparent PNG, 791x444); the zoom aims at his face */
.frozen-wrap {
  position: absolute;
  z-index: 2;
  left: 72%;
  top: 56%;
  width: min(600px, 50vw);
  transform: translate(-50%, -50%);
  transform-origin: 46% 38%;
  will-change: transform;
}
.frozen-img {
  display: block;
  width: 100%;
  filter: drop-shadow(0 0 30px rgba(186, 246, 255, 0.35)); /* icy glow */
  animation: shiver 0.18s steps(2) infinite;
}
@keyframes shiver { 50% { translate: 1px 0; } }

/* the ice heats up into the comet panel's yellow during the zoom; ends flat #ffe500
   so the two panels meet with no seam */
.heat {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #ffe500;
  clip-path: circle(var(--r, 0%) at 72% 56%); /* grows out of the frozen Duo */
  pointer-events: none;
}
.heat::before {
  /* a hot white-orange core that blooms out of the Duo first */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 72% 56%, #fff8c8 0%, #ffcf3a 35%, transparent 70%);
  opacity: calc(1 - var(--core, 0)); /* fades out right before the slide */
}
.panel-ice { margin-right: -1px; } /* overlap 1px so no hairline shows between panels */

/* Panel 2: fire */
.panel-fire {
  background: #ffe500; /* the comet art's background */
  color: #4b2c00;
}
.fire-copy .panel-sub { color: #7a4a00; }
.hot { color: #ff7a00; }
.badge-fire { background: #fff; color: #ff9600; box-shadow: 0 4px 0 rgba(200, 120, 0, 0.25); }

.fire-lines { position: absolute; inset: -20%; z-index: 1; pointer-events: none; transform: rotate(-38deg); }
.fire-lines i {
  position: absolute;
  height: 5px;
  border-radius: 5px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9));
  animation: whoosh linear infinite;
}
/* the comet flies down-left, so the air streaks past up-right */
@keyframes whoosh {
  from { transform: translateX(-70vw); opacity: 0; }
  15% { opacity: 1; }
  to { transform: translateX(70vw); opacity: 0; }
}

.comet-wrap {
  position: absolute;
  z-index: 2;
  left: 70%;
  top: 50%;
  width: min(620px, 52vw);
  margin: calc(min(620px, 52vw) * -1 / 3) 0 0 calc(min(620px, 52vw) / -2);
  will-change: transform;
}
.comet-fly {
  position: relative;
  animation: comet-shake 0.32s ease-in-out infinite alternate;
}
/* no filters on the image: its yellow background must stay exactly #ffe500 */
.comet-fly img { display: block; width: 100%; }
@keyframes comet-shake {
  from { transform: translate(-5px, 4px) rotate(-1deg); }
  to { transform: translate(5px, -4px) rotate(1deg); }
}
.embers { position: absolute; inset: 0; pointer-events: none; }
.embers i {
  position: absolute;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: #ff8a00;
  animation: ember ease-out infinite;
}
@keyframes ember {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to { transform: translate(140px, -110px) scale(0.2); opacity: 0; }
}

/* Panel 3: the teachers (art has a white background) */
.panel-teachers { background: #fff; color: var(--ink); }
.panel-fire { margin-right: -1px; }
.teach-copy .panel-sub { color: var(--muted); }
.teach-hl { color: var(--sky); }
.hint-touch { display: none; }
@media (hover: none) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
}

.teachers {
  position: absolute;
  left: 72%;
  top: 54%;
  width: min(520px, 42vw, 78vh);
  translate: -50% -50%;
  transform-origin: 48.8% 66%; /* Duo's face: the zoom into block 6 aims here */
  will-change: transform;
}
/* the art sits in the middle of a wide 2064x1152 canvas (x 24%-76%):
   show only that part so the box hugs the characters */
.teachers img {
  display: block;
  width: calc(100% / 0.52);
  max-width: none;
  margin-left: calc(-100% * 0.24 / 0.52);
  user-select: none;
}

/* invisible hotspot over each character */
.teacher {
  position: absolute;
  padding: 0;
  border: 0;
  border-radius: 40%;
  background: none;
  font: inherit; /* buttons don't inherit the page font by default */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.teacher:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

.t-bubble {
  position: absolute;
  bottom: calc(100% - 14%);
  left: 50%;
  z-index: 5;
  width: max-content;
  max-width: 230px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  text-align: left;
  text-wrap: balance;
  pointer-events: none;
  opacity: 0;
  translate: -50% 8px;
  scale: 0.6;
  transform-origin: 50% 100%;
  transition: opacity 0.18s ease, translate 0.35s cubic-bezier(0.3, 1.5, 0.5, 1), scale 0.35s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.t-bubble::after {
  /* tail pointing down at the character */
  content: "";
  position: absolute;
  left: calc(50% - 9px);
  bottom: -11px;
  width: 16px;
  height: 16px;
  background: #fff;
  border: solid var(--line);
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 4px;
  transform: rotate(45deg);
}
/* bubbles near the edges open toward the inside */
.side-l .t-bubble { left: 20%; translate: 0 8px; transform-origin: 20px 100%; }
.side-l .t-bubble::after { left: 14px; }
.side-r .t-bubble { left: auto; right: 20%; translate: 0 8px; transform-origin: calc(100% - 20px) 100%; }
.side-r .t-bubble::after { left: auto; right: 14px; }

.teacher:hover,
.teacher:focus-visible,
.teacher.talk { z-index: 6; }
.teacher:hover .t-bubble,
.teacher:focus-visible .t-bubble,
.teacher.talk .t-bubble { opacity: 1; scale: 1; translate: -50% 0; }
.side-l:hover .t-bubble, .side-l:focus-visible .t-bubble, .side-l.talk .t-bubble,
.side-r:hover .t-bubble, .side-r:focus-visible .t-bubble, .side-r.talk .t-bubble { translate: 0 0; }

/* ---------- Block 6: Duo over the turning globe ---------- */
.world {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  color: #fff;
  background: radial-gradient(120% 90% at 50% 100%, #2b6fd6 0%, #123a86 45%, #0a1d4a 100%);
}
.world-stars {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 98%, transparent),
    radial-gradient(2px 2px at 28% 8%, #fff 98%, transparent),
    radial-gradient(1.5px 1.5px at 44% 26%, #cfe8ff 98%, transparent),
    radial-gradient(2px 2px at 63% 12%, #fff 98%, transparent),
    radial-gradient(1.5px 1.5px at 78% 30%, #fff 98%, transparent),
    radial-gradient(2.5px 2.5px at 90% 10%, #fff 98%, transparent),
    radial-gradient(1.5px 1.5px at 8% 46%, #cfe8ff 98%, transparent),
    radial-gradient(2px 2px at 94% 48%, #fff 98%, transparent),
    radial-gradient(1.5px 1.5px at 20% 62%, #fff 98%, transparent),
    radial-gradient(1.5px 1.5px at 84% 66%, #cfe8ff 98%, transparent);
  animation: twinkle 3s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }

.world-title {
  position: absolute;
  z-index: 3;
  left: 16px;
  right: 16px;
  top: 6vh;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  font-size: clamp(30px, 4.4vw, 56px);
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -1px;
  text-wrap: balance;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

.lang-card {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: calc(6vh + clamp(80px, 11vw, 140px));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px 10px 12px;
  border: 2px solid var(--line);
  border-bottom-width: 5px;
  border-radius: 20px;
  background: #fff;
  color: var(--ink);
  translate: -50% 0;
}
.lang-card.pop { animation: lang-pop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes lang-pop {
  0% { transform: scale(0.8) rotate(-4deg); }
  100% { transform: none; }
}
.lang-flag { width: 58px; height: auto; display: block; }
.lang-name { font-size: 22px; font-weight: 900; line-height: 1.1; }
.lang-hello { font-size: 16px; font-weight: 800; color: var(--sky); }

.lang-dots {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: calc(6vh + clamp(80px, 11vw, 140px) + 86px);
  display: flex;
  gap: 8px;
  translate: -50% 0;
}
.lang-dots img {
  width: 24px;
  height: auto;
  opacity: 0.4;
  transition: opacity 0.25s, transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.lang-dots img.on { opacity: 1; transform: scale(1.35) translateY(-2px); }

/* globe: the planet is centered in a 1392x1728 canvas; this square box hugs it
   (plus its two clouds) so rotating the box spins the planet around its center */
.globe {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 55%;
  width: min(43vh, 84vw); /* the whole planet fits on screen */
  aspect-ratio: 1;
  will-change: transform;
}
.globe img {
  position: absolute;
  width: calc(100% / 0.74);
  max-width: none;
  left: calc(-100% * 0.132 / 0.74);
  top: calc(-100% * 0.2482 / 0.74);
  user-select: none;
}

/* our Duo, flying just above the globe */
.world-duo {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 47%;
  width: min(200px, 17vh, 40vw);
  transform-origin: 50% 50%;
  will-change: transform;
}

/* ---------- Block 7: download ---------- */
.download {
  position: relative;
  /* download morph (first 42%, see download.js) + Max crash, smoke and Super (super.js) */
  height: 620vh;
  color: #fff;
}
.dl-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 0 16px;
  /* the night sky of the globe scene */
  background: linear-gradient(180deg, #1a4aa6 0%, #123a86 35%, #0a1d4a 100%);
}
/* the green screen block 6 ends on; download.js shrinks it into the icon */
.dl-fill {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #32c900;
  pointer-events: none;
  will-change: clip-path;
}
#app-icon {
  opacity: 0;
  transform-origin: 50% 70%;
  /* --appear: morph-in (download.js); --sx/--sy: squash when Max hits it (super.js) */
  transform: scale(var(--appear, 1)) scale(var(--sx, 1), var(--sy, 1));
}

/* ---------- Block 8: Duolingo Max crash -> smoke -> Duolingo Super ---------- */
.super-bg {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(90% 70% at 30% 60%, #3b2a9e 0%, transparent 70%),
    linear-gradient(180deg, #0b1a5c 0%, #2a1a6e 55%, #4a1a73 100%);
}
.dl-inner { will-change: transform, opacity; }

/* white lightning bolt (paths drawn by super.js in screen pixels) */
.bolt {
  position: absolute;
  inset: 0;
  z-index: 7;
  width: 100%;
  height: 100%;
  overflow: visible;
  visibility: hidden;
  pointer-events: none;
}

/* flash radiates from where the bolt hits (--fx/--fy set by super.js) */
.flash {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: radial-gradient(circle at var(--fx, 30%) var(--fy, 45%), #fff 0%, #eef6ff 35%, rgba(255, 255, 255, 0.55) 100%);
  opacity: 0;
  pointer-events: none;
}

/* smoke: white base + a row of cloud puffs along its top */
.smoke {
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: 0;
  height: 72%;
  z-index: 6;
  transform: translateY(100%);
  pointer-events: none;
  will-change: transform;
}
.smoke-base {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70%; /* reaches up behind the puffs so no sky shows between them and the base */
  background: #fff;
}
.puff {
  position: absolute;
  animation: puff 3s ease-in-out infinite;
}
.puff svg { display: block; width: 100%; height: auto; }
@keyframes puff { 50% { transform: translateY(-3%) scale(1.03); } }

/* the Super scene */
.super {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 48px;
  max-width: 988px;
  margin: 0 auto;
  padding: 0 16px;
  visibility: hidden;
}
.super-art { justify-self: center; width: min(400px, 80%); }
.super-art img { display: block; width: 100%; filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.35)); }
.super-badge {
  display: inline-block;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 14px;
  background: linear-gradient(90deg, #26ff55, #1fc2ff 45%, #a560ff 75%, #ff4bdb);
  transform: skewX(-12deg);
}
.super-badge span {
  display: block;
  padding: 4px 18px;
  border-radius: 10px;
  background: linear-gradient(90deg, #13c46b, #2a8cff 50%, #b04bff);
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #0b1a5c;
}
.super-title {
  font-size: clamp(40px, 5.4vw, 68px);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -1px;
}
.super-grad {
  background: linear-gradient(90deg, #26ff55, #1fc2ff 45%, #ff4bdb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.super-sub {
  margin-top: 16px;
  max-width: 420px;
  font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.45;
  font-weight: 700;
  color: #d9c8ff;
}
@media (max-width: 800px) {
  .super { grid-template-columns: 1fr; gap: 16px; text-align: center; align-content: center; }
  .super-art { width: min(260px, 70vw); }
  .super-sub { margin-inline: auto; }
}
#dl-copy { opacity: 0; visibility: hidden; }

/* block 6's green burst (world.js grows it from Duo's body) */
.world-fill {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: #32c900;
  clip-path: circle(0% at 50% 50%);
  pointer-events: none;
}
.dl-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 48px;
  width: 100%;
  max-width: 988px;
}

/* spinning 3D app icon */
.app-stage {
  position: relative;
  justify-self: center;
  width: min(340px, 70vw);
}
.app-float { animation: app-float 3.6s ease-in-out infinite; }
.app-spin {
  /* the icon spans x 582-1330, y 44-1034 of the 1920x1080 image: crop to it */
  aspect-ratio: 748 / 990;
  overflow: visible;
}
.app-spin img {
  display: block;
  width: calc(100% * 1920 / 748);
  max-width: none;
  margin: calc(-100% * 44 / 748) 0 0 calc(-100% * 582 / 748);
  user-select: none;
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.35));
}
@keyframes app-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-16px) rotate(2deg); }
}
.app-shadow {
  width: 60%;
  height: 22px;
  margin: 18px auto 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.35), transparent);
  animation: app-shadow 3.6s ease-in-out infinite;
}
@keyframes app-shadow { 50% { transform: scale(0.8); opacity: 0.7; } }

.dl-title {
  font-size: clamp(34px, 4.6vw, 58px);
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: -1px;
  text-wrap: balance;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}
.dl-title .hl { color: var(--green); }
.dl-sub {
  margin-top: 16px;
  max-width: 440px;
  font-size: clamp(17px, 1.7vw, 21px);
  line-height: 1.45;
  font-weight: 700;
  color: #bfe6ff;
}

.stores { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }
.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
  padding: 10px 20px 10px 16px;
  border: 2px solid #3a3a3a;
  border-radius: 16px;
  background: #111;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 5px 0 #000;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}
.store-btn:hover { background: #1f1f1f; }
.store-btn:active { transform: translateY(5px); box-shadow: none; }
.store-btn:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.store-btn span { display: flex; flex-direction: column; font-size: 21px; font-weight: 800; line-height: 1.1; }
.store-btn small { font-size: 12px; font-weight: 700; letter-spacing: 0.4px; opacity: 0.8; }

@media (max-width: 800px) {
  .dl-inner { grid-template-columns: 1fr; gap: 28px; text-align: center; }
  .app-stage { width: min(240px, 60vw); }
  .dl-sub { margin-inline: auto; }
  .stores { justify-content: center; }
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  background: var(--green);
  color: #fff;
  padding: 120px 16px 72px;
}
.footer-cols {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 32px 24px;
  max-width: 1080px;
  margin: 0 auto;
}
.site-footer h3 {
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}
.footer-cols > div > nav + nav { margin-top: 28px; } /* stacked groups in the last column */
.site-footer nav a {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  color: rgba(215, 255, 184, 0.85);
  text-decoration: none;
}
.site-footer a:hover { color: #fff; }
.site-footer a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }

.footer-langs {
  max-width: 1080px;
  margin: 64px auto 0;
  padding-top: 48px;
  border-top: 2px solid rgba(255, 255, 255, 0.35);
}
.footer-langs h3 { font-size: 15px; }
/* full-bleed divider like the real site */
.footer-langs { position: relative; border-top: 0; }
.footer-langs::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 100vw;
  height: 2px;
  translate: -50% 0;
  background: rgba(255, 255, 255, 0.35);
}
.lang-list { display: flex; flex-wrap: wrap; gap: 14px 26px; }
.lang-list a {
  font-size: 13px;
  font-weight: 700;
  color: rgba(215, 255, 184, 0.85);
  text-decoration: none;
}
.lang-list a[aria-current] { color: #fff; }

@media (max-width: 800px) {
  .site-footer { padding-top: 64px; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
}

.streaks-block.still .snow,
.streaks-block.still .fire-lines,
.streaks-block.still .embers { display: none; }

/* little "scroll" mouse at the bottom of the hero */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 4;
  width: 26px;
  height: 40px;
  margin-left: -13px;
  border: 3px solid var(--line);
  border-radius: 14px;
}
.scroll-hint span {
  position: absolute;
  left: 50%;
  top: 7px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--green);
  animation: hint 1.6s ease-in-out infinite;
}
@keyframes hint { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 16px;
    padding-top: 78px;
  }
  .hero-stage { max-width: 260px; }
  h1 { font-size: 24px; margin-bottom: 28px; }
  .lang-picker { font-size: 12px; }
  .logo { font-size: 26px; }
  .level { top: 48%; }
  .tile { font-size: 15px; padding: 7px 11px 6px; }
  .answer { min-height: 112px; background-size: 100% 52px; background-image: linear-gradient(transparent 50px, var(--line) 50px, var(--line) 52px, transparent 52px); }
  .lesson { top: 44%; }
  .panel-copy { top: 9vh; translate: none; text-align: center; left: 16px; right: 16px; width: auto; }
  .frozen-wrap { left: 50%; top: 68%; width: 88vw; }
  .heat { clip-path: circle(var(--r, 0%) at 50% 68%); }
  .heat::before { background: radial-gradient(circle at 50% 68%, #fff8c8 0%, #ffcf3a 35%, transparent 70%); }
  .comet-wrap { left: 50%; top: 66%; width: 92vw; margin: calc(92vw * -1 / 3) 0 0 -46vw; }
  .teachers { left: 50%; top: 66%; width: min(86vw, 52vh); }
  .t-bubble { font-size: 14px; max-width: 180px; }
  .scroll-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint span, .streak, .duo.shake .duo-body, .loader-dots i, .loader-duo, .gold-duo-inner, .gold-duo img, .words.is-correct .tile-word,
  .frozen-img, .comet-fly, .duo.giggle .duo-body, .world-stars, .lang-card.pop,
  .app-float, .app-shadow, .puff { animation: none; }
}
