:root {
    --primary-blue: #4a90e2;
    --secondary-yellow: #ffc107;
    --success-green: #2ecc71;
    --light-gray: #f5f5f5;
    --dark-gray: #333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-gray);
    color: var(--dark-gray);
}

/* Top Bar */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.counter {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-blue);
}

/* Game Container */
.game-container {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    justify-content: center;
    max-width: 1600px;
    margin: 0 auto;
}

.image-wrapper {
    position: relative;
    flex: 1;
    max-width: 50%;
    cursor: crosshair;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.image-wrapper img {
    display: block;
    width: 100%;
    height: auto;
}

/* Found Difference Circle (SVG-based) */
.hitzone-overlay .found-circle {
    fill: none !important;
    stroke: #2ecc71 !important;
    stroke-width: 1 !important;
    pointer-events: none !important;
    opacity: 1 !important;
    animation: popCircle 0.3s ease-out;
}

@keyframes popCircle {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}
@keyframes svgPopIn {
    0% {
        r: 0;
        opacity: 1;
    }
    50% {
        r: 8.5;
    }
    100% {
        r: 7;
        opacity: 1;
    }
}

@keyframes svgBounce {
    0%, 100% {
        stroke-width: 0.6;
    }
    50% {
        stroke-width: 0.8;
    }
}

/* Win Modal */
.win-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.win-modal.show {
    display: flex;
}

#confettiCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.win-content {
    position: relative;
    z-index: 1001;
    background-color: white;
    padding: 3rem 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s ease-out;
}

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

.win-emoji {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.win-content h1 {
    font-size: 2.5rem;
    color: var(--success-green);
    margin-bottom: 0.5rem;
}

.win-content p {
    font-size: 1.2rem;
    color: var(--dark-gray);
    margin-bottom: 1.5rem;
}

.restart-btn {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    background-color: var(--success-green);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.restart-btn:hover {
    background-color: #27ae60;
}

/* SVG Hitzone Overlay */
.hitzone-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.hitzone-overlay .hitzone-circle {
    fill: transparent;
    stroke: none;
    pointer-events: all;
    cursor: pointer;
    transition: fill 0.1s ease-out;
}

.hitzone-overlay circle:hover {
    fill: rgba(46, 204, 113, 0.1);
}

/* Debug Mode: Show hitzone circles */
body.debug .hitzone-overlay circle {
    stroke: var(--success-green);
    stroke-width: 0.5;
    fill: rgba(46, 204, 113, 0.15);
    opacity: 0.8;
}

body.debug .hitzone-overlay circle:hover {
    fill: rgba(46, 204, 113, 0.3);
    stroke-width: 1;
}


/* Responsive Design */
@media (max-width: 768px) {
  .game-container {
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem;
    align-items: center;
  }

  .image-wrapper {
    width: 100%;
    max-width: 100%;
    max-height: none;
  }

  .image-wrapper img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
  }

  .top-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: nowrap;
    width: 100%;
  }

  .counter {
    font-size: 0.9rem;
    text-align: center;
    flex: 1;
  }

  .debug-btn {
    width: auto;
    flex-shrink: 0;
  }

  .home-btn {
    flex-shrink: 0;
  }

  .win-content {
    padding: 2rem 1rem;
  }

  .win-emoji {
    font-size: 3rem;
  }

  .win-content h1 {
    font-size: 2rem;
  }

  .win-content p {
    font-size: 1rem;
  }
}

/* Shake animation for misses */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s;
}
.click-marker {
    fill: red;
    stroke: white;
    stroke-width: 0.4;
    pointer-events: none;
}

/* Lives Display */
.lives-display {
    font-size: 1.4rem;
    letter-spacing: 3px;
    user-select: none;
}

/* Game Over Modal — red theme via override */
.game-over-modal .win-content h1 {
    color: #e74c3c;
}

.game-over-modal .retry-btn {
    background-color: #e74c3c;
}

.game-over-modal .retry-btn:hover {
    background-color: #c0392b;
}

/* Heart loss flash */
@keyframes heartLost {
    0% { transform: scale(1); }
    30% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.lives-display.lost {
    animation: heartLost 0.3s ease-out;
}