        * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
        
        /* Feedback on tap for all interactive elements */
        button, .btn, .header-btn, .header-back, .header-menu, .header-delete, .header-tokens,
        .location-card, .plant-card, .fab, .position-chip, .photo-thumb, .recognition-card, .batch-option {
            transition: transform 0.1s, opacity 0.1s;
        }
        button:active, .btn:active, .header-btn:active, .header-back:active, .header-menu:active, 
        .header-delete:active, .header-tokens:active, .fab:active, .position-chip:active,
        .recognition-card:active, .batch-option:active {
            transform: scale(0.95);
        }
        .location-card:active, .plant-card:active {
            opacity: 0.7;
        }
        .photo-thumb:active {
            transform: scale(0.9);
        }
        :root {
            --green: #4A7C59;
            --green-dark: #3d6b4a;
            --green-light: #E8F5E9;
            --gray-bg: #F5F5F5;
            --gray-text: #888888;
            --dark: #333333;
            --yellow: #F9A825;
            --red: #E74C3C;
            --safe-top: env(safe-area-inset-top);
            --safe-bottom: env(safe-area-inset-bottom);
        }
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--gray-bg);
            color: var(--dark);
            min-height: 100vh;
            overflow-x: hidden;
        }
        .app {
            max-width: 500px;
            margin: 0 auto;
            background: #fff;
            min-height: 100vh;
        }
        .header {
            background: var(--green);
            color: #fff;
            padding: calc(15px + var(--safe-top)) 15px 15px;
            display: flex;
            align-items: center;
            gap: 12px;
            position: sticky;
            top: 0;
            z-index: 100;
        }
        .header-back { 
            font-size: 28px; 
            cursor: pointer; 
            padding: 5px 15px 5px 5px; 
            display: none;
            align-items: center;
            gap: 4px;
        }
        .header-back.visible { display: flex; }
        .header-back-text {
            font-size: 16px;
            font-weight: 500;
        }
        .header-back:active {
            opacity: 0.7;
        }
        .header-title { font-size: 18px; font-weight: 600; flex: 1; }
        .header-tokens {
            background: rgba(255,255,255,0.2);
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .header-tokens:active {
            background: rgba(255,255,255,0.3);
        }
        .header-btn {
            font-size: 24px;
            cursor: pointer;
            padding: 8px;
            background: rgba(255,255,255,0.2);
            border-radius: 50%;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .header-menu {
            font-size: 20px;
            cursor: pointer;
            padding: 8px;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .header-delete {
            font-size: 20px;
            cursor: pointer;
            padding: 8px;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255,255,255,0.2);
            border-radius: 50%;
        }
        .header-delete:active {
            background: rgba(255,255,255,0.4);
        }
        .dropdown {
            position: absolute;
            top: calc(100% + 5px);
            right: 10px;
            background: #fff;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.15);
            min-width: 200px;
            overflow: hidden;
            display: none;
            z-index: 150;
            pointer-events: none;
        }
        .dropdown.show { display: block; pointer-events: auto; }
        .dropdown-item {
            padding: 14px 18px;
            font-size: 15px;
            color: var(--dark);
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .dropdown-item:active { background: var(--gray-bg); }
        .dropdown-divider { height: 1px; background: #eee; }
        .screen { display: none; padding-bottom: calc(90px + var(--safe-bottom)); }
        .screen.active { display: block; }
        .card {
            background: #fff;
            margin: 12px;
            border-radius: 16px;
            box-shadow: 0 2px 12px rgba(0,0,0,0.08);
            overflow: hidden;
            cursor: pointer;
            transition: transform 0.15s;
        }
        .card:active { transform: scale(0.98); }
        .location-card-header {
            padding: 16px;
            display: flex;
            align-items: center;
            gap: 14px;
            background: linear-gradient(135deg, var(--green-light) 0%, #fff 100%);
        }
        .location-icon {
            font-size: 36px;
            width: 56px;
            height: 56px;
            background: #fff;
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        .location-info h3 { font-size: 17px; font-weight: 600; }
        .location-info p { font-size: 13px; color: var(--gray-text); margin-top: 3px; }
        .location-stats {
            padding: 12px 16px;
            display: flex;
            justify-content: space-between;
            background: #fafafa;
        }
        .location-count { font-size: 14px; color: var(--green); font-weight: 600; }
        .plant-card { display: flex; gap: 14px; padding: 14px; }
        .plant-photo {
            width: 72px;
            height: 72px;
            border-radius: 12px;
            background: var(--green-light);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 32px;
            flex-shrink: 0;
            overflow: hidden;
        }
        .plant-photo img { width: 100%; height: 100%; object-fit: cover; }
        .plant-info { flex: 1; min-width: 0; }
        .plant-info h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
        .plant-badge {
            display: inline-block;
            background: var(--green-light);
            color: var(--green);
            font-size: 11px;
            font-weight: 500;
            padding: 3px 10px;
            border-radius: 12px;
            margin-bottom: 6px;
        }
        .plant-meta { font-size: 13px; color: var(--gray-text); }
        .plant-note { font-size: 12px; color: var(--yellow); margin-top: 4px; }
        .filter-bar {
            display: flex;
            gap: 8px;
            padding: 12px;
            overflow-x: auto;
            background: #fff;
            border-bottom: 1px solid #eee;
        }
        .filter-btn {
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 13px;
            font-weight: 500;
            white-space: nowrap;
            cursor: pointer;
            background: var(--gray-bg);
            color: var(--gray-text);
            border: none;
        }
        .filter-btn.active { background: var(--green); color: #fff; }
        .detail-photo {
            width: 100%;
            height: 280px;
            background: var(--green-light);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 120px;
            position: relative;
            overflow: hidden;
        }
        .detail-photo img { width: 100%; height: 100%; object-fit: cover; }
        .detail-photo-count {
            position: absolute;
            bottom: 12px;
            right: 12px;
            background: rgba(0,0,0,0.6);
            color: #fff;
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 12px;
        }
        .detail-content { padding: 20px; }
        .detail-name { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
        .detail-section { margin-top: 24px; }
        .detail-section h4 {
            font-size: 12px;
            font-weight: 600;
            color: var(--gray-text);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 10px;
        }
        .detail-section p { font-size: 15px; line-height: 1.6; }
        .detail-note {
            background: #FFF8E1;
            padding: 14px;
            border-radius: 12px;
            border-left: 4px solid var(--yellow);
        }
        .detail-desc {
            background: var(--green-light);
            padding: 14px;
            border-radius: 12px;
            border-left: 4px solid var(--green);
        }
        .photo-grid {
            display: flex;
            gap: 8px;
            overflow-x: auto;
            padding: 4px 0;
        }
        .photo-thumb {
            width: 64px;
            height: 64px;
            border-radius: 10px;
            background: var(--green-light);
            flex-shrink: 0;
            overflow: hidden;
            position: relative;
        }
        .photo-thumb-delete {
            position: absolute;
            top: 2px;
            right: 2px;
            width: 22px;
            height: 22px;
            background: rgba(0,0,0,0.6);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            cursor: pointer;
        }
        .photo-thumb-delete:active {
            background: rgba(231, 76, 60, 0.9);
        }
        .photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
        .photo-thumb-date {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(0,0,0,0.7);
            color: #fff;
            font-size: 9px;
            text-align: center;
            padding: 3px;
        }
        .btn-bar {
            position: fixed;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            max-width: 500px;
            padding: 12px;
            padding-bottom: calc(12px + var(--safe-bottom));
            background: #fff;
            box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
            display: flex;
            gap: 10px;
            z-index: 90;
        }
        .btn {
            flex: 1;
            padding: 16px;
            border: none;
            border-radius: 14px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            text-align: center;
            position: relative;
            z-index: 10;
            display: block;
            -webkit-tap-highlight-color: rgba(0,0,0,0.1);
        }
        .btn * { pointer-events: none; }
        .btn-primary { background: var(--green); color: #fff; }
        .btn-primary:active { background: var(--green-dark); }
        .btn-secondary { background: var(--gray-bg); color: var(--dark); }
        .fab {
            position: fixed;
            bottom: calc(24px + var(--safe-bottom));
            right: 24px;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: var(--green);
            color: #fff;
            font-size: 32px;
            border: none;
            box-shadow: 0 4px 20px rgba(74, 124, 89, 0.4);
            cursor: pointer;
            z-index: 90;
        }
        .fab:active { transform: scale(0.95); }
        .fab-group {
            position: fixed;
            bottom: calc(24px + var(--safe-bottom));
            right: 24px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            align-items: center;
            z-index: 90;
        }
        .fab-group .fab {
            position: static;
        }
        .fab-secondary {
            background: var(--gray-bg);
            color: var(--dark);
            font-size: 20px;
            width: 50px;
            height: 50px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.15);
        }
        /* Batch mode styles */
        .batch-photo-preview {
            width: 100%;
            height: 200px;
            border-radius: 12px;
            overflow: hidden;
            margin-bottom: 15px;
            background: var(--gray-bg);
        }
        .batch-photo-preview img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .batch-progress {
            text-align: center;
            padding: 10px;
            background: var(--green-light);
            border-radius: 8px;
            margin-bottom: 15px;
            font-size: 14px;
            color: var(--green);
            font-weight: 500;
        }
        .batch-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 15px;
        }
        .batch-option {
            border: 3px solid #eee;
            border-radius: 12px;
            overflow: hidden;
            cursor: pointer;
            transition: all 0.2s;
        }
        .batch-option:active, .batch-option.selected {
            border-color: var(--green);
            background: var(--green-light);
        }
        .batch-option img {
            width: 100%;
            height: 80px;
            object-fit: cover;
        }
        .batch-option-info {
            padding: 8px;
            text-align: center;
        }
        .batch-option-name {
            font-size: 12px;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .batch-option-score {
            font-size: 11px;
            color: var(--green);
        }
        .batch-option-manual {
            height: 80px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--gray-bg);
            font-size: 24px;
        }
        .batch-actions {
            display: flex;
            gap: 10px;
            margin-top: 15px;
        }
        .batch-actions .btn {
            flex: 1;
        }
        /* Onboarding styles */
        .onboarding-container {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 40px 30px;
        }
        .onboarding-slides {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            max-width: 400px;
        }
        .onboarding-slide {
            display: none;
            text-align: center;
            color: #fff;
            animation: fadeIn 0.3s ease;
        }
        .onboarding-slide.active {
            display: block;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .onboarding-emoji {
            font-size: 80px;
            margin-bottom: 30px;
        }
        .onboarding-slide h2 {
            font-size: 24px;
            font-weight: 700;
            margin-bottom: 16px;
        }
        .onboarding-slide p {
            font-size: 16px;
            opacity: 0.8;
            line-height: 1.5;
        }
        .onboarding-dots {
            display: flex;
            gap: 10px;
            margin: 40px 0;
        }
        .onboarding-dots .dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: rgba(255,255,255,0.3);
            transition: all 0.3s;
        }
        .onboarding-dots .dot.active {
            background: #fff;
            width: 24px;
            border-radius: 5px;
        }
        .onboarding-buttons {
            display: flex;
            gap: 16px;
            width: 100%;
            max-width: 400px;
        }
        .onboarding-skip {
            flex: 1;
            padding: 16px;
            border: none;
            border-radius: 14px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            background: rgba(255,255,255,0.1);
            color: rgba(255,255,255,0.7);
        }
        .onboarding-next {
            flex: 2;
            padding: 16px;
            border: none;
            border-radius: 14px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            background: var(--green);
            color: #fff;
        }
        .onboarding-next:active {
            background: var(--green-dark);
        }
        .modal {
            display: none;
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.5);
            z-index: 200;
            align-items: flex-end;
            justify-content: center;
        }
        .modal.active { display: flex; }
        .modal-content {
            background: #fff;
            width: 100%;
            max-width: 500px;
            border-radius: 20px 20px 0 0;
            padding: 20px;
            padding-bottom: calc(20px + var(--safe-bottom));
            max-height: 90vh;
            overflow-y: auto;
        }
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        .modal-title { font-size: 18px; font-weight: 600; }
        .modal-close { font-size: 24px; color: var(--gray-text); cursor: pointer; }
        .form-group { margin-bottom: 18px; }
        .form-label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-text); margin-bottom: 8px; }
        .form-input, .form-select {
            width: 100%;
            padding: 14px 16px;
            border: 2px solid #eee;
            border-radius: 12px;
            font-size: 16px;
            background: #fff;
        }
        .form-input:focus, .form-select:focus { outline: none; border-color: var(--green); }
        .form-row { display: flex; gap: 10px; }
        .form-row .form-group { flex: 1; }
        .photo-upload {
            width: 100%;
            height: 180px;
            border: 2px dashed #ddd;
            border-radius: 16px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            background: #fafafa;
            overflow: hidden;
            position: relative;
        }
        .photo-upload.has-photo { border: none; }
        .photo-upload img { width: 100%; height: 100%; object-fit: cover; }
        .photo-upload-icon { font-size: 48px; margin-bottom: 10px; }
        .photo-upload-text { color: var(--gray-text); font-size: 14px; }
        .photo-upload-badge {
            position: absolute;
            top: 10px;
            right: 10px;
            background: var(--green);
            color: #fff;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 600;
        }
        .empty { text-align: center; padding: 60px 30px; }
        .empty-icon { font-size: 72px; margin-bottom: 16px; }
        .empty h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
        .empty p { color: var(--gray-text); font-size: 14px; }
        .toast {
            position: fixed;
            bottom: calc(100px + var(--safe-bottom));
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background: var(--dark);
            color: #fff;
            padding: 14px 24px;
            border-radius: 12px;
            font-size: 14px;
            opacity: 0;
            transition: all 0.3s;
            z-index: 400;
            max-width: 90%;
            text-align: center;
        }
        .toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
        .loader-overlay {
            display: none;
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.7);
            z-index: 500;
            align-items: center;
            justify-content: center;
        }
        .loader-overlay.show { display: flex; }
        .loader-box {
            background: #fff;
            padding: 30px 40px;
            border-radius: 20px;
            text-align: center;
            min-width: 220px;
        }
        .loader-spinner {
            width: 50px;
            height: 50px;
            border: 4px solid var(--green-light);
            border-top-color: var(--green);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            margin: 0 auto 16px;
        }
        @keyframes spin { to { transform: rotate(360deg); } }
        .loader-text { font-size: 15px; color: var(--dark); font-weight: 500; }
        .recognition-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-bottom: 15px;
        }
        .recognition-card {
            border: 3px solid #eee;
            border-radius: 12px;
            overflow: hidden;
            cursor: pointer;
            transition: border-color 0.2s;
        }
        .recognition-card:active, .recognition-card.selected {
            border-color: var(--green);
        }
        .recognition-card img {
            width: 100%;
            height: 120px;
            object-fit: cover;
            display: block;
        }
        .recognition-card-info {
            padding: 8px;
            background: #fff;
        }
        .recognition-card-name {
            font-size: 13px;
            font-weight: 600;
            margin-bottom: 2px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .recognition-card-score {
            font-size: 11px;
            color: var(--green);
            font-weight: 600;
        }
        .recognition-card-score.low {
            color: var(--yellow);
        }
        .recognition-list { max-height: 300px; overflow-y: auto; }
        .recognition-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            border: 2px solid #eee;
            border-radius: 12px;
            margin-bottom: 10px;
            cursor: pointer;
        }
        .recognition-item:active, .recognition-item.selected { border-color: var(--green); background: var(--green-light); }
        .recognition-score {
            font-size: 14px;
            font-weight: 700;
            color: var(--green);
            min-width: 50px;
        }
        .recognition-score.low { color: var(--yellow); }
        .recognition-info { flex: 1; }
        .recognition-name { font-size: 15px; font-weight: 600; }
        .recognition-latin { font-size: 12px; color: var(--gray-text); font-style: italic; }
        .wiki-content {
            background: var(--green-light);
            padding: 16px;
            border-radius: 12px;
            margin-top: 10px;
            max-height: 200px;
            overflow-y: auto;
            font-size: 14px;
            line-height: 1.6;
        }
        .position-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 10px;
        }
        .position-chip {
            padding: 8px 14px;
            background: var(--gray-bg);
            border-radius: 20px;
            font-size: 13px;
            cursor: pointer;
            border: 2px solid transparent;
        }
        .position-chip:active, .position-chip.selected {
            background: var(--green-light);
            border-color: var(--green);
        }
    </style>
</head>
<body>
