body {
    margin: 0;
    overflow: hidden;
    font-family: 'Arial', sans-serif;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* AR.js Loader */
.arjs-loader {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.arjs-loader div {
    text-align: center;
    font-size: 1.25em;
    color: white;
}

#hitZone{
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px dashed rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.08);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.25);
  pointer-events: none;       /* ważne: overlay nie blokuje tapnięć */
  z-index: 9999;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease, background .12s ease, opacity .12s ease;
  opacity: 0.85;
}

/* gdy celujesz w coś klikalnego */
#hitZone.active{
  border-color: rgba(0,255,0,0.95);
  background: rgba(0,255,0,0.12);
  box-shadow: 0 0 18px rgba(0,255,0,0.35), 0 0 0 2px rgba(0,0,0,0.25);
  transform: translate(-50%, -50%) scale(1.05);
}

/* gdy gra blokuje input */
#hitZone.disabled{
  opacity: 0.35;
  /* filter: grayscale(0.2); */
}


#ui {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    transition: opacity 0.3s ease;
}

.toggle-ui-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 2000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid white;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

.toggle-ui-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.toggle-ui-btn:active {
    transform: scale(0.95);
}

.ui-hidden {
    opacity: 0;
    pointer-events: none;
}

#level {
    font-size: 28px;
    font-weight: bold;
    background: rgba(138, 43, 226, 0.8);
    padding: 10px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
}

#score {
    font-size: 28px;
    font-weight: bold;
    background: rgba(0, 128, 0, 0.8);
    padding: 10px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
}

#status {
    font-size: 22px;
    background: rgba(255, 165, 0, 0.8);
    padding: 10px 20px;
    border-radius: 10px;
    animation: pulse 1.5s ease-in-out infinite;
}

#gesture-status {
    font-size: 20px;
    font-weight: bold;
    background: rgba(0, 191, 255, 0.8);
    padding: 8px 16px;
    border-radius: 10px;
    margin-bottom: 10px;
    animation: glow 2s ease-in-out infinite;
}

#combo {
    font-size: 24px;
    font-weight: bold;
    background: rgba(255, 140, 0, 0.8);
    padding: 10px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

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

@keyframes glow {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(0, 191, 255, 0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 25px rgba(0, 191, 255, 0.9), 0 0 10px rgba(255, 255, 255, 0.5);
        transform: scale(1.02);
    }
}

#gesture-legend {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.85);
    padding: 15px 20px;
    border-radius: 12px;
    z-index: 1000;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.gesture-title {
    color: #FFD700;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 12px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.gesture-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-size: 16px;
}

.gesture-icon {
    font-size: 24px;
    margin-right: 8px;
    width: 30px;
    text-align: center;
}

.gesture-arrow {
    color: white;
    margin: 0 8px;
    font-weight: bold;
}

.gesture-color {
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.gesture-color.sound1 {
    color: #FFD700;
}

.gesture-color.sound2 {
    color: #FF69B4;
}

.gesture-info {
    color: #AAAAAA;
    font-size: 12px;
    text-align: center;
    margin-top: 8px;
    font-style: italic;
}

#gesture-challenge {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 40px 60px;
    border-radius: 20px;
    z-index: 3000;
    border: 4px solid #FFD700;
    text-align: center;
    animation: challengePulse 0.5s ease-in-out;
}

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

.challenge-title {
    color: #FFD700;
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.gesture-prompt {
    font-size: 120px;
    margin: 20px 0;
    animation: gestureFloat 1s ease-in-out infinite;
}

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

.challenge-timer {
    color: #FF4444;
    font-size: 48px;
    font-weight: bold;
    margin-top: 20px;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.8);
}

#gesture-success {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4000;
    text-align: center;
    animation: successPop 0.5s ease-out;
}

@keyframes successPop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.success-emoji {
    font-size: 180px;
    animation: successSpin 0.8s ease-in-out;
    filter: drop-shadow(0 0 20px rgba(50, 255, 50, 0.8));
}

@keyframes successSpin {
    0% { transform: rotate(0deg) scale(0); }
    60% { transform: rotate(360deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

.success-text {
    color: #00FF00;
    font-size: 64px;
    font-weight: bold;
    margin-top: 20px;
    text-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
    animation: successPulse 0.5s ease-in-out infinite alternate;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.success-sparkles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
}

.sparkle {
    position: absolute;
    font-size: 40px;
    animation: sparkleFloat 1.5s ease-in-out infinite;
}

.sparkle:nth-child(1) {
    top: 0;
    left: 50%;
    animation-delay: 0s;
}

.sparkle:nth-child(2) {
    top: 50%;
    right: 0;
    animation-delay: 0.2s;
}

.sparkle:nth-child(3) {
    bottom: 0;
    left: 50%;
    animation-delay: 0.4s;
}

.sparkle:nth-child(4) {
    top: 50%;
    left: 0;
    animation-delay: 0.6s;
}

@keyframes sparkleFloat {
    0%, 100% { transform: translateY(0px) scale(1); opacity: 1; }
    50% { transform: translateY(-20px) scale(1.3); opacity: 0.7; }
}

#gesture-fail {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4000;
    text-align: center;
    animation: failShake 0.5s ease-out;
}

@keyframes failShake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-50%, -50%) rotate(-5deg); }
    75% { transform: translate(-50%, -50%) rotate(5deg); }
}

.fail-emoji {
    font-size: 180px;
    animation: failDrop 0.6s ease-out;
    filter: drop-shadow(0 0 20px rgba(255, 50, 50, 0.8));
}

@keyframes failDrop {
    0% { transform: translateY(-100px) scale(0); opacity: 0; }
    60% { transform: translateY(10px) scale(1.1); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.fail-text {
    color: #FF4444;
    font-size: 64px;
    font-weight: bold;
    margin-top: 20px;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.8);
    animation: failPulse 0.3s ease-in-out 3;
}

@keyframes failPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.9); opacity: 0.7; }
}

#gameOver {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 40px 60px;
    border-radius: 20px;
    text-align: center;
    z-index: 2000;
    border: 3px solid #FFD700;
}

#gameOver h1 {
    color: #FFD700;
    font-size: 48px;
    margin: 0 0 20px 0;
    text-shadow: 2px 2px 8px rgba(255, 215, 0, 0.5);
}

#gameOver p {
    color: white;
    font-size: 24px;
    margin: 15px 0;
}

#restartBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 22px;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

#restartBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
}

#instructions {
    position: fixed;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 1000;
    text-align: center;
}

#controls {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 1000;
}

.color-btn {
    width: 100px;
    height: 80px;
    border: 3px solid white;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.color-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.color-btn:active::before {
    width: 300px;
    height: 300px;
}

.color-btn:active {
    transform: scale(0.92);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.color-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    /* filter: grayscale(0.3); */
}

.red-btn {
    background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
}

.green-btn {
    background: linear-gradient(135deg, #00FF00 0%, #00CC00 100%);
}

.blue-btn {
    background: linear-gradient(135deg, #0000FF 0%, #0000CC 100%);
}

.color-btn.flash {
    transform: scale(1.2) rotate(5deg);
    filter: brightness(1.8) drop-shadow(0 0 20px currentColor);
    box-shadow: 0 0 30px currentColor, 0 0 60px currentColor;
    animation: flashPulse 0.3s ease-in-out;
}

@keyframes flashPulse {
    0%, 100% { transform: scale(1.2) rotate(5deg); }
    50% { transform: scale(1.25) rotate(-5deg); }
}

#gesture-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Enhanced animations for AR elements */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes rotate3d {
    0% { transform: rotate3d(0, 1, 0, 0deg); }
    100% { transform: rotate3d(0, 1, 0, 360deg); }
}

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

/* Victory celebration overlay */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #FFD700;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Media query dla telefonów */
@media (max-width: 768px) {
    #level {
        font-size: 18px;
        padding: 6px 12px;
    }

    #score {
        font-size: 18px;
        padding: 6px 12px;
    }

    #status {
        font-size: 16px;
        padding: 6px 12px;
    }

    #gesture-status {
        font-size: 14px;
        padding: 5px 10px;
    }

    #combo {
        font-size: 16px;
        padding: 6px 12px;
    }

    #gesture-legend {
        padding: 10px 12px;
        max-width: 180px;
    }

    .gesture-title {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .gesture-item {
        font-size: 12px;
        margin: 5px 0;
    }

    .gesture-icon {
        font-size: 18px;
        width: 20px;
        margin-right: 5px;
    }

    .gesture-info {
        font-size: 10px;
    }

    #gesture-challenge {
        padding: 20px 30px;
    }

    .challenge-title {
        font-size: 24px;
    }

    .gesture-prompt {
        font-size: 80px;
    }

    .challenge-timer {
        font-size: 32px;
    }

    .success-emoji,
    .fail-emoji {
        font-size: 100px;
    }

    .success-text,
    .fail-text {
        font-size: 36px;
    }

    #gameOver {
        padding: 20px 30px;
        max-width: 90%;
    }

    #gameOver h1 {
        font-size: 32px;
    }

    #gameOver p {
        font-size: 18px;
    }

    #restartBtn {
        padding: 12px 30px;
        font-size: 18px;
    }

    #instructions {
        font-size: 12px;
        padding: 10px;
    }

    #controls {
        bottom: 60px;
        gap: 10px;
    }

    .color-btn {
        width: 70px;
        height: 60px;
        font-size: 12px;
    }
}

/* Fix for mobile AR rendering - ensure no color filters */
a-scene {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

a-scene canvas {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

video {
    filter: none !important;
    -webkit-filter: none !important;
    transform: none !important;
}

/* Ensure AR camera feed is not affected by any filters or overlays */
.a-canvas, canvas {
    filter: none !important;
    -webkit-filter: none !important;
    opacity: 1 !important;
}

/* Force video to full brightness */
video[data-aframe-video] {
    filter: brightness(1.0) contrast(1.0) !important;
    -webkit-filter: brightness(1.0) contrast(1.0) !important;
}
