:root {
  --ink: #12100d;
  --paper: #f7ecd5;
  --paper-deep: #dcb978;
  --ember: #9d4f45;
  --moss: #425944;
  --night: #1a2324;
  --gold: #d8ad5d;
  --shadow: rgba(12, 9, 6, 0.44);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at 18% 14%, rgba(216, 173, 93, 0.22), transparent 28rem),
    radial-gradient(circle at 82% 18%, rgba(66, 89, 68, 0.34), transparent 24rem),
    linear-gradient(rgba(18, 16, 13, 0.48), rgba(18, 16, 13, 0.78)),
    url("assets/background-mystic.jpg") center / cover fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 236, 205, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(255, 236, 205, 0.04) 1px, transparent 1px);
  background-size: 82px 82px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.68), transparent 72%);
}

button,
a {
  font: inherit;
}

.page-shell {
  width: min(100% - 28px, 900px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 30px;
  display: grid;
  align-content: center;
  gap: 24px;
}

.intro {
  position: relative;
  text-align: center;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}

.intro::before {
  content: "";
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border: 1px solid rgba(255, 226, 169, 0.68);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 241, 208, 0.9) 0 5px, transparent 6px),
    radial-gradient(circle at center, transparent 0 21px, rgba(216, 173, 93, 0.22) 22px 24px, transparent 25px);
  box-shadow: 0 0 34px rgba(216, 173, 93, 0.26);
}

.kicker {
  margin: 0 0 8px;
  color: #ffe2a9;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  color: #fff5df;
  font-size: clamp(2.05rem, 8vw, 4.7rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 560px;
  margin: 0 auto;
  color: #ffe9c2;
  font-size: 1.02rem;
  line-height: 1.55;
}

.game-panel {
  width: 100%;
  padding: clamp(12px, 2.4vw, 22px);
  border: 1px solid rgba(255, 233, 194, 0.18);
  border-radius: 8px;
  background: rgba(18, 16, 13, 0.32);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(3px);
}

.game-topline {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: #ffe9c2;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}

.game-topline p {
  margin: 0;
  font-size: 0.95rem;
}

.game-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-button {
  min-width: 82px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 233, 194, 0.55);
  border-radius: 999px;
  color: #fff4d8;
  background: rgba(23, 18, 14, 0.42);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.pill-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 233, 194, 0.42);
  border-radius: 999px;
  color: #fff4d8;
  background: rgba(157, 79, 69, 0.34);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.icon-button:hover {
  border-color: rgba(255, 233, 194, 0.86);
  background: rgba(66, 89, 68, 0.58);
  transform: translateY(-1px);
}

.pill-button:hover {
  border-color: rgba(255, 233, 194, 0.86);
  background: rgba(157, 79, 69, 0.58);
  transform: translateY(-1px);
}

.icon-button:focus-visible,
.pill-button:focus-visible,
.language-button:focus-visible,
.text-button:focus-visible,
.contact-link:focus-visible,
.card:focus-visible {
  outline: 3px solid #fff4d8;
  outline-offset: 3px;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 15px);
}

.card {
  display: block;
  width: 100%;
  min-height: 72px;
  height: clamp(72px, 21vw, 150px);
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgba(255, 233, 194, 0.55);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, rgba(255, 233, 194, 0.18), transparent 42%),
    linear-gradient(rgba(28, 35, 41, 0.08), rgba(28, 35, 41, 0.2)),
    url("assets/card-back-selected.jpg") center / cover;
  box-shadow: 0 10px 24px var(--shadow);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.card:hover {
  border-color: rgba(255, 241, 208, 0.9);
  box-shadow: 0 14px 30px rgba(12, 9, 6, 0.52), 0 0 18px rgba(216, 173, 93, 0.18);
  transform: translateY(-2px);
}

@supports not (aspect-ratio: 1) {
  .card {
    height: clamp(72px, 21vw, 150px);
  }
}

.card[disabled] {
  cursor: default;
}

.card-inner {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  overflow: hidden;
  transition: opacity 220ms ease;
}

.card-back {
  opacity: 1;
  background:
    linear-gradient(rgba(28, 35, 41, 0.08), rgba(28, 35, 41, 0.2)),
    url("assets/card-back-selected.jpg") center / cover;
}

.card-front {
  opacity: 0;
  border: 1px solid rgba(255, 245, 223, 0.45);
  background-position: center;
  background-size: cover;
}

.card.is-flipped .card-back,
.card.is-matched .card-back {
  opacity: 0;
}

.card.is-flipped .card-front,
.card.is-matched .card-front {
  opacity: 1;
}

.card.is-matched .card-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, rgba(255, 226, 169, 0.22), rgba(83, 97, 68, 0.34)),
    linear-gradient(135deg, transparent, rgba(255, 245, 223, 0.18));
}

.card.just-matched {
  animation: matchedGlow 780ms ease;
}

@keyframes matchedGlow {
  0% {
    box-shadow: 0 10px 24px var(--shadow);
  }

  45% {
    box-shadow: 0 0 0 2px rgba(255, 241, 208, 0.88), 0 0 30px rgba(216, 173, 93, 0.72);
  }

  100% {
    box-shadow: 0 10px 24px var(--shadow);
  }
}

.language-switch {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.language-button {
  min-width: 42px;
  min-height: 34px;
  border: 1px solid rgba(255, 233, 194, 0.34);
  border-radius: 999px;
  color: rgba(255, 244, 216, 0.78);
  background: rgba(18, 16, 13, 0.32);
  cursor: pointer;
}

.language-button.is-active {
  color: #fff4d8;
  border-color: rgba(255, 233, 194, 0.72);
  background: rgba(66, 89, 68, 0.5);
}

.reveal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(14, 10, 7, 0.72);
  backdrop-filter: blur(8px);
}

.reveal.is-visible {
  display: flex;
}

.reveal-panel {
  width: min(100%, 520px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 26px;
  border: 1px solid rgba(255, 233, 194, 0.48);
  border-radius: 8px;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0, rgba(255, 249, 233, 0.98), transparent 16rem),
    linear-gradient(135deg, rgba(245, 234, 214, 0.98), rgba(220, 185, 120, 0.98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.reveal-panel .kicker {
  color: #7d3f35;
}

.reveal-panel h2 {
  margin-bottom: 14px;
  font-size: 2rem;
  line-height: 1.05;
}

.reveal-panel p {
  color: #35271d;
  font-size: 1.02rem;
  line-height: 1.55;
}

.soft-note,
.phone-note {
  font-style: italic;
}

.phone-note {
  margin: 14px 0 4px;
  font-size: 0.94rem;
}

.contact-options {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.contact-link,
.text-button {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
}

.contact-link {
  color: #fff9e9;
  background: var(--moss);
  box-shadow: 0 10px 24px rgba(66, 89, 68, 0.28);
  transition: transform 180ms ease, background 180ms ease;
}

.contact-link:hover {
  background: #314a37;
  transform: translateY(-1px);
}

.text-button {
  border: 1px solid rgba(23, 18, 14, 0.24);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 16px, 900px);
    padding-top: 18px;
    align-content: start;
  }

  .game-board {
    gap: 8px;
  }

  .game-topline {
    display: grid;
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .game-actions {
    width: 100%;
    gap: 6px;
  }

  .pill-button {
    flex: 1 1 170px;
  }

  .icon-button {
    flex: 1 1 96px;
  }

  .reveal-panel {
    padding: 22px;
  }
}
