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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.container {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
}

#right-sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 20px;
}

header {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    text-align: center;
}

h1 {
    font-size: 1.8em;
    color: #ff6b6b;
    margin-bottom: 10px;
}

.score {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}

.progress-section {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.distance-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 600;
}

.distance-info p {
    font-size: 1.1em;
}

.progress-bar {
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    transition: width 0.3s ease;
    width: 0;
}

.history-section {
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-height: 400px;
    overflow-y: auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-section h3 {
    font-size: 1em;
    color: #667eea;
    margin: 0;
}

.history-stats {
    font-size: 0.85em;
    color: #11998e;
    font-weight: 600;
    margin: 0;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-empty {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f8f9fa;
    font-size: 0.85em;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.history-item .icon {
    font-size: 1.2em;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.history-item.correct {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.1) 0%, rgba(56, 239, 125, 0.1) 100%);
    border-left: 4px solid #11998e;
}

.history-item.wrong {
    background: linear-gradient(135deg, rgba(235, 51, 73, 0.1) 0%, rgba(244, 92, 67, 0.1) 100%);
    border-left: 4px solid #eb3349;
}

.history-item .question-text {
    flex: 1;
    line-height: 1.4;
}

.reset-btn {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(235, 51, 73, 0.3);
}

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

#quiz-container {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-height: 400px;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.5s;
}

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

#waiting-screen {
    text-align: center;
    padding: 40px 20px;
}

#waiting-screen h2 {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 20px;
}

#waiting-screen p {
    font-size: 1.2em;
    margin-bottom: 15px;
    line-height: 1.6;
}

.highlight {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 1.1em;
}

.waiting-progress-container {
    margin: 30px auto;
    max-width: 400px;
}

.waiting-progress-bar {
    height: 30px;
    background: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.waiting-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    width: 0;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.waiting-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.waiting-km {
    margin-top: 10px;
    font-size: 1.1em;
    font-weight: 600;
    color: #667eea;
}

.small {
    font-size: 0.9em;
    color: #999;
}

.question-card h2 {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 30px;
    line-height: 1.4;
}

.answers {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    font-weight: 500;
}

.answer-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.answer-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.answer-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.answer-btn.correct {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    animation: pulse 0.5s;
}

.answer-btn.wrong {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    animation: shake 0.5s;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

#result-screen {
    text-align: center;
    padding: 20px;
}

#result-title {
    font-size: 2.5em;
    margin-bottom: 15px;
    color: #667eea;
}

.result-question {
    font-size: 0.95em;
    color: #999;
    font-style: italic;
    margin-bottom: 15px;
    line-height: 1.4;
}

#result-text {
    font-size: 1.2em;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #666;
}

.btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 1.2em;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.btn:active {
    transform: translateY(-1px);
}

#final-screen {
    text-align: center;
    padding: 20px;
}

#final-screen h2 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 20px;
}

.big-score {
    font-size: 3em;
    font-weight: bold;
    color: #ff6b6b;
    margin: 30px 0;
}

#final-message {
    font-size: 1.3em;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #666;
}

.debug-info {
    margin-top: 20px;
    text-align: center;
    color: white;
    opacity: 0.8;
}

.spoof-controls {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

#spoof-input {
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.9em;
    width: 200px;
}

#spoof-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

#spoof-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 107, 107, 0.8);
    color: white;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

#spoof-btn:hover {
    background: rgba(255, 107, 107, 1);
}

#move-sw-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: rgba(102, 126, 234, 0.8);
    color: white;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

#move-sw-btn:hover {
    background: rgba(102, 126, 234, 1);
}

/* Car marker */
.car-marker {
    background: transparent !important;
    border: none !important;
}

/* Minimap */
#minimap {
    width: 100%;
    height: 200px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#minimap .leaflet-control-attribution {
    font-size: 8px;
}

.gps-status-below-map {
    display: block;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    color: #666;
    font-size: 0.85em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Weather Widget */
.weather-widget {
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.weather-widget h3 {
    font-size: 1em;
    color: #667eea;
    margin-bottom: 12px;
}

.weather-current {
    margin-bottom: 15px;
}

.weather-current .loading {
    color: #999;
    font-style: italic;
    font-size: 0.9em;
}

.weather-now {
    display: flex;
    align-items: center;
    gap: 12px;
}

.weather-now .temp {
    font-size: 2em;
    font-weight: bold;
    color: #333;
}

.weather-now .icon {
    font-size: 2.5em;
}

.weather-now .desc {
    font-size: 0.9em;
    color: #666;
}

.weather-forecast {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid #eee;
    padding-top: 12px;
}

.forecast-day {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85em;
    padding: 6px 0;
}

.forecast-day .day {
    font-weight: 600;
    color: #333;
    flex: 1;
}

.forecast-day .icon {
    font-size: 1.2em;
    width: 30px;
    text-align: center;
}

.forecast-day .temp {
    color: #666;
    font-weight: 500;
}

/* Mobile optimizations */
@media (max-width: 1024px) {
    body {
        flex-direction: column;
    }

    #right-sidebar {
        width: 100%;
        position: static;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 1.5em;
    }

    .distance-info {
        flex-direction: column;
        gap: 10px;
    }

    #quiz-container {
        padding: 20px;
    }

    .answer-btn {
        padding: 15px;
        font-size: 1em;
    }

    .spoof-controls {
        flex-direction: column;
    }

    #spoof-input {
        width: 100%;
        max-width: 250px;
    }
}

/* Landscape mode */
@media (orientation: landscape) and (max-height: 500px) {
    #quiz-container {
        min-height: auto;
    }

    #waiting-screen {
        padding: 20px 10px;
    }

    .answers {
        gap: 10px;
    }
}
