/* Florida Wildlife Match */

body.match-page {
  background-color: #13b39a !important;
  background-image:
    radial-gradient(circle at 12% 18%, #ffe24a 0 28px, transparent 29px),
    radial-gradient(circle at 88% 12%, #ff6b8a 0 22px, transparent 23px),
    radial-gradient(circle at 78% 78%, #7d5cff 0 18px, transparent 19px),
    radial-gradient(circle at 18% 82%, #ff8a3d 0 26px, transparent 27px),
    repeating-linear-gradient(
      -18deg,
      transparent 0 28px,
      rgba(255, 255, 255, 0.12) 28px 32px
    ),
    linear-gradient(165deg, #12c2a8 0%, #1ad1b0 35%, #ffcf33 70%, #ff6a3d 100%) !important;
  background-attachment: fixed;
}

.match-page .site-header {
  background: rgba(14, 92, 82, 0.94);
  border-bottom: 0;
}

.match-page .logo,
.match-page .logo:hover {
  color: #fff6c8;
}

.match-page .logo span {
  color: #7dfff0;
}

.match-page .nav-links a {
  color: #e8fff8;
}

.match-page .nav-links a:hover,
.match-page .nav-links a.active {
  color: #fff6c8;
  border-bottom-color: #ffd34e;
}

.match-page .nav-toggle {
  color: #fff6c8;
}

.match-layout {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) 168px;
  gap: 1rem;
  align-items: start;
  padding: 1.25rem 0 2.5rem;
}

.match-card-shell {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0.35rem 0 0.6rem;
}

.match-screen {
  display: none;
}

.match-screen.active {
  display: block;
}

.match-screen h1,
.match-screen h2 {
  font-family: var(--font-display);
  color: #16352e;
  margin-bottom: 0.4rem;
}

.match-kicker {
  display: inline-block;
  margin: 0 0 0.45rem;
  padding: 0.2rem 0.7rem;
  background: #ff3d7f;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
  border-radius: 999px;
  transform: rotate(-3deg);
}

.match-screen h1 {
  display: block;
  width: fit-content;
  background: #ff3d7f;
  color: #fff8c2;
  padding: 0.45rem 1rem 0.55rem;
  border-radius: 18px;
  box-shadow: 8px 8px 0 #7d1e44;
  font-size: clamp(2rem, 6vw, 3.1rem);
  letter-spacing: -0.02em;
  transform: rotate(-1.5deg);
}

.match-deco {
  position: relative;
  height: 0;
}

.deco {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  line-height: 1;
}

.deco-sun { left: auto; right: 0; top: -0.4rem; font-size: 3.2rem; }
.deco-palm { left: -0.4rem; top: 2.6rem; font-size: 2.6rem; }
.deco-gator { right: 8%; top: 5.4rem; font-size: 2.4rem; }
.deco-bird { left: 42%; top: -0.6rem; font-size: 2.1rem; }

.deco-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.d1 { left: 8%; top: 7.5rem; background: #ffe24a; }
.d2 { right: 4%; top: 1.8rem; background: #7d5cff; }
.d3 { left: 70%; top: 8.2rem; background: #ff6b8a; }
.d4 { left: 22%; top: -0.2rem; background: #fff; }

.match-screen .subtitle,
.match-screen .play-blurb {
  color: #16352e;
  font-weight: 650;
  margin: 0.75rem 0 1rem;
  max-width: 36rem;
}

.start-list {
  margin: 0 0 1.15rem 1.1rem;
  color: var(--text);
}

.start-list li {
  margin-bottom: 0.35rem;
}

.rule-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.95rem;
  margin: 0.35rem 0 1.3rem;
  position: relative;
  z-index: 1;
}

.rule-tile {
  position: relative;
  border-radius: 28px;
  padding: 1.05rem 1rem 1.1rem;
  color: #16352e;
  min-height: 9.4rem;
  border: 4px solid #16352e;
  box-shadow: 10px 10px 0 #16352e;
}

.rule-pic {
  display: block;
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.rule-tile.tile-sun { transform: rotate(-2.4deg); }
.rule-tile.tile-lagoon { transform: rotate(2deg); }
.rule-tile.tile-coral { transform: rotate(1.6deg); }
.rule-tile.tile-sky { transform: rotate(-1.8deg); }

.rule-tile h3 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  margin: 0 0 0.28rem;
  color: inherit;
}

.rule-tile p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: inherit;
}

.rule-num {
  position: absolute;
  top: -0.65rem;
  right: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-weight: 900;
  font-size: 1rem;
  background: #16352e;
  color: #ffe24a;
  border: 3px solid #fff8c2;
}

.tile-sun {
  background: #ffe24a;
}

.tile-lagoon {
  background: #2ee0c5;
}

.tile-coral {
  background: #ff6a4d;
  color: #2a120c;
}

.tile-sky {
  background: #6d8bff;
  color: #0d1a4a;
}

.how-box {
  background: #ffe27a;
  border: 0;
  color: #3b2d08;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

.match-btn {
  appearance: none;
  border: 0;
  background: #16352e;
  color: #fff6c8;
  font: inherit;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.match-btn:hover {
  border-color: var(--green-400);
  color: var(--green-700);
}

.match-btn-primary {
  background: #ff3d7f;
  border-color: #ff3d7f;
  color: #fff8c2;
  box-shadow: 5px 5px 0 #7d1e44;
  font-size: 1.05rem;
  padding: 0.7rem 1.35rem;
}

.match-btn-primary:hover {
  background: var(--green-700);
  color: #fff;
}

.controls-note,
.legal-note {
  margin-top: 1rem;
  font-size: 0.88rem;
  color: #16352e;
  font-weight: 650;
}

.how-box,
.reward-card {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
}

.reward-card {
  background: #7bd389;
  border: 0;
  color: #14351c;
}

.reward-card .label,
.how-box .label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--green-700);
  margin-bottom: 0.3rem;
}

.reward-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--blue-800);
  margin: 0.35rem 0;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
  margin: 0.5rem 0 1rem;
}

.match-level-btn {
  text-align: left;
  border: 0;
  background: #ffd34e;
  border-radius: 14px;
  padding: 0.7rem 0.75rem;
  cursor: pointer;
  font: inherit;
  color: #16352e;
}

.match-level-btn:hover:not(:disabled) {
  border-color: var(--green-400);
}

.match-level-btn.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.match-level-btn.is-done {
  background: #4ecdc4;
}

.lvl-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--blue-800);
}

.lvl-meta,
.lvl-done,
.lvl-lock {
  display: block;
  font-size: 0.75rem;
  color: var(--text-soft);
}

.lvl-done {
  color: var(--green-700);
  font-weight: 700;
}

.match-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
  align-items: center;
  margin-bottom: 0.65rem;
  font-size: 0.92rem;
  color: var(--blue-800);
}

.match-hud strong {
  font-variant-numeric: tabular-nums;
}

.hud-stat {
  background: #ffd34e;
  color: #16352e;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-weight: 700;
}

.hud-stat.is-low,
#play-timer.is-low {
  color: #9b2c2c;
  background: #fdecec;
}

.btn-quit-inline {
  margin-left: auto;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
}

.match-board {
  width: 100%;
  max-width: 34rem;
  margin-inline: auto;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-auto-rows: auto;
  gap: 0.65rem;
  perspective: 900px;
}

.match-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-width: 0;
  min-height: 5.5rem;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
}

.match-card-inner {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.38s ease;
}

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

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

.match-card-back {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 40%),
    repeating-linear-gradient(
      135deg,
      #245a7a 0 10px,
      #2d6f95 10px 20px,
      #3d7a56 20px 30px,
      #2f5f43 30px 40px
    );
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.match-card-back::after {
  content: "";
  position: absolute;
  inset: 22%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
}

.match-card-front {
  transform: rotateY(180deg);
  background: #102028;
}

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

.match-card.is-matched {
  cursor: default;
}

.match-card.is-matched .match-card-front {
  box-shadow: inset 0 0 0 3px #3d7a56;
}

.match-pop {
  position: absolute;
  left: 50%;
  top: 20%;
  transform: translate(-50%, 0);
  z-index: 2;
  background: #3d7a56;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  animation: pop-up 0.85s ease forwards;
  pointer-events: none;
}

@keyframes pop-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -16px);
  }
}

.play-hint {
  margin-top: 0.7rem;
  min-height: 1.3em;
  color: #16352e;
  font-weight: 750;
  font-size: 0.95rem;
}

.score-pop {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--green-700);
  margin-bottom: 0.6rem;
}

.reward-choices {
  display: grid;
  gap: 0.55rem;
  margin: 0.75rem 0;
}

.reward-choices button {
  text-align: left;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Quiet ads */
.ad-rail,
.ad-strip {
  min-width: 0;
}

.quiet-ad-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #16352e;
  font-weight: 800;
  margin: 0 0 0.4rem;
}

.quiet-ad {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: #ffd34e;
  border: 0;
  border-radius: 14px;
  padding: 0.4rem;
  margin-bottom: 0.5rem;
  color: inherit;
  text-decoration: none;
}

.quiet-ad:hover {
  border-color: var(--green-400);
  color: inherit;
}

.quiet-ad img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 7px;
  flex: none;
}

.quiet-ad span {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.quiet-ad strong {
  font-size: 0.78rem;
  line-height: 1.25;
  color: var(--blue-800);
}

.quiet-ad em {
  font-style: normal;
  font-size: 0.68rem;
  color: var(--text-soft);
}

.ad-strip {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.quiet-ad-inline {
  flex-direction: column;
  align-items: stretch;
  margin: 0;
}

.quiet-ad-inline img {
  width: 100%;
  height: 72px;
}

@media (max-width: 800px) {
  .match-page .nav-links {
    background: #0e5c52;
    border-bottom: 0;
    box-shadow: none;
  }

  .match-page .nav-links a {
    border-bottom-color: rgba(255, 255, 255, 0.12);
  }
}

@media (max-width: 980px) {
  .match-layout {
    grid-template-columns: 1fr;
  }

  .ad-rail {
    display: none;
  }

  .ad-strip {
    display: grid;
  }
}

@media (max-width: 560px) {
  .rule-tiles {
    grid-template-columns: 1fr;
  }

  .rule-tile {
    min-height: 0;
    transform: none !important;
  }

  .deco-gator,
  .deco-bird,
  .deco-dot {
    display: none;
  }
}

@media (max-width: 720px) {
  .match-board {
    max-width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.5rem;
  }

  .match-card {
    min-height: 5.75rem;
    border-radius: 10px;
  }

  .match-card-shell {
    padding: 0.9rem 0.7rem 1.1rem;
  }

  .ad-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .match-board {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.4rem;
  }

  .match-card {
    min-height: 5rem;
  }
}
