/* ============ Мир Гарри Поттера — магическая тема ============ */
* { box-sizing: border-box; }

:root {
  --bg: #0d0b16;
  --bg-2: #151127;
  --panel: #1b1633;
  --panel-2: #241d43;
  --line: rgba(255, 255, 255, 0.09);
  --text: #efeaff;
  --muted: #a79fd0;
  --gold: #e8b64c;
  --gold-2: #ffd97a;
  --gryffindor: #e33a3a;
  --slytherin: #3fbf6a;
  --hufflepuff: #e8c33c;
  --ravenclaw: #4a90e2;
  --other: #9a7be0;
  --ok: #46d17f;
  --bad: #ff5f70;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 18px;
  color: var(--text);
  background:
    radial-gradient(1000px 600px at 15% -10%, #2a1e52 0%, transparent 60%),
    radial-gradient(900px 700px at 110% 10%, #10304d 0%, transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 60%, #0a0813 100%);
}

h1, h2, h3, .logo__text, .btn, .chip, .tag, .quiz__counter, .quiz__score, .stat__num {
  font-family: "Cinzel", "Times New Roman", serif;
}

.container { width: min(1140px, 92%); margin: 0 auto; }
.container--narrow { width: min(780px, 92%); }
.hidden { display: none !important; }

/* --- звёзды --- */
.stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.star {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.5;
  animation: twinkle 3s infinite ease-in-out;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.7); }
  50% { opacity: 0.8; transform: scale(1.2); }
}

/* --- шапка --- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(13, 11, 22, 0.78);
  border-bottom: 1px solid var(--line);
}
.header__inner { display: flex; align-items: center; gap: 18px; padding: 14px 0; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo__bolt { font-size: 22px; filter: drop-shadow(0 0 8px var(--gold)); }
.logo__text { font-weight: 800; letter-spacing: 0.5px; font-size: 17px; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: 16px;
  letter-spacing: 0.4px; transition: color 0.2s;
}
.nav a:hover { color: var(--gold-2); }

/* --- кнопки --- */
.btn {
  display: inline-block; cursor: pointer; text-decoration: none;
  border: 1px solid transparent; border-radius: 999px;
  padding: 14px 28px; font-size: 15px; font-weight: 700;
  letter-spacing: 0.6px; transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  color: #2b1c00;
  box-shadow: 0 10px 26px rgba(232, 182, 76, 0.32);
}
.btn--ghost { border-color: rgba(232, 182, 76, 0.5); color: var(--gold-2); background: transparent; }
.btn--small { padding: 9px 18px; font-size: 13px; background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #2b1c00; }
.btn--big { padding: 17px 40px; font-size: 17px; }

/* --- hero --- */
.hero { position: relative; padding: 90px 0 70px; overflow: hidden; }
.hero__inner { position: relative; z-index: 2; }
.hero__eyebrow {
  margin: 0 0 14px; color: var(--gold-2); letter-spacing: 3px;
  text-transform: uppercase; font-size: 13px; font-family: "Cinzel", serif;
}
.hero__title { margin: 0; font-size: clamp(38px, 6vw, 68px); line-height: 1.08; font-weight: 800; }
.hero__title .accent {
  background: linear-gradient(120deg, var(--gold-2), #ff9d4d, var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__lead { max-width: 640px; font-size: 21px; line-height: 1.6; color: var(--muted); }
.hero__lead strong { color: var(--gold-2); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.hero__stats { display: flex; gap: 42px; margin-top: 54px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat__num { font-size: 44px; font-weight: 800; color: var(--gold-2); line-height: 1; }
.stat__label { color: var(--muted); font-size: 15px; letter-spacing: 1px; margin-top: 6px; }
.hero__glow {
  position: absolute; right: -160px; top: -120px; width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(232, 182, 76, 0.22) 0%, transparent 65%);
  filter: blur(10px); z-index: 1;
}

/* --- секции --- */
.section { padding: 70px 0; position: relative; z-index: 2; }
.section--quiz { background: rgba(0, 0, 0, 0.22); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section__title { font-size: clamp(30px, 4vw, 44px); margin: 0 0 12px; text-align: center; }
.section__subtitle { text-align: center; color: var(--muted); max-width: 620px; margin: 0 auto 34px; font-size: 19px; }

/* --- фильтры --- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 32px; }
.chip {
  cursor: pointer; padding: 9px 20px; font-size: 13px; letter-spacing: 0.6px;
  border-radius: 999px; background: var(--panel); color: var(--muted);
  border: 1px solid var(--line); transition: all 0.2s;
}
.chip:hover { color: var(--text); border-color: rgba(232, 182, 76, 0.5); }
.chip--active { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #2b1c00; border-color: transparent; }

/* --- карточки персонажей --- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.card {
  background: linear-gradient(160deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 22px 24px; position: relative; overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; height: 4px; width: 100%;
  background: var(--house, var(--gold));
}
.card:hover { transform: translateY(-6px); border-color: rgba(232, 182, 76, 0.45); box-shadow: var(--shadow); }
.card[data-house="Гриффиндор"] { --house: var(--gryffindor); }
.card[data-house="Слизерин"] { --house: var(--slytherin); }
.card[data-house="Хаффлпафф"] { --house: var(--hufflepuff); }
.card[data-house="Когтевран"] { --house: var(--ravenclaw); }
.card[data-house="Прочие"] { --house: var(--other); }

.card__avatar {
  width: 64px; height: 64px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 30px; margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.06); border: 2px solid var(--house, var(--gold));
  box-shadow: 0 0 22px color-mix(in srgb, var(--house, var(--gold)) 45%, transparent);
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card__name { margin: 0; font-size: 22px; }
.tag {
  font-size: 10.5px; letter-spacing: 0.8px; padding: 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--house, var(--gold)) 22%, transparent);
  color: color-mix(in srgb, var(--house, var(--gold)) 80%, #fff);
  border: 1px solid color-mix(in srgb, var(--house, var(--gold)) 50%, transparent);
  white-space: nowrap;
}
.card__role { margin: 8px 0 10px; color: var(--gold-2); font-style: italic; font-size: 16px; }
.card__text { margin: 0; color: var(--muted); line-height: 1.55; font-size: 17px; }

/* --- тест --- */
.quiz {
  background: linear-gradient(165deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid rgba(232, 182, 76, 0.28);
  border-radius: 24px; padding: 40px clamp(20px, 4vw, 44px);
  box-shadow: var(--shadow);
}
.quiz__start { text-align: center; }
.quiz__crest {
  font-size: 56px; width: 100px; height: 100px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 182, 76, 0.25), transparent 70%);
  animation: float 3.5s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.quiz__start-title { font-size: 28px; margin: 0 0 18px; }
.quiz__rules { list-style: none; padding: 0; margin: 0 auto 28px; max-width: 440px; text-align: left; }
.quiz__rules li {
  position: relative; padding: 9px 0 9px 34px; color: var(--muted); font-size: 17px;
  border-bottom: 1px dashed var(--line);
}
.quiz__rules li::before { content: "⚡"; position: absolute; left: 4px; }
.quiz__rules strong { color: var(--gold-2); }

.quiz__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.quiz__counter, .quiz__score { font-size: 13.5px; letter-spacing: 1px; color: var(--gold-2); }
.progress { height: 9px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; margin-bottom: 26px; }
.progress__bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  border-radius: 999px; transition: width 0.4s ease;
}
.quiz__question { font-size: clamp(20px, 3vw, 26px); line-height: 1.4; margin: 0 0 22px; min-height: 56px; }

.quiz__answers { display: grid; gap: 12px; }
.answer {
  text-align: left; cursor: pointer; font-family: inherit; font-size: 17.5px;
  padding: 15px 18px; border-radius: 14px; color: var(--text);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  transition: all 0.18s; display: flex; gap: 12px; align-items: center;
}
.answer:hover:not(:disabled) { border-color: var(--gold); background: rgba(232, 182, 76, 0.12); transform: translateX(4px); }
.answer:disabled { cursor: default; }
.answer__letter {
  flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.09); font-family: "Cinzel", serif; font-size: 14px; font-weight: 700;
}
.answer--correct { border-color: var(--ok); background: rgba(70, 209, 127, 0.16); }
.answer--correct .answer__letter { background: var(--ok); color: #06230f; }
.answer--wrong { border-color: var(--bad); background: rgba(255, 95, 112, 0.15); }
.answer--wrong .answer__letter { background: var(--bad); color: #2b0007; }

.quiz__feedback { margin-top: 18px; font-size: 17.5px; min-height: 26px; color: var(--muted); }
.quiz__feedback b.ok { color: var(--ok); }
.quiz__feedback b.bad { color: var(--bad); }
.quiz__actions { display: flex; justify-content: flex-end; margin-top: 22px; }

/* --- результат --- */
.quiz__result { text-align: center; }
.quiz__result-emoji { font-size: 64px; animation: float 3s ease-in-out infinite; }
.quiz__result-title { font-size: 32px; margin: 12px 0 6px; }
.quiz__result-score {
  font-family: "Cinzel", serif; font-size: 46px; font-weight: 800; color: var(--gold-2);
  margin-bottom: 10px;
}
.quiz__result-score span { font-size: 22px; color: var(--muted); font-weight: 600; }
.quiz__result-text { color: var(--muted); font-size: 19px; max-width: 480px; margin: 0 auto 26px; line-height: 1.6; }
.quiz__result-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* --- подвал --- */
.site-footer {
  padding: 30px 0 40px; text-align: center; color: var(--muted);
  font-size: 16px; border-top: 1px solid var(--line); position: relative; z-index: 2;
}

@media (max-width: 640px) {
  .nav { display: none; }
  .hero { padding: 56px 0 48px; }
  .hero__stats { gap: 26px; }
  .stat__num { font-size: 34px; }
  .quiz { padding: 28px 18px; }
}
