/* Zombie apocalypse mode (public/ui/zombie.js). Just for fun; on this phone only (localStorage sp.zombie).
   html[data-zombie] swaps the colours and the background for the whole app and wins over Look and "What you use it for".
   Day: grey-green paper with plum. Night: plum-black with moss green. Cards look stitched on, like patches. */
:root[data-zombie][data-zombie] { --bg: #e3e8d6; --card: #f4f6ea; --deep: #d6ddc4; --line: #c3cdae; --ink: #2a2233; --muted: #5e5a66;
  --brand: #2a2233; --brand-2: #2a2233; --pa: #6a4a7c; --accent: #7a9a3a; --gold: #7a9a3a; --good: #5f8a4e; --ok: #3f6b2f; --okbg: #dbe8c8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-zombie][data-zombie] { --bg: #1b1520; --card: #261e2d; --deep: #30263a; --line: #44384f; --ink: #e9e6d6; --muted: #aaa2b0;
    --brand: #e9e6d6; --brand-2: #e9e6d6; --pa: #a9cc6a; --accent: #a9cc6a; --gold: #a9cc6a; --good: #8fb86a; --ok: #a9cc6a; --okbg: #2a3a24; }
}
:root[data-theme="dark"][data-zombie][data-zombie] { --bg: #1b1520; --card: #261e2d; --deep: #30263a; --line: #44384f; --ink: #e9e6d6; --muted: #aaa2b0;
  --brand: #e9e6d6; --brand-2: #e9e6d6; --pa: #a9cc6a; --accent: #a9cc6a; --gold: #a9cc6a; --good: #8fb86a; --ok: #a9cc6a; --okbg: #2a3a24; }

html[data-zombie] .card { border: 1.5px dashed color-mix(in srgb, var(--pa) 45%, var(--line)); }
html[data-zombie] nav.bottom { border-top: 2px dashed color-mix(in srgb, var(--pa) 45%, var(--line)); }
/* The background: the same fixed layer as Settings > Background (backgrounds.css), and it wins over the one picked there. */
html[data-zombie] { background: var(--bg); }
html[data-zombie] body { background: transparent !important; }
html[data-zombie] body::before, html[data-zombie] body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
html[data-zombie] body::before { background: var(--bg) !important; }
html[data-zombie] header.top { background: transparent; border-bottom-color: transparent; }
html[data-zombie][data-zombie] body::after { background: url("art/bg-zombie.webp") center bottom / cover !important; opacity: 1 !important; filter: none !important; -webkit-mask: none !important; mask: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"])[data-zombie][data-zombie] body::after { background-image: url("art/bg-night-zombie.webp") !important; } }
:root[data-theme="dark"][data-zombie][data-zombie] body::after { background-image: url("art/bg-night-zombie.webp") !important; }
@media (prefers-contrast: more) { html[data-zombie][data-zombie] body::after { display: none; } }

/* The pretend list on Suggested supplies */
.zcard .zscene { display: block; width: min(100%, 340px); height: auto; margin: .2rem auto .6rem; }
.zcard .znote { background: var(--deep); border-radius: 12px; padding: .6rem .75rem; margin: .4rem 0 .6rem; }
.zcard .zgroup { display: flex; align-items: center; gap: .4rem; margin: 1rem 0 .2rem; font-size: 1rem; }
.zcard .zsum { margin: .2rem 0 .4rem; }
.zcard .zsum .rbar { display: block; margin-top: .35rem; }
.zpick .rpic.wide { object-fit: contain; }
.rcards + .zpick, .zpick { margin-bottom: .6rem; }
.zswitch { align-items: flex-start; gap: .6rem; margin-top: .8rem; }
.zswitch .check { flex: none; margin-top: .15rem; }

/* The walkers: a strip just above the tab bar. Nothing in it takes a tap. */
#zwalk { position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); height: 84px; z-index: 9; pointer-events: none; overflow: hidden; }
.zom { position: absolute; bottom: -6px; left: 0; height: var(--zh, 70px); animation: zom-cross var(--zs, 20s) linear var(--zd, 0s) both; will-change: transform; }
.zom img { height: 100%; width: auto; display: block; transform-origin: 50% 100%; animation: zom-step var(--zstep, .85s) ease-in-out infinite alternate; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .12)); }
.zom img { pointer-events: auto; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.zom.left { animation-name: zom-cross-left; }
.zom.hurry img { animation-duration: .16s; }
.zom.poof { transition: transform .5s cubic-bezier(.2, .9, .3, 1.4), opacity .5s ease-out; }
.zom.poof img { animation: zom-poof .5s ease-out forwards; }
.zom.poof::after { content: ""; position: absolute; left: 50%; top: 50%; width: 70px; height: 70px; margin: -35px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--card) 90%, transparent) 0 30%, color-mix(in srgb, var(--pa) 35%, transparent) 31% 46%, transparent 47%); animation: zom-puff .5s ease-out forwards; }
@keyframes zom-poof { to { transform: scale(.2) rotate(40deg); opacity: 0; } }
@keyframes zom-puff { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.zom.left img { animation-name: zom-step-left; }
@keyframes zom-cross { from { transform: translateX(-90px); } to { transform: translateX(100vw); } }
@keyframes zom-cross-left { from { transform: translateX(100vw); } to { transform: translateX(-90px); } }
@keyframes zom-step { from { transform: rotate(-6deg) translateY(0); } 50% { transform: rotate(0deg) translateY(-3px); } to { transform: rotate(6deg) translateY(0); } }
@keyframes zom-step-left { from { transform: scaleX(-1) rotate(-6deg) translateY(0); } 50% { transform: scaleX(-1) rotate(0deg) translateY(-3px); } to { transform: scaleX(-1) rotate(6deg) translateY(0); } }
/* Animations off or Reduce Motion: no walking. One zombie stands in the corner. */
.zom.stand { left: auto; right: 6px; height: 58px; animation: none; opacity: .9; }
.zom.stand img { animation: none; }
:root[data-motion="off"] .zom:not(.stand) { display: none; }
@media (prefers-reduced-motion: reduce) { .zom:not(.stand) { display: none; } }
@media print { #zwalk { display: none; } }

/* How long would you last? (the pretend run on the zombie screen) */
.zgame .zstage { position: relative; margin: .2rem 0 .7rem; padding-bottom: 6px; border-radius: 16px; background: var(--deep); overflow: hidden; }
.zgame .zhouse { display: block; width: min(86%, 300px); height: auto; margin: 0 auto; padding-top: .5rem; transition: filter .6s; }
.zgame .zmob { position: absolute; left: 0; right: 0; bottom: 0; height: 58px; pointer-events: none; }
.zgame .zmob img { position: absolute; bottom: -4px; height: 54px; width: auto; left: calc(2% + var(--i) * 12.2%); transform-origin: 50% 100%; animation: zom-arrive .45s cubic-bezier(.34, 1.56, .64, 1) both, zom-step .8s ease-in-out .45s infinite alternate; }
.zgame .zmob img:nth-child(even) { height: 48px; animation-duration: .45s, .95s; }
@keyframes zom-arrive { from { transform: translateY(60px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.zgame .zday { position: absolute; top: .5rem; right: .6rem; display: grid; justify-items: center; min-width: 58px; padding: .25rem .55rem .35rem; border-radius: 12px; background: var(--card); border: 1px solid var(--line); line-height: 1.05; }
.zgame .zday small { font-size: .7rem; color: var(--muted); }
.zgame .zday b { font-size: 1.6rem; font-variant-numeric: tabular-nums; font-family: var(--display); }
.zgame.done.lost .zhouse { filter: saturate(.55) brightness(.9); }
.zmeters { display: grid; gap: .55rem; margin-bottom: .8rem; }
.zmeter { display: flex; align-items: center; gap: .6rem; }
.zmeter .grow { flex: 1; min-width: 0; display: grid; gap: .25rem; }
.zmeter .sbar { display: block; }
.zmeter .sbar i { transition: width .08s linear; }
.zmeter .snum { min-width: 4.6rem; text-align: right; font-variant-numeric: tabular-nums; }
.zmeter.out b { color: var(--bad); }
.zresult { display: grid; gap: .15rem; text-align: center; padding: .7rem .75rem; margin-bottom: .8rem; border-radius: 12px; background: var(--deep); }
.zresult .zlast { font-family: var(--display); font-size: 1.5rem; line-height: 1.15; }
.zresult .zstars { color: var(--accent); font-size: 1.25rem; letter-spacing: .12em; }
.zresult .zstars i { font-style: normal; opacity: .25; }
:root[data-motion="off"] .zgame .zmob img { animation: none; }
@media (prefers-reduced-motion: reduce) { .zgame .zmob img { animation: none; } }
