/* Halloween (free): a haunted night with a big moon, bats flapping past, a haunted house and graveyard, glowing
   jack-o'-lanterns and drifting fog; slime on the buttons, cobwebs on cards, tombstone tiles and a bat on the title.
   Colours are in theme-flat.css. */

/* ---- the scene (built by buildHalloween() in app.js) ---- */
[data-theme="halloween"] #stage-bg { background: radial-gradient(90% 50% at 70% 8%, rgba(150, 255, 170, .08), transparent 60%),
  linear-gradient(#07040f 0%, #160b2a 45%, #2a1445 80%, #3a1a3f 100%); }
[data-theme="halloween"] .scene .moon { width: 5.2rem; height: 5.2rem; top: max(1.4rem, calc(env(safe-area-inset-top) + .6rem)); right: 1.2rem;
  background: radial-gradient(circle at 40% 38%, #fbffe8, #e6f2b8 60%, #b9c98a); box-shadow: 0 0 60px 18px rgba(210, 255, 170, .22); }

/* bats flapping across the sky */
.scene .bat { position: absolute; width: 2.6rem; animation: batpath var(--d) linear infinite; animation-delay: var(--t); opacity: .9; }
.scene .bat svg { width: 100%; height: auto; display: block; animation: flap .28s ease-in-out infinite alternate; transform-origin: 50% 60%; }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(.45); } }
@keyframes batpath {
  0% { transform: translate(-15vw, var(--y)) scale(var(--s)); }
  50% { transform: translate(50vw, calc(var(--y) - 6vh)) scale(var(--s)); }
  100% { transform: translate(115vw, var(--y)) scale(var(--s)); } }

/* the haunted hill, house, graveyard and pumpkins */
.scene .haunt { position: absolute; left: 0; right: 0; bottom: calc(var(--tabh) + env(safe-area-inset-bottom)); height: 26vh; }
.scene .haunt::after { content: ''; position: absolute; left: 0; right: 0; top: calc(100% - 1px); height: 8rem; background: #0b0614; }
.scene .haunt svg { position: absolute; inset: auto 0 0 0; width: 100%; height: 100%; }
.scene .haunt .win { animation: flicker 3s ease-in-out infinite; }
.scene .haunt .win:nth-of-type(2n) { animation-delay: -1.3s; }
.scene .haunt .jack { animation: flicker 2.2s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: .55; } 50% { opacity: .9; } 70% { opacity: .65; } }

/* fog drifting along the ground */
.scene .fog { position: absolute; left: -30%; width: 160%; height: 14vh; bottom: calc(4rem + env(safe-area-inset-bottom) + var(--b));
  background: radial-gradient(50% 50% at 50% 50%, rgba(220, 210, 255, .16), transparent 70%); filter: blur(6px);
  animation: fog var(--d) ease-in-out infinite alternate; }
@keyframes fog { from { transform: translateX(-8%); } to { transform: translateX(8%); } }

/* ---- the app ---- */
[data-theme="halloween"] .logo .l1 { position: relative; }
[data-theme="halloween"] .logo:not(.small) .l1::before { content: ''; position: absolute; left: -.5em; top: -.48em; width: 1.05em; height: .6em;
  transform: rotate(-14deg); pointer-events: none; animation: flap 1.6s ease-in-out infinite alternate;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3Cpath d='M30 14Q20 0 2 6q8 2 6 10 8-4 10 4 6-6 12-6 6 0 12 6 2-8 10-4-2-8 6-10Q40 0 30 14z' fill='%232b2140' stroke='%23000' stroke-width='1.5'/%3E%3Ccircle cx='27' cy='12' r='1.8' fill='%23ffd84d'/%3E%3Ccircle cx='33' cy='12' r='1.8' fill='%23ffd84d'/%3E%3C/svg%3E") center / contain no-repeat; }
[data-theme="halloween"] .logo .l2 { color: #ff7a1a; filter: drop-shadow(0 0 12px rgba(255, 122, 26, .55)); animation: firelight 2.4s ease-in-out infinite; }
[data-theme="halloween"] :is(.title, .tag, .home .dim) { text-shadow: 0 2px 10px rgba(0, 0, 0, .7); }

/* green slime dripping off the top of every main button */
[data-theme="halloween"] .btn:not(.ghost):not(.small) { position: relative; overflow: visible; }
[data-theme="halloween"] .btn:not(.ghost):not(.small)::before { content: ''; position: absolute; left: 6%; right: 6%; top: -3px; height: 20px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 22' preserveAspectRatio='none'%3E%3Cpath d='M0 0H200V5q-8 2-10 0-3 12-7 12t-4-10q-10 2-24 0-2 16-7 16t-5-14q-18 2-36 0-2 9-6 9t-5-9q-22 2-44 0-1 13-6 13t-6-11Q20 8 0 5z' fill='%237be04a'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
[data-theme="halloween"] .btn:not(.ghost) { box-shadow: 0 3px 0 color-mix(in srgb, var(--hot) 55%, black), 0 0 16px color-mix(in srgb, var(--hot) 40%, transparent); }
[data-theme="halloween"] .btn.gold { color: #fff; }
[data-theme="halloween"] .btn.alt { color: #0b2420; }

/* cobwebs in the corner of cards */
[data-theme="halloween"] .panel { position: relative; backdrop-filter: blur(6px); box-shadow: var(--shadow), inset 0 1px 0 rgba(200, 160, 255, .18); }
[data-theme="halloween"] .panel::after { content: ''; position: absolute; top: 0; right: 0; width: 3.4rem; height: 3.4rem; pointer-events: none; opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60' fill='none' stroke='%23e8dcff' stroke-width='1'%3E%3Cpath d='M60 0L20 40M60 0L0 22M60 0L38 60M60 0L4 52'/%3E%3Cpath d='M60 12Q52 14 49 11T60 12M60 26Q46 28 40 20 42 12 48 0M60 40Q40 44 30 30 34 16 34 0M60 54Q34 60 20 40 24 18 20 0'/%3E%3C/svg%3E") top right / contain no-repeat; }

/* Head to Head tiles are tombstones */
[data-theme="halloween"] .topic { border: 0; border-radius: 48% 48% 12px 12px / 30% 30% 12px 12px; padding-top: 1.1rem;
  background: linear-gradient(180deg, #4a4560, #2f2b42); color: #f1eaff;
  box-shadow: 0 4px 0 #1b1828, inset 0 2px 0 rgba(255, 255, 255, .12), 0 0 18px color-mix(in srgb, var(--sc) 25%, transparent); }
[data-theme="halloween"] .topic .ic { width: 2.2rem; height: 2.2rem; padding: .4rem; border-radius: 50%; color: #fff;
  background: var(--sc); box-shadow: 0 0 14px color-mix(in srgb, var(--sc) 70%, transparent); }
[data-theme="halloween"] .topic small { color: #b9a8d6; }
[data-theme="halloween"] #splash { background: linear-gradient(#07040f, #2a1445); }
[data-theme="halloween"] .splash-icon { background-image: url(/icons/icon-halloween-512.png); box-shadow: 0 0 40px rgba(255, 122, 26, .4); }

@media (prefers-reduced-motion: reduce) {
  [data-theme="halloween"] .scene *, [data-theme="halloween"] .logo * { animation: none !important; }
  .scene .bat, .scene .fog { display: none; }
}
