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

:root {
    --primary: #10B981;
    --primary-dark: #059669;
    --primary-light: #D1FAE5;
    --secondary: #3B82F6;
    --accent: #8B5CF6;
    --danger: #EF4444;
    --warning: #F59E0B;
    --dark: #0f172a;
    --darker: #020617;
    --card-bg: rgba(255, 255, 255, 0.98);
    --text: #1f2937;
    --text-light: #6b7280;
    --glass: rgba(15, 23, 42, 0.75);
    --glass-light: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(24px);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.24);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    background: var(--darker);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== CAMERA FEED ==================== */
#video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

#canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* ==================== LIVE INDICATOR ==================== */
#live-indicator {
    position: fixed;
    top: 100px;
    right: 16px;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 10px 16px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    z-index: 50;
    letter-spacing: 1.2px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-lg);
}

.pulse {
    width: 8px;
    height: 8px;
    background: #EF4444;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

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

/* ==================== LANGUAGE BUTTON ==================== */
#lang-btn {
    position: fixed;
    top: 100px;
    left: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 22px;
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

#lang-btn:hover {
    transform: scale(1.05);
    background: rgba(15, 23, 42, 0.85);
}

#lang-btn:active {
    transform: scale(0.98);
}

/* ==================== STATS HEADER ==================== */
#stats {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: white;
    padding: 14px 18px;
    border-radius: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 40;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-xl);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.stat-icon {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.stat-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-value {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.stat-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 2px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== LOCATION BADGE ==================== */
#location-badge {
    position: fixed;
    top: 165px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

#location-badge:hover {
    transform: translateX(-50%) scale(1.02);
    background: rgba(15, 23, 42, 0.85);
}

#location-badge span:first-child {
    font-size: 16px;
}

/* ==================== MODE TOGGLE ==================== */
#mode-toggle {
    position: fixed;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 80;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 6px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-lg);
}

.mode-btn {
    padding: 12px 20px;
    border-radius: 22px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
}

.mode-btn span:first-child {
    font-size: 18px;
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.mode-btn:not(.active):hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ==================== BARCODE OVERLAY ==================== */
#barcode-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 45;
    text-align: center;
}

.barcode-frame {
    width: 300px;
    height: 220px;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.2);
}

.barcode-corner {
    position: absolute;
    width: 32px;
    height: 32px;
    border: 4px solid var(--primary);
}

.barcode-corner.tl {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
    border-radius: 12px 0 0 0;
}

.barcode-corner.tr {
    top: -2px;
    right: -2px;
    border-left: none;
    border-bottom: none;
    border-radius: 0 12px 0 0;
}

.barcode-corner.bl {
    bottom: -2px;
    left: -2px;
    border-right: none;
    border-top: none;
    border-radius: 0 0 0 12px;
}

.barcode-corner.br {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 12px 0;
}

.barcode-line {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--danger), transparent);
    animation: scanLine 2s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
}

@keyframes scanLine {
    0%, 100% {
        top: 15%;
        opacity: 0.5;
    }
    50% {
        top: 85%;
        opacity: 1;
    }
}

.barcode-hint {
    color: white;
    margin-top: 20px;
    font-size: 15px;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-block;
}

/* ==================== SCAN BUTTON ==================== */
#scan-btn {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    padding: 18px 48px;
    font-size: 15px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 32px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.5),
                0 0 0 0 rgba(16, 185, 129, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#scan-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 12px 40px rgba(16, 185, 129, 0.6),
                0 0 0 0 rgba(16, 185, 129, 0.4);
}

#scan-btn:active {
    transform: translateX(-50%) scale(0.96);
}

#scan-btn.scanning {
    background: linear-gradient(135deg, var(--warning) 0%, #D97706 100%);
    animation: scanPulse 1.5s ease-in-out infinite;
}

@keyframes scanPulse {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(245, 158, 11, 0.5),
                    0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 8px 32px rgba(245, 158, 11, 0.7),
                    0 0 0 20px rgba(245, 158, 11, 0);
    }
}

#scan-icon {
    font-size: 20px;
}

/* ==================== BOTTOM NAVIGATION ==================== */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    display: flex;
    justify-content: space-around;
    padding: 10px 8px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 90;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
}

.nav-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 16px;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    min-width: 70px;
}

.nav-btn span:first-child {
    font-size: 24px;
    transition: all 0.3s ease;
}

.nav-btn.active {
    color: var(--primary);
    background: rgba(16, 185, 129, 0.15);
}

.nav-btn.active span:first-child {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.6));
}

.nav-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

/* ==================== RESULT CARD ==================== */
#result {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: 32px 32px 0 0;
    padding: 16px 20px 28px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 -12px 60px rgba(0, 0, 0, 0.4);
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#result.hidden {
    transform: translateY(120%);
}

.result-handle {
    width: 48px;
    height: 5px;
    background: #d1d5db;
    border-radius: 3px;
    margin: 0 auto 16px;
}

#result-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

#result-icon {
    font-size: 48px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

#result-title {
    font-size: 26px;
    font-weight: 800;
    text-transform: capitalize;
    color: var(--dark);
    line-height: 1.2;
}

#result-category {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 24px;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 16px;
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Location Rules */
.location-rules {
    background: linear-gradient(135deg, #DBEAFE, #BFDBFE);
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 16px;
    display: none;
    border: 2px solid #93C5FD;
}

.location-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #1E40AF;
}

.location-rules p {
    color: #1E3A8A;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 500;
}

/* Info Rows */
#result-content {
    margin-top: 8px;
}

.info-row {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
}

.info-row:last-child {
    border-bottom: none;
}

.info-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.info-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
}

/* Points Earned */
.points-earned {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    color: #92400E;
    padding: 12px 16px;
    border-radius: 16px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    box-shadow: var(--shadow-sm);
    animation: slideUp 0.5s ease;
}

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

.points-earned span:first-child {
    font-size: 24px;
}

/* Buttons */
.search-button,
.close-button {
    width: 100%;
    padding: 14px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: none;
}

.search-button {
    background: linear-gradient(135deg, var(--secondary), #2563EB);
    color: white;
    margin-bottom: 10px;
    box-shadow: var(--shadow-md);
}

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

.search-button:active {
    transform: translateY(0);
}

.close-button {
    background: #f1f5f9;
    color: var(--text);
}

.close-button:hover {
    background: #e2e8f0;
}

/* ==================== MODALS ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 2000;
    padding: 0;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

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

.modal-content {
    background: white;
    border-radius: 28px 28px 0 0;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUpModal 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-large {
    max-height: 90vh;
}

@keyframes slideUpModal {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 800;
    color: var(--dark);
}

.close-modal {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-light);
}

.close-modal:hover {
    background: #e2e8f0;
    color: var(--text);
}

/* ==================== CHALLENGES ==================== */
.challenges-container,
.leaderboard-container,
.nearby-container {
    padding: 20px 24px 28px;
    overflow-y: auto;
    flex: 1;
}

.loading-spinner-small {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 14px;
}

.challenge-card {
    background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
    padding: 18px;
    border-radius: 20px;
    margin-bottom: 14px;
    border: 2px solid #BBF7D0;
    transition: all 0.3s ease;
}

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

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.challenge-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
}

.challenge-reward {
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.challenge-desc {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
    line-height: 1.5;
}

.challenge-progress {
    width: 100%;
    height: 8px;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.challenge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.challenge-status {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-dark);
}

/* ==================== LEADERBOARD ==================== */
.leaderboard-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 24px 8px;
    border-bottom: 1px solid #f1f5f9;
}

.lb-tab {
    flex: 1;
    padding: 10px 16px;
    background: #f8fafc;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-light);
}

.lb-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.lb-tab:hover:not(.active) {
    background: #f1f5f9;
}

.lb-entry {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
}

.lb-rank {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

.lb-entry.top3 .lb-rank {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    color: #92400E;
    font-size: 20px;
}

.lb-entry.top1 .lb-rank {
    background: linear-gradient(135deg, #FDE047, #FACC15);
}

.lb-info {
    flex: 1;
}

.lb-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 2px;
}

.lb-stats {
    font-size: 12px;
    color: var(--text-light);
}

.lb-points {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
}

/* ==================== NEARBY FACILITIES ==================== */
.nearby-card {
    background: #f8fafc;
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.nearby-card:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.nearby-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.nearby-info {
    flex: 1;
}

.nearby-info h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--dark);
}

.nearby-info p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.nearby-accepts {
    font-size: 12px;
    color: var(--text);
    font-weight: 600;
}

.nearby-directions {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--secondary);
    border: none;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.nearby-directions:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* ==================== LANGUAGE SELECTOR ==================== */
.language-list {
    padding: 20px 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lang-option {
    padding: 16px;
    background: #f8fafc;
    border: 2px solid transparent;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    color: var(--text);
}

.lang-option:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.lang-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ==================== LOADING SCREEN ==================== */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--dark) 0%, var(--darker) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

#loading.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.logo-animation {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    position: relative;
}

.logo-emoji {
    font-size: 72px;
    animation: float 2s ease-in-out infinite;
    filter: drop-shadow(0 8px 24px rgba(16, 185, 129, 0.5));
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(5deg);
    }
}

.loading-content h2 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff, #d1d5db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-content p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    margin-bottom: 24px;
    font-weight: 500;
}

.progress-bar {
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin: 0 auto;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    animation: progress 2s ease-in-out infinite;
    border-radius: 3px;
}

@keyframes progress {
    0% {
        width: 0%;
        transform: translateX(0);
    }
    50% {
        width: 80%;
    }
    100% {
        width: 100%;
        transform: translateX(0);
    }
}

/* ==================== SEARCH MODAL ==================== */
.search-results {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.search-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.spinner-small {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.search-item {
    background: #f8fafc;
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--secondary);
    transition: all 0.3s ease;
}

.search-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.search-item h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
}

.search-item p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 10px;
    line-height: 1.5;
}

.search-item a {
    color: var(--secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.search-item a:hover {
    text-decoration: underline;
}

/* ==================== INSTRUCTIONS ==================== */
.instructions {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

.instructions.hidden {
    display: none;
}

.instruction-card {
    background: white;
    padding: 32px 28px;
    border-radius: 28px;
    text-align: center;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.instruction-icon {
    font-size: 64px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(16, 185, 129, 0.3));
}

.instruction-card h3 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--dark);
}

.instruction-card p {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 15px;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.feature {
    background: linear-gradient(135deg, var(--primary-light), #A7F3D0);
    color: var(--primary-dark);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    border: 2px solid #6EE7B7;
}

#got-it-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

#got-it-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

#got-it-btn:active {
    transform: translateY(0);
}

/* ==================== OBJECT SELECTION ==================== */
.object-list-container {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.object-list-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.object-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.object-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.object-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.object-item.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.obj-num {
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}

.object-item.selected .obj-num {
    background: rgba(255, 255, 255, 0.25);
}

.obj-icon {
    font-size: 16px;
}

.obj-name {
    font-weight: 700;
    text-transform: capitalize;
}

.obj-conf {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 600;
}

.object-item.selected .obj-conf {
    color: rgba(255, 255, 255, 0.85);
}

/* ==================== CRAFTS SECTION ==================== */
.crafts-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid #f1f5f9;
}

.craft-ideas-box {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 16px;
    border: 2px solid #FCD34D;
}

.craft-ideas-box h4 {
    color: #92400E;
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 800;
}

.craft-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.craft-chip {
    background: white;
    color: #92400E;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(146, 64, 14, 0.1);
}

/* ==================== UTILITIES ==================== */
.hidden {
    display: none !important;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 380px) {
    #stats {
        padding: 12px 14px;
        gap: 14px;
    }

    .stat-value {
        font-size: 16px;
    }

    #scan-btn {
        padding: 16px 36px;
        font-size: 14px;
    }

    .mode-btn {
        padding: 10px 16px;
        font-size: 12px;
    }

    .feature-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 320px) {
    #stats {
        gap: 10px;
        padding: 10px 12px;
    }

    .stat-icon {
        font-size: 20px;
    }

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

/* Safe area support for notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    #bottom-nav {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    #result {
        bottom: calc(70px + env(safe-area-inset-bottom));
    }

    #scan-btn {
        bottom: calc(110px + env(safe-area-inset-bottom));
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
