/* Scéna: pozadí, mýval, popelnice, skládka, efekty. */

:root {
  --bg0: #0b0d1a; --bg1: #171a2e; --panel: #1d2138; --panel2: #262b4a;
  --text: #eef0ff; --dim: #8f95bd; --gold: #ffd44d; --green: #5dffa0; --pink: #ff7ad9;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg0); color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; overflow: hidden; user-select: none; }
#app { display: flex; height: 100%; }

/* ---------- scene ---------- */
#stage { position: relative; flex: 1 1 58%; overflow: hidden;
  background:
    radial-gradient(ellipse 50% 55% at 50% 42%, rgba(150, 185, 255, .15), transparent 70%),
    linear-gradient(#060920, #0d1535 50%, #18224d 76%, #0a0b16); }
/* noční obloha: hvězdy, měsíc a jemné tmavé mraky nahoře */
#sky { position: absolute; inset: 0; overflow: hidden; }
#sky svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#moon { position: absolute; right: 13%; top: 17%; width: max(44px, 9cqw); aspect-ratio: 1; border-radius: 50%;
  background:
    radial-gradient(circle at 34% 38%, rgba(150,160,185,.45) 0 9%, transparent 10%),
    radial-gradient(circle at 64% 30%, rgba(150,160,185,.35) 0 6%, transparent 7%),
    radial-gradient(circle at 58% 66%, rgba(150,160,185,.4) 0 11%, transparent 12%),
    radial-gradient(circle at 36% 32%, #fffbe8, #e4e8f5 60%, #bfc8e0);
  box-shadow: 0 0 22px 6px rgba(200,215,255,.35), 0 0 80px 30px rgba(140,170,255,.18); }
.cloud { position: absolute; border-radius: 50%; background: rgba(3,5,18,.75); filter: blur(16px); animation: cloudDrift 46s ease-in-out infinite alternate; }
.cloud.c1 { left: -10%; top: -4%; width: 62%; height: 11%; }
.cloud.c2 { right: -12%; top: 3%; width: 50%; height: 9%; animation-duration: 58s; animation-direction: alternate-reverse; background: rgba(3,5,18,.62); }
.cloud.c3 { left: 18%; top: 11%; width: 34%; height: 5%; animation-duration: 70s; background: rgba(3,5,18,.4); }
@keyframes cloudDrift { to { transform: translateX(9%); } }
#ground { position: absolute; left: 0; right: 0; bottom: 0; height: 22%;
  background: linear-gradient(#1b1d33, #0a0b16); border-top: 3px solid #2c3052; }
#hud { position: absolute; top: 12px; left: 0; right: 0; text-align: center; pointer-events: none; z-index: 5; }
#money { font-size: clamp(30px, 5vw, 52px); font-weight: 900; color: var(--gold); text-shadow: 0 3px 0 #7a5a00, 0 0 18px rgba(255,212,77,.5); }
#rates { color: #c4c9ee; font-size: 14px; margin-top: 2px; text-shadow: 0 1px 3px #000, 0 0 6px #000, 0 0 10px #000; }
#title { position: absolute; top: 10px; left: 14px; font-weight: 900; letter-spacing: 1px; font-size: 14px; color: var(--pink); z-index: 6; opacity: .9; }
#sceneSvg { position: absolute; left: 50%; bottom: 8%; width: min(72%, 62vh); transform: translateX(-50%); cursor: pointer; touch-action: manipulation; z-index: 3; overflow: visible; }
#sceneSvg { --b0: #3d6b5c; --b1: #58a58a; --b2: #2f5446; --l0: #2e5546; --l1: #4d9780; --l2: #2a4a3d; --ol: #173126; --glow: rgba(120,255,190,.35); }
#bin { transform-box: fill-box; transform-origin: 50% 100%; }
.tw { animation: twinkle 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.tw2 { animation-delay: .5s; } .tw3 { animation-delay: 1s; }
@keyframes twinkle { 0%,100% { opacity: .2; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.2); } }

#dumpScene { position: absolute; inset: 0; z-index: 1; pointer-events: none; display: none; overflow: hidden; }
#stage.dump #dumpScene { display: block; }
#stage.dump #ground { background: linear-gradient(#2c2616, #110d06); border-top-color: #4f4224; }
#dumpBox { position: absolute; left: 0; right: 0; bottom: 0; aspect-ratio: 400 / 230; container-type: inline-size; }
#dumpSvg { position: absolute; inset: 0; width: 100%; height: 100%; }
#dumpJunk { position: absolute; inset: 0; }
#dumpJunk > span { position: absolute; font-size: 5.5cqw; opacity: .9; }
/* nákladní auta: couvají na hřeben, vyklopí a odjedou (celé auto jede po "dráze" široké jako scéna, takže % posunu = % scény) */
.track { position: absolute; left: 0; width: 100%; bottom: 33cqw; height: 13cqw; animation: drive 18s ease-in-out infinite backwards; animation-delay: var(--d, 0s); }
.track.l { --a: -24%; --b: 1%; }
.track.r { --a: 106%; --b: 82%; }
.rig { position: absolute; left: 0; bottom: -1cqw; width: 17cqw; height: 9.2cqw; }
.track.l .rig { transform: scaleX(-1); }
.rig svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bed { transform-box: fill-box; transform-origin: 0 100%; animation: tip 18s ease-in-out infinite backwards; }
.load { animation: unload 18s steps(1) infinite backwards; }
.bed, .load { animation-delay: var(--d, 0s); }   /* až za zkratkou animation, jinak se zpoždění přepíše na 0 a náklad se rozjede s autem */
.dp { position: absolute; left: 0; top: 3cqw; font-size: 2.8cqw; opacity: 0; animation: drop 18s linear infinite backwards; }
@keyframes drive { 0% { transform: translateX(var(--a)); } 28%, 72% { transform: translateX(var(--b)); } 100% { transform: translateX(var(--a)); } }
@keyframes tip { 0%, 34% { transform: rotate(0); } 42%, 62% { transform: rotate(-30deg); } 70%, 100% { transform: rotate(0); } }
@keyframes unload { 0% { opacity: 1; } 52% { opacity: 0; } 99% { opacity: 1; } }
@keyframes drop { 0%, 41% { opacity: 0; transform: translate(0, 0) rotate(0); } 43% { opacity: 1; }
  58% { opacity: 1; } 63%, 100% { opacity: 0; transform: translate(var(--dx, -4cqw), var(--dy, 12cqw)) rotate(var(--rot, 240deg)); } }

/* skládka – vyšší úrovně: pásy, roboti, UFO */
#dumpFleet { position: absolute; inset: 0; }
#dumpFleet > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.belt { stroke-dasharray: 3 5; animation: beltDash .6s linear infinite; }
@keyframes beltDash { to { stroke-dashoffset: -8; } }
.bj { position: absolute; font-size: 4cqw; line-height: 1; animation: beltMove 7s linear infinite; }
@keyframes beltMove { 0% { opacity: 0; transform: translate(0, 0) rotate(0); } 6%, 90% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(220deg); } }
.arm { animation: armSwing 2.4s ease-in-out infinite alternate; transform-box: view-box; }
.arm.b { animation-delay: -1.2s; }
@keyframes armSwing { from { transform: rotate(-16deg); } to { transform: rotate(18deg); } }
.ufo { position: absolute; left: 0; top: 2cqw; width: 12cqw; animation: ufoFly 16s linear infinite; }
.ufo b { display: block; font-size: 7cqw; line-height: 1; text-align: center; filter: drop-shadow(0 0 8px #7dffb0); animation: ufoBob 1.4s ease-in-out infinite alternate; }
.ufo i { position: absolute; left: 15%; width: 70%; top: 6cqw; height: 16cqw; clip-path: polygon(35% 0, 65% 0, 100% 100%, 0 100%);
  background: linear-gradient(rgba(125,255,176,.6), rgba(125,255,176,0)); animation: beamPulse .8s ease-in-out infinite alternate; }
.ufo span { position: absolute; left: 40%; top: 7cqw; font-size: 3cqw; animation: ufoDrop 2.2s linear infinite; opacity: 0; }
@keyframes ufoFly { from { transform: translateX(-14cqw); } to { transform: translateX(104cqw); } }
@keyframes ufoBob { to { transform: translateY(1cqw) rotate(4deg); } }
@keyframes beamPulse { from { opacity: .5; } to { opacity: 1; } }
@keyframes ufoDrop { 0% { opacity: 0; transform: translateY(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(14cqw) rotate(200deg); } }

#bin.squash { animation: squash .16s ease-out; }
@keyframes squash { 0% { transform: scale(1.0, 1.0); } 35% { transform: scale(1.07, .90); } 100% { transform: scale(1, 1); } }
#raccoon { transform-box: fill-box; transform-origin: 50% 100%; animation: idle 2.6s ease-in-out infinite; }
#raccoon.pop { animation: pop .22s ease-out; }
@keyframes idle { 0%,100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-6px) rotate(1.5deg); } }
@keyframes pop { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-26px) scale(1.06, .96) rotate(-4deg); } 100% { transform: translateY(0) scale(1); } }
#tail { transform-box: fill-box; transform-origin: 0% 100%; animation: wag 1.8s ease-in-out infinite; }
@keyframes wag { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(8deg); } }
#lid { transform-box: fill-box; transform-origin: 0% 100%; }
#sceneSvg.shake #lid { animation: lid .16s ease-out; }
@keyframes lid { 0% { transform: rotate(0); } 40% { transform: rotate(-9deg); } 100% { transform: rotate(0); } }
.eye { animation: blink 4s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }

#belly { position: absolute; top: 88px; left: 50%; transform: translateX(-50%); width: min(70%, 320px); height: 22px; border-radius: 11px;
  background: rgba(0,0,0,.5); border: 2px solid var(--pink); overflow: hidden; display: none; z-index: 6; pointer-events: none; }
#belly.on { display: block; }
#bellyFill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #ff7ad9, #ffd44d); }
#belly span { position: absolute; inset: 0; text-align: center; font-size: 12px; font-weight: 900; line-height: 20px; text-shadow: 0 1px 2px #000; }

.golden { position: absolute; z-index: 9; width: 90px; height: 90px; margin: -45px 0 0 -45px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 46px; touch-action: manipulation;
  background: radial-gradient(circle, rgba(255,226,120,.55), rgba(255,200,40,.18) 60%, transparent 72%);
  animation: gpulse 1s ease-in-out infinite; }
.golden span { filter: sepia(1) saturate(6) hue-rotate(-8deg) brightness(1.25) drop-shadow(0 0 10px #ffd44d); pointer-events: none; }
.golden.dying { animation: gblink .3s steps(2) infinite; }
@keyframes gpulse { 0%,100% { scale: 1; } 50% { scale: 1.12; } }
@keyframes gblink { 50% { opacity: .25; } }

#muteBtn { position: absolute; top: 8px; right: 112px; z-index: 20; height: 33px; width: 38px; background: rgba(0,0,0,.45); border: 2px solid var(--panel2);
  border-radius: 10px; cursor: pointer; font-size: 16px; color: var(--text); padding: 0; }
#muteBtn:hover { border-color: var(--pink); }
#langWrap { position: absolute; top: 8px; right: 12px; z-index: 20; }
#langBtn { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.45); border: 2px solid var(--panel2); border-radius: 10px;
  padding: 4px 8px; cursor: pointer; color: var(--text); font: inherit; font-weight: 800; font-size: 12px; }
#langBtn:hover { border-color: var(--pink); }
#langWrap svg { width: 28px; height: 19px; border-radius: 3px; display: block; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
#langMenu { display: none; position: absolute; right: 0; top: 36px; background: var(--panel); border: 2px solid var(--panel2); border-radius: 10px; padding: 4px; min-width: 150px; }
#langMenu.open { display: block; }
#langMenu button { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; color: var(--text); font: inherit; font-weight: 700;
  padding: 7px 8px; border-radius: 7px; cursor: pointer; text-align: left; }
#langMenu button:hover { background: var(--panel2); }
#langMenu button.cur { color: var(--gold); }

#lairDeco { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.deco { position: absolute; display: none; }
.deco.on { display: block; }
#decoThrone { left: 2%; bottom: 5%; width: 30%; max-width: 270px; overflow: visible; filter: drop-shadow(0 4px 3px rgba(0,0,0,.5)); }
#decoThrone.lv4 { filter: drop-shadow(0 0 8px rgba(255,212,77,.55)); }
#decoThrone.lv5 { animation: thronePulse 2.4s ease-in-out infinite; }
@keyframes thronePulse { 0%,100% { filter: drop-shadow(0 0 8px rgba(255,212,77,.6)); } 50% { filter: drop-shadow(0 0 20px rgba(255,236,150,.95)); } }
#decoTv { right: 3%; bottom: 6%; width: 24%; max-width: 220px; overflow: visible; filter: drop-shadow(0 4px 3px rgba(0,0,0,.5)); }
.tvScr { animation: tvHue 5s linear infinite; }
@keyframes tvHue { to { filter: hue-rotate(360deg); } }
#decoTv.lv5 { animation: thronePulse 2.4s ease-in-out infinite; }
#skyline { overflow: visible; position: absolute; left: 0; bottom: 22%; width: 100%; aspect-ratio: 2 / 1; z-index: 0; pointer-events: none; display: none; }
#stage.dump #skyline { bottom: 33cqw; }
#stage { container-type: inline-size; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html, body { overscroll-behavior: none; }
#decoDisco.lv5 { filter: drop-shadow(0 0 12px rgba(255,212,77,.7)); }
#decoDisco.lv4 .rbTile { animation: tvHue 3s linear infinite; }
#decoDisco { left: 9%; top: 9%; width: 64px; animation: swing 3s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes swing { 0%,100% { rotate: -6deg; } 50% { rotate: 6deg; } }
#disco-glow { position: absolute; inset: 0; pointer-events: none; z-index: 1; opacity: 0; transition: opacity .6s;
  background: conic-gradient(from 0deg at 50% 10%, rgba(255,0,170,.25), rgba(0,200,255,.25), rgba(255,230,0,.25), rgba(0,255,120,.25), rgba(255,0,170,.25));
  animation: spin 6s linear infinite; }
#disco-glow.on { opacity: .4; }
#decoDisco.party { filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 24px #ff7ad9); }
#decoDisco.lv1.party { filter: drop-shadow(0 0 10px #fff); }
#disco-glow.white { background: conic-gradient(from 0deg at 50% 10%, rgba(255,255,255,.2), rgba(255,255,255,.05), rgba(255,255,255,.2), rgba(255,255,255,.05), rgba(255,255,255,.2)); }
#decoDisco.party #ballCols { animation: ballroll .45s linear infinite; }
@keyframes ballroll { to { transform: translateX(16px); } }
#discoSpots { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; }
#discoSpots i { position: absolute; border-radius: 50%; animation: spotTw .4s ease-in-out infinite alternate; }
#discoSpots.go { animation: discoRot var(--dur) linear forwards, discoFade var(--dur) ease forwards; }
@keyframes discoRot { to { transform: rotate(-300deg); } }
@keyframes discoFade { 0% { opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes spotTw { from { opacity: .3; scale: .75; } to { opacity: 1; scale: 1.25; } }
.rbG { animation: spin 3s linear infinite; }
@keyframes spin { to { filter: hue-rotate(360deg); } }

#combo { position: absolute; top: 120px; left: 50%; transform: translateX(-50%); z-index: 6; pointer-events: none; display: none;
  font-weight: 900; font-size: 22px; color: #ffb347; text-shadow: 0 2px 0 #7a3a00, 0 0 12px rgba(255,140,0,.8); }
#combo.on { display: block; }
@media (min-width: 801px) { #combo { top: 24%; } }   /* na šířku níž, ať nepřekáží HUDu */
#decoShelf { position: absolute; right: 4%; top: 30%; display: flex; flex-direction: column; gap: 6px; font-size: 34px; pointer-events: none; }
#decoShelf:has(span.on) { background: radial-gradient(closest-side, rgba(8,10,28,.6) 45%, rgba(8,10,28,.3) 75%, transparent); padding: 18px 22px; margin: -18px -22px; }
#decoShelf span { display: none; }
#decoShelf span.on { display: block; }
#crew { position: absolute; bottom: 0; left: 0; right: 0; padding: 22px 0 10px; text-align: center; font-size: 24px; z-index: 4; pointer-events: none; letter-spacing: 2px;
  background: linear-gradient(to top, rgba(6,7,16,.9) 60%, rgba(6,7,16,0)); }
#crew:empty { display: none; }
#crew small { text-shadow: 0 1px 3px #000; }
#crew span { margin: 0 6px; }
#crew small { font-size: 12px; color: var(--dim); }
#quip { position: absolute; bottom: 7.5%; left: 0; right: 0; text-align: center; color: var(--text); font-size: 15px; font-style: italic;
  opacity: 0; transition: opacity .3s; z-index: 5; pointer-events: none; text-shadow: 0 2px 4px #000; padding: 0 12px; }
#quip.show { opacity: .95; }

.float { position: absolute; z-index: 8; pointer-events: none; font-weight: 900; font-size: 22px; color: var(--green);
  text-shadow: 0 2px 0 #08442a, 0 0 8px rgba(93,255,160,.7); white-space: nowrap; }
.float.big { color: var(--gold); font-size: 30px; text-shadow: 0 2px 0 #7a5a00, 0 0 14px rgba(255,212,77,.9); }
.junk { position: absolute; z-index: 7; pointer-events: none; font-size: 38px; line-height: 1; }

#decoShelf .ico { width: 56px; height: 56px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }

/* skládka: ikony místo emoji (velikost určuje font-size rodiče) */
.dp .ico, .bj .ico, #dumpJunk .ico, .ufo .ico { width: 1em; height: 1em; }
