:root {
  --bg-deep: #070b13;
  --bg-mid: #111a2a;
  --panel: rgba(14, 18, 26, 0.78);
  --panel-alt: rgba(26, 34, 49, 0.9);
  --gold: #d8b76c;
  --gold-soft: #f4d796;
  --stone: #d8d0c4;
  --text: #eef3ff;
  --muted: #bfc7d9;
  --red: #8d1d1d;
  --green: #214f36;
  --blue: #2d4a7a;
  --yellow: #c7a52e;
  --shadow: rgba(0, 0, 0, 0.35);
  --luxury-glow: rgba(212, 176, 98, 0.32);
  --house-primary: #d8b76c;
  --house-secondary: #f4d796;
  --house-deep: #111a2a;
  --house-glow: rgba(212, 176, 98, 0.32);
  --parchment-clip: polygon(
    0% 1%, 7% 3%, 14% 0%, 21% 2%, 28% 4%, 35% 1%, 42% 3%, 49% 0%, 56% 2%, 63% 4%,
    70% 1%, 77% 3%, 84% 0%, 91% 2%, 100% 1%,
    100% 99%, 91% 97%, 84% 100%, 77% 98%, 70% 96%, 63% 99%, 56% 97%, 49% 100%, 42% 98%, 35% 96%,
    28% 99%, 21% 97%, 14% 100%, 7% 98%, 0% 99%
  );
  /* Foto de textura de papel envelhecido (files/letter.jpg), usada como base do envelope e da carta. */
  --paper-photo: url("files/letter.jpg");
}

body[data-house="gryffindor"] {
  --house-primary: #a11d22;
  --house-secondary: #f0c76e;
  --house-deep: #20110d;
  --house-glow: rgba(161, 29, 34, 0.34);
}

body[data-house="ravenclaw"] {
  --house-primary: #2b5d97;
  --house-secondary: #a2d1ff;
  --house-deep: #0c1d30;
  --house-glow: rgba(43, 93, 151, 0.34);
}

body[data-house="hufflepuff"] {
  --house-primary: #d7a93f;
  --house-secondary: #f4db92;
  --house-deep: #2a2013;
  --house-glow: rgba(215, 169, 63, 0.3);
}

body[data-house="slytherin"] {
  --house-primary: #214d38;
  --house-secondary: #9ccd86;
  --house-deep: #0d1f1a;
  --house-glow: rgba(33, 77, 56, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Poppins", "Inter", sans-serif;
  background:
    radial-gradient(circle at 20% 20%, var(--house-glow), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(168, 124, 52, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(7, 9, 15, 0.85), rgba(11, 15, 23, 0.9)),
    url("https://images.unsplash.com/photo-1511125357779-27038c2b13db?auto=format&fit=crop&w=1600&q=80") center/cover no-repeat fixed;
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 15, 22, 0.15), rgba(10, 15, 22, 0.7));
}

img {
  max-width: 100%;
  display: block;
}

button,
input {
  font: inherit;
}

.cover-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(23, 27, 37, 0.28), rgba(6, 9, 14, 0.92) 55%),
    linear-gradient(180deg, rgba(10, 12, 18, 0.76), rgba(10, 12, 18, 0.92));
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.cover-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cover-screen__mist {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(216, 183, 108, 0.04), rgba(255,255,255,0.02));
}

.letter-scene {
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 1;
  animation: letterFloat 6s ease-in-out infinite;
}

.envelope {
  position: relative;
  width: min(620px, 75vw);
  height: 390px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background:
    linear-gradient(rgba(240, 224, 188, 0.4), rgba(240, 224, 188, 0.4)),
    var(--paper-photo) center/cover no-repeat,
    radial-gradient(ellipse at 10% 12%, rgba(120, 84, 34, 0.3), transparent 36%),
    radial-gradient(ellipse at 90% 88%, rgba(120, 84, 34, 0.32), transparent 42%),
    radial-gradient(ellipse at 78% 10%, rgba(150, 105, 45, 0.2), transparent 30%),
    radial-gradient(ellipse at 8% 85%, rgba(150, 105, 45, 0.2), transparent 32%),
    linear-gradient(160deg, #ecdcb0 0%, #d9c18d 45%, #c1a778 100%);
  border: 1px solid rgba(120, 84, 34, 0.4);
  box-shadow: 0 42px 90px rgba(0, 0, 0, 0.55), inset 0 0 28px rgba(255, 255, 255, 0.15);
  transition: transform 0.7s ease, filter 0.7s ease;
  animation: envelopeGlow 7s ease-in-out infinite;
}

.envelope:hover {
  transform: translateY(-6px);
  filter: brightness(1.05);
}

.envelope__back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background:
    linear-gradient(rgba(240, 224, 188, 0.4), rgba(240, 224, 188, 0.4)),
    var(--paper-photo) center/cover no-repeat,
    linear-gradient(180deg, rgba(221, 201, 156, 0.9), rgba(193, 164, 114, 0.95));
}

.envelope__flap-shadow {
  position: absolute;
  top: 7px;
  left: 0;
  width: 100%;
  height: 50%;
  background: rgba(15, 9, 3, 0.55);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: blur(4px);
  transition: opacity 0.4s ease;
  z-index: 1;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.envelope__flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background:
    linear-gradient(rgba(240, 224, 188, 0.4), rgba(240, 224, 188, 0.4)),
    var(--paper-photo) center/cover no-repeat,
    radial-gradient(ellipse at 25% 30%, rgba(120, 84, 34, 0.18), transparent 40%),
    linear-gradient(180deg, rgba(224, 204, 160, 0.98), rgba(179, 150, 101, 0.98));
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.3s ease;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.3));
  z-index: 2;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.envelope__seal {
  position: absolute;
  top: 38px;
  left: 50%;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 46% 54% 55% 45% / 48% 42% 58% 52%;
  transform: translate(-50%, 0) rotate(-6deg);
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.4), transparent 42%),
    radial-gradient(circle at 68% 74%, rgba(0, 0, 0, 0.3), transparent 55%),
    radial-gradient(circle, #a8271f 0%, #7c1712 55%, #45100c 100%);
  border: 1px solid rgba(255, 205, 130, 0.35);
  color: #f4d9a0;
  font-family: "Cinzel Decorative", "Cinzel", serif;
  font-weight: 700;
  font-size: 2rem;
  z-index: 3;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.45), inset 0 0 12px rgba(0, 0, 0, 0.4), 0 0 22px rgba(168, 39, 31, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  transition: opacity 0.4s ease 0.1s, transform 0.5s ease 0.1s;
}

.letter-card {
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(460px, 74%);
  min-height: 270px;
  padding: 15px;
  clip-path: var(--parchment-clip);

  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%) translateY(28px);
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.7s ease;
  z-index: 1;
}

.letter-card__inner {
  position: relative;
  width: 100%;
  padding: 200px 10px 20px 10px;
  font-family: "Cinzel Decorative", "Cinzel", serif;
  font-size: .8rem;
  font-weight: 700;
   color: #2a1c0f;
  text-align: center;
}




.seal-dot {
  width: 20px;
  height: 20px;
  margin: 18px auto 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d6534a 0%, #8d1f16 55%, #45100c 100%);
  box-shadow: 0 0 14px rgba(141, 31, 22, 0.5);
}

.letter-scene.open .envelope__flap {
  transform: rotateX(180deg) translateY(-8px);
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.3)) brightness(1.1);
}

.letter-scene.open .envelope__flap-shadow {
  opacity: 0;
}

.letter-scene.open .envelope__seal {
  opacity: 0;
  transform: translate(-50%, -34px) rotate(30deg) scale(0.55);
}

.letter-scene.open .letter-card {
  transform: translate(-50%, -62%) translateY(-18px) rotate(-1deg);
  box-shadow: 0 32px 58px rgba(0, 0, 0, 0.3);
}

.letter-scene.open .envelope {
  animation: envelopeOpen 0.7s ease forwards;
}

@keyframes envelopeOpen {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  35% {
    transform: scale(1.035);
    filter: brightness(1.18);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.page-shell {
  position: relative;
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 90px;
  z-index: 1;
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.page-shell.visible {
  opacity: 1;
  transform: translateY(0);
}

.page-shell.hidden {
  display: block;
}

.sparkles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  z-index: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.8) 1px, transparent 1.5px),
    radial-gradient(circle, rgba(212,176,98,0.8) 1px, transparent 1.8px);
  background-size: 150px 150px;
  background-position: center;
}

.topbar {
  position: relative;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  height: 74px;
  padding: 16px 0 0;
  transition: height 0.3s ease;
}

.topbar--scrolled {
  height: 56px;
}

.topbar--scrolled .house-picker__label {
  font-size: 0.7rem;
}

.topbar--scrolled .house__image {
  max-height: 52px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.74rem;
  color: var(--gold-soft);
}

.crest {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(216, 183, 108, 0.5);
  box-shadow: 0 0 20px rgba(216, 183, 108, 0.25);
  color: var(--house-secondary);
}

.house-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: start;
  gap: 8px;
}

.house-picker__label {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-soft);
  white-space: nowrap;
  transition: font-size 0.3s ease;
}

.house-picker__flags {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.house {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 4px 4px 10px;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.house__image {
  display: block;
  width: auto;
  height: auto;
  max-height: 88px;
  object-fit: contain;
  transition: filter 0.3s ease, transform 0.3s ease, max-height 0.3s ease;
}

.house::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  transition: transform 0.25s ease;
}

.house:hover::after,
.house:focus-visible::after,
.house.selected::after {
  transform: translateX(-50%) scaleX(1);
}

.house:hover .house__image,
.house.selected .house__image {
  transform: translateY(-3px) scale(1.12);
}

.house__image--gryffindor {
  filter: drop-shadow(0 4px 8px rgba(161, 29, 34, 0.55));
}

.house__image--ravenclaw {
  filter: drop-shadow(0 4px 8px rgba(43, 93, 151, 0.55));
}

.house__image--hufflepuff {
  filter: drop-shadow(0 4px 8px rgba(215, 169, 63, 0.55));
}

.house__image--slytherin {
  filter: drop-shadow(0 4px 8px rgba(33, 77, 56, 0.55));
}

.house:hover .house__image--gryffindor,
.house.selected .house__image--gryffindor {
  filter: drop-shadow(0 0 12px rgba(161, 29, 34, 0.9));
}

.house:hover .house__image--ravenclaw,
.house.selected .house__image--ravenclaw {
  filter: drop-shadow(0 0 12px rgba(43, 93, 151, 0.9));
}

.house:hover .house__image--hufflepuff,
.house.selected .house__image--hufflepuff {
  filter: drop-shadow(0 0 12px rgba(215, 169, 63, 0.9));
}

.house:hover .house__image--slytherin,
.house.selected .house__image--slytherin {
  filter: drop-shadow(0 0 12px rgba(33, 77, 56, 0.9));
}

.nav {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 24px;
}

.nav a {
  position: relative;
  color: var(--stone);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s ease;
}

.nav a:hover::after,
.nav a:focus-visible::after {
  transform: scaleX(1);
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: 2px;
  min-height: 760px;
  padding-top: 38px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--gold-soft);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

body[data-house="gryffindor"] .eyebrow,
body[data-house="gryffindor"] .brand,
body[data-house="gryffindor"] .label,
body[data-house="gryffindor"] .story-card__content span {
  color: var(--house-secondary);
}

body[data-house="ravenclaw"] .eyebrow,
body[data-house="ravenclaw"] .brand,
body[data-house="ravenclaw"] .label,
body[data-house="ravenclaw"] .story-card__content span {
  color: var(--house-secondary);
}

body[data-house="hufflepuff"] .eyebrow,
body[data-house="hufflepuff"] .brand,
body[data-house="hufflepuff"] .label,
body[data-house="hufflepuff"] .story-card__content span {
  color: var(--house-secondary);
}

body[data-house="slytherin"] .eyebrow,
body[data-house="slytherin"] .brand,
body[data-house="slytherin"] .label,
body[data-house="slytherin"] .story-card__content span {
  color: var(--house-secondary);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Cinzel Decorative", "Cinzel", serif;
}

.hero h1 {
  font-size: clamp(3.5rem, 4vw, 6rem);
  line-height: 0.98;
  letter-spacing: 0.02em;
  text-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.hero h1 span {
  display: block;
  font-size: .48em;
  color: var(--gold-soft);
  margin-top: 6px;
}

.lead {
  max-width: 560px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.8;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.5rem;
  border-radius: 999px;
  border: 1px solid rgba(216, 183, 108, 0.45);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  text-decoration: none;
  font-weight: 600;
}

.button:hover {
  transform: translateY(-2px);
}

.button--primary {
  background: linear-gradient(135deg, var(--house-primary), var(--house-secondary));
  color: #132028;
  box-shadow: 0 18px 30px rgba(183, 133, 40, 0.25);
}

.button--ghost {
  background: rgba(10, 15, 22, 0.3);
  color: var(--text);
}

.hero__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 18px;
  margin-top: 34px;
  max-width: 640px;
}

.hero__meta div {
  background: rgba(10, 15, 22, 0.38);
  border: 1px solid rgba(216, 183, 108, 0.2);
  border-radius: 18px;
  padding: 18px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.hero__meta span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero__meta strong {
  display: block;
  margin-top: 8px;
  font-size: 1.25rem;
  font-family: "Cinzel", serif;
  color: var(--gold-soft);
}

.hero__meta-local strong {
  font-size: 1.05rem;
  line-height: 1.3;
}

.hero__meta-local small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.hero__meta strong#countdown {
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.hero__visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 560px;
  transform-style: preserve-3d;
  perspective: 1000px;
  animation: slowSpin 20s ease-in-out infinite alternate;
}

.hero__visual::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  border: 1px solid rgba(212, 176, 98, 0.28);
  box-shadow: inset 0 0 30px rgba(212, 176, 98, 0.08), 0 0 40px rgba(212, 176, 98, 0.12);
  animation: pulse 8s ease-in-out infinite;
}

.castle-image {
  position: relative;
  width: min(540px, 100%);
  height: 520px;
  background: url("files/Gryffindor/pergaminho.png") center/contain no-repeat;
  filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.45));
  transform: rotate(2deg) translateZ(18px);
  animation: floatCastle 8s ease-in-out infinite;
}

body[data-house="gryffindor"] .castle-image {
  background-image: url("files/Gryffindor/pergaminho.png");
}

body[data-house="ravenclaw"] .castle-image {
  background-image: url("files/Ravenclaw/pergaminho.png");
}

body[data-house="hufflepuff"] .castle-image {
  background-image: url("files/Hufflepuff/pergaminho.png");
}

body[data-house="slytherin"] .castle-image {
  background-image: url("files/Slytherin/pergaminho.png");
}

.castle-image::before {
  content: "";
  position: absolute;
  inset: 12% 10% auto auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 183, 108, 0.3), transparent 70%);
  filter: blur(16px);
}

.spell-circle {
  position: absolute;
  width: 440px;
  height: 440px;
  border: 1px solid rgba(212, 176, 98, 0.34);
  border-radius: 50%;
  box-shadow: inset 0 0 30px rgba(212, 176, 98, 0.08), 0 0 30px rgba(212, 176, 98, 0.1);
  animation: pulse 8s ease-in-out infinite;
}

.floating-card {
  position: absolute;
  z-index: 2;
  padding: 18px 18px 14px;
  border-radius: 18px;
  background: rgba(10, 14, 22, 0.76);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(216, 183, 108, 0.35);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  animation: driftCard 7s ease-in-out infinite;
}

.floating-card--big {
  top: 60px;
  left: 40px;
  transform: rotate(-7deg) translateZ(30px);
  animation-delay: 0.3s;
}

.floating-card--small {
  right: 0;
  bottom: 110px;
  transform: rotate(9deg) translateZ(40px);
  animation-delay: 1.2s;
}

.label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.floating-card h3 {
  margin-top: 10px;
  font-size: 1.3rem;
}

.floating-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
}

.gallery,
.story,
.mini-game,
.rsvp {
  padding-top: 80px;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 26px;
}

.section-heading h2 {
  font-size: clamp(2rem, 2.4vw, 3rem);
  line-height: 1.2;
}

/* Divisor decorativo (estrela + losango + linha) */

.eyebrow--divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.eyebrow--divider::before,
.eyebrow--divider::after {
  content: "";
  flex: 0 0 auto;
  width: 84px;
  height: 6.5px;
  background: url("files/before.svg") no-repeat center / contain;
}

.eyebrow--divider::after {
  background-image: url("files/after.svg");
  transform: scaleX(-1);
}

/* Título "Desafio de Hogwarts" com o Chapéu Seletor ao lado */

.section-heading--jogo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  max-width: none;
  text-align: center;
}

.section-heading__hat {
  flex: 0 0 auto;
  width: 96px;
  height: auto;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.45));
}

.section-heading__text {
  max-width: 520px;
  min-width: 0;
}

/* Rodapé */

.site-footer {
  background: linear-gradient(180deg, transparent 0%, rgba(18, 14, 32, 0.92) 55%, #0d0a1b 100%);
}

.site-footer__inner {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 34px;
  text-align: center;
}

.site-footer__note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer__village {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 -6px 24px rgba(124, 109, 226, 0.22));
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
}

.gallery-card {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  min-height: 280px;
  padding: 20px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(216, 183, 108, 0.2);
  background-size: cover;
  background-position: center;
  box-shadow: 0 26px 40px rgba(0, 0, 0, 0.15);
  animation: galleryFloat 10s ease-in-out infinite;
}

.gallery-card:nth-child(2n) {
  animation-delay: 1.3s;
}

.gallery-card:nth-child(3n) {
  animation-delay: 2.2s;
}

.gallery-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 13, 18, 0.12), rgba(9, 13, 18, 0.75));
}

.gallery-card span {
  position: relative;
  z-index: 1;
  font-family: "Cinzel", serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f7e7bf;
  font-size: 0.8rem;
}

.gallery-card--owl {
  background-image: url("https://images.unsplash.com/photo-1517849845537-4d257902454a?auto=format&fit=crop&w=900&q=80");
}

.gallery-card--wand {
  background-image: url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=900&q=80");
}

.gallery-card--castle {
  background-image: url("https://images.unsplash.com/photo-1460661419201-fd4cecdf8a8b?auto=format&fit=crop&w=1200&q=80");
}

.gallery-card--glow {
  background-image: url("https://images.unsplash.com/photo-1524995997946-a1c2e315a42f?auto=format&fit=crop&w=1200&q=80");
}

.story-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 20px;
}

.story-card {
  overflow: hidden;
  min-height: 360px;
  background: rgba(20, 25, 35, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
}

.large-card {
  grid-row: span 2;
}

.story-card__image {
  height: 220px;
  background-size: cover;
  background-position: center;
}

.image-one {
  background-image: linear-gradient(180deg, rgba(9, 12, 18, 0.15), rgba(9, 12, 18, 0.55)), url("https://images.unsplash.com/photo-1460661419201-fd4cecdf8a8b?auto=format&fit=crop&w=1200&q=80");
}

.image-two {
  background-image: linear-gradient(180deg, rgba(9, 12, 18, 0.15), rgba(9, 12, 18, 0.55)), url("https://images.unsplash.com/photo-1518756131217-31eb79b20e8f?auto=format&fit=crop&w=1200&q=80");
}

.image-three {
  background-image: linear-gradient(180deg, rgba(9, 12, 18, 0.15), rgba(9, 12, 18, 0.55)), url("https://images.unsplash.com/photo-1524995997946-a1c2e315a42f?auto=format&fit=crop&w=1200&q=80");
}

.large-card .story-card__image {
  height: 360px;
}

.story-card__content {
  padding: 18px 18px 22px;
}

.story-card__content span {
  color: var(--gold-soft);
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.story-card__content h3 {
  margin-top: 12px;
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 1.25;
}

.story-card__content p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.8;
}

.game-panel {
  background: rgba(7, 13, 20, 0.7);
  border: 1px solid rgba(216, 183, 108, 0.24);
  border-radius: 28px;
  padding: 24px;
}

.game-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
}

.game-panel__header span {
  display: block;
  margin-bottom: 8px;
  color: var(--gold-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.game-panel__header strong {
  font-family: "Cinzel", serif;
  font-size: 2.1rem;
}

.game-panel__header strong.low {
  color: #e2645a;
}

.game-panel__hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.game-panel__hint.game-over,
.game-panel__hint.win {
  color: var(--gold-soft);
}

/* Tabs */

.game-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.game-tab {
  flex: 1 1 160px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(216, 183, 108, 0.25);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.game-tab:hover {
  transform: translateY(-2px);
  border-color: rgba(216, 183, 108, 0.5);
}

.game-tab.active {
  background: linear-gradient(135deg, var(--house-primary), var(--house-secondary));
  border-color: transparent;
  color: #132028;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.game-view {
  animation: fadeInView 0.35s ease;
}

@keyframes fadeInView {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Memory game */

.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.memory-card {
  aspect-ratio: 1;
  perspective: 800px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.memory-card__inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-style: preserve-3d;
}

.memory-card.flipped .memory-card__inner,
.memory-card.matched .memory-card__inner {
  transform: rotateY(180deg);
}

.memory-card__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 16px;
  backface-visibility: hidden;
  font-size: clamp(1.5rem, 2.4vw, 2.3rem);
}

.memory-card__face--back {
  background: radial-gradient(circle at top, rgba(255,255,255,0.08), rgba(10,12,18,0.92));
  border: 1px solid rgba(216, 183, 108, 0.3);
  color: rgba(216, 183, 108, 0.55);
}

.memory-card__face--front {
  background: linear-gradient(160deg, #ecdcb0, #c8a86b);
  border: 1px solid rgba(120, 84, 34, 0.4);
  color: #2a1c0f;
  transform: rotateY(180deg);
}

.memory-card.matched .memory-card__face--front {
  background: linear-gradient(160deg, var(--house-secondary), var(--house-primary));
}

/* Quidditch */

.quidditch-field {
  position: relative;
  height: 260px;
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.06), transparent 55%),
    linear-gradient(180deg, rgba(20, 40, 30, 0.55), rgba(8, 14, 12, 0.85));
  border: 1px solid rgba(216, 183, 108, 0.2);
  overflow: hidden;
  margin-bottom: 20px;
}

.quidditch-hoop {
  position: absolute;
  top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--gold-soft);
  font-family: "Cinzel", serif;
  font-size: 0.82rem;
}

.quidditch-hoop--left {
  left: 10%;
}

.quidditch-hoop--right {
  right: 10%;
}

.quidditch-hoop--center {
  left: 50%;
  transform: translateX(-50%);
}

.quidditch-hoop__ring {
  border-radius: 50%;
  border: 6px solid rgba(216, 183, 108, 0.7);
  box-shadow: 0 0 18px rgba(216, 183, 108, 0.2), inset 0 0 12px rgba(0, 0, 0, 0.4);
  background: rgba(0, 0, 0, 0.15);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.quidditch-hoop--left .quidditch-hoop__ring,
.quidditch-hoop--right .quidditch-hoop__ring {
  width: 54px;
  height: 54px;
}

.quidditch-hoop--center .quidditch-hoop__ring {
  width: 86px;
  height: 86px;
}

.quidditch-hoop.scored .quidditch-hoop__ring {
  border-color: var(--gold-soft);
  box-shadow: 0 0 30px rgba(216, 183, 108, 0.75);
}

.quidditch-aim {
  position: absolute;
  top: 168px;
  left: 10%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold-soft);
  box-shadow: 0 0 14px rgba(216, 183, 108, 0.6);
  animation: aimMove 1.6s ease-in-out infinite alternate;
}

.quidditch-field.throwing .quidditch-aim {
  animation-play-state: paused;
}

@keyframes aimMove {
  from {
    left: 10%;
  }
  to {
    left: calc(90% - 14px);
  }
}

.quidditch-ball {
  position: absolute;
  top: 206px;
  left: 50%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f2846f, #a1281a);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%);
  transition: top 0.6s cubic-bezier(0.3, 0.6, 0.2, 1), left 0.6s cubic-bezier(0.3, 0.6, 0.2, 1);
  color: transparent;
  font-size: 0;
}

.quidditch-throw {
  width: 100%;
}

.quidditch-throw:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Chess */

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(420px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(216, 183, 108, 0.35);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.chess-square {
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
}

.chess-square--light {
  background: #e9d3a3;
}

.chess-square--dark {
  background: #6b4a2b;
}

.chess-square.selected {
  box-shadow: inset 0 0 0 3px var(--gold-soft);
}

.chess-square.legal-move::after {
  content: "";
  position: absolute;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.3);
}

.chess-square.legal-move.has-piece::after {
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: rgba(161, 29, 34, 0.32);
}

.chess-piece {
  line-height: 1;
  font-size: clamp(1.4rem, 4.2vw, 2.2rem);
}

.chess-piece--white {
  color: #fdf6e3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 8px rgba(255, 255, 255, 0.2);
}

.chess-piece--black {
  color: #16110b;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.12);
}

.rsvp__card {
  background: linear-gradient(135deg, rgba(12, 16, 24, 0.8), rgba(20, 29, 38, 0.9));
  border: 1px solid rgba(216, 183, 108, 0.25);
  border-radius: 30px;
  padding: 30px;
}

.rsvp__card h2 {
  max-width: 700px;
  font-size: clamp(2rem, 2.5vw, 3rem);
}

.rsvp__form {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 26px;
}

.rsvp__form input {
  flex: 1 1 290px;
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(10, 14, 20, 0.72);
  color: var(--text);
  padding: 0 18px;
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@keyframes envelopeGlow {
  0%, 100% {
    box-shadow: 0 42px 90px rgba(0, 0, 0, 0.55), inset 0 0 28px rgba(255,255,255,0.04), 0 0 0 rgba(216, 183, 108, 0);
  }
  50% {
    box-shadow: 0 42px 90px rgba(0, 0, 0, 0.58), inset 0 0 28px rgba(255,255,255,0.04), 0 0 28px rgba(216, 183, 108, 0.18);
  }
}

@keyframes letterFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes floatCastle {
  0%, 100% {
    transform: rotate(2deg) translateY(0px) translateZ(18px);
  }
  50% {
    transform: rotate(2deg) translateY(-12px) translateZ(18px);
  }
}

@keyframes driftCard {
  0%, 100% {
    transform: rotate(-7deg) translateY(0px) translateZ(30px);
  }
  50% {
    transform: rotate(-7deg) translateY(-12px) translateZ(30px);
  }
}

.floating-card--small {
  animation-name: driftCardSmall;
}

@keyframes driftCardSmall {
  0%, 100% {
    transform: rotate(9deg) translateY(0px) translateZ(40px);
  }
  50% {
    transform: rotate(9deg) translateY(-10px) translateZ(40px);
  }
}

@keyframes gentleLift {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes galleryFloat {
  0%, 100% {
    transform: translateY(0px);
    filter: saturate(0.95);
  }
  50% {
    transform: translateY(-10px);
    filter: saturate(1.05);
  }
}

@keyframes slowSpin {
  0% {
    transform: rotateX(0deg) rotateY(0deg);
  }
  100% {
    transform: rotateX(2deg) rotateY(2.5deg);
  }
}

@keyframes pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 980px) {
  .hero,
  .story-grid {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .hero {
    min-height: auto;
    padding-top: 18px;
  }

  .hero__visual {
    min-height: 450px;
    order: -1;
  }

  .topbar {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 12px;
    height: auto;
    padding: 16px 0;
  }

  .house-picker {
    align-self: center;
  }

  .nav {
    justify-self: center;
  }
}

@media (max-width: 640px) {
  .nav {
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero__meta {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-heading--jogo {
    gap: 12px;
  }

  .section-heading__hat {
    width: 52px;
  }

  .eyebrow--divider {
    gap: 8px;
  }

  .eyebrow--divider::before,
  .eyebrow--divider::after {
    width: 36px;
    height: 2.8px;
  }

  .gallery-grid,
  .game-board {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }
}
