/**
 * Friends of Peat Easter egg game.
 *
 * Reuses the public theme tokens and intentionally stays visually subordinate
 * to the site rather than introducing a separate arcade design language.
 */

body.wv-easter-egg-open { overflow: hidden; }

.wv-easter-egg[hidden] { display: none !important; }
.wv-easter-egg {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 17, 13, .72);
  backdrop-filter: blur(8px);
}

.wv-easter-egg__dialog {
  position: relative;
  width: min(860px, 100%);
  height: min(760px, calc(100dvh - 48px));
  min-height: 560px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--wv-line) 72%, #5f3918);
  border-radius: var(--wv-radius);
  background: var(--wv-surface);
  box-shadow: 0 24px 70px rgba(20, 17, 13, .34);
  color: var(--wv-text);
}

.wv-easter-egg__close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 30;
  width: 42px;
  height: 42px;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255,247,234,.88);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.wv-easter-egg__close::before,
.wv-easter-egg__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 23px;
  height: 2.5px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}
.wv-easter-egg__close::before { transform: translate(-50%, -50%) rotate(45deg); }
.wv-easter-egg__close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.wv-easter-egg__close:hover {
  color: var(--wv-accent);
  background: rgba(255,255,255,.05);
}
.wv-easter-egg__close:focus-visible {
  outline: 2px solid var(--wv-accent);
  outline-offset: 2px;
  background: rgba(255,255,255,.05);
}

.wv-easter-egg__screen {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
.wv-easter-egg__screen[hidden] { display: none !important; }

.wv-easter-egg__intro,
.wv-easter-egg__pause {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: clamp(40px, 5vw, 52px) clamp(20px, 5vw, 52px);
  background:
    radial-gradient(circle at 86% 15%, rgba(156,100,31,.11), transparent 34%),
    var(--wv-surface);
}

.wv-easter-egg__copy { width: min(760px, 100%); }
.wv-easter-egg__eyebrow {
  margin: 0 0 10px;
  color: var(--wv-accent-dark);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.wv-easter-egg h2 {
  margin: 0;
  font-family: var(--wv-heading-font);
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.02;
  text-wrap: balance;
}
.wv-easter-egg__lead {
  max-width: 660px;
  margin: 16px 0 0;
  color: var(--wv-muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.wv-easter-egg__legend {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}
.wv-easter-egg__legend-item {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 5px;
  padding: 12px 15px;
  border: 1px solid var(--wv-line);
  border-radius: 12px;
  background: var(--wv-bg);
}
.wv-easter-egg__legend-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.wv-easter-egg__legend-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.wv-easter-egg__legend-item strong { font-size: .95rem; }
.wv-easter-egg__legend-item span { color: var(--wv-muted); font-size: .82rem; }

.wv-easter-egg__rules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
  margin: 20px 0 0;
  color: var(--wv-muted);
  font-size: .92rem;
}
.wv-easter-egg__rules p { margin: 0; }
.wv-easter-egg__rules strong { color: var(--wv-text); }
.wv-easter-egg__specials {
  margin: 18px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--wv-line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--wv-bg) 76%, #f3ede3);
}
.wv-easter-egg__specials-title {
  margin: 0 0 10px;
  color: var(--wv-text);
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.wv-easter-egg__specials-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}
.wv-easter-egg__special-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--wv-muted);
  font-size: .9rem;
}
.wv-easter-egg__special-item strong { color: var(--wv-text); }
.wv-easter-egg__special-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(156,100,31,.12);
  color: var(--wv-accent-dark);
  font-size: 1rem;
  flex: 0 0 28px;
}
.wv-easter-egg__actions { margin-top: 22px; }
.wv-easter-egg__intro .wv-easter-egg__actions {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}
.wv-easter-egg__intro .wv-easter-egg__copy {
  padding-bottom: 0;
}
.wv-easter-egg .wv-button { cursor: pointer; }

.wv-easter-egg__game {
  overflow: hidden;
  background: #1e1914;
  color: #fff;
}
.wv-easter-egg__hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  min-height: 66px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 64px 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: rgba(24, 19, 15, .82);
  backdrop-filter: blur(8px);
}
.wv-easter-egg__stat { min-width: 0; }
.wv-easter-egg__stat-label {
  display: block;
  color: rgba(255,255,255,.58);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.wv-easter-egg__stat-value {
  display: block;
  overflow: hidden;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wv-easter-egg__canvas-wrap {
  position: absolute;
  inset: 66px 0 0;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: contain;
  background:
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(214,177,104,.14) 39px 41px),
    radial-gradient(circle at 50% 12%, rgba(181,116,38,.12), transparent 33%),
    linear-gradient(180deg, #241d16 0%, #17130f 100%);
}
.wv-easter-egg__canvas { width: 100%; height: 100%; display: block; touch-action: none; }

.wv-easter-egg__pause {
  z-index: 20;
  background: rgba(29, 24, 19, .94);
  color: #fff;
}
.wv-easter-egg__pause .wv-easter-egg__copy { max-width: 520px; text-align: center; }
.wv-easter-egg__pause .wv-easter-egg__lead { color: rgba(255,255,255,.72); }

.wv-easter-egg__end {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100%;
  overflow: hidden;
  color: #fff7ea;
  background:
    radial-gradient(circle at 20% 12%, rgba(188,117,38,.22), transparent 28%),
    radial-gradient(circle at 82% 82%, rgba(121,70,28,.24), transparent 35%),
    linear-gradient(145deg, #24180f 0%, #130f0b 55%, #2b1b10 100%);
}
.wv-easter-egg__end::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image:
    repeating-linear-gradient(4deg, rgba(255,255,255,.06) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(92deg, rgba(255,255,255,.035) 0 1px, transparent 1px 26px);
}
.wv-easter-egg__end-head,
.wv-easter-egg__end-foot {
  position: relative;
  z-index: 4;
  text-align: center;
  background: linear-gradient(180deg, rgba(17,13,10,.96), rgba(17,13,10,.82));
}
.wv-easter-egg__end-head { padding: 42px 54px 18px; }
.wv-easter-egg__end-head h2 { font-size: clamp(2rem, 5vw, 3.8rem); }
.wv-easter-egg__end-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 14px;
  color: rgba(255,247,234,.75);
  font-size: .92rem;
}
.wv-easter-egg__end-stats strong { color: #f0bd76; }
.wv-easter-egg__credits-window {
  position: relative;
  z-index: 2;
  min-height: 0;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 88%, transparent 100%);
}
.wv-easter-egg__credits {
  width: min(780px, calc(100% - 40px));
  margin-inline: auto;
  padding: 44vh 0 52vh;
  text-align: center;
  animation: wv-fop-credits 34s linear infinite;
}
.wv-easter-egg__credits h3 {
  margin: 0 0 28px;
  color: #f0bd76;
  font-family: var(--wv-heading-font);
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  font-weight: 400;
}
.wv-easter-egg__credits p {
  margin: 0 0 26px;
  color: rgba(255,247,234,.91);
  font-family: var(--wv-heading-font);
  font-size: clamp(1.24rem, 2.9vw, 1.82rem);
  line-height: 1.6;
}
.wv-easter-egg__credits-list {
  margin: 0 0 30px;
  padding: 0;
  list-style: none;
}
.wv-easter-egg__credits-list li {
  margin: 0 0 18px;
  color: rgba(255,247,234,.91);
  font-family: var(--wv-heading-font);
  font-size: clamp(1.14rem, 2.7vw, 1.7rem);
  line-height: 1.55;
}
.wv-easter-egg__credits .wv-easter-egg__credits-final {
  margin-top: 56px;
  color: #f0bd76;
  font-size: clamp(1.45rem, 3.3vw, 2.25rem);
}
.wv-easter-egg__end-foot { padding: 16px 24px 24px; }
.wv-easter-egg__end-foot .wv-button { min-width: 170px; }

@keyframes wv-fop-credits {
  from { transform: translateY(0); }
  to { transform: translateY(calc(-100% + 20vh)); }
}

@media (max-width: 700px) {
  .wv-easter-egg { padding: 8px; }
  .wv-easter-egg__dialog {
    width: 100%;
    height: calc(100dvh - 16px);
    min-height: 0;
    border-radius: 14px;
  }
  .wv-easter-egg__intro { align-items: start; padding: 42px 18px 22px; }
  .wv-easter-egg__legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wv-easter-egg__rules { grid-template-columns: 1fr; gap: 8px; }
  .wv-easter-egg__specials-items { grid-template-columns: 1fr; }
  .wv-easter-egg__hud {
    min-height: 72px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    padding: 10px 52px 10px 12px;
  }
  .wv-easter-egg__stat-label { font-size: .58rem; letter-spacing: .06em; }
  .wv-easter-egg__stat-value { font-size: .88rem; }
  .wv-easter-egg__canvas-wrap { inset: 72px 0 0; }
  .wv-easter-egg__end-head { padding: 42px 46px 14px; }
  .wv-easter-egg__end-stats { gap: 7px 16px; }
  .wv-easter-egg__credits { width: min(90%, 700px); }
}

@media (prefers-reduced-motion: reduce) {
  .wv-easter-egg__credits-window { overflow: auto; mask-image: none; }
  .wv-easter-egg__credits {
    padding: 36px 0 48px;
    animation: none !important;
    transform: none !important;
  }
}
