/* ===== TIMERACER DESIGN SYSTEM ===== */

:root {
    /* Viewport */
    --vh: 1vh;

    /* Brand Colors */
    --primary-50: #f0f4ff;
    --primary-100: #e0e9ff;
    --primary-500: #667eea;
    --primary-600: #5a6fd8;
    --primary-700: #4f5bc4;
    --primary-900: #2d3748;

    /* Semantic Colors */
    --success-50: #f0fff4;
    --success-100: #dcfce7;
    --success-200: #bbf7d0;
    --success-300: #86efac;
    --success-500: #28a745;
    --success-600: #218838;
    --success-700: #1e7e34;

    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-200: #fde68a;
    --warning-300: #fcd34d;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;

    --error-50: #fef2f2;
    --error-100: #fee2e2;
    --error-200: #fecaca;
    --error-300: #fca5a5;
    --error-500: #dc3545;
    --error-600: #c82333;
    --error-700: #b91c1c;

    /* Primary Color Extensions */
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Additional Colors for Route Features */
    --orange-100: #fed7aa;
    --orange-500: #f97316;
    --orange-600: #ea580c;
    --orange-700: #c2410c;

    --purple-100: #e9d5ff;
    --purple-500: #a855f7;
    --purple-600: #9333ea;
    --purple-700: #7c3aed;

    --blue-100: #dbeafe;
    --blue-700: #1d4ed8;

    --yellow-50: #fffbeb;
    --yellow-100: #fef3c7;
    --yellow-400: #fbbf24;
    --yellow-700: #a16207;

    --red-100: #fee2e2;
    --red-700: #b91c1c;

    --green-100: #dcfce7;
    --green-700: #15803d;

    /* Spacing Scale - Condensed */
    --space-1: 0.125rem;
    --space-2: 0.25rem;
    --space-3: 0.375rem;
    --space-4: 0.5rem;
    --space-5: 0.625rem;
    --space-6: 0.75rem;
    --space-8: 1rem;
    --space-10: 1.25rem;
    --space-12: 1.5rem;

    /* Typography */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

/* Reset with modern defaults */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Override framework button margins */
button {
    margin-bottom: 0 !important;
}

/* Override Pico defaults with our design system */
:root:not([data-theme="dark"]) {
    --primary: var(--primary-500);
    --primary-hover: var(--primary-600);
    --primary-focus: var(--primary-100);
    --primary-inverse: #fff;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    overflow-x: hidden;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.screen {
    display: none;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* ===== AUTH STYLES ===== */
.auth-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: var(--space-6);
    background: url('loginBackground.svg') center center / cover no-repeat;
    position: relative;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    opacity: 1;
}

.auth-container h1 {
    font-family: 'Racing Sans One', sans-serif;
    color: white;
    font-size: var(--font-size-4xl);
    font-weight: 700;
    margin-bottom: 0;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.auth-form {
    background: white;
    padding: var(--space-8);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.auth-form.hidden {
    display: none;
}

.auth-form h2 {
    margin-bottom: var(--space-6);
    text-align: center;
    color: var(--gray-900);
    font-size: var(--font-size-2xl);
    font-weight: 600;
}

.auth-form input {
    width: 100%;
    padding: var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    transition: all var(--transition-base);
    background: var(--gray-50);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-500);
    background: white;
    box-shadow: 0 0 0 3px var(--primary-100);
    transform: translateY(-1px);
}

.auth-form button {
    width: 100%;
    padding: var(--space-4);
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.auth-form button:hover {
    background: var(--primary-600);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.auth-form button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Email Confirmation Message Styles */
.email-confirmation-message {
    background: linear-gradient(135deg, #e8f4fd 0%, #d1e7dd 100%);
    border: 2px solid #0d6efd;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

.email-confirmation-message.hidden {
    display: none;
}

.confirmation-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.confirmation-title {
    color: #0d6efd;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
}

.confirmation-text {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 500;
}

.confirmation-help {
    margin: 0 0 1rem 0;
    color: #6c757d;
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
}

.confirmation-note {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 1rem;
}

.confirmation-note small {
    color: #856404;
    font-weight: 600;
}

.resend-link {
    color: #0d6efd;
    text-decoration: underline;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease;
}

.resend-link:hover {
    color: #0b5ed7;
    text-decoration: none;
}

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

/* Route Category and Difficulty Styles */
.route-metadata-row {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
}

.route-category-section,
.route-difficulty-section {
    flex: 1;
    margin: 0;
}

.route-category-section label,
.route-difficulty-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gray-700);
}

.category-select,
.difficulty-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: var(--gray-700);
    transition: all var(--transition-base);
}

.category-select:focus,
.difficulty-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Route Visibility Toggle Styles */
.route-visibility-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

.visibility-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.visibility-toggle input[type="checkbox"] {
    display: none;
}

.visibility-toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background: var(--gray-300);
    border-radius: 24px;
    transition: all 0.3s ease;
}

.visibility-toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.visibility-toggle input[type="checkbox"]:checked + .visibility-toggle-slider {
    background: var(--primary-500);
}

.visibility-toggle input[type="checkbox"]:checked + .visibility-toggle-slider::before {
    transform: translateX(26px);
}

.visibility-label {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 14px;
}

.visibility-description {
    margin: 0;
    font-size: 12px;
    color: var(--gray-600);
    line-height: 1.4;
}

/* Public Routes Discovery Styles */
.public-routes-controls {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 0.75rem;
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-headers {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-header {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 2px;
}

.filter-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-select {
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 13px;
    background: white;
    flex: 1;
}

.filter-select.compact {
    min-width: 0;
    font-size: 12px;
}

.public-routes-list {
    max-height: 450px;
    overflow-y: auto;
}

.public-route-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 1rem;
    background: white;
    transition: all var(--transition-base);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.public-route-item:hover {
    border-color: var(--primary-300);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.public-route-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.public-route-info {
    flex: 1;
}

.public-route-name {
    font-family: 'Racing Sans One', sans-serif;
    font-weight: 400;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}



.public-route-meta {
    font-size: 12px;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

.public-route-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.public-route-description {
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.4;
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: 4px;
    border-left: 2px solid var(--primary-200);
}

.public-route-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 13px;
    color: var(--gray-600);
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 8px;
}

.public-route-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.public-route-stat-icon {
    font-size: 14px;
}

.public-route-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
    flex-shrink: 0;
}

.public-route-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.load-public-route-btn {
    background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.load-public-route-btn:hover {
    background: linear-gradient(135deg, var(--success-600) 0%, var(--success-700) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.load-public-route-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.like-route-btn {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}

.like-route-btn:hover {
    background: var(--gray-200);
}

.like-route-btn.liked {
    background: var(--error-100);
    color: var(--error-600);
    border-color: var(--error-300);
}

.share-route-btn {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}

.share-route-btn:hover {
    background: var(--gray-200);
}

.rate-route-btn {
    background: var(--orange-500);
    color: white;
}

.rate-route-btn:hover {
    background: var(--orange-600);
    transform: translateY(-1px);
}

.reviews-btn {
    background: var(--purple-500);
    color: white;
}

.reviews-btn:hover {
    background: var(--purple-600);
    transform: translateY(-1px);
}

/* Route Rating Styles */
.route-rating-info {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.route-rating-info h4 {
    margin: 0 0 0.5rem 0;
    color: var(--gray-800);
}

.route-rating-info p {
    margin: 0;
    color: var(--gray-600);
    font-size: 14px;
}

.rating-section {
    margin: 1.5rem 0;
    text-align: center;
}

.rating-section label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--gray-700);
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.star {
    font-size: 2rem;
    cursor: pointer;
    transition: all var(--transition-base);
    opacity: 0.3;
}

.star:hover,
.star.active {
    opacity: 1;
    transform: scale(1.1);
}

.review-section {
    margin: 1.5rem 0;
}

.review-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gray-700);
}

.review-section textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
}

.review-section textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Reviews Display Styles */
.reviews-summary {
    text-align: center;
    padding: 1.5rem;
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.average-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.rating-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
}

.rating-stars {
    display: flex;
    gap: 0.25rem;
}

.rating-stars .star {
    font-size: 1.5rem;
    opacity: 1;
}

.rating-count {
    color: var(--gray-600);
    font-size: 14px;
}

.reviews-list {
    max-height: 400px;
    overflow-y: auto;
}

.review-item {
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 1rem;
    background: white;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.review-user {
    font-weight: 600;
    color: var(--gray-800);
}

.review-rating {
    display: flex;
    gap: 0.25rem;
}

.review-rating .star {
    font-size: 1rem;
    opacity: 1;
}

.review-date {
    font-size: 12px;
    color: var(--gray-500);
}

.review-text {
    color: var(--gray-700);
    line-height: 1.5;
    margin: 0;
}

/* Enhanced Public Route Item Styles */
.public-route-category {
    display: inline-block;
    background: var(--blue-100);
    color: var(--blue-700);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 0.5rem;
}

.public-route-difficulty {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.difficulty-easy {
    background: var(--green-100);
    color: var(--green-700);
}

.difficulty-medium {
    background: var(--yellow-100);
    color: var(--yellow-700);
}

.difficulty-hard {
    background: var(--red-100);
    color: var(--red-700);
}

.difficulty-expert {
    background: var(--gray-800);
    color: white;
}

.public-route-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0.5rem 0;
    padding: 0.25rem 0.5rem;
    background: var(--yellow-50);
    border-radius: 4px;
    border-left: 2px solid var(--yellow-400);
}

.public-route-rating .star {
    font-size: 0.75rem;
    opacity: 1;
}

.rating-text {
    font-size: 11px;
    color: var(--gray-600);
    margin-left: 0.125rem;
}

.auth-form p {
    text-align: center;
    margin-top: 1rem;
    color: #666;
}

.auth-form a {
    color: #667eea;
    text-decoration: none;
}

.auth-form a:hover {
    text-decoration: underline;
}

.auth-form .auth-links {
    text-align: center;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.auth-form .form-description {
    text-align: center;
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Error and Success Messages */
.error-message {
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    color: #c33;
    font-size: 0.9rem;
    line-height: 1.5;
}

.error-message.hidden {
    display: none;
}

.error-message strong {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.error-message ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}

.error-message li {
    margin-bottom: 0.25rem;
}

.success-message {
    background-color: #efe;
    border: 1px solid #cfc;
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    color: #363;
    font-size: 0.9rem;
    line-height: 1.5;
}

.success-message.hidden {
    display: none;
}

/* OTP Verification Styles */
.otp-instructions {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--gray-600);
}

#otp-email-display {
    font-weight: 600;
    color: var(--primary-600);
}

#otp-code {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

/* Main App Styles */

/* ===== MODE SWITCHER ===== */
.mode-switcher {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: var(--space-1);
    gap: 0;
    background: var(--gray-100);
    border-radius: var(--radius-xl);
    flex-wrap: nowrap;
    margin: 0 auto;
}

.mode-btn {
    padding: var(--space-3) var(--space-6);
    border: none;
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all var(--transition-base);
    flex: 0 0 auto;
    border-radius: var(--radius-lg);
    position: relative;
    white-space: nowrap;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    margin: 0 !important;
}

.mode-btn.active {
    background: white;
    color: var(--primary-600);
    box-shadow: var(--shadow-sm);
}

.mode-btn:hover:not(.active) {
    background: var(--gray-200);
    color: var(--gray-700);
}







/* Options Modal Styles */
/* Custom Alert Modal Styles */
.alert-modal-content {
    max-width: 400px;
    width: 90%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--gray-200);
}

.alert-modal-header {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
    padding: 1.5rem;
    border-bottom: 1px solid var(--primary-200);
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-icon {
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-500);
    border-radius: 50%;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.alert-modal-header h3 {
    margin: 0;
    color: var(--primary-700);
    font-size: 18px;
    font-weight: 600;
}

.alert-modal-body {
    padding: 1.5rem;
    background: white;
}

.alert-modal-body p {
    margin: 0;
    color: var(--gray-700);
    font-size: 16px;
    line-height: 1.5;
}

.alert-modal-actions {
    padding: 1rem 1.5rem 1.5rem;
    background: white;
    display: flex;
    justify-content: flex-end;
}

.alert-ok-btn {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    min-width: 80px;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.alert-ok-btn:hover {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.alert-ok-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

/* Custom Confirm Modal Styles */
.confirm-modal-content {
    max-width: 450px;
    width: 90%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--warning-200);
}

.confirm-modal-header {
    background: linear-gradient(135deg, var(--warning-50) 0%, var(--warning-100) 100%);
    padding: 1.5rem;
    border-bottom: 1px solid var(--warning-200);
    display: flex;
    align-items: center;
    gap: 12px;
}

.confirm-icon {
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--warning-500);
    border-radius: 50%;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.confirm-modal-header h3 {
    margin: 0;
    color: var(--warning-700);
    font-size: 18px;
    font-weight: 600;
}

.confirm-modal-body {
    padding: 1.5rem;
    background: white;
}

.confirm-modal-body p {
    margin: 0;
    color: var(--gray-700);
    font-size: 16px;
    line-height: 1.5;
}

.confirm-modal-actions {
    padding: 1rem 1.5rem 1.5rem;
    background: white;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.confirm-cancel-btn {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.confirm-cancel-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.confirm-ok-btn {
    background: linear-gradient(135deg, var(--warning-500) 0%, var(--warning-600) 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    min-width: 80px;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.confirm-ok-btn:hover {
    background: linear-gradient(135deg, var(--warning-600) 0%, var(--warning-700) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.confirm-ok-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

/* Custom Prompt Modal Input */
.prompt-input {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.prompt-input:focus {
    outline: none;
    border-color: var(--warning-500);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.prompt-input::placeholder {
    color: var(--gray-400);
}

/* Mobile responsive for alert modal */
@media (max-width: 768px) {
    .alert-modal-content {
        max-width: 95%;
        margin: 1rem;
    }

    .alert-modal-header {
        padding: 1rem;
    }

    .alert-modal-body {
        padding: 1rem;
    }

    .alert-modal-actions {
        padding: 0.75rem 1rem 1rem;
    }

    .alert-ok-btn {
        padding: 8px 20px;
        font-size: 13px;
    }
}

/* Options Section Styles - Inline Content */
#options-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: 0;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#options-section.hidden {
    display: none;
}

.options-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.options-sections-container {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-xl);
}

.options-header h3 {
    margin: 0;
    color: var(--primary-700);
    font-size: 1.25rem;
    font-weight: 700;
}



.options-section {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--gray-200);
    background: white;
}

.options-section:last-child {
    border-bottom: none;
}

.options-section h4 {
    margin: 0 0 1rem 0;
    color: var(--gray-800);
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.option-info {
    flex: 1;
}

.option-info label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.option-description {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.option-control {
    margin-left: 1rem;
}



/* Logout Button in Options */
.logout-btn {
    padding: 0.75rem 1.5rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logout-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

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

.upgrade-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.manage-subscription-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.manage-subscription-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.4);
}

.privacy-policy-link {
    color: var(--primary-600);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-block;
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
}

.privacy-policy-link:hover {
    background: var(--primary-100);
    color: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

/* Privacy Controls Styles */
.secondary-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.secondary-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.4);
}

.danger-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.danger-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.4);
}

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

.danger-zone {
    border-top: 2px solid #dc3545;
    padding-top: 1rem;
    margin-top: 1rem;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 8px;
    background: #28a745;
    color: white;
}

.status-badge.inactive {
    background: #6c757d;
}

/* Countdown Select in Options */
.countdown-select {
    padding: 0.5rem;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.countdown-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Sound Toggle Switch */
.sound-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    cursor: pointer;
}

.sound-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.sound-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-300);
    border-radius: 24px;
    transition: all var(--transition-base);
}

.sound-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.sound-toggle input:checked+.sound-toggle-slider {
    background: var(--success-500);
}

.sound-toggle input:checked+.sound-toggle-slider:before {
    transform: translateX(26px);
}

/* Countdown Modal */
.countdown-content {
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.countdown-display {
    text-align: center;
    max-width: 400px;
}

.countdown-display h2 {
    margin: 0 0 2rem 0;
    font-size: 2.5rem;
    font-weight: 300;
    color: #fff;
}

.countdown-number {
    font-size: 8rem;
    font-weight: bold;
    color: #28a745;
    margin: 1rem 0;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    text-shadow: 0 0 20px rgba(40, 167, 69, 0.5);
    animation: pulse-countdown 1s ease-in-out;
}

.countdown-text {
    font-size: 1.2rem;
    margin: 1rem 0 3rem 0;
    color: #ccc;
}

.cancel-countdown-btn {
    padding: 0.75rem 2rem;
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: 2px solid #dc3545;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.cancel-countdown-btn:hover {
    background: #dc3545;
    transform: translateY(-2px);
}

@keyframes pulse-countdown {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse-location {
    0% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(40, 167, 69, 0.7);
    }

    70% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 10px rgba(40, 167, 69, 0);
    }

    100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* ===== GPS LOCATION MARKER ===== */
.user-location-marker {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    z-index: 1000 !important;
}

.gps-marker {
    position: relative !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    transition: all var(--transition-base) !important;
    z-index: 1001 !important;
}

.gps-marker::before {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 6px !important;
    height: 6px !important;
    background: white !important;
    border-radius: 50% !important;
    z-index: 2 !important;
}

.gps-marker-standard {
    width: 20px !important;
    height: 20px !important;
    background: #dc2626 !important; /* Red color for high visibility */
    border: 3px solid white !important;
    box-shadow: var(--shadow-lg) !important;
    animation: pulse-gps-standard 2s ease-in-out infinite !important;
    transform-origin: center center !important;
}

.gps-marker-trial {
    width: 22px !important;
    height: 22px !important;
    background: #dc2626 !important; /* Same dramatic red as standard */
    border: 3px solid white !important;
    box-shadow: var(--shadow-xl) !important;
    animation: pulse-gps-marker 1.5s ease-in-out infinite !important;
    transform-origin: center center !important;
}

/* Standard GPS marker animation - dramatic red pulse */
@keyframes pulse-gps-standard {
    0%, 100% {
        transform: scale(1);
        box-shadow: var(--shadow-lg), 0 0 0 0 rgba(220, 38, 38, 0.6);
    }
    50% {
        transform: scale(1.3);
        box-shadow: var(--shadow-lg), 0 0 0 12px rgba(220, 38, 38, 0);
    }
}

/* Time trial GPS marker animation - dramatic red pulse matching standard */
@keyframes pulse-gps-marker {
    0%, 100% {
        transform: scale(1);
        box-shadow: var(--shadow-xl), 0 0 0 0 rgba(220, 38, 38, 0.7);
    }
    50% {
        transform: scale(1.4);
        box-shadow: var(--shadow-xl), 0 0 0 15px rgba(220, 38, 38, 0);
    }
}

/* Additional overrides for user location marker */
.leaflet-marker-icon.user-location-marker {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    z-index: 1000 !important;
    pointer-events: auto !important;
}

.leaflet-marker-icon.user-location-marker .gps-marker {
    border-radius: 50% !important;
}

/* Prevent Pico CSS from styling Leaflet markers - surgical approach */
.leaflet-marker-icon {
    /* Only override the problematic Pico CSS properties */
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    /* Keep essential Leaflet properties */
    display: block !important;
    position: absolute !important;
    cursor: pointer !important;
}

.leaflet-marker-icon img {
    /* Ensure marker images display correctly */
    display: block !important;
    max-width: none !important;
    max-height: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Checkpoint markers now use default Leaflet styling */



/* Leaderboard Styles */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.leaderboard-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.leaderboard-table td {
    font-size: 14px;
}

.leaderboard-rank {
    font-weight: bold;
    text-align: center;
    width: 50px;
}

.leaderboard-rank.first {
    color: #ffd700;
}

.leaderboard-rank.second {
    color: #c0c0c0;
}

.leaderboard-rank.third {
    color: #cd7f32;
}

.leaderboard-time {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-weight: bold;
    color: #667eea;
}

.leaderboard-user {
    font-weight: 500;
}

.leaderboard-date {
    color: #666;
    font-size: 12px;
}

.leaderboard-empty {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.leaderboard-empty h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
}

.personal-best {
    background: #e7f3ff;
    border-left: 4px solid #667eea;
}

/* Location Status Indicator */
/* ===== LOCATION STATUS INDICATOR ===== */
.location-status {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) var(--space-3);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-xs);
    color: var(--warning-700);
    box-shadow: var(--shadow-lg);
    min-height: 32px;
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.location-status.map-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 9999;
    width: 120px;
    pointer-events: auto;
    visibility: visible !important;
    opacity: 1 !important;
    display: none; /* Hidden by default - only show when there's an issue */
    transform: translateX(0);
    transition: transform 0.3s ease-in-out;
}

/* GPS Status: Green = Connected */
.location-status.success {
    background: #22c55e; /* Green background */
    color: white;
    border-color: #16a34a;
    font-weight: 700;
}

.location-status.success .location-text {
    animation: none; /* Remove pulsing for cleaner look */
}

/* GPS Status: Red = No Signal */
.location-status.error {
    background: #ef4444; /* Red background */
    color: white;
    border-color: #dc2626;
    font-weight: 700;
}

/* GPS Status: Yellow = Acquiring Signal */
.location-status.loading {
    background: #eab308; /* Yellow background */
    color: white;
    border-color: #ca8a04;
    font-weight: 700;
    animation: pulse-gps-acquiring 2s ease-in-out infinite;
}

@keyframes pulse-gps-acquiring {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}



.location-text {
    font-weight: 600;
}



/* Navigation Links */
.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0.5rem;
}

.nav-btn {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-btn:hover {
    color: #667eea;
    text-decoration: underline;
}

.nav-btn.disabled {
    color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

.nav-btn.disabled:hover {
    color: #ccc;
    text-decoration: none;
}

/* ===== RACING FONT ELEMENTS ===== */
#rating-route-name,
#trial-route-name,
.modal h3 {
    font-family: 'Racing Sans One', sans-serif;
}

/* ===== NAVIGATION TRIAL BUTTONS ===== */
.nav-trial-btn {
    background: linear-gradient(135deg, white 0%, var(--gray-50) 100%);
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-xl);
    font-size: var(--font-size-xs);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    box-shadow: var(--shadow-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(10px);
}

.nav-trial-btn.disabled {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-400);
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

.nav-trial-btn.disabled:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.nav-trial-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-300);
}

.nav-trial-btn.start-btn {
    background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
    border-color: var(--success-600);
    color: white;
    box-shadow: var(--shadow-md), 0 0 0 0 rgba(40, 167, 69, 0.4);
}

.nav-trial-btn.start-btn:hover {
    background: linear-gradient(135deg, var(--success-600) 0%, var(--success-700) 100%);
    border-color: var(--success-700);
    box-shadow: var(--shadow-xl), 0 0 0 4px rgba(40, 167, 69, 0.2);
    transform: translateY(-3px);
}

.nav-trial-btn.stop-btn {
    border-color: var(--error-500);
    color: var(--error-600);
    background: var(--error-50);
}

.nav-trial-btn.stop-btn:hover {
    background: var(--error-500);
    color: white;
    border-color: var(--error-600);
}

.nav-trial-btn.reset-btn {
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    border-color: var(--gray-300);
    color: var(--gray-700);
    box-shadow: var(--shadow-sm);
}

.nav-trial-btn.reset-btn:hover {
    background: linear-gradient(135deg, var(--gray-500) 0%, var(--gray-600) 100%);
    color: white;
    border-color: var(--gray-600);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* ===== MAIN CONTENT ===== */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: var(--space-1);
}

/* ===== MAP STYLES ===== */
#map-container {
    position: relative;
    height: 45vh;
    height: calc(var(--vh, 1vh) * 45);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
}

#map {
    height: 100%;
    width: 100%;
}

.map-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.control-btn {
    padding: var(--space-3) var(--space-4);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all var(--transition-base);
    color: var(--gray-700);
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--gray-50);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Location Center Button - Google Maps style with modern design */
.location-btn {
    position: absolute;
    bottom: 60px;
    right: 20px;
    z-index: 9999;
    
    /* Circular Google Maps style */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    
    /* Modern styling */
    background: white;
    color: #5f6368;
    font-size: 1.4rem;
    font-weight: 400;
    
    /* Subtle shadow like Google Maps */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
    
    /* Smooth transitions */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.location-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.location-btn:active {
    background: #f1f3f4;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.location-btn.locating {
    background: #1a73e8;
    color: white;
    animation: pulse-location 1.5s ease-in-out infinite;
}

.location-btn.locating:hover {
    background: #1557b0;
}

/* Add Checkpoint Button - positioned above location button */
.add-checkpoint-btn {
    position: absolute;
    bottom: 120px; /* Above the location button */
    right: 20px;
    width: auto;
    height: 36px;
    padding: 0 12px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    z-index: 1000;
    display: none; /* Initially hidden until route is active */
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.add-checkpoint-btn:hover {
    background: #3367d6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.add-checkpoint-btn:active {
    background: #2851a3;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.add-checkpoint-btn.disabled {
    background: #9aa0a6;
    cursor: not-allowed;
    opacity: 0.6;
}

.add-checkpoint-btn.disabled:hover {
    background: #9aa0a6;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Location icon styles removed - now using text */

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

/* Zoom controls removed for cleaner circular map interface */

/* Enhanced touch support for all control buttons */
@media (hover: none) and (pointer: coarse) {
    .control-btn:hover {
        transform: none;
    }

    .control-btn:active {
        transform: scale(0.95);
        background: rgba(255, 255, 255, 0.9);
    }
}

/* Animation for Add Checkpoint button appearance */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Numbered Checkpoint Markers */
.numbered-checkpoint-marker {
    background: transparent !important;
    border: none !important;
}

.checkpoint-number-circle {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.checkpoint-number-circle:hover {
    transform: scale(1.1);
}

/* Special styling for the Start checkpoint */
.checkpoint-number-circle.start-checkpoint {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

/* Loop route indicator for start checkpoint */
.checkpoint-number-circle.loop-route {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 2px #fff, 0 0 0 4px #ff6b35;
}

/* Special styling for the Finish checkpoint (when not a loop route) */
.checkpoint-number-circle.finish-checkpoint {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 2px #fff;
}

/* Special styling for active checkpoint during time trial */
.checkpoint-number-circle.active-checkpoint {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4), 0 0 0 2px #fff, 0 0 0 4px #667eea;
    animation: checkpoint-pulse 2s ease-in-out infinite;
}

@keyframes checkpoint-pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4), 0 0 0 2px #fff, 0 0 0 4px #667eea;
    }
    50% {
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.6), 0 0 0 2px #fff, 0 0 0 6px rgba(102, 126, 234, 0.3);
    }
}

/* Special styling for completed checkpoints during time trial */
.checkpoint-number-circle.completed-checkpoint {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4), 0 0 0 2px #fff;
    animation: checkpoint-complete 0.6s ease-out;
}

@keyframes checkpoint-complete {
    0% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4), 0 0 0 2px #fff;
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 4px 16px rgba(40, 167, 69, 0.6), 0 0 0 3px #fff, 0 0 20px rgba(40, 167, 69, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4), 0 0 0 2px #fff;
    }
}

/* Checkpoint popup styling */
.checkpoint-popup {
    min-width: 200px;
    padding: 8px;
}

.popup-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.start-finish-control {
    border-top: 1px solid #eee;
    padding-top: 8px;
}

.popup-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
}

.popup-toggle-label input[type="checkbox"] {
    margin: 0;
    transform: scale(0.9);
}

.popup-toggle-text {
    user-select: none;
    line-height: 1.3;
}

.popup-toggle-label:hover .popup-toggle-text {
    color: #333;
}

/* Table toggle controls */
.table-action-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.loop-toggle-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

.table-toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.table-toggle-label input[type="checkbox"] {
    margin: 0;
    transform: scale(0.9);
}

.table-toggle-text {
    user-select: none;
    font-weight: 500;
}

.table-toggle-label:hover .table-toggle-text {
    color: #333;
}

/* Responsive adjustments for table toggles */
@media (max-width: 768px) {
    .table-action-controls {
        gap: 6px;
    }

    .table-toggle-label {
        font-size: 11px;
    }
}

/* Clean slate - let Leaflet handle default marker styling */

/* Selected location markers now use default Leaflet styling */





/* ===== ROUTE CONTAINER ===== */
#route-container {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-2);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#route-container h3 {
    margin-bottom: 1rem;
    color: #333;
    flex-shrink: 0;
}

/* Compact route stats for Time Trial mode */
.route-stats-compact {
    margin: 0;
    font-size: 12px;
    color: #666;
    line-height: 1.3;
    white-space: nowrap;
}

/* Table Styles */
.table-wrapper {
    flex: 1;
    overflow-y: auto;
    margin-top: 0.5rem;
    position: relative;
}

#checkpoints-table {
    width: 100%;
    border-collapse: collapse;
}

#checkpoints-table th,
#checkpoints-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
    vertical-align: middle;
}

#checkpoints-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 13px;
    padding: 10px 12px;
}

#checkpoints-table td {
    font-size: 14px;
    line-height: 1.4;
}

/* First column (number) - make it narrower */
#checkpoints-table th:first-child,
#checkpoints-table td:first-child {
    width: 40px;
    text-align: center;
    padding: 8px 8px;
}

/* Radius column - optimize for dropdown */
#checkpoints-table th:nth-child(3),
#checkpoints-table td:nth-child(3) {
    width: 90px;
    text-align: center;
}

/* Last column (actions) - optimize for buttons */
#checkpoints-table th:last-child,
#checkpoints-table td:last-child {
    width: 120px;
    text-align: center;
}

.remove-checkpoint {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 70px;
}

.remove-checkpoint:hover {
    background: #ff5252;
}

.edit-checkpoint {
    background: white;
    color: #666;
    border: 1px solid #ccc;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 70px;
    margin-right: 8px;
}

.edit-checkpoint:hover {
    background: #f5f5f5;
    border-color: #999;
}

.button-group {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.checkpoint-name {
    display: inline-block;
    margin-right: 8px;
    font-weight: 500;
}

.editable-name {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.editable-name:hover {
    background-color: #f0f4ff;
    color: #667eea;
}

/* Simplified editable checkpoint name styling */
.checkpoint-name.editable-name {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    display: inline-block;
    width: 100%;
}

.checkpoint-name.editable-name:hover {
    background-color: #f8f9fa;
}

.edit-indicator {
    opacity: 0.5;
    font-size: 12px;
    margin-left: 6px;
    transition: opacity 0.2s ease;
}

.checkpoint-name.editable-name:hover .edit-indicator {
    opacity: 0.8;
}

/* Radius Select Dropdown */
.radius-select {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
    text-align: center;
}

.radius-select:hover {
    border-color: var(--primary-400);
}

.radius-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Modal Form Styling */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 14px;
}

.radius-select-modal {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.radius-select-modal:hover {
    border-color: var(--primary-400);
}

.radius-select-modal:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkpoint-status {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.checkpoint-status.completed {
    color: #28a745;
    font-weight: 600;
}

.checkpoint-status.active {
    color: #667eea;
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    main {
        padding: var(--space-1);
        gap: var(--space-2);
    }

    #route-container {
        padding: var(--space-4);
    }

    .map-controls {
        top: 8px;
        left: 8px;
    }

    .control-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Mobile positioning for GPS status and location button */
    .location-status.map-overlay {
        width: 100px; /* Fixed width for mobile */
        right: 8px;
    }
    
    .location-btn {
        bottom: 50px; /* Higher position for mobile to clear attribution */
        right: 16px;
        width: 44px; /* Slightly smaller for mobile */
        height: 44px;
        font-size: 1.2rem; /* Icon size for mobile */
    }

    .add-checkpoint-btn {
        bottom: 105px; /* Above the location button on mobile */
        right: 16px;
        height: 32px;
        padding: 0 10px;
        font-size: 12px;
        border-radius: 16px;
    }
    }

    #checkpoints-table th,
    #checkpoints-table td {
        padding: 6px 8px;
        font-size: 12px;
    }

    #checkpoints-table th {
        padding: 8px 8px;
        font-size: 11px;
    }

    #checkpoints-table th:first-child,
    #checkpoints-table td:first-child {
        width: 30px;
        padding: 6px 4px;
    }

    #checkpoints-table th:nth-child(3),
    #checkpoints-table td:nth-child(3) {
        width: 80px;
        padding: 6px 4px;
    }

    #checkpoints-table th:last-child,
    #checkpoints-table td:last-child {
        width: 100px;
    }

    .radius-select {
        width: 65px;
        font-size: 12px;
        padding: 3px 6px;
    }

    .remove-checkpoint {
        padding: 4px 8px;
        font-size: 11px;
        min-width: 60px;
    }

    .edit-checkpoint {
        padding: 4px 8px;
        font-size: 11px;
        min-width: 60px;
        margin-right: 6px;
    }

    .edit-indicator {
        font-size: 10px;
        margin-left: 4px;
    }

    .remove-checkpoint {
        padding: 2px 6px;
        font-size: 10px;
    }

    .edit-checkpoint {
        padding: 2px 6px;
        font-size: 10px;
        min-width: 50px;
        margin-right: 4px;
    }

    .mode-switcher {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        padding: 0.25rem;
        gap: 0;
        background: var(--gray-100);
        border-radius: var(--radius-xl);
        flex-wrap: nowrap;
        margin: 0 auto;
    }

    .mode-btn {
        padding: 0.5rem 1rem;
        font-size: 12px;
    }

    .nav-btn {
        font-size: 12px;
        padding: 0.2rem 0.4rem;
    }

    .nav-trial-btn {
        padding: 0.2rem 0.6rem;
        font-size: 11px;
        gap: 0.2rem;
    }

    .countdown-display h2 {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    .countdown-number {
        font-size: 6rem;
    }

    .countdown-text {
        font-size: 1rem;
        margin: 0.5rem 0 2rem 0;
    }

    .cancel-countdown-btn {
        padding: 0.6rem 1.5rem;
        font-size: 14px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.5rem 0.25rem;
        font-size: 12px;
    }

    .leaderboard-date {
        font-size: 11px;
    }



    .option-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .option-control {
        margin-left: 0;
        align-self: flex-end;
    }

    .logout-btn {
        padding: 0.5rem 1rem;
        font-size: 12px;
    }

    .route-header,
    .trial-route-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }



    .route-stats-compact {
        font-size: 11px;
        white-space: normal;
        /* Allow wrapping on very small screens */
    }

    .no-route-placeholder {
        padding: 1.5rem 1rem;
    }

    .placeholder-icon {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
    }

    .placeholder-content h4 {
        font-size: 16px;
    }

    .placeholder-content p {
        font-size: 13px;
        margin-bottom: 1rem;
    }

    #create-route-placeholder-btn {
        padding: 0.6rem 1.2rem;
        font-size: 13px;
    }

/* Route Header */
/* Route Editor header - styled as a card to match Time Trial */
.route-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: white;
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
    width: 100%;
}

/* Time Trial header - inside the time-trial-section card */
.trial-route-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.route-header.hidden {
    display: none !important;
}



/* No Route Placeholder */
/* ===== NO ROUTE PLACEHOLDER ===== */
.no-route-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6) var(--space-4);
    text-align: center;
}

.placeholder-content {
    max-width: 320px;
    padding: var(--space-6);
    background: var(--gray-50);
    border-radius: var(--radius-2xl);
    border: 2px dashed var(--gray-300);
}

.placeholder-icon {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--space-4);
    opacity: 0.8;
}

.placeholder-content h4 {
    margin: 0 0 var(--space-2) 0;
    color: var(--gray-800);
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.placeholder-content p {
    margin: 0 0 var(--space-6) 0;
    color: var(--gray-600);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

#create-route-placeholder-btn {
    padding: var(--space-3) var(--space-6);
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    font-size: var(--font-size-sm);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    box-shadow: var(--shadow-lg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#create-route-placeholder-btn:hover {
    background: var(--primary-600);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

#create-route-placeholder-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.action-btn {
    font-size: 12px;
    font-weight: 500;
}

.cancel-btn {
    padding: 8px 12px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.cancel-btn:hover {
    background: #5a6268;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* Fullscreen Modal */
.fullscreen-modal {
    background-color: rgba(0, 0, 0, 0.8);
}

.fullscreen-content {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e1e5e9;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body input,
.modal-body textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
}

.modal-body textarea {
    min-height: 80px;
}

.input-helper {
    margin: -0.5rem 0 1rem 0;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Saved Routes List */
#saved-routes-list {
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.route-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e1e5e9;
}

.route-item:last-child {
    margin-bottom: 0;
}

.route-item h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 16px;
}

.route-item p {
    margin: 0 0 0.5rem 0;
    color: #666;
    font-size: 14px;
}

.route-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.route-stats {
    font-size: 12px;
    color: #666;
}

.route-item-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.route-item-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    flex: 1;
}

.route-item-actions .load-route-btn {
    flex: 2 !important;
    width: auto !important;
}

.route-item-actions .delete-route-btn {
    flex: 1 !important;
    width: auto !important;
}

.load-route-btn {
    background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.load-route-btn:hover {
    background: linear-gradient(135deg, var(--success-600) 0%, var(--success-700) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.load-route-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.delete-route-btn {
    background: linear-gradient(135deg, var(--error-500) 0%, var(--error-600) 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.delete-route-btn:hover {
    background: linear-gradient(135deg, var(--error-600) 0%, var(--error-700) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.delete-route-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.empty-routes {
    text-align: center;
    color: #666;
    padding: 2rem;
}

/* Viewport Management */
@supports (height: 100dvh) {
    .screen {
        height: 100dvh;
    }

    body {
        height: 100dvh;
    }
}

/* Prevent overscroll on mobile */
body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

/* Time Trial Styles */
/* ===== TIME TRIAL STYLES ===== */
#time-trial-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    margin-bottom: var(--space-2);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
}

/* Route Info Header */
/* Unified styling for route name and distance displays */
.route-name-display {
    font-family: 'Racing Sans One', sans-serif;
    font-size: var(--font-size-lg);
    font-weight: 400;
    color: var(--gray-900);
    text-align: left;
    grid-column: 1;
}

.route-distance-display {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-lg);
    text-align: center;
    grid-column: 2;
    justify-self: end;
}

/* Timer Container */
.timer-container {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-4);
}

/* Trial Control Button */
.trial-control-container {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.trial-control-btn {
    width: 100%;
    max-width: 400px;
    padding: var(--space-4) var(--space-6);
    font-size: var(--font-size-lg);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
}

.trial-control-btn.start-btn {
    background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.trial-control-btn.start-btn:hover {
    background: linear-gradient(135deg, var(--success-600) 0%, var(--success-700) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.trial-control-btn.start-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.trial-control-btn.stop-btn {
    background: linear-gradient(135deg, var(--error-500) 0%, var(--error-600) 100%);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.trial-control-btn.stop-btn:hover {
    background: linear-gradient(135deg, var(--error-600) 0%, var(--error-700) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.trial-control-btn.reset-btn {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.trial-control-btn.reset-btn:hover {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.time-trial-header h4 {
    margin: 0;
    color: var(--primary-700);
    font-size: var(--font-size-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timer-display {
    font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-900);
    background: var(--gray-50);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-xl);
    border: 2px solid var(--gray-200);
    text-align: center;
    box-shadow: var(--shadow-sm);
    letter-spacing: 0.05em;
    min-width: 280px;
}





/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.hidden {
    display: none !important;
}

/* Empty Route Overlay */
.empty-route-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.empty-route-content {
    text-align: center;
    padding: var(--space-8);
    max-width: 300px;
}

.empty-route-icon {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-4);
    opacity: 0.6;
}

.empty-route-content p {
    margin: 0;
    color: var(--gray-600);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    font-weight: 500;
}

/* Mobile Modal Adjustments */
@media (max-width: 768px) {
    .modal.active {
        align-items: flex-start;
        padding: 0.5rem 0;
        overflow-y: auto;
    }

    .modal-content {
        width: 95%;
        margin: 0 auto;
        max-height: calc(100vh - 1rem);
        min-height: auto;
        position: relative;
        top: 0;
        transform: none;
    }

    .modal-header,
    .modal-body {
        padding: 1rem;
    }

    /* Ensure modal content is scrollable and buttons remain accessible */

    /* Route modal buttons mobile adjustments */
    .route-item-actions {
        gap: 8px;
        flex-wrap: wrap;
    }

    .route-item-actions button {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .route-item-actions .load-route-btn {
        flex: 2 !important;
        width: auto !important;
    }

    .route-item-actions .delete-route-btn {
        flex: 1 !important;
        width: auto !important;
    }

    .modal-body {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }

    /* Make sure action buttons are always visible */
    .modal-actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 1rem;
        margin: 0;
        border-top: 1px solid #e1e5e9;
        border-radius: 0 0 12px 12px;
    }

    /* Additional adjustments when keyboard is visible */
    body.keyboard-visible .modal.active {
        align-items: flex-start;
        padding-top: 0.25rem;
    }

    body.keyboard-visible .modal-content {
        max-height: 75vh;
    }

    body.keyboard-visible .modal-body {
        max-height: calc(75vh - 120px);
    }

    .route-actions {
        flex-direction: column;
    }

    .nav-links {
        gap: 1rem;
        font-size: 12px;
    }

    .route-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Options section mobile adjustments */
    #options-section {
        border-radius: var(--radius-lg);
    }

    .options-sections-container {
        /* Ensure smooth scrolling on mobile */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        border-radius: var(--radius-lg);
    }

    .options-section {
        padding: 1rem 1.5rem;
    }

    .options-section h4 {
        font-size: 16px;
    }

    .option-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Mobile responsive for confirm modal */
    .confirm-modal-content {
        max-width: 95%;
        margin: 1rem;
    }

    .confirm-modal-header {
        padding: 1rem;
    }

    .confirm-modal-body {
        padding: 1rem;
    }

    .confirm-modal-actions {
        padding: 0.75rem 1rem 1rem;
        gap: 8px;
    }

    .confirm-cancel-btn,
    .confirm-ok-btn {
        padding: 8px 16px;
        font-size: 13px;
        min-width: 70px;
    }

    /* Mobile responsive for email confirmation modal */
    .email-confirmation-content {
        max-width: 95%;
        margin: 1rem;
    }

    .email-confirmation-header {
        padding: 1rem;
    }

    .email-confirmation-body {
        padding: 1rem;
    }

    .email-confirmation-actions {
        padding: 0.75rem 1rem 1rem;
        gap: 8px;
    }
}


/* ===== COOKIE CONSENT BANNER ===== */
.consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-top: 2px solid var(--primary-500);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    padding: 1.5rem;
    animation: slideUp 0.3s ease-out;
}

.consent-banner.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.consent-content {
    max-width: 1200px;
    margin: 0 auto;
}

.consent-content h3 {
    margin: 0 0 0.75rem 0;
    color: var(--primary-700);
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.consent-content p {
    margin: 0 0 1rem 0;
    color: var(--gray-700);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.consent-details {
    background: var(--gray-50);
    border-left: 3px solid var(--primary-300);
    padding: 0.75rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--gray-600);
    line-height: 1.6;
}

.consent-details strong {
    color: var(--gray-800);
    font-weight: 600;
}

.consent-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.consent-actions .button-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.consent-actions .button-primary:hover {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.consent-actions .button-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.consent-actions .button-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.consent-actions .button-secondary:hover {
    background: var(--gray-200);
    color: var(--gray-800);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.consent-actions .button-secondary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.consent-actions .consent-link {
    color: var(--primary-600);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: 0.75rem 1rem;
    transition: color var(--transition-base);
}

.consent-actions .consent-link:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* Mobile responsive for consent banner */
@media (max-width: 768px) {
    .consent-banner {
        padding: 1rem;
    }

    .consent-content h3 {
        font-size: var(--font-size-base);
    }

    .consent-content p {
        font-size: 0.8125rem;
    }

    .consent-details {
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .consent-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .consent-actions .button-primary,
    .consent-actions .button-secondary {
        width: 100%;
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
    }

    .consent-actions .consent-link {
        width: 100%;
        text-align: center;
        padding: 0.5rem;
    }
}

/* Accessibility improvements for consent banner */
.consent-banner:focus-within {
    outline: 2px solid var(--primary-500);
    outline-offset: -2px;
}

.consent-actions button:focus,
.consent-actions a:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .consent-banner {
        border-top: 3px solid var(--primary-700);
    }

    .consent-details {
        border-left: 4px solid var(--primary-500);
    }
}

/* ===== PRIVACY POLICY SCREEN ===== */
#privacy-policy-screen {
    background: var(--gray-50);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.policy-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    background: white;
    min-height: 100vh;
}

.policy-container .back-button {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.policy-container .back-button:hover {
    background: var(--gray-200);
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

.policy-container h1 {
    font-family: 'Racing Sans One', sans-serif;
    color: var(--primary-700);
    font-size: var(--font-size-3xl);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.policy-container .last-updated {
    color: var(--gray-500);
    font-size: var(--font-size-sm);
    font-style: italic;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.policy-section {
    margin-bottom: 2.5rem;
}

.policy-section h2 {
    color: var(--primary-600);
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: 1rem;
    margin-top: 0;
    line-height: 1.3;
}

.policy-section h3 {
    color: var(--gray-800);
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
    line-height: 1.4;
}

.policy-section p {
    color: var(--gray-700);
    font-size: var(--font-size-base);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.policy-section ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 1rem;
}

.policy-section ul li {
    color: var(--gray-700);
    font-size: var(--font-size-base);
    line-height: 1.7;
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.policy-section ul li::before {
    content: "•";
    color: var(--primary-500);
    font-weight: bold;
    font-size: 1.2em;
    position: absolute;
    left: 0;
    top: -0.1em;
}

.policy-section ul li strong {
    color: var(--gray-900);
    font-weight: 600;
}

.policy-section a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-base);
    word-break: break-all;
}

.policy-section a:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

.policy-note {
    background: var(--primary-50);
    border-left: 4px solid var(--primary-500);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.policy-note strong {
    color: var(--primary-700);
    font-weight: 700;
}

.privacy-choices-summary {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1rem;
}

.choice-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.choice-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.choice-icon {
    font-size: var(--font-size-2xl);
    flex-shrink: 0;
    line-height: 1;
}

.choice-content {
    flex: 1;
    color: var(--gray-700);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.choice-content strong {
    color: var(--gray-900);
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

/* Mobile responsive for privacy policy */
@media (max-width: 768px) {
    .policy-container {
        padding: 1.5rem 1rem;
    }

    .policy-container h1 {
        font-size: var(--font-size-2xl);
    }

    .policy-section h2 {
        font-size: var(--font-size-lg);
    }

    .policy-section h3 {
        font-size: var(--font-size-base);
    }

    .policy-section p,
    .policy-section ul li {
        font-size: var(--font-size-sm);
    }

    .choice-item {
        gap: 0.75rem;
    }

    .choice-icon {
        font-size: var(--font-size-xl);
    }
}

/* Print styles for privacy policy */
@media print {
    .policy-container .back-button {
        display: none;
    }

    .policy-container {
        max-width: 100%;
        padding: 0;
    }

    .policy-section {
        page-break-inside: avoid;
    }

    .policy-section h2 {
        page-break-after: avoid;
    }
}

/* Accessibility improvements for privacy policy */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-600);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--radius-md);
    z-index: 100;
    transition: top var(--transition-base);
}

.skip-link:focus {
    top: 0.5rem;
    outline: 2px solid var(--primary-700);
    outline-offset: 2px;
}

.policy-container a:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.policy-container .back-button:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .policy-section h2 {
        color: var(--primary-700);
        border-bottom: 2px solid var(--primary-700);
        padding-bottom: 0.5rem;
    }

    .policy-note {
        border-left: 6px solid var(--primary-600);
    }

    .privacy-choices-summary {
        border: 2px solid var(--gray-400);
    }
}
