/* Egg smash prototype — 4×4 tap grid */

html:has(body.egg-smash-page) {
  min-height: 100dvh;
  background-color: #050d0a;
  overscroll-behavior-y: none;
}

body.egg-smash-page {
  margin: 0;
  min-height: 100dvh;
  font-family: Fredoka, system-ui, sans-serif;
  background: radial-gradient(ellipse 120% 80% at 50% 0%, #143d2f 0%, #0a1610 45%, #050d0a 100%);
  color: #ecfdf5;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* Top-right balance (base .coin-hud is top-left in coins-hud.css) */
body.egg-smash-page .coin-hud {
  left: auto;
  right: max(0.45rem, env(safe-area-inset-right));
  z-index: 10001;
}

body.egg-smash-page .coin-wallet-overlay {
  z-index: 10002;
}

.egg-smash {
  box-sizing: border-box;
  max-width: 28rem;
  margin: 0 auto;
  padding: max(0.75rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.egg-smash__header {
  text-align: center;
  margin-bottom: 0.75rem;
}

.egg-smash__title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 5vw, 1.65rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fef3c7;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.egg-smash__tagline {
  margin: 0;
  font-size: max(0.82rem, 13px);
  font-weight: 600;
  line-height: 1.4;
  color: rgba(216, 243, 220, 0.82);
}

.egg-smash__rules {
  margin: 0 0 0.5rem;
  font-size: max(0.88rem, 14px);
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  color: rgba(216, 243, 220, 0.92);
}

.egg-smash__high-line {
  margin: 0.35rem 0 0.25rem;
  font-size: max(0.9rem, 15px);
  font-weight: 600;
  color: #fde68a;
}

.egg-smash__cost-hint {
  margin: 0 0 0.65rem;
  font-size: max(0.82rem, 13px);
  font-weight: 600;
  color: rgba(167, 243, 208, 0.85);
}

.egg-smash__btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 0 #92400e, 0 4px 12px rgba(0, 0, 0, 0.25);
}

.egg-smash__hud {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.85rem;
  background: rgba(15, 41, 30, 0.72);
  border: 2px solid rgba(149, 213, 178, 0.28);
}

.egg-smash__hud-block {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.egg-smash__hud-label {
  display: block;
  font-size: max(0.68rem, 11px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(216, 243, 220, 0.65);
}

.egg-smash__hud-value {
  display: block;
  font-size: max(1.05rem, 18px);
  font-weight: 800;
  color: #fef3c7;
  font-variant-numeric: tabular-nums;
}

.egg-smash__hud-block--good .egg-smash__hud-value {
  color: #fde68a;
}

.egg-smash__hud-block--bad .egg-smash__hud-value {
  color: #fca5a5;
}

.egg-smash__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.egg-smash__cell {
  position: relative;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: rgba(8, 28, 20, 0.55);
  box-shadow: inset 0 0 0 2px rgba(100, 150, 130, 0.22);
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}

.egg-smash__cell:disabled {
  cursor: default;
  opacity: 0.92;
}

.egg-smash__cell:not(:disabled):active {
  transform: scale(0.96);
}

.egg-smash__cell:focus-visible {
  outline: 2px solid rgba(255, 209, 102, 0.85);
  outline-offset: 2px;
}

.egg-smash__slot {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  border: 2px dashed rgba(149, 213, 178, 0.2);
  pointer-events: none;
  opacity: 0.65;
}

.egg-smash__cell--filled .egg-smash__slot {
  opacity: 0;
  pointer-events: none;
}

.egg-smash__egg {
  position: absolute;
  inset: 10%;
  border-radius: 50% 50% 48% 48% / 58% 58% 42% 42%;
  pointer-events: none;
  transform-origin: 50% 65%;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease;
  box-shadow:
    inset 0 -6px 14px rgba(0, 0, 0, 0.22),
    inset 0 8px 16px rgba(255, 255, 255, 0.28),
    0 4px 10px rgba(0, 0, 0, 0.35);
}

.egg-smash__egg--spawn {
  animation: egg-smash-pop-in 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes egg-smash-pop-in {
  from {
    transform: scale(0.35);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.egg-smash__egg--c0 {
  background: linear-gradient(165deg, #fff7ed 0%, #fed7aa 40%, #ea580c 100%);
}
.egg-smash__egg--c1 {
  background: linear-gradient(165deg, #fdf4ff 0%, #e9d5ff 45%, #a855f7 100%);
}
.egg-smash__egg--c2 {
  background: linear-gradient(165deg, #ecfeff 0%, #a5f3fc 42%, #0891b2 100%);
}
.egg-smash__egg--c3 {
  background: linear-gradient(165deg, #fffbeb 0%, #fde68a 40%, #d97706 100%);
}
.egg-smash__egg--c4 {
  background: linear-gradient(165deg, #fff1f2 0%, #fda4af 45%, #e11d48 100%);
}
.egg-smash__egg--c5 {
  background: linear-gradient(165deg, #eff6ff 0%, #bfdbfe 45%, #2563eb 100%);
}

/* Safe to pop — light / mint green */
.egg-smash__egg--green-light {
  background: linear-gradient(165deg, #f7fee7 0%, #bbf7d0 38%, #4ade80 100%);
  box-shadow:
    inset 0 -6px 14px rgba(0, 0, 0, 0.18),
    inset 0 8px 16px rgba(255, 255, 255, 0.38),
    0 4px 10px rgba(0, 0, 0, 0.32);
}

/* Bad — same green treatment as pre–light-green eggs */
.egg-smash__egg--green-bad {
  background: linear-gradient(165deg, #bbf7d0 0%, #22c55e 38%, #14532d 100%);
  box-shadow:
    inset 0 -6px 14px rgba(0, 0, 0, 0.28),
    inset 0 8px 14px rgba(255, 255, 255, 0.2),
    0 0 0 2px rgba(20, 83, 45, 0.55),
    0 4px 10px rgba(0, 0, 0, 0.4);
}

.egg-smash__egg.is-popping {
  transform: scale(0.1);
  opacity: 0;
}

.egg-smash__egg.is-shrinking {
  transition: transform 0.38s cubic-bezier(0.55, 0.06, 0.68, 0.19), opacity 0.38s ease;
  transform: scale(0);
  opacity: 0;
}

.egg-smash__bad-x {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 12vw, 2.75rem);
  font-weight: 800;
  color: #dc2626;
  text-shadow:
    0 0 12px rgba(254, 202, 202, 0.95),
    0 2px 0 rgba(127, 29, 29, 0.9);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}

.egg-smash__bad-x.is-visible {
  opacity: 1;
  transform: scale(1);
  animation: egg-smash-x-pulse 0.55s ease both;
}

@keyframes egg-smash-x-pulse {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  35% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

.egg-smash__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem 1rem;
}

.egg-smash__nav-link {
  font-size: max(0.88rem, 14px);
  font-weight: 700;
  color: rgba(167, 243, 208, 0.92);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.egg-smash__nav-link:hover {
  color: #fef3c7;
}

.egg-smash__nav-link--center {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 0.35rem;
}

.egg-smash__btn-arcade {
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin: 0;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  font-family: inherit;
  font-size: max(0.95rem, 16px);
  font-weight: 700;
  line-height: 1.2;
  color: rgba(167, 243, 208, 0.98);
  text-align: center;
  cursor: pointer;
  border: 2px solid rgba(149, 213, 178, 0.55);
  border-radius: 0.75rem;
  background: rgba(12, 45, 34, 0.65);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  -webkit-tap-highlight-color: transparent;
}

.egg-smash__btn-arcade:hover {
  color: #fef3c7;
  border-color: rgba(167, 243, 208, 0.75);
  background: rgba(20, 70, 52, 0.75);
}

.egg-smash__btn-arcade:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.egg-smash__btn-arcade:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.egg-smash__overlay-foot {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.35rem;
  /* Safe-area only — panel padding handles visual inset */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Match collapsed margin that existed before Play sat inside a flex wrapper */
.egg-smash__overlay-foot--start {
  margin-top: 0.75rem;
}

.egg-smash__overlay-foot--start .egg-smash__btn-primary {
  margin-top: 0;
}

.egg-smash__overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: rgba(5, 15, 11, 0.82);
  backdrop-filter: blur(8px);
}

/* `hidden` must win — author `display: flex` otherwise overrides the attribute */
.egg-smash__overlay[hidden] {
  display: none !important;
}

.egg-smash__overlay-panel {
  width: min(100%, 22rem);
  padding: 1.25rem 1.15rem 1rem;
  border-radius: 1.1rem;
  background: linear-gradient(165deg, rgba(30, 70, 52, 0.98) 0%, rgba(12, 38, 28, 0.99) 100%);
  border: 2px solid rgba(149, 213, 178, 0.4);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.egg-smash__overlay-title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.25rem, 4.5vw, 1.5rem);
  font-weight: 800;
  color: #fef3c7;
}

.egg-smash__overlay-text {
  margin: 0 0 0.55rem;
  font-size: max(0.9rem, 15px);
  font-weight: 600;
  line-height: 1.45;
  color: rgba(216, 243, 220, 0.9);
}

.egg-smash__btn-primary {
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.65rem 1rem;
  font-family: inherit;
  font-size: max(1rem, 16px);
  font-weight: 800;
  color: #0f291e;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  background: linear-gradient(180deg, #fde68a 0%, #f59e0b 100%);
  box-shadow: 0 4px 0 #b45309, 0 8px 20px rgba(0, 0, 0, 0.35);
}

.egg-smash__btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b45309, 0 4px 12px rgba(0, 0, 0, 0.3);
}

.egg-smash__tally-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  text-align: left;
}

.egg-smash__tally-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(149, 213, 178, 0.2);
  font-size: max(0.92rem, 15px);
  font-weight: 600;
  color: rgba(216, 243, 220, 0.95);
}

.egg-smash__tally-list li:last-child {
  border-bottom: none;
}

.egg-smash__tally-label {
  color: rgba(216, 243, 220, 0.78);
}

.egg-smash__tally-num {
  font-size: max(1.1rem, 18px);
  font-weight: 800;
  color: #fde68a;
  font-variant-numeric: tabular-nums;
}

.egg-smash__tally-num--bad {
  color: #fca5a5;
}

.egg-smash__tally-num--prize {
  color: #fde68a;
}

.egg-smash__tally-coins {
  background: rgba(45, 106, 79, 0.35);
  margin: 0.25rem -0.35rem 0.35rem;
  padding: 0.45rem 0.35rem !important;
  border-radius: 0.5rem;
  border-bottom: none !important;
}
