HTMLify
Coffee_Brewing_Guide_Brew_Steps_Updated.html
Views: 19 | Author: deepfriedgalliform
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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 | <!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, user-scalable=no"> <title>Coffee Brewing Guide</title> <!-- PWA Meta Tags & Manifest --> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="apple-mobile-web-app-title" content="Brew Guide"> <meta name="theme-color" content="#121214"> <link rel="manifest" href="data:application/manifest+json;charset=utf-8,%7B%22name%22%3A%22Coffee%20Brewing%20Guide%22%2C%22short_name%22%3A%22BrewGuide%22%2C%22start_url%22%3A%22.%22%2C%22display%22%3A%22standalone%22%2C%22background_color%22%3A%22%23121214%22%2C%22theme_color%22%3A%22%23121214%22%2C%22icons%22%3A%5B%5D%7D"> <script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js@4.5.1/dist/chart.umd.min.js"></script> <script> tailwind.config = { theme: { extend: { colors: { volvic: '#00A887', volvicDark: '#007A62', bronze: '#D4A373', gold: '#D4A359', switchClosed: '#E11D48', switchOpen: '#059669', darkBg: '#121214', cardBg: '#1A1A1E', borderDark: '#2A2A30' } } } } </script> <style> @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap'); body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; user-select: none; -webkit-tap-highlight-color: transparent; background-color: #121214; } .pulse-subtle { animation: pulse-slow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; } @keyframes pulse-slow { 0%, 100% { opacity: 1; } 50% { opacity: 0.8; } } </style> </head> <body class="bg-darkBg text-slate-100 min-h-screen flex flex-col justify-center items-center p-3 sm:p-4"> <!-- Main Application Card Container --> <div class="w-full max-w-md bg-cardBg rounded-3xl border border-borderDark p-5 sm:p-6 shadow-2xl flex flex-col gap-5 relative overflow-hidden"> <!-- ==================== 1. SETUP / RECIPE SCREEN ==================== --> <div id="setupScreen" class="flex flex-col gap-4 sm:gap-5"> <!-- Header --> <div class="text-center pt-1"> <h1 class="text-2xl font-extrabold tracking-tight text-white">Coffee Brewing Guide</h1> </div> <!-- Main Config Options Panel (User Inputs) --> <div class="bg-darkBg/60 border border-borderDark rounded-2xl p-3.5 sm:p-4 flex flex-col gap-4"> <!-- Coffee Preset Selection Dropdown --> <div> <label for="coffeeSelect" class="text-[11px] font-semibold uppercase tracking-wider text-slate-400 mb-2 block">Coffee Profile</label> <div class="relative"> <select id="coffeeSelect" onchange="updateSetupSpecs()" class="w-full bg-darkBg border border-borderDark rounded-xl p-3 text-sm font-medium text-white focus:outline-none focus:border-bronze appearance-none cursor-pointer pr-8"> <optgroup label="Standard Roast Profiles"> <option value="light_high">Light Roast / High Elevation</option> <option value="medium_light">Medium-Light Roast</option> <option value="medium_classic" selected>Medium Roast / Classic</option> <option value="dark_low">Dark Roast / Low Acidity</option> </optgroup> <optgroup label="Pact Coffee Profiles"> <option value="pact_light">Pact Specialty Light</option> <option value="pact_fruit">Pact Fruit & Floral</option> <option value="pact_choc">Pact Chocolate & Nutty</option> <option value="pact_dark">Pact Dark Roast / Bold Espresso Blend</option> </optgroup> <optgroup label="Regional & Specialty Profiles"> <option value="african_washed">African Washed (Yirgacheffe/Kenya)</option> <option value="central_american">Central American (Guatemala/Costa Rica)</option> <option value="natural_process">Natural Process (Eth/Bra)</option> <option value="sumatran_dark">Sumatran Dark / Pacific</option> </optgroup> </select> <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-3 text-slate-400"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg> </div> </div> </div> <!-- Brew Method Selection Tabs --> <div> <label class="text-[11px] font-semibold uppercase tracking-wider text-slate-400 mb-2 block">Brew Method</label> <div class="grid grid-cols-2 sm:grid-cols-4 bg-darkBg p-1 rounded-xl border border-borderDark text-[11px] font-bold gap-1"> <button id="btnMethodV60" onclick="setBrewMethod('v60')" class="py-2.5 rounded-lg transition-all bg-bronze text-slate-950 font-extrabold shadow-md text-center"> V60 </button> <button id="btnMethodSwitchHybrid" onclick="setBrewMethod('switch_hybrid')" class="py-2.5 rounded-lg transition-all text-slate-400 hover:text-white text-center"> Switch Hybrid </button> <button id="btnMethodSwitchImmersion" onclick="setBrewMethod('switch_immersion')" class="py-2.5 rounded-lg transition-all text-slate-400 hover:text-white text-center"> Switch Immersion </button> <button id="btnMethodClever" onclick="setBrewMethod('clever')" class="py-2.5 rounded-lg transition-all text-slate-400 hover:text-white text-center"> Clever Dripper </button> </div> </div> <!-- Cup Size Selector --> <div> <label class="text-[11px] font-semibold uppercase tracking-wider text-slate-400 mb-2 block">Cup Size & Ratio (1:16.6)</label> <div class="grid grid-cols-2 bg-darkBg p-1 rounded-xl border border-borderDark text-xs font-bold gap-1"> <button id="btn1Cup" onclick="setCupSize(1)" class="py-2.5 rounded-lg transition-all bg-bronze text-slate-950 font-extrabold shadow-md"> 1 Cup (15g / 250g) </button> <button id="btn2Cup" onclick="setCupSize(2)" class="py-2.5 rounded-lg transition-all text-slate-400 hover:text-white"> 2 Cups (30g / 500g) </button> </div> </div> </div> <!-- Recipe Summary & Specs Panel (Display Fields with Distinct Border) --> <div class="bg-darkBg/40 border border-bronze/30 rounded-2xl p-3.5 flex flex-col gap-3"> <span class="text-[10px] font-bold uppercase tracking-wider text-bronze px-1">Recipe Specifications & Summary</span> <!-- Specs Grid Summary Cards --> <div class="grid grid-cols-2 gap-2.5"> <div class="bg-darkBg/60 border border-borderDark p-3 rounded-2xl text-center"> <span class="text-[10px] font-semibold uppercase tracking-wider text-slate-400 block">Dose</span> <span id="specDose" class="text-base font-extrabold text-white mt-0.5 block">15.0g</span> </div> <div class="bg-darkBg/60 border border-borderDark p-3 rounded-2xl text-center"> <span class="text-[10px] font-semibold uppercase tracking-wider text-slate-400 block">Yield / Ratio</span> <span id="specWater" class="text-base font-extrabold text-white mt-0.5 block">250g (1:16.6)</span> </div> <div class="bg-darkBg/60 border border-borderDark p-3 rounded-2xl text-center"> <span class="text-[10px] font-semibold uppercase tracking-wider text-slate-400 block">Temperature</span> <span id="specTemp" class="text-base font-extrabold text-white mt-0.5 block">91°C</span> </div> <div class="bg-darkBg/60 border border-borderDark p-3 rounded-2xl text-center flex flex-col justify-center items-center"> <span class="text-[10px] font-semibold uppercase tracking-wider text-slate-400 block">Fellow Ode Gen 2</span> <span id="specOde" class="text-base font-extrabold text-white mt-0.5 block">Setting 6.0</span> <span id="specGrindTexture" class="text-[10px] font-medium text-slate-300 mt-1 bg-darkBg px-2 py-0.5 rounded-md border border-borderDark/60 block w-full truncate">Medium — Kosher Salt</span> </div> </div> <!-- Total Brew Time Card Inside Summary Panel --> <div class="bg-darkBg/60 border border-borderDark p-3 rounded-2xl text-center"> <span class="text-[10px] font-semibold uppercase tracking-wider text-slate-400 block">Estimated Total Brew Time</span> <span id="specTotalTime" class="text-base font-extrabold text-bronze mt-0.5 block">03:00</span> </div> </div> <!-- Proceed Button --> <button onclick="goToPrepScreen()" class="w-full bg-bronze hover:bg-amber-600 text-slate-950 font-extrabold py-3.5 rounded-2xl text-base shadow-lg shadow-bronze/20 active:scale-[0.98] transition-all flex items-center justify-center gap-2 mt-1"> <span>Proceed to Preparation</span> <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M14 5l7 7m0 0l-7 7m7-7H3"></path></svg> </button> </div> <!-- ==================== 2. SELF-PACED PREPARE SCREEN ==================== --> <div id="prepScreen" class="hidden flex-col gap-3 sm:gap-4"> <!-- Header without title bubble --> <div class="text-center pt-1"> <h2 class="text-xl font-extrabold text-white">Pre-Brew Checklist</h2> </div> <!-- Preparation Checklist Card (Compact padding for single-view fit) --> <div class="bg-darkBg/80 border border-borderDark rounded-2xl p-3 flex flex-col gap-2.5"> <div class="flex items-start gap-2.5 border-b border-borderDark/60 pb-2"> <div class="w-5 h-5 rounded-full bg-bronze/20 text-bronze flex items-center justify-center text-[11px] font-black shrink-0">1</div> <div> <span class="text-[11px] font-bold text-white block">Boil Kettle</span> <p id="prepInstructionBoil" class="text-[11px] text-slate-300 mt-0.5">Boil water to required temperature.</p> </div> </div> <div class="flex items-start gap-2.5 border-b border-borderDark/60 pb-2"> <div class="w-5 h-5 rounded-full bg-bronze/20 text-bronze flex items-center justify-center text-[11px] font-black shrink-0">2</div> <div> <span class="text-[11px] font-bold text-white block">Weigh Coffee Beans</span> <p id="prepInstructionWeigh" class="text-[11px] text-slate-300 mt-0.5">Weigh coffee beans accurately on scale.</p> </div> </div> <div class="flex items-start gap-2.5 border-b border-borderDark/60 pb-2"> <div class="w-5 h-5 rounded-full bg-bronze/20 text-bronze flex items-center justify-center text-[11px] font-black shrink-0">3</div> <div> <span class="text-[11px] font-bold text-white block">Grind Coffee</span> <p id="prepInstructionGrind" class="text-[11px] text-slate-300 mt-0.5">Grind on Fellow Ode Gen 2.</p> </div> </div> <div class="flex items-start gap-2.5 border-b border-borderDark/60 pb-2"> <div class="w-5 h-5 rounded-full bg-bronze/20 text-bronze flex items-center justify-center text-[11px] font-black shrink-0">4</div> <div> <span class="text-[11px] font-bold text-white block">Rinse Filter Paper & Preheat</span> <p class="text-[11px] text-slate-300 mt-0.5">Rinse paper filter with hot water, then discard rinse water.</p> </div> </div> <div id="prepStep5" class="flex items-start gap-2.5 border-b border-borderDark/60 pb-2"> <div class="w-5 h-5 rounded-full bg-bronze/20 text-bronze flex items-center justify-center text-[11px] font-black shrink-0">5</div> <div> <span id="prepStep5Title" class="text-[11px] font-bold text-white block">Add Grounds & Flatten Bed</span> <p id="prepStep5Desc" class="text-[11px] text-slate-300 mt-0.5">Add ground coffee to filter, tap level, and tare scale.</p> </div> </div> <div class="flex items-start gap-2.5"> <div class="w-5 h-5 rounded-full bg-bronze/20 text-bronze flex items-center justify-center text-[11px] font-black shrink-0">6</div> <div> <span class="text-[11px] font-bold text-white block">Ready to Start</span> <p class="text-[11px] text-slate-300 mt-0.5">Review recipe overview below, then press Start.</p> </div> </div> </div> <!-- Integrated Recipe Overview Header --> <div id="recipeOverviewCard" class="w-full bg-darkBg/80 border border-borderDark rounded-2xl p-3 flex flex-col gap-2"> <div class="flex items-center justify-between border-b border-borderDark/60 pb-1.5"> <span class="text-[10px] font-bold uppercase tracking-wider text-bronze flex items-center gap-1"> <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 002-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg> Recipe Overview </span> <div class="flex items-center gap-2"> <span id="overviewTotalWater" class="text-[10px] font-bold text-slate-300">Yield: 250g</span> <span id="overviewTotalTime" class="text-[10px] font-extrabold text-white bg-bronze/20 border border-bronze/40 px-2 py-0.5 rounded-md">Time: 03:15</span> </div> </div> <div id="overviewList" class="flex flex-col gap-1 text-[11px] text-slate-300 max-h-48 overflow-y-auto pr-1"> <!-- Steps inserted via JS --> </div> </div> <!-- Navigation Buttons --> <div class="grid grid-cols-3 gap-2.5 w-full"> <button onclick="goToSetupScreen()" class="col-span-1 bg-darkBg hover:bg-borderDark text-slate-300 font-bold py-3 rounded-2xl border border-borderDark text-xs transition-all flex items-center justify-center gap-1"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path></svg> <span>Setup</span> </button> <button onclick="startCountdown()" class="col-span-2 bg-volvic hover:bg-volvicDark text-white font-extrabold py-3 rounded-2xl text-sm shadow-lg shadow-volvic/20 active:scale-[0.98] transition-all flex items-center justify-center gap-2"> <span>Start Brew Cycle</span> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M14 5l7 7m0 0l-7 7m7-7H3"></path></svg> </button> </div> </div> <!-- ==================== 2.5. GET READY COUNTDOWN SCREEN ==================== --> <div id="countdownScreen" class="hidden flex-col items-center justify-center text-center gap-6 py-12"> <span class="px-3.5 py-1.5 rounded-full text-xs font-extrabold tracking-widest uppercase border bg-bronze/15 text-bronze border-bronze/40 animate-pulse"> Get Ready </span> <div class="flex flex-col items-center gap-2"> <span id="countdownNumber" class="text-8xl sm:text-9xl font-black text-white tabular-nums tracking-tighter">10</span> <p class="text-xs text-slate-400 mt-2">Get your kettle ready and tare your scale...</p> </div> <button onclick="skipCountdown()" class="text-xs font-bold text-slate-400 hover:text-white underline underline-offset-4 mt-4 py-2"> Skip Countdown & Start Now </button> </div> <!-- ==================== 3. ACTIVE BREW TIMER & LINE CHART ==================== --> <div id="brewScreen" class="hidden flex-col items-center gap-3 sm:gap-4"> <!-- Unified Status Header Bubble --> <div class="w-full flex flex-col items-center gap-2"> <div id="unifiedStatusBubble" class="w-full px-4 py-3 sm:py-4 rounded-2xl border bg-volvic/15 border-volvic/40 text-center flex flex-col items-center justify-center gap-1.5 transition-all duration-300"> <span id="phaseBadge" class="text-xs font-extrabold tracking-widest uppercase text-volvic"> BLOOM PHASE </span> <span id="unifiedInstruction" class="text-base sm:text-lg font-extrabold text-white leading-snug"> Pour to 50g at ~4.2 g/s </span> </div> <div id="valveBadge" class="px-3 py-1 rounded-lg text-xs font-black tracking-widest uppercase transition-all duration-300 bg-switchOpen/20 text-emerald-400 border border-emerald-500/40 hidden"> VALVE OPEN 🔓 </div> </div> <!-- Line Chart Container (Weight Over Time vs Target Profile) --> <div class="w-full bg-darkBg/90 border border-borderDark rounded-2xl p-3 flex flex-col items-center justify-center"> <div class="w-full h-48 relative"> <canvas id="brewChartCanvas"></canvas> </div> <!-- Live Metrics Display Below Chart (Step Timer, Target Water, and Integrated Total Brew Time) --> <div class="flex flex-col gap-2 w-full mt-2.5"> <div class="grid grid-cols-2 gap-2 w-full"> <div class="bg-cardBg/80 border border-borderDark/80 p-2 rounded-xl text-center"> <span class="text-[9px] text-slate-400 font-bold uppercase tracking-wider block">Step Timer</span> <span id="timerSeconds" class="text-2xl font-black text-white tabular-nums leading-none mt-1 block">45s</span> </div> <div class="bg-cardBg/80 border border-borderDark/80 p-2 rounded-xl text-center"> <span class="text-[9px] text-slate-400 font-bold uppercase tracking-wider block">Target Water</span> <span id="targetWater" class="text-2xl font-black text-bronze tabular-nums leading-none mt-1 block">50g</span> </div> </div> <!-- Integrated Total Brew Time Card --> <div class="bg-cardBg/80 border border-borderDark/80 p-2.5 rounded-xl flex items-center justify-between px-4"> <div class="flex items-center gap-2"> <span class="w-2 h-2 rounded-full bg-volvic animate-pulse"></span> <span class="text-[10px] text-slate-400 font-bold uppercase tracking-wider">Total Brew Time</span> </div> <span id="totalElapsedTimer" class="text-lg font-black text-white font-mono tracking-tight">00:00</span> </div> </div> </div> <!-- Step Title & Description --> <div class="text-center px-2 w-full"> <h2 id="stepTitle" class="text-base font-bold text-white">The Bloom</h2> <p id="stepDesc" class="text-xs text-slate-400 mt-0.5 min-h-[30px] leading-relaxed">Gentle spiral pour to saturate all grounds evenly.</p> </div> <!-- Next Step Preview Badge --> <div class="w-full bg-darkBg/60 border border-borderDark rounded-xl p-2.5 flex items-center justify-between text-xs text-slate-400"> <span class="font-bold text-[10px] uppercase tracking-wider text-slate-500">Next:</span> <span id="nextStepTitle" class="font-semibold text-slate-200 truncate">First Main Pour (150g)</span> </div> <!-- Controls Row --> <div class="grid grid-cols-3 gap-2.5 w-full mt-0.5"> <button onclick="prevStep()" class="bg-darkBg hover:bg-borderDark text-slate-300 font-bold py-3.5 px-3 rounded-xl border border-borderDark active:scale-95 transition-all text-xs flex items-center justify-center gap-1"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path></svg> <span>Back</span> </button> <button id="btnPause" onclick="togglePause()" class="bg-volvic hover:bg-volvicDark text-white font-extrabold py-3.5 px-3 rounded-xl border border-volvic/30 active:scale-95 transition-all text-sm flex items-center justify-center gap-1"> <span>Pause</span> </button> <button onclick="nextStep()" class="bg-darkBg hover:bg-borderDark text-slate-300 font-bold py-3.5 px-3 rounded-xl border border-borderDark active:scale-95 transition-all text-xs flex items-center justify-center gap-1"> <span>Skip</span> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg> </button> </div> <button onclick="cancelBrew()" class="w-full bg-rose-950/50 hover:bg-rose-900/70 text-rose-300 font-extrabold py-3.5 px-4 rounded-xl border border-rose-500/40 active:scale-[0.98] transition-all text-xs flex items-center justify-center gap-2"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 6l12 12M18 6L6 18"></path></svg> Cancel Brew </button> </div> <!-- ==================== 4. COMPLETION SUMMARY SCREEN ==================== --> <div id="summaryScreen" class="hidden flex-col gap-5"> <div class="text-center"> <div class="inline-flex items-center justify-center w-12 h-12 bg-volvic/20 text-volvic rounded-full mb-2"> <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M5 13l4 4L19 7"></path></svg> </div> <h2 class="text-2xl font-extrabold text-white">Brew Complete!</h2> <p id="summaryFinalTime" class="text-xs font-bold text-bronze mt-1">Total Brew Time: 00:00</p> </div> <!-- Tasting Profile Card --> <div class="bg-darkBg/60 border border-borderDark rounded-2xl p-4"> <h3 class="text-xs font-bold uppercase tracking-wider text-bronze mb-1.5 flex items-center gap-1.5"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"></path></svg> <span>Expected Tasting Profile</span> </h3> <p id="tastingNotes" class="text-xs text-slate-300 leading-relaxed">--</p> </div> <!-- Extraction Diagnostic Card --> <div class="bg-darkBg/60 border border-borderDark rounded-2xl p-4"> <h3 class="text-xs font-bold uppercase tracking-wider text-rose-400 mb-1.5 flex items-center gap-1.5"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg> <span>Extraction Check</span> </h3> <p id="diagnosticAdvice" class="text-xs text-slate-300 leading-relaxed"> If your cup tastes bitter or chalky, adjust Fellow Ode Gen 2 setting slightly coarser (+1 click) for your next brew. </p> </div> <button onclick="resetApp()" class="w-full bg-volvic hover:bg-volvicDark text-white font-extrabold py-3.5 rounded-2xl text-base shadow-lg shadow-volvic/20 active:scale-[0.98] transition-all"> Brew Another Cup </button> </div> </div> <script> // Service Worker Registration for PWA Offline Support if ('serviceWorker' in navigator) { window.addEventListener('load', () => { const swCode = `self.addEventListener('fetch', e => {});`; const blob = new Blob([swCode], { type: 'text/javascript' }); const swUrl = URL.createObjectURL(blob); navigator.serviceWorker.register(swUrl).catch(() => {}); }); } // Complete Database for Coffee Profiles & Fellow Ode Gen 2 Calibrations const coffeeData = { light_high: { temp: "96°C", notes: "Bright jasmine florals, sparkling citrus acidity, and clean tea-like sweetness.", ode: 5.1 }, medium_light: { temp: "93°C", notes: "Vibrant stone fruit, red berry notes, and refined cane sugar sweetness.", ode: 5.2 }, medium_classic: { temp: "91°C", notes: "Balanced caramel sweetness, milk chocolate, rounded apple acidity, and smooth finish.", ode: 6.0 }, dark_low: { temp: "85°C", notes: "Deep dark chocolate, smoky molasses, low acidity, and heavy velvety body.", ode: 6.3 }, pact_light: { temp: "93°C", notes: "Elegantly light body with crisp bergamot, honeysuckle, and stone fruit complexity.", ode: 5.2 }, pact_fruit: { temp: "94°C", notes: "Juicy raspberry, ripe peach notes, tropical sweetness, and floral aromas.", ode: 5.1 }, pact_choc: { temp: "92°C", notes: "Comforting hazelnut praline, milk chocolate, toasted oats, and balanced caramel body.", ode: 6.0 }, pact_dark: { temp: "88°C", notes: "Rich cocoa nibs, dark treacle, robust crema character, and lingering spiced finish.", ode: 6.2 }, african_washed: { temp: "96°C", notes: "High elevation Ethiopian/Kenyan character with lemongrass, black tea, and intense citrus clarity.", ode: 5.0 }, central_american: { temp: "92°C", notes: "Smooth honey sweetness, red apple, roasted almond, and clean balanced finish.", ode: 6.0 }, natural_process: { temp: "90°C", notes: "Complex anaerobic fermentation notes, dried mango, blueberry jam, and winey sweetness.", ode: 5.3 }, sumatran_dark: { temp: "86°C", notes: "Earthy, cedary, dark chocolate, low acidity, and full syrup-like mouthfeel.", ode: 6.3 } }; function getGrindTextureLabel(setting) { if (setting < 5.3) return "Medium-Fine — Table Salt"; if (setting <= 6.5) return "Medium — Kosher Salt"; if (setting <= 7.2) return "Medium-Coarse — Coarse Salt"; return "Coarse — Rough Sea Salt"; } function formatTime(totalSeconds) { const mins = Math.floor(totalSeconds / 60); const secs = totalSeconds % 60; return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`; } function generateSteps(method, cups) { const scale = cups === 2 ? 2 : 1; const targetTotalWater = 250 * scale; if (method === 'v60') { if (cups === 1) { return [ { title: "Bloom Pour", time: 12, pourTime: 12, water: 50, flow: "~4.2 g/s", desc: "Pour water in gentle spirals to 50g at ~4.2 g/s.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at ~4.2 g/s.", valve: null }, { title: "Bloom Rest", time: 33, pourTime: 0, water: 50, flow: "Resting", desc: "Let the coffee bloom and release trapped CO2 gases.", phase: "bloom", restBadge: "BLOOM REST", restInstruction: "Let the coffee bloom.", valve: null }, { title: "First Main Pour", time: 20, pourTime: 20, water: 150, flow: "~5.0 g/s", desc: "Pour in smooth concentric spirals to 150g at ~5.0 g/s.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at ~5.0 g/s.", valve: null }, { title: "First Main Wait", time: 25, pourTime: 0, water: 150, flow: "Resting", desc: "Let the water level drop slightly into the bed.", phase: "pour", restBadge: "WAIT", restInstruction: "Let bed settle.", valve: null }, { title: "Final Pour", time: 20, pourTime: 20, water: 250, flow: "~5.0 g/s", desc: "Pour to 250g target at ~5.0 g/s, give one gentle swirl.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at ~5.0 g/s.", valve: null }, { title: "Final Drawdown", time: 70, pourTime: 0, water: 250, flow: "Percolation drain", desc: "Allow the coffee to drain fully through the filter.", phase: "drawdown", restBadge: "DRAWDOWN", restInstruction: "Allow coffee to drain.", valve: null } ]; } else { return [ { title: "Bloom Pour", time: 15, pourTime: 15, water: 100, flow: "6.7 g/s", desc: "Pour in gentle spirals to 100g at 6.7 g/s.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at 6.7 g/s.", valve: null }, { title: "Bloom Rest", time: 30, pourTime: 0, water: 100, flow: "Resting", desc: "Let the coffee bloom and release CO2.", phase: "bloom", restBadge: "BLOOM REST", restInstruction: "Let the coffee bloom.", valve: null }, { title: "First Main Pour", time: 30, pourTime: 30, water: 300, flow: "6.7 g/s", desc: "Pour smoothly to 300g at 6.7 g/s.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at 6.7 g/s.", valve: null }, { title: "First Main Wait", time: 20, pourTime: 0, water: 300, flow: "Resting", desc: "Let the bed settle before final fill.", phase: "pour", restBadge: "WAIT", restInstruction: "Let bed settle.", valve: null }, { title: "Final Pour", time: 29, pourTime: 29, water: 500, flow: "6.9 g/s", desc: "Pour to 500g target at 6.9 g/s, give one gentle swirl.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at 6.9 g/s.", valve: null }, { title: "Final Drawdown", time: 86, pourTime: 0, water: 500, flow: "Percolation drain", desc: "Allow the larger batch to drain fully.", phase: "drawdown", restBadge: "DRAWDOWN", restInstruction: "Allow coffee to drain.", valve: null } ]; } } else if (method === 'switch_hybrid') { if (cups === 1) { return [ { title: "Open Bloom Pour", time: 12, pourTime: 12, water: 50, flow: "~4.2 g/s", desc: "Valve open. Pour bloom water to 50g at ~4.2 g/s.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at ~4.2 g/s.", valve: "open" }, { title: "Open Bloom Rest", time: 33, pourTime: 0, water: 50, flow: "Resting", desc: "Valve open. Allow coffee to bloom.", phase: "bloom", restBadge: "BLOOM REST", restInstruction: "Let coffee bloom.", valve: "open" }, { title: "Close Valve & Steep Pour", time: 20, pourTime: 20, water: 250, flow: "~10.0 g/s", desc: "Close valve, then pour to 250g at ~10.0 g/s.", phase: "steep", restBadge: "POURING", restInstruction: "Pour at ~10.0 g/s.", valve: "closed" }, { title: "Immersion Steep Phase", time: 70, pourTime: 0, water: 250, flow: "Steeping", desc: "Valve closed. Steep undisturbed.", phase: "steep", restBadge: "IMMERSION STEEP", restInstruction: "Steep with valve closed.", valve: "closed" }, { title: "Release Valve & Drawdown", time: 45, pourTime: 0, water: 250, flow: "Immersion drain", desc: "Open valve and let coffee drain into server.", phase: "drawdown", restBadge: "DRAWDOWN", restInstruction: "Open valve to drain.", valve: "open" } ]; } else { return [ { title: "Open Bloom Pour", time: 15, pourTime: 15, water: 100, flow: "6.7 g/s", desc: "Valve open. Pour larger bloom to 100g at 6.7 g/s.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at 6.7 g/s.", valve: "open" }, { title: "Open Bloom Rest", time: 30, pourTime: 0, water: 100, flow: "Resting", desc: "Valve open. Allow coffee to bloom.", phase: "bloom", restBadge: "BLOOM REST", restInstruction: "Let coffee bloom.", valve: "open" }, { title: "Close Valve & Steep Pour", time: 30, pourTime: 30, water: 500, flow: "~13.3 g/s", desc: "Close valve, pour smoothly to 500g at ~13.3 g/s.", phase: "steep", restBadge: "POURING", restInstruction: "Pour at ~13.3 g/s.", valve: "closed" }, { title: "Immersion Steep Phase", time: 90, pourTime: 0, water: 500, flow: "Steeping", desc: "Valve closed. Steep for proper extraction.", phase: "steep", restBadge: "IMMERSION STEEP", restInstruction: "Steep with valve closed.", valve: "closed" }, { title: "Release Valve & Drawdown", time: 60, pourTime: 0, water: 500, flow: "Immersion drain", desc: "Open valve and let larger volume drain.", phase: "drawdown", restBadge: "DRAWDOWN", restInstruction: "Open valve to drain.", valve: "open" } ]; } } else if (method === 'switch_immersion') { if (cups === 1) { return [ { title: "Closed Full Steep Pour", time: 25, pourTime: 25, water: 250, flow: "~10.0 g/s", desc: "Keep valve closed and pour to 250g at ~10.0 g/s.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at ~10.0 g/s.", valve: "closed" }, { title: "Settle Phase", time: 5, pourTime: 0, water: 250, flow: "Resting", desc: "Let coffee settle before steeping begins.", phase: "pour", restBadge: "SETTLE", restInstruction: "Let bed settle.", valve: "closed" }, { title: "Immersion Steep Phase", time: 120, pourTime: 0, water: 250, flow: "Steeping", desc: "Keep valve closed while coffee steeps.", phase: "steep", restBadge: "IMMERSION STEEP", restInstruction: "Steep with valve closed.", valve: "closed" }, { title: "Release Valve & Drawdown", time: 60, pourTime: 0, water: 250, flow: "Immersion drain", desc: "Open valve and allow coffee to drain fully.", phase: "drawdown", restBadge: "DRAWDOWN", restInstruction: "Open valve to drain.", valve: "open" } ]; } else { return [ { title: "Closed Full Steep Pour", time: 35, pourTime: 35, water: 500, flow: "~20.0 g/s", desc: "Keep valve closed and pour to 500g at ~20.0 g/s.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at ~20.0 g/s.", valve: "closed" }, { title: "Settle Phase", time: 5, pourTime: 0, water: 500, flow: "Resting", desc: "Let larger bed settle.", phase: "pour", restBadge: "SETTLE", restInstruction: "Let bed settle.", valve: "closed" }, { title: "Immersion Steep Phase", time: 120, pourTime: 0, water: 500, flow: "Steeping", desc: "Keep valve closed while coffee steeps.", phase: "steep", restBadge: "IMMERSION STEEP", restInstruction: "Steep with valve closed.", valve: "closed" }, { title: "Release Valve & Drawdown", time: 90, pourTime: 0, water: 500, flow: "Immersion drain", desc: "Open valve and allow larger volume to drain.", phase: "drawdown", restBadge: "DRAWDOWN", restInstruction: "Open valve to drain.", valve: "open" } ]; } } else { // Clever Dripper (Water-First approach) if (cups === 1) { return [ { title: "Water-First Pour", time: 25, pourTime: 25, water: 250, flow: "~10.0 g/s", desc: "Keep valve closed. Pour 250g water first at ~10.0 g/s.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at ~10.0 g/s.", valve: "closed" }, { title: "Water Rest", time: 5, pourTime: 0, water: 250, flow: "Resting", desc: "Water in place, get ready to add coffee grounds.", phase: "pour", restBadge: "READY", restInstruction: "Add coffee on top.", valve: "closed" }, { title: "Add Coffee & Full Steep", time: 120, pourTime: 0, water: 250, flow: "Steeping", desc: "Add coffee on top. At 1:30, gently break crust with one stir.", phase: "steep", cueAt: 90, cueDuration: 8, cueInstruction: "Give coffee crust one gentle stir.", restBadge: "IMMERSION STEEP", restInstruction: "Steep with valve closed.", valve: "closed" }, { title: "Place on Vessel & Drawdown", time: 60, pourTime: 0, water: 250, flow: "Automatic release", desc: "Place dripper onto server to release coffee.", phase: "drawdown", restBadge: "DRAWDOWN", restInstruction: "Place on server to drain.", valve: "open" } ]; } else { return [ { title: "Water-First Pour", time: 35, pourTime: 35, water: 500, flow: "~20.0 g/s", desc: "Keep valve closed. Pour 500g water first at ~20.0 g/s.", phase: "pour", restBadge: "POURING", restInstruction: "Pour at ~20.0 g/s.", valve: "closed" }, { title: "Water Rest", time: 5, pourTime: 0, water: 500, flow: "Resting", desc: "Water in place, get ready to add coffee grounds.", phase: "pour", restBadge: "READY", restInstruction: "Add coffee on top.", valve: "closed" }, { title: "Add Coffee & Full Steep", time: 180, pourTime: 0, water: 500, flow: "Steeping", desc: "Add coffee on top. At 2:00, gently break crust with one stir.", phase: "steep", cueAt: 120, cueDuration: 10, cueInstruction: "Give larger coffee crust one gentle stir.", restBadge: "IMMERSION STEEP", restInstruction: "Steep with valve closed.", valve: "closed" }, { title: "Place on Vessel & Drawdown", time: 90, pourTime: 0, water: 500, flow: "Automatic release", desc: "Place dripper onto server to release coffee smoothly.", phase: "drawdown", restBadge: "DRAWDOWN", restInstruction: "Place on server to drain.", valve: "open" } ]; } } } // State Variables let currentMethod = 'v60'; let currentCups = 1; let currentStepIdx = 0; let remainingStepTime = 0; let totalElapsedSeconds = 0; let isPaused = false; let timerInterval = null; let countdownInterval = null; let remainingCountdown = 10; let wakeLock = null; let brewChart = null; let targetProfileData = []; let actualProfileData = []; async function requestWakeLock() { if (!('wakeLock' in navigator) || document.visibilityState !== 'visible') return; try { if (wakeLock) return; wakeLock = await navigator.wakeLock.request('screen'); wakeLock.addEventListener('release', () => { wakeLock = null; }); } catch (e) { wakeLock = null; } } async function releaseWakeLock() { if (!wakeLock) return; try { await wakeLock.release(); } catch (e) {} wakeLock = null; } document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible' && !document.getElementById('brewScreen').classList.contains('hidden')) { requestWakeLock(); } }); let audioCtx = null; function initAudio() { if (!audioCtx) { audioCtx = new (window.AudioContext || window.webkitAudioContext)(); } if (audioCtx.state === 'suspended') { audioCtx.resume(); } } function playChime() { try { initAudio(); const osc = audioCtx.createOscillator(); const gain = audioCtx.createGain(); osc.type = 'sine'; osc.frequency.setValueAtTime(880, audioCtx.currentTime); gain.gain.setValueAtTime(0.3, audioCtx.currentTime); gain.gain.exponentialRampToValueAtTime(0.001, audioCtx.currentTime + 0.6); osc.connect(gain); gain.connect(audioCtx.destination); osc.start(); osc.stop(audioCtx.currentTime + 0.6); } catch(e){} } function triggerVibration() { if ('vibrate' in navigator) { try { navigator.vibrate([200, 100, 200]); } catch(e){} } } function setBrewMethod(method) { currentMethod = method; const btnV60 = document.getElementById('btnMethodV60'); const btnSwitchHybrid = document.getElementById('btnMethodSwitchHybrid'); const btnSwitchImmersion = document.getElementById('btnMethodSwitchImmersion'); const btnClever = document.getElementById('btnMethodClever'); const activeClass = "py-2.5 rounded-lg transition-all bg-bronze text-slate-950 font-extrabold shadow-md text-center"; const inactiveClass = "py-2.5 rounded-lg transition-all text-slate-400 hover:text-white text-center"; btnV60.className = method === 'v60' ? activeClass : inactiveClass; btnSwitchHybrid.className = method === 'switch_hybrid' ? activeClass : inactiveClass; btnSwitchImmersion.className = method === 'switch_immersion' ? activeClass : inactiveClass; btnClever.className = method === 'clever' ? activeClass : inactiveClass; updateSetupSpecs(); } function setCupSize(size) { currentCups = size; const btn1 = document.getElementById('btn1Cup'); const btn2 = document.getElementById('btn2Cup'); if (size === 1) { btn1.className = "py-2.5 rounded-lg transition-all bg-bronze text-slate-950 font-extrabold shadow-md"; btn2.className = "py-2.5 rounded-lg transition-all text-slate-400 hover:text-white"; } else { btn2.className = "py-2.5 rounded-lg transition-all bg-bronze text-slate-950 font-extrabold shadow-md"; btn1.className = "py-2.5 rounded-lg transition-all text-slate-400 hover:text-white"; } updateSetupSpecs(); } function getCalculatedOdeSetting() { const key = document.getElementById('coffeeSelect').value; const data = coffeeData[key] || coffeeData['medium_classic']; let calculatedOde = data.ode; if (currentMethod === 'switch_hybrid') { calculatedOde += 0.2; } else if (currentMethod === 'switch_immersion' || currentMethod === 'clever') { calculatedOde += 0.5; } if (currentCups === 2) { calculatedOde += 1.0; } return calculatedOde; } function updateSetupSpecs() { const key = document.getElementById('coffeeSelect').value; const data = coffeeData[key] || coffeeData['medium_classic']; const calculatedOde = getCalculatedOdeSetting(); document.getElementById('specTemp').innerText = data.temp; document.getElementById('specOde').innerText = `Setting ${calculatedOde.toFixed(1)}`; document.getElementById('specGrindTexture').innerText = getGrindTextureLabel(calculatedOde); document.getElementById('specDose').innerText = currentCups === 1 ? "15.0g" : "30.0g"; document.getElementById('specWater').innerText = currentCups === 1 ? "250g (1:16.6)" : "500g (1:16.6)"; const steps = generateSteps(currentMethod, currentCups); let totalSeconds = 0; steps.forEach(s => totalSeconds += s.time); document.getElementById('specTotalTime').innerText = formatTime(totalSeconds); } function goToPrepScreen() { const key = document.getElementById('coffeeSelect').value; const data = coffeeData[key] || coffeeData['medium_classic']; const calculatedOde = getCalculatedOdeSetting(); const waterGrams = currentCups === 1 ? 250 : 500; const doseGrams = currentCups === 1 ? "15.0g" : "30.0g"; document.getElementById('prepInstructionBoil').innerText = `Boil at least ${waterGrams}ml water to ${data.temp}.`; document.getElementById('prepInstructionWeigh').innerText = `Weigh ${doseGrams} coffee beans.`; document.getElementById('prepInstructionGrind').innerText = `Grind to ${calculatedOde.toFixed(1)} on Fellow Ode Gen 2 (${getGrindTextureLabel(calculatedOde)}).`; const step5Title = document.getElementById('prepStep5Title'); const step5Desc = document.getElementById('prepStep5Desc'); if (currentMethod === 'clever') { step5Title.innerText = "Weigh Water into Brewer First"; step5Desc.innerText = `Place filter in Clever Dripper off the vessel, ensure valve is closed, and pour ${waterGrams}g water directly into the brewer. Keep ground coffee separate until timer starts.`; } else { step5Title.innerText = "Add Grounds & Flatten Bed"; step5Desc.innerText = "Add ground coffee to filter, tap gently to level bed, and tare scale to 0.0g."; } populateRecipeOverview(); document.getElementById('setupScreen').classList.add('hidden'); document.getElementById('prepScreen').classList.remove('hidden'); document.getElementById('prepScreen').classList.add('flex'); } function goToSetupScreen() { document.getElementById('prepScreen').classList.add('hidden'); document.getElementById('prepScreen').classList.remove('flex'); document.getElementById('setupScreen').classList.remove('hidden'); } function populateRecipeOverview() { const steps = generateSteps(currentMethod, currentCups); const overviewList = document.getElementById('overviewList'); const overviewTotalWater = document.getElementById('overviewTotalWater'); const overviewTotalTime = document.getElementById('overviewTotalTime'); overviewList.innerHTML = ''; let totalSeconds = 0; steps.forEach(s => totalSeconds += s.time); overviewTotalWater.innerText = `Yield: ${currentCups === 1 ? 250 : 500}g`; overviewTotalTime.innerText = `Time: ${formatTime(totalSeconds)}`; steps.forEach((s, i) => { const item = document.createElement('div'); item.className = "flex items-center justify-between border-b border-borderDark/30 pb-0.5 pt-0.5 text-[10px]"; let valveTag = ''; if (s.valve === 'open') { valveTag = `<span class="text-emerald-400 font-bold ml-1">[🔓 Open]</span>`; } else if (s.valve === 'closed') { valveTag = `<span class="text-rose-400 font-bold ml-1">[🔒 Closed]</span>`; } item.innerHTML = ` <div class="flex items-center gap-1 truncate pr-2"> <span class="text-bronze font-bold">${i + 1}.</span> <span class="font-medium text-slate-200 truncate">${s.title}</span> ${valveTag} </div> <div class="flex items-center gap-1.5 whitespace-nowrap"> <span class="font-bold text-white">${s.water}g</span> <span class="text-[9px] text-slate-400">(${s.time}s)</span> </div> `; overviewList.appendChild(item); }); } function generateTargetProfile() { const steps = generateSteps(currentMethod, currentCups); targetProfileData = [{ x: 0, y: 0 }]; let t = 0; let prevWater = 0; steps.forEach(s => { const targetWater = s.water; const pourT = s.pourTime || 0; const stepDuration = s.time; for (let sec = 1; sec <= stepDuration; sec++) { t++; let currentW = prevWater; if (pourT > 0 && sec <= pourT) { currentW = prevWater + ((targetWater - prevWater) * (sec / pourT)); } else { currentW = targetWater; } targetProfileData.push({ x: t, y: Math.round(currentW * 10) / 10 }); } prevWater = targetWater; }); actualProfileData = [{ x: 0, y: 0 }]; } function initChart() { const ctx = document.getElementById('brewChartCanvas').getContext('2d'); if (brewChart) { brewChart.destroy(); } const maxY = currentCups === 1 ? 275 : 550; brewChart = new Chart(ctx, { type: 'line', data: { datasets: [ { label: 'Target Profile', data: targetProfileData, borderColor: '#D4A373', borderWidth: 2, borderDash: [5, 5], pointRadius: 0, fill: false, tension: 0.1 }, { label: 'Live Brew', data: actualProfileData, borderColor: '#00A887', backgroundColor: 'rgba(0, 168, 135, 0.15)', borderWidth: 3, pointRadius: 0, fill: true, tension: 0.1 } ] }, options: { responsive: true, maintainAspectRatio: false, animation: false, scales: { x: { type: 'linear', title: { display: true, text: 'Time (s)', color: '#94A3B8', font: { size: 10 } }, ticks: { color: '#64748B', font: { size: 9 } }, grid: { color: '#2A2A30' } }, y: { min: 0, max: maxY, title: { display: true, text: 'Weight (g)', color: '#94A3B8', font: { size: 10 } }, ticks: { color: '#64748B', font: { size: 9 } }, grid: { color: '#2A2A30' } } }, plugins: { legend: { display: true, position: 'top', labels: { color: '#CBD5E1', font: { size: 10, weight: 'bold' }, usePointStyle: true, pointStyle: 'line', boxWidth: 20 } }, tooltip: { enabled: false } } } }); } function updateChartLiveData() { if (!brewChart) return; const targetPoint = targetProfileData.find(p => p.x === totalElapsedSeconds) || targetProfileData[targetProfileData.length - 1]; const existingIdx = actualProfileData.findIndex(p => p.x === totalElapsedSeconds); if (existingIdx >= 0) { actualProfileData[existingIdx] = { x: totalElapsedSeconds, y: targetPoint.y }; } else { actualProfileData.push({ x: totalElapsedSeconds, y: targetPoint.y }); } brewChart.update('none'); } function startCountdown() { initAudio(); document.getElementById('prepScreen').classList.add('hidden'); document.getElementById('prepScreen').classList.remove('flex'); document.getElementById('countdownScreen').classList.remove('hidden'); document.getElementById('countdownScreen').classList.add('flex'); remainingCountdown = 10; document.getElementById('countdownNumber').innerText = remainingCountdown; clearInterval(countdownInterval); countdownInterval = setInterval(() => { remainingCountdown--; document.getElementById('countdownNumber').innerText = remainingCountdown; if (remainingCountdown <= 3 && remainingCountdown > 0) { playChime(); } if (remainingCountdown <= 0) { clearInterval(countdownInterval); playChime(); triggerVibration(); startActiveBrewTimer(); } }, 1000); } function skipCountdown() { clearInterval(countdownInterval); playChime(); startActiveBrewTimer(); } function startActiveBrewTimer() { document.getElementById('countdownScreen').classList.add('hidden'); document.getElementById('countdownScreen').classList.remove('flex'); document.getElementById('brewScreen').classList.remove('hidden'); document.getElementById('brewScreen').classList.add('flex'); currentStepIdx = 0; totalElapsedSeconds = 0; document.getElementById('totalElapsedTimer').innerText = "00:00"; generateTargetProfile(); initChart(); loadStep(0); } function loadStep(idx) { clearInterval(timerInterval); const steps = generateSteps(currentMethod, currentCups); if (idx >= steps.length) { finishBrew(); return; } currentStepIdx = idx; const step = steps[idx]; remainingStepTime = step.time; isPaused = false; document.getElementById('btnPause').innerText = "Pause"; document.getElementById('stepTitle').innerText = step.title; document.getElementById('stepDesc').innerText = step.desc; document.getElementById('targetWater').innerText = step.water + "g"; const nextStepTitle = document.getElementById('nextStepTitle'); if (idx + 1 < steps.length) { const next = steps[idx + 1]; nextStepTitle.innerText = `${next.title} (${next.water}g)`; } else { nextStepTitle.innerText = "Final Drawdown & Serve"; } const valveBadge = document.getElementById('valveBadge'); if (currentMethod === 'v60' || !step.valve) { valveBadge.classList.add('hidden'); } else { valveBadge.classList.remove('hidden'); if (step.valve === 'open') { valveBadge.innerText = "VALVE OPEN 🔓"; valveBadge.className = "px-3 py-1 rounded-lg text-xs font-black tracking-widest uppercase transition-all duration-300 bg-switchOpen/20 text-emerald-400 border border-emerald-500/40"; } else { valveBadge.innerText = "VALVE CLOSED 🔒"; valveBadge.className = "px-3 py-1 rounded-lg text-xs font-black tracking-widest uppercase transition-all duration-300 bg-switchClosed/20 text-rose-400 border border-rose-500/40 pulse-subtle"; } } updateUI(); startTimer(); } function startTimer() { clearInterval(timerInterval); timerInterval = setInterval(() => { if (!isPaused) { remainingStepTime--; totalElapsedSeconds++; document.getElementById('totalElapsedTimer').innerText = formatTime(totalElapsedSeconds); updateChartLiveData(); updateUI(); if (remainingStepTime <= 0) { clearInterval(timerInterval); playChime(); triggerVibration(); nextStep(); } } }, 1000); } function updateUI() { const steps = generateSteps(currentMethod, currentCups); const step = steps[currentStepIdx]; document.getElementById('timerSeconds').innerText = remainingStepTime + "s"; const elapsedTimeInStep = step.time - remainingStepTime; const isPouring = step.pourTime > 0 && elapsedTimeInStep < step.pourTime; const badge = document.getElementById('phaseBadge'); const instruction = document.getElementById('unifiedInstruction'); const statusBubble = document.getElementById('unifiedStatusBubble'); if (isPouring) { const pourLeft = step.pourTime - elapsedTimeInStep; badge.innerText = `ACTIVE POUR (${pourLeft}s)`; instruction.innerText = `Pour to ${step.water}g at ${step.flow}`; statusBubble.className = "w-full px-4 py-3 sm:py-4 rounded-2xl border bg-volvic/20 border-volvic text-center flex flex-col items-center justify-center gap-1 transition-all duration-300 animate-pulse"; return; } if (step.phase === 'drawdown') { badge.innerText = step.restBadge || "DRAWDOWN"; instruction.innerText = step.restInstruction || "Let the coffee drain."; statusBubble.className = "w-full px-4 py-3 sm:py-4 rounded-2xl border bg-gold/15 border-gold/40 text-center flex flex-col items-center justify-center gap-1 transition-all duration-300"; return; } if (step.phase === 'steep') { const showCue = step.cueAt !== undefined && elapsedTimeInStep >= step.cueAt && elapsedTimeInStep < step.cueAt + (step.cueDuration || 10); badge.innerText = showCue ? "ACTION NOW" : (step.restBadge || "IMMERSION STEEP"); instruction.innerText = showCue ? step.cueInstruction : (step.restInstruction || "Steep with the valve closed."); statusBubble.className = "w-full px-4 py-3 sm:py-4 rounded-2xl border bg-gold/15 border-gold/40 text-center flex flex-col items-center justify-center gap-1 transition-all duration-300"; return; } badge.innerText = step.restBadge || (step.phase === 'bloom' ? "BLOOM REST" : "WAIT"); instruction.innerText = step.restInstruction || "Wait for the next step."; statusBubble.className = "w-full px-4 py-3 sm:py-4 rounded-2xl border bg-bronze/15 border-bronze/40 text-center flex flex-col items-center justify-center gap-1 transition-all duration-300"; } function togglePause() { isPaused = !isPaused; document.getElementById('btnPause').innerText = isPaused ? "Resume" : "Pause"; } function nextStep() { loadStep(currentStepIdx + 1); } function cancelBrew() { clearInterval(timerInterval); clearInterval(countdownInterval); timerInterval = null; countdownInterval = null; releaseWakeLock(); isPaused = false; remainingStepTime = 0; totalElapsedSeconds = 0; document.getElementById('brewScreen').classList.add('hidden'); document.getElementById('brewScreen').classList.remove('flex'); document.getElementById('countdownScreen').classList.add('hidden'); document.getElementById('countdownScreen').classList.remove('flex'); document.getElementById('prepScreen').classList.add('hidden'); document.getElementById('prepScreen').classList.remove('flex'); document.getElementById('setupScreen').classList.remove('hidden'); document.getElementById('totalElapsedTimer').innerText = "00:00"; document.getElementById('btnPause').innerText = "Pause"; } function prevStep() { if (currentStepIdx > 0) { loadStep(currentStepIdx - 1); } } function finishBrew() { clearInterval(timerInterval); releaseWakeLock(); document.getElementById('brewScreen').classList.add('hidden'); document.getElementById('brewScreen').classList.remove('flex'); document.getElementById('summaryScreen').classList.add('hidden'); document.getElementById('summaryScreen').classList.remove('hidden'); document.getElementById('summaryScreen').classList.add('flex'); document.getElementById('summaryFinalTime').innerText = `Total Brew Time: ${formatTime(totalElapsedSeconds)}`; const key = document.getElementById('coffeeSelect').value; const data = coffeeData[key] || coffeeData['medium_classic']; document.getElementById('tastingNotes').innerText = data.notes; const diag = document.getElementById('diagnosticAdvice'); if (currentMethod === 'v60') { diag.innerText = "If your brew tastes dry or astringent, your grind was slightly too fine. Coarsen your Fellow Ode Gen 2 by 1 click for your next brew."; } else if (currentMethod.includes('switch')) { diag.innerText = "If drawdown stalled during valve open phase, coarsen your Fellow Ode Gen 2 by 1 click to minimize fine migration."; } else { diag.innerText = "If cup feels muddy or overly heavy, coarsen your Fellow Ode Gen 2 setting slightly."; } } function resetApp() { document.getElementById('summaryScreen').classList.add('hidden'); document.getElementById('summaryScreen').classList.remove('flex'); document.getElementById('setupScreen').classList.remove('hidden'); } // Initialize specs on load updateSetupSpecs(); </script> </body> </html> |