:root {
  --wood-dark: #2b1a10;
  --wood-mid: #4a2f1c;
  --wood-light: #6f4a2c;
  --parchment: #f2e2ba;
  --parchment-edge: #dcc48f;
  --ale-gold: #d9a441;
  --ember: #c1440e;
  --candle-glow: #ffb84d;
  --text-dark: #2b1a10;
  --text-warm: #4a2f1c;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: 'EB Garamond', Georgia, serif;
  color: var(--text-dark);
  background-color: var(--wood-dark);
  background-image:
    radial-gradient(ellipse 140% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%),
    repeating-linear-gradient(
      180deg,
      var(--wood-mid) 0px,
      var(--wood-mid) 118px,
      var(--wood-dark) 118px,
      var(--wood-dark) 121px,
      rgba(255, 255, 255, 0.06) 121px,
      rgba(255, 255, 255, 0.06) 123px
    ),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-blend-mode: normal, normal, overlay;
  background-attachment: fixed;
  position: relative;
  padding-bottom: 2rem;
}

.tavern-glow {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 640px 320px at 50% 0%, rgba(255, 184, 77, 0.16), transparent 70%);
  z-index: 0;
}

/* ---------- Header / Sign ---------- */

.signboard-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2.5rem;
  z-index: 1;
}

.chains {
  display: flex;
  gap: 8rem;
  margin-bottom: -4px;
}

.chains span {
  width: 3px;
  height: 28px;
  background: repeating-linear-gradient(
    var(--ale-gold),
    var(--ale-gold) 4px,
    transparent 4px,
    transparent 8px
  );
  opacity: 0.7;
}

.signboard {
  background: linear-gradient(180deg, var(--wood-light), var(--wood-mid));
  border: 4px solid var(--wood-dark);
  border-radius: 6px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(0, 0, 0, 0.4);
  padding: 1.4rem 2.5rem;
  text-align: center;
  max-width: 90vw;
}

.signboard h1 {
  font-family: 'MedievalSharp', cursive;
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: var(--ale-gold);
  margin: 0;
  text-shadow: 0 0 12px rgba(255, 184, 77, 0.5), 0 2px 2px rgba(0, 0, 0, 0.6);
  letter-spacing: 1px;
}

.tagline {
  color: var(--parchment-edge);
  font-style: italic;
  margin: 0.4rem 0 0;
  font-size: 1.05rem;
}

/* ---------- Main / Intro ---------- */

main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
}

.intro {
  text-align: center;
  color: var(--parchment);
  max-width: 640px;
  margin: 0 auto 2.5rem;
  font-size: 1.15rem;
  line-height: 1.6;
  opacity: 0.9;
}

/* ---------- Game grid / cards ---------- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.5rem;
}

.game-card {
  background:
    linear-gradient(180deg, var(--parchment), var(--parchment-edge));
  border: 3px solid var(--wood-dark);
  border-radius: 10px;
  padding: 1.6rem 1.3rem;
  text-align: center;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.4),
    inset 0 0 0 2px rgba(255, 255, 255, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-card:not(.locked):hover {
  transform: translateY(-6px);
  box-shadow:
    0 14px 26px rgba(0, 0, 0, 0.5),
    0 0 22px rgba(255, 184, 77, 0.55);
}

.card-icon {
  font-size: 2.6rem;
  margin-bottom: 0.6rem;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.game-card h2 {
  font-family: 'MedievalSharp', cursive;
  color: var(--text-warm);
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
}

.card-desc {
  margin: 0 0 1.2rem;
  color: var(--text-warm);
  font-size: 0.98rem;
  min-height: 3em;
}

.play-btn {
  font-family: 'EB Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 1rem;
  background: linear-gradient(180deg, var(--ember), #8f2e07);
  color: var(--parchment);
  border: 2px solid var(--wood-dark);
  border-radius: 6px;
  padding: 0.5rem 1.4rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.play-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #d4531a, var(--ember));
  transform: scale(1.04);
}

.play-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.game-card.locked {
  opacity: 0.65;
  filter: grayscale(0.4);
}

.play-btn:disabled {
  background: #8a8071;
  color: #e8e0cf;
  cursor: not-allowed;
  border-color: #55503f;
}

/* ---------- Footer ---------- */

footer {
  position: relative;
  z-index: 1;
  margin-top: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  color: var(--parchment-edge);
  font-style: italic;
  opacity: 0.8;
}

.candle {
  animation: flicker 2.4s infinite ease-in-out;
  font-size: 1.2rem;
}

.candle:last-child {
  animation-delay: 0.6s;
}

@keyframes flicker {
  0%, 100% { opacity: 1; filter: brightness(1); }
  45% { opacity: 0.75; filter: brightness(1.3); }
  60% { opacity: 0.9; filter: brightness(0.9); }
}

/* ---------- Modal scroll ---------- */

.scroll-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 9, 5, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 1rem;
}

.scroll-overlay.open {
  display: flex;
}

.scroll {
  background: linear-gradient(180deg, var(--parchment), var(--parchment-edge));
  border: 4px double var(--wood-dark);
  border-radius: 8px;
  max-width: 380px;
  width: 100%;
  padding: 1.8rem 1.6rem;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.scroll h3 {
  font-family: 'MedievalSharp', cursive;
  color: var(--text-warm);
  margin-top: 0;
}

.scroll p {
  color: var(--text-warm);
  line-height: 1.5;
}

.scroll button {
  margin-top: 0.8rem;
  font-family: 'EB Garamond', Georgia, serif;
  font-weight: 600;
  background: linear-gradient(180deg, var(--ember), #8f2e07);
  color: var(--parchment);
  border: 2px solid var(--wood-dark);
  border-radius: 6px;
  padding: 0.5rem 1.4rem;
  cursor: pointer;
}

.scroll button:hover {
  background: linear-gradient(180deg, #d4531a, var(--ember));
}

@media (max-width: 480px) {
  .chains {
    gap: 4rem;
  }
}

/* ---------- Music toggle ---------- */

.music-toggle {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 5;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--wood-dark);
  background: linear-gradient(180deg, var(--wood-light), var(--wood-mid));
  color: var(--parchment-edge);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  opacity: 0.65;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.music-toggle:hover {
  opacity: 1;
  transform: scale(1.06);
}

.music-toggle.playing {
  opacity: 1;
  animation: music-pulse 2.4s infinite ease-in-out;
}

@keyframes music-pulse {
  0%, 100% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), 0 0 12px rgba(255, 184, 77, 0.5); }
  50% { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), 0 0 22px rgba(255, 184, 77, 0.85); }
}
