/* Screensaver, toast, Cloud Hopper and the reveal animation for the hidden dock item.
   Everything in here is 8-bit: hard edges, banded colors, stepped motion. */

@font-face {
    font-family: 'Press Start 2P';
    src: url('../fonts/PressStart2P.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ==================== HIDDEN ITEMS ==================== */

.dock-item[hidden],
.mobile-app[hidden] {
    display: none;
}

@keyframes dock-pop {
    from { width: 0; opacity: 0; transform: translateY(24px) scale(0.3); }
    to   { width: 64px; opacity: 1; transform: none; }
}

.dock-item.pop {
    animation: dock-pop 0.5s steps(6);
}

/* ==================== TOAST ==================== */

/* Pixel-cut corners come from stacking four 2px-offset shadows instead of a border radius */
.toast {
    position: fixed;
    top: 46px;
    left: 50%;
    z-index: 30000;
    max-width: calc(100vw - 40px);
    padding: 12px 16px;
    background: #16224a;
    color: #fff;
    font: 9px/1.9 'Press Start 2P', monospace;
    text-align: center;
    white-space: pre-line;
    box-shadow:
        0 -2px 0 0 #fff,
        0 2px 0 0 #fff,
        -2px 0 0 0 #fff,
        2px 0 0 0 #fff,
        6px 6px 0 0 rgba(0, 0, 0, 0.35);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -24px);
    transition: opacity 0s linear 0.35s, transform 0.35s steps(5);
}

.toast::first-line {
    color: #ffe94d;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
    transition: opacity 0s, transform 0.35s steps(5);
}

/* ==================== SCREENSAVER ==================== */

/* A soft dusk sky with glass-panel clock, in the same material language as the dock */
.screensaver {
    position: fixed;
    inset: 0;
    z-index: 100000;
    overflow: hidden;
    background: linear-gradient(to bottom,
        #0f1f4d 0%,
        #24408c 34%,
        #5f82d4 60%,
        #c59bc8 80%,
        #f6b79f 94%,
        #ffd6a8 100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    cursor: none;
    transition: opacity 0.6s ease, visibility 0s linear 0.6s;
}

.screensaver.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 1.4s ease, visibility 0s;
}

/* Keeps catching input for a moment after waking so the click can't reach a window underneath */
.screensaver.waking {
    pointer-events: auto;
}

/* Warm glow where the sky meets the horizon */
.ss-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(70% 45% at 50% 105%, rgba(255, 224, 178, 0.75), rgba(255, 224, 178, 0) 70%);
}

.ss-clouds {
    position: absolute;
    inset: 0;
}

.ss-cloud {
    position: absolute;
    left: 0;
    translate: var(--x, 20vw) 0;
    animation: ss-drift 160s linear infinite;
    will-change: translate;
}

@keyframes ss-drift {
    from { translate: calc(var(--w) * -1) 0; }
    to   { translate: calc(100vw + var(--w)) 0; }
}

.ss-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 6vh;
}

.ss-clock {
    padding: clamp(18px, 3.2vw, 34px) clamp(28px, 5vw, 64px);
    text-align: center;
    color: #fff;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-top-color: rgba(255, 255, 255, 0.7);
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(10, 20, 70, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    -webkit-font-smoothing: antialiased;
}

.ss-time {
    font: 200 clamp(56px, 11vw, 120px) / 1 'Helvetica Neue', Helvetica, Arial, sans-serif;
    letter-spacing: -0.03em;
    text-shadow: 0 2px 18px rgba(20, 30, 90, 0.35);
}

.ss-ap {
    margin-left: 0.18em;
    font-size: 0.26em;
    font-weight: 300;
    letter-spacing: 0.02em;
    opacity: 0.9;
}

.ss-date {
    margin-top: clamp(8px, 1.4vw, 14px);
    font: 600 clamp(13px, 1.8vw, 18px) / 1.3 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 8px rgba(20, 30, 90, 0.35);
    opacity: 0.92;
}

@media (prefers-reduced-motion: reduce) {
    .ss-cloud { animation: none; }
    .screensaver, .screensaver.active { transition: opacity 0.2s ease; }
}

@media (prefers-reduced-transparency: reduce) {
    .ss-clock {
        background: rgba(40, 62, 130, 0.88);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

@media (prefers-contrast: more) {
    .ss-clock {
        background: rgba(10, 20, 60, 0.9);
        border-color: #fff;
    }
}

.reduce-motion .ss-cloud { animation: none; }
.reduce-motion .screensaver,
.reduce-motion .screensaver.active { transition: opacity 0.2s ease; }

/* ==================== CLOUD HOPPER ==================== */

/* The game screen sits in a dark arcade bezel */
#gameWindow {
    width: 320px;
    max-width: 320px;
}

.game-body {
    padding: 0 !important;
    background: #0d1033;
    line-height: 0;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    overflow: hidden;
}

.game-canvas {
    display: block;
    margin: 0 auto;
    width: 320px;
    height: 480px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.game-content {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0d1033;
}

@media (prefers-reduced-motion: reduce) {
    .dock-item.pop { animation: none; }
    .toast, .toast.show { transition: none; }
}
