Sarolanda commited on
Commit
5a10fb7
Β·
1 Parent(s): 6588e16

fix: remove duplicate methods from database.py

Browse files
Files changed (3) hide show
  1. app.py +325 -397
  2. index.html +1 -1
  3. static/style.css +445 -445
app.py CHANGED
@@ -1,397 +1,325 @@
1
- """
2
- app.py β€” PawMap
3
- Build Small Hackathon Β· Backyard AI Track Β· Junho 2026
4
- Custom frontend via gradio.Server
5
- """
6
- import json
7
- import logging
8
- import os
9
- import tempfile
10
- import time
11
- import uuid
12
- from pathlib import Path
13
-
14
- from gradio import Server
15
- from gradio.data_classes import FileData
16
- from fastapi.responses import HTMLResponse, JSONResponse
17
- from fastapi import Query
18
- from fastapi.staticfiles import StaticFiles
19
-
20
- from core.ai import AnimalAI
21
- from core.database import Database, DATA_DIR, PHOTOS_DIR
22
- from core.matcher import AnimalMatcher
23
- from core.seed import seed_if_empty
24
- from core.tracer import log_trace
25
-
26
- logging.basicConfig(level=logging.INFO)
27
- db = Database()
28
- ai = AnimalAI()
29
- matcher = AnimalMatcher()
30
- seed_if_empty(db) # popula o mapa com dados de demo se o banco estiver vazio
31
-
32
-
33
- def _photo_url(photo_path: str) -> str:
34
- """Convert DB-relative photo path to a URL served by the /photos/ static mount.
35
- photo_path is relative to DATA_DIR (e.g. 'photos/animal_42/abc.jpg').
36
- The static mount serves PHOTOS_DIR at /photos/, so we strip the 'photos/' prefix.
37
- """
38
- if not photo_path:
39
- return ""
40
- # Normalise separators
41
- p = photo_path.replace("\\", "/")
42
- if p.startswith("photos/"):
43
- p = p[len("photos/"):]
44
- return f"/photos/{p}"
45
-
46
- # In-memory session store for analyze β†’ confirm two-step flow
47
- _pending: dict[str, dict] = {}
48
-
49
- app = Server()
50
-
51
- # Serve photos as static files at /photos/...
52
- PHOTOS_DIR.mkdir(parents=True, exist_ok=True)
53
- app.mount("/photos", StaticFiles(directory=str(PHOTOS_DIR)), name="photos")
54
-
55
- # Serve frontend assets (CSS, JS, images) at /static/...
56
- STATIC_DIR = Path(__file__).parent / "static"
57
- STATIC_DIR.mkdir(exist_ok=True)
58
- app.mount("/static", StaticFiles(directory=str(STATIC_DIR)), name="static")
59
-
60
-
61
- # ─── Frontend ─────────────────────────────────────────────────────────────────
62
-
63
- @app.get("/", response_class=HTMLResponse)
64
- async def homepage():
65
- html_path = Path(__file__).parent / "index.html"
66
- return html_path.read_text(encoding="utf-8")
67
-
68
-
69
- # ─── Data APIs (FastAPI routes, no queuing needed) ────────────────────────────
70
-
71
- @app.get("/api/map-data")
72
- async def get_map_data(
73
- species: str = Query("all"),
74
- timeframe: str = Query("all"),
75
- ):
76
- data = db.get_map_data(species, timeframe)
77
- for item in data:
78
- item["photo_url"] = _photo_url(item.pop("last_photo", "") or "")
79
- return JSONResponse(content=data)
80
-
81
-
82
- @app.get("/api/animals")
83
- async def get_animals():
84
- animals = db.get_recent_animals(limit=30)
85
- for a in animals:
86
- a["photo_url"] = _photo_url(a.pop("last_photo_path", "") or "")
87
- a.pop("embedding", None)
88
- return JSONResponse(content=animals)
89
-
90
-
91
- @app.get("/api/animal/{animal_id}")
92
- async def get_animal(animal_id: int):
93
- detail = db.get_animal_detail(animal_id)
94
- if not detail:
95
- return JSONResponse(content={"error": "not found"}, status_code=404)
96
- for s in detail.get("sightings", []):
97
- s["photo_url"] = _photo_url(s.get("photo_path") or "")
98
- # also strip embedding from animal object before sending
99
- detail.get("animal", {}).pop("embedding", None)
100
- return JSONResponse(content=detail)
101
-
102
-
103
- # ─── ML APIs (queued via Gradio) ──────────────────────────────────────────────
104
-
105
- @app.api(name="analyze_image")
106
- def analyze_image(image_path: FileData) -> dict:
107
- """
108
- Step 1: Analyze photo with AI, find similar animals.
109
- Returns session_id + AI description + top matches (no DB write yet).
110
- """
111
- from PIL import Image as PILImage
112
-
113
- img = PILImage.open(image_path["path"]).convert("RGB")
114
-
115
- description = ai.analyze_image(img)
116
-
117
- # RejeiΓ§Γ£o: a IA nΓ£o detectou nenhum animal na foto
118
- if description.get("is_animal") is False:
119
- return {
120
- "error": "Nenhum cΓ£o ou gato identificado na foto. Por favor, fotografe um animal de rua.",
121
- "session_id": "",
122
- "description": {},
123
- "similar": [],
124
- }
125
-
126
- embedding = ai.get_embedding(description)
127
- candidates = db.get_all_animals_with_embeddings()
128
- top_matches = matcher.find_top_matches(embedding, candidates, top_n=3)
129
-
130
- # Enrich matches with photo URLs and sighting info
131
- similar = []
132
- for m in top_matches:
133
- sightings = db.get_animal_sightings(m["id"])
134
- photo_path = next(
135
- (s["photo_path"] for s in sightings if s.get("photo_path")), None
136
- )
137
- latest = sightings[0] if sightings else {}
138
- similar.append({
139
- "id": m["id"],
140
- "score_pct": round(m["score"] * 100),
141
- "photo_url": _photo_url(photo_path) if photo_path else "",
142
- "days_ago": latest.get("days_ago", ""),
143
- })
144
-
145
- # Save image to temp file for the confirm step
146
- tmp = tempfile.NamedTemporaryFile(suffix=".jpg", delete=False, dir=DATA_DIR)
147
- img.save(tmp.name, format="JPEG", quality=85)
148
- tmp.close()
149
-
150
- session_id = uuid.uuid4().hex
151
- _pending[session_id] = {
152
- "temp_path": tmp.name,
153
- "description": description,
154
- "embedding": embedding,
155
- "timestamp": time.time(),
156
- }
157
- _cleanup_sessions()
158
-
159
- log_trace({
160
- "event": "analyze",
161
- "session_id": session_id,
162
- "description": {k: v for k, v in description.items() if k not in ("_ai_success",)},
163
- "top_matches": [{"id": m["id"], "score_pct": m["score_pct"]} for m in similar],
164
- })
165
-
166
- return {
167
- "session_id": session_id,
168
- "description": description,
169
- "similar": similar,
170
- }
171
-
172
-
173
- @app.api(name="confirm_sighting")
174
- def confirm_sighting(
175
- session_id: str,
176
- gps_json: str = "",
177
- notes: str = "",
178
- condition: str = "",
179
- ) -> dict:
180
- """
181
- Step 2: User reviewed/edited the AI results β†’ save sighting to DB.
182
- """
183
- import datetime
184
- from PIL import Image as PILImage
185
-
186
- session = _pending.pop(session_id, None)
187
- if not session:
188
- return {"error": "SessΓ£o expirada. Tire a foto novamente."}
189
-
190
- img = PILImage.open(session["temp_path"]).convert("RGB")
191
- description = session["description"]
192
- embedding = session["embedding"]
193
-
194
- # Clean up temp file
195
- try:
196
- os.unlink(session["temp_path"])
197
- except Exception:
198
- pass
199
-
200
- # Parse GPS
201
- try:
202
- coords = json.loads(gps_json) if gps_json and gps_json.strip() else {}
203
- except Exception:
204
- coords = {}
205
- lat = round(float(coords["lat"]), 5) if coords.get("lat") else None
206
- lng = round(float(coords["lng"]), 5) if coords.get("lng") else None
207
-
208
- # Append condition to notes
209
- full_notes = notes
210
- if condition:
211
- full_notes = (notes + f" [CondiΓ§Γ£o: {condition}]").strip()
212
-
213
- candidates = db.get_all_animals_with_embeddings()
214
- match = matcher.find_match(embedding, candidates)
215
-
216
- if match:
217
- animal_id, _ = match
218
- photo_path = db.save_photo(img, animal_id=animal_id)
219
- db.add_sighting(animal_id, photo_path, lat, lng, full_notes)
220
- db.update_animal(animal_id)
221
- animal = db.get_animal(animal_id)
222
- count = animal["sighting_count"]
223
- species = animal["species"]
224
- desc_obj = json.loads(animal.get("description") or "{}")
225
- is_new = False
226
- else:
227
- animal_id = db.create_animal(description, embedding)
228
- photo_path = db.save_photo(img, animal_id=animal_id)
229
- db.add_sighting(animal_id, photo_path, lat, lng, full_notes)
230
- count = 1
231
- species = description.get("species", "dog")
232
- desc_obj = description
233
- is_new = True
234
-
235
- breed = desc_obj.get("breed_estimate", "")
236
- color = desc_obj.get("primary_color", "")
237
- name = " ".join(filter(None, [
238
- "CΓ£o" if species == "dog" else "Gato",
239
- color.capitalize() if color else "",
240
- breed if breed and breed.lower() not in ("srd", "unknown", "") else "",
241
- ])).strip() or ("CΓ£o" if species == "dog" else "Gato")
242
-
243
- result = {
244
- "animal_id": animal_id,
245
- "is_new": is_new,
246
- "count": count,
247
- "species": species,
248
- "name": name,
249
- "photo_url": _photo_url(photo_path) if photo_path else "",
250
- "location": f"Lat {lat:.4f}, Lng {lng:.4f}" if lat and lng else "LocalizaΓ§Γ£o nΓ£o registrada",
251
- "time": datetime.datetime.now().strftime("%H:%M"),
252
- }
253
-
254
- log_trace({
255
- "event": "confirm",
256
- "session_id": session_id,
257
- "animal_id": animal_id,
258
- "is_new": is_new,
259
- "species": species,
260
- "sighting_count": count,
261
- "gps": {"lat": lat, "lng": lng},
262
- "description": desc_obj,
263
- })
264
-
265
- return result
266
-
267
-
268
- def _cleanup_sessions():
269
- cutoff = time.time() - 1800 # 30 min
270
- for k in list(_pending.keys()):
271
- if _pending[k]["timestamp"] < cutoff:
272
- try:
273
- os.unlink(_pending[k]["temp_path"])
274
- except Exception:
275
- pass
276
- _pending.pop(k, None)
277
-
278
-
279
- # ─── Help ─────────────────────────────────────────────
280
-
281
- @app.post("/api/animal/{animal_id}/helped")
282
- async def mark_helped(animal_id: int):
283
- """Legacy β€” mantido por compatibilidade. Prefira submit_help_proof."""
284
- animal = db.get_animal(animal_id)
285
- if not animal:
286
- return JSONResponse(content={"error": "not found"}, status_code=404)
287
- db.add_sighting(animal_id, None, None, None, "", is_help_event=True, help_type="other")
288
- db.update_animal(animal_id)
289
- return JSONResponse(content={"ok": True})
290
-
291
-
292
- @app.api(name="submit_help_proof")
293
- def submit_help_proof(
294
- animal_id: int,
295
- help_type: str = "other",
296
- notes: str = "",
297
- image_path: FileData = None,
298
- ) -> dict:
299
- """
300
- Registra que alguΓ©m ajudou o animal, com foto de prova opcional.
301
- A IA verifica se a foto Γ© do mesmo animal e detecta melhora de condiΓ§Γ£o.
302
- """
303
- from PIL import Image as PILImage
304
- import json as _json
305
-
306
- photo_path = None
307
- ai_verified = False
308
- condition_update = None
309
- match_score = None
310
-
311
- if image_path and image_path.get("path"):
312
- img = PILImage.open(image_path["path"]).convert("RGB")
313
-
314
- # Analisa a foto com IA
315
- description = ai.analyze_image(img)
316
-
317
- if description.get("is_animal") is not False and description.get("_ai_success"):
318
- embedding = ai.get_embedding(description)
319
- candidates = db.get_all_animals_with_embeddings()
320
-
321
- # Verifica se Γ© o mesmo animal
322
- match = matcher.find_match(embedding, candidates)
323
- if match:
324
- matched_id, score = match
325
- ai_verified = (matched_id == animal_id)
326
- match_score = round(score * 100)
327
-
328
- # Detecta melhora de condiΓ§Γ£o
329
- animal_data = db.get_animal(animal_id)
330
- if animal_data:
331
- prev_desc = _json.loads(animal_data.get("description") or "{}")
332
- prev_condition = prev_desc.get("condition", "")
333
- new_condition = description.get("condition", "")
334
- condition_rank = {"injured": 0, "thin": 1, "healthy": 2}
335
- if (condition_rank.get(new_condition, -1) >
336
- condition_rank.get(prev_condition, -1)):
337
- condition_update = new_condition
338
-
339
- photo_path = db.save_photo(img, animal_id=animal_id)
340
-
341
- db.add_sighting(
342
- animal_id,
343
- photo_path,
344
- None, None,
345
- notes,
346
- is_help_event=True,
347
- help_type=help_type,
348
- )
349
- db.update_animal(animal_id)
350
-
351
- log_trace({
352
- "event": "help_proof",
353
- "animal_id": animal_id,
354
- "help_type": help_type,
355
- "has_photo": photo_path is not None,
356
- "ai_verified": ai_verified,
357
- "match_score": match_score,
358
- "condition_update": condition_update,
359
- })
360
-
361
- return {
362
- "ok": True,
363
- "animal_id": animal_id,
364
- "help_type": help_type,
365
- "ai_verified": ai_verified,
366
- "match_score": match_score,
367
- "condition_update": condition_update,
368
- "photo_url": _photo_url(photo_path) if photo_path else "",
369
- }
370
-
371
-
372
- # ─── Admin ────────────────────────────────────────────
373
-
374
- @app.get("/admin/push-traces")
375
- async def push_traces():
376
- """Publica data/traces.jsonl como dataset no HF Hub.
377
- Acesse esta URL no browser para disparar o upload.
378
- Requer HF_TOKEN e HF_DATASET_ID nos Secrets do Space.
379
- """
380
- from core.tracer import push_to_hub, TRACES_PATH
381
- if not TRACES_PATH.exists():
382
- return JSONResponse(content={"ok": False, "error": "Nenhum trace encontrado ainda."})
383
- lines = TRACES_PATH.read_text().strip().splitlines()
384
- push_to_hub()
385
- return JSONResponse(content={"ok": True, "traces_published": len(lines)})
386
-
387
-
388
- # ─── Launch ────────────────────────────────────────────
389
-
390
- if __name__ == "__main__":
391
- DATA_DIR.mkdir(parents=True, exist_ok=True)
392
- PHOTOS_DIR.mkdir(parents=True, exist_ok=True)
393
- app.launch(
394
- server_name="0.0.0.0",
395
- server_port=int(os.environ.get("PORT", 7860)),
396
- show_error=True,
397
- )
 
1
+ """
2
+ app.py β€” PawMap
3
+ Build Small Hackathon Β· Backyard AI Track Β· Junho 2026
4
+ Custom frontend via gradio.Server
5
+ """
6
+ import json
7
+ import logging
8
+ import os
9
+ import tempfile
10
+ import time
11
+ import uuid
12
+ from pathlib import Path
13
+
14
+ from gradio import Server
15
+ from gradio.data_classes import FileData
16
+ from fastapi.responses import HTMLResponse, JSONResponse
17
+ from fastapi import Query
18
+ from fastapi.staticfiles import StaticFiles
19
+
20
+ from core.ai import AnimalAI
21
+ from core.database import Database, DATA_DIR, PHOTOS_DIR
22
+ from core.matcher import AnimalMatcher
23
+ from core.seed import seed_if_empty
24
+ from core.tracer import log_trace
25
+
26
+ logging.basicConfig(level=logging.INFO)
27
+ db = Database()
28
+ ai = AnimalAI()
29
+ matcher = AnimalMatcher()
30
+ seed_if_empty(db) # popula o mapa com dados de demo se o banco estiver vazio
31
+
32
+
33
+ def _photo_url(photo_path: str) -> str:
34
+ """Convert DB-relative photo path to a URL served by the /photos/ static mount.
35
+ photo_path is relative to DATA_DIR (e.g. 'photos/animal_42/abc.jpg').
36
+ The static mount serves PHOTOS_DIR at /photos/, so we strip the 'photos/' prefix.
37
+ """
38
+ if not photo_path:
39
+ return ""
40
+ # Normalise separators
41
+ p = photo_path.replace("\\", "/")
42
+ if p.startswith("photos/"):
43
+ p = p[len("photos/"):]
44
+ return f"/photos/{p}"
45
+
46
+ # In-memory session store for analyze β†’ confirm two-step flow
47
+ _pending: dict[str, dict] = {}
48
+
49
+ app = Server()
50
+
51
+ # Serve photos as static files at /photos/...
52
+ PHOTOS_DIR.mkdir(parents=True, exist_ok=True)
53
+ app.mount("/photos", StaticFiles(directory=str(PHOTOS_DIR)), name="photos")
54
+
55
+ # Serve frontend assets (CSS, JS, images) at /static/...
56
+ STATIC_DIR = Path(__file__).parent / "static"
57
+ STATIC_DIR.mkdir(exist_ok=True)
58
+ app.mount("/static", StaticFiles(directory=str(STATIC_DIR)), name="static")
59
+
60
+
61
+ # ─── Frontend ─────────────────────────────────────────────────────────────────
62
+
63
+ @app.get("/", response_class=HTMLResponse)
64
+ async def homepage():
65
+ html_path = Path(__file__).parent / "index.html"
66
+ return html_path.read_text(encoding="utf-8")
67
+
68
+
69
+ # ─── Data APIs (FastAPI routes, no queuing needed) ────────────────────────────
70
+
71
+ @app.get("/api/map-data")
72
+ async def get_map_data(
73
+ species: str = Query("all"),
74
+ timeframe: str = Query("all"),
75
+ ):
76
+ data = db.get_map_data(species, timeframe)
77
+ for item in data:
78
+ item["photo_url"] = _photo_url(item.pop("last_photo", "") or "")
79
+ return JSONResponse(content=data)
80
+
81
+
82
+ @app.get("/api/animals")
83
+ async def get_animals():
84
+ animals = db.get_recent_animals(limit=30)
85
+ for a in animals:
86
+ a["photo_url"] = _photo_url(a.pop("last_photo_path", "") or "")
87
+ a.pop("embedding", None)
88
+ return JSONResponse(content=animals)
89
+
90
+
91
+ @app.get("/api/animal/{animal_id}")
92
+ async def get_animal(animal_id: int):
93
+ detail = db.get_animal_detail(animal_id)
94
+ if not detail:
95
+ return JSONResponse(content={"error": "not found"}, status_code=404)
96
+ for s in detail.get("sightings", []):
97
+ s["photo_url"] = _photo_url(s.get("photo_path") or "")
98
+ # also strip embedding from animal object before sending
99
+ detail.get("animal", {}).pop("embedding", None)
100
+ return JSONResponse(content=detail)
101
+
102
+
103
+ # ─── ML APIs (queued via Gradio) ──────────────────────────────────────────────
104
+
105
+ @app.api(name="analyze_image")
106
+ def analyze_image(image_path: FileData) -> dict:
107
+ """
108
+ Step 1: Analyze photo with AI, find similar animals.
109
+ Returns session_id + AI description + top matches (no DB write yet).
110
+ """
111
+ from PIL import Image as PILImage
112
+
113
+ img = PILImage.open(image_path["path"]).convert("RGB")
114
+
115
+ description = ai.analyze_image(img)
116
+
117
+ # RejeiΓ§Γ£o: a IA nΓ£o detectou nenhum animal na foto
118
+ if description.get("is_animal") is False:
119
+ return {
120
+ "error": "Nenhum cΓ£o ou gato identificado na foto. Por favor, fotografe um animal de rua.",
121
+ "session_id": "",
122
+ "description": {},
123
+ "similar": [],
124
+ }
125
+
126
+ embedding = ai.get_embedding(description)
127
+ candidates = db.get_all_animals_with_embeddings()
128
+ top_matches = matcher.find_top_matches(embedding, candidates, top_n=3)
129
+
130
+ # Enrich matches with photo URLs and sighting info
131
+ similar = []
132
+ for m in top_matches:
133
+ sightings = db.get_animal_sightings(m["id"])
134
+ photo_path = next(
135
+ (s["photo_path"] for s in sightings if s.get("photo_path")), None
136
+ )
137
+ latest = sightings[0] if sightings else {}
138
+ similar.append({
139
+ "id": m["id"],
140
+ "score_pct": round(m["score"] * 100),
141
+ "photo_url": _photo_url(photo_path) if photo_path else "",
142
+ "days_ago": latest.get("days_ago", ""),
143
+ })
144
+
145
+ # Save image to temp file for the confirm step
146
+ tmp = tempfile.NamedTemporaryFile(suffix=".jpg", delete=False, dir=DATA_DIR)
147
+ img.save(tmp.name, format="JPEG", quality=85)
148
+ tmp.close()
149
+
150
+ session_id = uuid.uuid4().hex
151
+ _pending[session_id] = {
152
+ "temp_path": tmp.name,
153
+ "description": description,
154
+ "embedding": embedding,
155
+ "timestamp": time.time(),
156
+ }
157
+ _cleanup_sessions()
158
+
159
+ log_trace({
160
+ "event": "analyze",
161
+ "session_id": session_id,
162
+ "description": {k: v for k, v in description.items() if k not in ("_ai_success",)},
163
+ "top_matches": [{"id": m["id"], "score_pct": m["score_pct"]} for m in similar],
164
+ })
165
+
166
+ return {
167
+ "session_id": session_id,
168
+ "description": description,
169
+ "similar": similar,
170
+ }
171
+
172
+
173
+ @app.api(name="confirm_sighting")
174
+ def confirm_sighting(
175
+ session_id: str,
176
+ gps_json: str = "",
177
+ notes: str = "",
178
+ condition: str = "",
179
+ ) -> dict:
180
+ """
181
+ Step 2: User reviewed/edited the AI results β†’ save sighting to DB.
182
+ """
183
+ import datetime
184
+ from PIL import Image as PILImage
185
+
186
+ session = _pending.pop(session_id, None)
187
+ if not session:
188
+ return {"error": "SessΓ£o expirada. Tire a foto novamente."}
189
+
190
+ img = PILImage.open(session["temp_path"]).convert("RGB")
191
+ description = session["description"]
192
+ embedding = session["embedding"]
193
+
194
+ # Clean up temp file
195
+ try:
196
+ os.unlink(session["temp_path"])
197
+ except Exception:
198
+ pass
199
+
200
+ # Parse GPS
201
+ try:
202
+ coords = json.loads(gps_json) if gps_json and gps_json.strip() else {}
203
+ except Exception:
204
+ coords = {}
205
+ lat = round(float(coords["lat"]), 5) if coords.get("lat") else None
206
+ lng = round(float(coords["lng"]), 5) if coords.get("lng") else None
207
+
208
+ # Append condition to notes
209
+ full_notes = notes
210
+ if condition:
211
+ full_notes = (notes + f" [CondiΓ§Γ£o: {condition}]").strip()
212
+
213
+ candidates = db.get_all_animals_with_embeddings()
214
+ match = matcher.find_match(embedding, candidates)
215
+
216
+ if match:
217
+ animal_id, _ = match
218
+ photo_path = db.save_photo(img, animal_id=animal_id)
219
+ db.add_sighting(animal_id, photo_path, lat, lng, full_notes)
220
+ db.update_animal(animal_id)
221
+ animal = db.get_animal(animal_id)
222
+ count = animal["sighting_count"]
223
+ species = animal["species"]
224
+ desc_obj = json.loads(animal.get("description") or "{}")
225
+ is_new = False
226
+ else:
227
+ animal_id = db.create_animal(description, embedding)
228
+ photo_path = db.save_photo(img, animal_id=animal_id)
229
+ db.add_sighting(animal_id, photo_path, lat, lng, full_notes)
230
+ count = 1
231
+ species = description.get("species", "dog")
232
+ desc_obj = description
233
+ is_new = True
234
+
235
+ breed = desc_obj.get("breed_estimate", "")
236
+ color = desc_obj.get("primary_color", "")
237
+ name = " ".join(filter(None, [
238
+ "CΓ£o" if species == "dog" else "Gato",
239
+ color.capitalize() if color else "",
240
+ breed if breed and breed.lower() not in ("srd", "unknown", "") else "",
241
+ ])).strip() or ("CΓ£o" if species == "dog" else "Gato")
242
+
243
+ result = {
244
+ "animal_id": animal_id,
245
+ "is_new": is_new,
246
+ "count": count,
247
+ "species": species,
248
+ "name": name,
249
+ "photo_url": _photo_url(photo_path) if photo_path else "",
250
+ "location": f"Lat {lat:.4f}, Lng {lng:.4f}" if lat and lng else "LocalizaΓ§Γ£o nΓ£o registrada",
251
+ "time": datetime.datetime.now().strftime("%H:%M"),
252
+ }
253
+
254
+ log_trace({
255
+ "event": "confirm",
256
+ "session_id": session_id,
257
+ "animal_id": animal_id,
258
+ "is_new": is_new,
259
+ "species": species,
260
+ "sighting_count": count,
261
+ "gps": {"lat": lat, "lng": lng},
262
+ "description": desc_obj,
263
+ })
264
+
265
+ return result
266
+
267
+
268
+ def _cleanup_sessions():
269
+ cutoff = time.time() - 1800 # 30 min
270
+ for k in list(_pending.keys()):
271
+ if _pending[k]["timestamp"] < cutoff:
272
+ try:
273
+ os.unlink(_pending[k]["temp_path"])
274
+ except Exception:
275
+ pass
276
+ _pending.pop(k, None)
277
+
278
+
279
+ # ─── Help ─────────────────────────────────────────────
280
+
281
+ @app.post("/api/animal/{animal_id}/helped")
282
+ async def mark_helped(animal_id: int):
283
+ """Legacy β€” mantido por compatibilidade. Prefira submit_help_proof."""
284
+ animal = db.get_animal(animal_id)
285
+ if not animal:
286
+ return JSONResponse(content={"error": "not found"}, status_code=404)
287
+ db.add_sighting(animal_id, None, None, None, "", is_help_event=True, help_type="other")
288
+ db.update_animal(animal_id)
289
+ return JSONResponse(content={"ok": True})
290
+
291
+
292
+ @app.api(name="submit_help_proof")
293
+ def submit_help_proof(
294
+ animal_id: int,
295
+ help_type: str = "other",
296
+ notes: str = "",
297
+ image_path: FileData = None,
298
+ ) -> dict:
299
+ """
300
+ Registra que alguΓ©m ajudou o animal, com foto de prova opcional.
301
+ A IA verifica se a foto Γ© do mesmo animal e detecta melhora de condiΓ§Γ£o.
302
+ """
303
+ from PIL import Image as PILImage
304
+ import json as _json
305
+
306
+ photo_path = None
307
+ ai_verified = False
308
+ condition_update = None
309
+ match_score = None
310
+
311
+ if image_path and image_path.get("path"):
312
+ img = PILImage.open(image_path["path"]).convert("RGB")
313
+
314
+ # Analisa a foto com IA
315
+ description = ai.analyze_image(img)
316
+
317
+ if description.get("is_animal") is not False and description.get("_ai_success"):
318
+ embedding = ai.get_embedding(description)
319
+ candidates = db.get_all_animals_with_embeddings()
320
+
321
+ # Verifica se Γ© o mesmo animal
322
+ match = matcher.find_match(embedding, candidates)
323
+ if match:
324
+ matched_id, score = match
325
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
index.html CHANGED
@@ -1282,4 +1282,4 @@
1282
  </script>
1283
  <script src="/static/help-proof.js"></script>
1284
  </body>
1285
- </html>
 
1282
  </script>
1283
  <script src="/static/help-proof.js"></script>
1284
  </body>
1285
+ <
static/style.css CHANGED
@@ -1,448 +1,448 @@
1
- *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
2
- :root {
3
- --green: #388C59;
4
- --green-dark: #2d7249;
5
- --green-pale: #D9EBD9;
6
- --green-soft: #EDF6EE;
7
- --orange: #FB8C00;
8
- --red: #E53935;
9
- --text: #1A1A1A;
10
- --text-muted: #777;
11
- --border: #EBEBEB;
12
- --bg: #F5F5F5;
13
- --white: #FFFFFF;
14
- --nav-h: 62px;
15
- --header-h: 54px;
16
- --filter-h: 48px;
17
- }
18
- html, body { height:100%; font-family:'Inter',system-ui,sans-serif; background:#ddd; color:var(--text); overflow:hidden; -webkit-tap-highlight-color:transparent; }
19
-
20
- /* ── App shell ── */
21
- #app { display:flex; flex-direction:column; height:100dvh; max-width:480px; margin:0 auto; background:var(--white); box-shadow:0 0 40px rgba(0,0,0,.15); overflow:hidden; position:relative; }
22
-
23
- /* ── Onboarding ── */
24
- #screen-splash { position:absolute; inset:0; z-index:999; background:linear-gradient(170deg,#2d7249 0%,#388C59 60%,#4aa86e 100%); display:flex; flex-direction:column; overflow:hidden; transition:opacity .35s ease, transform .35s ease; }
25
- #screen-splash.splash-out { opacity:0; transform:scale(1.03); pointer-events:none; }
26
-
27
- #ob-skip { position:absolute; top:16px; right:16px; background:rgba(255,255,255,.18); border:none; color:#fff; font-size:13px; font-weight:600; padding:6px 14px; border-radius:20px; cursor:pointer; z-index:10; }
28
-
29
- /* Sliding track */
30
- #ob-track { display:flex; flex:1; transition:transform .38s cubic-bezier(.4,0,.2,1); min-height:0; }
31
- .ob-step { min-width:100%; display:flex; flex-direction:column; align-items:center; padding:48px 28px 0; }
32
-
33
- /* Lottie area */
34
- .ob-lottie-wrap { width:220px; height:220px; position:relative; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
35
- .ob-lottie { width:220px; height:220px; }
36
- .ob-lottie-fallback { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:96px; line-height:1; }
37
- /* Hide fallback once lottie loads */
38
- .ob-lottie:not([error]) + .ob-lottie-fallback { animation: hideFallback 0s 1.2s forwards; }
39
- @keyframes hideFallback { to { opacity:0; pointer-events:none; } }
40
-
41
- /* Text */
42
- .ob-text { text-align:center; margin-top:20px; }
43
- .ob-step-label { font-size:11px; font-weight:700; letter-spacing:1.2px; text-transform:uppercase; color:rgba(255,255,255,.55); margin-bottom:10px; }
44
- .ob-text h2 { font-size:22px; font-weight:800; color:#fff; line-height:1.25; letter-spacing:-.3px; margin-bottom:12px; }
45
- .ob-text p { font-size:14px; color:rgba(255,255,255,.82); line-height:1.6; }
46
-
47
- /* Dots */
48
- #ob-dots { display:flex; justify-content:center; gap:8px; padding:20px 0 12px; flex-shrink:0; }
49
- .ob-dot { width:8px; height:8px; border-radius:4px; background:rgba(255,255,255,.3); transition:width .25s, background .25s; }
50
- .ob-dot.active { width:24px; background:#fff; }
51
-
52
- /* Actions */
53
- #ob-actions { padding:0 24px 32px; flex-shrink:0; }
54
- #ob-next { width:100%; padding:16px; background:#fff; color:var(--green-dark); border:none; border-radius:14px; font-size:16px; font-weight:700; cursor:pointer; letter-spacing:-.2px; transition:transform .1s, box-shadow .1s; box-shadow:0 4px 20px rgba(0,0,0,.2); }
55
- #ob-next:active { transform:scale(.98); }
56
-
57
- /* ── Header ── */
58
- #header { height:var(--header-h); background:var(--green); color:#fff; display:flex; align-items:center; justify-content:space-between; padding:0 16px; flex-shrink:0; z-index:200; }
59
- .hidden { display:none !important; }
60
- #header.hidden { display:none; }
61
- #header .logo { font-size:17px; font-weight:700; letter-spacing:-.3px; }
62
- .icon-btn { background:transparent; border:none; color:#fff; cursor:pointer; width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:18px; transition:background .15s; }
63
- .icon-btn:hover { background:rgba(255,255,255,.15); }
64
- .icon-btn svg { width:20px; height:20px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
65
-
66
- /* ── Filter chips ── */
67
- #filter-row { height:var(--filter-h); display:flex; align-items:center; gap:6px; padding:0 14px; overflow-x:auto; scrollbar-width:none; background:var(--white); border-bottom:1px solid var(--border); flex-shrink:0; }
68
- #filter-row::-webkit-scrollbar { display:none; }
69
- .chip { border-radius:20px; border:1.5px solid var(--border); background:var(--white); color:var(--text-muted); font-size:13px; font-weight:500; padding:5px 14px; white-space:nowrap; cursor:pointer; font-family:inherit; transition:all .15s; flex-shrink:0; }
70
- .chip:hover { border-color:var(--green); color:var(--green); }
71
- .chip.active { background:var(--green); border-color:var(--green); color:#fff; font-weight:600; }
72
-
73
- /* ── Screen system ── */
74
- .screen { display:none; flex:1; flex-direction:column; overflow:hidden; position:relative; }
75
- .screen.active { display:flex; }
76
-
77
- /* ── Bottom nav ── */
78
- #bottom-nav { height:var(--nav-h); background:var(--white); border-top:1px solid var(--border); display:flex; align-items:stretch; flex-shrink:0; z-index:500; }
79
- #bottom-nav.hidden { display:none; }
80
- .nav-btn { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; background:transparent; border:none; border-top:2.5px solid transparent; color:var(--text-muted); font-size:11px; font-weight:500; cursor:pointer; font-family:inherit; transition:all .15s; padding-bottom:4px; }
81
- .nav-btn.active { color:var(--green); border-top-color:var(--green); font-weight:700; }
82
- .nav-icon { font-size:20px; line-height:1; }
83
-
84
- /* ════ MAP ════ */
85
- #map { flex:1; width:100%; z-index:1; }
86
- .leaflet-control-zoom { border:none !important; box-shadow:0 2px 12px rgba(0,0,0,.15) !important; }
87
- .leaflet-control-zoom a { border-radius:8px !important; border:none !important; font-weight:600 !important; color:var(--text) !important; }
88
- #sighting-card { position:absolute; bottom:14px; left:14px; right:14px; background:var(--white); border-radius:16px; padding:14px 16px; box-shadow:0 4px 24px rgba(0,0,0,.14); z-index:400; display:flex; align-items:center; gap:12px; transition:opacity .2s,transform .2s; }
89
- #sighting-card.hidden { opacity:0; pointer-events:none; transform:translateY(8px); }
90
- #sighting-card .card-photo { width:52px; height:52px; border-radius:50%; flex-shrink:0; background:var(--bg); display:flex; align-items:center; justify-content:center; font-size:24px; overflow:hidden; }
91
- #sighting-card .card-photo img { width:100%; height:100%; object-fit:cover; }
92
- #sighting-card .card-info { flex:1; min-width:0; }
93
- #sighting-card .card-top { display:flex; align-items:center; gap:6px; margin-bottom:3px; }
94
- .badge { background:var(--green-pale); color:var(--green); border-radius:20px; padding:2px 10px; font-size:11px; font-weight:700; }
95
- .badge.urgent { background:#ffebee; color:var(--red); }
96
- .badge.orange { background:#fff3e0; color:var(--orange); }
97
- #sighting-card .card-time { font-size:11px; color:var(--text-muted); }
98
- #sighting-card .card-location { font-weight:600; font-size:13px; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
99
- #sighting-card .card-sub { font-size:12px; color:var(--text-muted); margin-top:1px; }
100
- .btn-ficha { background:var(--green); color:#fff; border:none; border-radius:10px; padding:8px 14px; font-size:12px; font-weight:600; white-space:nowrap; cursor:pointer; font-family:inherit; flex-shrink:0; transition:background .15s; }
101
- .btn-ficha:hover { background:var(--green-dark); }
102
- #map-empty { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); background:var(--white); border-radius:12px; padding:14px 20px; font-size:13px; color:var(--text-muted); box-shadow:0 2px 12px rgba(0,0,0,.1); z-index:500; display:none; pointer-events:none; }
103
-
104
- /* ════ REGISTER ════ */
105
- #screen-register { background:#111; }
106
- #viewfinder { flex:1; position:relative; background:#111; overflow:hidden; display:flex; align-items:center; justify-content:center; min-height:0; }
107
- #photo-preview { width:100%; height:100%; object-fit:cover; display:none; }
108
- #camera-placeholder { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; color:rgba(255,255,255,.35); }
109
- #camera-placeholder svg { width:56px; height:56px; stroke:rgba(255,255,255,.3); fill:none; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
110
- #camera-placeholder p { font-size:14px; }
111
- #gps-pill { position:absolute; top:14px; left:16px; right:16px; background:rgba(255,255,255,.92); backdrop-filter:blur(8px); border-radius:12px; padding:10px 14px; display:flex; align-items:center; gap:10px; font-size:13px; font-weight:500; color:var(--text); box-shadow:0 2px 12px rgba(0,0,0,.15); cursor:pointer; }
112
- #gps-pill svg { width:16px; height:16px; flex-shrink:0; stroke:var(--green); fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
113
- #gps-text { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--text-muted); }
114
- #gps-text.located { color:var(--text); font-weight:600; }
115
- #shutter-btn { position:absolute; bottom:20px; left:50%; transform:translateX(-50%); width:72px; height:72px; border-radius:50%; background:var(--green); border:4px solid rgba(255,255,255,.9); box-shadow:0 4px 20px rgba(0,0,0,.4); display:flex; align-items:center; justify-content:center; cursor:pointer; transition:transform .1s; }
116
- #shutter-btn:active { transform:translateX(-50%) scale(.93); }
117
- #shutter-btn svg { width:28px; height:28px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
118
- #photo-input { display:none; }
119
- #reg-sheet { background:var(--white); border-radius:20px 20px 0 0; padding:10px 16px 16px; flex-shrink:0; box-shadow:0 -4px 20px rgba(0,0,0,.12); }
120
- .drag-handle { width:40px; height:5px; border-radius:3px; background:#DDD; margin:0 auto 14px; }
121
- #notes-row { display:flex; align-items:center; gap:10px; background:var(--bg); border-radius:10px; padding:10px 14px; margin-bottom:12px; }
122
- #notes-row svg { width:16px; height:16px; flex-shrink:0; stroke:var(--text-muted); fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
123
- #notes-input { flex:1; border:none; background:transparent; font-family:inherit; font-size:13px; color:var(--text); resize:none; outline:none; line-height:1.4; max-height:60px; overflow-y:auto; }
124
- #notes-input::placeholder { color:var(--text-muted); }
125
- .btn-secondary { width:100%; padding:14px; border-radius:12px; font-size:15px; font-weight:600; font-family:inherit; cursor:pointer; transition:all .15s; margin-bottom:10px; display:flex; align-items:center; justify-content:center; gap:8px; background:var(--green-pale); color:var(--green); border:1.5px solid var(--green-pale); }
126
- .btn-secondary:hover { background:var(--green-soft); border-color:var(--green); }
127
- .btn-secondary svg { width:18px; height:18px; fill:none; stroke:var(--green); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
128
- .btn-secondary.located { background:var(--green); color:#fff; border-color:var(--green); }
129
- .btn-secondary.located svg { stroke:#fff; }
130
- .btn-primary { width:100%; padding:15px; border-radius:12px; font-size:15px; font-weight:700; font-family:inherit; cursor:pointer; transition:all .15s; display:flex; align-items:center; justify-content:center; gap:8px; background:var(--green); color:#fff; border:none; }
131
- .btn-primary:hover { background:var(--green-dark); }
132
- .btn-primary:disabled { background:#ccc; cursor:not-allowed; }
133
- .btn-primary svg { width:18px; height:18px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
134
-
135
- /* ════ ANALYSIS ════ */
136
- #screen-analysis { background:var(--bg); overflow-y:auto; }
137
- .flow-header { position:sticky; top:0; z-index:100; background:var(--white); border-bottom:1px solid var(--border); display:flex; align-items:center; gap:12px; padding:0 16px; height:var(--header-h); flex-shrink:0; }
138
- .flow-header .back-btn { background:transparent; border:none; cursor:pointer; padding:8px; border-radius:50%; display:flex; align-items:center; justify-content:center; margin-left:-8px; }
139
- .flow-header .back-btn svg { width:20px; height:20px; fill:none; stroke:var(--text); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
140
- .flow-header h2 { font-size:16px; font-weight:700; color:var(--text); }
141
- #analysis-photo-wrap { position:relative; background:#111; flex-shrink:0; }
142
- #analysis-photo { width:100%; max-height:300px; object-fit:cover; display:block; }
143
- #ai-badge { position:absolute; top:12px; right:12px; background:rgba(0,0,0,.6); backdrop-filter:blur(4px); color:#fff; border-radius:20px; padding:5px 12px; font-size:12px; font-weight:600; display:flex; align-items:center; gap:6px; }
144
- #ai-badge .dot { width:8px; height:8px; border-radius:50%; background:var(--green); animation:pulse-dot 1.2s ease-in-out infinite; }
145
- @keyframes pulse-dot { 0%,100%{opacity:.4;transform:scale(.8)} 50%{opacity:1;transform:scale(1)} }
146
- #ai-badge.done { background:rgba(56,140,89,.9); }
147
- #ai-badge.done .dot { animation:none; background:#fff; }
148
- #animal-result-badge { position:absolute; bottom:12px; left:50%; transform:translateX(-50%); background:rgba(56,140,89,.92); backdrop-filter:blur(4px); color:#fff; border-radius:20px; padding:7px 18px; font-size:13px; font-weight:700; display:flex; align-items:center; gap:8px; white-space:nowrap; opacity:0; transition:opacity .3s; }
149
- #animal-result-badge.visible { opacity:1; }
150
- #animal-result-badge svg { width:16px; height:16px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
151
- .analysis-card { background:var(--white); border-radius:16px; margin:12px 16px; padding:16px; box-shadow:0 1px 6px rgba(0,0,0,.06); }
152
- .analysis-card h3 { font-size:16px; font-weight:700; color:var(--text); margin-bottom:4px; display:flex; align-items:center; justify-content:space-between; }
153
- .analysis-card h3 button { background:transparent; border:none; cursor:pointer; padding:4px; color:var(--text-muted); font-size:16px; }
154
- .analysis-card .subtitle { font-size:13px; color:var(--text-muted); margin-bottom:14px; line-height:1.4; }
155
- .dropdowns-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:14px; }
156
- .dropdown-field label { display:block; font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:5px; }
157
- .dropdown-field select { width:100%; padding:10px 12px; border:1.5px solid var(--border); border-radius:10px; font-family:inherit; font-size:13px; font-weight:500; color:var(--text); background:var(--bg); cursor:pointer; outline:none; appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 12px center; padding-right:32px; }
158
- .dropdown-field select:focus { border-color:var(--green); background-color:var(--white); }
159
- .condition-label { font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:8px; }
160
- .condition-chips { display:flex; flex-wrap:wrap; gap:8px; }
161
- .cond-chip { border-radius:20px; border:1.5px solid var(--border); background:var(--white); color:var(--text); padding:6px 14px; font-size:13px; font-weight:500; cursor:pointer; font-family:inherit; transition:all .15s; display:flex; align-items:center; gap:5px; }
162
- .cond-chip.active { background:var(--green); border-color:var(--green); color:#fff; }
163
- .cond-chip .check { display:none; font-size:12px; }
164
- .cond-chip.active .check { display:inline; }
165
- .similar-scroll { display:flex; gap:12px; overflow-x:auto; padding:4px 0 8px; scrollbar-width:none; }
166
- .similar-scroll::-webkit-scrollbar { display:none; }
167
- .similar-card { flex-shrink:0; width:148px; border-radius:12px; overflow:hidden; border:1.5px solid var(--border); background:var(--white); }
168
- .match-pct { position:absolute; bottom:6px; left:6px; background:rgba(0,0,0,.65); color:#fff; border-radius:6px; padding:2px 7px; font-size:11px; font-weight:700; }
169
- .similar-card-info { padding:8px 10px; }
170
- .similar-card-info .days { font-size:12px; font-weight:600; color:var(--text); }
171
- .similar-card-info .dist { font-size:11px; color:var(--text-muted); }
172
- #analysis-actions { padding:12px 16px 20px; background:var(--white); border-top:1px solid var(--border); display:flex; flex-direction:column; gap:10px; flex-shrink:0; position:sticky; bottom:0; z-index:50; }
173
- .btn-outline { width:100%; padding:14px; border-radius:12px; font-size:15px; font-weight:600; font-family:inherit; cursor:pointer; background:transparent; color:var(--text-muted); border:1.5px solid var(--border); transition:all .15s; }
174
- .btn-outline:hover { border-color:var(--text-muted); color:var(--text); }
175
-
176
- /* ════ CONFIRM ════ */
177
- #screen-confirm { background:var(--bg); align-items:center; justify-content:center; overflow-y:auto; }
178
- #confirm-inner { width:100%; max-width:360px; padding:40px 24px 32px; display:flex; flex-direction:column; align-items:center; }
179
- #confirm-photo-wrap { position:relative; margin-bottom:20px; }
180
- #confirm-photo { width:160px; height:160px; border-radius:50%; background:var(--bg); display:flex; align-items:center; justify-content:center; font-size:64px; border:4px solid var(--white); box-shadow:0 4px 20px rgba(0,0,0,.15); overflow:hidden; }
181
- #confirm-photo img { width:100%; height:100%; object-fit:cover; }
182
- #confirm-check { position:absolute; bottom:4px; right:4px; width:44px; height:44px; border-radius:50%; background:var(--green); border:3px solid var(--white); display:flex; align-items:center; justify-content:center; }
183
- #confirm-check svg { width:20px; height:20px; fill:none; stroke:#fff; stroke-width:2.5; stroke-linecap:round; stroke-linejoin:round; }
184
- #confirm-title { font-size:26px; font-weight:800; color:var(--text); text-align:center; line-height:1.2; margin-bottom:24px; }
185
- #confirm-card { width:100%; background:var(--white); border-radius:16px; overflow:hidden; box-shadow:0 2px 12px rgba(0,0,0,.07); margin-bottom:24px; }
186
- .confirm-row { display:flex; align-items:center; justify-content:space-between; padding:14px 18px; gap:12px; }
187
- .confirm-row + .confirm-row { border-top:1px solid var(--border); }
188
- .confirm-row-label { display:flex; align-items:center; gap:8px; font-size:14px; color:var(--text-muted); font-weight:500; }
189
- .confirm-row-label svg { width:16px; height:16px; fill:none; stroke:var(--text-muted); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
190
- .confirm-row-value { font-size:14px; font-weight:700; color:var(--text); text-align:right; }
191
- .confirm-btns { width:100%; display:flex; flex-direction:column; gap:10px; }
192
-
193
- /* ════ SIGHTINGS LIST ════ */
194
- #screen-sightings { background:var(--bg); }
195
- #sightings-header { background:var(--white); border-bottom:1px solid var(--border); padding:12px 16px; display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
196
- #sightings-header span { font-size:13px; font-weight:600; color:var(--text-muted); }
197
- #refresh-btn { background:transparent; border:none; cursor:pointer; font-size:18px; color:var(--green); padding:4px 8px; border-radius:8px; }
198
- #animals-list { flex:1; overflow-y:auto; padding:10px 0 8px; }
199
- .animal-item { display:flex; align-items:center; gap:12px; background:var(--white); margin:6px 14px; border-radius:14px; padding:12px 14px; box-shadow:0 1px 6px rgba(0,0,0,.06); cursor:pointer; transition:box-shadow .15s; border:1.5px solid transparent; }
200
- .animal-item:hover { box-shadow:0 3px 14px rgba(0,0,0,.1); border-color:var(--green-pale); }
201
- .animal-item-photo { width:58px; height:58px; border-radius:12px; flex-shrink:0; background:var(--bg); display:flex; align-items:center; justify-content:center; font-size:28px; overflow:hidden; }
202
- .animal-item-photo img { width:100%; height:100%; object-fit:cover; }
203
- .animal-item-info { flex:1; min-width:0; }
204
- .animal-item-name { font-weight:700; font-size:14px; color:var(--text); margin-bottom:2px; }
205
- .animal-item-breed { font-size:12px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:4px; }
206
- .animal-item-meta { font-size:11px; color:var(--text-muted); }
207
- .animal-item-meta.urgent { color:var(--red); }
208
- .animal-item-badge { flex-shrink:0; background:var(--green-pale); color:var(--green); border-radius:20px; padding:4px 10px; font-size:12px; font-weight:700; }
209
- .animal-item-badge.urgent { background:#ffebee; color:var(--red); }
210
- .animals-empty { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; padding:40px 24px; text-align:center; color:var(--text-muted); }
211
- .animals-empty .ph-icon { font-size:52px; opacity:.3; }
212
- .animals-empty p { font-size:14px; }
213
-
214
- /* ════ PROFILE / FICHA ════ */
215
- #screen-profile { background:var(--white); }
216
- .profile-scroll { flex:1; overflow-y:auto; min-height:0; }
217
-
218
- /* Hero */
219
- .profile-hero { position:relative; height:280px; background:#111; flex-shrink:0; }
220
- .profile-hero-img { width:100%; height:100%; object-fit:cover; display:block; }
221
- .hero-gradient { position:absolute; bottom:0; left:0; right:0; height:140px; background:linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 100%); }
222
- .hero-top-btns { position:absolute; top:16px; left:0; right:0; display:flex; justify-content:space-between; padding:0 16px; }
223
- .hero-btn { width:40px; height:40px; border-radius:50%; background:rgba(255,255,255,.92); border:none; cursor:pointer; display:flex; align-items:center; justify-content:center; backdrop-filter:blur(4px); transition:background .15s; }
224
- .hero-btn:hover { background:#fff; }
225
- .hero-btn svg { width:18px; height:18px; fill:none; stroke:var(--text); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
226
- #profile-sightings-badge { position:absolute; bottom:14px; left:16px; background:rgba(56,140,89,.88); backdrop-filter:blur(4px); color:#fff; border-radius:20px; padding:6px 14px; font-size:12px; font-weight:700; display:flex; align-items:center; gap:6px; }
227
- #profile-sightings-badge svg { width:14px; height:14px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
228
-
229
- /* Profile content */
230
- .profile-content { padding:20px 16px 0; background:var(--white); }
231
- #profile-title { font-size:24px; font-weight:800; color:var(--text); margin-bottom:6px; }
232
- #profile-status { display:flex; align-items:center; gap:7px; font-size:13px; color:var(--text-muted); margin-bottom:24px; }
233
- #profile-status .status-dot { width:8px; height:8px; border-radius:50%; background:var(--green); flex-shrink:0; }
234
-
235
- /* Identification grid */
236
- .section-title { font-size:16px; font-weight:700; color:var(--text); margin-bottom:12px; }
237
- .id-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:24px; }
238
- .id-cell { background:var(--bg); border-radius:12px; padding:12px 14px; }
239
- .id-cell-label { font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:6px; }
240
- .id-cell-value { font-size:14px; font-weight:600; color:var(--text); display:flex; align-items:center; gap:6px; }
241
- .id-cell-value .color-dot { width:14px; height:14px; border-radius:50%; flex-shrink:0; }
242
-
243
- /* Gallery */
244
- .gallery-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
245
- .gallery-see-all { font-size:13px; font-weight:600; color:var(--green); background:transparent; border:none; cursor:pointer; font-family:inherit; }
246
- .gallery-scroll { display:flex; gap:10px; overflow-x:auto; scrollbar-width:none; margin:0 -16px; padding:0 16px 4px; margin-bottom:24px; }
247
- .gallery-scroll::-webkit-scrollbar { display:none; }
248
- .gallery-card { flex-shrink:0; width:150px; border-radius:12px; overflow:hidden; border:1px solid var(--border); background:var(--bg); }
249
- .gallery-card-img { width:150px; height:110px; object-fit:cover; display:block; background:var(--bg); }
250
- .gallery-card-info { padding:8px 10px; }
251
- .gallery-card-date { font-size:11px; color:var(--text-muted); margin-bottom:2px; display:flex; align-items:center; gap:4px; }
252
- .gallery-card-date svg { width:10px; height:10px; fill:none; stroke:var(--text-muted); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
253
- .gallery-card-loc { font-size:12px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
254
-
255
- /* Trajectory */
256
- #trajectory-map { width:100%; height:180px; border-radius:12px; overflow:hidden; background:var(--bg); margin-bottom:8px; border:1px solid var(--border); }
257
- .profile-section { margin-bottom:24px; }
258
-
259
- /* Profile footer */
260
- .profile-footer { padding:12px 16px 20px; background:var(--white); border-top:1px solid var(--border); flex-shrink:0; }
261
- .btn-adopt { width:100%; padding:16px; border-radius:14px; font-size:16px; font-weight:700; font-family:inherit; cursor:pointer; background:var(--green); color:#fff; border:none; display:flex; align-items:center; justify-content:center; gap:8px; transition:background .15s; }
262
- .btn-adopt:hover { background:var(--green-dark); }
263
-
264
- /* ── Spinners & animations ── */
265
- @keyframes spin { to { transform:rotate(360deg); } }
266
- .spinner { width:16px; height:16px; border:2px solid rgba(255,255,255,.3); border-top-color:#fff; border-radius:50%; animation:spin .7s linear infinite; }
267
- .skeleton { background:linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%); background-size:200% 100%; animation:shimmer 1.4s infinite; border-radius:8px; }
268
- @keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
269
-
270
- /* ── Lucide icon sizing ─────────────────────────────────────────────────── */
271
- /* Nav icons */
272
- .nav-icon svg { width: 22px; height: 22px; display: block; }
273
- .nav-btn.active .nav-icon svg { stroke: var(--green); }
274
- .nav-btn .nav-icon svg { stroke: var(--text-muted); }
275
-
276
- /* Filter chip icons */
277
- .chip svg { width: 15px; height: 15px; vertical-align: middle; margin-right: 2px; }
278
-
279
- /* Condition chip check icon */
280
- .check svg { width: 12px; height: 12px; }
281
-
282
- /* Card photo placeholder */
283
- .card-photo svg { width: 28px; height: 28px; stroke: var(--text-muted); }
284
-
285
- /* Map empty */
286
- #map-empty svg { display: none; }
287
-
288
- /* Edit button */
289
- #edit-btn svg { width: 14px; height: 14px; stroke: var(--text-muted); }
290
-
291
- /* Confirm photo placeholder */
292
- #confirm-photo svg { width: 72px; height: 72px; }
293
-
294
- /* Similar card placeholder */
295
- .similar-card svg { opacity: .4; }
296
-
297
- /* Animals empty / ph-icon */
298
- .ph-icon svg { width: 52px; height: 52px; stroke: var(--text-muted); opacity: .3; }
299
- .ph-icon { display: flex; align-items: center; justify-content: center; }
300
-
301
- /* Refresh button */
302
- #refresh-btn svg { width: 18px; height: 18px; stroke: var(--green); display: block; }
303
-
304
- /* Adopt button */
305
- .btn-adopt svg { width: 18px; height: 18px; stroke: #fff; fill: #fff; }
306
-
307
- /* ── Gallery card menu ── */
308
- .gallery-card-img-wrap { position:relative; }
309
- .gallery-card-menu-btn { position:absolute; top:6px; right:6px; width:28px; height:28px; background:rgba(0,0,0,.45); border:none; border-radius:50%; display:flex; align-items:center; justify-content:center; cursor:pointer; color:#fff; padding:0; }
310
- .gallery-card-menu-btn svg { width:14px; height:14px; }
311
- .photo-menu { position:absolute; z-index:800; background:#fff; border-radius:10px; box-shadow:0 4px 20px rgba(0,0,0,.15); overflow:hidden; min-width:160px; }
312
- #photo-menu-download { display:flex; align-items:center; gap:10px; padding:13px 16px; font-size:14px; font-weight:500; color:var(--text); background:none; border:none; cursor:pointer; width:100%; }
313
- #photo-menu-download:active { background:var(--bg); }
314
- #photo-menu-download svg { width:16px; height:16px; flex-shrink:0; color:var(--text-muted); }
315
-
316
- /* ── Helped banner & events ── */
317
- #profile-helped-banner { display:flex; align-items:center; gap:8px; background:var(--green-soft); border:1px solid var(--green-pale); border-radius:10px; padding:10px 14px; margin:10px 0 4px; font-size:13px; color:var(--green-dark); font-weight:500; }
318
- #profile-helped-banner i { flex-shrink:0; }
319
- .helped-events { display:flex; flex-direction:column; gap:8px; margin-top:12px; }
320
- .helped-event { display:flex; align-items:center; gap:10px; padding:10px 12px; background:var(--green-soft); border-radius:10px; }
321
- .helped-event-icon { flex-shrink:0; display:flex; }
322
- .helped-event-text { display:flex; flex-direction:column; gap:1px; }
323
- .helped-event-text span { font-size:13px; font-weight:500; color:var(--green-dark); }
324
- .helped-event-text small { font-size:11px; color:var(--text-muted); }
325
-
326
- /* ── Help bottom sheet ── */
327
- #help-overlay { position:absolute; inset:0; background:rgba(0,0,0,.45); z-index:500; }
328
- .help-sheet { position:absolute; bottom:0; left:0; right:0; background:#fff; border-radius:20px 20px 0 0; z-index:501; padding:12px 0 32px; transform:translateY(100%); transition:transform .3s cubic-bezier(.4,0,.2,1); }
329
- .help-sheet.open { transform:translateY(0); }
330
- #help-animal-row { display:flex; align-items:center; gap:12px; padding:12px 20px 16px; border-bottom:1px solid var(--border); }
331
- #help-animal-photo { width:48px; height:48px; border-radius:12px; overflow:hidden; background:var(--bg); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:26px; }
332
- #help-animal-photo img { width:100%; height:100%; object-fit:cover; }
333
- #help-animal-name { font-size:15px; font-weight:700; color:var(--text); }
334
- #help-animal-sub { font-size:12px; color:var(--text-muted); margin-top:2px; }
335
- .help-actions { display:flex; flex-direction:column; padding:8px 0; }
336
- .help-action-btn { display:flex; align-items:center; gap:14px; padding:14px 20px; background:none; border:none; cursor:pointer; text-align:left; transition:background .12s; width:100%; }
337
- .help-action-btn:active { background:var(--bg); }
338
- .help-action-icon { font-size:24px; width:32px; text-align:center; flex-shrink:0; }
339
- .help-action-text { flex:1; }
340
- .help-action-text strong { display:block; font-size:15px; font-weight:600; color:var(--text); }
341
- .help-action-text small { display:block; font-size:12px; color:var(--text-muted); margin-top:1px; }
342
- .help-chevron { width:18px; height:18px; fill:none; stroke:#ccc; stroke-width:2; stroke-linecap:round; flex-shrink:0; }
343
- .help-cancel { display:block; width:calc(100% - 40px); margin:8px 20px 0; padding:14px; background:var(--bg); border:none; border-radius:12px; font-size:15px; font-weight:600; color:var(--text-muted); cursor:pointer; }
344
-
345
- /* ── Helped confirmation ── */
346
- .helped-confirm { position:absolute; inset:0; background:rgba(0,0,0,.5); z-index:600; display:flex; align-items:center; justify-content:center; padding:24px; opacity:0; transition:opacity .25s; }
347
- .helped-confirm.open { opacity:1; }
348
- .helped-inner { background:#fff; border-radius:20px; padding:32px 24px; text-align:center; width:100%; max-width:320px; }
349
- .helped-icon-wrap { width:56px; height:56px; background:var(--green-soft); border-radius:50%; display:flex; align-items:center; justify-content:center; margin:0 auto 16px; }
350
- .helped-icon-wrap i { color:var(--green); }
351
- .helped-inner h3 { font-size:20px; font-weight:800; margin-bottom:8px; color:var(--text); }
352
- .helped-inner p { font-size:14px; color:var(--text-muted); line-height:1.5; margin-bottom:24px; }
353
- #helped-ok { width:100%; padding:14px; background:var(--green); color:#fff; border:none; border-radius:12px; font-size:15px; font-weight:700; cursor:pointer; }
354
-
355
- /* Profile sightings badge */
356
- #profile-sightings-badge svg { width: 14px; height: 14px; stroke: #fff; }
357
-
358
- /* Urgent triangle icon inline */
359
- .animal-item-meta svg { vertical-align: middle; display: inline; }
360
-
361
- /* ── AI description callout (profile) ──────────────────────────────────── */
362
- .ai-desc-callout {
363
- display: flex;
364
- align-items: flex-start;
365
- gap: 10px;
366
- background: var(--green-soft);
367
- border: 1px solid var(--green-pale);
368
- border-radius: 12px;
369
- padding: 12px 14px;
370
- margin-bottom: 24px;
371
- }
372
- .ai-label {
373
- background: var(--green);
374
- color: #fff;
375
- font-size: 10px;
376
- font-weight: 800;
377
- letter-spacing: .5px;
378
- border-radius: 6px;
379
- padding: 2px 7px;
380
- flex-shrink: 0;
381
- margin-top: 1px;
382
- }
383
- .ai-desc-callout p {
384
- font-size: 13px;
385
- color: var(--text);
386
- line-height: 1.5;
387
- margin: 0;
388
- }
389
-
390
- /* ── Confirm identification grid ─────────────────────────────────────────── */
391
- .confirm-id-grid {
392
- width: 100%;
393
- margin-bottom: 20px;
394
- }
395
- .cig-label {
396
- font-size: 11px;
397
- font-weight: 700;
398
- color: var(--text-muted);
399
- text-transform: uppercase;
400
- letter-spacing: .4px;
401
- margin-bottom: 10px;
402
- text-align: center;
403
- }
404
- .cig-cells {
405
- display: grid;
406
- grid-template-columns: 1fr 1fr;
407
- gap: 8px;
408
- }
409
- .cig-cell {
410
- background: var(--bg);
411
- border-radius: 10px;
412
- padding: 10px 12px;
413
- }
414
- .cig-cell.cig-full {
415
- grid-column: 1 / -1;
416
- }
417
- .cig-key {
418
- font-size: 10px;
419
- font-weight: 600;
420
- color: var(--text-muted);
421
- text-transform: uppercase;
422
- letter-spacing: .4px;
423
- margin-bottom: 4px;
424
- }
425
- .cig-val {
426
- font-size: 13px;
427
- font-weight: 600;
428
- color: var(--text);
429
- display: flex;
430
- align-items: center;
431
- gap: 4px;
432
- }
433
- .cig-val svg { width: 13px; height: 13px; flex-shrink: 0; }
434
-
435
- /* ── AI badge error state ────────────────────────────────────────────────── */
436
- #ai-badge.error { background: rgba(229,57,53,.88); }
437
- #animal-result-badge.error {
438
- background: rgba(229,57,53,.92);
439
- font-size: 12px;
440
- max-width: calc(100% - 24px);
441
- text-align: center;
442
- white-space: normal;
443
- line-height: 1.4;
444
- padding: 10px 16px;
445
- }
446
 
447
  /* ── Help Proof Screen ────────────────────────────────────────────────────── */
448
  #screen-help-proof { display:flex; flex-direction:column; padding:0 0 100px; overflow-y:auto; background:var(--white); }
 
1
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
2
+ :root {
3
+ --green: #388C59;
4
+ --green-dark: #2d7249;
5
+ --green-pale: #D9EBD9;
6
+ --green-soft: #EDF6EE;
7
+ --orange: #FB8C00;
8
+ --red: #E53935;
9
+ --text: #1A1A1A;
10
+ --text-muted: #777;
11
+ --border: #EBEBEB;
12
+ --bg: #F5F5F5;
13
+ --white: #FFFFFF;
14
+ --nav-h: 62px;
15
+ --header-h: 54px;
16
+ --filter-h: 48px;
17
+ }
18
+ html, body { height:100%; font-family:'Inter',system-ui,sans-serif; background:#ddd; color:var(--text); overflow:hidden; -webkit-tap-highlight-color:transparent; }
19
+
20
+ /* ── App shell ── */
21
+ #app { display:flex; flex-direction:column; height:100dvh; max-width:480px; margin:0 auto; background:var(--white); box-shadow:0 0 40px rgba(0,0,0,.15); overflow:hidden; position:relative; }
22
+
23
+ /* ── Onboarding ── */
24
+ #screen-splash { position:absolute; inset:0; z-index:999; background:linear-gradient(170deg,#2d7249 0%,#388C59 60%,#4aa86e 100%); display:flex; flex-direction:column; overflow:hidden; transition:opacity .35s ease, transform .35s ease; }
25
+ #screen-splash.splash-out { opacity:0; transform:scale(1.03); pointer-events:none; }
26
+
27
+ #ob-skip { position:absolute; top:16px; right:16px; background:rgba(255,255,255,.18); border:none; color:#fff; font-size:13px; font-weight:600; padding:6px 14px; border-radius:20px; cursor:pointer; z-index:10; }
28
+
29
+ /* Sliding track */
30
+ #ob-track { display:flex; flex:1; transition:transform .38s cubic-bezier(.4,0,.2,1); min-height:0; }
31
+ .ob-step { min-width:100%; display:flex; flex-direction:column; align-items:center; padding:48px 28px 0; }
32
+
33
+ /* Lottie area */
34
+ .ob-lottie-wrap { width:220px; height:220px; position:relative; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
35
+ .ob-lottie { width:220px; height:220px; }
36
+ .ob-lottie-fallback { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:96px; line-height:1; }
37
+ /* Hide fallback once lottie loads */
38
+ .ob-lottie:not([error]) + .ob-lottie-fallback { animation: hideFallback 0s 1.2s forwards; }
39
+ @keyframes hideFallback { to { opacity:0; pointer-events:none; } }
40
+
41
+ /* Text */
42
+ .ob-text { text-align:center; margin-top:20px; }
43
+ .ob-step-label { font-size:11px; font-weight:700; letter-spacing:1.2px; text-transform:uppercase; color:rgba(255,255,255,.55); margin-bottom:10px; }
44
+ .ob-text h2 { font-size:22px; font-weight:800; color:#fff; line-height:1.25; letter-spacing:-.3px; margin-bottom:12px; }
45
+ .ob-text p { font-size:14px; color:rgba(255,255,255,.82); line-height:1.6; }
46
+
47
+ /* Dots */
48
+ #ob-dots { display:flex; justify-content:center; gap:8px; padding:20px 0 12px; flex-shrink:0; }
49
+ .ob-dot { width:8px; height:8px; border-radius:4px; background:rgba(255,255,255,.3); transition:width .25s, background .25s; }
50
+ .ob-dot.active { width:24px; background:#fff; }
51
+
52
+ /* Actions */
53
+ #ob-actions { padding:0 24px 32px; flex-shrink:0; }
54
+ #ob-next { width:100%; padding:16px; background:#fff; color:var(--green-dark); border:none; border-radius:14px; font-size:16px; font-weight:700; cursor:pointer; letter-spacing:-.2px; transition:transform .1s, box-shadow .1s; box-shadow:0 4px 20px rgba(0,0,0,.2); }
55
+ #ob-next:active { transform:scale(.98); }
56
+
57
+ /* ── Header ── */
58
+ #header { height:var(--header-h); background:var(--green); color:#fff; display:flex; align-items:center; justify-content:space-between; padding:0 16px; flex-shrink:0; z-index:200; }
59
+ .hidden { display:none !important; }
60
+ #header.hidden { display:none; }
61
+ #header .logo { font-size:17px; font-weight:700; letter-spacing:-.3px; }
62
+ .icon-btn { background:transparent; border:none; color:#fff; cursor:pointer; width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:18px; transition:background .15s; }
63
+ .icon-btn:hover { background:rgba(255,255,255,.15); }
64
+ .icon-btn svg { width:20px; height:20px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
65
+
66
+ /* ── Filter chips ── */
67
+ #filter-row { height:var(--filter-h); display:flex; align-items:center; gap:6px; padding:0 14px; overflow-x:auto; scrollbar-width:none; background:var(--white); border-bottom:1px solid var(--border); flex-shrink:0; }
68
+ #filter-row::-webkit-scrollbar { display:none; }
69
+ .chip { border-radius:20px; border:1.5px solid var(--border); background:var(--white); color:var(--text-muted); font-size:13px; font-weight:500; padding:5px 14px; white-space:nowrap; cursor:pointer; font-family:inherit; transition:all .15s; flex-shrink:0; }
70
+ .chip:hover { border-color:var(--green); color:var(--green); }
71
+ .chip.active { background:var(--green); border-color:var(--green); color:#fff; font-weight:600; }
72
+
73
+ /* ── Screen system ── */
74
+ .screen { display:none; flex:1; flex-direction:column; overflow:hidden; position:relative; }
75
+ .screen.active { display:flex; }
76
+
77
+ /* ── Bottom nav ── */
78
+ #bottom-nav { height:var(--nav-h); background:var(--white); border-top:1px solid var(--border); display:flex; align-items:stretch; flex-shrink:0; z-index:500; }
79
+ #bottom-nav.hidden { display:none; }
80
+ .nav-btn { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; background:transparent; border:none; border-top:2.5px solid transparent; color:var(--text-muted); font-size:11px; font-weight:500; cursor:pointer; font-family:inherit; transition:all .15s; padding-bottom:4px; }
81
+ .nav-btn.active { color:var(--green); border-top-color:var(--green); font-weight:700; }
82
+ .nav-icon { font-size:20px; line-height:1; }
83
+
84
+ /* ════ MAP ════ */
85
+ #map { flex:1; width:100%; z-index:1; }
86
+ .leaflet-control-zoom { border:none !important; box-shadow:0 2px 12px rgba(0,0,0,.15) !important; }
87
+ .leaflet-control-zoom a { border-radius:8px !important; border:none !important; font-weight:600 !important; color:var(--text) !important; }
88
+ #sighting-card { position:absolute; bottom:14px; left:14px; right:14px; background:var(--white); border-radius:16px; padding:14px 16px; box-shadow:0 4px 24px rgba(0,0,0,.14); z-index:400; display:flex; align-items:center; gap:12px; transition:opacity .2s,transform .2s; }
89
+ #sighting-card.hidden { opacity:0; pointer-events:none; transform:translateY(8px); }
90
+ #sighting-card .card-photo { width:52px; height:52px; border-radius:50%; flex-shrink:0; background:var(--bg); display:flex; align-items:center; justify-content:center; font-size:24px; overflow:hidden; }
91
+ #sighting-card .card-photo img { width:100%; height:100%; object-fit:cover; }
92
+ #sighting-card .card-info { flex:1; min-width:0; }
93
+ #sighting-card .card-top { display:flex; align-items:center; gap:6px; margin-bottom:3px; }
94
+ .badge { background:var(--green-pale); color:var(--green); border-radius:20px; padding:2px 10px; font-size:11px; font-weight:700; }
95
+ .badge.urgent { background:#ffebee; color:var(--red); }
96
+ .badge.orange { background:#fff3e0; color:var(--orange); }
97
+ #sighting-card .card-time { font-size:11px; color:var(--text-muted); }
98
+ #sighting-card .card-location { font-weight:600; font-size:13px; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
99
+ #sighting-card .card-sub { font-size:12px; color:var(--text-muted); margin-top:1px; }
100
+ .btn-ficha { background:var(--green); color:#fff; border:none; border-radius:10px; padding:8px 14px; font-size:12px; font-weight:600; white-space:nowrap; cursor:pointer; font-family:inherit; flex-shrink:0; transition:background .15s; }
101
+ .btn-ficha:hover { background:var(--green-dark); }
102
+ #map-empty { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); background:var(--white); border-radius:12px; padding:14px 20px; font-size:13px; color:var(--text-muted); box-shadow:0 2px 12px rgba(0,0,0,.1); z-index:500; display:none; pointer-events:none; }
103
+
104
+ /* ════ REGISTER ════ */
105
+ #screen-register { background:#111; }
106
+ #viewfinder { flex:1; position:relative; background:#111; overflow:hidden; display:flex; align-items:center; justify-content:center; min-height:0; }
107
+ #photo-preview { width:100%; height:100%; object-fit:cover; display:none; }
108
+ #camera-placeholder { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; color:rgba(255,255,255,.35); }
109
+ #camera-placeholder svg { width:56px; height:56px; stroke:rgba(255,255,255,.3); fill:none; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
110
+ #camera-placeholder p { font-size:14px; }
111
+ #gps-pill { position:absolute; top:14px; left:16px; right:16px; background:rgba(255,255,255,.92); backdrop-filter:blur(8px); border-radius:12px; padding:10px 14px; display:flex; align-items:center; gap:10px; font-size:13px; font-weight:500; color:var(--text); box-shadow:0 2px 12px rgba(0,0,0,.15); cursor:pointer; }
112
+ #gps-pill svg { width:16px; height:16px; flex-shrink:0; stroke:var(--green); fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
113
+ #gps-text { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--text-muted); }
114
+ #gps-text.located { color:var(--text); font-weight:600; }
115
+ #shutter-btn { position:absolute; bottom:20px; left:50%; transform:translateX(-50%); width:72px; height:72px; border-radius:50%; background:var(--green); border:4px solid rgba(255,255,255,.9); box-shadow:0 4px 20px rgba(0,0,0,.4); display:flex; align-items:center; justify-content:center; cursor:pointer; transition:transform .1s; }
116
+ #shutter-btn:active { transform:translateX(-50%) scale(.93); }
117
+ #shutter-btn svg { width:28px; height:28px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
118
+ #photo-input { display:none; }
119
+ #reg-sheet { background:var(--white); border-radius:20px 20px 0 0; padding:10px 16px 16px; flex-shrink:0; box-shadow:0 -4px 20px rgba(0,0,0,.12); }
120
+ .drag-handle { width:40px; height:5px; border-radius:3px; background:#DDD; margin:0 auto 14px; }
121
+ #notes-row { display:flex; align-items:center; gap:10px; background:var(--bg); border-radius:10px; padding:10px 14px; margin-bottom:12px; }
122
+ #notes-row svg { width:16px; height:16px; flex-shrink:0; stroke:var(--text-muted); fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
123
+ #notes-input { flex:1; border:none; background:transparent; font-family:inherit; font-size:13px; color:var(--text); resize:none; outline:none; line-height:1.4; max-height:60px; overflow-y:auto; }
124
+ #notes-input::placeholder { color:var(--text-muted); }
125
+ .btn-secondary { width:100%; padding:14px; border-radius:12px; font-size:15px; font-weight:600; font-family:inherit; cursor:pointer; transition:all .15s; margin-bottom:10px; display:flex; align-items:center; justify-content:center; gap:8px; background:var(--green-pale); color:var(--green); border:1.5px solid var(--green-pale); }
126
+ .btn-secondary:hover { background:var(--green-soft); border-color:var(--green); }
127
+ .btn-secondary svg { width:18px; height:18px; fill:none; stroke:var(--green); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
128
+ .btn-secondary.located { background:var(--green); color:#fff; border-color:var(--green); }
129
+ .btn-secondary.located svg { stroke:#fff; }
130
+ .btn-primary { width:100%; padding:15px; border-radius:12px; font-size:15px; font-weight:700; font-family:inherit; cursor:pointer; transition:all .15s; display:flex; align-items:center; justify-content:center; gap:8px; background:var(--green); color:#fff; border:none; }
131
+ .btn-primary:hover { background:var(--green-dark); }
132
+ .btn-primary:disabled { background:#ccc; cursor:not-allowed; }
133
+ .btn-primary svg { width:18px; height:18px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
134
+
135
+ /* ════ ANALYSIS ════ */
136
+ #screen-analysis { background:var(--bg); overflow-y:auto; }
137
+ .flow-header { position:sticky; top:0; z-index:100; background:var(--white); border-bottom:1px solid var(--border); display:flex; align-items:center; gap:12px; padding:0 16px; height:var(--header-h); flex-shrink:0; }
138
+ .flow-header .back-btn { background:transparent; border:none; cursor:pointer; padding:8px; border-radius:50%; display:flex; align-items:center; justify-content:center; margin-left:-8px; }
139
+ .flow-header .back-btn svg { width:20px; height:20px; fill:none; stroke:var(--text); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
140
+ .flow-header h2 { font-size:16px; font-weight:700; color:var(--text); }
141
+ #analysis-photo-wrap { position:relative; background:#111; flex-shrink:0; }
142
+ #analysis-photo { width:100%; max-height:300px; object-fit:cover; display:block; }
143
+ #ai-badge { position:absolute; top:12px; right:12px; background:rgba(0,0,0,.6); backdrop-filter:blur(4px); color:#fff; border-radius:20px; padding:5px 12px; font-size:12px; font-weight:600; display:flex; align-items:center; gap:6px; }
144
+ #ai-badge .dot { width:8px; height:8px; border-radius:50%; background:var(--green); animation:pulse-dot 1.2s ease-in-out infinite; }
145
+ @keyframes pulse-dot { 0%,100%{opacity:.4;transform:scale(.8)} 50%{opacity:1;transform:scale(1)} }
146
+ #ai-badge.done { background:rgba(56,140,89,.9); }
147
+ #ai-badge.done .dot { animation:none; background:#fff; }
148
+ #animal-result-badge { position:absolute; bottom:12px; left:50%; transform:translateX(-50%); background:rgba(56,140,89,.92); backdrop-filter:blur(4px); color:#fff; border-radius:20px; padding:7px 18px; font-size:13px; font-weight:700; display:flex; align-items:center; gap:8px; white-space:nowrap; opacity:0; transition:opacity .3s; }
149
+ #animal-result-badge.visible { opacity:1; }
150
+ #animal-result-badge svg { width:16px; height:16px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
151
+ .analysis-card { background:var(--white); border-radius:16px; margin:12px 16px; padding:16px; box-shadow:0 1px 6px rgba(0,0,0,.06); }
152
+ .analysis-card h3 { font-size:16px; font-weight:700; color:var(--text); margin-bottom:4px; display:flex; align-items:center; justify-content:space-between; }
153
+ .analysis-card h3 button { background:transparent; border:none; cursor:pointer; padding:4px; color:var(--text-muted); font-size:16px; }
154
+ .analysis-card .subtitle { font-size:13px; color:var(--text-muted); margin-bottom:14px; line-height:1.4; }
155
+ .dropdowns-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:14px; }
156
+ .dropdown-field label { display:block; font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:5px; }
157
+ .dropdown-field select { width:100%; padding:10px 12px; border:1.5px solid var(--border); border-radius:10px; font-family:inherit; font-size:13px; font-weight:500; color:var(--text); background:var(--bg); cursor:pointer; outline:none; appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 12px center; padding-right:32px; }
158
+ .dropdown-field select:focus { border-color:var(--green); background-color:var(--white); }
159
+ .condition-label { font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:8px; }
160
+ .condition-chips { display:flex; flex-wrap:wrap; gap:8px; }
161
+ .cond-chip { border-radius:20px; border:1.5px solid var(--border); background:var(--white); color:var(--text); padding:6px 14px; font-size:13px; font-weight:500; cursor:pointer; font-family:inherit; transition:all .15s; display:flex; align-items:center; gap:5px; }
162
+ .cond-chip.active { background:var(--green); border-color:var(--green); color:#fff; }
163
+ .cond-chip .check { display:none; font-size:12px; }
164
+ .cond-chip.active .check { display:inline; }
165
+ .similar-scroll { display:flex; gap:12px; overflow-x:auto; padding:4px 0 8px; scrollbar-width:none; }
166
+ .similar-scroll::-webkit-scrollbar { display:none; }
167
+ .similar-card { flex-shrink:0; width:148px; border-radius:12px; overflow:hidden; border:1.5px solid var(--border); background:var(--white); }
168
+ .match-pct { position:absolute; bottom:6px; left:6px; background:rgba(0,0,0,.65); color:#fff; border-radius:6px; padding:2px 7px; font-size:11px; font-weight:700; }
169
+ .similar-card-info { padding:8px 10px; }
170
+ .similar-card-info .days { font-size:12px; font-weight:600; color:var(--text); }
171
+ .similar-card-info .dist { font-size:11px; color:var(--text-muted); }
172
+ #analysis-actions { padding:12px 16px 20px; background:var(--white); border-top:1px solid var(--border); display:flex; flex-direction:column; gap:10px; flex-shrink:0; position:sticky; bottom:0; z-index:50; }
173
+ .btn-outline { width:100%; padding:14px; border-radius:12px; font-size:15px; font-weight:600; font-family:inherit; cursor:pointer; background:transparent; color:var(--text-muted); border:1.5px solid var(--border); transition:all .15s; }
174
+ .btn-outline:hover { border-color:var(--text-muted); color:var(--text); }
175
+
176
+ /* ════ CONFIRM ════ */
177
+ #screen-confirm { background:var(--bg); align-items:center; justify-content:center; overflow-y:auto; }
178
+ #confirm-inner { width:100%; max-width:360px; padding:40px 24px 32px; display:flex; flex-direction:column; align-items:center; }
179
+ #confirm-photo-wrap { position:relative; margin-bottom:20px; }
180
+ #confirm-photo { width:160px; height:160px; border-radius:50%; background:var(--bg); display:flex; align-items:center; justify-content:center; font-size:64px; border:4px solid var(--white); box-shadow:0 4px 20px rgba(0,0,0,.15); overflow:hidden; }
181
+ #confirm-photo img { width:100%; height:100%; object-fit:cover; }
182
+ #confirm-check { position:absolute; bottom:4px; right:4px; width:44px; height:44px; border-radius:50%; background:var(--green); border:3px solid var(--white); display:flex; align-items:center; justify-content:center; }
183
+ #confirm-check svg { width:20px; height:20px; fill:none; stroke:#fff; stroke-width:2.5; stroke-linecap:round; stroke-linejoin:round; }
184
+ #confirm-title { font-size:26px; font-weight:800; color:var(--text); text-align:center; line-height:1.2; margin-bottom:24px; }
185
+ #confirm-card { width:100%; background:var(--white); border-radius:16px; overflow:hidden; box-shadow:0 2px 12px rgba(0,0,0,.07); margin-bottom:24px; }
186
+ .confirm-row { display:flex; align-items:center; justify-content:space-between; padding:14px 18px; gap:12px; }
187
+ .confirm-row + .confirm-row { border-top:1px solid var(--border); }
188
+ .confirm-row-label { display:flex; align-items:center; gap:8px; font-size:14px; color:var(--text-muted); font-weight:500; }
189
+ .confirm-row-label svg { width:16px; height:16px; fill:none; stroke:var(--text-muted); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
190
+ .confirm-row-value { font-size:14px; font-weight:700; color:var(--text); text-align:right; }
191
+ .confirm-btns { width:100%; display:flex; flex-direction:column; gap:10px; }
192
+
193
+ /* ════ SIGHTINGS LIST ════ */
194
+ #screen-sightings { background:var(--bg); }
195
+ #sightings-header { background:var(--white); border-bottom:1px solid var(--border); padding:12px 16px; display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
196
+ #sightings-header span { font-size:13px; font-weight:600; color:var(--text-muted); }
197
+ #refresh-btn { background:transparent; border:none; cursor:pointer; font-size:18px; color:var(--green); padding:4px 8px; border-radius:8px; }
198
+ #animals-list { flex:1; overflow-y:auto; padding:10px 0 8px; }
199
+ .animal-item { display:flex; align-items:center; gap:12px; background:var(--white); margin:6px 14px; border-radius:14px; padding:12px 14px; box-shadow:0 1px 6px rgba(0,0,0,.06); cursor:pointer; transition:box-shadow .15s; border:1.5px solid transparent; }
200
+ .animal-item:hover { box-shadow:0 3px 14px rgba(0,0,0,.1); border-color:var(--green-pale); }
201
+ .animal-item-photo { width:58px; height:58px; border-radius:12px; flex-shrink:0; background:var(--bg); display:flex; align-items:center; justify-content:center; font-size:28px; overflow:hidden; }
202
+ .animal-item-photo img { width:100%; height:100%; object-fit:cover; }
203
+ .animal-item-info { flex:1; min-width:0; }
204
+ .animal-item-name { font-weight:700; font-size:14px; color:var(--text); margin-bottom:2px; }
205
+ .animal-item-breed { font-size:12px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:4px; }
206
+ .animal-item-meta { font-size:11px; color:var(--text-muted); }
207
+ .animal-item-meta.urgent { color:var(--red); }
208
+ .animal-item-badge { flex-shrink:0; background:var(--green-pale); color:var(--green); border-radius:20px; padding:4px 10px; font-size:12px; font-weight:700; }
209
+ .animal-item-badge.urgent { background:#ffebee; color:var(--red); }
210
+ .animals-empty { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; padding:40px 24px; text-align:center; color:var(--text-muted); }
211
+ .animals-empty .ph-icon { font-size:52px; opacity:.3; }
212
+ .animals-empty p { font-size:14px; }
213
+
214
+ /* ════ PROFILE / FICHA ════ */
215
+ #screen-profile { background:var(--white); }
216
+ .profile-scroll { flex:1; overflow-y:auto; min-height:0; }
217
+
218
+ /* Hero */
219
+ .profile-hero { position:relative; height:280px; background:#111; flex-shrink:0; }
220
+ .profile-hero-img { width:100%; height:100%; object-fit:cover; display:block; }
221
+ .hero-gradient { position:absolute; bottom:0; left:0; right:0; height:140px; background:linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 100%); }
222
+ .hero-top-btns { position:absolute; top:16px; left:0; right:0; display:flex; justify-content:space-between; padding:0 16px; }
223
+ .hero-btn { width:40px; height:40px; border-radius:50%; background:rgba(255,255,255,.92); border:none; cursor:pointer; display:flex; align-items:center; justify-content:center; backdrop-filter:blur(4px); transition:background .15s; }
224
+ .hero-btn:hover { background:#fff; }
225
+ .hero-btn svg { width:18px; height:18px; fill:none; stroke:var(--text); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
226
+ #profile-sightings-badge { position:absolute; bottom:14px; left:16px; background:rgba(56,140,89,.88); backdrop-filter:blur(4px); color:#fff; border-radius:20px; padding:6px 14px; font-size:12px; font-weight:700; display:flex; align-items:center; gap:6px; }
227
+ #profile-sightings-badge svg { width:14px; height:14px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
228
+
229
+ /* Profile content */
230
+ .profile-content { padding:20px 16px 0; background:var(--white); }
231
+ #profile-title { font-size:24px; font-weight:800; color:var(--text); margin-bottom:6px; }
232
+ #profile-status { display:flex; align-items:center; gap:7px; font-size:13px; color:var(--text-muted); margin-bottom:24px; }
233
+ #profile-status .status-dot { width:8px; height:8px; border-radius:50%; background:var(--green); flex-shrink:0; }
234
+
235
+ /* Identification grid */
236
+ .section-title { font-size:16px; font-weight:700; color:var(--text); margin-bottom:12px; }
237
+ .id-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:24px; }
238
+ .id-cell { background:var(--bg); border-radius:12px; padding:12px 14px; }
239
+ .id-cell-label { font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:6px; }
240
+ .id-cell-value { font-size:14px; font-weight:600; color:var(--text); display:flex; align-items:center; gap:6px; }
241
+ .id-cell-value .color-dot { width:14px; height:14px; border-radius:50%; flex-shrink:0; }
242
+
243
+ /* Gallery */
244
+ .gallery-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
245
+ .gallery-see-all { font-size:13px; font-weight:600; color:var(--green); background:transparent; border:none; cursor:pointer; font-family:inherit; }
246
+ .gallery-scroll { display:flex; gap:10px; overflow-x:auto; scrollbar-width:none; margin:0 -16px; padding:0 16px 4px; margin-bottom:24px; }
247
+ .gallery-scroll::-webkit-scrollbar { display:none; }
248
+ .gallery-card { flex-shrink:0; width:150px; border-radius:12px; overflow:hidden; border:1px solid var(--border); background:var(--bg); }
249
+ .gallery-card-img { width:150px; height:110px; object-fit:cover; display:block; background:var(--bg); }
250
+ .gallery-card-info { padding:8px 10px; }
251
+ .gallery-card-date { font-size:11px; color:var(--text-muted); margin-bottom:2px; display:flex; align-items:center; gap:4px; }
252
+ .gallery-card-date svg { width:10px; height:10px; fill:none; stroke:var(--text-muted); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
253
+ .gallery-card-loc { font-size:12px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
254
+
255
+ /* Trajectory */
256
+ #trajectory-map { width:100%; height:180px; border-radius:12px; overflow:hidden; background:var(--bg); margin-bottom:8px; border:1px solid var(--border); }
257
+ .profile-section { margin-bottom:24px; }
258
+
259
+ /* Profile footer */
260
+ .profile-footer { padding:12px 16px 20px; background:var(--white); border-top:1px solid var(--border); flex-shrink:0; }
261
+ .btn-adopt { width:100%; padding:16px; border-radius:14px; font-size:16px; font-weight:700; font-family:inherit; cursor:pointer; background:var(--green); color:#fff; border:none; display:flex; align-items:center; justify-content:center; gap:8px; transition:background .15s; }
262
+ .btn-adopt:hover { background:var(--green-dark); }
263
+
264
+ /* ── Spinners & animations ── */
265
+ @keyframes spin { to { transform:rotate(360deg); } }
266
+ .spinner { width:16px; height:16px; border:2px solid rgba(255,255,255,.3); border-top-color:#fff; border-radius:50%; animation:spin .7s linear infinite; }
267
+ .skeleton { background:linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%); background-size:200% 100%; animation:shimmer 1.4s infinite; border-radius:8px; }
268
+ @keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
269
+
270
+ /* ── Lucide icon sizing ─────────────────────────────────────────────────── */
271
+ /* Nav icons */
272
+ .nav-icon svg { width: 22px; height: 22px; display: block; }
273
+ .nav-btn.active .nav-icon svg { stroke: var(--green); }
274
+ .nav-btn .nav-icon svg { stroke: var(--text-muted); }
275
+
276
+ /* Filter chip icons */
277
+ .chip svg { width: 15px; height: 15px; vertical-align: middle; margin-right: 2px; }
278
+
279
+ /* Condition chip check icon */
280
+ .check svg { width: 12px; height: 12px; }
281
+
282
+ /* Card photo placeholder */
283
+ .card-photo svg { width: 28px; height: 28px; stroke: var(--text-muted); }
284
+
285
+ /* Map empty */
286
+ #map-empty svg { display: none; }
287
+
288
+ /* Edit button */
289
+ #edit-btn svg { width: 14px; height: 14px; stroke: var(--text-muted); }
290
+
291
+ /* Confirm photo placeholder */
292
+ #confirm-photo svg { width: 72px; height: 72px; }
293
+
294
+ /* Similar card placeholder */
295
+ .similar-card svg { opacity: .4; }
296
+
297
+ /* Animals empty / ph-icon */
298
+ .ph-icon svg { width: 52px; height: 52px; stroke: var(--text-muted); opacity: .3; }
299
+ .ph-icon { display: flex; align-items: center; justify-content: center; }
300
+
301
+ /* Refresh button */
302
+ #refresh-btn svg { width: 18px; height: 18px; stroke: var(--green); display: block; }
303
+
304
+ /* Adopt button */
305
+ .btn-adopt svg { width: 18px; height: 18px; stroke: #fff; fill: #fff; }
306
+
307
+ /* ── Gallery card menu ── */
308
+ .gallery-card-img-wrap { position:relative; }
309
+ .gallery-card-menu-btn { position:absolute; top:6px; right:6px; width:28px; height:28px; background:rgba(0,0,0,.45); border:none; border-radius:50%; display:flex; align-items:center; justify-content:center; cursor:pointer; color:#fff; padding:0; }
310
+ .gallery-card-menu-btn svg { width:14px; height:14px; }
311
+ .photo-menu { position:absolute; z-index:800; background:#fff; border-radius:10px; box-shadow:0 4px 20px rgba(0,0,0,.15); overflow:hidden; min-width:160px; }
312
+ #photo-menu-download { display:flex; align-items:center; gap:10px; padding:13px 16px; font-size:14px; font-weight:500; color:var(--text); background:none; border:none; cursor:pointer; width:100%; }
313
+ #photo-menu-download:active { background:var(--bg); }
314
+ #photo-menu-download svg { width:16px; height:16px; flex-shrink:0; color:var(--text-muted); }
315
+
316
+ /* ── Helped banner & events ── */
317
+ #profile-helped-banner { display:flex; align-items:center; gap:8px; background:var(--green-soft); border:1px solid var(--green-pale); border-radius:10px; padding:10px 14px; margin:10px 0 4px; font-size:13px; color:var(--green-dark); font-weight:500; }
318
+ #profile-helped-banner i { flex-shrink:0; }
319
+ .helped-events { display:flex; flex-direction:column; gap:8px; margin-top:12px; }
320
+ .helped-event { display:flex; align-items:center; gap:10px; padding:10px 12px; background:var(--green-soft); border-radius:10px; }
321
+ .helped-event-icon { flex-shrink:0; display:flex; }
322
+ .helped-event-text { display:flex; flex-direction:column; gap:1px; }
323
+ .helped-event-text span { font-size:13px; font-weight:500; color:var(--green-dark); }
324
+ .helped-event-text small { font-size:11px; color:var(--text-muted); }
325
+
326
+ /* ── Help bottom sheet ── */
327
+ #help-overlay { position:absolute; inset:0; background:rgba(0,0,0,.45); z-index:500; }
328
+ .help-sheet { position:absolute; bottom:0; left:0; right:0; background:#fff; border-radius:20px 20px 0 0; z-index:501; padding:12px 0 32px; transform:translateY(100%); transition:transform .3s cubic-bezier(.4,0,.2,1); }
329
+ .help-sheet.open { transform:translateY(0); }
330
+ #help-animal-row { display:flex; align-items:center; gap:12px; padding:12px 20px 16px; border-bottom:1px solid var(--border); }
331
+ #help-animal-photo { width:48px; height:48px; border-radius:12px; overflow:hidden; background:var(--bg); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:26px; }
332
+ #help-animal-photo img { width:100%; height:100%; object-fit:cover; }
333
+ #help-animal-name { font-size:15px; font-weight:700; color:var(--text); }
334
+ #help-animal-sub { font-size:12px; color:var(--text-muted); margin-top:2px; }
335
+ .help-actions { display:flex; flex-direction:column; padding:8px 0; }
336
+ .help-action-btn { display:flex; align-items:center; gap:14px; padding:14px 20px; background:none; border:none; cursor:pointer; text-align:left; transition:background .12s; width:100%; }
337
+ .help-action-btn:active { background:var(--bg); }
338
+ .help-action-icon { font-size:24px; width:32px; text-align:center; flex-shrink:0; }
339
+ .help-action-text { flex:1; }
340
+ .help-action-text strong { display:block; font-size:15px; font-weight:600; color:var(--text); }
341
+ .help-action-text small { display:block; font-size:12px; color:var(--text-muted); margin-top:1px; }
342
+ .help-chevron { width:18px; height:18px; fill:none; stroke:#ccc; stroke-width:2; stroke-linecap:round; flex-shrink:0; }
343
+ .help-cancel { display:block; width:calc(100% - 40px); margin:8px 20px 0; padding:14px; background:var(--bg); border:none; border-radius:12px; font-size:15px; font-weight:600; color:var(--text-muted); cursor:pointer; }
344
+
345
+ /* ── Helped confirmation ── */
346
+ .helped-confirm { position:absolute; inset:0; background:rgba(0,0,0,.5); z-index:600; display:flex; align-items:center; justify-content:center; padding:24px; opacity:0; transition:opacity .25s; }
347
+ .helped-confirm.open { opacity:1; }
348
+ .helped-inner { background:#fff; border-radius:20px; padding:32px 24px; text-align:center; width:100%; max-width:320px; }
349
+ .helped-icon-wrap { width:56px; height:56px; background:var(--green-soft); border-radius:50%; display:flex; align-items:center; justify-content:center; margin:0 auto 16px; }
350
+ .helped-icon-wrap i { color:var(--green); }
351
+ .helped-inner h3 { font-size:20px; font-weight:800; margin-bottom:8px; color:var(--text); }
352
+ .helped-inner p { font-size:14px; color:var(--text-muted); line-height:1.5; margin-bottom:24px; }
353
+ #helped-ok { width:100%; padding:14px; background:var(--green); color:#fff; border:none; border-radius:12px; font-size:15px; font-weight:700; cursor:pointer; }
354
+
355
+ /* Profile sightings badge */
356
+ #profile-sightings-badge svg { width: 14px; height: 14px; stroke: #fff; }
357
+
358
+ /* Urgent triangle icon inline */
359
+ .animal-item-meta svg { vertical-align: middle; display: inline; }
360
+
361
+ /* ── AI description callout (profile) ──────────────────────────────────── */
362
+ .ai-desc-callout {
363
+ display: flex;
364
+ align-items: flex-start;
365
+ gap: 10px;
366
+ background: var(--green-soft);
367
+ border: 1px solid var(--green-pale);
368
+ border-radius: 12px;
369
+ padding: 12px 14px;
370
+ margin-bottom: 24px;
371
+ }
372
+ .ai-label {
373
+ background: var(--green);
374
+ color: #fff;
375
+ font-size: 10px;
376
+ font-weight: 800;
377
+ letter-spacing: .5px;
378
+ border-radius: 6px;
379
+ padding: 2px 7px;
380
+ flex-shrink: 0;
381
+ margin-top: 1px;
382
+ }
383
+ .ai-desc-callout p {
384
+ font-size: 13px;
385
+ color: var(--text);
386
+ line-height: 1.5;
387
+ margin: 0;
388
+ }
389
+
390
+ /* ── Confirm identification grid ─────────────────────────────────────────── */
391
+ .confirm-id-grid {
392
+ width: 100%;
393
+ margin-bottom: 20px;
394
+ }
395
+ .cig-label {
396
+ font-size: 11px;
397
+ font-weight: 700;
398
+ color: var(--text-muted);
399
+ text-transform: uppercase;
400
+ letter-spacing: .4px;
401
+ margin-bottom: 10px;
402
+ text-align: center;
403
+ }
404
+ .cig-cells {
405
+ display: grid;
406
+ grid-template-columns: 1fr 1fr;
407
+ gap: 8px;
408
+ }
409
+ .cig-cell {
410
+ background: var(--bg);
411
+ border-radius: 10px;
412
+ padding: 10px 12px;
413
+ }
414
+ .cig-cell.cig-full {
415
+ grid-column: 1 / -1;
416
+ }
417
+ .cig-key {
418
+ font-size: 10px;
419
+ font-weight: 600;
420
+ color: var(--text-muted);
421
+ text-transform: uppercase;
422
+ letter-spacing: .4px;
423
+ margin-bottom: 4px;
424
+ }
425
+ .cig-val {
426
+ font-size: 13px;
427
+ font-weight: 600;
428
+ color: var(--text);
429
+ display: flex;
430
+ align-items: center;
431
+ gap: 4px;
432
+ }
433
+ .cig-val svg { width: 13px; height: 13px; flex-shrink: 0; }
434
+
435
+ /* ── AI badge error state ────────────────────────────────────────────────── */
436
+ #ai-badge.error { background: rgba(229,57,53,.88); }
437
+ #animal-result-badge.error {
438
+ background: rgba(229,57,53,.92);
439
+ font-size: 12px;
440
+ max-width: calc(100% - 24px);
441
+ text-align: center;
442
+ white-space: normal;
443
+ line-height: 1.4;
444
+ padding: 10px 16px;
445
+ }
446
 
447
  /* ── Help Proof Screen ────────────────────────────────────────────────────── */
448
  #screen-help-proof { display:flex; flex-direction:column; padding:0 0 100px; overflow-y:auto; background:var(--white); }