/* =========================================
   VARIABLES
   ========================================= */
:root {
    --bg-sky: #46bdecea;
    --pixel-font: 'Press Start 2P', cursive;
    
    
    --c-white: #ffffff;
    --c-black: #000000;
    --c-green: #00e436; 
    --c-blue: #29adff;
    --c-blue-dark: #00233c;
    --c-red: #ff004d;
    --c-yellow: #ffec27;
    --c-purple: #692addd3;
    
    --shadow-depth: 4px;
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* =========================================
   BASE STYLES
   ========================================= */
* {
    box-sizing: border-box;
    
    image-rendering: pixelated;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
    touch-action: none;
    -webkit-overflow-scrolling: touch;
    background-color: var(--bg-sky);
}

body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100vw;
    width: 100dvw;
    font-family: var(--pixel-font);
    background-color: var(--bg-sky);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    color: var(--c-black);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    transition: filter 0.6s ease, transform 0.6s ease;
}

h1 {
    font-size: 2.5rem;
    color: var(--c-green);
    text-shadow: 
        4px 4px 0 var(--c-black),
        -2px -2px 0 var(--c-yellow);
    line-height: 1.5;
    margin: 0;
    transform: rotate(-3deg);
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    background: var(--c-blue-dark);
    color: var(--c-white);
    padding: 10px;
    display: inline-block;
    box-shadow: 4px 4px 0 var(--c-blue);
}

.hidden { display: none !important; }

.floating {
    animation: float 3s ease-in-out infinite;
}

/* Animations */
@keyframes flyLeft {
    from { transform: translateX(100vw) scale(var(--scale, 1)); }
    to { transform: translateX(-200px) scale(var(--scale, 1)); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes timerPulse {
    0%, 100% { 
        transform: scale(1);
    }
    50% { 
        transform: scale(1.2);
    }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes welcomePop {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes marquee-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50.05%);
    }
}

@keyframes cardEntrance {
    0% { opacity: 0; transform: translateY(100px) scale(0.5) rotate(-10deg); }
    70% { transform: translateY(-10px) scale(1.05) rotate(2deg); }
    100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

@keyframes cardFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* =========================================
   LAYOUT
   ========================================= */
.cloud-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.cloud {
    position: absolute;
    width: 150px;
    height: 75px;
    background-image: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='75' viewBox='0 0 100 50'%3E%3Crect x='20' y='20' width='60' height='15' fill='%23cccccc' opacity='0.4'/%3E%3Crect x='30' y='10' width='40' height='10' fill='%23cccccc' opacity='0.4'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='75' viewBox='0 0 100 50'%3E%3Crect x='20' y='20' width='60' height='15' fill='white' opacity='0.85'/%3E%3Crect x='30' y='10' width='40' height='10' fill='white' opacity='0.85'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: 2px 2px, 0 0;
    left: 0;
    will-change: transform;
    filter: drop-shadow(3px 3px 0 rgba(0,0,0,0.18));
}

.cloud:nth-child(1) { top: 10%; animation: flyLeft 25s linear infinite; animation-delay: -5s; --scale: 1.2; }
.cloud:nth-child(2) { top: 25%; animation: flyLeft 35s linear infinite; animation-delay: -22s; --scale: 0.8; opacity: 0.8; }
.cloud:nth-child(3) { top: 40%; animation: flyLeft 28s linear infinite; animation-delay: -12s; --scale: 1.0; }
.cloud:nth-child(4) { top: 55%; animation: flyLeft 45s linear infinite; animation-delay: -35s; --scale: 0.6; opacity: 0.6; }
.cloud:nth-child(5) { top: 70%; animation: flyLeft 32s linear infinite; animation-delay: -8s; --scale: 1.1; }

#game-container {
    width: 100%;
    max-width: 600px;
    height: 100%;
    padding: 10px 10px 120px 10px;
    text-align: center;
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

@media (hover: hover) and (pointer: fine) {
    #game-container {
        padding-bottom: 90px;
    }
}

/* Static page styles for about/legal pages */
body.static-page {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 1;
}

.static-container {
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    touch-action: pan-y;
    margin: 0;
    padding: 25px;
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    border: 4px solid var(--c-black);
    box-shadow: 8px 8px 0 rgba(0,0,0,0.2);
    box-sizing: border-box;
}

.static-header {
    text-align: center;
    margin-bottom: 30px;
    margin-top: 20px;
}

.static-content {
    background: rgba(255, 255, 255, 0.9);
    border: 4px solid var(--c-black);
    box-shadow: 8px 8px 0 rgba(0,0,0,0.2);
    padding: 20px;
    text-align: center;
}


.logo-area {
    margin-bottom: 10px;
    margin-top: -20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-link {
    display: block;
    line-height: 0;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s;
}

.logo-link:active {
    transform: scale(0.98);
}

#game-logo {
    max-width: 100%;
    height: auto;
    max-height: 350px;
    width: auto;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.3));
}

.screen {
    background: var(--c-white);
    border: 4px solid var(--c-black);
    padding: 1rem;
    box-shadow: 8px 8px 0 rgba(0,0,0,0.2);
    position: relative;
    max-height: calc(100dvh - 150px);
    overflow-y: auto;
    box-sizing: border-box;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.screen::after {
    content: "";
    position: absolute;
    top: 4px; left: 4px; right: 4px; bottom: 4px;
    border: 2px solid rgba(0,0,0,0.05);
    pointer-events: none;
}

.game-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px 0;
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 20px));
    font-size: 0.6rem;
    color: var(--c-black);
    opacity: 0.8;
    z-index: 100;
    font-family: var(--pixel-font);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    box-shadow: none;
    box-sizing: border-box;
    pointer-events: auto;
}

.footer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.footer-socials {
    margin-bottom: 2px;
}

.footer-links {
    font-size: 0.6rem;
}

.footer-copyright {
    font-size: 0.5rem;
    opacity: 0.8;
}

.footer-links a {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.footer-links .separator {
    opacity: 0.5;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid var(--c-black);
    box-shadow: 2px 2px 0 var(--c-black);
    background: var(--c-white);
    text-decoration: none;
    transition: transform 0.1s;
}

.social-link:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.social-svg {
    width: 16px;
    height: 16px;
    display: block;
}

.welcome-overlay {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top, rgba(144, 238, 144, 0.4), transparent 60%),
        radial-gradient(circle at bottom, rgba(0, 80, 40, 0.8), rgba(0, 0, 0, 0.95));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.welcome-modal {
    position: relative;
    background:
        linear-gradient(135deg, #0a3b1a 0%, #137333 40%, #1fd46b 100%);
    border: 4px solid var(--c-black);
    box-shadow: 8px 8px 0 rgba(0,0,0,0.2);
    padding: 1rem 1.1rem;
    max-width: 500px;
    width: 90%;
    overflow: hidden;
    animation: welcomePop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.welcome-title {
    margin: 0 auto 10px auto;
    padding: 10px;
    background: #0b2412;
    color: #b8ffb8;
    display: block;
    text-align: center;
    box-shadow: 4px 4px 0 var(--c-green);
    font-size: 1rem;
}

.welcome-divider {
    border: 0;
    height: 2px;
    background: #000;
    margin: 10px 0;
    box-shadow: 0 1px 0 rgba(255,255,255,0.2);
}

.welcome-content {
    text-align: left;
    font-size: 0.7rem;
    background: rgba(5, 40, 20, 0.9);
    border: 3px solid var(--c-black);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.4);
    padding: 10px;
    color: #e0f2e0;
}

.welcome-subtitle {
    text-align: center;
    margin: 8px 0 14px 0;
    font-size: 0.75rem;
    padding: 8px;
    border: 3px solid var(--c-black);
    background: #145d2e;
    color: #e5ffe5;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.4);
}

.welcome-list-box {
    border: 3px solid var(--c-black);
    padding: 10px;
    background:
        repeating-linear-gradient(
            45deg,
            #0f3b1d,
            #0f3b1d 4px,
            #145b2b 4px,
            #145b2b 8px
        );
    box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
    margin-top: 5px;
}

.welcome-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 15px 0;
}

.welcome-list li {
    margin-bottom: 14px;
    color: #ffffff;
    text-shadow: 1px 1px 0 #000;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.welcome-emoji {
    flex-shrink: 0;
    margin-top: 1px;
}

.welcome-text {
    flex: 1;
    line-height: 1.6;
}

.welcome-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.welcome-actions .pixel-btn {
    margin: 0;
    flex: 1;
}

.privacy-title {
    flex-shrink: 0;
}

.privacy-content {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.privacy-back-btn {
    flex-shrink: 0;
}

.privacy-link {
    cursor: pointer; 
    text-decoration: underline;
}

.install-link {
    display: none;
    text-align: center;
    font-size: 0.6rem;
    text-decoration: underline;
    cursor: pointer;
    margin-top: 10px;
}

/* =========================================
   COMPONENTS
   ========================================= */
.pixel-btn {
    display: block;
    width: 100%;
    padding: 15px 10px;
    margin: 15px 0;
    font-family: var(--pixel-font);
    font-size: 1rem;
    border: 4px solid var(--c-black);
    color: var(--c-black);
    cursor: pointer;
    position: relative;
    box-shadow:
        var(--shadow-depth) var(--shadow-depth) 0 var(--c-black),
        inset -2px -2px 0 rgba(255,255,255,0.2),
        inset 2px 2px 0 rgba(0,0,0,0.15);
    transition: transform 0.1s;
    text-transform: uppercase;
    
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.4), transparent);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
    font-weight: normal;
    letter-spacing: 1px;
    color: white;
}

.pixel-btn.green { background-color: var(--c-green); color: white; }
.pixel-btn.blue { background-color: var(--c-blue); color: white; }
.pixel-btn.yellow { background-color: var(--c-yellow); color: white; }
.pixel-btn.red { background-color: var(--c-red); color: white; }
.pixel-btn.purple { background-color: var(--c-purple); color: white; }
.pixel-btn.small { width: auto; display: inline-block; padding: 10px; font-size: 0.7rem; }

#btn-start { 
    background-color: var(--c-blue); 
    color: white; 
    animation: slideUpFade 0.5s ease-out backwards;
}

#btn-rules { 
    background-color: var(--c-red); 
    color: white; 
    animation: slideUpFade 0.5s ease-out 0.1s backwards;
}

#btn-settings { 
    background-color: var(--c-yellow); 
    color: white; 
    animation: slideUpFade 0.5s ease-out 0.2s backwards;
}

#btn-suggestions { 
    background-color: var(--c-green); 
    color: white; 
    animation: slideUpFade 0.5s ease-out 0.3s backwards;
}

#btn-feedback { 
    background-color: var(--c-purple); 
    color: white; 
    animation: slideUpFade 0.5s ease-out 0.4s backwards;
}

#btn-next {
    background-image: 
        linear-gradient(to bottom, rgba(255,255,255,0.2), rgba(0,0,0,0.1)),
        linear-gradient(to bottom, #ffec27, #ffbd00);
    background-position: center;
    background-size: cover;
    color: white;
}

.pixel-btn::after {
    content: "";
    position: absolute;
    left: 4px;
    right: 4px;
    top: 4px;
    height: 8px;
    background: rgba(255,255,255,0.12);
    pointer-events: none;
}

.pixel-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow:
        var(--shadow-depth) calc(var(--shadow-depth) + 2px) 0 var(--c-black),
        inset -2px -2px 0 rgba(255,255,255,0.2),
        inset 2px 2px 0 rgba(0,0,0,0.15);
}

.pixel-btn:active {
    transform: translate(var(--shadow-depth), var(--shadow-depth));
    box-shadow:
        0 0 0 var(--c-black),
        inset -1px -1px 0 rgba(255,255,255,0.18),
        inset 1px 1px 0 rgba(0,0,0,0.12);
}

.pixel-speech-bubble {
    background: #fff;
    border: 2px solid black;
    padding: 15px;
    position: relative;
    margin-top: 20px;
    font-size: 0.7rem;
    line-height: 1.5;
}

.pixel-speech-bubble::before {
    content: "";
    position: absolute;
    top: -10px; left: 50%;
    border-width: 0 10px 10px;
    border-style: solid;
    border-color: black transparent;
    display: block;
    width: 0;
}

.settings-group {
    text-align: left;
    margin-bottom: 20px;
}

.pixel-box {
    text-align: left;
    padding: 15px;
}

.pixel-box p {
    text-align: left;
    margin: 10px 0;
    font-size: 0.7rem;
    line-height: 1.6;
}

.pixel-box ol {
    text-align: left;
    margin: 10px 0;
    padding-left: 20px;
    font-size: 0.7rem;
    line-height: 1.6;
}

.pixel-box ol li {
    margin: 10px 0;
}

.pixel-box .rules-list {
    text-align: left;
    margin: 15px 0;
    padding-left: 25px;
    font-size: 0.85rem;
    line-height: 1.8;
    list-style-type: disc;
}

.pixel-box .rules-list li {
    margin: 15px 0;
}

label { font-size: 0.8rem; display: block; margin-bottom: 10px;}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 15px;
    background: var(--c-black);
    outline: none;
    border: 2px solid white;
    touch-action: pan-x;
    -webkit-tap-highlight-color: transparent;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    background-color: var(--thumb-color, var(--c-green));
    border: 3px solid var(--c-black);
    cursor: pointer;
    touch-action: pan-x;
    box-shadow: 
        inset 2px 2px 0 rgba(255,255,255,0.4),
        inset -2px -2px 0 rgba(0,0,0,0.2),
        3px 3px 0 rgba(0,0,0,0.2);
    border-radius: 0;
}

.difficulty-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    margin-top: 5px;
}

.pixel-textarea {
    width: 100%;
    padding: 10px;
    font-family: var(--pixel-font);
    font-size: 0.7rem;
    border: 3px solid var(--c-black);
    background: var(--c-white);
    color: var(--c-black);
    resize: none;
    min-height: 80px;
    box-sizing: border-box;
    image-rendering: pixelated;
}

.pixel-select {
    width: 100%;
    padding: 10px;
    font-family: var(--pixel-font);
    font-size: 0.7rem;
    border: 3px solid var(--c-black);
    background: var(--c-white);
    color: var(--c-black);
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--c-black);
    image-rendering: pixelated;
}

.pixel-input,
textarea.pixel-input {
    width: 100%;
    padding: 10px;
    font-family: var(--pixel-font);
    font-size: 0.7rem;
    border: 3px solid var(--c-black);
    background: var(--c-white);
    color: var(--c-black);
    box-shadow: 3px 3px 0 var(--c-black);
    image-rendering: pixelated;
    box-sizing: border-box;
    margin-bottom: 10px;
}

textarea.pixel-input {
    resize: none;
    min-height: 40px; /* Start smaller */
    height: 40px;     /* Force initial height */
    line-height: 1.4;
    overflow-y: hidden; 
    padding: 8px 10px; /* Slightly tighter padding */
}

.password-wrapper {
    position: relative;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 18px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 5;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle svg {
    width: 24px;
    height: 24px;
}

.password-toggle:hover {
    opacity: 1;
}

.pixel-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 0.8rem;
    margin-bottom: 10px;
    user-select: none;
}

.pixel-checkbox-label input {
    display: none;
}

.pixel-checkbox-custom {
    width: 30px;
    height: 30px;
    background-color: var(--c-white);
    border: 3px solid var(--c-black);
    position: relative;
    display: inline-block;
    box-shadow: 3px 3px 0 var(--c-black);
    transition: transform 0.1s, box-shadow 0.1s;
}

.pixel-checkbox-label:active .pixel-checkbox-custom {
    transform: translate(3px, 3px);
    box-shadow: 0 0 0 var(--c-black);
}

.pixel-checkbox-label input:checked + .pixel-checkbox-custom::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 2px;
    width: 8px;
    height: 14px;
    border: solid var(--c-green);
    border-width: 0 4px 4px 0;
    transform: rotate(45deg);
}

.pixel-checkbox-label:hover .pixel-checkbox-custom {
    background-color: #f0f0f0;
}

.pixel-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: default;
    font-size: 0.8rem;
    margin-bottom: 10px;
    user-select: none;
}

.pixel-toggle-switch {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.pixel-toggle-label input {
    display: none;
}

.pixel-toggle-custom {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: var(--c-red); 
    border: 3px solid var(--c-black);
    box-shadow: 3px 3px 0 var(--c-black);
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.1s;
}

.pixel-toggle-switch:active .pixel-toggle-custom {
    transform: translate(3px, 3px);
    box-shadow: 0 0 0 var(--c-black);
}

.pixel-toggle-label input:checked + .pixel-toggle-custom {
    background-color: var(--c-green); 
}

.pixel-toggle-custom::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    background-color: var(--c-white);
    border: 3px solid var(--c-black);
    transition: left 0.2s; 
}

.pixel-toggle-label input:checked + .pixel-toggle-custom::after {
    left: 26px;
}

.pixel-toggle-label:hover .pixel-toggle-custom {
    filter: brightness(1.1);
}

.btn-full-width {
    width: 100%;
}

.pixel-popup {
    border-color: var(--c-red);
    box-shadow: 8px 8px 0 rgba(0,0,0,0.5);
    max-width: 90%;
    width: 400px;
    background: linear-gradient(135deg, #f0f0f0 0%, #d0d0d0 100%);
}

.pixel-popup .welcome-title {
    background: var(--c-white);
    color: var(--c-red);
    box-shadow: 4px 4px 0 var(--c-black);
    text-shadow: 1px 1px 0 var(--c-black);
}

.pixel-popup .welcome-content {
    background: var(--c-white);
    color: var(--c-black);
}

/* Shared Message Styles */
.suggestion-message {
    padding: 10px;
    margin: 10px 0;
    border: 3px solid var(--c-black);
    font-size: 0.7rem;
    text-align: center;
}

.suggestion-message.success {
    background: var(--c-green);
    color: white;
}

.suggestion-message.error {
    background: var(--c-red);
    color: white;
}

/* Cookie Consent */
#cookie-consent {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: var(--c-white);
    border: 4px solid var(--c-black);
    box-shadow: 8px 8px 0 rgba(0,0,0,0.4);
    padding: 20px;
    z-index: 1000;
    display: none; /* Hidden by default, shown by JS */
    text-align: center;
}

#cookie-consent p {
    font-family: 'Arial', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.4;
}

#cookie-consent .cookie-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

#cookie-consent .pixel-btn {
    margin: 0;
}

/* =========================================
   GAME STYLES
   ========================================= */
#random-letter {
    font-size: 6rem;
    color: var(--c-white);
    text-shadow: 5px 5px 0 var(--c-black);
    margin: 20px 0;
}

#countdown-5 {
    font-size: 4rem;
    color: var(--c-red);
}

#game-over-title {
    font-size: 2rem;
    color: var(--c-red);
    text-shadow: 4px 4px 0 var(--c-black);
    margin-bottom: 5px;
    animation: blink 1s infinite;
}

.game-over-content {
    margin: 5px 0;
}

.game-over-message {
    font-size: 1rem;
    color: var(--c-black);
    margin: 5px 0;
}

.jail-gif {
    max-width: 200px;
    height: auto;
    margin-top: 10px;
    border: 3px solid var(--c-black);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
    image-rendering: pixelated;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

#countdown-question {
    color: var(--c-green);
    transition: color 0.3s ease;
}

#countdown-question.timer-green {
    color: var(--c-green);
}

#countdown-question.timer-orange {
    color: #ff7f00;
}

#countdown-question.timer-red {
    color: var(--c-red);
    animation: timerPulse 0.6s ease-in-out infinite;
}

#timer-bar-container {
    width: 100%;
    height: 20px;
    border: 3px solid var(--c-black);
    background: var(--c-white);
    margin: 10px 0 20px 0;
    position: relative;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
}

#timer-bar-fill {
    height: 100%;
    width: 100%;
    background-color: var(--c-green);
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.2), rgba(0,0,0,0.1));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: width 1s linear, background-color 0.3s ease;
}

.home-status {
    margin-top: 6px; 
    font-size: 0.7rem;
    color: #aaddff;
    text-align: center;
    font-family: var(--pixel-font);
    padding: 3px 10px;
    border: 2px solid var(--c-black);
    box-shadow: 3px 3px 0 rgba(0,0,0,0.25);
    background: #003b73;
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
    display: flex;
    animation: slideUpFade 0.5s ease-out 0.5s backwards;
}

.marquee-content {
    display: flex;
    width: max-content;
    animation: marquee-scroll 20s linear infinite;
}

.marquee-segment {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding-right: 0;
}

.d-time, .d-time-unit {
    color: var(--c-green);
    font-weight: bold;
}

.d-diff {
    font-weight: bold;
    color: var(--c-green);
}

.d-pow {
    font-weight: bold;
    color: var(--c-red);
}

.d-opd {
    font-weight: bold;
    color: var(--c-red);
}

/* Card Selection Styles */
#card-selection-container {
    text-align: center;
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-title {
    font-size: 1.2rem;
    color: var(--c-white);
    margin-bottom: 20px;
    text-transform: uppercase;
}

.cards-wrapper {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.card-anim-wrapper {
    width: 90px;
    height: 130px;
    position: relative;
    animation: cardEntrance 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.card-float-wrapper {
    width: 100%;
    height: 100%;
    animation: cardFloat 3s ease-in-out infinite;
}

.card-anim-wrapper.revealed-wrapper,
.card-anim-wrapper.revealed-wrapper .card-float-wrapper {
    animation: none;
}

.pixel-card {
    width: 90px;
    height: 130px;
    background-color: #fbb040;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.2) 10px, rgba(255,255,255,0.2) 20px),
        linear-gradient(to bottom, #fbb040, #f9ed32);
    border: 4px solid var(--c-black);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    color: var(--c-white);
    text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
    cursor: pointer;
    box-shadow: 
        inset 4px 4px 0 rgba(255,255,255,0.4),
        inset -4px -4px 0 rgba(0,0,0,0.1),
        6px 6px 0 var(--c-black);
    filter: grayscale(0%) brightness(1) contrast(1);
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.8s ease, opacity 0.8s ease, border-color 0.8s ease, box-shadow 0.8s ease;
    will-change: transform, filter;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    padding: 8px;
    text-align: center;
    word-break: break-word;
    /* animation: cardFloat 3s ease-in-out infinite; Moved to wrapper */
    position: relative;
}

.pixel-card::before {
    content: "?";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.pixel-card.revealed::before,
.pixel-card.revealed-unselected::before {
    display: none;
}

.card-anim-wrapper:nth-child(1) { animation-delay: 0s; }
.card-anim-wrapper:nth-child(2) { animation-delay: 0.4s; }
.card-anim-wrapper:nth-child(3) { animation-delay: 0.8s; }

.card-anim-wrapper:nth-child(1) .card-float-wrapper { animation-delay: 1.2s; }
.card-anim-wrapper:nth-child(2) .card-float-wrapper { animation-delay: 1.7s; }
.card-anim-wrapper:nth-child(3) .card-float-wrapper { animation-delay: 2.2s; }

.card-anim-wrapper:not(.revealed-wrapper) .card-float-wrapper:hover {
    animation-play-state: paused;
}

.card-anim-wrapper:not(.revealed-wrapper) .card-float-wrapper:hover .pixel-card {
    transform: translateY(-6px) scale(1.02) rotate(1deg);
    box-shadow: 
        inset 4px 4px 0 rgba(255,255,255,0.4),
        inset -4px -4px 0 rgba(0,0,0,0.1),
        8px 10px 0 var(--c-black);
    z-index: 10;
}

.card-anim-wrapper:not(.revealed-wrapper) .card-float-wrapper:active .pixel-card {
    transform: translateY(2px);
    box-shadow: 
        inset 4px 4px 0 rgba(255,255,255,0.4),
        inset -4px -4px 0 rgba(0,0,0,0.1),
        2px 2px 0 var(--c-black);
}

.pixel-card.revealed {
    background: var(--c-blue);
    background-image: 
        linear-gradient(135deg, rgba(255,255,255,0.1) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.1) 75%, transparent 75%, transparent);
    background-size: 20px 20px;
    color: var(--c-white);
    transform: scale(1.15) rotate(0deg);
    box-shadow: 
        inset 4px 4px 0 rgba(255,255,255,0.3),
        inset -4px -4px 0 rgba(0,0,0,0.2),
        8px 8px 0 rgba(0,0,0,0.3);
    animation: none;
    font-size: 0.8rem;
    z-index: 5;
    border-color: white;
    outline: 4px solid var(--c-black);
}

.pixel-card.revealed-unselected {
    filter: grayscale(100%) brightness(0.7) contrast(0.8);
    transform: scale(0.95);
    opacity: 0.6;
    cursor: default;
    box-shadow: inset 2px 2px 0 rgba(0,0,0,0.1), 2px 2px 0 rgba(0,0,0,0.2);
    animation: none;
    font-size: 0.8rem;
    border-color: #555;
    /* Keep background image for smooth grayscale transition */
}

/* =========================================
   MEDIA QUERIES
   ========================================= */
@media (max-width: 600px) {
    html, body {
        overflow: hidden;
        touch-action: none;
        -webkit-overflow-scrolling: none;
        overscroll-behavior: none;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    body {
        padding: 5px;
    }
    
    #game-container {
        max-width: 100%;
        padding: 10px;
    }
    
    .logo-area {
        margin-bottom: 10px;
    }
    
    #game-logo {
        max-height: 120px;
        max-width: 80%;
    }
    
    h1 { 
        font-size: 1.5rem; 
        line-height: 1.3;
    }
    
    .screen { 
        padding: 0.6rem 0.5rem; 
        width: 100%;
        margin: 0;
        max-height: calc(100dvh - 40px);
        overflow-y: auto;
    }
    
    #game-container {
        max-height: 100dvh;
        height: 100dvh;
        padding: 5px;
    }
    
    h2 {
        font-size: 0.9rem;
        padding: 8px;
        margin-bottom: 15px;
    }
    
    #random-letter { 
        font-size: 3.5rem; 
        margin: 15px 0;
    }
    
    #countdown-5 {
        font-size: 3rem;
    }
    
    #countdown-question {
        font-size: 2.5rem;
    }
    
    #game-over-title {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .game-over-message {
        font-size: 0.8rem;
    }
    
    .pixel-btn { 
        font-size: 0.7rem; 
        padding: 12px 8px;
        margin: 10px 0;
    }
    
    
    .pixel-speech-bubble {
        font-size: 0.65rem;
        padding: 12px;
        margin-top: 15px;
    }
    
    .pixel-btn.small {
        font-size: 0.6rem;
        padding: 8px;
    }
    
    .settings-group {
        margin-bottom: 15px;
    }
    
    label {
        font-size: 0.7rem;
        margin-bottom: 8px;
    }
    
    .difficulty-labels {
        font-size: 0.55rem;
    }
    
    
    #admin-screen {
        max-height: calc(100dvh - 60px);
        padding: 0.6rem 0.5rem;
    }
    
    #admin-screen h2 {
        font-size: 0.7rem;
        margin-bottom: 6px;
        padding: 5px;
    }
    
    .admin-tabs {
        gap: 3px;
        margin-bottom: 6px;
    }
    
    .admin-tab {
        padding: 4px 6px;
        font-size: 0.45rem;
    }
    
    #question-manager-list,
    #suggestions-manager-list,
    #admin-powerups-list,
    #admin-opdrachten-list,
    #feedback-manager-list {
        height: 90px;
        max-height: 90px;
        font-size: 0.45rem;
        margin-bottom: 5px;
        padding: 4px;
    }
    
    .admin-controls {
        gap: 4px;
        margin-bottom: 5px;
        flex-wrap: wrap;
    }
    
    .admin-controls select {
        font-size: 0.5rem;
        padding: 5px;
        min-width: 0;
    }
    
    .admin-controls button {
        padding: 5px;
        font-size: 0.45rem;
    }
    
    .admin-item {
        padding: 2px 0;
        font-size: 0.45rem;
    }
    
    .btn-approve,
    .btn-reject {
        padding: 3px 6px;
        margin: 0 2px;
        font-size: 0.45rem;
    }
    
    .pixel-btn.small {
        font-size: 0.5rem;
        padding: 5px;
        margin: 3px 0;
    }
    
    .admin-tab-content {
        margin-bottom: 6px;
    }
    
    #question-manager-list,
    #admin-powerups-list,
    #admin-opdrachten-list {
        font-size: 0.55rem;
        height: 120px;
        padding: 4px;
    }
    
    .admin-item {
        padding: 4px 0;
    }
    
    .admin-controls {
        margin-bottom: 10px;
    }
    
    .install-link {
        display: block;
    }
}

@media (max-width: 400px) {
    #game-logo {
        max-height: 100px;
        max-width: 85%;
    }
    
    h1 { 
        font-size: 1.2rem; 
    }
    
    #random-letter { 
        font-size: 3rem; 
    }
    
    #countdown-5 {
        font-size: 2.5rem;
    }
    
    #countdown-question {
        font-size: 2rem;
    }
    
    #game-over-title {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }
    
    .game-over-message {
        font-size: 0.75rem;
    }
    
    .pixel-btn { 
        font-size: 0.65rem; 
        padding: 10px 6px;
    }
    
    .screen { 
        padding: 0.8rem 0.6rem; 
    }
    
    h2 {
        font-size: 0.8rem;
        padding: 6px;
    }
    
    .pixel-speech-bubble {
        font-size: 0.6rem;
        padding: 10px;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    body {
        overflow-y: auto;
    }
    
    #game-container {
        padding: 5px 5px 120px 5px;
    }
    
    .logo-area {
        margin-bottom: 10px;
    }
    
    h1 {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }
    
    .screen {
        padding: 0.8rem;
    }
    
    #random-letter {
        font-size: 3rem;
        margin: 10px 0;
    }
    
    #countdown-5,
    #countdown-question {
        font-size: 2.5rem;
    }
}

@media (max-height: 750px) {
    #game-logo {
        max-height: 80px;
        margin-bottom: 5px;
    }

    .pixel-btn {
        padding: 8px 5px;
        margin: 6px 0;
        font-size: 0.65rem;
    }

    .screen {
        padding: 0.5rem;
    }

    .logo-area {
        margin-top: 0;
        margin-bottom: 5px;
    }
    
    .game-footer {
        padding-top: 5px;
        padding-bottom: calc(5px + env(safe-area-inset-bottom, 10px));
        gap: 4px;
    }
    
    #game-container {
        padding-bottom: 80px;
    }
}
