/* CACCIA AI GATTI 3D · demo — l'impaginazione: lo schermo del gioco sopra, i tasti sotto */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
html, body { background: #111; height: 100%; overflow: hidden; touch-action: none;
             font-family: ui-rounded, "Trebuchet MS", system-ui, sans-serif; color: #fff; }
[hidden] { display: none !important; }

#app { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 8px; }
#schermo { position: relative; width: min(96vw, calc((100dvh - 190px) * 4 / 3), 960px); aspect-ratio: 4 / 3;
           background: #000; border-radius: 10px; overflow: hidden; container-type: inline-size; }
#gioco { width: 100%; height: 100%; display: block; }
#gioco.ds { image-rendering: pixelated; }

/* ---------- le scritte sopra la scena ---------- */
#hud > div { position: absolute; font-weight: 700; font-size: 3.4cqw; }
#ora { top: 2.2cqw; left: 2.2cqw; background: rgba(0, 0, 0, 0.5); padding: 0.6cqw 1.8cqw; border-radius: 99px; }
#spirito { top: 2cqw; right: 2.2cqw; display: flex; gap: 1cqw; }
/* i tre gattini dello Spirito: una testina con le orecchie */
#spirito i { width: 6cqw; height: 5cqw; background: rgba(255, 255, 255, 0.92); border: 0.5cqw solid rgba(0, 0, 0, 0.45);
             border-radius: 45% 45% 50% 50%; position: relative; transition: background 0.3s; }
#spirito i::before, #spirito i::after { content: ""; position: absolute; top: -1.9cqw; width: 0; height: 0;
             border-left: 1.2cqw solid transparent; border-right: 1.2cqw solid transparent; border-bottom: 2.2cqw solid rgba(255, 255, 255, 0.92); transition: border-color 0.3s; }
#spirito i::before { left: 0.1cqw; } #spirito i::after { right: 0.1cqw; }
#spirito i.pieno { background: #f0c860; animation: salto 0.5s; }
#spirito i.pieno::before, #spirito i.pieno::after { border-bottom-color: #f0c860; }
#spirito.luce i { box-shadow: 0 0 2.5cqw 1cqw rgba(255, 220, 90, 0.9); }
@keyframes salto { 40% { transform: translateY(-1.6cqw); } }
#obiettivo { top: 9.5cqw; left: 2.2cqw; background: rgba(40, 32, 48, 0.72); padding: 0.7cqw 1.8cqw; border-radius: 1.6cqw;
             font-size: 2.9cqw !important; font-weight: 600 !important; border-left: 0.9cqw solid #f0c860; max-width: 70%; }
#obiettivo:empty { display: none; }
#suggerimento { bottom: 3cqw; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.62); padding: 0.8cqw 2.4cqw;
             border-radius: 99px; font-size: 3cqw !important; white-space: nowrap; }
#suggerimento b { display: inline-block; background: #4b9ec1; border-radius: 50%; width: 4.4cqw; height: 4.4cqw; line-height: 4.4cqw; text-align: center; margin-right: 1cqw; }

/* ---------- il dialogo ---------- */
#dialogo { position: absolute; left: 3%; right: 3%; bottom: 3%; background: rgba(28, 24, 40, 0.95); border: 0.6cqw solid #fff;
           border-radius: 2.4cqw; padding: 3.2cqw 3.6cqw 3.6cqw; min-height: 21cqw; }
#chi { position: absolute; top: -3.4cqw; left: 3cqw; background: #f0c860; color: #2a2030; font-weight: 800; font-size: 3.2cqw;
       padding: 0.5cqw 2.2cqw; border-radius: 1.4cqw; }
#testo { font-size: 3.7cqw; line-height: 1.35; font-weight: 500; }
#avanti { position: absolute; right: 3cqw; bottom: 1.6cqw; color: #f0c860; font-weight: 800; font-size: 3cqw; animation: lampo 0.9s infinite; }
@keyframes lampo { 50% { opacity: 0.2; } }
#scelte { list-style: none; margin-top: 1.6cqw; display: flex; gap: 2cqw; flex-wrap: wrap; }
#scelte li { font-size: 3.5cqw; font-weight: 700; padding: 0.8cqw 2.6cqw; border-radius: 1.6cqw; border: 0.5cqw solid #6a6480; color: #cfc9e0; }
#scelte li.sel { background: #f0c860; border-color: #f0c860; color: #2a2030; }

/* ---------- velo nero (cambio stanza), flash della foto, polaroid ---------- */
#velo, #flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
#velo { background: #000; transition: opacity 0.35s; } #velo.su { opacity: 1; }
#flash { background: #fff; } #flash.su { animation: flash 0.5s; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
#polaroid { position: absolute; right: 4%; top: 12%; width: 38%; background: #fbf8f0; padding: 1.6cqw 1.6cqw 0.8cqw; border-radius: 0.8cqw;
            box-shadow: 0 1.2cqw 3cqw rgba(0, 0, 0, 0.5); transform: rotate(4deg); animation: esce 0.4s; }
#polaroid img { width: 100%; display: block; border-radius: 0.4cqw; }
#polaroid p { color: #3a3040; font-size: 2.8cqw; text-align: center; padding: 1cqw 0 0.6cqw; font-weight: 700; }
@keyframes esce { from { transform: translateY(-20%) rotate(-6deg); opacity: 0; } }

/* ---------- titolo e fine demo ---------- */
#pannello { position: absolute; inset: 0; background: rgba(18, 16, 26, 0.9); display: flex; flex-direction: column; align-items: center;
            justify-content: center; text-align: center; gap: 2.6cqw; padding: 6cqw; }
#pannello:empty { display: none; }
#pannello h1 { font-size: 8.5cqw; letter-spacing: 0.3cqw; line-height: 1.05; }
#pannello h1 small { display: block; font-size: 3.4cqw; letter-spacing: 0.9cqw; color: #f0c860; margin-top: 1.4cqw; }
#pannello p { font-size: 3.3cqw; line-height: 1.4; color: #dcd6ea; max-width: 80%; }
#pannello button { font: inherit; font-weight: 800; font-size: 4.2cqw; padding: 1.6cqw 6cqw; border: 0; border-radius: 99px;
                   background: #f0c860; color: #2a2030; margin-top: 1.4cqw; cursor: pointer; }
#pannello .tasti { font-size: 2.6cqw; color: #a8a2b8; }
#stile { position: absolute; left: 50%; top: 2cqw; transform: translateX(-50%); font: inherit; font-size: 2.5cqw; font-weight: 700;
         background: rgba(0, 0, 0, 0.5); color: #ddd; border: 0.3cqw solid rgba(255, 255, 255, 0.35); border-radius: 99px; padding: 0.5cqw 2cqw; cursor: pointer; }

/* ---------- i tasti del telefono ---------- */
#comandi { width: 100%; max-width: 480px; display: flex; justify-content: space-between; align-items: center; padding: 0 6px; }
#croce { position: relative; width: 132px; height: 132px; border-radius: 50%; background: #23232e; border: 2px solid #3c3c4c; touch-action: none; }
#croce span { position: absolute; color: #8a8aa0; font-size: 18px; pointer-events: none; transition: color 0.1s; }
#croce .su { top: 8px; left: 50%; transform: translateX(-50%); } #croce .giu { bottom: 8px; left: 50%; transform: translateX(-50%); }
#croce .sx { left: 10px; top: 50%; transform: translateY(-50%); } #croce .dx { right: 10px; top: 50%; transform: translateY(-50%); }
#croce span.on { color: #f0c860; }
#tasti { display: flex; gap: 16px; align-items: center; }
.tasto { width: 62px; height: 62px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800;
         font-size: 22px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45); touch-action: none; }
.tasto.a { background: #4b9ec1; } .tasto.b { background: #c14b4b; margin-top: 26px; }
.tasto.giu { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45); }

/* sul computer (mouse): niente tasti a schermo, il gioco più grande */
@media (hover: hover) and (pointer: fine) {
  #comandi { display: none; }
  #schermo { width: min(96vw, calc((100dvh - 24px) * 4 / 3), 1100px); }
}
/* telefono girato: croce a sinistra, gioco al centro, A e B a destra */
@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  #app { flex-direction: row; gap: 10px; padding: 6px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left)); }
  #schermo { width: min(calc(100vw - 330px), calc((100dvh - 12px) * 4 / 3)); order: 2; }
  #comandi { display: contents; }
  #croce { order: 1; flex: none; } #tasti { order: 3; flex: none; }
}
