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

/* Custom Fonts */
@font-face {
    font-family: 'Montserrat';
    src: url('fonts/Montserrat-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Montserrat';
    src: url('fonts/Montserrat-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Montserrat';
    src: url('fonts/Montserrat-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'Marine';
    src: url('fonts/Marine-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Marine';
    src: url('fonts/Marine-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

:root {
    --primary-color: #CC0000;
    --secondary-color: #CC0000;
    --danger-color: #CC0000;
    --warning-color: #F39C12;
    --dark-bg: #1a1a1a;
    --light-bg: rgba(236, 240, 241, 0.1);
    --text-dark: #2C3E50;
    --text-light: #FFFFFF;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Montserrat', sans-serif;
    background: url('https://firebasestorage.googleapis.com/v0/b/tieyoung-e964a.appspot.com/o/Iron%20Biotics%20Summit%2FBG.png?alt=media&token=5e45daf6-4d54-4aa1-9c0a-fbfc7f739834') center center / cover no-repeat fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

/* Logo at top center */
body::before {
    content: '';
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 80px;
    background: url('https://firebasestorage.googleapis.com/v0/b/tieyoung-e964a.appspot.com/o/Iron%20Biotics%20Summit%2FLogo.png?alt=media&token=b60eb503-cb1a-48d0-8688-b3686fbae80b') center center / contain no-repeat;
    z-index: 1000;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Screen Management */
.screen {
    display: none;
    background: transparent;
    border-radius: 20px;
    box-shadow: none;
    padding: 2rem;
    padding-top: 100px !important;
    animation: fadeIn 0.3s ease-in;
    border: none;
}

.screen.active {
    display: block;
}

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

/* Welcome Screen */
.welcome-content {
    text-align: center;
    max-width: 575px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.welcome-content h1 {
    color: var(--primary-color);
    font-family: 'Marine', 'Montserrat', sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-content p {
    color: #000000;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    margin-bottom: 2rem;
    text-shadow: none;
}

.input-group {
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    color: #000000;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    text-shadow: none;
}

.input-group input {
    width: 100%;
    padding: 1rem;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    font-family: 'Montserrat', sans-serif;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem;
    box-shadow: var(--shadow);
    min-width: 150px;
    font-family: 'Montserrat', sans-serif;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

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

.btn-primary {
    background: var(--primary-color);
    color: var(--text-light);
}

.btn-primary:hover {
    background: var(--secondary-color);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-light);
}

.btn-secondary:hover {
    background: var(--primary-color);
}

.btn-hint {
    background: var(--primary-color);
    color: var(--text-light);
    margin-top: 1rem;
}

.btn-hint:hover {
    background: var(--secondary-color);
}

.btn-hint:disabled {
    background: #BDC3C7;
    cursor: not-allowed;
    transform: none;
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-bg);
    gap: 2rem;
    text-align: center;
}

.player-info {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: #000000;
    font-weight: 600;
    text-shadow: none;
    font-family: 'Montserrat', sans-serif;
}

.game-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-family: 'Montserrat', sans-serif;
}

.game-stats span {
    color: #000000;
    text-shadow: none;
}

.game-stats strong {
    color: var(--primary-color);
    text-shadow: none;
}

/* Images Container */
.images-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.image-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 1 45%;
}

.image-wrapper h3 {
    color: #000000;
    margin-bottom: 1rem;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    text-shadow: none;
    font-family: 'Montserrat', sans-serif;
}

.image-box {
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16/9;
    border: 3px solid rgba(220, 20, 60, 0.5);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    cursor: crosshair;
    background: transparent;
}

.image-box canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* Progress Container */
.progress-container {
    margin-bottom: 1rem;
    text-align: center;
}

.differences-found {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: #000000;
    margin-bottom: 1rem;
    text-shadow: none;
    font-family: 'Montserrat', sans-serif;
}

.differences-found strong {
    color: var(--primary-color);
}

.progress-bar {
    width: 100%;
    max-width: 500px;
    height: 30px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    overflow: hidden;
    margin: 0 auto;
    border: 2px solid #000000;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #FF1744);
    transition: width 0.3s ease;
    width: 0%;
}

.game-content {
    text-align: center;
}

/* Results Screen */
.results-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.results-content h1 {
    color: #000000;
    font-family: 'Marine', 'Montserrat', sans-serif;
    font-size: clamp(2rem, 5vw, 2.5rem);
    margin-bottom: 2rem;
    text-shadow: none;
}

.results-content h2 {
    color: #000000;
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 2rem;
    text-shadow: none;
}

.final-stats {
    background: transparent;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: none;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin: 0.5rem 0;
    background: transparent;
    border-radius: 10px;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    border: none;
}

.stat-label {
    color: #000000;
    font-weight: 500;
    text-shadow: none;
}

.stat-value {
    color: var(--primary-color);
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    text-shadow: none;
}

/* Leaderboard Screen */
.leaderboard-content {
    max-width: 700px;
    margin: 0 auto;
    padding: 1rem;
}

.leaderboard-content h1 {
    color: #000000;
    font-family: 'Marine', 'Montserrat', sans-serif;
    font-size: clamp(2rem, 5vw, 2.5rem);
    margin-bottom: 2rem;
    text-align: center;
    text-shadow: none;
}

.leaderboard-list {
    margin-bottom: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin: 0.5rem 0;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    transition: all 0.3s ease;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    border: 2px solid #000000;
    color: #000000;
}

.leaderboard-entry:hover {
    background: rgba(220, 20, 60, 0.3);
    transform: translateX(5px);
}

.leaderboard-entry.top-3 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    font-weight: 600;
}

.leaderboard-entry.top-3:nth-child(2) {
    background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
}

.leaderboard-entry.top-3:nth-child(3) {
    background: linear-gradient(135deg, #CD7F32, #B8860B);
}

.rank {
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    min-width: 40px;
}

.player-data {
    flex: 1;
    margin: 0 1rem;
}

.entry-score {
    font-weight: 700;
    color: var(--primary-color);
    font-size: clamp(1rem, 2.5vw, 1.2rem);
}

.top-3 .entry-score {
    color: white;
}

.entry-time {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    color: #7f8c8d;
    margin-left: 1rem;
}

.top-3 .entry-time {
    color: rgba(255, 255, 255, 0.8);
}

.empty-leaderboard {
    text-align: center;
    padding: 3rem;
    color: #000000;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    text-shadow: none;
}

.leaderboard-content .btn {
    display: block;
    margin: 2rem auto;
}

/* Click Effect */
@keyframes clickEffect {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.click-marker {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 5px solid;
    border-radius: 50%;
    pointer-events: none;
    animation: clickEffect 0.6s ease-out;
}

.click-marker.correct {
    border-color: var(--secondary-color);
}

.click-marker.incorrect {
    border-color: var(--danger-color);
}

/* Hint Highlight */
.hint-highlight {
    position: absolute;
    border: 8px dashed var(--primary-color);
    border-radius: 50%;
    animation: pulse 1s infinite;
    pointer-events: none;
    background: rgba(220, 20, 60, 0.1);
    box-shadow: 0 0 20px rgba(220, 20, 60, 0.5);
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .screen {
        padding: 1.5rem;
        border-radius: 15px;
    }

    .game-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .game-stats {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .images-container {
        flex-direction: column;
        gap: 1rem;
    }

    .image-wrapper {
        flex: 1 1 100%;
    }

    .btn {
        width: 100%;
        margin: 0.5rem 0;
    }

    .stat-item {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .leaderboard-entry {
        flex-wrap: wrap;
        text-align: center;
    }

    .entry-time {
        margin-left: 0;
        width: 100%;
    }
}

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

    .screen {
        padding: 1rem;
    }

    .welcome-content,
    .results-content,
    .leaderboard-content {
        padding: 1rem 0.5rem;
    }

    .final-stats {
        padding: 1rem;
    }

    .image-box {
        border-width: 2px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .images-container {
        flex-direction: row;
        justify-content: center;
    }

    .image-wrapper {
        flex: 0 1 45%;
    }

    .game-header {
        flex-direction: row;
    }

    .game-stats {
        flex-direction: row;
    }
}

/* Results Modal Popup */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease-in;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 90%;
    text-align: center;
    animation: slideIn 0.4s ease-out;
}

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

.modal-content h1 {
    color: var(--primary-color);
    font-family: 'Marine', 'Montserrat', sans-serif;
    font-size: clamp(2rem, 5vw, 2.5rem);
    margin-bottom: 2rem;
}

.modal-content h2 {
    color: #000000;
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 2rem;
}

.modal-content .final-stats {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.modal-content .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin: 0.5rem 0;
    background: transparent;
    border-radius: 10px;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
}

.modal-content .stat-label {
    color: #000000;
    font-weight: 500;
}

.modal-content .stat-value {
    color: var(--primary-color);
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
}

/* Print styles */
@media print {
    body {
        background: white;
    }

    .btn {
        display: none;
    }
}
