/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    /* Prevent text size adjust on orientation change */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Prevent horizontal scroll */
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: Monaco, monospace;
    background-color: #000000;
    color: #ffffff;
    height: 100vh; /* Fixed height, not min-height */
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1.6;
    /* Prevent all scrolling */
    overflow: hidden;
    width: 100%;
    /* Better text rendering on mobile */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* iOS Safari fix */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 40px 20px;
    text-align: center;
    max-height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Landing page */
.statement {
    margin: 100px 0;
    font-size: 18px;
    letter-spacing: 2px;
}

.statement p {
    margin: 0;
}

.nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 60px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 15px 40px;
    background-color: #000000;
    color: #ffffff;
    text-decoration: none;
    border: 1px solid #ffffff;
    font-family: Monaco, monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}

.btn:hover {
    background-color: #ffffff;
    color: #000000;
}

.btn-danger {
    border-color: #ffffff;
}

.btn-danger:hover {
    background-color: #ffffff;
    color: #000000;
}

/* Instruction text */
.instruction {
    font-size: 14px;
    letter-spacing: 1px;
    margin-top: 10px;
    color: #cccccc;
}

.capture-header {
    margin-bottom: 20px;
}

.capture-header .instruction {
    font-size: 16px;
    letter-spacing: 2px;
}

/* Capture page */
.capture-interface {
    margin: 20px auto;
}

#video {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1/1;
    object-fit: cover;
    border: 1px solid #ffffff;
    display: block;
    margin: 0 auto;
}

/* Hide video play button and controls */
#video::-webkit-media-controls {
    display: none !important;
}

#video::-webkit-media-controls-enclosure {
    display: none !important;
}

#video::-webkit-media-controls-panel {
    display: none !important;
}

#video::-webkit-media-controls-play-button {
    display: none !important;
}

#video::-webkit-media-controls-start-playback-button {
    display: none !important;
}

.capture-controls {
    margin-top: 20px;
}

/* Gallery page */
.gallery-header {
    margin-bottom: 40px;
}

.gallery-header h2 {
    font-size: 18px;
    font-weight: normal;
    letter-spacing: 2px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.photo-item {
    position: relative;
    border: 1px solid #ffffff;
    background-color: #000000;
}

.photo-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.photo-actions {
    padding: 10px;
    border-top: 1px solid #ffffff;
}

.photo-photographer {
    padding: 10px;
    border-top: 1px solid #ffffff;
    font-size: 12px;
    letter-spacing: 1px;
    text-align: center;
}

.flag-btn {
    width: 100%;
    padding: 8px;
    background-color: #000000;
    color: #ff0000;
    border: 1px solid #ff0000;
    font-family: Monaco, monospace;
    font-size: 12px;
    cursor: pointer;
    letter-spacing: 1px;
}

.flag-btn:hover {
    background-color: #ff0000;
    color: #000000;
}

/* Admin page */
.admin-panel {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px;
    border: 1px solid #ffffff;
}

.admin-panel h2 {
    font-size: 18px;
    font-weight: normal;
    letter-spacing: 2px;
    margin-bottom: 40px;
}

.session-stats {
    margin: 40px 0;
    text-align: left;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #ffffff;
}

.stat-label {
    font-size: 14px;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 14px;
    font-weight: bold;
}

.admin-controls {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Status messages */
.status {
    margin-top: 20px;
    font-size: 12px;
    letter-spacing: 1px;
    min-height: 20px;
    color: #cccccc;
}

/* Back link */
.back-link {
    display: inline-block;
    margin-top: 40px;
    color: #ffffff;
    text-decoration: none;
    font-size: 12px;
    letter-spacing: 1px;
    border-bottom: 1px solid #ffffff;
}

.back-link:hover {
    border-bottom: 1px solid transparent;
}

/* Sticky back link for gallery */
.back-link.sticky {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #000000;
    padding: 12px 24px;
    border: 1px solid #ffffff;
    border-bottom: 1px solid #ffffff;
    z-index: 100;
    margin-top: 0;
}

.back-link.sticky:hover {
    background-color: #ffffff;
    color: #000000;
    border-bottom: 1px solid #ffffff;
}

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

.modal-content {
    background-color: #000000;
    border: 2px solid #ffffff;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    font-size: 18px;
    font-weight: normal;
    letter-spacing: 2px;
    margin-bottom: 30px;
    color: #ffffff;
}

.modal-content input {
    width: 100%;
    padding: 15px;
    border: 1px solid #ffffff;
    font-family: Monaco, monospace;
    font-size: 14px;
    letter-spacing: 1px;
    margin-bottom: 20px;
    background-color: #000000;
    color: #ffffff;
}

.modal-content input:focus {
    outline: none;
    border: 2px solid #ffffff;
}


/* Leaderboard */
.leaderboard-content {
    max-width: 600px;
}

.leaderboard-content h2 {
    font-size: 24px;
    font-weight: normal;
    letter-spacing: 3px;
    margin-bottom: 40px;
    color: #ffffff;
}

.leaderboard-section {
    margin-bottom: 40px;
    text-align: left;
}

.leaderboard-section h3 {
    font-size: 16px;
    font-weight: normal;
    letter-spacing: 2px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ffffff;
    color: #ffffff;
}

.leaderboard-list {
    list-style: none;
    padding: 0;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #ffffff;
    font-size: 14px;
    letter-spacing: 1px;
    color: #ffffff;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    font-weight: bold;
    margin-right: 15px;
}

.leaderboard-username {
    flex: 1;
}

.leaderboard-count {
    font-weight: bold;
}

.close-leaderboard-btn {
    margin-top: 30px;
    width: 100%;
}

/* Results page */
.results-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin: 40px 0;
}

.results-grid .photo-item {
    width: 100%;
    max-width: 600px;
}

.results-grid .photo-item img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    height: auto;
}

.results-grid .photo-photographer {
    font-size: 40px;
    padding: 20px;
    padding-bottom: 10px;
    line-height: 1.3;
}

.results-instruction {
    font-size: 32px;
    letter-spacing: 2px;
    color: #cccccc;
    margin-top: 20px;
    margin-bottom: 20px;
    font-style: italic;
}

.results-instruction p {
    margin: 15px 0;
    line-height: 1.4;
}

.photo-info {
    border-top: 1px solid #ffffff;
}

.contact-btn {
    display: block;
    width: calc(100% - 40px);
    margin: 10px 20px 20px 20px;
    padding: 20px;
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
    text-align: center;
    text-decoration: none;
    font-family: Monaco, monospace;
    font-size: 36px;
    letter-spacing: 2px;
    transition: all 0.2s;
}

.contact-btn:hover {
    background-color: #ffffff;
    color: #000000;
}

/* Results page text sizing */
results.html .gallery-header h2 {
    font-size: 48px;
    margin-bottom: 20px;
}

body:has(#resultsGallery) .gallery-header h2 {
    font-size: 48px;
    margin-bottom: 20px;
}

body:has(#resultsGallery) .back-link {
    font-size: 28px;
    padding: 10px 0;
}

/* Responsive */
/* Orientation styles */
.orientation-container {
    width: 100%;
    max-width: 800px;
    padding: 40px 20px;
    text-align: center;
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.orientation-screen {
    display: none;
    width: 100%;
}

.orientation-screen.active {
    display: block;
}

.orientation-text {
    margin-bottom: 60px;
    opacity: 1;
}

.orientation-text p {
    font-size: 18px;
    letter-spacing: 2px;
    line-height: 1.8;
    margin: 10px 0;
}

.orientation-btn {
    transition: opacity 0.3s ease-in-out;
}

.returning-participant {
    position: fixed;
    bottom: 30px;
    right: 30px;
}

.returning-participant a {
    color: #ffffff;
    text-decoration: underline;
    font-size: 11px;
    letter-spacing: 0.5px;
    cursor: pointer;
    background: none;
    border: none;
    font-family: Monaco, monospace;
}

.returning-participant a:hover {
    opacity: 0.7;
}

@media (max-width: 768px) {
    /* Container adjustments */
    .container {
        padding: 20px 15px;
    }
    
    /* Landing/Home page */
    .statement {
        margin: 40px 0;
        font-size: 4vw; /* Responsive text */
        letter-spacing: 1px;
    }
    
    .nav-links {
        margin-top: 40px;
        gap: 15px;
    }
    
    /* Buttons - larger touch targets */
    .btn {
        padding: 18px 30px;
        font-size: 16px;
        min-height: 48px; /* Minimum touch target */
        width: 100%;
        max-width: 300px;
    }
    
    /* Capture page */
    .capture-interface {
        margin: 10px auto;
        width: 100%;
    }
    
    #video {
        max-width: 100%;
        width: 100%;
        aspect-ratio: 1/1;
    }
    
    .capture-controls {
        margin-top: 15px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .capture-controls .btn {
        width: 100%;
        max-width: none;
    }
    
    /* Gallery page */
    .gallery-header {
        margin-bottom: 20px;
    }
    
    .gallery-header h2 {
        font-size: 4vw;
    }
    
    .instruction {
        font-size: 3.5vw;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin: 20px 0;
    }
    
    .photo-item img {
        height: auto;
        aspect-ratio: 1/1;
    }
    
    .flag-btn {
        padding: 12px;
        font-size: 14px;
        min-height: 48px;
    }
    
    /* Results page */
    .results-grid {
        gap: 20px;
        margin: 20px 0;
    }
    
    .results-grid .photo-photographer {
        font-size: 6vw;
        padding: 15px;
    }
    
    .contact-btn {
        font-size: 5vw;
        padding: 15px;
    }
    
    /* Modal */
    .modal-content {
        padding: 25px 20px;
        width: 85%;
    }
    
    .modal-content h3 {
        font-size: 4.5vw;
        margin-bottom: 20px;
    }
    
    .modal-content input {
        padding: 18px 15px;
        font-size: 16px; /* Prevent zoom on focus */
        min-height: 52px;
    }
    
    .modal-content .btn {
        min-height: 52px;
        font-size: 16px;
    }
    
    /* Leaderboard */
    .leaderboard-content {
        max-width: 95%;
        padding: 0 10px;
    }
    
    .leaderboard-content h2 {
        font-size: 5vw;
        margin-bottom: 20px;
    }
    
    .leaderboard-section h3 {
        font-size: 4vw;
    }
    
    .leaderboard-item {
        font-size: 3.5vw;
        padding: 10px 0;
        flex-wrap: wrap;
    }
    
    /* Orientation */
    .orientation-container {
        padding: 20px 15px;
        min-height: 100vh;
        min-height: -webkit-fill-available; /* iOS Safari fix */
    }
    
    .orientation-text {
        margin-bottom: 40px;
    }
    
    .orientation-text p {
        font-size: 4.5vw;
        letter-spacing: 1px;
        line-height: 1.6;
    }
    
    .orientation-btn {
        width: 100%;
        max-width: 280px;
        min-height: 52px;
        font-size: 16px;
    }
    
    .returning-participant {
        bottom: 15px;
        right: 15px;
    }
    
    .returning-participant a {
        font-size: 12px;
        padding: 10px;
    }
    
    /* Back link */
    .back-link {
        font-size: 14px;
        padding: 12px 20px;
    }
    
    .back-link.sticky {
        bottom: 15px;
        padding: 15px 25px;
        font-size: 14px;
    }
    
    /* Status messages */
    .status {
        font-size: 3.5vw;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .statement {
        font-size: 4.5vw;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .orientation-text p {
        font-size: 5vw;
    }
    
    .modal-content {
        width: 90%;
        padding: 20px 15px;
    }
}

/* Landscape mobile fix */
@media (max-height: 500px) and (orientation: landscape) {
    .orientation-container {
        min-height: auto;
        padding: 15px;
    }
    
    .orientation-text {
        margin-bottom: 20px;
    }
    
    .orientation-text p {
        font-size: 3vw;
        line-height: 1.4;
        margin: 5px 0;
    }
    
    .orientation-btn {
        padding: 12px 25px;
        font-size: 14px;
    }
}
