:root {
  color-scheme: dark;
  --ink: #1f1713;
  --muted: #7a6659;
  --paper: #fff7e8;
  --line: rgba(105, 61, 38, 0.2);
  --red: #aa3040;
  --red-dark: #701d2a;
  --gold: #e9b84e;
  --teal: #0f6f70;
  --teal-dark: #092f36;
  --white: #fffaf1;
  --shadow: 0 28px 80px rgba(12, 8, 6, 0.36);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: #092f36;
  color: var(--white);
}

button {
  font: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-shell {
  min-height: 100vh;
  background: #092f36;
}

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 3vw, 2.5rem);
  background: rgba(6, 24, 29, 0.68);
  border-bottom: 1px solid rgba(255, 240, 210, 0.14);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}

.brand-mark {
  width: 1.35rem;
  height: 1.65rem;
  border-radius: 0.65rem 0.65rem 0.35rem 0.35rem;
  background: linear-gradient(180deg, #ffe38d, #d2474f 58%, #7f2230);
  box-shadow: 0 0 22px rgba(255, 201, 74, 0.72);
}

.music-button,
.primary-button,
.secondary-button,
.close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-weight: 820;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.music-button {
  min-height: 2.75rem;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  color: var(--white);
  border: 1px solid rgba(255, 240, 210, 0.22);
  background: rgba(170, 48, 64, 0.78);
  white-space: nowrap;
}

.music-button[aria-pressed="true"] {
  background: rgba(15, 111, 112, 0.9);
}

.music-icon {
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  border-radius: 50%;
  color: var(--red-dark);
  background: var(--gold);
  line-height: 1;
}

.lantern-stage {
  position: relative;
  min-height: 100svh;
  padding: 7.25rem clamp(1rem, 3vw, 2.5rem) 3rem;
  overflow: hidden;
}

.stage-art,
.stage-overlay {
  position: absolute;
  inset: 0;
}

.stage-art {
  background:
    linear-gradient(90deg, rgba(7, 25, 30, 0.72), rgba(7, 25, 30, 0.2) 50%, rgba(7, 25, 30, 0.62)),
    url("./assets/lantern-festival-hero.jpg") center / cover no-repeat;
  transform: scale(1.02);
}

.stage-overlay {
  background:
    radial-gradient(circle at 70% 18%, rgba(233, 184, 78, 0.22), transparent 20rem),
    linear-gradient(180deg, rgba(7, 20, 25, 0.16), rgba(7, 20, 25, 0.74) 82%, rgba(7, 20, 25, 0.92));
}

.stage-content {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
}

.hero-copy {
  max-width: 760px;
  margin-bottom: 1.5rem;
}

.section-label {
  margin: 0 0 0.35rem;
  color: #8de0d6;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 8em;
  font-size: clamp(3.2rem, 8vw, 7.5rem);
  line-height: 0.9;
  text-shadow: 0 18px 60px rgba(0, 0, 0, 0.4);
}

h2 {
  color: var(--ink);
  font-size: clamp(1.7rem, 3vw, 2.8rem);
  line-height: 1;
}

.intro-copy {
  max-width: 32rem;
  margin: 1rem 0 0;
  color: rgba(255, 250, 241, 0.84);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 680;
  line-height: 1.45;
}

.lantern-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(4.6rem, 1fr));
  gap: clamp(0.8rem, 1.8vw, 1.35rem);
  padding: clamp(1rem, 2.4vw, 1.7rem);
  border: 1px solid rgba(255, 240, 210, 0.18);
  border-radius: var(--radius);
  background: rgba(6, 25, 30, 0.46);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.lantern {
  position: relative;
  display: grid;
  min-height: 8.6rem;
  place-items: start center;
  border: 0;
  color: var(--white);
  background: transparent;
  isolation: isolate;
}

.lantern-cord {
  width: 1px;
  height: 1.6rem;
  background: rgba(255, 240, 210, 0.64);
}

.lantern-body {
  position: relative;
  width: clamp(3.4rem, 7vw, 5.4rem);
  height: clamp(4.25rem, 8.5vw, 6.5rem);
  border-radius: 45% 45% 38% 38%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14), transparent 18%, rgba(255, 255, 255, 0.18) 48%, transparent 78%),
    radial-gradient(circle at 50% 22%, rgba(255, 238, 166, 0.95), rgba(255, 188, 82, 0.7) 32%, rgba(178, 42, 55, 0.92) 75%);
  border: 1px solid rgba(255, 229, 165, 0.45);
  box-shadow:
    0 0 26px rgba(255, 183, 62, 0.66),
    inset 0 -12px 24px rgba(90, 19, 24, 0.2);
  animation: lantern-sway 3.6s ease-in-out infinite;
  animation-delay: var(--sway-delay);
}

.lantern-body::before,
.lantern-body::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  height: 0.32rem;
  border-radius: 999px;
  background: rgba(112, 29, 42, 0.78);
}

.lantern-body::before {
  top: -0.08rem;
}

.lantern-body::after {
  bottom: -0.08rem;
}

.lantern-gold .lantern-body {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 18%, rgba(255, 255, 255, 0.18) 48%, transparent 78%),
    radial-gradient(circle at 50% 22%, rgba(255, 244, 184, 0.98), rgba(233, 184, 78, 0.82) 38%, rgba(170, 97, 37, 0.94) 78%);
}

.lantern-rose .lantern-body {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14), transparent 18%, rgba(255, 255, 255, 0.2) 48%, transparent 78%),
    radial-gradient(circle at 50% 22%, rgba(255, 225, 190, 0.96), rgba(222, 91, 88, 0.74) 36%, rgba(132, 31, 52, 0.94) 78%);
}

.lantern-amber .lantern-body {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.15), transparent 18%, rgba(255, 255, 255, 0.18) 48%, transparent 78%),
    radial-gradient(circle at 50% 22%, rgba(255, 236, 166, 0.98), rgba(255, 151, 72, 0.78) 36%, rgba(159, 58, 38, 0.94) 78%);
}

.lantern-label {
  margin-top: 0.55rem;
  color: rgba(255, 250, 241, 0.78);
  font-size: 0.72rem;
  font-weight: 850;
}

.lantern:hover .lantern-body,
.lantern:focus-visible .lantern-body {
  transform: translateY(-5px) scale(1.05);
  box-shadow:
    0 0 42px rgba(255, 210, 94, 0.94),
    inset 0 -12px 24px rgba(90, 19, 24, 0.2);
}

.lantern:focus-visible {
  outline: 3px solid rgba(255, 232, 160, 0.9);
  outline-offset: 5px;
}

.riddle-modal {
  width: min(720px, calc(100vw - 2rem));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  color: var(--ink);
  background: transparent;
}

.riddle-modal::backdrop {
  background: rgba(4, 14, 18, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  display: grid;
  gap: 1.1rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid rgba(255, 240, 210, 0.36);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.98), rgba(255, 240, 212, 0.94)),
    repeating-linear-gradient(90deg, transparent, transparent 17px, rgba(170, 48, 64, 0.05) 18px);
  box-shadow: var(--shadow);
}

.close-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  color: var(--red-dark);
  background: rgba(255, 250, 241, 0.8);
  font-size: 1.35rem;
}

.modal-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-right: 3rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.3rem 0.68rem;
  border-radius: 999px;
  color: var(--white);
  background: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
}

.tag-soft {
  color: var(--teal-dark);
  background: rgba(15, 111, 112, 0.12);
}

.question {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.08;
}

.question[data-density="medium"] {
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1.14;
}

.question[data-density="long"] {
  font-size: clamp(1.35rem, 3vw, 2.2rem);
  line-height: 1.22;
}

.hint-box,
.answer-box {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.82);
}

.hint-box span,
.answer-box span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hint-box p,
.answer-box p {
  margin: 0.3rem 0 0;
  font-size: 1.1rem;
  font-weight: 760;
}

.answer-box {
  border-color: rgba(15, 111, 112, 0.24);
  background: rgba(15, 111, 112, 0.08);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.primary-button,
.secondary-button {
  min-height: 3rem;
  padding: 0 1.1rem;
}

.primary-button {
  border: 0;
  color: var(--white);
  background: var(--red);
  box-shadow: 0 12px 24px rgba(170, 48, 64, 0.25);
}

.secondary-button {
  color: var(--red-dark);
  border: 1px solid rgba(112, 29, 42, 0.22);
  background: rgba(255, 250, 241, 0.86);
}

.primary-button:hover,
.secondary-button:hover,
.music-button:hover,
.close-button:hover {
  transform: translateY(-1px);
}

@keyframes lantern-sway {
  0%,
  100% {
    rotate: -1.5deg;
  }
  50% {
    rotate: 1.5deg;
  }
}

@media (max-width: 980px) {
  .topbar {
    position: sticky;
  }

  .lantern-stage {
    padding-top: 1.25rem;
  }

  .lantern-grid {
    grid-template-columns: repeat(6, minmax(4.3rem, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    gap: 0.65rem;
  }

  .brand {
    font-size: 0.95rem;
  }

  .music-button {
    padding: 0.45rem 0.65rem;
    font-size: 0.86rem;
  }

  .lantern-grid {
    grid-template-columns: repeat(3, minmax(4.5rem, 1fr));
  }

  .lantern {
    min-height: 7.8rem;
  }

  .card-actions > button {
    flex: 1 1 9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
