/* ===========================
   FRONTEND ACTIVITY STYLES
   Based on test.html design
   =========================== */

/* Responsive Outer Wrapper for Mobile Devices */
.cca-responsive-wrapper {
    width: 100%;
    max-width: 1280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    margin: 0 auto;
}

/* Main Container — Fluid 16:9 Aspect-Ratio (max 1280px) */
.custom-course-activity {
    position: relative;
    width: 100% !important;
    max-width: 1280px !important;
    aspect-ratio: 16 / 9 !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 auto;
    background: #000;
    overflow: hidden;
    font-family: sans-serif;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    touch-action: manipulation;
    container-type: inline-size;
    /* Enables Container Query Units (cqw) */
    box-sizing: border-box;
}


/* Fullscreen Mode Pseudoclass & JS Class Support */
.custom-course-activity.cca-is-fullscreen,
.custom-course-activity:fullscreen,
.custom-course-activity:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left) !important;
    background: #000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.custom-course-activity.cca-is-fullscreen .course-container,
.custom-course-activity:fullscreen .course-container,
.custom-course-activity:-webkit-full-screen .course-container {
    width: min(100vw, calc(100vh * 16 / 9)) !important;
    width: min(100vw, calc(100dvh * 16 / 9)) !important;
    height: min(100vh, calc(100vw * 9 / 16)) !important;
    height: min(100dvh, calc(100vw * 9 / 16)) !important;
    max-width: 100% !important;
    max-height: 100% !important;
    aspect-ratio: 16 / 9 !important;
    position: relative !important;
    margin: auto !important;
    box-sizing: border-box !important;
}

/* Mobile Landscape Fullscreen Safety Buffer (Reserves 50px space for mobile Chrome system exit toast) */
@media screen and (max-height: 600px) {

    .custom-course-activity.cca-is-fullscreen .course-container,
    .custom-course-activity:fullscreen .course-container,
    .custom-course-activity:-webkit-full-screen .course-container {
        width: min(100vw, calc((100vh - 50px) * 16 / 9)) !important;
        width: min(100vw, calc((100dvh - 50px) * 16 / 9)) !important;
        height: min(calc(100vh - 50px), calc(100vw * 9 / 16)) !important;
        height: min(calc(100dvh - 50px), calc(100vw * 9 / 16)) !important;
        max-height: calc(100vh - 50px) !important;
        max-height: calc(100dvh - 50px) !important;
    }
}

.custom-course-activity.cca-is-fullscreen .cca-slide,
.custom-course-activity:fullscreen .cca-slide,
.custom-course-activity:-webkit-full-screen .cca-slide {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

.custom-course-activity.cca-is-fullscreen .cca-slide-bg,
.custom-course-activity:fullscreen .cca-slide-bg,
.custom-course-activity:-webkit-full-screen .cca-slide-bg {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

/* Progress Bar */
.cca-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 1000;
}

.cca-progress-fill {
    height: 100%;
    background: #4CAF50;
    transition: width 0.3s ease;
}

.cca-stage-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    color: white;
    font-size: clamp(10px, 1.2cqw, 14px);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 5px;
    z-index: 1000;
    display: none;
}

/* Course Container */
.course-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Slides */
.cca-slide {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.cca-slide.active {
    display: block;
}

.cca-slide-bg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Base Top & Nav Button Layout Rules */
.cca-top-btn,
.cca-nav-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: nowrap !important;
    width: max-content !important;
    min-width: max-content !important;
    max-width: none !important;
    flex-shrink: 0 !important;
}

/* Image nav/top buttons — fluid square sizing anchored to correct corner */
.cca-top-btn.is-image,
.cca-nav-btn.is-image {
    width: clamp(36px, 9cqw, 100px) !important;
    height: clamp(36px, 9cqw, 100px) !important;
    min-width: clamp(36px, 9cqw, 100px) !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Mobile & Mobile Landscape Compact Button Sizing */
@media screen and (max-width: 768px),
screen and (max-height: 600px) {

    .cca-top-btn.is-image,
    .cca-nav-btn.is-image {
        width: clamp(20px, 5.5cqw, 55px) !important;
        height: clamp(20px, 5.5cqw, 55px) !important;
        min-width: clamp(20px, 5.5cqw, 55px) !important;
    }

    .cca-home-btn,
    .cca-prev-btn,
    .cca-next-btn {
        padding: clamp(2px, 0.5cqw, 5px) clamp(5px, 0.9cqw, 10px) !important;
        font-size: clamp(9px, 1cqw, 12px) !important;
    }

    .cca-fullscreen-btn {
        width: clamp(16px, 3.2cqw, 26px) !important;
        height: clamp(16px, 3.2cqw, 26px) !important;
        padding: 0 !important;
        top: 0% !important;
        right: 0% !important;
    }

    .cca-fullscreen-btn svg {
        width: clamp(10px, 2cqw, 15px) !important;
        height: clamp(10px, 2cqw, 15px) !important;
    }

    .cca-game-statusbar {
        padding: clamp(2px, 0.5cqw, 6px) clamp(8px, 1.5cqw, 16px) !important;
        font-size: clamp(8px, 1.1cqw, 13px) !important;
        max-width: 88% !important;
    }

    .cca-game-reset {
        padding: clamp(3px, 0.5cqw, 6px) clamp(6px, 1cqw, 12px) !important;
        font-size: clamp(8px, 1cqw, 12px) !important;
    }
}

/* Home Button — Top Left Aligned */
.cca-home-btn {
    position: absolute;
    left: var(--btn-x, 2%);
    top: var(--btn-y, 2%);
    transform: scale(var(--btn-scale, 0.8));
    transform-origin: top left;
    padding: clamp(4px, 0.9cqw, 10px) clamp(8px, 1.6cqw, 20px);
    font-size: clamp(11px, 1.4cqw, 16px);
    border-radius: 5px;
    cursor: pointer;
    border: none;
    background: var(--btn-bg, rgba(0, 0, 0, 0.6)) !important;
    color: var(--btn-color, #ffffff) !important;
    z-index: 100;
    font-weight: 600;
    white-space: nowrap !important;
    width: max-content !important;
    min-width: max-content !important;
}

.cca-home-btn:hover {
    filter: brightness(1.1);
}

/* Fullscreen Button — Permanently Locked & Flush to Top Right Corner */
.cca-fullscreen-btn {
    position: absolute !important;
    top: auto !important;
    right: 0% !important;
    left: auto !important;
    bottom: 0% !important;
    transform: scale(var(--btn-scale, 0.85)) !important;
    transform-origin: top right !important;
    width: clamp(20px, 3.8cqw, 34px) !important;
    height: clamp(20px, 3.8cqw, 34px) !important;
    padding: 0 !important;
    border-radius: 0 0 0 6px !important;
    cursor: pointer;
    border: none;
    background: var(--btn-bg, rgba(140, 140, 140, 0.75)) !important;
    color: var(--btn-color, #ffffff) !important;
    z-index: 90 !important;
    /* Strictly scoped inside activity container area */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.25);
    transition: background 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.cca-fullscreen-btn svg {
    width: clamp(12px, 2.3cqw, 20px) !important;
    height: clamp(12px, 2.3cqw, 20px) !important;
}

.cca-fullscreen-btn:hover {
    background: rgba(110, 110, 110, 0.9) !important;
    filter: brightness(1.15);
}

.cca-fullscreen-btn .cca-fs-icon-enter,
.cca-fullscreen-btn .cca-fs-icon-exit {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.cca-fullscreen-btn .cca-fs-icon-exit {
    display: none;
}

/* Fullscreen active state icon & tooltip toggle */
.custom-course-activity.cca-is-fullscreen .cca-fullscreen-btn .cca-fs-icon-enter,
.custom-course-activity:fullscreen .cca-fullscreen-btn .cca-fs-icon-enter,
.custom-course-activity:-webkit-full-screen .cca-fullscreen-btn .cca-fs-icon-enter {
    display: none !important;
}

.custom-course-activity.cca-is-fullscreen .cca-fullscreen-btn .cca-fs-icon-exit,
.custom-course-activity:fullscreen .cca-fullscreen-btn .cca-fs-icon-exit,
.custom-course-activity:-webkit-full-screen .cca-fullscreen-btn .cca-fs-icon-exit {
    display: flex !important;
}

/* Tooltip on hover ("Vollbild") */
.cca-fullscreen-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.custom-course-activity.cca-is-fullscreen .cca-fullscreen-btn[data-tooltip]::after,
.custom-course-activity:fullscreen .cca-fullscreen-btn[data-tooltip]::after,
.custom-course-activity:-webkit-full-screen .cca-fullscreen-btn[data-tooltip]::after {
    content: "Vollbild beenden";
}

.cca-fullscreen-btn[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Prev Button — Bottom Left Aligned */
.cca-prev-btn {
    position: absolute;
    left: var(--btn-x, 2%);
    top: var(--btn-y, 98%);
    transform: translateY(-100%) scale(var(--btn-scale, 0.8));
    transform-origin: bottom left;
    padding: clamp(5px, 1cqw, 12px) clamp(10px, 1.9cqw, 24px);
    font-size: clamp(12px, 1.5cqw, 18px);
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background: var(--btn-bg, rgba(0, 0, 0, 0.6)) !important;
    color: var(--btn-color, #ffffff) !important;
    z-index: 100;
    font-weight: 600;
    white-space: nowrap !important;
    width: max-content !important;
    min-width: max-content !important;
}

.cca-fullscreen-btn:hover {
    filter: brightness(1.1);
}

/* Prev Button — Bottom Left Aligned */
.cca-prev-btn {
    position: absolute;
    left: var(--btn-x, 2%);
    top: var(--btn-y, 98%);
    transform: translateY(-100%) scale(var(--btn-scale, 0.8));
    transform-origin: bottom left;
    padding: clamp(5px, 1cqw, 12px) clamp(10px, 1.9cqw, 24px);
    font-size: clamp(12px, 1.5cqw, 18px);
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background: var(--btn-bg, rgba(0, 0, 0, 0.6)) !important;
    color: var(--btn-color, #ffffff) !important;
    z-index: 100;
    font-weight: 600;
    white-space: nowrap !important;
    width: max-content !important;
    min-width: max-content !important;
}

.cca-prev-btn:hover {
    filter: brightness(1.1);
}

/* Next Button — Bottom Right Aligned */
.cca-next-btn {
    position: absolute;
    left: var(--btn-x, 98%);
    top: var(--btn-y, 98%);
    transform: translate(-100%, -100%) scale(var(--btn-scale, 0.8));
    transform-origin: bottom right;
    padding: clamp(5px, 1cqw, 12px) clamp(10px, 1.9cqw, 24px);
    font-size: clamp(12px, 1.5cqw, 18px);
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background: var(--btn-bg, rgba(0, 0, 0, 0.6)) !important;
    color: var(--btn-color, #ffffff) !important;
    z-index: 100;
    font-weight: 600;
    white-space: nowrap !important;
    width: max-content !important;
    min-width: max-content !important;
}

.cca-next-btn:hover {
    filter: brightness(1.1);
}

/* Custom Unified Buttons */
.cca-custom-btn {
    position: absolute;
    left: var(--btn-x, 50%);
    top: var(--btn-y, 50%);
    transform: translate(-50%, -50%) scale(var(--btn-scale, 1));
    background: var(--btn-bg, #ff6b35);
    color: var(--btn-color, #ffffff);
    padding: var(--btn-padding, 15px 40px);
    border: none;
    border-radius: var(--btn-radius, 50px);
    font-size: var(--btn-font-size, 24px);
    font-weight: 600;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    width: max-content;
}

.cca-custom-btn:hover {
    transform: translate(-50%, -50%) scale(var(--btn-scale, 1));
    filter: none;
    background-color: transparent !important;
    color: var(--btn-color, #ffffff) !important;
}

.cca-custom-btn.is-image {
    background: transparent;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    width: calc(var(--btn-width, 20) * 1cqw * var(--btn-scale, 1));
    height: auto;
}

/* All button sizes scale automatically via clamp()/cqw — no mobile override needed */


.cca-custom-btn.is-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Game Map Styles */
.cca-game-map {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.cca-map-stage {
    position: absolute;
    width: 80px;
    height: 80px;
    cursor: pointer;
    opacity: 1;
    transition: all 0.3s ease;
    border-radius: 8px;
    z-index: 10;
    display: inline-block;
}

.cca-map-stage:hover:not(.locked) {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.cca-map-stage.locked {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

.cca-map-stage.completed {
    /* Border and shadow applied via JavaScript with custom colors */
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.2);
    }
}

/* Connecting Lines */
.cca-map-line {
    position: absolute;
    height: 3px;
    background: none;
    z-index: 0;
    transform-origin: 0 0;
    opacity: 0.8;
    /* Border style applied via JavaScript with custom settings */
}

/* Popup Modal */
.cca-stage-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    z-index: 999999;
    animation: fadeIn 0.3s ease;
}

/* Fullscreen popup support */
.custom-course-activity .cca-stage-popup {
    position: absolute;
}

.cca-stage-popup.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.cca-popup-content {
    position: relative;
    width: clamp(280px, 75cqw, 800px);
    height: clamp(180px, 55cqw, 600px);
    /* ~75cqw * 9/16 to keep 16:9 ratio */
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.cca-popup-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.cca-popup-close {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(28px, 8%, 60px);
    height: clamp(28px, 8%, 60px);
    border-radius: 50%;
    font-size: clamp(14px, 4%, 30px);
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    z-index: 1001;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cca-popup-close:hover {
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    filter: none;
}

/* Loading State */
.cca-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    z-index: 1000;
}

.cca-loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60%,
    100% {
        content: '...';
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .custom-course-activity {
        max-width: 100%;
    }
}

/* Screen-width breakpoints only affect the outer wrapper width */
@media (max-width: 768px) {
    .custom-course-activity {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .custom-course-activity {
        max-width: 100%;
    }
}

/* Fullscreen Mode */
.custom-course-activity:fullscreen::before,
.custom-course-activity:-webkit-full-screen::before,
.custom-course-activity:-moz-full-screen::before,
.custom-course-activity:-ms-fullscreen::before {
    display: none;
}

/* FIXED: Ensure popup is visible in fullscreen */
.custom-course-activity:fullscreen .cca-stage-popup,
.custom-course-activity:-webkit-full-screen .cca-stage-popup,
.custom-course-activity:-moz-full-screen .cca-stage-popup,
.custom-course-activity:-ms-fullscreen .cca-stage-popup {
    z-index: 2147483647 !important;
    position: fixed !important;
}

:fullscreen .cca-stage-popup,
:-webkit-full-screen .cca-stage-popup,
:-moz-full-screen .cca-stage-popup,
:-ms-fullscreen .cca-stage-popup {
    z-index: 2147483647 !important;
    position: fixed !important;
}

/* Memory Game 1 fullscreen adjustments */
.custom-course-activity.cca-is-fullscreen .cca-memory-game .cca-memory-face img,
.custom-course-activity:fullscreen .cca-memory-game .cca-memory-face img,
.custom-course-activity:-webkit-full-screen .cca-memory-game .cca-memory-face img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: auto !important;
}

.custom-course-activity.cca-is-fullscreen .cca-memory-game .cca-memory-front img,
.custom-course-activity:fullscreen .cca-memory-game .cca-memory-front img,
.custom-course-activity:-webkit-full-screen .cca-memory-game .cca-memory-front img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: auto !important;
}

/* Print Styles */
@media print {
    .custom-course-activity {
        height: auto;
        page-break-inside: avoid;
    }

    .cca-nav-btn,
    .cca-top-btn,
    .cca-progress-bar {
        display: none;
    }
}

/* Accessibility */
.cca-nav-btn:focus,
.cca-top-btn:focus,
.cca-map-stage:focus,
.cca-popup-close:focus {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {

    .cca-nav-btn,
    .cca-top-btn {
        background: rgba(0, 0, 0, 0.9);
        border: 2px solid white;
    }

    .cca-map-stage.completed {
        border: 4px solid yellow;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    .cca-nav-btn,
    .cca-top-btn,
    .cca-map-stage,
    .cca-popup-content,
    .cca-stage-popup {
        animation: none;
        transition: none;
    }

    .cca-map-stage:hover:not(.locked) {
        transform: none;
    }
}

/* ===========================
   SELECTING GAME STYLES
   =========================== */
.cca-selecting-game {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 10;
}

.cca-selecting-img {
    position: absolute;
    cursor: pointer;
    opacity: 1;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.cca-selecting-img:hover {
    transform: scale(1.05);
}

.cca-selecting-img.correct {
    filter: drop-shadow(0 0 15px var(--correct-color, #16a34a)) brightness(1.1);
}

.cca-selecting-img.wrong {
    filter: drop-shadow(0 0 15px var(--wrong-color, #f59e0b)) brightness(1.1);
}

.cca-selecting-img.disabled {
    pointer-events: none;
    opacity: 0.7;
}

/* ===========================
   MEMORY GAME STYLES
   =========================== */
.cca-memory-game {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2cqw 2cqw 12cqw 2cqw;
    z-index: 10;
    box-sizing: border-box;
}

.cca-memory-grid {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 0.5vmin;
    perspective: 1200px;
    box-sizing: border-box;
}

.cca-memory-card {
    position: relative;
    border-radius: 1vmin;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.cca-memory-card.flipped {
    transform: rotateY(180deg);
}

.cca-memory-card.matched {
    cursor: default;
}

.cca-memory-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 1vmin;
    overflow: hidden;
    box-shadow: 0 0.5vmin 1.5vmin rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

.cca-memory-back {
    transform: rotateY(180deg);
}

.cca-memory-face img {
    max-width: 98% !important;
    max-height: 98% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: auto !important;
    display: block !important;
}

.cca-memory-front {
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .18), rgba(255, 255, 255, .05));
    border: 1px solid rgba(255, 255, 255, .18);
    background-color: #2c3e50;
}

/* Memory Game 1 front card - use img tag instead of background */
.cca-memory-game .cca-memory-front img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: auto !important;
}

.cca-memory-back {
    background-color: transparent;
}

.cca-memory-card.matched .cca-memory-back {
    outline: 4px solid #16a34a;
    outline-offset: -4px;
}

/* Game Status Bars — fluid cqw sizing */
.cca-game-statusbar {
    position: absolute;
    bottom: clamp(4px, 1cqw, 12px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 60%;
    max-width: 92%;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(3px, 0.7cqw, 10px) clamp(10px, 2cqw, 30px);
    font-size: clamp(9px, 1.4cqw, 18px);
    z-index: 100;
    border-radius: clamp(16px, 3cqw, 50px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    gap: clamp(6px, 1cqw, 14px);
}

.cca-game-reset {
    padding: clamp(4px, 0.7cqw, 10px) clamp(8px, 1.4cqw, 20px);
    border-radius: clamp(12px, 2cqw, 20px);
    font-size: clamp(9px, 1.2cqw, 14px);
    margin: clamp(2px, 0.4cqw, 5px);
    white-space: nowrap;
    flex-shrink: 0;
}

.cca-game-statusbar .left,
.cca-game-statusbar .right {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1cqw, 14px);
}

.cca-game-statusbar b {
    font-size: clamp(10px, 1.5cqw, 20px);
}

/* Game Feedback Modal */
.cca-game-feedback {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    z-index: 999999;
    animation: fadeIn 0.3s ease;
}

.cca-game-feedback.active {
    display: flex;
}

.cca-game-feedback-content {
    background: #1e293b;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease;
    color: white;
}

.cca-game-feedback-content h3 {
    margin-top: 0;
    font-size: 24px;
}

.cca-game-feedback-content p {
    margin: 15px 0;
    font-size: 16px;
}

.cca-game-feedback-close {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.cca-game-feedback-close:hover {
    background: #45a049;
    transform: translateY(-2px);
}

/* ===========================
   MEMORY GAME TYPE 02 STYLES
   =========================== */
.cca-memory-v2-game {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 10;
}

.cca-memory-v2-card {
    position: absolute;
    cursor: pointer;
    transform-style: preserve-3d;
    perspective: 1200px;
}

.cca-memory-v2-card .cca-memory-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    border-radius: 1vmin;
}

.cca-memory-v2-card.flipped .cca-memory-card {
    transform: rotateY(180deg);
}

.cca-memory-v2-card.matched .cca-memory-card {
    cursor: default;
}

.cca-memory-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 1vmin;
    overflow: hidden;
    box-shadow: 0 0.5vmin 1.5vmin rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

/* Memory Game 1 specific card face */
.cca-memory-game .cca-memory-face {
    padding: 0;
}

.cca-memory-v2-card .cca-memory-back {
    transform: rotateY(180deg);
}

.cca-memory-face img {
    width: 100%;
    height: 100%;
    object-fit: scale-down;
    display: block;
}

/* Memory Game 1 specific image sizing */
.cca-memory-game .cca-memory-face img {
    width: 95%;
    height: 100%;
    object-fit: contain;
}

.cca-memory-v2-card .cca-memory-front {
    background-size: cover;
    background-position: center;
}

.cca-memory-v2-card.matched .cca-memory-back {
    outline: 4px solid #16a34a;
    outline-offset: -4px;
}

/* Memory game responsive — gap reduces on smaller containers */
@media (max-width: 1024px) {
    .cca-memory-grid {
        gap: 0.4vmin;
    }
}

@media (max-width: 768px) {
    .cca-memory-grid {
        gap: 0.3vmin;
    }
}

@media (max-width: 480px) {
    .cca-memory-grid {
        gap: 0.2vmin;
    }

    .cca-memory-face {
        padding: 0.5vmin;
    }
}