@font-face {
  font-family: "GW Bantley";
  src: url("assets/fonts/GwBantleyRegularTrial-j9dzv.ttf") format("truetype");
  font-style: normal;
  font-weight: 800;
}

:root {
  --bg: #090b11;
  --bg-deep: #06070c;
  --text: #e7e3f3;
  --muted: #b9b4c8;
  --line: rgba(214, 222, 255, 0.16);
  --line-strong: rgba(214, 222, 255, 0.28);
  --card: rgba(22, 25, 37, 0.78);
  --card-soft: rgba(29, 33, 49, 0.92);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "Baskervville", "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 16%, rgba(188, 176, 224, 0.14), transparent 22%),
    radial-gradient(circle at 82% 22%, rgba(144, 164, 205, 0.16), transparent 24%),
    radial-gradient(circle at 50% 85%, rgba(232, 197, 223, 0.08), transparent 24%),
    linear-gradient(180deg, #0e1018 0%, #08090f 56%, #04050a 100%);
  overflow-x: hidden;
}

body.overlay-open {
  overflow: hidden;
}

.mist {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 88%);
  opacity: 0.24;
}

.app {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.header {
  display: flex;
  justify-content: center;
  padding: 18px 0 40px;
}

.header h1,
.overlay__text h2 {
  margin: 0;
  font-family: "Baskervville", "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: 0.14em;
}

.header h1 {
  font-family: "GW Bantley", "Times New Roman", serif;
  font-size: clamp(4rem, 10vw, 4.75rem);
  font-weight: 400;
  letter-spacing: 0.18em;
}

.spread {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
}

.spread-card {
  position: relative;
  width: 100%;
  aspect-ratio: 0.72;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(26, 30, 43, 0.88), rgba(13, 15, 23, 0.95));
  box-shadow: var(--shadow);
  padding: 14px;
  overflow: hidden;
  appearance: none;
  transform-style: preserve-3d;
}

.spread-card::before,
.overlay__art::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(228, 227, 243, 0.14);
  border-radius: 18px;
  pointer-events: none;
}

.spread-card--featured {
  cursor: pointer;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease, filter 220ms ease;
}

.spread-card--featured:hover,
.spread-card--featured:focus-visible {
  transform: translateY(-6px) rotate(-1deg);
  border-color: var(--line-strong);
  filter: saturate(1.05);
}

.spread-card__face {
  position: absolute;
  inset: 14px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  backface-visibility: hidden;
  transition: transform 560ms cubic-bezier(0.22, 1, 0.36, 1), opacity 320ms ease;
}

.spread-card__face--front {
  background:
    radial-gradient(circle at 50% 25%, rgba(169, 177, 218, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(21, 24, 35, 0.96), rgba(11, 12, 19, 0.98));
  transform: rotateY(0deg);
}

.spread-card__face--back {
  overflow: hidden;
  transform: rotateY(180deg);
}

.spread-card--featured:hover .spread-card__face--front,
.spread-card--featured:focus-visible .spread-card__face--front {
  transform: rotateY(180deg);
}

.spread-card--featured:hover .spread-card__face--back,
.spread-card--featured:focus-visible .spread-card__face--back {
  transform: rotateY(360deg);
}

.spread-card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 18px;
  filter: saturate(0.86) brightness(0.9) contrast(0.95);
}

.spread-card--sealed {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 25%, rgba(169, 177, 218, 0.1), transparent 30%),
    linear-gradient(180deg, rgba(21, 24, 35, 0.96), rgba(11, 12, 19, 0.98));
}

.sealed-card__glyph {
  font-family: "Baskervville", "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 5.5rem);
  color: rgba(228, 227, 243, 0.74);
  transform: translateY(-4px);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 8, 14, 0.28);
  backdrop-filter: blur(10px);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 260ms ease, visibility 0ms linear 260ms, backdrop-filter 260ms ease;
}

.hidden {
  display: none;
}

.overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 260ms ease, backdrop-filter 260ms ease;
}

.overlay__panel {
  width: min(1120px, calc(100% - 48px));
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(360px, 1fr);
  gap: 40px;
  align-items: center;
  margin: auto;
  padding: 24px;
  border: 1px solid rgba(228, 227, 243, 0.16);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(20, 24, 36, 0.8), rgba(11, 13, 21, 0.82)),
    rgba(14, 16, 24, 0.6);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(24px);
  transform: translateY(12px) scale(0.985);
  opacity: 0;
  transition: transform 260ms ease, opacity 220ms ease;
}

.overlay.is-visible .overlay__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.overlay__art {
  position: relative;
  margin: 0;
  padding: 10px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(30, 35, 49, 0.68), rgba(14, 16, 24, 0.78));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
}

.overlay__art img {
  display: block;
  width: 100%;
  border-radius: 22px;
  max-height: min(68vh, 640px);
  object-fit: contain;
}

.overlay__text {
  max-width: 560px;
}

.overlay__eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.45em;
}

.overlay__text h2 {
  font-size: clamp(3rem, 8vw, 5.75rem);
  line-height: 0.9;
}

.overlay__subtitle {
  margin: 12px 0 0;
  font-family: "Baskervville", "Times New Roman", serif;
  font-size: 1.5rem;
  color: #d6d1ea;
}

.overlay__body {
  margin: 22px 0 0;
  max-width: 46ch;
  color: var(--muted);
  line-height: 1.8;
  font-size: 1rem;
}

.overlay__body p {
  margin: 0 0 1rem;
}

.overlay__body p:last-child {
  margin-bottom: 0;
}

.overlay__actions {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.overlay__choice {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(228, 227, 243, 0.16);
  border-radius: 999px;
  background: rgba(12, 15, 24, 0.48);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.overlay__choice:hover,
.overlay__choice:focus-visible {
  background: rgba(36, 42, 59, 0.74);
  border-color: rgba(228, 227, 243, 0.28);
  transform: translateY(-1px);
}

.overlay__prompt {
  width: 100%;
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1.05rem;
}

.app.is-ended,
.mist.is-ended {
  opacity: 0;
  pointer-events: none;
  transition: opacity 360ms ease;
}

.end-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at center, rgba(20, 24, 36, 0.72), rgba(6, 8, 14, 0.96));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 360ms ease, visibility 0ms linear 360ms;
}

.end-screen.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 360ms ease;
}

.end-screen__text {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  letter-spacing: 0.08em;
  text-align: center;
}

@media (max-width: 900px) {
  .spread {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overlay__panel {
    grid-template-columns: 1fr;
    gap: 22px;
    width: min(680px, calc(100% - 16px));
  }

  .overlay__text {
    max-width: none;
    text-align: center;
    margin: 0 auto;
  }

  .overlay__body {
    margin-left: auto;
    margin-right: auto;
  }

  .overlay__actions {
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100% - 20px, 1120px);
    padding-top: 12px;
    padding-bottom: 24px;
  }

  .header {
    padding: 10px 0 18px;
  }

  .header h1 {
    font-size: clamp(3.7rem, 8vw, 2.4rem);
    
  }

  .spread {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .spread-card {
    padding: 8px;
    border-radius: 18px;
  }

  .spread-card::before,
  .overlay__art::before {
    inset: 6px;
    border-radius: 13px;
  }

  .spread-card__face {
    inset: 8px;
    border-radius: 14px;
  }

  .spread-card__image {
    border-radius: 14px;
  }

  .sealed-card__glyph {
    font-size: clamp(2.5rem, 11vw, 3.7rem);
  }

  .overlay {
    align-items: center;
    padding: 14px;
  }

  .overlay__panel {
    gap: 16px;
    width: min(100%, 520px);
    padding: 16px;
  }

  .overlay__art {
    padding: 8px;
  }

  .overlay__art img {
    max-height: min(40vh, 300px);
  }

  .overlay__text h2 {
    font-size: clamp(2.6rem, 16vw, 4rem);
  }

  .overlay__body {
    max-width: 32ch;
    font-size: 0.96rem;
    line-height: 1.7;
  }
}
