:root {
    /* Color Theme */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-color: #2ed573;
    --warning-color: #ff6b47;
    --error-color: #ff4757;
    --success-color: #2ed573;
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-backdrop: blur(10px);
    
    /* Spacing - REDUCED for larger elements */
    --container-padding: 20px; /* Reduced from 30px */
    --border-radius: 20px;
    --small-radius: 10px;
    
    /* Animation Timing */
    --transition-fast: 0.3s ease;
    --transition-slow: 1.5s ease;
    
    /* Radar Dimensions - SIGNIFICANTLY ENLARGED */
    --radar-size: 280px; /* Increased from 220px */
    --radar-ring-1: 80px; /* Increased from 60px */
    --radar-ring-2: 160px; /* Increased from 120px */
    --radar-ring-3: 240px; /* Increased from 180px */
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 20px;
    background: var(--primary-gradient);
    min-height: 100vh;
    color: white;
    position: relative;
}

.container {
    max-width: 600px; /* Keep same max width but use space more efficiently */
    margin: 0 auto;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    border-radius: var(--border-radius);
    padding: var(--container-padding); /* Now 20px instead of 30px */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header {
    text-align: center;
    margin-bottom: 20px; /* Reduced from 35px */
    position: relative;
}

.header h1 {
    margin: 0;
    font-size: 28px; /* Keep same font size */
    font-weight: 600;
    margin-bottom: 20px; /* Reduced from 25px */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.header h1 .material-symbols-outlined {
    font-size: 32px;
    color: var(--error-color);
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 32;
}

.maps-button {
    position: absolute;
    top: -15px;
    right: -20px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: var(--glass-backdrop);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.maps-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.maps-button:active {
    transform: translateY(0);
}

.maps-button:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.direction-indicator {
    position: relative;
    width: var(--radar-size); /* Now 280px */
    height: var(--radar-size); /* Now 280px */
    margin: 0 auto 20px auto; /* Reduced from 25px */
    background: radial-gradient(circle, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-radius: 50%;
    border: 3px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.radar-rings {
    position: absolute;
    width: 100%;
    height: 100%;
}

.radar-ring {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: radarPulse 3s ease-in-out infinite;
}

.ring-1 { 
    width: var(--radar-ring-1); /* Now 80px */
    height: var(--radar-ring-1); /* Now 80px */
    animation-delay: 0s;
}
.ring-2 { 
    width: var(--radar-ring-2); /* Now 160px */
    height: var(--radar-ring-2); /* Now 160px */
    animation-delay: 0.5s;
}
.ring-3 { 
    width: var(--radar-ring-3); /* Now 240px */
    height: var(--radar-ring-3); /* Now 240px */
    animation-delay: 1s;
}

@keyframes radarPulse {
    0% { 
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: 0 0 0 rgba(255, 255, 255, 0);
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% { 
        border-color: rgba(255, 255, 255, 0.6);
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0;
    }
}

.phone-indicator {
    position: absolute;
    width: 24px; /* Slightly increased from 20px */
    height: 36px; /* Slightly increased from 30px */
    background: var(--accent-color);
    border-radius: 5px; /* Slightly increased from 4px */
    border: 2px solid white;
    z-index: 4;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 18px rgba(46, 213, 115, 0.7); /* Slightly increased glow */
    will-change: transform;
}

.phone-indicator::before {
    content: '';
    position: absolute;
    top: -10px; /* Adjusted for larger phone */
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent; /* Slightly increased from 6.06px */
    border-right: 7px solid transparent;
    border-bottom: 10px solid var(--accent-color); /* Slightly increased from 8.08px */
}

.target-dot {
    position: absolute;
    width: 20px; /* Slightly increased from 16px */
    height: 20px; /* Slightly increased from 16px */
    background: var(--error-color);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 24px rgba(255, 71, 87, 0.8); /* Increased glow */
    z-index: 3;
    transition: var(--transition-fast);
    will-change: transform, left, top;
}

.target-dot.close {
    animation: targetPulse 1s infinite;
}

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

.instruction-text {
    position: absolute;
    bottom: -45px; /* Adjusted for larger radar */
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 18px; /* Increased from 16px */
    font-weight: 600;
    white-space: nowrap;
}

.aligned {
    color: var(--success-color);
}

.misaligned {
    color: var(--warning-color);
}

.image-container {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px; /* Reduced from 25px */
    text-align: center;
    position: relative;
    overflow: visible;
}

.location-image {
    width: 100%;
    max-width: 560px; /* Increased from 550px to use available space */
    height: 340px; /* Increased from 280px */
    object-fit: cover;
    object-position: center center; 
    border-radius: var(--small-radius);
    border: 2px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: opacity var(--transition-slow);
    position: relative;
    will-change: transform, opacity, filter;
}

.image-flip {
    animation: magicalFlip 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
    opacity: 1.0 !important;
    filter: none !important;
}

.image-shake {
    animation: angryShake 2s ease-in-out;
    filter: grayscale(100%) !important;
    opacity: 1.0 !important;
}

@keyframes magicalFlip {
    0% { transform: rotateX(0deg); }
    40% { transform: rotateX(1300deg); }
    70% { transform: rotateX(1800deg); }
    85% { transform: rotateX(2070deg); }
    95% { transform: rotateX(2160deg); }
    100% { transform: rotateX(2160deg); }
}

@keyframes angryShake {
    0%, 100% { transform: translateX(0); }
    5% { transform: translateX(-15px) rotate(-2deg); }
    10% { transform: translateX(15px) rotate(2deg); }
    15% { transform: translateX(-12px) rotate(-1.5deg); }
    20% { transform: translateX(12px) rotate(1.5deg); }
    25% { transform: translateX(-15px) rotate(-2deg); }
    30% { transform: translateX(15px) rotate(2deg); }
    35% { transform: translateX(-12px) rotate(-1.5deg); }
    40% { transform: translateX(12px) rotate(1.5deg); }
    45% { transform: translateX(-15px) rotate(-2deg); }
    50% { transform: translateX(15px) rotate(2deg); }
    55% { transform: translateX(-12px) rotate(-1.5deg); }
    60% { transform: translateX(12px) rotate(1.5deg); }
    65% { transform: translateX(-10px) rotate(-1deg); }
    70% { transform: translateX(10px) rotate(1deg); }
    75% { transform: translateX(-8px) rotate(-0.5deg); }
    80% { transform: translateX(8px) rotate(0.5deg); }
    85% { transform: translateX(-6px) rotate(-0.5deg); }
    90% { transform: translateX(6px) rotate(0.5deg); }
    95% { transform: translateX(-3px); }
}

.sparkle-overlay {
    position: absolute;
    top: -50px; /* Increased from -40px for larger image */
    left: -50px;
    right: -50px;
    bottom: -50px;
    pointer-events: none;
    overflow: visible;
}

.sparkle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    will-change: transform, opacity;
}

.sparkle-type-1, .sparkle-type-2, .sparkle-type-3, .sparkle-type-4, .sparkle-type-5, .sparkle-type-6 {
    border-radius: 50%;
}

.sparkle-type-1 {
    width: 12px; height: 12px;
    background: conic-gradient(from 0deg, #ffd700, #ffed4e, #ffc107, #fff700, #ffd700);
    box-shadow: 0 0 8px #ffd700;
    animation: sparkleType1 1.9s ease-out forwards;
}

.sparkle-type-2 {
    width: 8px; height: 8px;
    background: conic-gradient(from 45deg, #87ceeb, #add8e6, #00bfff, #87cefa, #87ceeb);
    box-shadow: 0 0 6px #87ceeb;
    animation: sparkleType2 2.25s ease-out forwards;
}

.sparkle-type-3 {
    width: 14px; height: 14px;
    background: conic-gradient(from 90deg, #dda0dd, #da70d6, #ba55d3, #9370db, #dda0dd);
    box-shadow: 0 0 10px #dda0dd;
    animation: sparkleType3 1.65s ease-out forwards;
}

.sparkle-type-4 {
    width: 6px; height: 6px;
    background: conic-gradient(from 180deg, #98fb98, #90ee90, #00ff7f, #32cd32, #98fb98);
    box-shadow: 0 0 5px #98fb98;
    animation: sparkleType4 2.1s ease-out forwards;
}

.sparkle-type-5 {
    width: 16px; height: 16px;
    background: conic-gradient(from 270deg, #ffa07a, #ff6347, #ff4500, #coral, #ffa07a);
    box-shadow: 0 0 12px #ffa07a;
    animation: sparkleType5 1.725s ease-out forwards;
}

.sparkle-type-6 {
    width: 18px; height: 18px;
    background: conic-gradient(from 315deg, #ff69b4, #00bfff, #32cd32, #ffd700, #ff1493, #00ffff, #ff69b4);
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.8);
    animation: sparkleType6 1.2s ease-out forwards;
}

@keyframes sparkleType1 {
    0% { opacity: 1; transform: scale(0) rotate(0deg) translateY(0); }
    25% { opacity: 1; transform: scale(2) rotate(180deg) translateY(-8px); }
    60% { opacity: 0.8; transform: scale(1.2) rotate(360deg) translateY(-18px); }
    100% { opacity: 0; transform: scale(0) rotate(720deg) translateY(-30px); }
}

@keyframes sparkleType2 {
    0% { opacity: 1; transform: scale(0) rotate(0deg) translateX(0); }
    30% { opacity: 1; transform: scale(1.8) rotate(270deg) translateX(12px); }
    70% { opacity: 0.6; transform: scale(1) rotate(540deg) translateX(22px); }
    100% { opacity: 0; transform: scale(0) rotate(810deg) translateX(35px); }
}

@keyframes sparkleType3 {
    0% { opacity: 1; transform: scale(0) rotate(0deg); }
    20% { opacity: 1; transform: scale(2.2) rotate(144deg); }
    45% { opacity: 0.9; transform: scale(1.5) rotate(288deg); }
    75% { opacity: 0.5; transform: scale(0.8) rotate(432deg); }
    100% { opacity: 0; transform: scale(0) rotate(576deg); }
}

@keyframes sparkleType4 {
    0% { opacity: 1; transform: scale(0) rotate(0deg) translateY(0) translateX(0); }
    25% { opacity: 1; transform: scale(1.5) rotate(120deg) translateY(-6px) translateX(6px); }
    55% { opacity: 0.7; transform: scale(2) rotate(240deg) translateY(-14px) translateX(14px); }
    100% { opacity: 0; transform: scale(0) rotate(480deg) translateY(-25px) translateX(25px); }
}

@keyframes sparkleType5 {
    0% { opacity: 1; transform: scale(0) rotate(0deg) translateY(0) translateX(0); }
    30% { opacity: 1; transform: scale(1.8) rotate(216deg) translateY(-10px) translateX(-10px); }
    65% { opacity: 0.7; transform: scale(1.2) rotate(432deg) translateY(-20px) translateX(-20px); }
    100% { opacity: 0; transform: scale(0) rotate(648deg) translateY(-32px) translateX(-32px); }
}

@keyframes sparkleType6 {
    0% { opacity: 1; transform: scale(0) rotate(0deg); }
    15% { opacity: 1; transform: scale(2.5) rotate(216deg); }
    35% { opacity: 0.9; transform: scale(2) rotate(432deg); }
    55% { opacity: 0.8; transform: scale(2.2) rotate(648deg); }
    75% { opacity: 0.6; transform: scale(1.5) rotate(864deg); }
    100% { opacity: 0; transform: scale(0) rotate(1440deg); }
}

.status {
    text-align: center;
    padding: 18px;
    border-radius: var(--small-radius);
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 20px; /* Reduced from 25px */
    transition: var(--transition-fast);
}

.status.loading {
    background: rgba(255, 193, 7, 0.3);
    border: 2px solid rgba(255, 193, 7, 0.6);
}

.status.active {
    background: rgba(40, 167, 69, 0.3);
    border: 2px solid rgba(40, 167, 69, 0.6);
}

.status.wrong-direction {
    background: rgba(220, 53, 69, 0.3);
    border: 2px solid rgba(220, 53, 69, 0.6);
    animation: wrongDirectionFlash 2s ease-in-out infinite;
}

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

.controls {
    text-align: center;
}

.btn {
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    color: white;
    padding: 16px 32px; /* Slightly increased from 15px 30px */
    border-radius: 25px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    margin: 8px;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.accuracy-indicator {
    text-align: center;
    margin-top: 20px;
    font-size: 16px;
    opacity: 0.8;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.location-flash {
    animation: locationFlash 0.8s infinite;
}

@keyframes locationFlash {
    0% { background: var(--primary-gradient); }
    50% { background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%); }
    100% { background: var(--primary-gradient); }
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    border-radius: var(--border-radius);
    border: 2px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 400px;
    color: white;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 20px 20px 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.close-btn:hover {
    opacity: 1;
}

.modal-body {
    padding: 20px;
}

.modal-body label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

.modal-body input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--glass-border);
    border-radius: var(--small-radius);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
}

.modal-body input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.15);
}

.modal-body input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.coordinate-help {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}

.modal-footer {
    padding: 0 20px 20px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: #26c566;
    border-color: #26c566;
}

/* Confetti Effect */
.confetti-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 1;
}

.confetti-rect {
    background: #ffd700;
    border-radius: 2px;
    animation: confettiFall 4s linear forwards;
}

.confetti-circle {
    border-radius: 50%;
    background: #ff6b47;
    animation: confettiFall 4s linear forwards;
}

.confetti-triangle {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid #2ed573;
    background: transparent;
    animation: confettiFall 4s linear forwards;
}

.confetti-square {
    background: #87ceeb;
    border-radius: 1px;
    animation: confettiFall 4s linear forwards;
}

.confetti-diamond {
    background: #ff69b4;
    transform: rotate(45deg);
    animation: confettiFall 4s linear forwards;
}

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