/* Halloween event "hw26": Gengar's Cave hub (.gc inside the online overlay) and the night menu theme (html.ev-hw26).
   Linked from dev.html after style.css (glue); nothing here changes the menu outside the event window.
   Art: assets/event-hw26 (hub background and card, candle icon, menu overlay, map candle, cave-entrance tab icon), drawn pixelated. */
:root {
  --ev-night: #120c2a;
  --ev-night2: #24164f;
  --ev-violet: #8f6cff;
  --ev-lilac: #d8c8ff;
  --ev-flame: #ffc65a;
  --ev-pumpkin: #ff8a2a;
}

/* ---------- Gengar's Cave hub ---------- */
.gc { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.gc-head {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  background: linear-gradient(90deg, rgba(10, 8, 26, .82) 0, rgba(10, 8, 26, .55) 45%, rgba(10, 8, 26, .1) 75%),
    url("../assets/event-hw26/hub-background.png") 70% 62% / cover no-repeat, var(--ev-night);
  image-rendering: pixelated;
  box-shadow: inset 0 0 0 2px #4a3796, 0 2px 0 #07041a;
  min-height: 64px;
}
.gc-head > div:first-child { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.gc-head b { font-size: 18px; color: var(--ev-lilac); }
.gc-head small { color: #b7a8e8; }
.gc-candles { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--ev-flame); white-space: nowrap; }
.gc-candle-ico {
  display: inline-block; width: 16px; height: 16px; margin-right: 2px; vertical-align: -3px;
  background: url("../assets/event-hw26/event-candle.png") center / 16px 16px no-repeat; image-rendering: pixelated;
}
.gc-tabs { flex-wrap: wrap; }
.gc-body { overflow: auto; min-height: 0; }
.gc-rules ul { margin: 6px 0 8px 18px; padding: 0; }
.gc-rules li { margin: 3px 0; color: var(--muted, #b9cbf0); }
.gc-meter { height: 10px; border-radius: 6px; background: #0e0a24; box-shadow: inset 0 0 0 2px #3a2b72; overflow: hidden; margin: 4px 0 10px; }
.gc-meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--ev-violet), var(--ev-flame)); }
.gc-book, .gc-ach, .gc-prizes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.gc-tier, .gc-ach li, .gc-prizes li {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  background: rgba(10, 6, 30, .45); box-shadow: inset 0 0 0 1px #3d2f7a;
}
.gc-tier-n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: #2a1c5e; color: var(--ev-lilac); }
.gc-tier-need { flex: none; min-width: 64px; color: var(--ev-flame); font-weight: 700; }
.gc-tier-rw, .gc-ach li > div, .gc-prizes li > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.gc-tier.ready { box-shadow: inset 0 0 0 2px var(--ev-flame); }
.gc-tier.got, .gc-ach li.claimed { opacity: .65; }
.gc-ach li > div { display: flex; flex-direction: column; }
.gc-ach li.locked b { color: #9c90c8; }
.gc-ach-rw { color: var(--ev-flame); }
.gc-done { color: var(--green, #5fe08a); font-weight: 700; white-space: nowrap; }
.gc-lock { color: #8e84b8; white-space: nowrap; }
.gc-prizes li b { flex: none; min-width: 72px; color: var(--ev-lilac); }
.gc-table th { font-size: 12px; color: #b7a8e8; font-weight: 700; }
.gc-over { display: flex; flex-direction: column; gap: 2px; }
/* Prizes v2: reward chips, the podium rows and the Hall of Fame. */
.gc-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gc-prizes li { flex-wrap: wrap; }
.gc-chip { flex: none; max-width: 100%; overflow-wrap: normal; display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 12px; background: #1d1446; box-shadow: inset 0 0 0 1px #3a2b72; color: #e6dcff; font-size: 13px; line-height: 1.2; }
.gc-chip-mon { padding: 0 8px 0 2px; }
.gc-chip-mon img { width: 32px; height: 32px; image-rendering: pixelated; }
.gc-chip-mon.shiny { box-shadow: inset 0 0 0 1px var(--ev-flame), 0 0 8px rgba(255, 210, 63, .35); color: #ffe9a8; }
.gc-chip-title { color: var(--ev-lilac); font-style: italic; }
.gc-chip-hall { color: #ffe9a8; }
.gc-prize-hall { flex-basis: 100%; color: #ffe9a8; }
.gc-ring { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 3px var(--ring); flex: none; }
.gc-ava-ico { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 50% 38%, #e6dcff 0 28%, transparent 30%), radial-gradient(circle at 50% 110%, #e6dcff 0 46%, transparent 48%), #3a2b72; flex: none; }
.gc-prizes li.podium.p1 { box-shadow: inset 0 0 0 2px #ffd23f; }
.gc-prizes li.podium.p2 { box-shadow: inset 0 0 0 2px #d8dde8; }
.gc-prizes li.podium.p3 { box-shadow: inset 0 0 0 2px #d08a4e; }
.gc-prizes li.got { opacity: .75; }
.gc-hall { margin-top: 12px; padding: 8px 10px; border-radius: 8px; background: rgba(14, 10, 36, .7); box-shadow: inset 0 0 0 1px #3a2b72; }
.gc-hall h4 { margin: 0 0 4px; color: #ffe9a8; font-size: 15px; }
.gc-hall-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.gc-hall-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gc-hall-list li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-hall-list .rk { width: 22px; text-align: center; font-weight: 800; color: var(--ev-lilac); }

@media (max-height: 460px) {
  .gc-head { padding: 6px 10px; }
    .gc-head b { font-size: 15px; }
  .gc-tier, .gc-ach li, .gc-prizes li { padding: 5px 8px; }
}

/* ---------- Night start screen and menu (event-theme.js) ----------
   The layers are the first children of #tap-start and #scr-menu with z-index -1: both screens are fixed stacking contexts,
   so the layers cover the world canvas behind the screen and stay under its text and buttons (only the world is tinted). */
html.ev-hw26 #scr-menu .menu-item.play { box-shadow: 0 0 0 2px var(--ev-pumpkin), 0 0 16px rgba(255, 138, 42, .45); }
.ev-night, .ev-decor { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
/* Violet night over the world, a moonlit corner and a vignette: plain alpha layers, cheap to composite on phones. */
.ev-night {
  background:
    radial-gradient(ellipse 85% 80% at 50% 45%, transparent 55%, rgba(6, 3, 20, .4) 100%),
    radial-gradient(ellipse 55% 40% at 82% 6%, rgba(143, 108, 255, .18), transparent 70%),
    linear-gradient(rgba(38, 18, 92, .18), rgba(24, 12, 60, .24));
}
.ev-decor { background: url("../assets/event-hw26/menu-night-decor.png") center bottom / cover no-repeat; image-rendering: pixelated; opacity: .9; }
.ev-decor i { position: absolute; display: block; }
.ev-fog {
  left: -10%; right: -10%; bottom: -4%; height: 26%;
  background: radial-gradient(ellipse 50% 60% at 30% 100%, rgba(190, 170, 255, .16), transparent 70%),
              radial-gradient(ellipse 50% 60% at 75% 100%, rgba(190, 170, 255, .12), transparent 70%);
  animation: ev-drift 18s ease-in-out infinite alternate;
}
@keyframes ev-drift { from { transform: translateX(-3%); } to { transform: translateX(3%); } }
/* Map candles (32 px art) in the grass at the bottom edges; whole-number scale. */
.ev-candle {
  --s: 1; width: calc(32px * var(--s)); height: calc(32px * var(--s));
  background: url("../assets/event-hw26/map-candle.png") 0 0 / 100% 100% no-repeat; image-rendering: pixelated;
  animation: ev-flicker 1.7s steps(1, end) infinite;
}
.ev-candle.c1 { left: 3%; bottom: 5%; }
.ev-candle.c2 { left: 11%; bottom: 2%; animation-delay: -.6s; }
.ev-candle.c3 { right: 24%; bottom: 3%; animation-delay: -1.1s; }
.ev-candle.c4 { right: 33%; bottom: 7%; animation-delay: -.3s; }
@keyframes ev-flicker { 0% { opacity: 1; } 22% { opacity: .78; } 30% { opacity: 1; } 61% { opacity: .86; } 70% { opacity: 1; } }
/* Gengar's Cave peeking in: the arch of hub-background.png (x 176-320, y 0-144 of 320x180), faded at its edges. Decor only;
   the banner above the Play group opens the cave. */
.ev-cave {
  --s: 1; position: absolute; z-index: -1; width: calc(144px * var(--s)); height: calc(144px * var(--s)); pointer-events: none;
  background: url("../assets/event-hw26/hub-background.png") calc(-176px * var(--s)) 0 / calc(320px * var(--s)) calc(180px * var(--s)) no-repeat;
  image-rendering: pixelated;
  -webkit-mask-image: radial-gradient(ellipse 66% 66% at 60% 54%, #000 46%, transparent 92%);
  mask-image: radial-gradient(ellipse 66% 66% at 60% 54%, #000 46%, transparent 92%);
}
#tap-start > .ev-cave { right: calc(-24px * var(--s)); bottom: calc(-12px * var(--s)); }
#scr-menu > .ev-cave { left: calc(-28px * var(--s)); bottom: calc(-14px * var(--s)); }
@media (min-width: 1700px) and (min-height: 900px) { .ev-cave, .ev-candle { --s: 2; } }
@media (max-height: 460px) { #scr-menu > .ev-cave { display: none; } .ev-candle.c3, .ev-candle.c4 { display: none; } }
@media (prefers-reduced-motion: reduce) { .ev-fog, .ev-candle { animation: none; } }
/* "Gengar's Cave · Night event" banner across the full width above the Play group, in the night card style: the hub card art
   behind dark violet, a violet frame and the cave-entrance icon. While it shows, the Play group's own entry hides and the side
   column is Daily, Friends and Leaderboard as outside the event. */
html.ev-hw26 #scr-menu .mg-play-side [data-go=cave] { display: none; }
#scr-menu .ev-banner {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; margin: 0; padding: 8px 18px 8px 12px;
  border: 0; border-radius: 16px; cursor: pointer; text-align: left; color: #f1eaff; text-shadow: 0 1px 0 #07041a;
  background: linear-gradient(90deg, rgba(18, 12, 42, .94) 0, rgba(18, 12, 42, .74) 50%, rgba(18, 12, 42, .3)),
    url("../assets/event-hw26/hub-card.png") right 30% / auto 220% no-repeat, #1a1240;
  image-rendering: pixelated;
  box-shadow: 0 0 0 2px var(--ev-violet), 0 0 16px rgba(143, 108, 255, .5), 0 10px 28px rgba(5, 12, 32, .38);
}
#scr-menu .ev-banner::before { display: none; }
#scr-menu .ev-banner:hover, #scr-menu .ev-banner:focus-visible { outline: none; filter: brightness(1.12);
  box-shadow: 0 0 0 3px var(--ev-lilac), 0 0 22px rgba(143, 108, 255, .7), 0 10px 28px rgba(5, 12, 32, .38); }
.ev-banner-ico { flex: none; width: 48px; height: 48px; background: url("../assets/event-hw26/hub-tab-play@2x.png") 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }
.ev-banner-t { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
#scr-menu .ev-banner b { font-size: 22px; font-weight: 800; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #f1eaff; }
#scr-menu .ev-banner small { display: block; font-size: 13px; color: #cbb9ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-banner-go { flex: none; font-style: normal; font-size: 30px; line-height: 1; color: var(--ev-lilac); }
@media (max-height: 860px) and (min-height: 521px) {
  #scr-menu .ev-banner { min-height: 54px; padding: 6px 16px 6px 10px; }
  .ev-banner-ico { width: 40px; height: 40px; }
  #scr-menu .ev-banner b { font-size: 19px; }
}
@media (max-aspect-ratio: 1/1) and (min-height: 521px) {
  #scr-menu .ev-banner { min-height: 48px; }
  #scr-menu .ev-banner b { font-size: 18px; }
}
/* Phones held sideways: one compact line across the grid, title and subtitle side by side. */
@media (max-height: 520px) {
  #scr-menu .ev-banner { grid-column: 1 / -1; min-height: 30px; gap: 8px; padding: 2px 10px 2px 6px; border-radius: 10px; }
  .ev-banner-ico { width: 24px; height: 24px; background-image: url("../assets/event-hw26/hub-tab-play.png"); }
  .ev-banner-t { flex-direction: row; align-items: baseline; gap: 8px; }
  #scr-menu .ev-banner b { font-size: 14px; }
  #scr-menu .ev-banner small { font-size: 11px; }
  .ev-banner-go { font-size: 18px; }
}
/* The entry in the Play group shows the hub card art behind its text. */
#scr-menu [data-go=cave] {
  background: linear-gradient(90deg, rgba(18, 12, 42, .92) 0, rgba(18, 12, 42, .7) 55%, rgba(18, 12, 42, .25)),
    url("../assets/event-hw26/hub-card.png") right 30% / auto 160% no-repeat, #1a1240;
  image-rendering: pixelated;
}
#scr-menu [data-go=cave], #scr-menu [data-go=cave] small, #scr-menu [data-go=cave] span { color: #f1eaff; }
#scr-menu [data-go=cave] small { color: #cbb9ff; }
#scr-menu [data-go=cave] { text-shadow: 0 1px 0 #07041a; }

/* Night calendar (task 12): ten cards in a grid that wraps on narrow screens; art (night-card*.png) replaces the stub frame. */
.gc-nights { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.gc-night {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border-radius: 8px; text-align: center; min-width: 0;
  background: rgba(10, 6, 30, .45); box-shadow: inset 0 0 0 1px #3d2f7a;
}
.gc-night small { overflow-wrap: anywhere; color: var(--ev-flame); }
.gc-night.open { box-shadow: inset 0 0 0 2px var(--ev-flame); }
.gc-night.claimed { opacity: .65; }
.gc-night.locked b { color: #9c90c8; }
.gc-first { color: var(--ev-flame); }
/* Dark Egg in the incubator: the 38×50 art (egg-dark-incubator) in place of the drawn egg; the night-10 egg glows. */
.egg-art.dark {
  filter: none; border: 0; border-radius: 0; width: 38px; height: 50px; image-rendering: pixelated;
  background: url(../assets/event-hw26/ui/egg-dark-incubator.png) center / 38px 50px no-repeat;
  background-image: image-set(url(../assets/event-hw26/ui/egg-dark-incubator.png) 1x, url(../assets/event-hw26/ui/egg-dark-incubator@2x.png) 2x);
}
.egg-art.dark.sparkle { filter: drop-shadow(0 0 6px #c9a6ff); }

/* Wave 1 art: pixel icons at their native size (or exact halves for chips), never smoothed. */
.gc-art { image-rendering: pixelated; flex: none; }
.gc-tabs .gen-tab { display: inline-flex; align-items: center; gap: 4px; }
.gc-tab-ico { width: 32px; height: 32px; margin: -6px 0; }
.gc-rw-ico, .gc-ach-ico, .gc-place-ico { width: 32px; height: 32px; vertical-align: middle; margin-right: 4px; }
.gc-chip-ico { width: 16px; height: 16px; vertical-align: middle; margin-right: 3px; }
.gc-ncard { position: relative; display: block; width: 96px; height: 128px; margin: 0 auto; }
.gc-ncard-bg { position: absolute; inset: 0; width: 96px; height: 128px; }
.gc-ncard-rw { position: absolute; left: 20px; top: 32px; width: 56px; height: 64px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; align-content: center; gap: 0; }
.gc-ncard-rw .gc-rw-ico { margin: 0; }
.gc-ncard-n { position: absolute; left: 34px; top: 113px; width: 28px; height: 7px; overflow: hidden; font: 800 8px/7px Pixelify, "Segoe UI", system-ui, sans-serif; text-align: center; color: #f3e9ff; text-shadow: 0 1px 0 #120a2a; }
