/* Animal Camera — bespoke camera game styles.
 *
 * A wildlife-photography game: animals roam a living habitat scene while the
 * player looks through a camera viewfinder, focuses, and snaps the animal
 * that matches the clue. Nothing here depends on the shared moving-target
 * engine — this game renders its own scene, camera HUD and capture effects.
 */

.ps-game {
    --ps-ink: #1d2430;
    --ps-cam: #20262e;
    display: flex;
    flex-direction: column;
    gap: 12px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

/* ---------------- Clue banner ---------------- */
.ps-prompt {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 700;
    font-size: clamp(18px, 4.4vw, 26px);
    text-align: center;
    color: var(--ps-ink);
    background: linear-gradient(180deg, #fff, #fbf6ec);
    border: 2px solid #f0e2c6;
    border-radius: 14px;
    padding: 10px 14px;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.05);
    line-height: 1.25;
}
.ps-prompt strong { color: #e8792b; white-space: nowrap; }
.ps-prompt .ps-prompt-emoji { font-size: 1.15em; }

/* ---------------- Digital camera body ---------------- */
.ps-camera {
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    border-radius: 24px;
    background:
        radial-gradient(120% 140% at 12% 0%, #3a4048 0%, #23272d 45%, #171a1f 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.08),
        inset 0 -3px 8px rgba(0, 0, 0, 0.55),
        0 16px 34px rgba(0, 0, 0, 0.32);
}
/* The LCD screen (live view) */
.ps-cam-screen {
    position: relative;
    flex: 1 1 auto;
    height: clamp(280px, 48vh, 460px);
    border-radius: 12px;
    overflow: hidden;
    background: #0b1a24;
    border: 3px solid #05070a;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06), inset 0 0 40px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}
/* Right-hand control cluster: brand, mode dial, shutter */
.ps-cam-controls {
    flex: 0 0 auto;
    width: 66px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 6px 2px;
}
.ps-cam-brand {
    color: #cfd6df;
    font: 800 12px/1 'DM Sans', sans-serif;
    letter-spacing: 2px;
    opacity: 0.8;
}
.ps-cam-dial {
    width: 46px; height: 46px;
    border-radius: 50%;
    background:
        repeating-conic-gradient(#3c434c 0deg 10deg, #2a2f36 10deg 20deg);
    box-shadow: inset 0 0 0 4px #20242a, inset 0 0 0 6px #14171b, 0 2px 4px rgba(0,0,0,0.5);
    position: relative;
}
.ps-cam-dial::after {
    content: '';
    position: absolute; left: 50%; top: 6px;
    width: 4px; height: 10px; margin-left: -2px;
    border-radius: 2px; background: #8fd0ff;
}
.ps-cam-shutter {
    width: 52px; height: 52px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    cursor: pointer;
    background: radial-gradient(circle at 50% 38%, #ff8a8a, #e53b3b 60%, #b81f1f 100%);
    box-shadow: 0 3px 0 #8f1414, 0 6px 10px rgba(0, 0, 0, 0.4), inset 0 2px 3px rgba(255, 255, 255, 0.5);
    -webkit-tap-highlight-color: transparent;
    transition: transform 80ms ease, box-shadow 80ms ease;
}
.ps-cam-shutter > span {
    display: block; width: 100%; height: 100%;
    border-radius: 50%;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35);
}
.ps-cam-shutter:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #8f1414, 0 3px 6px rgba(0, 0, 0, 0.4), inset 0 2px 3px rgba(255, 255, 255, 0.5);
}
@media (max-width: 560px) {
    .ps-camera { flex-direction: column; gap: 8px; }
    .ps-cam-controls {
        width: auto;
        flex-direction: row-reverse;
        justify-content: center;
        gap: 18px;
        padding: 2px 0 0;
    }
    .ps-cam-brand { display: none; }
    .ps-cam-dial { width: 38px; height: 38px; }
    .ps-cam-shutter { width: 46px; height: 46px; }
}

/* ---------------- The living scene (painted backdrop) ---------------- */
.ps-scene {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    transition: filter 140ms ease;
}
.ps-scene.is-focusing { filter: blur(1.4px) saturate(0.9); }

.ps-bubble {
    position: absolute;
    bottom: -20px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.7);
    animation: ps-bubble-up linear infinite;
}
@keyframes ps-bubble-up {
    from { transform: translateY(0) scale(0.6); opacity: 0; }
    15%  { opacity: 0.8; }
    to   { transform: translateY(-360px) scale(1.1); opacity: 0; }
}
.ps-flake {
    position: absolute;
    top: -16px;
    color: #fff;
    font-size: 14px;
    animation: ps-flake-fall linear infinite;
    text-shadow: 0 1px 2px rgba(120, 160, 200, 0.5);
}
@keyframes ps-flake-fall {
    from { transform: translateY(-20px) translateX(0) rotate(0deg); }
    to   { transform: translateY(420px) translateX(24px) rotate(240deg); }
}

/* ---------------- Roaming animals ---------------- */
.ps-animal {
    position: absolute;
    top: 0; left: 0;
    border: 0;
    background: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    will-change: transform;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}
.ps-animal-inner {
    display: block;
    animation: ps-bob 1.6s ease-in-out infinite;
    transform-origin: bottom center;
}
.ps-animal-img {
    display: block;
    width: clamp(58px, 13vw, 96px);
    height: clamp(58px, 13vw, 96px);
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 6px 5px rgba(0, 0, 0, 0.22));
}
.ps-animal-emoji {
    font-size: clamp(48px, 11vw, 84px);
    line-height: 1;
    pointer-events: none;
    filter: drop-shadow(0 6px 5px rgba(0, 0, 0, 0.22));
}
@keyframes ps-bob {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50%      { transform: translateY(-7px) rotate(1deg); }
}
/* Each animal gets a random-ish delay via nth-child so they don't sync. */
.ps-animal:nth-child(2n) .ps-animal-inner { animation-duration: 1.9s; }
.ps-animal:nth-child(3n) .ps-animal-inner { animation-duration: 1.4s; }
.ps-animal:nth-child(4n) .ps-animal-inner { animation-delay: -0.6s; }

.ps-animal.is-hunted .ps-animal-inner { animation-duration: 0.5s; }
.ps-animal.is-captured .ps-animal-inner { animation: ps-pose 0.5s ease; }
@keyframes ps-pose {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.28) rotate(-4deg); }
    100% { transform: scale(1) rotate(0); }
}
.ps-animal.is-missed .ps-animal-inner { animation: ps-runaway 0.6s ease forwards; }
@keyframes ps-runaway {
    to { transform: translateY(-40px) scale(0.4); opacity: 0; }
}
.ps-animal.is-blurred .ps-animal-inner { animation: ps-shake 0.4s ease; }
@keyframes ps-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-7px) rotate(-3deg); }
    75% { transform: translateX(7px) rotate(3deg); }
}

/* ---------------- Camera HUD overlay ---------------- */
.ps-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}
/* Corner focus brackets */
.ps-corner {
    position: absolute;
    width: 30px; height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.85);
}
.ps-corner.tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.ps-corner.tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.ps-corner.bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.ps-corner.br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }

/* Rule-of-thirds grid */
.ps-grid { position: absolute; inset: 0; opacity: 0.28; }
.ps-grid::before, .ps-grid::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
}
.ps-grid::before { left: 33.33%; right: 33.33%; top: 0; bottom: 0; border-left: 1px solid rgba(255,255,255,0.7); border-right: 1px solid rgba(255,255,255,0.7); background: none; }
.ps-grid::after  { top: 33.33%; bottom: 33.33%; left: 0; right: 0; border-top: 1px solid rgba(255,255,255,0.7); border-bottom: 1px solid rgba(255,255,255,0.7); background: none; }

/* Top status row: REC + shot counter */
.ps-rec {
    position: absolute;
    top: 20px; left: 52px;
    display: flex; align-items: center; gap: 7px;
    color: #fff;
    font: 700 13px/1 'DM Sans', monospace;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.ps-rec-dot {
    width: 11px; height: 11px; border-radius: 50%;
    background: #ff3b3b;
    box-shadow: 0 0 8px #ff3b3b;
    animation: ps-blink 1s steps(2, start) infinite;
}
@keyframes ps-blink { 50% { opacity: 0.15; } }

.ps-count {
    position: absolute;
    top: 20px; left: 50%; transform: translateX(-50%);
    color: #fff;
    font: 700 13px/1 'DM Sans', monospace;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Battery indicator (top-right) */
.ps-batt {
    position: absolute;
    top: 18px; right: 16px;
    width: 26px; height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.ps-batt::after {
    content: '';
    position: absolute; right: -4px; top: 3px;
    width: 3px; height: 5px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 0 2px 2px 0;
}
.ps-batt > span {
    position: absolute; left: 1px; top: 1px; bottom: 1px;
    width: 70%;
    background: #7ee08a;
    border-radius: 1px;
}

/* Zoom indicator (bottom-left, decorative) */
.ps-zoom {
    position: absolute;
    left: 52px; bottom: 32px;
    width: 84px; height: 5px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    overflow: hidden;
}
.ps-zoom-fill { display: block; height: 100%; width: 62%; background: rgba(255, 255, 255, 0.85); }

/* Focus / round timer bar along the bottom of the screen */
.ps-timer-wrap {
    position: absolute;
    left: 52px; right: 52px; bottom: 18px;
    height: 8px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    overflow: hidden;
}
.ps-timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #7ee08a, #f5d94a);
    transform-origin: left center;
    transition: transform 100ms linear, background 200ms linear;
}
.ps-timer-fill.is-low { background: linear-gradient(90deg, #ff9d4d, #ff5b5b); }

/* Digital-camera focus frame that follows the pointer.
   Positioned via transform: translate3d()+scale() from JS so it rides its own
   GPU layer — tracks the pointer 1:1 with no lag and no ghost-trail repaint
   artifacts (which happen when animating left/top on filtered elements). */
.ps-reticle {
    position: absolute;
    left: 0; top: 0;
    width: 88px; height: 88px;             /* must match RET in game.js */
    transform: translate3d(-9999px, -9999px, 0);
    transform-origin: center center;
    pointer-events: none;
    z-index: 6;
    will-change: transform;
    transition: opacity 150ms ease;
}
/* Rounded translucent focus box — the digital-camera "tap to focus" area */
.ps-reticle::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18), inset 0 0 14px rgba(0, 0, 0, 0.14);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
/* four bright L-shaped AF corner brackets */
.ps-af {
    position: absolute;
    width: 18px; height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.95);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
    transition: border-color 120ms ease;
}
.ps-af.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.ps-af.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.ps-af.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.ps-af.br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }
/* Glassy camera lens in the middle */
.ps-lens {
    position: absolute;
    left: 50%; top: 50%;
    width: 28px; height: 28px;
    margin: -14px 0 0 -14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: radial-gradient(circle at 38% 32%,
        rgba(255, 255, 255, 0.6), rgba(120, 180, 220, 0.18) 46%, rgba(0, 0, 0, 0.22) 100%);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.4), inset 0 0 6px rgba(255, 255, 255, 0.35);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.ps-lens::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    width: 6px; height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
}
/* Focus lock: everything glows green as the camera confirms focus */
.ps-reticle.is-locked::before { border-color: #57e08a; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18), 0 0 16px rgba(87, 224, 138, 0.55); }
.ps-reticle.is-locked .ps-af { border-color: #57e08a; }
.ps-reticle.is-locked .ps-lens { border-color: #57e08a; box-shadow: 0 0 10px rgba(87, 224, 138, 0.6), inset 0 0 6px rgba(255, 255, 255, 0.4); }
.ps-reticle.is-locked .ps-lens::after { background: #57e08a; }
/* Smooth glide + zoom only when locking onto the chosen animal. */
.ps-reticle.is-locked {
    transition: transform 160ms ease-out, opacity 150ms ease;
}

/* Shutter flash + aperture blink */
.ps-flash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 8;
}
.ps-flash.is-firing { animation: ps-flash 0.34s ease; }
@keyframes ps-flash {
    0% { opacity: 0; }
    12% { opacity: 0.92; }
    100% { opacity: 0; }
}

/* ---------------- Filmstrip / photo album ---------------- */
.ps-filmstrip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 112px;
    padding: 10px 12px;
    background: repeating-linear-gradient(90deg, #23282f 0 16px, #1a1e24 16px 23px);
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.ps-filmstrip::-webkit-scrollbar { height: 6px; }
.ps-filmstrip::-webkit-scrollbar-thumb { background: #4a5563; border-radius: 6px; }
.ps-film-hint {
    color: #9aa6b4;
    font: 600 14px/1.3 'DM Sans', sans-serif;
    padding: 0 6px;
    white-space: nowrap;
}
.ps-polaroid {
    flex: 0 0 auto;
    width: 90px;
    background: #fff;
    border-radius: 5px;
    padding: 6px 6px 10px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    transform: rotate(var(--ps-tilt, -2deg));
}
.ps-polaroid img { display: block; width: 100%; height: 66px; object-fit: contain; }
.ps-polaroid .ps-polaroid-cap { font-size: 13px; font-weight: 600; text-align: center; color: #2a2f37; margin-top: 4px; font-family: 'DM Sans', sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-polaroid.is-new { animation: ps-develop 0.6s ease; }
@keyframes ps-develop {
    0% { opacity: 0; filter: brightness(2.2) contrast(0.3); transform: rotate(var(--ps-tilt, -2deg)) scale(0.6); }
    100% { opacity: 1; filter: none; transform: rotate(var(--ps-tilt, -2deg)) scale(1); }
}

/* Flying polaroid used during the capture -> album animation */
.ps-fly {
    position: fixed;
    z-index: 90;
    background: #fff;
    border-radius: 6px;
    padding: 6px 6px 14px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    transition: transform 620ms cubic-bezier(0.5, 0, 0.3, 1), opacity 620ms ease;
}
.ps-fly img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ps-fly.is-blur img { filter: blur(3px) contrast(0.8); }

/* Floating "+points" / star popover */
.ps-pop {
    position: fixed;
    z-index: 95;
    font: 800 22px/1 'DM Sans', sans-serif;
    color: #ffb300;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    animation: ps-pop-up 0.9s ease forwards;
    white-space: nowrap;
}
@keyframes ps-pop-up {
    0% { opacity: 0; transform: translateY(0) scale(0.6); }
    20% { opacity: 1; transform: translateY(-8px) scale(1.1); }
    100% { opacity: 0; transform: translateY(-52px) scale(1); }
}

/* Confetti burst */
.ps-confetti {
    position: fixed;
    z-index: 92;
    width: 10px; height: 14px;
    border-radius: 2px;
    pointer-events: none;
    will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
    .ps-animal-inner,
    .ps-bubble, .ps-flake, .ps-rec-dot { animation: none !important; }
}
