Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
4557 lines (4376 loc) · 312 KB
/
Copy pathindex.html
File metadata and controls
4557 lines (4376 loc) · 312 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="theme-color" content="#EDE3D0">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Tavola">
<link rel="manifest" href="manifest.json">
<link rel="icon" type="image/png" href="icon-192.png">
<link rel="apple-touch-icon" href="icon-192.png">
<title>Tavola</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;500;600;700&family=Marcellus&display=swap" rel="stylesheet">
<script src="https://www.gstatic.com/firebasejs/10.7.1/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.7.1/firebase-auth-compat.js"></script>
<style>
:root{
--r:8px; /* corner rounding used across the app */
--r-lg:14px; /* popups */
--paper:#EDE3D0;
--paper-dark:#E2D5BC;
--ink:#2B2620;
--herb:#6B7A38;
--gold:#C08A2E;
--tomato:#B8462F;
--brown:#7A5C3E;
--card:#FAF6EC;
--line:rgba(43,38,32,0.16);
--line-strong:rgba(43,38,32,0.32);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html,body{margin:0;padding:0;background:var(--paper);color:var(--ink);font-family:'Work Sans',sans-serif;}
body{
background-image:
radial-gradient(circle at 1px 1px, rgba(43,38,32,0.06) 1px, transparent 0);
background-size: 14px 14px;
}
#app{max-width:520px;margin:0 auto;min-height:100vh;display:flex;flex-direction:column;padding-bottom:70px;position:relative;}
h1,h2,h3{font-family:'Work Sans',sans-serif;font-weight:700;}
button{font-family:'Work Sans',sans-serif;cursor:pointer;}
input,textarea,select{font-family:'Work Sans',sans-serif;}
.app-header{background:var(--ink);color:var(--paper);padding:10px 16px 10px;position:relative;margin-bottom:0;}
.brand-text{align-self:stretch;position:relative;display:flex;flex-direction:column;justify-content:center;}
.brand-sub{position:absolute;left:2px;bottom:0;line-height:1;white-space:nowrap;font-size:15px;font-weight:600;color:var(--paper);opacity:0.75;margin-top:2px;letter-spacing:0.2px;}
.brand-sub[hidden]{display:none;}
.app-header h1{margin:0;font-family:"Marcellus",Georgia,serif;font-weight:400;letter-spacing:0.5px;font-size:32.8px;white-space:nowrap;letter-spacing:0.2px;}
.app-header .tagline{margin:6px 0 0;font-size:13px;color:rgba(237,227,208,0.72);}
main{flex:1;padding:26px 16px 16px;}
/* Tab bar */
.tabbar{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:100%;max-width:520px;background:var(--card);border-top:1px solid var(--line-strong);display:flex;z-index:20;}
.tab{flex:1;border:none;background:none;padding:12px 4px 10px;font-size:12px;color:var(--brown);border-top:3px solid transparent;font-weight:600;}
.tab.active{color:var(--ink);border-top:3px solid var(--tomato);background:var(--paper-dark);}
/* Search / filters */
.search-row{display:flex;gap:8px;margin-bottom:12px;}
.search-row input{flex:1;padding:10px 12px;border:1px solid var(--line-strong);border-radius:var(--r);background:var(--card);font-size:14px;color:var(--ink);}
.np-search-row{margin:0 0 10px;}
.np-found{margin:0 0 12px;}
.search-row input:focus{outline:2px solid var(--herb);outline-offset:1px;}
.chip-row{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px;}
.chip{padding:5px 12px;border-radius:14px;border:1px solid var(--line-strong);background:var(--card);font-size:12px;color:var(--brown);font-weight:600;}
.chip.active{background:var(--ink);color:var(--paper);border-color:var(--ink);}
.add-btn{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;padding:12px;background:var(--tomato);color:#fff;border:none;border-radius:var(--r);font-size:14px;font-weight:600;margin-bottom:10px;}
.add-btn:active{opacity:0.85;}
/* Recipe cards */
.recipe-grid{display:flex;flex-direction:column;gap:18px;}
.recipe-card{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:16px 14px 14px;position:relative;box-shadow:3px 3px 0 rgba(43,38,32,0.07);cursor:pointer;}
.card-tag{position:absolute;top:-10px;left:14px;padding:2px 10px;font-family:'Work Sans',sans-serif;font-weight:600;font-size:10.5px;color:#fff;border-radius:1px;letter-spacing:0.3px;}
.recipe-card h3{margin:8px 0 2px;font-size:22px;line-height:1.2;font-weight:700;}
.recipe-sub{font-size:13px;color:var(--brown);line-height:1.35;margin-bottom:6px;}
.detail-sub{font-size:15px;color:var(--brown);line-height:1.4;margin:0 0 8px;}
.plan-item-sub{font-size:12px;color:var(--brown);line-height:1.3;margin-top:1px;}
.picker-item .pick-sub{display:block;font-style:normal;font-size:11.5px;color:var(--brown);}
.cook-step-title .cook-sub{display:block;font-weight:400;font-size:12px;opacity:.8;margin-top:2px;}
.star-svg{width:62%;height:62%;display:block;}
.fav-line .fav-btn .star-svg,.cook-finish .fav-btn .star-svg{width:22px;height:22px;}
.recipe-meta{font-size:12.5px;color:var(--brown);margin-bottom:8px;}
.cooked-btn{display:block;width:100%;margin:18px 0 4px;padding:14px;font:inherit;font-size:15px;font-weight:600;border-radius:var(--r);border:1px solid var(--ink);background:none;color:var(--ink);}
.cooked-btn.on{background:var(--herb);border-color:var(--herb);color:#fff;}
.cook-stat{font-size:12px;color:var(--herb);font-weight:600;margin:-4px 0 8px;}
.plan-item .cook-stat{margin:2px 0 0;}
.recipe-ing-preview{font-size:13px;color:var(--ink);opacity:0.75;line-height:1.4;}
.empty-state{text-align:center;padding:40px 20px;color:var(--brown);}
.empty-state h3{font-size:16px;margin-bottom:6px;color:var(--ink);}
.empty-state p{font-size:13px;line-height:1.5;}
/* Sheet (modal) */
.sheet-overlay{position:fixed;inset:0;background:rgba(43,38,32,0.5);display:flex;align-items:flex-end;justify-content:center;z-index:50;}
.sheet-overlay.hidden{display:none;}
.hidden{display:none;}
.sheet-wrap{position:relative;width:100%;max-width:520px;}
.pop-x{position:absolute;top:8px;right:8px;z-index:2;width:36px;height:36px;padding:0;border:none;background:none;color:var(--brown);display:flex;align-items:center;justify-content:center;cursor:pointer;}
.pop-x svg{width:20px;height:20px;}
.sheet > h2:first-of-type{padding-right:34px;}
.dlg-title{padding-right:30px;}
.dlg{position:relative;}
.sheet{background:var(--paper);width:100%;max-height:88vh;box-sizing:border-box;overflow-y:auto;border-radius:var(--r-lg) var(--r-lg) 0 0;padding:18px 18px 28px;position:relative;}
.sheet-handle{display:none;} /* panels close with the X only */
.sheet h2{font-size:19px;margin:0 0 14px;}
.field{margin-bottom:14px;}
.field label{display:block;font-size:12px;font-weight:600;color:var(--brown);margin-bottom:5px;text-transform:none;}
.field input,.field select,.field textarea{width:100%;padding:10px 11px;border:1px solid var(--line-strong);border-radius:var(--r);background:var(--card);font-size:14px;color:var(--ink);}
.field textarea{resize:vertical;min-height:70px;}
.row2{display:flex;gap:10px;}
.row2 .field{flex:1;}
.ing-row{display:flex;gap:6px;margin-bottom:8px;align-items:center;}
.ing-block{margin-bottom:12px;}
.ing-block .ing-row{margin-bottom:4px;}
.ing-cat{width:100%;padding:6px 9px;font-size:12px;border:1px solid var(--line);border-radius:var(--r);background:var(--paper);color:var(--brown);}
.ing-row input,.ing-row select{padding:8px 9px;font-size:13px;border:1px solid var(--line-strong);border-radius:var(--r);background:var(--card);color:var(--ink);}
.ing-row .ing-name{flex:2;}
.ing-row .ing-qty{flex:0.7;}
.ing-row .ing-unit{flex:0.9;}
.small-btn{border:1px solid var(--line-strong);background:var(--card);border-radius:var(--r);padding:8px 10px;font-size:13px;color:var(--brown);}
.remove-x{border:none;background:none;color:var(--tomato);font-size:18px;padding:0 4px;line-height:1;}
.step-row{display:flex;gap:6px;margin-bottom:8px;align-items:flex-start;}
.step-num{font-weight:700;font-size:12px;color:var(--brown);padding-top:9px;width:20px;}
.step-row textarea{flex:1;min-height:44px;font-size:13px;}
.primary-btn{display:block;width:100%;padding:12px;background:var(--tomato);color:#fff;border:none;border-radius:var(--r);font-size:14px;font-weight:600;margin-top:8px;}
.primary-btn:disabled{opacity:.45;}
.secondary-btn{display:block;width:100%;padding:12px;background:none;border:1px solid var(--line-strong);color:var(--brown);border-radius:var(--r);font-size:13px;font-weight:600;margin-top:8px;}
.danger-btn{width:100%;padding:12px;background:none;border:1px solid var(--tomato);color:var(--tomato);border-radius:var(--r);font-size:13px;margin-top:8px;}
/* Detail view */
.detail-back{background:none;border:none;color:var(--brown);font-size:13px;margin-bottom:12px;padding:0;font-weight:600;}
.detail-title{font-size:28px;line-height:1.15;margin:0 0 4px;}
.detail-section{margin-top:20px;}
.rtabs{display:flex;margin-top:16px;border-bottom:2px solid var(--line-strong);}
.rtab{flex:1;padding:11px 0;background:none;border:none;border-bottom:3px solid transparent;margin-bottom:-2px;font-size:14px;font-weight:600;color:var(--brown);}
.rtab.active{color:var(--ink);border-bottom-color:var(--tomato);}
.detail-section h4{font-family:'Work Sans',sans-serif;font-weight:700;font-size:12.5px;color:var(--brown);margin:0 0 10px;letter-spacing:0.6px;text-transform:uppercase;}
.ing-list{list-style:none;padding:0;margin:0;}
.ing-list li{padding:9px 0;border-bottom:1px solid var(--line);font-size:17px;}
.steps-list{padding-left:0;list-style:none;counter-reset:step;margin:0;}
.steps-list li{counter-increment:step;padding:11px 0 11px 32px;border-bottom:1px solid var(--line);font-size:17px;line-height:1.5;position:relative;}
.steps-list li::before{content:counter(step);position:absolute;left:0;top:13px;font-weight:700;font-size:14px;color:var(--herb);width:22px;}
.steps-list .step-ings{list-style:none;padding:0;margin:8px 0 0;}
.steps-list .step-ings li{counter-increment:none;display:flex;justify-content:space-between;gap:10px;padding:3px 0;border:none;font-size:14px;color:var(--brown);}
.steps-list .step-ings li::before{content:none;}
.steps-list .step-ings li[data-act]{cursor:pointer;}
.steps-list .step-ings li.editing{display:block;color:var(--ink);}
.step-new-link{display:block;margin:0 0 4px;padding:6px 2px;}
.step-edit-link{background:none;border:none;padding:0 2px;font:inherit;font-size:13px;color:var(--brown);text-decoration:underline;cursor:pointer;}
.step-edit-text{width:100%;min-height:110px;font:inherit;font-size:16px;line-height:1.5;padding:8px;border:1px solid var(--line-strong);border-radius:var(--r);background:#fff;color:var(--ink);box-sizing:border-box;}
.step-edit-actions{display:flex;gap:8px;margin-top:6px;}
.step-edit-actions input,.step-edit-actions select{flex:1;min-width:0;font:inherit;font-size:16px;padding:8px;border:1px solid var(--line-strong);border-radius:var(--r);background:#fff;color:var(--ink);}
.step-edit-actions button{flex:1;font:inherit;font-size:13px;font-weight:600;padding:9px 12px;border:1px solid var(--line-strong);border-radius:var(--r);background:none;color:var(--brown);}
.step-edit-actions button.ok{background:var(--tomato);border-color:var(--tomato);color:#fff;}
.recipe-sub-head{margin:18px 0 10px;font-size:14px;font-weight:700;color:var(--brown);}
/* Meal plan view */
.plan-select-wrap{margin-bottom:12px;}
.plan-select-wrap label{display:block;font-size:12px;font-weight:600;color:var(--brown);margin-bottom:5px;}
.plan-select-wrap select{width:100%;padding:11px;border:1px solid var(--line-strong);border-radius:var(--r);background:var(--card);font-size:15px;font-weight:600;color:var(--ink);}
.plan-current-label{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--herb);margin:0 0 4px;}
.plan-date{font-size:22px;font-weight:700;margin:0 0 14px;}
.prev-plan{background:var(--card);border:1px solid var(--line);border-radius:var(--r);margin-bottom:8px;}
.prev-head{display:flex;align-items:center;gap:10px;width:100%;background:none;border:none;padding:13px 12px;text-align:left;color:var(--ink);font-size:14.5px;}
.prev-arrow{color:var(--brown);width:12px;}
.prev-title{flex:1;font-weight:600;}
.prev-count{font-size:12px;color:var(--brown);}
.prev-body{padding:0 12px 12px 34px;}
.prev-meal{padding:8px 0;border-top:1px solid var(--line);font-size:14px;cursor:pointer;}
.prev-empty,.prev-extras{font-size:13px;color:var(--brown);padding:6px 0;}
.prev-actions{display:flex;gap:8px;margin-top:8px;}
.prev-del{color:var(--tomato);}
.locked-note{background:var(--card);border:1px solid var(--line-strong);border-radius:var(--r);padding:11px 12px;font-size:13px;color:var(--brown);margin-bottom:10px;line-height:1.4;}
.plan-hint{font-size:12px;color:var(--brown);margin:8px 0 0;}
.gro-bar{display:flex;align-items:center;gap:10px;margin:0 0 8px;padding:4px 0 8px;border-bottom:1px solid var(--line);}
.all-box{display:flex;align-items:center;gap:12px;flex:1;min-width:0;background:none;border:none;padding:6px 0;font:inherit;font-size:14px;color:var(--ink);text-align:left;cursor:pointer;}
.all-box .box{width:20px;height:20px;flex-shrink:0;border:1.5px solid var(--ink);border-radius:var(--r);background:var(--card);display:inline-grid;place-content:center;}
.all-box .box::after{content:"";opacity:0;}
.all-box.on .box{background:var(--ink);}
.all-box.on .box::after{width:10px;height:5px;border-left:2px solid var(--paper);border-bottom:2px solid var(--paper);transform:rotate(-45deg) translate(1px,-1px);opacity:1;}
.all-box.some .box::after{width:10px;height:2px;background:var(--ink);opacity:1;}
.gro-hide{height:40px;flex-shrink:0;padding:0 12px;background:none;border:1px solid var(--line-strong);border-radius:var(--r);font:inherit;font-size:13px;font-weight:600;color:var(--brown);white-space:nowrap;cursor:pointer;}
.icon-btn{width:40px;height:40px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:none;border:1px solid var(--line-strong);border-radius:var(--r);color:var(--ink);padding:0;cursor:pointer;}
.icon-btn .share-ico{width:20px;height:20px;}
.gro-total{display:flex;justify-content:space-between;align-items:baseline;font-size:15px;margin:0 0 12px;padding:10px 12px;background:var(--card);border:1px solid var(--line);border-radius:var(--r);}
.gro-total span{font-size:12px;color:var(--brown);}
.thumb{width:64px;height:64px;border-radius:var(--r);object-fit:cover;flex-shrink:0;display:block;cursor:pointer;}
.thumb-sm{width:36px;height:36px;}
.thumb-empty{display:flex;align-items:center;justify-content:center;color:var(--paper);font-weight:700;font-size:22px;opacity:.85;}
.thumb-sm.thumb-empty{font-size:15px;}
.prev-meal{display:flex;align-items:center;gap:10px;}
.serv-line{margin-top:7px;font-size:13px;color:var(--brown);display:flex;align-items:center;gap:8px;}
/* − and + are plain; only the number sits in a box */
.stepper{display:inline-flex;align-items:center;gap:2px;}
.stepper strong{min-width:26px;height:24px;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;padding:0 3px;text-align:center;color:var(--ink);font-size:14px;line-height:1;border:1px solid var(--line-strong);border-radius:var(--r);background:var(--card);}
.stepper{gap:6px;}
.stepper button, .plan-item .stepper button{border:none;border-radius:var(--r);background:var(--paper-dark);color:var(--ink);font:inherit;font-size:16px;font-weight:600;line-height:1;width:24px;height:24px;padding:0;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;}
/* draw − and + so they sit exactly in the middle of the button (the text stays for screen readers) */
.stepper button, .plan-item .stepper button{position:relative;font-size:0;}
.stepper button::before{content:"";position:absolute;left:50%;top:50%;width:10px;height:2px;background:currentColor;transform:translate(-50%,-50%);}
.stepper button:last-child::after{content:"";position:absolute;left:50%;top:50%;width:2px;height:10px;background:currentColor;transform:translate(-50%,-50%);}
.np-again{width:24px;height:20px;color:var(--brown);flex-shrink:0;}
.plan-count{font-size:12.5px;color:var(--brown);margin:18px 0 8px;font-weight:600;}
.plan-item{display:flex;align-items:center;gap:10px;background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:12px;margin-bottom:8px;}
.plan-item-main{flex:1;cursor:pointer;}
.plan-item-title{font-size:14.5px;font-weight:600;line-height:1.35;}
.plan-item-meta{font-size:12px;color:var(--brown);margin-top:2px;}
.plan-item button{border:none;background:none;color:var(--tomato);font-size:12px;font-weight:600;padding:6px;}
.picker-item{padding:12px 10px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;gap:10px;}
.picker-item span{flex:1;font-size:14px;line-height:1.35;}
.picker-item{justify-content:flex-start;}
.picker-item button{margin-left:auto;}
.picker-item small{display:block;font-size:11.5px;color:var(--brown);margin-top:2px;}
.picker-item .thumb{cursor:default;width:46px;height:46px;}
.picker-chips{margin-bottom:6px;flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px;}
.picker-chips .chip{flex-shrink:0;}
.picker-item button{background:var(--herb);color:#fff;border:none;border-radius:var(--r);padding:7px 12px;font-size:12px;font-weight:600;min-width:74px;}
.picker-item button.on{background:var(--ink);}
/* the ⋯ button sits in the vertical middle of the banner; the version is tucked just above it */
.header-right{position:absolute;top:50%;transform:translateY(-50%);right:12px;}
.header-btn#menu-header-btn svg{width:20px;height:20px;display:block;}
.app-menu{position:absolute;top:calc(100% - 4px);right:14px;min-width:210px;background:var(--paper);border:none;border-radius:var(--r-lg);overflow:hidden;box-shadow:0 8px 30px rgba(43,38,32,.35);z-index:60;}
.app-menu button{display:block;width:100%;text-align:left;padding:14px 16px;font:inherit;font-size:15px;font-weight:600;color:var(--ink);background:none;border:none;border-top:1px solid var(--line);border-radius:0;}
.app-menu button:first-child{border-top:none;}
.app-menu-ver{padding:10px 16px 12px;border-top:1px solid var(--line);font-size:12px;color:var(--brown);opacity:.75;}
.app-menu button:active{background:var(--paper-dark);}
.header-btn{background:rgba(237,227,208,0.12);color:var(--paper);border:1px solid rgba(237,227,208,0.32);border-radius:50%;width:34px;height:34px;padding:0;font-size:18px;line-height:1;display:flex;align-items:center;justify-content:center;}
.sheet-note{font-size:13px;color:var(--brown);line-height:1.5;margin:0 0 12px;}
.sheet-status{font-size:13px;color:var(--brown);min-height:18px;margin:8px 0;line-height:1.4;}
.sheet-steps{font-size:13px;color:var(--ink);line-height:1.6;padding-left:20px;margin:0 0 14px;}
.thumbs{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:6px;}
.thumb{position:relative;width:72px;height:72px;}
.thumb img{width:72px;height:72px;object-fit:cover;border-radius:var(--r);border:1px solid var(--line-strong);display:block;}
.thumb span{position:absolute;left:3px;bottom:3px;background:var(--ink);color:var(--paper);font-size:10px;font-weight:700;border-radius:8px;padding:1px 6px;}
.thumb button{position:absolute;top:-6px;right:-6px;width:22px;height:22px;border-radius:50%;border:none;background:var(--tomato);color:#fff;font-size:14px;line-height:1;padding:0;}
.file-chip{display:flex;align-items:center;justify-content:space-between;gap:8px;background:var(--card);border:1px solid var(--line-strong);border-radius:var(--r);padding:9px 11px;font-size:13px;margin-bottom:6px;}
.file-chip button{border:none;background:none;color:var(--tomato);font-size:18px;}
.bug-item{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:11px 12px;margin-bottom:8px;}
.bug-item.done{opacity:0.6;}
.bug-item.review{border-left:3px solid var(--gold);}
.bug-result{font-size:12px;line-height:1.45;margin-top:6px;color:var(--brown);}
#fix-lock{position:fixed;inset:0;z-index:9999;background:var(--paper);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;text-align:center;padding:24px;}
#fix-lock svg{width:130px;height:130px;}
#fix-lock .fl-msg{font-size:15px;font-weight:600;color:var(--ink);}
#fix-lock .fl-sub{font-size:12px;color:var(--brown);max-width:280px;line-height:1.5;}
#fix-lock button{border:1px solid var(--line-strong);background:none;border-radius:var(--r);padding:9px 16px;font-size:13px;font-weight:700;color:var(--herb);}
.bug-text{font-size:14px;line-height:1.45;white-space:pre-wrap;}
.bug-meta{font-size:11.5px;color:var(--brown);margin-top:5px;}
.bug-pick{margin-right:6px;vertical-align:-1px;width:18px;height:18px;accent-color:var(--herb);}
.bug-actions{display:flex;gap:14px;margin-top:8px;}
.bug-actions button{border:none;background:none;color:var(--herb);font-size:12px;font-weight:700;padding:2px 0;}
.bug-actions button.del{color:var(--tomato);}
/* Grocery list */
.grocery-group{margin-bottom:18px;}
.grocery-item{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--line);font-size:14px;}
.grocery-item input[type=checkbox]{width:18px;height:18px;accent-color:var(--herb);flex-shrink:0;}
.grocery-item.checked span{text-decoration:line-through;color:#9c8f77;}
.grocery-item{align-items:flex-start;gap:12px;padding:11px 0;}
.grocery-item input[type=checkbox]{margin-top:1px;}
.gi-name{flex:1;min-width:0;line-height:1.35;}
.gi-name::first-letter{text-transform:uppercase;}
.fav-btn{background:rgba(255,255,255,.92);border:1px solid var(--line-strong);color:var(--brown);border-radius:50%;width:38px;height:38px;font-size:18px;line-height:1;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0;flex-shrink:0;}
.fav-btn.on{color:#d99a1e;border-color:#d99a1e;}
.recipe-card .fav-btn{position:absolute;top:6px;right:8px;z-index:2;box-shadow:0 1px 4px rgba(0,0,0,.25);}
.filter-label{font-size:11px;letter-spacing:.6px;text-transform:uppercase;color:var(--brown);margin:10px 0 2px;font-weight:600;}
.fav-line{display:flex;align-items:center;gap:10px;margin:2px 0 6px;}
.fav-line .share-round .share-ico{width:20px;height:20px;}
.fav-line .fav-btn{width:40px;height:40px;}
.fav-line .fav-btn span{font-size:14px;font-weight:600;}
.done-col{display:flex;align-items:center;flex-shrink:0;cursor:pointer;padding:4px;}
.done-col input{-webkit-appearance:none;appearance:none;width:24px;height:24px;margin:0;border-radius:50%;border:2px solid var(--line-strong);background:transparent;cursor:pointer;position:relative;transition:background .15s,border-color .15s;}
.done-col input:checked{background:var(--herb);border-color:var(--herb);}
.done-col input:checked::after{content:'✓';position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:#fff;font-size:15px;font-weight:700;}
.np-total{font-size:14px;color:var(--ink);margin:14px 0 6px;}
.np-chosen{box-sizing:border-box;margin-top:14px;display:flex;flex-direction:column;gap:12px;} /* each meal is its own card */
.np-ch{display:flex;align-items:center;gap:10px;min-height:50px;box-sizing:border-box;padding:8px;border:1px solid var(--line-strong);border-radius:var(--r);background:var(--card);}
.np-tools{margin-top:0;}
.np-tools .share-btn{flex-direction:column;gap:4px;padding:10px 4px 8px;}
.btn-ico-row{display:inline-flex;align-items:center;justify-content:center;gap:8px;}
.btn-ico-row .share-ico{width:20px;height:20px;}
.tool-l{font-size:12px;font-weight:600;line-height:1.1;color:var(--brown);}
.np-carried{position:relative;border-radius:var(--r);display:flex;flex-direction:column;gap:12px;margin:0 -10px;padding:24px 10px 12px;outline:2px solid #E07B22;outline-offset:-2px;} /* the box sits outside the cards so they are as wide as the others */
.np-carried-l{position:absolute;top:0;left:0;border-radius:var(--r) 0 var(--r) 0;padding:2px 7px 3px;background:#E07B22;color:#fff;font-size:10.5px;font-weight:700;line-height:1.2;}
.np-sg-l{display:flex;align-items:center;gap:8px;}
.info-btn{width:20px;height:20px;flex-shrink:0;border:none;background:none;color:var(--brown);padding:0;display:inline-flex;align-items:center;justify-content:center;vertical-align:-4px;cursor:pointer;}
.info-btn svg{width:20px;height:20px;display:block;}
.np-ch .thumb{width:72px;height:72px;}
.np-fav{position:absolute;right:-5px;bottom:-5px;width:20px;height:20px;padding:3px;box-sizing:border-box;border-radius:50%;background:var(--card);color:var(--gold);}
.np-xsp{width:30px;flex-shrink:0;}
.np-suggest{position:relative;margin-top:14px;padding:14px 12px;border:1px solid var(--line-strong);border-radius:var(--r);background:var(--card);}
.np-sg-col{display:flex;flex-direction:column;align-items:center;gap:10px;}
.np-suggest .np-sg-l{justify-content:center;height:26px;}
.np-suggest .np-sg-l strong{display:block;font-size:17px;}
.np-suggest .np-big{gap:10px;}
.np-suggest .np-big button, .np-suggest .np-big strong{height:44px;}
.np-suggest .np-big button{width:44px;}
.np-suggest .np-big button::before{width:15px;}
.np-suggest .np-big button:last-child::after{height:15px;}
.np-suggest .np-big strong{min-width:52px;font-size:21px;}
/* serves is small and to the side so the meals counter leads */
.np-suggest small{display:block;font-size:11.5px;color:var(--brown);margin-top:2px;}
.np-ch-t{flex:1;min-width:0;font-size:16px;font-weight:600;line-height:1.3;overflow-wrap:anywhere;cursor:pointer;}
.np-th{position:relative;flex-shrink:0;display:block;}
.np-side{display:flex;flex-direction:column;align-items:flex-end;gap:4px;flex-shrink:0;} /* × above the serves so the name gets more room */
.np-x{border:none;background:none;font-size:22px;line-height:1;color:var(--brown);padding:2px 6px 4px;margin-right:-2px;cursor:pointer;flex-shrink:0;}
.np-ch{position:relative;}
/* remove sits in a circle over the right edge of the list */
.np-ch{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;}
.np-ch .np-swap{position:absolute;top:-9px;right:-9px;z-index:2;width:22px;height:22px;margin:0;padding:0;border:none;border-radius:50%;background:var(--ink);color:var(--paper);display:flex;align-items:center;justify-content:center;cursor:pointer;}
.np-ch .np-swap svg{width:13px;height:13px;}
.np-ch.sel{outline:2px solid var(--herb);outline-offset:-2px;background:color-mix(in srgb, var(--herb) 8%, var(--card));}
.np-tick{position:absolute;top:-9px;right:-9px;z-index:2;width:22px;height:22px;border-radius:50%;border:2px solid var(--line-strong);background:var(--card);box-sizing:border-box;}
.np-tick.on{border-color:var(--herb);background:var(--herb);}
.np-tick.on::after{content:"";position:absolute;left:50%;top:45%;width:8px;height:4px;border-left:2px solid #fff;border-bottom:2px solid #fff;transform:translate(-50%,-50%) rotate(-45deg);}
body.np-selecting .app-header, body.np-selecting .tabbar, body.np-selecting #np-chosen ~ *{display:none;} /* only the meals, the bin and Cancel while choosing */
.np-fab-wrap{position:fixed;left:0;right:0;bottom:calc(20px + env(safe-area-inset-bottom, 0px));z-index:40;display:flex;flex-direction:column-reverse;align-items:center;gap:10px;pointer-events:none;} /* bin with Cancel under it, both centred */
.np-fab-wrap button{pointer-events:auto;}
.np-fab{position:relative;width:60px;height:60px;border-radius:50%;border:none;background:var(--tomato);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 4px 14px rgba(43,38,32,.35);}
.np-fab svg{width:28px;height:28px;}
.np-fab-n{position:absolute;top:-4px;right:-4px;min-width:22px;height:22px;padding:0 5px;box-sizing:border-box;border-radius:11px;background:var(--ink);color:var(--paper);font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;}
.np-sel-x{border:1px solid var(--line-strong);border-radius:var(--r);background:var(--card);color:var(--ink);font:inherit;font-size:14px;font-weight:600;padding:9px 14px;cursor:pointer;box-shadow:0 2px 8px rgba(43,38,32,.2);}
body.np-selecting main{padding-bottom:72px;}
.np-srv{display:inline-flex;align-items:center;gap:5px;flex-shrink:0;padding:5px 8px;border:1px solid var(--line-strong);border-radius:var(--r);background:var(--card);color:var(--ink);font:inherit;font-size:15px;cursor:pointer;}
.np-srv strong{font-weight:700;}
.np-srv.fixed{border-color:transparent;background:none;cursor:default;padding-right:2px;}
.np-srv .np-plate{width:17px;height:17px;color:var(--brown);}
.np-srv .np-again{width:18px;height:18px;}
.srv-pick{display:flex;flex-direction:column;align-items:center;gap:6px;margin:10px 0 18px;}
.srv-pick .np-big{gap:10px;}
.srv-pick .np-big button, .srv-pick .np-big strong{height:48px;}
.srv-pick .np-big button{width:48px;}
.srv-pick .np-big button::before{width:16px;}
.srv-pick .np-big button:last-child::after{height:16px;}
.srv-pick .np-big strong{min-width:60px;font-size:22px;}
.srv-l{font-size:13px;color:var(--brown);}
.np-cui-h{cursor:pointer;}
.np-empty{min-height:60px;display:flex;align-items:center;justify-content:center;font-size:13px;color:var(--brown);border:1px dashed var(--line-strong);}
.is-off{opacity:.45;}
.np-add{flex-shrink:0;width:34px;height:34px;border:1px solid var(--herb);background:transparent;color:var(--herb);font-size:18px;font-weight:700;border-radius:var(--r);margin-left:auto;cursor:pointer;}
.np-add.on{background:var(--herb);color:#fff;}
.plan-add-link{color:var(--herb);font-weight:700;cursor:pointer;}
.plan-item.done{opacity:.5;}
.plan-item.carried{border:2px solid #E07B22;}
.carried-tag{display:inline-block;font-size:12px;font-weight:700;color:#B85E0E;margin-bottom:3px;}
#load-error{position:fixed;inset:0;z-index:9999;background:var(--paper);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;text-align:center;padding:24px;}
#load-error svg{width:110px;height:110px;}
#load-error .le-msg{font-size:15px;font-weight:600;color:var(--ink);}
#load-error .le-sub{font-size:12.5px;color:var(--brown);max-width:300px;line-height:1.5;}
#load-error button{border:none;background:var(--tomato);color:#fff;border-radius:var(--r);padding:11px 26px;font-size:14px;font-weight:700;}
.plan-item.done .plan-item-title{text-decoration:line-through;}
.plan-item.done .plan-item-meta,.plan-item.done .serv-line{text-decoration:line-through;}
.plan-side{display:flex;flex-direction:column;align-items:center;gap:4px;flex-shrink:0;}
.plan-item-main{min-width:0;}
.plan-item .plan-fav{background:none;border:none;width:32px;height:32px;line-height:1;color:var(--brown);cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;}
.plan-item .plan-fav .star-svg{width:26px;height:26px;}
.picker-item .fav-btn{width:34px;height:34px;}
.cook-finish{text-align:center;padding:20px 10px;}
.cook-finish h2{font-size:28px;margin:0 0 6px;}
.cook-finish p{color:var(--brown);margin:0 0 20px;}
.dislike-btn{display:block;width:100%;margin:10px 0 4px;padding:12px;font:inherit;font-size:13px;font-weight:600;border-radius:var(--r);border:1px solid var(--line-strong);background:none;color:var(--brown);}
.dislike-btn.on{border-color:var(--tomato);color:var(--tomato);}
.cook-finish .dislike-btn{max-width:320px;margin:16px auto 0;}
.cook-finish .fav-btn{width:auto;border-radius:24px;padding:0 20px;height:46px;font-size:16px;gap:8px;margin:0 auto;}
.app-header .brand{display:flex;flex-direction:row;align-items:center;gap:12px;padding-right:56px;}
.app-header .brand svg{width:88px;height:88px;flex-shrink:0;border-radius:20px;margin-top:-12px;} /* the logo drawing has empty space at its top; pull it up so the banner has even space above and below */
.plan-headrow{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:6px;}
.plan-headrow .plan-date{margin:0;}
.plan-title-line{display:flex;align-items:center;gap:8px;}
.lock-btn{background:var(--card);border:1px solid var(--line-strong);border-radius:50%;width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;color:var(--brown);cursor:pointer;padding:0;flex-shrink:0;}
.lock-btn.locked{color:var(--tomato);border-color:var(--tomato);}
.lock-btn svg{width:18px;height:18px;}
.plan-plus{background:var(--herb);color:#fff;border:none;border-radius:50%;width:40px;height:40px;font-size:26px;line-height:1;font-weight:600;cursor:pointer;flex-shrink:0;box-shadow:2px 2px 0 rgba(43,38,32,.15);}
.seg-row{display:flex;gap:8px;margin-bottom:12px;}
.seg-row .chip{flex:1;text-align:center;}
.choice-btn{display:flex;align-items:center;gap:12px;width:100%;text-align:left;background:var(--card);border:1px solid var(--line-strong);border-radius:var(--r);padding:14px;margin-bottom:10px;font-size:15px;font-weight:600;color:var(--ink);cursor:pointer;}
.choice-btn small{display:block;font-weight:400;font-size:12.5px;color:var(--brown);margin-top:2px;}
.choice-btn .ico{font-size:24px;}
.import-note{background:rgba(77,122,90,.14);border:1px solid var(--herb);border-radius:var(--r);padding:9px 12px;font-size:13px;color:var(--ink);margin-bottom:12px;}
.dlg-overlay{position:fixed;inset:0;background:rgba(43,38,32,.55);display:flex;align-items:center;justify-content:center;padding:24px;z-index:200;}
.dlg-overlay.hidden{display:none;}
/* message popups match the slide-up panels: same ground, corners, heading, buttons and close X */
.dlg{background:var(--paper);border:none;border-radius:var(--r-lg);box-shadow:0 8px 30px rgba(43,38,32,.35);width:100%;max-width:360px;padding:18px 18px 18px;}
.dlg-title{font-size:19px;font-weight:700;color:var(--ink);margin:0 0 12px;}
.dlg-msg{font-size:15px;line-height:1.45;color:var(--ink);margin-bottom:16px;white-space:pre-line;}
.dlg-actions{display:flex;gap:10px;justify-content:flex-end;}
.dlg-actions.stack{flex-direction:column;}
.dlg-actions button{flex:1;border-radius:var(--r);padding:12px;font-size:14px;font-weight:600;cursor:pointer;border:1px solid var(--line-strong);background:none;color:var(--brown);}
.dlg-actions button.ok{background:var(--tomato);border-color:var(--tomato);color:#fff;}
.dlg-actions button.danger{background:var(--tomato);border-color:var(--tomato);color:#fff;}
.toast{position:fixed;left:50%;bottom:84px;transform:translateX(-50%);background:var(--ink);color:var(--paper);padding:10px 16px;border-radius:20px;font-size:13.5px;z-index:210;box-shadow:0 3px 10px rgba(0,0,0,.3);max-width:86%;text-align:center;}
.ing-list li{display:flex;justify-content:space-between;gap:14px;align-items:baseline;}
.ing-list li .ing-nm{font-weight:500;}
.ing-list li .ing-q{white-space:nowrap;color:var(--brown);font-weight:600;font-size:16px;}
/* meal plan cards */
.plan-item{position:relative;align-items:stretch;padding:12px 12px 12px 12px;min-height:128px;}
.plan-item .thumb{width:104px;height:104px;align-self:flex-start;}
.plan-item .thumb-empty{font-size:44px;}
.plan-item .fav-btn{position:absolute;top:10px;right:10px;z-index:3;width:24px;height:24px;box-shadow:0 1px 4px rgba(0,0,0,.3);}
.plan-item .fav-btn{color:var(--brown);}
.plan-item .fav-btn.on{color:#d99a1e;}
.plan-item .fav-btn .star-svg{width:16px;height:16px;}
.plan-item .plan-rm{position:absolute;top:46px;right:8px;font-size:12px;}
.plan-item .done-col{position:absolute;right:6px;bottom:8px;padding:4px;}
.plan-item .plan-item-main{padding-right:40px;min-width:0;}
.plan-item.editing .plan-item-main{padding-right:56px;}
.cu-chip{cursor:pointer;user-select:none;}
.cu-chip input{display:none;}
.cu-chip.on{background:var(--ink);color:var(--paper);border-color:var(--ink);}
.newcat-row{display:flex;gap:8px;margin-top:8px;}
.newcat-row input{flex:1;min-width:0;}
.gi-link{border-bottom:1px dotted var(--brown);cursor:pointer;}
.gi-where{display:block;font-size:12px;color:var(--herb);margin-top:2px;cursor:pointer;}
.where-list{margin:0 0 14px;}
.where-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--line);cursor:pointer;}
.where-row span{flex:1;min-width:0;}
.where-row strong{display:block;font-size:14px;color:var(--ink);}
.where-row small{display:block;font-size:12px;color:var(--brown);margin-top:1px;}
.where-row em{font-style:normal;color:var(--herb);font-size:18px;}
.gi-note{display:block;font-size:12px;color:var(--brown);margin-top:1px;}
.gi-qty{flex:0 0 auto;max-width:42%;text-align:right;font-weight:600;color:var(--brown);line-height:1.35;padding-left:8px;}
.gcat-head{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--herb);margin:18px 0 2px;padding-bottom:4px;border-bottom:2px solid var(--line-strong);}
.check-actions{display:flex;gap:8px;margin-bottom:4px;}
.check-actions .secondary-btn{margin-top:0;}
.share-btn{display:flex;align-items:center;justify-content:center;}
.share-btn .share-ico{width:22px;height:22px;}
.check-actions .secondary-btn:disabled{opacity:0.4;}
.extra-form{margin:-14px 0 12px;padding:8px;border:1px solid var(--line);background:var(--card);border-radius:var(--r);}
.extra-row{display:flex;gap:6px;margin-bottom:6px;}
.extra-row:last-child{margin-bottom:0;}
.extra-row input,.extra-row select{padding:9px 10px;font-size:14px;border:1px solid var(--line-strong);border-radius:var(--r);background:var(--paper);color:var(--ink);min-width:0;}
.extra-row input:first-child{flex:2;} .extra-row input:last-child{flex:1;}
.extra-row select{flex:1;}
.extra-add{flex:0 0 44px;height:44px;padding:0;display:flex;align-items:center;justify-content:center;background:var(--tomato);color:#fff;border:none;border-radius:var(--r);}
.extra-add svg{width:22px;height:22px;}
.extra-row #extra-name{flex:1 1 auto;}
.extra-row #extra-qty{flex:0 0 72px;width:72px;}
.extra-shops{flex-wrap:wrap;align-items:center;margin-bottom:0;gap:6px;}
.gro-pills{margin-bottom:12px;}
.shop-edit{width:30px;height:36px;flex:0 0 30px;padding:0;margin:0 -2px 0 -3px;display:flex;align-items:center;justify-content:center;background:none;border:none;color:var(--brown);cursor:pointer;}
.shop-edit svg{width:24px;height:24px;}
.shop-note{font-size:12px;color:var(--brown);}
.shop-del{width:auto;margin:0 0 0 auto;padding:6px 12px;font-size:13px;}
#sheet .ss-row .extra-add{margin-left:auto;}
.extra-lbl{flex:0 0 auto;align-self:center;font-size:13px;font-weight:600;color:var(--brown);}
.gro-show{font-size:12px;font-weight:600;color:var(--brown);margin:0 0 6px;}
.grocery-item.extra .gi-name,.grocery-item.extra .gi-qty{font-style:italic;}
.gi-del{border:none;background:none;color:var(--tomato);font-size:20px;line-height:1;padding:0 2px;flex-shrink:0;}
#app.booting .app-header,#app.booting .tabbar,#app.booting #main{display:none;}
.boot-splash{display:none;}
/* plain manifest-coloured ground, the same as the phone's own launch screen, so the hand-over is seamless */
#app.booting{position:fixed;inset:0;z-index:5;background:var(--paper);}
#app.booting .boot-splash{position:relative;display:flex;align-items:center;justify-content:center;height:100%;} /* exactly the app's height, so the logo is centred in it */
/* the logo is cut to a circle the same size and place as the phone's own launch screen, so the hand-over is seamless and only the steam starts moving */
#boot-splash .boot-logo{width:58.3vw;height:58.3vw;max-width:300px;max-height:300px;border-radius:50%;overflow:hidden;display:flex;align-items:center;justify-content:center;}
#boot-splash .boot-logo svg{width:107.3%;height:107.3%;flex-shrink:0;}
#boot-splash .boot-ver{position:absolute;left:0;right:0;top:calc(50% + min(29.2vw, 150px) + 18px);text-align:center;}
.boot-ver{font-size:12px;font-weight:500;letter-spacing:0.3px;color:var(--brown);opacity:.7;}
/* steam rises off the bowl on the opening screen: each wisp drifts up and fades, one after another */
#boot-splash svg [stroke="#EDE3D0"] path{transform-box:fill-box;transform-origin:50% 100%;animation:steam-rise 2.4s ease-in-out infinite;}
#boot-splash svg [stroke="#EDE3D0"] path:nth-child(2){animation-delay:.8s;}
#boot-splash svg [stroke="#EDE3D0"] path:nth-child(3){animation-delay:1.6s;}
@keyframes steam-rise{0%{opacity:0;transform:translateY(14px) scaleY(.85);}25%{opacity:1;}70%{opacity:.8;}100%{opacity:0;transform:translateY(-26px) scaleY(1.1);}}
@media (prefers-reduced-motion: reduce){ #boot-splash svg [stroke="#EDE3D0"] path{animation:none;} }
.boot-splash svg{width:130px;height:130px;}
.loading{text-align:center;padding:40px;color:var(--brown);font-size:13px;}
/* Cooking mode */
.cook-overlay{position:fixed;inset:0;background:var(--ink);color:var(--paper);z-index:100;display:flex;flex-direction:column;}
.cook-overlay.hidden{display:none;}
.cook-header{display:flex;justify-content:space-between;align-items:center;padding:18px 18px 4px;}
.cook-exit{background:none;border:none;color:var(--paper);font-size:28px;line-height:1;padding:4px 10px;}
.cook-progress{font-weight:600;font-size:13px;color:rgba(237,227,208,0.75);}
.cook-step-area{flex:1;display:flex;flex-direction:column;min-height:0;padding:0;text-align:center;touch-action:pan-y;}
.cook-step-main{flex:1;display:flex;align-items:center;justify-content:center;padding:16px 30px;overflow-y:auto;min-height:0;}
.cook-ings-panel{margin:0 18px 10px;padding:12px 14px;background:rgba(237,227,208,0.1);border:1px solid rgba(237,227,208,0.28);border-radius:var(--r);text-align:left;max-height:34%;overflow-y:auto;flex-shrink:0;}
.cook-ings-title{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--gold);margin-bottom:6px;}
.cook-ing-row{display:flex;justify-content:space-between;gap:12px;padding:5px 0;font-size:15px;border-top:1px solid rgba(237,227,208,0.14);}
.cook-ing-row:first-child{border-top:none;}
.cook-ing-qty{font-weight:600;white-space:nowrap;}
.cook-ing-none{font-size:13px;color:rgba(237,227,208,0.6);}
.cook-step-title{font-weight:600;font-size:13px;color:var(--gold);margin-bottom:16px;letter-spacing:0.3px;}
.cook-step-text{font-size:clamp(20px,5.5vw,28px);line-height:1.55;}
.cook-step-ings{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:22px;}
.cook-ing-chip{background:rgba(237,227,208,0.12);color:var(--paper);border:1px solid rgba(237,227,208,0.32);padding:6px 13px;border-radius:14px;font-size:13px;}
.cook-dots{display:flex;justify-content:center;gap:6px;padding-bottom:10px;flex-wrap:wrap;max-width:260px;margin:0 auto;}
.cook-dot{width:6px;height:6px;border-radius:50%;background:rgba(237,227,208,0.28);flex-shrink:0;}
.cook-dot.active{background:var(--tomato);}
.cook-nav{display:flex;gap:10px;padding:10px 18px calc(18px + env(safe-area-inset-bottom, 0px));}
.cook-nav-btn{flex:1;padding:14px;border:1px solid rgba(237,227,208,0.35);background:none;color:var(--paper);border-radius:var(--r);font-size:14px;font-weight:600;}
.cook-nav-btn:disabled{opacity:0.3;}
.cook-nav-btn.primary{background:var(--tomato);border-color:var(--tomato);}
.store-seg{display:flex;gap:0;margin:0 0 12px;border:1px solid var(--ink);border-radius:var(--r);overflow:hidden;}
.store-seg button{flex:1;padding:11px 8px;font:inherit;font-weight:600;font-size:14px;background:var(--card);color:var(--ink);border:none;border-radius:0;cursor:pointer;}
.store-seg button + button{border-left:1px solid var(--ink);}
.store-seg button.on{background:var(--ink);color:var(--paper);}
.store-tag{font:inherit;font-size:10.5px;font-weight:700;padding:2px 7px;border-radius:var(--r);border:1px solid var(--line-strong);background:transparent;color:var(--brown);margin-left:6px;white-space:nowrap;}
.store-tag.aldi{background:var(--ink);color:var(--paper);border-color:var(--ink);}
.grocery-item input[type=checkbox]{-webkit-appearance:none;appearance:none;width:20px;height:20px;border:1.5px solid var(--ink);border-radius:var(--r);background:var(--card);display:inline-grid;place-content:center;cursor:pointer;}
.grocery-item input[type=checkbox]::after{content:"";width:10px;height:5px;border-left:2px solid var(--paper);border-bottom:2px solid var(--paper);transform:rotate(-45deg) translate(1px,-1px);opacity:0;}
.grocery-item input[type=checkbox]:checked{background:var(--ink);}
.grocery-item input[type=checkbox]:checked::after{opacity:1;}
.gi-name{min-width:0}
.np-sec{border-top:1px solid var(--line-strong);padding:12px 0 4px;margin-top:10px;}
.np-sec h3{font-size:14px;margin:0 0 8px;}
.np-sec h3.np-cui-h{font-size:17px;margin:4px 0 10px;}
.np-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:6px 0;font-size:14px;}
.np-row .stepper{flex-shrink:0}
.ooseason{color:var(--tomato);font-weight:700;white-space:nowrap;}
.ss-row{display:flex;align-items:center;gap:8px;padding:4px 0;font-size:13px;}
.ss-n{flex:1;min-width:0;text-transform:capitalize;font-weight:600;}
.ss-n.off{color:var(--brown);font-weight:400;opacity:.7;}
.ss-row select,.ss-row input{padding:6px;border:1px solid var(--line-strong);border-radius:var(--r);background:var(--card);color:inherit;font-size:13px;}
.np-opt{display:flex;gap:8px;align-items:flex-start;padding:6px 0;font-size:14px;line-height:1.4;}
.np-opt input{margin-top:3px}
.np-ings{max-height:150px;overflow:auto;border:1px solid var(--line-strong);border-radius:var(--r);padding:4px 8px;margin:6px 0;}
.np-chip{display:inline-flex;align-items:center;gap:6px;background:var(--card);border:1px solid var(--line-strong);border-radius:14px;padding:4px 6px 4px 10px;font-size:13px;margin:0 6px 6px 0;}
.np-chip button{border:none;background:none;font-size:16px;color:var(--brown);padding:0 4px;}
.draft-banner{background:var(--card);border:1px dashed var(--herb);border-radius:var(--r);padding:9px 12px;font-size:13px;margin:10px 0;color:var(--brown);}
.card-next{display:block;width:100%;margin-top:10px;padding:10px;font:inherit;font-size:13px;font-weight:600;border-radius:var(--r);border:1px solid var(--line-strong);background:none;color:var(--brown);}
.card-next.on{background:var(--herb);border-color:var(--herb);color:#fff;}
.cook-ing-row{cursor:pointer}
.cook-ing-row.editing{display:block;cursor:default}
.cook-ing-row .ce{display:flex;gap:8px;margin-top:6px;}
.cook-ing-row .ce input,.cook-ing-row .ce select{flex:1;min-width:0;font:inherit;font-size:16px;padding:8px;border-radius:var(--r);border:1px solid rgba(237,227,208,.5);background:rgba(0,0,0,.25);color:var(--paper);}
.cook-ing-row .ce button,.cook-edit-actions button{font:inherit;font-weight:700;padding:8px 14px;border-radius:var(--r);border:1px solid rgba(237,227,208,.5);background:transparent;color:var(--paper);}
.cook-ing-row .ce button.ok,.cook-edit-actions button.ok{background:var(--herb);border-color:var(--herb);color:#fff;}
.cook-edit-link{margin-top:10px;background:none;border:none;color:rgba(237,227,208,.7);font:inherit;font-size:14px;text-decoration:underline;padding:4px 0;}
.cook-step-edit{width:100%;min-height:140px;font:inherit;font-size:18px;line-height:1.5;padding:10px;border-radius:var(--r);border:1px solid rgba(237,227,208,.5);background:rgba(0,0,0,.25);color:var(--paper);box-sizing:border-box;}
.cook-edit-actions{display:flex;gap:8px;margin-top:8px;}
.idea-btns{display:flex;gap:8px;margin:10px 0 0;}
.idea-btns .secondary-btn{margin:0;flex:1;padding:10px 6px;font-size:13px;}
.idea-row .small-btn{flex-shrink:0;margin-left:8px;}
.idea-row .small-btn.on{background:var(--herb);color:#fff;}
.np-cu{border-top:1px solid var(--line);}
.np-cu-head{flex:1;cursor:pointer;padding:6px 0;font-weight:600;}
.np-list{margin:0 0 8px;border:1px solid var(--line-strong);border-radius:var(--r);background:var(--card);}
.np-recipe{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:9px 10px;font-size:14px;border-top:1px solid var(--line);cursor:pointer;}
.np-recipe:first-child{border-top:none}
.np-recipe.on{background:rgba(107,122,56,.16);}
.np-recipe .thumb{cursor:pointer;width:46px;height:46px;flex-shrink:0;}
.np-rt{flex:1;min-width:0;line-height:1.3;}
.np-rt strong{display:block;font-size:14px;color:var(--ink);}
.np-rt .pick-sub,.np-rt small{display:block;font-style:normal;font-size:11.5px;color:var(--brown);margin-top:1px;}
.np-recipe{justify-content:flex-start;}
.extra-seg{margin:0;flex:1;}
.extra-seg button{padding:9px 10px;font-size:14px;}
.fold-head{display:flex;align-items:center;gap:8px;width:100%;margin:8px 0 0;padding:10px 12px;background:var(--card);border:1px solid var(--line-strong);border-radius:var(--r);font:inherit;font-size:14px;color:var(--ink);text-align:left;}
.fold-head span{font-weight:700;}
.fold-head em{font-style:normal;color:var(--brown);flex:1;}
.fold-head b{color:var(--brown);}
.chip-row[hidden]{display:none;}
.fold-head + .chip-row{margin-top:8px;}
/* cooking mode uses the same light look as the rest of the app */
#cook-overlay{background:var(--paper);color:var(--ink);}
#cook-overlay .cook-header{gap:10px;padding:12px 12px 8px;border-bottom:1px solid var(--line);background:var(--card);}
#cook-overlay .cook-exit{color:var(--ink);}
#cook-overlay .cook-progress{color:var(--brown);white-space:nowrap;}
.cook-recipe{flex:1;min-width:0;display:flex;align-items:center;gap:10px;}
.cook-recipe .thumb{width:44px;height:44px;border-radius:var(--r);flex-shrink:0;object-fit:cover;font-size:20px;}
.cook-rt{min-width:0;display:flex;flex-direction:column;}
.cook-rt strong{font-size:15px;line-height:1.2;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;}
.cook-rt small{font-size:11.5px;color:var(--brown);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
#cook-overlay .cook-ings-panel{background:var(--card);border-color:var(--line-strong);}
#cook-overlay .cook-ing-row{border-top-color:var(--line);}
#cook-overlay .cook-ing-none{color:var(--brown);}
#cook-overlay .cook-dot{background:var(--line-strong);}
#cook-overlay .cook-dot.active{background:var(--tomato);}
#cook-overlay .cook-nav-btn{border-color:var(--line-strong);color:var(--ink);}
#cook-overlay .cook-nav-btn.primary{background:var(--tomato);border-color:var(--tomato);color:#fff;}
#cook-overlay .cook-ing-row .ce input,#cook-overlay .cook-ing-row .ce select,#cook-overlay .cook-step-edit{border-color:var(--line-strong);background:#fff;color:var(--ink);}
#cook-overlay .cook-ing-row .ce button,#cook-overlay .cook-edit-actions button{border-color:var(--line-strong);color:var(--ink);}
#cook-overlay .cook-ing-row .ce button.ok,#cook-overlay .cook-edit-actions button.ok{background:var(--herb);border-color:var(--herb);color:#fff;}
#cook-overlay .cook-edit-link{color:var(--brown);}
#cook-overlay .cook-step-area{cursor:pointer;}
#cook-overlay .cook-header{background:var(--ink);color:var(--paper);border-bottom:none;padding:14px 12px 14px;}
#cook-overlay .cook-exit{color:var(--paper);}
#cook-overlay .cook-progress{color:rgba(237,227,208,0.75);}
#cook-overlay .cook-rt strong{font-size:19px;line-height:1.2;-webkit-line-clamp:2;}
#cook-overlay .cook-rt small{color:rgba(237,227,208,0.72);}
#cook-overlay .cook-recipe .thumb{width:56px;height:56px;border-radius:10px;}
#cook-overlay .cook-step-area{text-align:left;}
#cook-overlay .cook-edit-bar{padding:10px 20px 0;min-height:36px;flex-shrink:0;}
#cook-overlay .cook-edit-link{margin-top:0;padding:4px 0;font-size:14px;}
#cook-overlay .cook-step-main{align-items:flex-start;justify-content:flex-start;padding:22px 20px 16px;}
#cook-overlay .cook-step-main > div{width:100%;}
.tab{font-size:13px;padding-left:2px;padding-right:2px;white-space:nowrap;}
@media (max-width:380px){.tab{font-size:11.5px;}}
.planner-title{font-size:22px;margin:0 0 6px;}
.planner-lead{font-size:13.5px;color:var(--brown);line-height:1.5;margin:0 0 12px;}
.planner-sec{margin-top:22px;border-top:1px solid var(--line-strong);padding-top:14px;}
.planner-sec h3{font-size:14px;margin:0 0 10px;}
.planner-row{cursor:pointer}
.planner-row .small-btn{flex-shrink:0;margin-left:8px}
.btn-row{display:flex;gap:8px;margin-top:8px;}
.btn-row > button{flex:1;min-width:0;width:auto;margin-top:0;}
.idea-btns{margin:8px 0 0;}
/* Recipes tab: compact rows and clearer section headers */
.search-add{flex:0 0 44px;height:44px;padding:0;border:none;border-radius:var(--r);background:var(--tomato);color:#fff;font:inherit;font-size:26px;font-weight:400;line-height:1;cursor:pointer;}
.recipe-grid{gap:10px;}
.recipe-card.rc-row{display:flex;align-items:center;gap:12px;padding:8px;box-shadow:none;border-color:var(--line-strong);}
.rc-th{flex-shrink:0;}
.rc-row .thumb, .rc-row .thumb-sm{width:72px;height:72px;}
.rc-row .thumb-sm.thumb-empty{font-size:26px;}
.rc-body{flex:1;min-width:0;}
.recipe-card.rc-row h3{margin:0 0 3px;font-size:16px;line-height:1.25;}
.rc-row .recipe-meta{font-size:12.5px;margin:0;}
.rc-has{margin-top:3px;font-size:12.5px;font-weight:600;color:var(--herb);font-style:italic;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.rc-tag{display:block;margin-top:3px;font-size:11.5px;font-weight:700;}
.rc-side{display:flex;flex-direction:column;align-items:center;gap:8px;flex-shrink:0;}
.recipe-card.rc-row .fav-btn{position:static;width:32px;height:32px;font-size:15px;box-shadow:none;}
.rc-draft{width:32px;height:32px;padding:0;border-radius:50%;border:1px solid var(--line-strong);background:none;color:var(--ink);font:inherit;font-size:18px;line-height:1;cursor:pointer;}
.rc-draft.on{background:var(--herb);border-color:var(--herb);color:#fff;font-size:15px;}
.fold-head{padding:12px 14px;margin-top:10px;border:1px solid var(--ink);border-left:5px solid var(--herb);background:var(--card);font-size:15px;}
.fold-head b{font-size:16px;color:var(--ink);}
.fold-head em{font-weight:600;}
.recipe-sub-head{display:flex;align-items:center;gap:8px;margin:20px 0 10px;padding:10px 14px;border-left:5px solid var(--brown);background:var(--paper-dark);font-size:15px;color:var(--ink);}
.recipe-sub-head em{font-style:normal;font-weight:600;color:var(--brown);}
/* Recipes filters: a labelled row per kind (type olive, cuisine brown); the filters that are on sit underneath */
.filt-line{display:flex;align-items:flex-start;margin:0 -16px 8px 0;}
.filt-lbl{flex:0 0 58px;padding-top:8px;font-size:12px;font-weight:700;}
.filt-type .filt-lbl{color:var(--herb);}
.filt-cui .filt-lbl{color:var(--brown);}
.filt-type{border-left:4px solid var(--herb);padding-left:8px;}
.filt-cui{border-left:4px solid var(--brown);padding-left:8px;}
.filt-scroll{flex:1;min-width:0;display:flex;gap:6px;overflow-x:auto;padding:2px 16px 2px 0;scrollbar-width:none;}
.filt-scroll.two{flex-direction:column;gap:6px;}
.filt-r{display:flex;gap:6px;width:max-content;}
.filt-scroll::-webkit-scrollbar{display:none;}
.filt-line .chip, .filt-active .chip{flex-shrink:0;white-space:nowrap;padding:6px 11px;font-size:13px;}
.filt-line .chip span{opacity:.7;font-weight:500;}
.filt-type .chip{border-color:color-mix(in srgb, var(--herb) 55%, transparent);color:var(--herb);}
.filt-cui .chip{border-color:color-mix(in srgb, var(--brown) 45%, transparent);color:var(--brown);}
.filt-none{padding-top:7px;font-size:13px;color:var(--stone, var(--brown));}
.filt-active{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:4px;padding:10px 0 0;border-top:1px solid var(--line-strong);}
.filt-active .filt-lbl{flex:0 0 auto;padding:0 4px 0 0;color:var(--ink);}
.filt-active .filt-none{padding:0;}
.chip.on-type{background:var(--herb);border-color:var(--herb);color:#fff;}
.chip.on-cui{background:var(--brown);border-color:var(--brown);color:#fff;}
.filt-active .chip b{margin-left:4px;font-weight:700;opacity:.85;}
.filt-clear{margin-left:auto;padding:4px 0;border:none;background:none;font:inherit;font-size:13px;font-weight:600;color:var(--brown);text-decoration:underline;cursor:pointer;}
</style>
</head>
<body>
<div id="app" class="booting">
<header class="app-header">
<div class="header-right"><button type="button" class="header-btn" id="menu-header-btn" aria-label="More options" aria-haspopup="true" aria-expanded="false"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="6" cy="12" r="1.8" fill="currentColor"/><circle cx="12" cy="12" r="1.8" fill="currentColor"/><circle cx="18" cy="12" r="1.8" fill="currentColor"/></svg></button></div>
<div class="app-menu" id="app-menu" hidden></div>
<div class="brand"><svg viewBox="0 0 512 512"><rect width="512" height="512" rx="112" fill="#2B2620"/><defs><clipPath id="rr"><rect width="512" height="512" rx="112"/></clipPath> <pattern id="gh" width="64" height="64" patternUnits="userSpaceOnUse"><rect width="64" height="64" fill="#F6EEDC"/><rect width="32" height="64" fill="#C8452D" opacity=".5"/><rect width="64" height="32" fill="#C8452D" opacity=".5"/></pattern></defs><g clip-path="url(#rr)"><path d="M0 408 Q256 388 512 408 V512 H0Z" fill="url(#gh)"/><path d="M0 408 Q256 388 512 408" fill="none" stroke="#2B2620" stroke-opacity=".25" stroke-width="3"/></g><g transform="translate(256 262) scale(.9) translate(-256 -256)"> <!-- steam --> <g fill="none" stroke="#EDE3D0" stroke-width="12" stroke-linecap="round" opacity=".85"> <path d="M206 120c-18-22 18-34 0-58"/><path d="M256 108c-18-22 18-34 0-58"/><path d="M306 120c-18-22 18-34 0-58"/> </g> <!-- shallow pasta bowl: underside, rim, well --> <path d="M52 322c4 52 84 86 204 86s200-34 204-86z" fill="#EFE6D0"/> <path d="M52 322c4 52 84 86 204 86s200-34 204-86c-30 20-100 32-204 32S82 342 52 322z" fill="#E4D8BC" opacity=".6"/> <rect x="190" y="402" width="132" height="18" rx="9" fill="#EFE6D0"/> <ellipse cx="256" cy="322" rx="204" ry="66" fill="#FAF6EC"/> <ellipse cx="256" cy="322" rx="204" ry="66" fill="none" stroke="#D9CDB4" stroke-width="5"/> <!-- painted rim --> <ellipse cx="256" cy="322" rx="186" ry="55" fill="none" stroke="#2F5D8C" stroke-width="7"/> <ellipse cx="256" cy="322" rx="164" ry="46" fill="none" stroke="#2F5D8C" stroke-width="3"/> <circle cx="432" cy="330" r="5" fill="#E9B949"/><circle cx="408" cy="354" r="5" fill="#E9B949"/><circle cx="344" cy="373" r="5" fill="#E9B949"/><circle cx="256" cy="379" r="5" fill="#E9B949"/><circle cx="168" cy="373" r="5" fill="#E9B949"/><circle cx="103" cy="355" r="5" fill="#E9B949"/><circle cx="80" cy="330" r="5" fill="#E9B949"/><circle cx="103" cy="305" r="5" fill="#E9B949"/><circle cx="167" cy="286" r="5" fill="#E9B949"/><circle cx="255" cy="280" r="5" fill="#E9B949"/><circle cx="343" cy="286" r="5" fill="#E9B949"/><circle cx="408" cy="304" r="5" fill="#E9B949"/> <!-- well --> <ellipse cx="256" cy="324" rx="138" ry="36" fill="#F1E8D2"/> <!-- spaghetti nest --> <g fill="none" stroke="#F0CF6E" stroke-width="18" stroke-linecap="round"> <path d="M130 318c26-30 50 18 76-4s50 22 76-4 50 18 76-4"/> <ellipse cx="256" cy="302" rx="104" ry="30"/> <ellipse cx="256" cy="278" rx="80" ry="24"/> <ellipse cx="256" cy="256" rx="56" ry="17"/> <ellipse cx="256" cy="238" rx="32" ry="10"/> <path d="M360 326c20 6 36 14 40 24" /> </g> <g fill="none" stroke="#C8962A" stroke-width="4" stroke-linecap="round" opacity=".5"> <ellipse cx="256" cy="310" rx="104" ry="30"/><ellipse cx="256" cy="286" rx="80" ry="24"/><ellipse cx="256" cy="264" rx="56" ry="17"/> </g> <!-- sauce and basil --> <ellipse cx="256" cy="226" rx="30" ry="12" fill="#B94A2F"/> <ellipse cx="248" cy="222" rx="11" ry="4" fill="#D8674A" opacity=".8"/> <path d="M262 218c8-24 32-26 40-12-10 18-30 22-40 12z" fill="#4D7A5A"/> <path d="M268 216c10-6 20-8 30-4" stroke="#2F5A3C" stroke-width="3.5" fill="none" stroke-linecap="round"/> <!-- fork --> <g stroke-linecap="round" stroke-linejoin="round" fill="none"> <line x1="410" y1="150" x2="306" y2="238" stroke="#9AA3AB" stroke-width="16"/> <line x1="410" y1="150" x2="306" y2="238" stroke="#DDE2E6" stroke-width="9"/> <g stroke="#9AA3AB" stroke-width="14"><line x1="298" y1="226" x2="274" y2="246"/><line x1="306" y1="238" x2="282" y2="258"/><line x1="290" y1="216" x2="266" y2="236"/></g> <g stroke="#DDE2E6" stroke-width="7"><line x1="298" y1="226" x2="274" y2="246"/><line x1="306" y1="238" x2="282" y2="258"/><line x1="290" y1="216" x2="266" y2="236"/></g> </g> </g> <g><circle cx="74" cy="446" r="28" fill="#D2452E"/><ellipse cx="64" cy="436" rx="9" ry="6" fill="#fff" opacity=".35"/> <path d="M74 418c-4-8-14-10-20-6 6 6 12 8 20 6z M74 418c4-8 14-10 20-6-6 6-12 8-20 6z M74 418l0-10" fill="#4D7A5A" stroke="#2F5A3C" stroke-width="3" stroke-linejoin="round"/></g> <g><path d="M438 452c10-26 40-30 54-14-12 22-40 28-54 14z" fill="#4D7A5A"/><path d="M446 450c14-8 28-10 42-6" stroke="#2F5A3C" stroke-width="4" fill="none" stroke-linecap="round"/></g></svg><div class="brand-text"><h1>Tavola</h1><div class="brand-sub" id="brand-sub" hidden></div></div></div>
</header>
<div class="boot-splash" id="boot-splash"><div class="boot-logo"><svg viewBox="0 0 512 512"><rect width="512" height="512" rx="112" fill="#2B2620"/><defs><clipPath id="rr"><rect width="512" height="512" rx="112"/></clipPath> <pattern id="gh" width="64" height="64" patternUnits="userSpaceOnUse"><rect width="64" height="64" fill="#F6EEDC"/><rect width="32" height="64" fill="#C8452D" opacity=".5"/><rect width="64" height="32" fill="#C8452D" opacity=".5"/></pattern></defs><g clip-path="url(#rr)"><path d="M0 408 Q256 388 512 408 V512 H0Z" fill="url(#gh)"/><path d="M0 408 Q256 388 512 408" fill="none" stroke="#2B2620" stroke-opacity=".25" stroke-width="3"/></g><g transform="translate(256 262) scale(.9) translate(-256 -256)"> <!-- steam --> <g fill="none" stroke="#EDE3D0" stroke-width="12" stroke-linecap="round" opacity=".85"> <path d="M206 120c-18-22 18-34 0-58"/><path d="M256 108c-18-22 18-34 0-58"/><path d="M306 120c-18-22 18-34 0-58"/> </g> <!-- shallow pasta bowl: underside, rim, well --> <path d="M52 322c4 52 84 86 204 86s200-34 204-86z" fill="#EFE6D0"/> <path d="M52 322c4 52 84 86 204 86s200-34 204-86c-30 20-100 32-204 32S82 342 52 322z" fill="#E4D8BC" opacity=".6"/> <rect x="190" y="402" width="132" height="18" rx="9" fill="#EFE6D0"/> <ellipse cx="256" cy="322" rx="204" ry="66" fill="#FAF6EC"/> <ellipse cx="256" cy="322" rx="204" ry="66" fill="none" stroke="#D9CDB4" stroke-width="5"/> <!-- painted rim --> <ellipse cx="256" cy="322" rx="186" ry="55" fill="none" stroke="#2F5D8C" stroke-width="7"/> <ellipse cx="256" cy="322" rx="164" ry="46" fill="none" stroke="#2F5D8C" stroke-width="3"/> <circle cx="432" cy="330" r="5" fill="#E9B949"/><circle cx="408" cy="354" r="5" fill="#E9B949"/><circle cx="344" cy="373" r="5" fill="#E9B949"/><circle cx="256" cy="379" r="5" fill="#E9B949"/><circle cx="168" cy="373" r="5" fill="#E9B949"/><circle cx="103" cy="355" r="5" fill="#E9B949"/><circle cx="80" cy="330" r="5" fill="#E9B949"/><circle cx="103" cy="305" r="5" fill="#E9B949"/><circle cx="167" cy="286" r="5" fill="#E9B949"/><circle cx="255" cy="280" r="5" fill="#E9B949"/><circle cx="343" cy="286" r="5" fill="#E9B949"/><circle cx="408" cy="304" r="5" fill="#E9B949"/> <!-- well --> <ellipse cx="256" cy="324" rx="138" ry="36" fill="#F1E8D2"/> <!-- spaghetti nest --> <g fill="none" stroke="#F0CF6E" stroke-width="18" stroke-linecap="round"> <path d="M130 318c26-30 50 18 76-4s50 22 76-4 50 18 76-4"/> <ellipse cx="256" cy="302" rx="104" ry="30"/> <ellipse cx="256" cy="278" rx="80" ry="24"/> <ellipse cx="256" cy="256" rx="56" ry="17"/> <ellipse cx="256" cy="238" rx="32" ry="10"/> <path d="M360 326c20 6 36 14 40 24" /> </g> <g fill="none" stroke="#C8962A" stroke-width="4" stroke-linecap="round" opacity=".5"> <ellipse cx="256" cy="310" rx="104" ry="30"/><ellipse cx="256" cy="286" rx="80" ry="24"/><ellipse cx="256" cy="264" rx="56" ry="17"/> </g> <!-- sauce and basil --> <ellipse cx="256" cy="226" rx="30" ry="12" fill="#B94A2F"/> <ellipse cx="248" cy="222" rx="11" ry="4" fill="#D8674A" opacity=".8"/> <path d="M262 218c8-24 32-26 40-12-10 18-30 22-40 12z" fill="#4D7A5A"/> <path d="M268 216c10-6 20-8 30-4" stroke="#2F5A3C" stroke-width="3.5" fill="none" stroke-linecap="round"/> <!-- fork --> <g stroke-linecap="round" stroke-linejoin="round" fill="none"> <line x1="410" y1="150" x2="306" y2="238" stroke="#9AA3AB" stroke-width="16"/> <line x1="410" y1="150" x2="306" y2="238" stroke="#DDE2E6" stroke-width="9"/> <g stroke="#9AA3AB" stroke-width="14"><line x1="298" y1="226" x2="274" y2="246"/><line x1="306" y1="238" x2="282" y2="258"/><line x1="290" y1="216" x2="266" y2="236"/></g> <g stroke="#DDE2E6" stroke-width="7"><line x1="298" y1="226" x2="274" y2="246"/><line x1="306" y1="238" x2="282" y2="258"/><line x1="290" y1="216" x2="266" y2="236"/></g> </g> </g> <g><circle cx="74" cy="446" r="28" fill="#D2452E"/><ellipse cx="64" cy="436" rx="9" ry="6" fill="#fff" opacity=".35"/> <path d="M74 418c-4-8-14-10-20-6 6 6 12 8 20 6z M74 418c4-8 14-10 20-6-6 6-12 8-20 6z M74 418l0-10" fill="#4D7A5A" stroke="#2F5A3C" stroke-width="3" stroke-linejoin="round"/></g> <g><path d="M438 452c10-26 40-30 54-14-12 22-40 28-54 14z" fill="#4D7A5A"/><path d="M446 450c14-8 28-10 42-6" stroke="#2F5A3C" stroke-width="4" fill="none" stroke-linecap="round"/></g></svg></div><div class="boot-ver">v0.82</div></div>
<script>
// the banner's copy of the logo is hidden while the app opens, and both copies use the same pattern ids, so give this copy its own (or the tablecloth would not draw)
(function(){ var sv = document.querySelector('#boot-splash svg'); if(!sv) return; var h = sv.innerHTML;
sv.querySelectorAll('[id]').forEach(function(el){ var o = el.id; h = h.split('id="' + o + '"').join('id="bs-' + o + '"').split('url(#' + o + ')').join('url(#bs-' + o + ')'); });
sv.innerHTML = h; })();
// the phone's top bar stays cream like the launch screen while Tavola opens, then turns dark to match the banner
(function(){ var app = document.getElementById('app'), m = document.querySelector('meta[name="theme-color"]');
var set = function(){ if(!app.classList.contains('booting')){ m.setAttribute('content', '#2B2620'); ob.disconnect(); } };
var ob = new MutationObserver(set); ob.observe(app, {attributes: true, attributeFilter: ['class']}); })();
// measurements shown at the bottom of the ⋯ menu, to line the opening screen up with the phone's launch screen.
// Taken once the page has its real size: when this script runs, the installed app can still report a 0×0 window.
// Installed app: the phone's launch screen centres the logo on the whole screen, and the app's window changes size while it starts
// (the bottom bar appears), so the logo is placed from the top of the window using the screen's size, which is known straight away.
(function(){ try{
var sa = window.matchMedia('(display-mode: standalone)').matches, early = window.innerHeight, sizes = [early];
if(sa && screen.height > 0){
var sp = document.getElementById('boot-splash'), lg = sp.querySelector('.boot-logo'), vr = sp.querySelector('.boot-ver');
var size = Math.min(screen.width * 0.583, 300), top = screen.height / 2 - size / 2;
sp.style.alignItems = 'flex-start'; lg.style.marginTop = top.toFixed(1) + 'px'; vr.style.top = (top + size + 18).toFixed(1) + 'px';
window.addEventListener('resize', function(){ if(sizes.length < 6) sizes.push(window.innerHeight); });
}
requestAnimationFrame(function(){ requestAnimationFrame(function(){ try{
var b = document.querySelector('#boot-splash .boot-logo').getBoundingClientRect();
var logo = Math.round(b.top) + '–' + Math.round(b.bottom);
// read when the ⋯ menu opens, so later window sizes are included
Object.defineProperty(window, '__bootInfo', {configurable: true, get: function(){ return 'screen ' + screen.width + '×' + screen.height + ' · window ' + sizes.join('→') + ' · ' + (sa ? 'app' : 'browser') + ' · logo ' + logo + ' · dpr ' + (window.devicePixelRatio || 1); }});
}catch(e){ window.__bootInfo = 'error ' + e.message; } }); });
}catch(e){ window.__bootInfo = 'error ' + e.message; } })();
</script>
<main id="main"></main>
<nav class="tabbar">
<button data-tab="plan" class="tab active">Menu</button>
<button data-tab="planner" class="tab">Planner</button>
<button data-tab="box" class="tab">Recipes</button>
<button data-tab="list" class="tab">Shopping</button>
</nav>
</div>
<div id="dlg-overlay" class="dlg-overlay hidden"><div class="dlg" role="dialog" aria-modal="true"><button type="button" class="pop-x" id="dlg-x" aria-label="Close"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button><div class="dlg-title">Tavola</div><div class="dlg-msg" id="dlg-msg"></div><div class="dlg-actions" id="dlg-actions"></div></div></div>
<div id="sheet-overlay" class="sheet-overlay hidden">
<div class="sheet-wrap" id="sheet-wrap"><button type="button" class="pop-x" id="sheet-x" aria-label="Close"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button><div id="sheet" class="sheet"></div></div>
</div>
<!-- Setup / sign-in overlay: hidden until we know it is actually needed (prevents a flash on start-up) -->
<div id="setup-overlay" class="cook-overlay hidden">
<div style="flex:1;overflow-y:auto;padding:30px 24px;">
<div id="setup-stage-config" class="hidden">
<h2 style="font-size:20px;margin:0 0 4px;">Change shared database</h2>
<p style="font-size:13.5px;color:rgba(237,227,208,0.8);line-height:1.6;margin-bottom:16px;">Paste a Firebase config (JSON) to point this device at a different shared database. Leave this alone unless you know you need to change it.</p>
<div class="field">
<label style="color:rgba(237,227,208,0.8);">Firebase config (paste the whole object)</label>
<textarea id="setup-config-input" placeholder='{"apiKey":"...","authDomain":"...","databaseURL":"...","projectId":"...","appId":"..."}' style="width:100%;min-height:120px;font-size:12px;font-family:monospace;padding:10px;border:1px solid rgba(237,227,208,0.35);border-radius:2px;background:rgba(237,227,208,0.08);color:var(--paper);"></textarea>
</div>
<div id="setup-status" style="font-size:13px;color:var(--gold);min-height:18px;margin-bottom:6px;"></div>
<button class="cook-nav-btn primary" id="setup-save-config-btn" style="width:100%;">Save & Reload</button>
<button class="cook-nav-btn" id="setup-reset-config-btn" style="width:100%;margin-top:10px;">Reset to the built-in database</button>
<button class="cook-nav-btn" id="setup-cancel-config-btn" style="width:100%;margin-top:10px;">Cancel</button>
</div>
<div id="setup-stage-login" class="hidden">
<h2 style="font-size:20px;margin:0 0 10px;">Sign in</h2>
<p style="font-size:13.5px;color:rgba(237,227,208,0.8);line-height:1.6;margin-bottom:20px;">Sign in with the Google account you use for this Tavola.</p>
<button class="cook-nav-btn primary" id="google-signin-btn" style="width:100%;">Sign in with Google</button>
<div id="login-status" style="font-size:13px;color:var(--gold);min-height:18px;margin-top:10px;"></div>
</div>
</div>
</div>
<div id="cook-overlay" class="cook-overlay hidden">
<div class="cook-header">
<button id="cook-exit-btn" class="cook-exit" aria-label="Exit cooking mode">×</button>
<div class="cook-recipe" id="cook-recipe"></div>
<div class="cook-progress" id="cook-progress"></div>
</div>
<div class="cook-step-area" id="cook-step-area"></div>
<div class="cook-dots" id="cook-dots"></div>
<div class="cook-nav">
<button id="cook-prev-btn" class="cook-nav-btn">Back</button>
<button id="cook-next-btn" class="cook-nav-btn primary">Next</button>
</div>
</div>
<script>
const TAG_COLORS = {breakfast:'var(--herb)', dinner:'var(--tomato)', snack:'var(--brown)', dessert:'var(--brown)'};
const TAG_LABELS = {breakfast:'Breakfast', dinner:'Dinner', snack:'Snack', dessert:'Dessert'};
const LEGACY_DAYS = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];
const LEGACY_MEALS = ['breakfast','lunch','dinner'];
/* ---------- STATE + NAVIGATION STACK ---------- */
const HOME_VIEW = {tab:'plan', recipeId:null};
let viewStack = [HOME_VIEW];
const currentView = () => viewStack[viewStack.length - 1];
let state = {
recipes: {},
plans: {},
activePlanId: null,
editPlanId: null, // a built menu being edited on the Planner screen
npOpen: {}, // cuisines opened on the Planner
npSugg: {}, // random suggestions made on the Planner, by cuisine
npLog: [], // meals added by the Suggest meals counter, in order: {id, cu}
npUsed: [], // cuisines already used in the current round of suggestions
npGone: [], // meals taken off the plan this session: Suggest meals does not bring them back
npFavGone: 0, // favourite suggestions taken off the plan: they still count towards the two favourites
checks: {},
shops: [],
npSel: null,
searchTerm: '',
openPlans: {},
typeSel: ['fav'], // Recipes tab type filters (several can be on); it opens on favourites
openFilters: {cuisine: true}, // Cuisine pills open, Type folded
cuiSel: [], // Recipes tab cuisine filters; none means any cuisine
customCuisines: {},
storePrefs: {},
npSearch: '', // search box on the Planner
seasonal: null, // edited in-season fruit and veg list (null = the Sydney starting list)
draftPlan: {},
loaded: false
};
let loadingState = false;
let deferredInstall = null;
function uid(){
return (window.crypto && crypto.randomUUID) ? crypto.randomUUID() : 'id-' + Date.now() + '-' + Math.random().toString(36).slice(2, 8);
}
/* ---------- FIREBASE AUTH + STORAGE (shared, Google Sign-In required) ---------- */
// The Firebase web config is NOT a secret: it only identifies the project.
// Access is protected by Google Sign-In + the Realtime Database rules (email whitelist).
const DEFAULT_FIREBASE_CONFIG = {"apiKey":"AIzaSyAAVlcygCcJXlK0LkfIh3oiEMc6sZhEVFo","authDomain":"recipe-box-oneill.firebaseapp.com","databaseURL":"https://recipe-box-oneill-default-rtdb.firebaseio.com","projectId":"recipe-box-oneill","storageBucket":"recipe-box-oneill.firebasestorage.app","messagingSenderId":"809735084570","appId":"1:809735084570:web:e6fbe32739f5a901014fa3"};
let FIREBASE_CONFIG = DEFAULT_FIREBASE_CONFIG;
try {
const saved = JSON.parse(localStorage.getItem('recipeBoxFirebaseConfig') || 'null');
if(saved && saved.apiKey && saved.databaseURL) FIREBASE_CONFIG = saved;
} catch(e){}
let DB_URL = FIREBASE_CONFIG.databaseURL || '';
let auth = null;
async function authedDbUrl(path){
const base = `${DB_URL.replace(/\/$/,'')}/${path}.json`;
const user = auth && auth.currentUser;
if(!user) return base;
const token = await user.getIdToken();
return `${base}?auth=${token}`;
}
async function dbGet(path){
const res = await fetch(await authedDbUrl(path));
if(!res.ok) throw new Error('DB get failed: ' + res.status);
return await res.json();
}
async function dbSet(path, value){
const res = await fetch(await authedDbUrl(path), {method:'PUT', headers:{'Content-Type':'application/json'}, body: JSON.stringify(value)});
if(!res.ok) throw new Error('DB set failed: ' + res.status);
}
async function dbDelete(path){
const res = await fetch(await authedDbUrl(path), {method:'DELETE'});
if(!res.ok) throw new Error('DB delete failed: ' + res.status);
}
/* ---------- INGREDIENT CATEGORIES ----------
Every ingredient carries a `category` (stored with the recipe in the database). New and imported
ingredients get a best guess from their name, which can be changed in the recipe form. */
const CATEGORIES = [
{key:'produce', label:'Fruit & veg'},
{key:'meat', label:'Meat, fish & alternatives'},
{key:'dairy', label:'Dairy & eggs'},
{key:'bakery', label:'Bakery'},
{key:'pantry', label:'Pantry'},
{key:'spices', label:'Herbs & spices'},
{key:'frozen', label:'Frozen'},
{key:'drinks', label:'Drinks'},
{key:'other', label:'Other'}
];
const CAT_KEYS = CATEGORIES.map(c => c.key);
const CAT_LABEL = Object.fromEntries(CATEGORIES.map(c => [c.key, c.label]));
function guessCategory(rawName){
const n = String(rawName || '').toLowerCase().replace(/\([^)]*\)/g, ' ');
const has = re => re.test(n);
if(has(/\bfrozen\b|ice cream/)) return 'frozen';
// things that look like another category but belong in the pantry
if(has(/broth|\bstock\b|bouillon|coconut (milk|cream)|(almond|oat|soy|soya|rice) milk|(peanut|nut|almond|cashew) butter|tomato (paste|sauce|puree|passata)|bread ?crumbs?|\bpanko\b|baking (powder|soda)|bicarb|cream of tartar|corn ?(flour|starch|meal)|\bdried (cranberr|fig|date|apricot|raisin|fruit|mango)|raisin|sultana|\bdates?\b|vinegar|canned|tinned|\btin of\b|chickpea|lentil|kidney bean|black bean|cannellini/)) return 'pantry';
// spices, seasonings and dried herbs
if(has(/\bdried\b.*\b(sage|thyme|basil|parsley|oregano|rosemary|mint|dill|coriander|chives|tarragon)\b|\b(sage|thyme|basil|parsley|oregano|rosemary|mint|dill|coriander|chives|tarragon)\b.*\bdried\b/)) return 'spices';
if(has(/\b(salt|paprika|cumin|turmeric|cinnamon|nutmeg|oregano|cayenne|allspice|cardamom|saffron|seasoning|spice|spices|curry powder|garlic powder|onion powder|(pepper|chil+i|chilli) flakes|bay leaf|bay leaves|mixed herbs|peppercorns?|garam masala|za'atar|sumac|ground (ginger|coriander|cloves|mustard|black pepper|white pepper)|ginger powder)\b/)) return 'spices';
if(has(/\b(bell|capsicum|chil+i|jalape[nñ]o|red|green|yellow|orange)\s+peppers?\b|\bcapsicum\b/)) return 'produce';
if(has(/\bpepper\b/)) return 'spices';
if(has(/\b(milk|cream|yog(h)?urt|cheese|mozzarella|parmesan|cheddar|feta|ricotta|halloumi|butter|eggs?|ghee|kefir|mascarpone|paneer|cottage)\b/)) return 'dairy';
if(has(/\b(chicken|beef|pork|lamb|bacon|sausages?|mince|turkey|ham|salmon|tuna|prawns?|shrimps?|fish|fillets?|steak|veggie ground|plant.based|vegan|tofu|tempeh|seitan|meatballs?|chorizo|salami|anchov(y|ies))\b/)) return 'meat';
if(has(/\b(bread|buns?|rolls?|sourdough|tortillas?|wraps?|pita|naan|bagels?|croissants?|baguette|focaccia|muffins?|flatbread)\b/)) return 'bakery';
if(has(/(apple|banana|lemon|lime\b|oranges?\b|berr(y|ies)|grapes?\b|mango|pears?\b|peach|plum|melon|pineapple|avocado|tomato|onion|shallot|leek|garlic|potato|carrot|celery|broccoli|cauliflower|spinach|arugula|rocket|lettuce|kale|cabbage|mushroom|cucumber|zucchini|courgette|squash|pumpkin|eggplant|aubergine|sweetcorn|corn on|\bcorn\b|\bpeas?\b|green beans?|asparagus|ginger|chil+i|jalape|beetroot|radish|fennel|basil|parsley|coriander|cilantro|\bmint\b|thyme|rosemary|\bdill\b|chives|\bsage\b|greens|spring mix|salad|sprouts|bok choy|cress|\bfigs?\b|herbs?\b)/)) return 'produce';
if(has(/\b(wine|beer|soda|sparkling|kombucha|coffee|espresso|tea)\b/)) return 'drinks';
if(has(/(oil|sauce|paste|soy|mustard|mayo|mayonnaise|honey|syrup|molasses|treacle|sugar|flour|vanilla|extract|rice|quinoa|pasta|orzo|noodle|spaghetti|couscous|\boats?\b|cereal|granola|bean|nut\b|nuts\b|almond|walnut|cashew|pecan|pistachio|peanut|seeds?\b|tahini|jam\b|cocoa|chocolate|yeast|olives?\b|capers?\b|pickle|artichoke|hummus|crumbs)/)) return 'pantry';
if(has(/\bwater\b/)) return 'pantry';
return 'other';
}
// Migrations fix the data in memory straight away (so the screen is right), then save only the small changed
// fields in the background. They never block start-up and never re-upload photos.
function migrateCategories(){
const writes = [];
Object.values(state.recipes).forEach(r=>{
if(!TAG_LABELS[r.tag]){ // the old Lunch type (or anything unknown) is now Dinner
r.tag = 'dinner';
writes.push(dbSet('recipes/' + r.id + '/tag', 'dinner'));
}
if(!CUISINE_KEYS.includes(r.cuisine)){
r.cuisine = guessCuisine(fullTitle(r), r.ingredients);
writes.push(dbSet('recipes/' + r.id + '/cuisine', r.cuisine));
}
let dirty = false;
(Array.isArray(r.ingredients) ? r.ingredients : []).forEach(i=>{
if(!CAT_KEYS.includes(i.category)){ i.category = guessCategory(i.name); dirty = true; }
});
if(dirty) writes.push(dbSet('recipes/' + r.id + '/ingredients', r.ingredients));
});
return writes;
}
function migrateIngredients(){
const writes = [];
Object.values(state.recipes).forEach(r=>{
if(!Array.isArray(r.ingredients)) return;
const next = r.ingredients.map(normalizeIngredient);
if(JSON.stringify(next) !== JSON.stringify(r.ingredients)){
r.ingredients = next;
writes.push(dbSet('recipes/' + r.id + '/ingredients', next));
}
});
return writes;
}
/* ---------- CUISINES / DISH STYLES (for finding meals in the plan builder) ---------- */
const CUISINES = [
{key:'italian', label:'Italian'}, {key:'mexican', label:'Mexican'}, {key:'asian', label:'Asian'},
{key:'indian', label:'Indian'}, {key:'mediterranean', label:'Mediterranean'}, {key:'middle-eastern', label:'Middle Eastern'},
{key:'french', label:'French'}, {key:'american', label:'American'},
{key:'salad', label:'Salad'}, {key:'soup', label:'Soup & stew'}, {key:'burgers', label:'Burgers & sandwiches'},
{key:'recipetin', label:'Recipe Tin'},
{key:'other', label:'Other'}
];
const CUISINE_KEYS = CUISINES.map(c => c.key);
const CUISINE_LABEL = Object.fromEntries(CUISINES.map(c => [c.key, c.label]));
const CUISINE_EMOJI = {italian:'🍝', mexican:'🌮', asian:'🥢', indian:'🍛', mediterranean:'🫒', 'middle-eastern':'🧆', french:'🥖', american:'🍔', salad:'🥗', soup:'🍲', burgers:'🍔', recipetin:'🥘', other:'🍽️'};
const CUISINE_GRAD = {italian:'#b5472f,#d9803f', mexican:'#c4572b,#e2a53b', asian:'#a8383d,#d9803f', indian:'#c47a1f,#e2b33b', mediterranean:'#4d7a5a,#8fae6b', 'middle-eastern':'#a5642f,#d4a24c', french:'#5d6f9c,#a3a9c9', american:'#8a4a2f,#c98a4a', salad:'#4f8a4a,#9cc069', soup:'#b0612f,#dba04c', burgers:'#8a4a2f,#c98a4a', recipetin:'#a8453a,#d9906b', other:'#7a6a55,#b9a98e'};
function placeholderHtml(r, h, radius, extra){
const c = r.cuisine && CUISINE_EMOJI[r.cuisine] ? r.cuisine : 'other';
return `<div style="height:${h}px;background:linear-gradient(135deg,${CUISINE_GRAD[c]});display:flex;align-items:center;justify-content:center;font-size:${Math.round(h*0.42)}px;border-radius:${radius};${extra||''}">${CUISINE_EMOJI[c]}</div>`;
}
function guessCuisine(title, ingredients){
const ti = String(title || '').toLowerCase();
const ing = (ingredients || []).map(i => String((i && i.name) || '').toLowerCase()).join(' | ');
const titleRules = [
['salad', /salad/], ['soup', /\bsoup|stew|chowder|chili\b|chilli\b/],
['burgers', /burger|sandwich|\bwraps?\b|\bsub\b|toastie|sloppy/],
['mexican', /taco|burrito|quesadilla|enchilada|fajita|nacho|mexican|tostada|guacamole/],
['indian', /curry|masala|tikka|\bdal\b|dhal|paneer|biryani|korma|samosa|indian/],
['asian', /stir.?fry|ramen|noodle|teriyaki|sushi|fried rice|pad thai|thai|katsu|dumpling|miso|asian|korean|japanese|chinese|bibimbap|pho\b/],
['middle-eastern', /hummus|falafel|shawarma|shakshuka|kebab|tabbouleh|middle eastern/],
['french', /french|ratatouille|quiche|crepe|crêpe|gratin|croque|bourguignon/],
['italian', /pasta|orzo|risotto|pizza|lasagn|gnocchi|spaghetti|penne|ravioli|carbonara|bolognese|pesto|italian|bruschetta|parmigiana|frittata|focaccia|fettuccine|linguine/],
['mediterranean', /greek|mediterranean|gyro|souvlaki|couscous/],
['american', /\bbbq\b|barbecue|mac (and|&|n) cheese|pancake|waffle|meatloaf|casserole|american|sliders?/]
];
for(const [k, re] of titleRules) if(re.test(ti)) return k;
const ingRules = [
['mexican', /tortilla|salsa|chipotle|jalape|black bean|cilantro|tortillas/],
['indian', /garam masala|curry|turmeric|paneer|tikka|cardamom/],
['asian', /soy sauce|sesame oil|miso|bok choy|rice vinegar|hoisin|fish sauce|ginger/],
['middle-eastern', /tahini|za'atar|sumac|hummus|pita/],
['italian', /pasta|orzo|parmesan|mozzarella|ricotta|pesto|spaghetti|basil/],
['mediterranean', /feta|halloumi|kalamata|olives?\b|tzatziki|couscous/]
];
for(const [k, re] of ingRules) if(re.test(ing)) return k;
return 'other';
}
// A recipe can belong to several categories (r.cuisines); r.cuisine stays as the first one.
function recipeCuisines(r){
const list = Array.isArray(r.cuisines) ? r.cuisines.filter(k => CUISINE_KEYS.includes(k)) : [];
if(list.length) return list;
return [CUISINE_KEYS.includes(r.cuisine) ? r.cuisine : 'other'];
}
function cuisineLabels(r){ return recipeCuisines(r).map(k => CUISINE_LABEL[k] || 'Other').join(' · '); }
// Categories the household has added themselves (stored in the database under customCuisines)
function applyCustomCuisines(){
Object.entries(state.customCuisines || {}).forEach(([key, label])=>{
if(CUISINE_KEYS.includes(key) || typeof label !== 'string') return;
const at = CUISINES.findIndex(c => c.key === 'other');
CUISINES.splice(at < 0 ? CUISINES.length : at, 0, {key, label});
CUISINE_KEYS.push(key); CUISINE_LABEL[key] = label;
});
}
function cuisineChipsHtml(selected){
return CUISINES.map(c => `<label class="chip cu-chip ${selected.includes(c.key)?'on':''}"><input type="checkbox" value="${esc(c.key)}" ${selected.includes(c.key)?'checked':''}>${esc(c.label)}</label>`).join('');
}
function cuisineOptionsHtml(sel){
return CUISINES.map(c => `<option value="${c.key}" ${c.key === sel ? 'selected' : ''}>${esc(c.label)}</option>`).join('');
}
function normPlan(p){
const ids = p.recipeIds ? (Array.isArray(p.recipeIds) ? p.recipeIds : Object.values(p.recipeIds)) : [];
const ex = p.extras ? (Array.isArray(p.extras) ? p.extras : Object.values(p.extras)) : [];
const legacyBuilt = ids.filter(Boolean).length > 0;
const built = p.built === undefined ? legacyBuilt : !!p.built;
const locked = p.locked === undefined ? built : !!p.locked;
return {id: p.id, name: p.name || 'Meal plan', created: p.created || 0, builtAt: p.builtAt || undefined, recipeIds: ids.filter(Boolean), built, locked, groceryDone: !!p.groceryDone,
servings: Object.fromEntries(Object.entries(p.servings || {}).map(([k,v]) => [k, Math.min(99, Math.max(1, parseInt(v) || 1))])),
done: Object.fromEntries(Object.entries(p.done || {}).filter(([k,v]) => v).map(([k,v]) => [k, typeof v === 'number' ? v : true])),
people: parseInt(p.people) || undefined, carried: p.carried ? Object.values(p.carried).filter(Boolean) : undefined, carryClear: p.carryClear ? Object.values(p.carryClear).filter(Boolean) : undefined, carryNew: p.carryNew ? Object.values(p.carryNew).filter(Boolean) : undefined, carryMode: p.carryMode || undefined, skipIng: p.skipIng ? Object.values(p.skipIng).filter(Boolean) : undefined,
extras: ex.filter(x => x && x.name).map(x => ({id: String(x.id || uid()), name: String(x.name), qty: String(x.qty || ''), category: CAT_KEYS.includes(x.category) ? x.category : guessCategory(x.name)}))};
}
// times cooked / last cooked come from the meal plans: a ticked meal stores the time it was ticked
// (older ticks hold just "true", so the plan's own date stands in for them)
function cookStats(id){
let n = 0, last = 0;
Object.values(state.plans).forEach(p => {
const v = p.done && p.done[id]; if(!v) return;
n++;
const t = typeof v === 'number' ? v : (p.created || 0);
if(t > last) last = t;
});
// cooks logged from the recipe page when the meal was not in the plan
const rc = state.recipes[id];
adhocCooks(rc).forEach(t => { n++; if(t > last) last = t; });
return {n, last};
}
function adhocCooks(r){ return r && r.cooks ? Object.values(r.cooks).filter(t => typeof t === 'number') : []; }
function sameDay(a, b){ return new Date(a).toDateString() === new Date(b).toDateString(); }
// is this recipe ticked as cooked right now? In the current plan it is the plan tick; otherwise a cook logged today
function cookedNow(r){
const pl = activePlan();
if(pl && pl.recipeIds.includes(r.id)) return !!(pl.done && pl.done[r.id]);
return adhocCooks(r).some(t => sameDay(t, Date.now()));
}