:root {
  color-scheme: dark;
  --gold: #f4d488;
  --gold-light: #fff1bd;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: #fff8e8;
  font-family: Georgia, "Times New Roman", serif;
  background: #0c0812 url("assets/background/magic-library-background.png") center / cover fixed no-repeat;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(90deg, rgba(5, 3, 10, .78), rgba(5, 3, 10, .2) 50%, rgba(5, 3, 10, .78)), linear-gradient(180deg, rgba(5, 3, 10, .2), rgba(5, 3, 10, .58));
}

.magic-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ambient-light {
  position: fixed;
  z-index: 0;
  width: 38vw;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: .3;
  filter: blur(80px);
  pointer-events: none;
  mix-blend-mode: screen;
  animation: drift 12s ease-in-out infinite alternate;
}

.ambient-light-one {
  top: -18vw;
  left: 18vw;
  background: #4f7cff;
}

.ambient-light-two {
  right: 10vw;
  bottom: -24vw;
  background: #8b43e8;
  animation-delay: -5s;
}

@keyframes drift {
  to {
    transform: translate3d(5vw, 3vh, 0) scale(1.18);
  }
}

.page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(110px, 160px) minmax(420px, 1120px) minmax(110px, 160px);
  gap: clamp(16px, 2vw, 34px);
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px clamp(18px, 3vw, 50px);
}

.ad-space {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 600px;
  border: 1px solid rgba(244, 212, 136, .2);
  border-radius: 16px;
  color: rgba(255, 241, 189, .48);
  font: .68rem Arial, sans-serif;
  letter-spacing: .18em;
  text-transform: uppercase;
  background: rgba(8, 5, 14, .3);
  backdrop-filter: blur(2px);
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(800px, calc(100vh - 56px));
  padding: clamp(48px, 7vw, 90px) clamp(30px, 7vw, 96px);
  text-align: center;
  border: 1px solid rgba(255, 225, 151, .38);
  border-radius: 32px;
  background: radial-gradient(circle at 50% 15%, rgba(91, 58, 151, .38), transparent 42%), rgba(10, 6, 17, .76);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .58), inset 0 0 60px rgba(131, 92, 211, .1);
  backdrop-filter: blur(8px);
  transform-style: preserve-3d;
  transition: transform .25s ease-out;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: .78rem;
  letter-spacing: .32em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--gold-light);
  font-size: clamp(4.5rem, 13vw, 8.4rem);
  font-style: italic;
  font-weight: 600;
  line-height: .9;
  letter-spacing: -.07em;
  text-shadow: 0 3px 0 #5c3c17, 0 0 18px rgba(255, 216, 113, .72), 0 0 50px rgba(123, 83, 215, .7);
  transform: skewX(-7deg);
}

h1::first-letter {
  font-size: 1.18em;
}

.ornament {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(330px, 82%);
  margin: 28px 0;
  color: var(--gold);
}

.ornament::before,
.ornament::after {
  flex: 1;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, currentColor);
}

.ornament::after {
  background: linear-gradient(90deg, currentColor, transparent);
}

.tagline {
  max-width: 470px;
  margin: 0;
  color: #f8efd9;
  font-size: clamp(1.05rem, 2.3vw, 1.35rem);
  line-height: 1.65;
  text-shadow: 0 2px 8px #000;
}

.languages {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: min(500px, 100%);
  margin-top: 14px;
}

.language-prompt {
  margin: 38px 0 0;
  color: var(--gold-light);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-shadow: 0 2px 8px #000;
}

.language {
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 225, 151, .58);
  border-radius: 12px;
  color: #1c1026;
  font: 700 1rem Georgia, serif;
  text-decoration: none;
  cursor: pointer;
  background: linear-gradient(180deg, #ffe9a8, #d7a94c);
  box-shadow: 0 6px 0 #6d481b, 0 11px 22px rgba(0, 0, 0, .36);
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}

.game-main {
  min-height: min(860px, calc(100vh - 56px));
  padding-top: clamp(34px, 5vw, 58px);
  padding-bottom: clamp(34px, 5vw, 58px);
}

.home-link {
  color: inherit;
  text-decoration: none;
}

.game-main h1 {
  font-size: clamp(3.8rem, 9vw, 6.6rem);
}

.game-intro {
  margin: 0 0 26px;
  color: var(--gold-light);
  font-size: clamp(.92rem, 2vw, 1.15rem);
  letter-spacing: .08em;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 22px);
  width: min(820px, 100%);
}

.game-slot {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 3px solid #d7a94c;
  border-radius: 18px;
  background: radial-gradient(circle, rgba(102, 68, 164, .2), rgba(8, 5, 14, .68));
  box-shadow: inset 0 0 0 2px rgba(255, 241, 189, .28), inset 0 0 28px rgba(142, 91, 220, .18), 0 8px 22px rgba(0, 0, 0, .38), 0 0 16px rgba(244, 212, 136, .16);
}

.game-slot::after {
  width: 42%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 241, 189, .22);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 22px rgba(139, 67, 232, .28);
}

.localized-footer a {
  padding: 3px 0;
  border-bottom: 1px solid transparent;
  color: rgba(255, 241, 189, .68);
  font: .74rem Arial, sans-serif;
  letter-spacing: .08em;
  text-decoration: none;
  transition: color .18s ease, border-color .18s ease;
}

.localized-footer a:hover,
.localized-footer a:focus-visible {
  border-color: var(--gold);
  color: var(--gold-light);
  outline: none;
}

[dir="rtl"] .game-main {
  font-family: Tahoma, Arial, sans-serif;
}

[dir="rtl"] .game-main h1 {
  font-family: Georgia, "Times New Roman", serif;
}

.language:hover,
.language:focus-visible,
.language.is-selected {
  filter: brightness(1.12);
  outline: none;
  transform: translateY(-3px);
  box-shadow: 0 9px 0 #6d481b, 0 15px 26px rgba(0, 0, 0, .4), 0 0 24px rgba(255, 224, 140, .45);
}

.language:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #6d481b, 0 7px 14px rgba(0, 0, 0, .32);
}

.status {
  min-height: 1em;
  margin: 38px 0 0;
  color: rgba(255, 248, 232, .63);
  font: .78rem Arial, sans-serif;
  letter-spacing: .08em;
}

.footer-links {
  display: flex;
  gap: 8px 22px;
  justify-content: center;
  margin-top: 20px;
}

.footer-links button,
.footer-links a {
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  color: rgba(255, 241, 189, .68);
  font: .74rem Arial, sans-serif;
  letter-spacing: .08em;
  cursor: pointer;
  background: transparent;
  text-decoration: none;
  transition: color .18s ease, border-color .18s ease;
}

.footer-links button:hover,
.footer-links button:focus-visible,
.footer-links a:hover,
.footer-links a:focus-visible {
  border-color: var(--gold);
  color: var(--gold-light);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .ambient-light {
    animation: none;
  }

  main,
  .language {
    transition: none;
  }
}

@media (max-width: 1050px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
  }

  .ad-space {
    display: none;
  }
}

@media (max-width: 560px) {
  .page {
    padding: 14px;
  }

  main {
    min-height: calc(100vh - 28px);
    padding: 34px 16px;
    border-radius: 22px;
  }

  .languages {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .language {
    min-height: 52px;
    padding: 9px 5px;
    font-size: clamp(.72rem, 3.2vw, .92rem);
  }

  .game-main {
    padding: 28px 12px;
  }

  .game-grid {
    gap: 8px;
  }

  .game-slot {
    border-width: 2px;
    border-radius: 12px;
  }
}

.seo-summary { max-width: 680px; margin: 12px auto 24px; color: rgba(255, 248, 232, .78); font: .95rem/1.55 Arial, sans-serif; }

.page { grid-template-columns: minmax(0, 1120px); }
.ad-space { display: none; }
