/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

/* Screen management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px 0;
    position: relative;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Welcome Screen */
.title {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    animation: fadeInUp 0.8s ease-out;
}

.subtitle {
    font-size: 1.4rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.description {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.8);
    max-width: 600px;
    margin: 0 auto 3rem;
    line-height: 1.7;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

/* Buttons */
.btn-primary, .btn-secondary {
    background: white;
    color: #667eea;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.btn-primary:hover, .btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
    margin-left: 1rem;
}

/* Game Screen */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: white;
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: -30px;
    right: 0;
    color: white;
    font-weight: 600;
}

.image-container {
    position: relative;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.assessment-image {
    max-width: 300px;
    max-height: 400px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    background: white;
    padding: 10px;
}

.assessment-image.swipe-left {
    animation: swipeLeft 0.5s ease-out forwards;
}

.assessment-image.swipe-right {
    animation: swipeRight 0.5s ease-out forwards;
}

.assessment-image.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.swipe-hint {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 300px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    pointer-events: none;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
}

.btn-choice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.btn-not-fat {
    background: #4CAF50;
    color: white;
}

.btn-not-fat:hover {
    background: #45a049;
    transform: translateX(-5px);
}

.btn-fat {
    background: #f44336;
    color: white;
}

.btn-fat:hover {
    background: #da190b;
    transform: translateX(5px);
}

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

.arrow {
    font-size: 1.2rem;
}

.instructions {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-top: 1rem;
}

.mobile-only {
    display: none;
}

/* Results Screen */
.results-grids {
    margin: 2rem 0;
}

.grid-section {
    margin-bottom: 3rem;
}

.grid-section h3 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    justify-items: center;
    margin-bottom: 2rem;
}

.grid-image {
    width: 120px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
    background: white;
    padding: 5px;
}

.grid-image:hover {
    transform: scale(1.05);
}

.grid-image.animate-in {
    animation: slideIn 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

/* Spectrum */
.spectrum-section {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    margin: 2rem 0;
}

.spectrum-section h3 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 2rem;
}

.spectrum-container {
    max-width: 500px;
    margin: 0 auto;
}

.spectrum-labels {
    display: flex;
    justify-content: space-between;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.spectrum-bar {
    height: 20px;
    background: linear-gradient(90deg, #4CAF50 0%, #FFC107 50%, #f44336 100%);
    border-radius: 10px;
    position: relative;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.spectrum-marker {
    position: absolute;
    top: -5px;
    width: 30px;
    height: 30px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    transition: left 1s ease-out;
    transform: translateX(-50%);
    left: 50%;
}

.spectrum-marker.animate {
    animation: bounceIn 0.8s ease-out;
}

/* Score display */
.score-display {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(5px);
    border-radius: 15px;
    padding: 1.5rem;
}

.score-item {
    text-align: center;
    color: white;
}

.score-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.score-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
}

.spectrum-description {
    color: white;
    font-size: 1.1rem;
    margin-top: 1rem;
}

.offline-message {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    margin-top: 0.5rem;
}

/* Share section */
.share-section {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.github-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.3);
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.github-link:hover {
    color: white;
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.1);
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-overlay p {
    color: white;
    font-size: 1.2rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes swipeLeft {
    to {
        transform: translateX(-100vw) rotate(-15deg);
        opacity: 0;
    }
}

@keyframes swipeRight {
    to {
        transform: translateX(100vw) rotate(15deg);
        opacity: 0;
    }
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        transform: translateX(-50%) scale(0);
    }
    50% {
        transform: translateX(-50%) scale(1.2);
    }
    100% {
        transform: translateX(-50%) scale(1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .description {
        font-size: 1rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .btn-choice {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    
    .assessment-image {
        max-width: 250px;
        max-height: 350px;
    }
    
    .mobile-only {
        display: block;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .grid-image {
        width: 100px;
        height: 125px;
    }
    
    .spectrum-section {
        padding: 1.5rem;
    }
    
    .spectrum-labels {
        font-size: 0.8rem;
        text-align: center;
        gap: 1rem;
    }
    
    .share-section {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    
    .share-section button {
        width: 100%;
        max-width: 280px;
    }
    
    .score-display {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .score-item {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.8rem;
    }
    
    .assessment-image {
        max-width: 200px;
        max-height: 300px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 12px 30px;
        font-size: 1rem;
    }
    
    .spectrum-section {
        padding: 1rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn-choice:hover {
        transform: none;
    }
    
    .btn-not-fat:hover {
        background: #4CAF50;
    }
    
    .btn-fat:hover {
        background: #f44336;
    }
    
    .assessment-image {
        cursor: grab;
    }
    
    .assessment-image:active {
        cursor: grabbing;
    }
}

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

/* Focus styles for accessibility */
button:focus,
.btn-choice:focus {
    outline: 3px solid rgba(255,255,255,0.8);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .spectrum-bar {
        border: 2px solid white;
    }
    
    .assessment-image {
        border: 2px solid white;
    }
}