:root {
  --ink: #17120e;
  --paper: #f5ead6;
  --paper-deep: #e3c28a;
  --ember: #bb5747;
  --moss: #536144;
  --night: #1c2329;
  --gold: #d6ab5f;
  --shadow: rgba(20, 12, 5, 0.38);
}

* {
  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:
    linear-gradient(rgba(23, 18, 14, 0.34), rgba(23, 18, 14, 0.72)),
    url("assets/background.jpg") center / cover fixed;
}

button,
a {
  font: inherit;
}

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

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

.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.15rem, 8vw, 4.8rem);
  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%;
}

.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;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 233, 194, 0.55);
  border-radius: 50%;
  color: #fff4d8;
  background: rgba(23, 18, 14, 0.42);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.icon-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(7px, 2vw, 14px);
}

.card {
  width: 100%;
  min-height: 72px;
  height: clamp(72px, 21vw, 150px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
}

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

.card[disabled] {
  cursor: default;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  transform-style: preserve-3d;
  transition: transform 560ms ease;
}

.card.is-flipped .card-inner,
.card.is-matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  overflow: hidden;
  backface-visibility: hidden;
  box-shadow: 0 10px 24px var(--shadow);
}

.card-back {
  border: 1px solid rgba(255, 233, 194, 0.35);
  background:
    linear-gradient(rgba(28, 35, 41, 0.08), rgba(28, 35, 41, 0.2)),
    url("assets/card-back.jpg") center / cover;
}

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

.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.42));
}

.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:
    linear-gradient(135deg, rgba(245, 234, 214, 0.96), rgba(227, 194, 138, 0.96));
  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;
}

.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);
}

.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% - 18px, 900px);
    padding-top: 22px;
  }

  .game-board {
    gap: 7px;
  }

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