:root { --ink: #5B4A4A; --font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", system-ui, -apple-system, sans-serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8FD3F5; font-family: var(--font); color: var(--ink);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
body { position: fixed; inset: 0; touch-action: none; }
svg { display: block; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; overflow: hidden; }

/* ---------- κουμπιά ---------- */
.round { position: fixed; z-index: 10; width: 68px; height: 68px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.94); box-shadow: 0 6px 16px rgba(30,90,130,.22), inset 0 -3px 0 rgba(0,0,0,.06); transition: transform .15s ease, opacity .2s, background .2s; touch-action: none; }
.round:active { transform: scale(.9); }
.round svg { width: 38px; height: 38px; pointer-events: none; }
.round.dim { opacity: .45; }
#tools { position: fixed; z-index: 10; top: calc(16px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); display: flex; gap: 12px; }
#tools .round { position: static; width: 56px; height: 56px; opacity: .92; } #tools .round svg { width: 30px; height: 30px; } #tools .round.dim { opacity: .4; }
#bin { top: calc(16px + env(safe-area-inset-top)); left: calc(16px + env(safe-area-inset-left)); width: 96px; height: 96px; }
#bin svg { width: 56px; height: 56px; }
#bin .lid { transform-box: fill-box; transform-origin: 20% 100%; transition: transform .2s; }
#bin.hot { background: #FFE0E0; transform: scale(1.22); } #bin.hot .lid { transform: rotate(-26deg) translateY(-3px); }
#mute .off { display: none; } #mute.is-off .on { display: none; } #mute.is-off .off { display: block; }
#night .moon { display: none; } body.night #night .sun { display: none; } body.night #night .moon { display: block; }
#broom { position: relative; }
#broom .ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); }
#broom .ring circle { fill: none; stroke: #F26B6B; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 226; stroke-dashoffset: 226; }
#broom.holding .ring circle { animation: fillring 1.1s linear forwards; }
@keyframes fillring { to { stroke-dashoffset: 0; } }

.go { position: fixed; z-index: 8; top: 36%; width: 64px; height: 96px; border: 0; border-radius: 30px; background: rgba(255,255,255,.4); display: grid; place-items: center; cursor: pointer; transition: transform .15s, background .2s; touch-action: none; }
.go svg { width: 36px; height: 36px; filter: drop-shadow(0 2px 3px rgba(60,100,140,.35)); }
.go:active { transform: scale(.9); background: rgba(255,255,255,.6); }
#goL { left: calc(8px + env(safe-area-inset-left)); } #goR { right: calc(8px + env(safe-area-inset-right)); }

/* ---------- ράφι ---------- */
#panel { position: fixed; z-index: 9; left: 0; right: 0; margin: 0 auto; bottom: calc(10px + env(safe-area-inset-bottom)); width: min(calc(100vw - 16px), 960px);
  background: rgba(255,255,255,.95); border-radius: 32px; padding: 10px 14px 10px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 10px 26px rgba(30,90,130,.28), inset 0 -3px 0 rgba(0,0,0,.05); }
#shelf { display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; height: 100px; padding: 4px 2px 6px; align-items: flex-end; scrollbar-width: none; touch-action: none; }
#shelf::-webkit-scrollbar { display: none; }
.tile { flex: 0 0 auto; height: 88px; border-radius: 22px; border: 0; padding: 0 8px; background: #EAF4FA; display: grid; place-items: center; cursor: pointer; touch-action: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.05); }
.tile svg { pointer-events: none; overflow: visible; }
.tile:active { background: #D8ECF7; }
.tile.hint { animation: hint 1.6s ease-in-out infinite; }
#cats { display: flex; gap: 12px; justify-content: center; }
#cats button { width: clamp(64px, 12vw, 92px); height: 62px; border-radius: 22px; border: 0; padding: 4px; background: #EEF3F7; display: grid; place-items: center; cursor: pointer; touch-action: none; transition: transform .15s; }
#cats button svg { max-width: 100%; max-height: 100%; pointer-events: none; overflow: visible; }
#cats button.on { background: #FFE9A8; box-shadow: 0 0 0 4px #FFC247; }
#cats button:active { transform: scale(.92); }

/* ---------- σκηνή ---------- */
.pc { cursor: grab; } .pc.held { cursor: grabbing; }
.pin { transform-box: fill-box; transform-origin: 50% 100%; }
.pc.held .pin { transform: scale(1.07) rotate(-2deg); transform-origin: 50% 50%; filter: drop-shadow(0 14px 10px rgba(0,0,0,.2)); }
.pc.gone { transition: opacity .2s, transform .2s; opacity: 0; }
.pin.land { animation: land .38s ease-out; }
.vanish { transition: opacity .5s ease; opacity: 0; }
.halo { fill: none; stroke: #fff; stroke-width: 4; stroke-dasharray: 10 8; pointer-events: none; animation: dash 1.2s linear infinite; filter: drop-shadow(0 0 3px rgba(40,90,140,.6)); }
.bub { cursor: pointer; } .bub .bin { animation: popin .3s cubic-bezier(.3,1.8,.5,1) both; transform-box: fill-box; transform-origin: center; filter: drop-shadow(0 4px 4px rgba(0,0,0,.25)); }
.prevR { fill: rgba(255,255,255,.34); stroke: #fff; stroke-width: 3; stroke-dasharray: 9 7; pointer-events: none; }
#prev, #ui, #fx { pointer-events: none; } #ui .bub { pointer-events: all; }
.star { opacity: 0; transition: opacity 1.4s; } body.night .star { animation: twinkle 3s ease-in-out infinite; }
#skyN { opacity: 0; transition: opacity 1.4s ease; } body.night #skyN { opacity: 1; }
#moon { opacity: 0; transition: opacity 1.4s ease; pointer-events: none; }
#stars { transition: opacity 1.4s; }
.win-glass, .lamp-glass, .head-glow { transition: fill .8s ease; }
body.night .win-glass { fill: #FFE27A; } body.night .lamp-glass { fill: #FFE27A; } body.night .head-glow { fill: #FFF6A8; }
body.night .lamp-glass, body.night .head-glow { filter: drop-shadow(0 0 7px #FFE27A); }

/* ζωντάνια των κομματιών */
.sway { animation: sway 4.5s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.drift { animation: drift 7s ease-in-out infinite alternate; }
.bob { animation: bob 2.2s ease-in-out infinite alternate; }
.spin { animation: spin 40s linear infinite; }
.wag { animation: wag .55s ease-in-out infinite alternate; }
.flap { animation: flap .35s ease-in-out infinite alternate; }
.flutter { animation: flutter .28s ease-in-out infinite alternate; }
.smoke { animation: smoke 3.2s ease-out infinite; transform-box: fill-box; }
.tl { animation: tl 6s steps(1) infinite; } .tl1 { animation-delay: 0s; } .tl2 { animation-delay: -4s; } .tl3 { animation-delay: -2s; }
.flagwave { transform-box: fill-box; transform-origin: 0 50%; animation: flag 1.4s ease-in-out infinite alternate; }
.particle { animation: pfly 1.2s cubic-bezier(.2,.7,.3,1) forwards; }
.pop-in { animation: popin .5s cubic-bezier(.3,1.8,.5,1); transform-box: fill-box; transform-origin: center; }
#panel .hint, .hint { animation: hint 1.6s ease-in-out infinite; }

@keyframes hint { 0%,100% { transform: rotate(0) scale(1); } 20% { transform: rotate(-6deg) scale(1.1); } 40% { transform: rotate(6deg) scale(1.1); } 60% { transform: rotate(0) scale(1); } }
@keyframes land { 0% { transform: scale(1.1,.86); } 45% { transform: scale(.95,1.07); } 100% { transform: scale(1); } }
@keyframes popin { 0% { transform: scale(.2); } 100% { transform: scale(1); } }
@keyframes dash { to { stroke-dashoffset: -36; } }
@keyframes twinkle { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes sway { 0%,100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.6deg); } }
@keyframes drift { from { transform: translateX(-8px); } to { transform: translateX(10px); } }
@keyframes bob { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wag { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
@keyframes flap { from { transform: rotate(-24deg); } to { transform: rotate(18deg); } }
@keyframes flutter { from { transform: scaleX(.55); } to { transform: scaleX(1); } }
@keyframes smoke { 0% { transform: translateY(6px) scale(.7); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-26px) scale(1.25); opacity: 0; } }
@keyframes tl { 0%,100% { opacity: .25; } 33% { opacity: 1; } }
@keyframes flag { from { transform: skewY(-6deg) scaleX(.92); } to { transform: skewY(6deg) scaleX(1); } }
@keyframes pfly { 0% { transform: translate(0,0) scale(.3) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx),var(--dy)) scale(1) rotate(var(--rot)); opacity: 0; } }

#far1 path, #far2 path { transition: fill 1.4s ease; }
body.night #far1 path { fill: #5D6DAD; } body.night #far2 path { fill: #4A5B98; }
#duskG { opacity: 0; transition: opacity 1.4s ease; pointer-events: none; } body.night #duskG { opacity: .38; }

/* ---------- οριζόντια οθόνη: το μενού μικραίνει, οι κατηγορίες πάνε δεξιά ---------- */
@media (orientation: landscape) {
  #panel { padding: 8px 12px; border-radius: 26px; width: min(calc(100vw - 16px), 900px); }
  #shelf { height: 86px; padding: 2px 2px 4px; }
  .tile { height: 78px; padding: 0 6px; min-width: 72px !important; }
  .tile svg { width: auto !important; height: auto !important; max-height: 58px; max-width: 170px; }
  #cats { position: fixed; z-index: 9; right: calc(14px + env(safe-area-inset-right)); top: calc(86px + env(safe-area-inset-top)); flex-direction: column; gap: 8px; padding: 8px; border-radius: 28px; background: rgba(255,255,255,.9); box-shadow: 0 6px 16px rgba(30,90,130,.22); }
  #cats button { width: 62px; height: 54px; }
  .go { top: auto; bottom: calc(118px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #tools .round { width: 46px; height: 46px; } #tools .round svg { width: 26px; height: 26px; }
  #bin { width: 72px; height: 72px; } #bin svg { width: 42px; height: 42px; }
  #cats { top: calc(70px + env(safe-area-inset-top)); gap: 4px; padding: 5px; } #cats button { width: 52px; height: 44px; }
  #shelf { height: 74px; } .tile { height: 66px; } .tile svg { max-height: 46px; }
  #panel { bottom: calc(6px + env(safe-area-inset-bottom)); padding: 6px 10px; }
  .go { bottom: calc(96px + env(safe-area-inset-bottom)); width: 48px; height: 48px; }
  #goR { right: calc(84px + env(safe-area-inset-right)); }
}
