/* ==========================================================================
   CYBERKNIGHT — LEVEL 0: "MÁY SOI KIM CƯƠNG" (HỘP QUÀ BÍ ẨN)
   Design System: Child-Friendly CyberKnight Theme — Bright, Cute & Animated
   ========================================================================== */

:root {
    /* ===== CHILD-FRIENDLY COLOR PALETTE ===== */
    --ck-blue-50: #EBF5FF;
    --ck-blue-100: #D0E8FF;
    --ck-blue-200: #A3D1FF;
    --ck-blue-300: #5BA8FF;
    --ck-blue-400: #3B8EFF;
    --ck-blue-500: #0066FF;
    --ck-blue-600: #0052CC;
    --ck-blue-700: #003D99;
    --ck-sky: #00D4FF;
    --ck-mint: #4ECDC4;
    --ck-green: #22C55E;
    --ck-green-light: #A7F3D0;
    --ck-yellow: #FFD700;
    --ck-yellow-light: #FFF3B0;
    --ck-orange: #FF9F43;
    --ck-red: #FF4757;
    --ck-red-light: #FECDD3;
    --ck-pink: #FF6B9D;
    --ck-purple: #8B5CF6;
    --ck-white: #FFFFFF;
    --ck-bg-gradient-start: #E8F4FD;
    --ck-bg-gradient-mid: #D0E8FF;
    --ck-bg-gradient-end: #C3DDFF;
    --ck-text-primary: #1E3A5F;
    --ck-text-secondary: #4A6FA5;
    --ck-text-muted: #7B9CC0;

    /* ===== SHADOWS ===== */
    --ck-shadow-soft: 0 4px 20px rgba(0, 102, 255, 0.12);
    --ck-shadow-card: 0 8px 32px rgba(0, 102, 255, 0.15), 0 2px 8px rgba(0, 0, 0, 0.06);
    --ck-shadow-button: 0 4px 16px rgba(0, 102, 255, 0.3);
    --ck-shadow-glow-blue: 0 0 30px rgba(0, 102, 255, 0.25);
    --ck-shadow-glow-green: 0 0 30px rgba(34, 197, 94, 0.3);
    --ck-shadow-glow-red: 0 0 30px rgba(255, 71, 87, 0.3);

    /* ===== FONTS ===== */
    --font-heading: 'Poppins', 'Space Grotesk', sans-serif;
    --font-body: 'Poppins', 'Inter', -apple-system, sans-serif;

    /* ===== LEGACY COMPATIBILITY ===== */
    --cyber-bg: #0a0e27;
    --cyber-card-bg: rgba(16, 23, 53, 0.85);
    --cyber-accent: #00f0ff;
    --cyber-secondary: #8b5cf6;
    --cyber-pink: #ff00aa;
    --cyber-yellow: #ffd700;
    --cyber-good: #00ff88;
    --cyber-bad: #ff3366;
    --cyber-warning: #ffaa00;
    --brutal-border: 3px solid #ffffff;
    --brutal-shadow: 6px 6px 0px 0px #000000;
    --brutal-shadow-hover: 3px 3px 0px 0px #000000;
    --brutal-shadow-good: 0 0 30px rgba(0, 255, 136, 0.4), 6px 6px 0px #000;
    --brutal-shadow-bad: 0 0 30px rgba(255, 51, 102, 0.5), 6px 6px 0px #000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: fixed;
    inset: 0;
    background-color: var(--ck-bg-gradient-start);
    color: var(--ck-text-primary);
    font-family: var(--font-body);
    touch-action: manipulation;
}

/* ==========================================================================
   CONTAINER & STAGES (Full Viewport Management)
   ========================================================================== */

#app-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(180deg, var(--ck-bg-gradient-start) 0%, var(--ck-bg-gradient-mid) 50%, var(--ck-bg-gradient-end) 100%);
}

.stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.stage.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 20;
}

/* Freeze Frame Canvas Overlay for 100% seamless crossfade */
#freeze-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

/* ==========================================================================
   VIDEO STAGES (#stage-intro & #stage-outro)
   ========================================================================== */

.video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #000;
}

/* Skip Video Button — Floating pill on video stages */
.video-skip-btn {
    position: absolute;
    bottom: 32px;
    right: 32px;
    z-index: 35;
    padding: 12px 28px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ck-blue-600);
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 2px solid var(--ck-blue-300);
    border-radius: 50px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 4px rgba(0, 102, 255, 0.08);
    transition: all 0.25s ease;
    animation: skip-btn-appear 0.6s ease-out 1s both;
}

.video-skip-btn:hover {
    background: var(--ck-blue-500);
    color: #fff;
    border-color: var(--ck-blue-500);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 28px rgba(0, 102, 255, 0.35);
}

.video-skip-btn:active {
    transform: translateY(0) scale(0.98);
}

@keyframes skip-btn-appear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-overlay-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 30;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--ck-blue-400);
    color: var(--ck-blue-600);
    padding: 10px 18px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 50px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    box-shadow: var(--ck-shadow-soft);
}

.video-overlay-btn:hover {
    background: var(--ck-blue-500);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--ck-shadow-button);
}

/* ==========================================================================
   START OVERLAY — Child-Friendly CyberKnight Welcome
   ========================================================================== */

#start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: linear-gradient(180deg, #E8F4FD 0%, #D0E8FF 40%, #C3DDFF 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    text-align: center;
    padding: 24px;
    transition: opacity 0.5s ease;
}

/* Floating decorations background for start overlay */
#start-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(0, 102, 255, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(0, 212, 255, 0.04) 0%, transparent 50%);
    pointer-events: none;
}

#start-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.cyber-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--ck-blue-100), var(--ck-blue-50));
    border: 2px solid var(--ck-blue-300);
    border-radius: 999px;
    color: var(--ck-blue-600);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: var(--ck-shadow-soft);
    animation: badge-float 3s ease-in-out infinite;
}

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

.cyber-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--ck-blue-600) 0%, var(--ck-blue-400) 40%, var(--ck-sky) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 12px rgba(0, 102, 255, 0.2));
    line-height: 1.2;
}

.cyber-subtitle {
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--ck-text-secondary);
    max-width: 520px;
    line-height: 1.6;
}

.btn-cyber-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 36px;
    background: linear-gradient(135deg, var(--ck-blue-500) 0%, var(--ck-blue-400) 100%);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: none;
    border-radius: 50px;
    box-shadow: var(--ck-shadow-button), 0 2px 0 0 var(--ck-blue-700);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.btn-cyber-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-cyber-primary:hover::before {
    left: 100%;
}

.btn-cyber-primary:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 30px rgba(0, 102, 255, 0.45), 0 3px 0 0 var(--ck-blue-700);
}

.btn-cyber-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.3);
}

/* ==========================================================================
   STAGE 2: MINI-GAME "MÁY SOI KIM CƯƠNG" — Child-Friendly Theme
   ========================================================================== */

#stage-game {
    background: linear-gradient(180deg, #E8F4FD 0%, #D0E8FF 40%, #C3DDFF 100%);
    position: relative;
    overflow: hidden;
}

/* Floating Cloud Decorations */
#stage-game::before,
#stage-game::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    z-index: 1;
}

#stage-game::before {
    width: 200px;
    height: 80px;
    top: 8%;
    left: 5%;
    border-radius: 100px;
    animation: cloud-drift 20s ease-in-out infinite;
}

#stage-game::after {
    width: 160px;
    height: 60px;
    top: 15%;
    right: 8%;
    border-radius: 80px;
    animation: cloud-drift 25s ease-in-out infinite reverse;
}

@keyframes cloud-drift {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(30px); }
}

/* Background Cyber Grid — soft dotted version */
.cyber-grid {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle, rgba(0, 102, 255, 0.06) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 30%, transparent 75%);
    pointer-events: none;
    z-index: 1;
}

/* CyberKnight Logo — positioned left-center, large and prominent */
.character-logo-left {
    position: absolute;
    bottom: 5%;
    left: 1%;
    width: clamp(140px, 22vw, 320px);
    z-index: 5;
    pointer-events: none;
    filter: drop-shadow(0 8px 24px rgba(0, 102, 255, 0.18));
    animation: logo-float 5s ease-in-out infinite;
}

/* SigmaBloom brand logo — bottom-right subtle */
.brand-logo-right {
    position: absolute;
    bottom: 12%;
    right: 3%;
    width: clamp(40px, 5vw, 70px);
    z-index: 5;
    pointer-events: none;
    opacity: 0.5;
    filter: drop-shadow(0 4px 8px rgba(0, 102, 255, 0.1));
    animation: logo-float 6s ease-in-out infinite 1s;
}

@keyframes logo-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.03); }
}

/* Decorative gradient blobs — soft colorful depth */
.deco-blob {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.5;
    filter: blur(60px);
}

.deco-blob-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 102, 255, 0.12) 0%, transparent 70%);
    top: 5%;
    left: 8%;
    animation: blob-drift 15s ease-in-out infinite;
}

.deco-blob-2 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    bottom: 10%;
    right: 10%;
    animation: blob-drift 18s ease-in-out infinite reverse;
}

.deco-blob-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
    top: 40%;
    right: 20%;
    animation: blob-drift 12s ease-in-out infinite 3s;
}

@keyframes blob-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, -15px) scale(1.1); }
    66% { transform: translate(-15px, 10px) scale(0.95); }
}

/* Floating emoji shield decorations */
.deco-shield {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    font-size: clamp(20px, 3vw, 36px);
    opacity: 0.3;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.1));
}

.deco-shield-1 {
    top: 18%;
    left: 12%;
    animation: shield-float 8s ease-in-out infinite;
}

.deco-shield-2 {
    top: 25%;
    right: 15%;
    animation: shield-float 10s ease-in-out infinite 2s;
}

.deco-shield-3 {
    bottom: 30%;
    left: 8%;
    animation: shield-float 9s ease-in-out infinite 1s;
}

.deco-shield-4 {
    bottom: 25%;
    right: 8%;
    animation: shield-float 7s ease-in-out infinite 3s;
}

@keyframes shield-float {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.3; }
    25% { transform: translateY(-12px) rotate(10deg); opacity: 0.5; }
    50% { transform: translateY(-20px) rotate(-5deg); opacity: 0.35; }
    75% { transform: translateY(-8px) rotate(5deg); opacity: 0.45; }
}

/* Top Game Bar — Bright & Rounded */
.game-header {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 30;
    pointer-events: none;
}

.game-header > * {
    pointer-events: auto;
}

/* Exit button (top right) — matches CK theme */
.game-exit-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--ck-blue-300);
    border-radius: 50px;
    color: var(--ck-blue-600);
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--ck-shadow-soft);
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.game-exit-btn:hover {
    background: var(--ck-red);
    color: #fff;
    border-color: var(--ck-red);
    transform: scale(1.05);
}

/* Scan Progress Box — Bright Rounded Pill */
.scan-progress-box {
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid var(--ck-blue-200);
    border-radius: 50px;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 200px;
    backdrop-filter: blur(10px);
    box-shadow: var(--ck-shadow-card);
}

.scan-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ck-blue-600);
}

.scan-progress-bar-bg {
    width: 100%;
    height: 10px;
    background: var(--ck-blue-100);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.scan-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--ck-blue-400), var(--ck-sky));
    border-radius: 6px;
    transition: width 0.15s ease-out, background 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 102, 255, 0.3);
    position: relative;
}

.scan-progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent);
    border-radius: 6px 6px 0 0;
}

.scan-progress-bar-fill.danger {
    background: linear-gradient(90deg, var(--ck-red), var(--ck-pink));
    box-shadow: 0 0 12px rgba(255, 71, 87, 0.4);
}

/* Countdown Circular Timer — Cute CK Version */
.countdown-box {
    position: relative;
    width: 68px;
    height: 68px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    box-shadow: var(--ck-shadow-card);
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-svg {
    transform: rotate(-90deg);
    width: 68px;
    height: 68px;
    position: absolute;
}

.countdown-bg {
    fill: transparent;
    stroke: var(--ck-blue-100);
    stroke-width: 5;
}

.countdown-circle {
    fill: none;
    stroke: var(--ck-blue-400);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 201;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
    filter: drop-shadow(0 0 4px rgba(0, 102, 255, 0.3));
}

.countdown-circle.danger {
    stroke: var(--ck-red);
    filter: drop-shadow(0 0 6px rgba(255, 71, 87, 0.4));
}

.countdown-circle.paused {
    stroke: var(--ck-green);
    filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.4));
}

.countdown-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 20px;
    color: var(--ck-text-primary);
    z-index: 2;
}

/* ==========================================================================
   GIFT BOX CENTER ARENA — Cute CK Version
   ========================================================================== */

.game-arena {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

/* Floating sparkle particles container */
#particle-canvas {
    position: absolute;
    inset: -60px;
    width: calc(100% + 120px);
    height: calc(100% + 120px);
    pointer-events: none;
    z-index: 15;
}

/* Interactive Gift Card Container — Cute Cloud Card */
.gift-card-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    border-radius: 32px;
    padding: 12px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(208, 232, 255, 0.9) 100%);
    border: 3px solid var(--ck-blue-300);
    box-shadow: var(--ck-shadow-card), 0 0 0 6px rgba(0, 102, 255, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, border-color 0.4s ease, box-shadow 0.4s ease;
    animation: gift-float 3s ease-in-out infinite;
    cursor: default;
}

.gift-card-wrapper.danger {
    border-color: var(--ck-red);
    background: linear-gradient(145deg, rgba(255, 230, 230, 0.95) 0%, rgba(255, 200, 200, 0.9) 100%);
    box-shadow: var(--ck-shadow-glow-red), 0 0 0 6px rgba(255, 71, 87, 0.12);
    animation: gift-danger-wiggle 0.5s ease-in-out infinite;
}

@keyframes gift-float {
    0%, 100% {
        transform: scale(1) translateY(0);
        filter: drop-shadow(0 8px 20px rgba(0, 102, 255, 0.15));
    }
    50% {
        transform: scale(1.03) translateY(-8px);
        filter: drop-shadow(0 16px 30px rgba(0, 102, 255, 0.2));
    }
}

@keyframes gift-danger-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-2deg); }
    75% { transform: rotate(2deg); }
}

/* Shake animation when malware revealed */
.screen-shake {
    animation: shake 0.45s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-3px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
    40%, 60% { transform: translate3d(5px, 0, 0); }
}

/* Gift Card Inner Layer: Contains normal shiny gift */
.gift-inner-front {
    position: absolute;
    inset: 12px;
    border-radius: 24px;
    background: linear-gradient(135deg, #FFE082 0%, #FFD54F 40%, #FFC107 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    overflow: hidden;
    z-index: 10;
}

/* Sparkle overlay on gift front */
.gift-inner-front::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent 0%, rgba(255, 255, 255, 0.3) 10%, transparent 20%);
    animation: gift-sparkle-rotate 4s linear infinite;
    pointer-events: none;
}

@keyframes gift-sparkle-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Shiny Gift Icon SVG */
.gift-icon-svg {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.15));
    animation: gift-icon-bounce 2s ease-in-out infinite;
}

@keyframes gift-icon-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.gift-label-bait {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--ck-red), var(--ck-pink));
    padding: 6px 18px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
    animation: label-pulse 1.5s ease-in-out infinite;
}

@keyframes label-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Gift Card Hidden Layer: The sneaky malware underneath! */
.gift-inner-hidden {
    position: absolute;
    inset: 12px;
    border-radius: 24px;
    background: linear-gradient(135deg, #FFE0E0 0%, #FFC2C2 50%, #FFA8A8 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow: hidden;
    z-index: 5;
    border: 2px dashed var(--ck-red);
}

.virus-character {
    width: 110px;
    height: 110px;
    filter: drop-shadow(0 0 15px rgba(255, 71, 87, 0.5));
    animation: virus-wiggle 1.2s ease-in-out infinite;
}

@keyframes virus-wiggle {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-4px) rotate(-5deg); }
    75% { transform: translateY(4px) rotate(5deg); }
}

.virus-danger-tag {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--ck-red), #E53E3E);
    padding: 6px 16px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 16px rgba(255, 71, 87, 0.4);
    animation: danger-tag-pulse 1s ease-in-out infinite;
}

@keyframes danger-tag-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(255, 71, 87, 0.4); }
    50% { transform: scale(1.06); box-shadow: 0 6px 24px rgba(255, 71, 87, 0.6); }
}

/* Scratch / Spotlight Canvas */
#scratch-canvas {
    position: absolute;
    inset: 12px;
    width: calc(100% - 24px);
    height: calc(100% - 24px);
    border-radius: 24px;
    z-index: 12;
    cursor: none;
    pointer-events: none;
}

/* ==========================================================================
   ACTION BUTTON — Bright & Child-Friendly
   ========================================================================== */

.action-btn-container {
    margin-top: 24px;
    z-index: 30;
    width: 100%;
    display: flex;
    justify-content: center;
}

.btn-game-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 260px;
    padding: 16px 32px;
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

/* Red clickbait pulse state */
.btn-game-action.bait-state {
    background: linear-gradient(135deg, var(--ck-red) 0%, #E53E3E 100%);
    color: #ffffff;
    box-shadow: 0 6px 24px rgba(255, 71, 87, 0.4), 0 2px 0 0 #C53030;
    animation: bait-bounce 1.5s ease-in-out infinite;
}

@keyframes bait-bounce {
    0%, 100% {
        transform: scale(1) translateY(0);
    }
    50% {
        transform: scale(1.06) translateY(-4px);
        box-shadow: 0 10px 32px rgba(255, 71, 87, 0.5), 0 2px 0 0 #C53030;
    }
}

/* Green safe state after scanning */
.btn-game-action.safe-state {
    background: linear-gradient(135deg, var(--ck-green) 0%, #16A34A 100%);
    color: #ffffff;
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.4), 0 2px 0 0 #15803D;
    animation: safe-bounce 1.5s ease-in-out infinite;
}

@keyframes safe-bounce {
    0%, 100% {
        transform: scale(1) translateY(0);
    }
    50% {
        transform: scale(1.04) translateY(-3px);
    }
}

.btn-game-action:hover {
    transform: translateY(-3px) scale(1.05) !important;
}

.btn-game-action:active {
    transform: translateY(1px) scale(0.98) !important;
}

.btn-game-action.hidden {
    display: none !important;
}

/* ==========================================================================
   DUAL DECISION BUTTONS — Equal Weight, Child-Friendly
   ========================================================================== */

.dual-decision-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: 500px;
    animation: fadeInDualDecision 0.4s ease-out;
}

.dual-decision-container.hidden {
    display: none !important;
}

@keyframes fadeInDualDecision {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.btn-decision {
    flex: 1;
    min-height: 56px;
    padding: 14px 20px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

/* Red button (Nhận quà = Bad branch) */
.btn-decision-bad {
    background: linear-gradient(135deg, var(--ck-red) 0%, #E53E3E 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(255, 71, 87, 0.3), 0 2px 0 0 #C53030;
}

.btn-decision-bad:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 24px rgba(255, 71, 87, 0.45);
}

.btn-decision-bad:active {
    transform: translateY(1px) scale(0.98);
}

/* Green button (Không nhận = Good branch) */
.btn-decision-good {
    background: linear-gradient(135deg, var(--ck-green) 0%, #16A34A 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3), 0 2px 0 0 #15803D;
}

.btn-decision-good:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.45);
}

.btn-decision-good:active {
    transform: translateY(1px) scale(0.98);
}

/* ==========================================================================
   MAGNIFIER (Tool for kids to drag and scan) — Cute CK Version
   ========================================================================== */

#magnifier-tool {
    position: absolute;
    bottom: 30%;
    right: calc(50% - 300px);
    width: 90px;
    height: 90px;
    z-index: 40;
    cursor: grab;
    touch-action: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease-out;
}

#magnifier-tool.dragging {
    cursor: grabbing;
    z-index: 45;
}

.magnifier-body {
    position: relative;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.magnifier-lens-outer {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 4px solid var(--ck-blue-400);
    background: radial-gradient(circle at 35% 35%, rgba(0, 180, 255, 0.3) 0%, rgba(255, 255, 255, 0.5) 70%, transparent 100%);
    box-shadow: 0 4px 16px rgba(0, 102, 255, 0.3), inset 0 0 10px rgba(0, 180, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: magnifier-glow 2s ease-in-out infinite;
}

@keyframes magnifier-glow {
    0%, 100% { box-shadow: 0 4px 16px rgba(0, 102, 255, 0.3), inset 0 0 10px rgba(0, 180, 255, 0.3); }
    50% { box-shadow: 0 4px 24px rgba(0, 102, 255, 0.5), inset 0 0 15px rgba(0, 180, 255, 0.4); }
}

.magnifier-lens-outer::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 8px;
    width: 14px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    transform: rotate(-35deg);
}

.magnifier-handle {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 28px;
    height: 10px;
    background: linear-gradient(90deg, var(--ck-blue-500), var(--ck-blue-400));
    border: 2px solid #ffffff;
    border-radius: 6px;
    transform: rotate(45deg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.magnifier-hint-label {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 800;
    color: var(--ck-blue-600);
    background: rgba(255, 255, 255, 0.95);
    padding: 4px 10px;
    border-radius: 50px;
    border: 2px solid var(--ck-blue-200);
    white-space: nowrap;
    letter-spacing: 0.5px;
    pointer-events: none;
    box-shadow: var(--ck-shadow-soft);
    animation: hint-bounce 1.5s infinite;
}

@keyframes hint-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Light beam cone following the magnifier */
.scanner-light-beam {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 180, 255, 0.25) 0%, rgba(0, 180, 255, 0.05) 60%, transparent 100%);
    pointer-events: none;
    z-index: 18;
    transform: translate(-50%, -50%);
    display: none;
}

/* Hint speech bubble for kid guidance — cute cloud shape */
.hint-speech-bubble {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.96);
    color: var(--ck-text-primary);
    border: 2px solid var(--ck-blue-200);
    box-shadow: var(--ck-shadow-card);
    border-radius: 24px;
    padding: 14px 22px;
    max-width: 380px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.6;
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.hint-speech-bubble.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(-10px);
}

.hint-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 12px 10px 0 10px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}

/* ==========================================================================
   STAGE 4: SUMMARY & LESSON CARD — Child-Friendly CyberKnight Version
   ========================================================================== */

#stage-summary {
    background: linear-gradient(180deg, #E8F4FD 0%, #D0E8FF 50%, #C3DDFF 100%);
    padding: 24px;
    overflow-y: auto;
    position: relative;
}

/* Floating decoration shapes */
#stage-summary::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-image:
        radial-gradient(circle at 15% 25%, rgba(0, 102, 255, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 85% 75%, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 50% 10%, rgba(255, 215, 0, 0.05) 0%, transparent 40%);
    pointer-events: none;
}

.summary-card {
    width: 100%;
    max-width: 580px;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid var(--ck-blue-300);
    box-shadow: var(--ck-shadow-card);
    border-radius: 32px;
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 18px;
    backdrop-filter: blur(16px);
    position: relative;
    overflow: hidden;
    z-index: 10;
    animation: summary-enter 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes summary-enter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Decorative sparkle pattern on top */
.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--ck-blue-400), var(--ck-sky), var(--ck-purple), var(--ck-blue-400));
    background-size: 300% 100%;
    animation: gradient-slide 3s linear infinite;
}

@keyframes gradient-slide {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

.summary-card.good-branch {
    border-color: var(--ck-green);
    box-shadow: var(--ck-shadow-glow-green), var(--ck-shadow-card);
}

.summary-card.good-branch::before {
    background: linear-gradient(90deg, var(--ck-green), var(--ck-mint), var(--ck-sky), var(--ck-green));
    background-size: 300% 100%;
}

.summary-card.bad-branch {
    border-color: var(--ck-red);
    box-shadow: var(--ck-shadow-glow-red), var(--ck-shadow-card);
}

.summary-card.bad-branch::before {
    background: linear-gradient(90deg, var(--ck-red), var(--ck-orange), var(--ck-pink), var(--ck-red));
    background-size: 300% 100%;
}

.summary-icon-badge {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border: none;
    box-shadow: var(--ck-shadow-card);
    animation: icon-bounce 2s ease-in-out infinite;
}

@keyframes icon-bounce {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.1) translateY(-5px); }
}

.summary-card.good-branch .summary-icon-badge {
    background: linear-gradient(135deg, var(--ck-green-light), var(--ck-green));
}

.summary-card.bad-branch .summary-icon-badge {
    background: linear-gradient(135deg, var(--ck-red-light), var(--ck-red));
}

.summary-title {
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 800;
    line-height: 1.2;
    color: var(--ck-text-primary);
}

.summary-card.good-branch .summary-title {
    background: linear-gradient(135deg, var(--ck-green), var(--ck-mint));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.summary-card.bad-branch .summary-title {
    background: linear-gradient(135deg, var(--ck-red), var(--ck-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.summary-reward-box {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, var(--ck-blue-50), #F0F7FF);
    border: 2px solid var(--ck-blue-200);
    padding: 10px 24px;
    border-radius: 999px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
}

.summary-reward-xp {
    color: var(--ck-orange);
    display: flex;
    align-items: center;
    gap: 6px;
}

.summary-reward-badge {
    color: var(--ck-blue-500);
    display: flex;
    align-items: center;
    gap: 6px;
}

.lessons-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    margin: 4px 0;
}

.lesson-item {
    background: linear-gradient(135deg, var(--ck-blue-50), #F0F7FF);
    border-left: 4px solid var(--ck-blue-400);
    padding: 12px 16px;
    border-radius: 0 16px 16px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ck-text-primary);
    transition: transform 0.2s ease;
}

.lesson-item:hover {
    transform: translateX(4px);
}

.summary-card.good-branch .lesson-item {
    border-left-color: var(--ck-green);
    background: linear-gradient(135deg, #F0FFF4, #E8FFE8);
}

.summary-card.bad-branch .lesson-item {
    border-left-color: var(--ck-red);
    background: linear-gradient(135deg, #FFF0F0, #FFE8E8);
}

.summary-actions {
    display: flex;
    gap: 14px;
    width: 100%;
    margin-top: 8px;
}

.btn-summary-replay {
    flex: 1;
    padding: 14px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ck-text-primary);
    border: 2px solid var(--ck-blue-300);
    border-radius: 50px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--ck-shadow-soft);
    transition: all 0.2s ease;
}

.btn-summary-replay:hover {
    background: var(--ck-blue-50);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.15);
}

.btn-summary-continue {
    flex: 1.5;
    padding: 14px;
    background: linear-gradient(135deg, var(--ck-blue-500), var(--ck-blue-400));
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--ck-shadow-button), 0 2px 0 0 var(--ck-blue-700);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn-summary-continue::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.5s;
}

.btn-summary-continue:hover::before {
    left: 100%;
}

.btn-summary-continue:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 102, 255, 0.4), 0 2px 0 0 var(--ck-blue-700);
}

/* ==========================================================================
   FLOATING SPARKLES ANIMATION — Background decoration for all stages
   ========================================================================== */

.floating-sparkle {
    position: absolute;
    pointer-events: none;
    z-index: 2;
    animation: sparkle-float linear infinite;
}

.floating-sparkle.star {
    width: 16px;
    height: 16px;
    background: var(--ck-yellow);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    opacity: 0.6;
}

.floating-sparkle.circle {
    width: 10px;
    height: 10px;
    background: var(--ck-blue-300);
    border-radius: 50%;
    opacity: 0.5;
}

.floating-sparkle.diamond {
    width: 12px;
    height: 12px;
    background: var(--ck-sky);
    transform: rotate(45deg);
    opacity: 0.45;
}

@keyframes sparkle-float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN (Tablets & Phones >= 48px Touch Targets)
   ========================================================================== */

@media (max-width: 640px) {
    .game-arena {
        max-width: 320px;
        height: 380px;
    }

    .gift-card-wrapper {
        width: 240px;
        height: 240px;
    }

    .gift-icon-svg {
        width: 100px;
        height: 100px;
    }

    .virus-character {
        width: 90px;
        height: 90px;
    }

    .btn-game-action {
        min-width: 240px;
        padding: 14px 24px;
        font-size: 15px;
    }

    .dual-decision-container {
        gap: 10px;
        flex-direction: column;
        max-width: 320px;
    }

    .btn-decision {
        min-height: 50px;
        padding: 12px 16px;
        font-size: 13px;
        letter-spacing: 0.4px;
    }

    #magnifier-tool {
        bottom: 15px;
        right: 15px;
        width: 80px;
        height: 80px;
    }

    .summary-card {
        padding: 24px 20px;
        border-radius: 24px;
    }

    .summary-actions {
        flex-direction: column;
    }

    .character-logo-left,
    .brand-logo-right {
        display: none;
    }

    .scan-progress-box {
        min-width: 160px;
        padding: 8px 14px;
    }

    .countdown-box {
        width: 56px;
        height: 56px;
    }

    .countdown-svg {
        width: 56px;
        height: 56px;
    }

    .countdown-text {
        font-size: 16px;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .character-logo-left {
        width: clamp(80px, 14vw, 180px);
    }

    .brand-logo-right {
        width: clamp(35px, 4vw, 55px);
    }
}
