/* ===== Аватар: Легенда об Аанге — воздушная тема ===== */
* { box-sizing: border-box; }

:root {
  --sky-1: #eaf7ff;
  --sky-2: #bfe6fb;
  --sky-3: #7ec8f0;
  --deep: #0d3b5c;
  --ink: #0b2b45;
  --accent: #0e8fd6;
  --accent-2: #38bdf8;
  --gold: #f4b942;
  --air: #7dd3fc;
  --water: #2563eb;
  --earth: #16a34a;
  --fire: #ef4444;
  --card: rgba(255, 255, 255, .78);
  --radius: 22px;
  --shadow: 0 18px 40px -18px rgba(13, 59, 92, .45);
}

html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 84px; }

body {
  margin: 0;
  font-family: 'Manrope', system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 45%, #a8dcf7 100%);
  overflow-x: hidden;
}

h1, h2, h3, .hero__title { font-family: 'Marcellus', Georgia, serif; font-weight: 400; }

/* ===== Воздушный фон ===== */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud {
  position: absolute;
  background: radial-gradient(circle at 30% 40%, #fff 0 55%, rgba(255,255,255,0) 72%);
  border-radius: 50%;
  filter: blur(2px);
  opacity: .8;
}
.cloud--1 { width: 340px; height: 130px; top: 8%;  left: -12%; animation: drift 55s linear infinite; }
.cloud--2 { width: 260px; height: 100px; top: 42%; right: -14%; animation: drift 70s linear infinite reverse; opacity: .6; }
.cloud--3 { width: 420px; height: 150px; top: 72%; left: -18%; animation: drift 90s linear infinite; opacity: .5; }

.wind {
  position: absolute;
  width: 240px; height: 60px;
  border: 2px solid rgba(255, 255, 255, .75);
  border-color: rgba(255,255,255,.75) transparent transparent transparent;
  border-radius: 50%;
  opacity: .6;
}
.wind--1 { top: 22%; left: 6%;  animation: sway 9s ease-in-out infinite; }
.wind--2 { top: 55%; right: 8%; animation: sway 12s ease-in-out infinite reverse; transform: rotate(180deg); }
.wind--3 { top: 85%; left: 30%; animation: sway 14s ease-in-out infinite; }

@keyframes drift { to { transform: translateX(130vw); } }
@keyframes sway  { 50% { transform: translateX(60px) rotate(6deg); } }

/* ===== Навигация ===== */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .8rem clamp(1rem, 4vw, 3rem);
  background: rgba(234, 247, 255, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(13, 59, 92, .12);
}
.nav__logo {
  font-family: 'Marcellus', serif; font-size: 1.25rem; letter-spacing: .28em;
  text-transform: uppercase; color: var(--deep); text-decoration: none;
}
.nav__arrow { border-bottom: 3px solid var(--accent); padding-bottom: 2px; }
.nav__links { display: flex; align-items: center; gap: clamp(.6rem, 2vw, 1.6rem); flex-wrap: wrap; }
.nav__links a {
  color: var(--deep); text-decoration: none; font-size: .95rem; font-weight: 600;
  padding: .35rem .2rem; border-bottom: 2px solid transparent; transition: .25s;
}
.nav__links a:hover { border-bottom-color: var(--accent); color: var(--accent); }
.nav__cta {
  background: var(--accent); color: #fff !important; padding: .5rem 1.1rem !important;
  border-radius: 999px; border-bottom: none !important; box-shadow: var(--shadow);
}
.nav__cta:hover { background: var(--deep); }

/* ===== Кнопки ===== */
.btn {
  display: inline-block; padding: .85rem 1.9rem; border-radius: 999px;
  font: 600 1rem 'Manrope', sans-serif; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: .25s;
}
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn--primary:hover { transform: translateY(-3px); background: var(--deep); }
.btn--ghost { border-color: var(--deep); color: var(--deep); background: rgba(255,255,255,.5); }
.btn--ghost:hover { background: #fff; transform: translateY(-3px); }

/* ===== Герой ===== */
.hero {
  position: relative; z-index: 1;
  min-height: calc(100vh - 64px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: clamp(2rem, 6vw, 5rem) 1.25rem 3rem;
}
.hero__badge {
  background: rgba(255,255,255,.75); border: 1px solid rgba(13,59,92,.18);
  padding: .4rem 1.1rem; border-radius: 999px; font-size: .85rem; font-weight: 600;
  color: var(--deep); letter-spacing: .06em;
}
.hero__title {
  margin: 1.2rem 0 0; font-size: clamp(2.6rem, 8vw, 5.2rem);
  line-height: 1.05; color: var(--deep);
}
.hero__title em { font-style: normal; color: var(--accent); text-shadow: 0 6px 24px rgba(14,143,214,.35); }
.hero__lead {
  max-width: 46rem; margin: 1.4rem auto 0; font-size: clamp(1rem, 2.4vw, 1.18rem);
  line-height: 1.7; color: #14456b;
}
.hero__actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin-top: 2rem; }
.hero__emblem { margin-top: 2rem; color: var(--accent); animation: float 6s ease-in-out infinite; }
.hero__emblem svg { width: clamp(140px, 30vw, 220px); height: auto; }
@keyframes float { 50% { transform: translateY(-16px) rotate(4deg); } }
.hero__scroll { margin-top: 1.6rem; font-size: .85rem; letter-spacing: .2em; color: #3b7ba6; animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(8px); } }

/* ===== Секции ===== */
.section { position: relative; z-index: 1; padding: clamp(3.5rem, 9vw, 6.5rem) clamp(1rem, 5vw, 4rem); max-width: 1180px; margin: 0 auto; }
.section--alt { max-width: none; background: rgba(255,255,255,.45); border-block: 1px solid rgba(13,59,92,.1); }
.section--alt > * { max-width: 1180px; margin-inline: auto; }
.section__head { text-align: center; margin-bottom: 2.6rem; }
.section__eyebrow {
  text-transform: uppercase; letter-spacing: .3em; font-size: .78rem; font-weight: 800;
  color: var(--accent); background: rgba(14,143,214,.12); padding: .35rem .9rem; border-radius: 999px;
}
.section__title { font-size: clamp(1.7rem, 4.5vw, 2.7rem); color: var(--deep); margin: .9rem 0 0; }
.section__sub { color: #2b6288; margin-top: .6rem; }

/* ===== Завязка ===== */
.story { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.story__card {
  position: relative; background: var(--card); border-radius: var(--radius);
  padding: 1.6rem 1.4rem 1.4rem; box-shadow: var(--shadow);
  border-top: 4px solid var(--accent-2); overflow: hidden; transition: .3s;
}
.story__card:hover { transform: translateY(-8px); box-shadow: 0 26px 50px -20px rgba(13,59,92,.55); }
.story__num {
  position: absolute; top: .4rem; right: .9rem; font-family: 'Marcellus', serif;
  font-size: 3rem; color: rgba(14,143,214,.16);
}
.story__card h3 { margin: 0 0 .5rem; font-size: 1.25rem; color: var(--deep); }
.story__card p { margin: 0; line-height: 1.65; color: #245576; font-size: .96rem; }

.quote {
  margin: 2.6rem auto 0; max-width: 760px; text-align: center;
  font-family: 'Marcellus', serif; font-size: clamp(1.1rem, 2.6vw, 1.45rem);
  line-height: 1.6; color: var(--deep);
  background: rgba(255,255,255,.7); border-radius: var(--radius);
  padding: 2rem 1.6rem; box-shadow: var(--shadow); border-left: 6px solid var(--gold);
}
.quote cite { display: block; margin-top: .9rem; font: 600 .9rem 'Manrope', sans-serif; color: var(--accent); font-style: normal; }

/* ===== Персонажи ===== */
.heroes { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.hero-card {
  display: flex; flex-direction: column; gap: .9rem;
  background: var(--card); border-radius: var(--radius); padding: 1.5rem 1.4rem;
  box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.8);
  border-bottom: 5px solid var(--accent); transition: .3s; outline: none;
}
.hero-card:hover, .hero-card:focus-visible { transform: translateY(-8px) scale(1.02); background: #fff; }
.hero-card--air    { border-bottom-color: var(--air); }
.hero-card--water  { border-bottom-color: var(--water); }
.hero-card--earth  { border-bottom-color: var(--earth); }
.hero-card--fire   { border-bottom-color: var(--fire); }
.hero-card__glyph {
  width: 68px; height: 68px; display: grid; place-items: center; font-size: 2rem;
  border-radius: 50%; background: linear-gradient(145deg, #fff, var(--sky-2));
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.9), var(--shadow);
}
.hero-card:hover .hero-card__glyph { animation: pop .5s ease; }
@keyframes pop { 40% { transform: scale(1.18) rotate(-8deg); } }
.hero-card h3 { margin: 0; font-size: 1.4rem; color: var(--deep); }
.hero-card__tag {
  display: inline-block; font-size: .74rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); background: rgba(14,143,214,.1);
  padding: .25rem .7rem; border-radius: 999px; margin-top: .35rem;
}
.hero-card p { margin: .5rem 0 0; line-height: 1.6; color: #245576; font-size: .95rem; }

/* ===== Почему стоит ===== */
.perks { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.perk { background: rgba(255,255,255,.8); border-radius: var(--radius); padding: 1.5rem 1.3rem; box-shadow: var(--shadow); text-align: center; transition: .3s; }
.perk:hover { transform: translateY(-6px); }
.perk span { font-size: 2.2rem; display: block; }
.perk h3 { color: var(--deep); font-size: 1.15rem; margin: .7rem 0 .4rem; }
.perk p { margin: 0; color: #245576; font-size: .93rem; line-height: 1.6; }

/* ===== Тест ===== */
.quiz {
  max-width: 780px; margin: 0 auto; background: rgba(255,255,255,.88);
  border-radius: 28px; padding: clamp(1.3rem, 4vw, 2.4rem); box-shadow: var(--shadow);
  border: 1px solid #fff;
}
.quiz__hud { margin-bottom: 1.4rem; }
.quiz__progress { height: 10px; background: rgba(13,59,92,.14); border-radius: 999px; overflow: hidden; }
.quiz__progress span { display: block; height: 100%; width: 10%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .45s ease; }
.quiz__meta { display: flex; justify-content: space-between; margin-top: .55rem; font-size: .85rem; font-weight: 700; color: var(--deep); }
.quiz__question { font-size: clamp(1.15rem, 3vw, 1.5rem); color: var(--deep); margin: 0 0 1.2rem; line-height: 1.4; }
.quiz__options { display: grid; gap: .7rem; }
.quiz__opt {
  text-align: left; font: 600 .98rem 'Manrope', sans-serif; color: var(--ink);
  background: var(--sky-1); border: 2px solid rgba(14,143,214,.25); border-radius: 14px;
  padding: .85rem 1.1rem; cursor: pointer; transition: .2s;
}
.quiz__opt:hover:not(:disabled) { border-color: var(--accent); background: #fff; transform: translateX(6px); }
.quiz__opt:disabled { cursor: default; opacity: .85; }
.quiz__opt--right { background: #dcfce7 !important; border-color: var(--earth) !important; color: #14532d !important; }
.quiz__opt--wrong { background: #fee2e2 !important; border-color: var(--fire) !important; color: #7f1d1d !important; }
.quiz__hint { min-height: 1.4rem; margin-top: 1rem; font-size: .93rem; line-height: 1.5; color: var(--accent); font-weight: 600; }
.quiz__screen--result { text-align: center; }
.quiz__medal { font-size: 3.4rem; animation: float 4s ease-in-out infinite; }
.quiz__text { color: #245576; line-height: 1.65; }
.quiz__scoreline { font-family: 'Marcellus', serif; font-size: 1.4rem; color: var(--deep); margin: .8rem 0 1.4rem; }
.fade-in { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } }

/* ===== Фильтр стихий ===== */
.element-filter {
  display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center;
  margin: -1rem 0 2rem;
}
.efilter {
  font: 700 .9rem 'Manrope', sans-serif; color: var(--deep);
  background: rgba(255,255,255,.8); border: 2px solid rgba(14,143,214,.25);
  padding: .5rem 1.1rem; border-radius: 999px; cursor: pointer; transition: .22s;
}
.efilter:hover { transform: translateY(-3px); border-color: var(--accent); }
.efilter--active { background: var(--deep); color: #fff; border-color: var(--deep); }
.efilter--air.efilter--active    { background: var(--air);    border-color: var(--air);    color: #083344; }
.efilter--water.efilter--active  { background: var(--water);  border-color: var(--water);  color: #fff; }
.efilter--earth.efilter--active  { background: var(--earth);  border-color: var(--earth);  color: #fff; }
.efilter--fire.efilter--active   { background: var(--fire);   border-color: var(--fire);   color: #fff; }
.hero-card.is-hidden { display: none; }

/* ===== Карусель цитат ===== */
.section--quotes { padding-top: clamp(2rem, 6vw, 4rem); }
.qcarousel {
  max-width: 760px; margin: 0 auto; text-align: center;
  background: rgba(255,255,255,.82); border-radius: 28px;
  padding: clamp(1.6rem, 5vw, 3rem); box-shadow: var(--shadow);
  border-top: 5px solid var(--accent-2); position: relative;
}
.qcarousel__mark { font-size: 3.4rem; line-height: 1; color: var(--accent); font-family: 'Marcellus', serif; }
.qcarousel__text {
  margin: .6rem auto 0; font-family: 'Marcellus', serif;
  font-size: clamp(1.15rem, 3vw, 1.6rem); line-height: 1.55; color: var(--deep);
  min-height: 4.5em;
}
.qcarousel__author { margin-top: .8rem; font-weight: 800; color: var(--accent); letter-spacing: .05em; }
.qcarousel__dots { display: flex; gap: .5rem; justify-content: center; margin-top: 1.4rem; }
.qdot {
  width: 11px; height: 11px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(13,59,92,.22); padding: 0; transition: .25s;
}
.qdot--active { background: var(--accent); transform: scale(1.35); }
.q-fade { animation: fadeIn .45s ease; }

/* ===== Галерея наций ===== */
.section--nations {
  max-width: none; background: rgba(255,255,255,.4);
  border-block: 1px solid rgba(13,59,92,.1);
  transition: background .8s ease;
}
.section--nations > * { max-width: 1180px; margin-inline: auto; }
.section--nations.nation-glow--air    { background: rgba(125,211,252,.32); }
.section--nations.nation-glow--water  { background: rgba(96,165,250,.28); }
.section--nations.nation-glow--earth  { background: rgba(74,222,128,.24); }
.section--nations.nation-glow--fire   { background: rgba(248,113,113,.24); }
.nations { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.nation {
  background: rgba(255,255,255,.85); border-radius: var(--radius);
  padding: 1.7rem 1.5rem; box-shadow: var(--shadow); transition: .35s;
  border-bottom: 6px solid var(--air);
}
.nation:hover { transform: translateY(-8px); background: #fff; }
.nation--water { border-bottom-color: var(--water); }
.nation--earth { border-bottom-color: var(--earth); }
.nation--fire  { border-bottom-color: var(--fire); }
.nation__badge {
  width: 74px; height: 74px; display: grid; place-items: center; font-size: 2.2rem;
  border-radius: 50%; background: linear-gradient(145deg, #fff, var(--sky-2));
  box-shadow: var(--shadow); margin-bottom: .9rem;
}
.nation:hover .nation__badge { animation: pop .5s ease; }
.nation h3 { margin: 0; font-size: 1.35rem; color: var(--deep); }
.nation__tag {
  display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); background: rgba(14,143,214,.1);
  padding: .22rem .65rem; border-radius: 999px; margin-top: .4rem;
}
.nation p { color: #245576; line-height: 1.62; font-size: .94rem; }
.nation__fact { font-size: .84rem; color: var(--deep); background: var(--sky-1); border-radius: 12px; padding: .55rem .8rem; }

/* ===== Мини-игра «Собери стихии» ===== */
.game {
  max-width: 900px; margin: 0 auto; background: rgba(255,255,255,.88);
  border-radius: 28px; padding: clamp(1.1rem, 3.5vw, 2rem); box-shadow: var(--shadow);
}
.game__hud { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.game__stat {
  font: 700 .92rem 'Manrope', sans-serif; color: var(--deep);
  background: var(--sky-1); border-radius: 999px; padding: .4rem .9rem;
}
.btn--small { padding: .5rem 1.3rem; font-size: .9rem; }
.game__targets { display: grid; gap: .7rem; grid-template-columns: repeat(4, 1fr); }
.gtarget {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  font-size: 1.7rem; padding: .9rem .4rem; border-radius: 16px; cursor: pointer;
  background: var(--sky-1); border: 3px dashed rgba(13,59,92,.3); transition: .2s;
}
.gtarget span { font: 800 .78rem 'Manrope', sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--deep); }
.gtarget--air   { background: rgba(125,211,252,.35); }
.gtarget--water { background: rgba(96,165,250,.3); }
.gtarget--earth { background: rgba(74,222,128,.3); }
.gtarget--fire  { background: rgba(248,113,113,.3); }
.gtarget.is-over { transform: scale(1.06); border-style: solid; border-color: var(--deep); box-shadow: var(--shadow); }
.gtarget.is-hit { animation: hitPulse .5s ease; }
@keyframes hitPulse { 40% { transform: scale(1.14); } }

.game__pool {
  margin-top: 1rem; min-height: 120px; display: flex; flex-wrap: wrap;
  gap: .7rem; align-items: center; justify-content: center;
  background: rgba(13,59,92,.06); border-radius: 18px; padding: .9rem;
}
.game__placeholder { margin: 0; color: #3b7ba6; font-size: .95rem; text-align: center; width: 100%; }
.gcard {
  font: 700 .95rem 'Manrope', sans-serif; color: var(--deep); cursor: grab;
  background: #fff; border: 2px solid rgba(14,143,214,.35); border-radius: 14px;
  padding: .7rem 1.1rem; box-shadow: var(--shadow); transition: .2s; user-select: none;
}
.gcard:hover { transform: translateY(-4px) rotate(-1deg); border-color: var(--accent); }
.gcard.is-selected { border-color: var(--accent); background: var(--sky-1); transform: translateY(-4px); box-shadow: 0 0 0 3px rgba(14,143,214,.3); }
.gcard:active { cursor: grabbing; }
.gcard.is-right { animation: flyRight .45s ease forwards; }
.gcard.is-wrong { animation: shake .4s ease; border-color: var(--fire); }
@keyframes flyRight { to { transform: translateY(-40px) scale(.4); opacity: 0; } }
@keyframes shake { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
.game__msg { margin-top: .9rem; text-align: center; font-weight: 800; color: var(--deep); min-height: 1.4rem; }
.game__msg--good { color: var(--earth); }
.game__msg--bad  { color: var(--fire); }

/* ===== Конструктор аватара ===== */
.lab {
  display: grid; gap: 1.6rem; grid-template-columns: minmax(280px, 1fr) minmax(300px, 420px);
  align-items: start; background: rgba(255,255,255,.85); border-radius: 28px;
  padding: clamp(1.2rem, 4vw, 2.2rem); box-shadow: var(--shadow);
}
@media (max-width: 780px) { .lab { grid-template-columns: 1fr; } .game__targets { grid-template-columns: repeat(2, 1fr); } }
.lab__group { margin-bottom: 1.1rem; }
.lab__label {
  display: block; font-size: .78rem; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); margin-bottom: .5rem;
}
.lab__input {
  width: 100%; font: 600 1.05rem 'Manrope', sans-serif; color: var(--deep);
  background: var(--sky-1); border: 2px solid rgba(14,143,214,.3);
  border-radius: 14px; padding: .75rem 1rem; outline: none; transition: .2s;
}
.lab__input:focus { border-color: var(--accent); background: #fff; }
.lab__chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  font: 700 .9rem 'Manrope', sans-serif; color: var(--deep); cursor: pointer;
  background: var(--sky-1); border: 2px solid rgba(14,143,214,.25);
  padding: .5rem 1rem; border-radius: 999px; transition: .22s;
}
.chip:hover { transform: translateY(-3px); border-color: var(--accent); }
.chip--active { background: var(--deep); color: #fff; border-color: var(--deep); }
.lab__actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.4rem; }
.lab__preview { text-align: center; }
#avCanvas {
  width: 100%; max-width: 340px; height: auto; border-radius: 22px;
  box-shadow: 0 24px 48px -20px rgba(13,59,92,.6); background: var(--sky-2);
}
.lab__hint { margin: .9rem 0 0; font-size: .9rem; font-weight: 700; color: var(--deep); }

/* ===== Кнопка «наверх» ===== */
.totop {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 1.4rem;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(16px);
  transition: .3s;
}
.totop.is-visible { opacity: 1; pointer-events: auto; transform: none; }
.totop:hover { background: var(--deep); }

/* ===== Подвал ===== */
.footer {
  position: relative; z-index: 1; text-align: center; padding: 2.6rem 1rem;
  background: var(--deep); color: #cde9fb; margin-top: 3rem;
}
.footer p { margin: .3rem 0; }
.footer__muted { color: #7db8dd; font-size: .85rem; letter-spacing: .12em; }

@media (max-width: 560px) {
  .nav__links a:not(.nav__cta) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
