:root {
  --cream: #fbf7f1;
  --ink: #234b52;
  --teal: #06a4c7;
  --teal-dark: #1f5f66;
  --coral: #c1504a;
  --gold: #e0be73;
  --card-w: 130px;
  --card-ratio: 0.716; /* width / height, matches the card artwork */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 16px 64px;
  text-align: center;
}

header {
  margin-bottom: 8px;
}

header img.logo {
  height: 90px;
  margin-bottom: 4px;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: normal;
  font-size: 1.7rem;
  color: var(--teal-dark);
  margin: 4px 0 6px;
}

p.intro {
  max-width: 480px;
  margin: 0 auto 28px;
  color: var(--teal-dark);
  opacity: 0.85;
  line-height: 1.5;
}

.limit-notice {
  max-width: 480px;
  margin: -8px auto 24px;
  padding: 10px 16px;
  background: #fff3ec;
  border: 1px solid var(--gold);
  border-radius: 10px;
  color: var(--coral);
  font-size: 0.92rem;
  display: none;
}
.limit-notice.show { display: block; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: 14px;
  justify-items: center;
  perspective: 1200px;
}

.card {
  width: 100%;
  max-width: var(--card-w);
  aspect-ratio: var(--card-ratio);
  position: relative;
  cursor: pointer;
}

.card.disabled { cursor: default; }
.card.disabled .card-inner { opacity: 0.5; transition: opacity 0.4s; }

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.35s cubic-bezier(.4,.2,.2,1);
  transform-style: preserve-3d;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
}

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

.card:not(.flipped):not(.disabled) .card-inner:hover {
  transform: translateY(-4px);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  backface-visibility: hidden;
}

.card-back {
  background: #01a5ca;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--teal);
}

.card-back img {
  width: 62%;
}

.card-front {
  transform: rotateY(180deg);
}

.card-front img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.reveal {
  margin-top: 34px;
  min-height: 40px;
}

.reveal .drawn-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  color: var(--teal-dark);
  margin-bottom: 14px;
}

button.again {
  display: none;
  margin-top: 18px;
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 11px 26px;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  letter-spacing: 0.02em;
}
button.again:hover { background: var(--teal-dark); }
button.again.show { display: inline-block; }

footer {
  margin-top: 56px;
  font-size: 0.8rem;
  color: var(--teal-dark);
  opacity: 0.6;
}

/* Spotlight: the chosen card grows to center-stage, the rest fade away */
.grid.spotlighting .card:not(.origin) .card-inner {
  opacity: 0.07;
  transition: opacity 0.4s ease;
}
.grid.spotlighting .card.origin .card-inner {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.spotlight-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 45, 48, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 40;
}
.spotlight-backdrop.show { opacity: 1; }

.spotlight-card {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(640px, 86vw, calc(86vh * var(--card-ratio)));
  aspect-ratio: var(--card-ratio);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 55px rgba(0,0,0,0.35);
  z-index: 50;
  pointer-events: none;
  will-change: transform;
}

.spotlight-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
