* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #1e1e2e 0%, #2d2d44 100%);
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior-y: contain;
}

.app-container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding-bottom: 100px;
    min-height: 100vh;
}

/* Pages */
.page {
    display: none;
    padding: 20px 15px;
    animation: fadeIn 0.3s ease-in;
    min-height: calc(100vh - 100px);
}

.page.active {
    display: block;
}

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

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    flex-wrap: nowrap;
}

.stat-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    padding: 18px 12px;
    border-radius: 16px;
    text-align: center;
    min-width: 0;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #aaa;
    margin-bottom: 10px;
    letter-spacing: 1.5px;
}

.progress-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 5px;
}

.stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
    margin-top: 8px;
}

/* Timer Display */
.timer-display {
    font-size: 5rem;
    font-weight: 900;
    text-align: center;
    margin: 35px 0;
    background: linear-gradient(135deg, #00e5ff, #00bfff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-variant-numeric: tabular-nums;
    letter-spacing: -2px;
    line-height: 1;
}

/* Safety Status */
.safety-status {
    text-align: center;
    padding: 20px;
    border-radius: 12px;
    background: linear-gradient(90deg, #ff6b35, #ff8c42);
    margin-bottom: 25px;
    font-weight: 800;
    font-size: 1.3rem;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    transition: all 0.3s ease;
}

.safety-status:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.6);
}

/* Start Button */
.start-btn {
    width: 100%;
    padding: 28px 20px;
    font-size: 2rem;
    font-weight: 900;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 2px;
    min-height: 70px;
}

.start-btn.disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.start-btn.enabled {
    background: linear-gradient(135deg, #00e676, #00c853);
    color: white;
    box-shadow: 0 6px 20px rgba(0, 230, 118, 0.5);
}

.start-btn.enabled:active {
    transform: scale(0.98);
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.4);
}

.start-btn.active {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5); }
    50% { box-shadow: 0 6px 30px rgba(255, 107, 53, 0.8); }
}

/* Map Placeholder */
.map-placeholder {
    background: rgba(255, 255, 255, 0.05);
    border: 3px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 50px 20px;
    text-align: center;
    color: #999;
}

.map-placeholder p {
    font-size: 3rem;
    margin-bottom: 15px;
}

.map-placeholder small {
    font-size: 1.1rem;
}

/* Checklist */
#checklist-container {
    margin-bottom: 30px;
}

.checklist-item {
    background: rgba(255, 255, 255, 0.08);
    padding: 22px 18px;
    margin-bottom: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all 0.2s ease;
    min-height: 70px;
}

.checklist-item:active {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0.98);
}

.safety-checkbox {
    width: 32px;
    height: 32px;
    cursor: pointer;
    accent-color: #00e676;
    flex-shrink: 0;
    min-width: 32px;
    min-height: 32px;
}

.checklist-item label {
    cursor: pointer;
    flex: 1;
    font-size: 1.15rem;
    color: white;
    line-height: 1.4;
}

.verify-btn {
    width: 100%;
    padding: 25px 20px;
    font-size: 1.7rem;
    font-weight: 900;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #00e676, #00c853);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 6px 20px rgba(0, 230, 118, 0.5);
    min-height: 70px;
}

.verify-btn:active {
    transform: scale(0.98);
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.4);
}

/* Timeline */
#timeline-container {
    margin-top: 20px;
}

.timeline-item {
    background: rgba(255, 255, 255, 0.08);
    padding: 22px 18px;
    margin-bottom: 15px;
    border-radius: 16px;
    border-left: 5px solid #00e5ff;
}

.trip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 1.2rem;
    font-weight: 700;
}

.night-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 6px 14px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}

.trip-details {
    color: #ddd;
    font-size: 1.1rem;
    line-height: 1.6;
}

.trip-details p {
    margin: 8px 0;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(30, 30, 46, 0.98);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.nav-item {
    flex: 1;
    background: none;
    border: none;
    color: #999;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 10px;
    min-height: 65px;
}

.nav-item span {
    width: 40px;
    height: 4px;
    background: #999;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-item.active {
    color: #00e5ff;
}

.nav-item.active span {
    background: #00e5ff;
    box-shadow: 0 0 15px #00e5ff;
}

.nav-item:active {
    transform: scale(0.95);
}

/* Login Screen */
#google-login-btn {
    padding: 20px;
}

#google-login-btn h1 {
    font-size: 3.5rem !important;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#google-login-btn p {
    font-size: 1.3rem !important;
}

/* Sync Status Area - FIXED: Collapsible and less obtrusive */
#sync-status-area {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.95);
    padding: 12px 15px;
    border-radius: 12px;
    z-index: 999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    max-width: 200px;
    transition: all 0.3s ease;
}

/* Collapsed state - just shows user pic */
#sync-status-area.collapsed {
    padding: 8px;
    max-width: 60px;
}

#sync-status-area.collapsed #sync-controls,
#sync-status-area.collapsed #sync-time {
    display: none !important;
}

#user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

#user-info img {
    border-radius: 50%;
    width: 45px !important;
    height: 45px;
    border: 2px solid #00e5ff !important;
    flex-shrink: 0;
}

#user-info p {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    display: block;
}

#sync-status-area.collapsed #user-info p {
    display: none;
}

#sync-time {
    color: #00e5ff !important;
    font-size: 0.85rem !important;
    margin-top: 8px !important;
    text-align: center;
}

#sync-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

#sync-status-area button {
    flex: 1;
    padding: 10px 12px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    min-height: 40px;
    border: none;
    cursor: pointer;
}

/* Close button for sync modal */
#close-sync-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border: none;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    font-size: 1.2rem !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive adjustments */
@media (max-width: 380px) {
    .timer-display {
        font-size: 4rem;
    }
    
    .start-btn {
        font-size: 1.7rem;
        padding: 24px 16px;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    #sync-status-area {
        max-width: 170px;
    }
}

/* Landscape mode */
@media (orientation: landscape) and (max-height: 500px) {
    .timer-display {
        font-size: 3.5rem;
        margin: 20px 0;
    }
    
    .stats-bar {
        margin-bottom: 15px;
    }
    
    .stat-box {
        padding: 12px 8px;
    }
    
    .start-btn {
        padding: 20px;
        font-size: 1.5rem;
    }
    
    .page {
        padding: 15px 12px;
    }
    
    #sync-status-area {
        top: 5px;
        right: 5px;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    body {
        background: #000;
    }
    
    .stat-box,
    .checklist-item,
    .timeline-item {
        background: rgba(255, 255, 255, 0.15);
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
}

/* Prevent zoom on input focus */
input, select, textarea {
    font-size: 16px !important;
}

/* Better scrolling */
.page {
    -webkit-overflow-scrolling: touch;
}

/* Timeline empty state */
#timeline-container > div {
    font-size: 1.2rem;
    line-height: 1.6;
}
