Spaces:
Running
Running
File size: 76,100 Bytes
130797f 36e4fde 130797f 36e4fde 27decdf 36e4fde 27decdf 36e4fde 130797f 36e4fde 130797f 36e4fde | 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 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mr. FLEN's Stock Prediction Game</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700;900&family=Exo+2:wght@300;400;600;700&display=swap" rel="stylesheet">
</head>
<body class="bg-gradient-to-br from-gray-900 via-purple-900 to-indigo-900 min-h-screen text-white">
<div class="container mx-auto px-4 py-8 max-w-6xl">
<!-- Header -->
<header class="text-center mb-8 relative">
<div class="absolute inset-0 bg-gradient-to-r from-cyan-500/20 to-purple-500/20 blur-3xl rounded-full mx-auto w-3/4 h-32"></div>
<h1 class="text-4xl md:text-5xl font-bold mb-3 relative z-10">
<span class="bg-clip-text text-transparent bg-gradient-to-r from-cyan-400 via-purple-400 to-pink-400 font-orbitron">
MR. FLEN'S
</span>
<br>
<span class="font-exo text-2xl md:text-3xl">STOCK PREDICTION GAME</span>
</h1>
<div class="flex justify-center mt-3 space-x-2">
<div class="w-2 h-2 bg-cyan-400 rounded-full animate-pulse"></div>
<div class="w-2 h-2 bg-purple-400 rounded-full animate-pulse delay-100"></div>
<div class="w-2 h-2 bg-pink-400 rounded-full animate-pulse delay-200"></div>
</div>
</header>
<!-- User Info Bar -->
<div class="bg-gradient-to-r from-gray-800/50 to-gray-900/50 backdrop-blur-lg border border-cyan-500/30 rounded-2xl shadow-2xl p-4 mb-6 flex justify-between items-center">
<div class="flex items-center space-x-4">
<div class="w-10 h-10 bg-gradient-to-r from-cyan-500 to-purple-500 rounded-full flex items-center justify-center">
<i class="fas fa-user"></i>
</div>
<div>
<div class="font-exo font-bold" id="current-user">Guest User</div>
<div class="text-sm text-gray-400">
<span class="mr-3">System 1 Points: <span id="user-points-s1">0</span></span>
<span>System 2 Points: <span id="user-points-s2">0</span></span>
</div>
</div>
</div>
<div class="flex space-x-3">
<button id="league-tab" class="px-4 py-2 bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-500 hover:to-pink-500 rounded-lg font-exo font-bold text-sm transition-all">
<i class="fas fa-trophy mr-2"></i>LEAGUE
</button>
<button id="settings-tab" class="px-4 py-2 bg-gradient-to-r from-gray-600 to-gray-700 hover:from-gray-500 hover:to-gray-600 rounded-lg font-exo font-bold text-sm transition-all">
<i class="fas fa-cog mr-2"></i>SETTINGS
</button>
</div>
</div>
<!-- Main Content Area -->
<div id="main-content">
<!-- Dashboard Content -->
<div id="dashboard-content">
<!-- Market Status -->
<div class="bg-gradient-to-r from-gray-800/50 to-gray-900/50 backdrop-blur-lg border border-cyan-500/30 rounded-2xl shadow-2xl p-6 mb-6 relative overflow-hidden">
<div class="absolute inset-0 bg-gradient-to-r from-cyan-500/5 to-purple-500/5"></div>
<div class="relative z-10">
<div class="flex items-center justify-between">
<div>
<h3 class="text-xl font-exo font-bold text-gray-200 mb-2">MARKET STATUS</h3>
<p id="market-status-text" class="text-gray-300">Analyzing quantum market state...</p>
</div>
<div id="market-status-icon" class="text-3xl"></div>
</div>
<div class="mt-3 h-2 bg-gray-700 rounded-full overflow-hidden">
<div id="market-progress" class="h-full bg-gradient-to-r from-cyan-500 to-purple-500 w-0 transition-all duration-1000"></div>
</div>
</div>
</div>
<!-- Prediction Form -->
<div id="prediction-form-container" class="bg-gradient-to-r from-gray-800/50 to-gray-900/50 backdrop-blur-lg border border-cyan-500/30 rounded-2xl shadow-2xl p-6 mb-6 relative overflow-hidden">
<div class="absolute inset-0 bg-gradient-to-r from-cyan-500/5 to-purple-500/5"></div>
<div class="relative z-10">
<h3 class="text-xl font-exo font-bold text-gray-200 mb-5">QUANTUM PREDICTION ENGINE</h3>
<form id="prediction-form">
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<label class="block text-gray-300 font-exo font-medium mb-2" for="symbol">
<i class="fas fa-chart-line mr-2 text-cyan-400"></i>STOCK SYMBOL
</label>
<div class="flex">
<input
type="text"
id="symbol"
class="flex-1 px-3 py-2 bg-gray-900/70 border border-cyan-500/30 rounded-l-lg focus:ring-2 focus:ring-cyan-500 focus:border-cyan-500 text-white font-exo backdrop-blur-sm"
placeholder="e.g. AAPL, GOOGL"
required
>
<button
type="button"
id="check-symbol"
class="bg-gradient-to-r from-cyan-600 to-purple-600 hover:from-cyan-500 hover:to-purple-500 px-3 py-2 rounded-r-lg transition-all duration-300 font-exo font-bold"
>
<i class="fas fa-search"></i>
</button>
</div>
</div>
<div>
<label class="block text-gray-300 font-exo font-medium mb-2">
<i class="fas fa-calendar-day mr-2 text-cyan-400"></i>PERIOD
</label>
<div class="grid grid-cols-2 gap-1">
<label class="flex items-center bg-gray-900/50 p-2 rounded-lg cursor-pointer hover:bg-gray-800/70 border border-cyan-500/20 transition-all text-sm">
<input type="radio" name="period" value="day" class="mr-1 accent-cyan-500" checked>
<span class="font-exo">TODAY</span>
</label>
<label class="flex items-center bg-gray-900/50 p-2 rounded-lg cursor-pointer hover:bg-gray-800/70 border border-cyan-500/20 transition-all text-sm">
<input type="radio" name="period" value="week" class="mr-1 accent-purple-500">
<span class="font-exo">WEEK</span>
</label>
</div>
</div>
<div>
<label class="block text-gray-300 font-exo font-medium mb-2">
<i class="fas fa-arrow-up mr-2 text-cyan-400"></i>PREDICTION
</label>
<div class="grid grid-cols-2 gap-1">
<label class="flex items-center bg-green-900/30 p-2 rounded-lg cursor-pointer hover:bg-green-800/50 border border-green-500/30 transition-all text-sm">
<input type="radio" name="prediction" value="up" class="mr-1 accent-green-500" required>
<span class="text-green-400 font-exo">UP</span>
</label>
<label class="flex items-center bg-red-900/30 p-2 rounded-lg cursor-pointer hover:bg-red-800/50 border border-red-500/30 transition-all text-sm">
<input type="radio" name="prediction" value="down" class="mr-1 accent-red-500">
<span class="text-red-400 font-exo">DOWN</span>
</label>
</div>
<div class="mt-2 text-xs text-gray-400">
<i class="fas fa-info-circle mr-1"></i>If none selected, system assigns random
</div>
</div>
</div>
<!-- Stock Details Section -->
<div id="stock-details" class="mt-5 p-4 bg-gray-900/50 rounded-xl border border-cyan-500/20 hidden backdrop-blur-sm">
<div class="flex items-center justify-between mb-4">
<h4 class="text-lg font-exo font-bold text-gray-200">QUANTUM STOCK ANALYSIS</h4>
<button type="button" id="close-details" class="text-gray-400 hover:text-cyan-400">
<i class="fas fa-times"></i>
</button>
</div>
<div id="stock-info" class="mb-4">
<!-- Stock info will be populated here -->
</div>
<div id="stock-chart" class="bg-gray-900/70 p-3 rounded-lg border border-cyan-500/20">
<div class="text-center text-gray-500 py-8">
<i class="fas fa-spinner fa-spin text-2xl mb-2"></i>
<p>Initializing quantum processors...</p>
</div>
</div>
</div>
<button
type="submit"
id="submit-prediction"
class="w-full mt-5 bg-gradient-to-r from-cyan-600 to-purple-600 hover:from-cyan-500 hover:to-purple-500 text-white font-exo font-bold py-3 px-4 rounded-xl transition-all duration-300 transform hover:scale-[1.02]"
>
<i class="fas fa-rocket mr-2"></i>LAUNCH PREDICTION
</button>
</form>
</div>
</div>
<!-- Pending Predictions -->
<div class="bg-gradient-to-r from-gray-800/50 to-gray-900/50 backdrop-blur-lg border border-cyan-500/30 rounded-2xl shadow-2xl p-6 relative overflow-hidden">
<div class="absolute inset-0 bg-gradient-to-r from-cyan-500/5 to-purple-500/5"></div>
<div class="relative z-10">
<h3 class="text-xl font-exo font-bold text-gray-200 mb-4">QUANTUM PREDICTIONS</h3>
<div id="pending-predictions-list" class="space-y-3">
<p class="text-gray-400 text-center py-8">No pending quantum predictions in the system</p>
</div>
</div>
</div>
</div>
<!-- League Content -->
<div id="league-content" class="hidden">
<div class="bg-gradient-to-r from-gray-800/50 to-gray-900/50 backdrop-blur-lg border border-cyan-500/30 rounded-2xl shadow-2xl p-6 relative overflow-hidden">
<div class="absolute inset-0 bg-gradient-to-r from-cyan-500/5 to-purple-500/5"></div>
<div class="relative z-10">
<div class="flex justify-between items-center mb-6">
<h3 class="text-2xl font-exo font-bold text-gray-200">QUANTUM LEAGUE TABLE</h3>
<button id="refresh-leaderboard" class="px-4 py-2 bg-gradient-to-r from-cyan-600 to-purple-600 hover:from-cyan-500 hover:to-purple-500 rounded-lg font-exo font-bold text-sm transition-all">
<i class="fas fa-sync mr-2"></i>REFRESH
</button>
</div>
<div class="mb-6">
<h4 class="font-exo font-bold text-lg text-cyan-400 mb-3">IMPORT USER DATA</h4>
<div class="flex">
<textarea
id="import-data"
class="flex-1 px-3 py-2 bg-gray-900/70 border border-cyan-500/30 rounded-l-lg focus:ring-2 focus:ring-cyan-500 focus:border-cyan-500 text-white font-exo text-sm backdrop-blur-sm"
placeholder="Paste user data here to import..."
rows="3"
></textarea>
<button
id="import-user-data"
class="bg-gradient-to-r from-green-600 to-cyan-600 hover:from-green-500 hover:to-cyan-500 px-4 py-2 rounded-r-lg transition-all font-exo font-bold"
>
IMPORT
</button>
</div>
<div class="mt-2 text-sm text-gray-400">
<i class="fas fa-info-circle mr-1"></i>Share your data with friends via text message
</div>
</div>
<div class="mb-6">
<h4 class="font-exo font-bold text-lg text-cyan-400 mb-3">YOUR DATA TO SHARE</h4>
<div class="flex">
<textarea
id="export-data"
class="flex-1 px-3 py-2 bg-gray-900/70 border border-cyan-500/30 rounded-l-lg focus:ring-2 focus:ring-cyan-500 focus:border-cyan-500 text-white font-exo text-sm backdrop-blur-sm"
rows="2"
readonly
></textarea>
<button
id="copy-data"
class="bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-500 hover:to-pink-500 px-4 py-2 rounded-r-lg transition-all font-exo font-bold"
>
COPY
</button>
</div>
</div>
<div class="mb-6">
<h4 class="font-exo font-bold text-lg text-cyan-400 mb-3">SCORING SYSTEMS</h4>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-gray-900/50 p-4 rounded-lg border border-cyan-500/20">
<h5 class="font-exo font-bold text-cyan-400 mb-2">System 1: Binary Scoring</h5>
<p class="text-sm text-gray-300">+1 pt for correct prediction, -1 pt for incorrect</p>
</div>
<div class="bg-gray-900/50 p-4 rounded-lg border border-purple-500/20">
<h5 class="font-exo font-bold text-purple-400 mb-2">System 2: Percentage Scoring</h5>
<p class="text-sm text-gray-300">±1 pt per 1% change in predicted direction</p>
</div>
</div>
</div>
<div>
<h4 class="font-exo font-bold text-lg text-cyan-400 mb-3">LEADERBOARD</h4>
<div id="leaderboard" class="space-y-2">
<p class="text-gray-400 text-center py-8">No league data available. Import user data to see rankings.</p>
</div>
</div>
</div>
</div>
</div>
<!-- Settings Content -->
<div id="settings-content" class="hidden">
<div class="bg-gradient-to-r from-gray-800/50 to-gray-900/50 backdrop-blur-lg border border-cyan-500/30 rounded-2xl shadow-2xl p-6 relative overflow-hidden">
<div class="absolute inset-0 bg-gradient-to-r from-cyan-500/5 to-purple-500/5"></div>
<div class="relative z-10">
<h3 class="text-2xl font-exo font-bold text-gray-200 mb-6">USER SETTINGS</h3>
<form id="user-settings-form" class="space-y-6">
<div>
<label class="block text-gray-300 font-exo font-medium mb-2" for="username">
<i class="fas fa-user-edit mr-2 text-cyan-400"></i>USERNAME
</label>
<input
type="text"
id="username"
class="w-full px-4 py-3 bg-gray-900/70 border border-cyan-500/30 rounded-lg focus:ring-2 focus:ring-cyan-500 focus:border-cyan-500 text-white font-exo backdrop-blur-sm"
placeholder="Enter your username"
required
>
</div>
<div>
<label class="block text-gray-300 font-exo font-medium mb-2">
<i class="fas fa-palette mr-2 text-cyan-400"></i>THEME
</label>
<div class="grid grid-cols-3 gap-3">
<label class="flex items-center bg-gray-900/50 p-3 rounded-lg cursor-pointer hover:bg-gray-800/70 border border-cyan-500/20 transition-all">
<input type="radio" name="theme" value="default" class="mr-2 accent-cyan-500" checked>
<span class="font-exo">DEFAULT</span>
</label>
<label class="flex items-center bg-gray-900/50 p-3 rounded-lg cursor-pointer hover:bg-gray-800/70 border border-purple-500/20 transition-all">
<input type="radio" name="theme" value="dark" class="mr-2 accent-purple-500">
<span class="font-exo">DARK</span>
</label>
<label class="flex items-center bg-gray-900/50 p-3 rounded-lg cursor-pointer hover:bg-gray-800/70 border border-pink-500/20 transition-all">
<input type="radio" name="theme" value="neon" class="mr-2 accent-pink-500">
<span class="font-exo">NEON</span>
</label>
</div>
</div>
<div>
<label class="block text-gray-300 font-exo font-medium mb-2">
<i class="fas fa-bell mr-2 text-cyan-400"></i>NOTIFICATIONS
</label>
<div class="flex items-center">
<label class="flex items-center bg-gray-900/50 p-3 rounded-lg cursor-pointer hover:bg-gray-800/70 border border-cyan-500/20 transition-all mr-4">
<input type="checkbox" id="notifications" class="mr-2 accent-cyan-500">
<span class="font-exo">ENABLE NOTIFICATIONS</span>
</label>
</div>
</div>
<button
type="submit"
class="w-full bg-gradient-to-r from-cyan-600 to-purple-600 hover:from-cyan-500 hover:to-purple-500 text-white font-exo font-bold py-3 px-4 rounded-xl transition-all duration-300"
>
<i class="fas fa-save mr-2"></i>SAVE SETTINGS
</button>
</form>
<div class="mt-8 pt-6 border-t border-gray-700">
<h4 class="font-exo font-bold text-lg text-red-400 mb-3">DANGER ZONE</h4>
<button
id="reset-data"
class="w-full bg-gradient-to-r from-red-600 to-orange-600 hover:from-red-500 hover:to-orange-500 text-white font-exo font-bold py-3 px-4 rounded-xl transition-all duration-300"
>
<i class="fas fa-trash mr-2"></i>RESET ALL DATA
</button>
</div>
</div>
</div>
</div>
<!-- History Content -->
<div id="history-content" class="hidden">
<div class="bg-gradient-to-r from-gray-800/50 to-gray-900/50 backdrop-blur-lg border border-cyan-500/30 rounded-2xl shadow-2xl p-6 relative overflow-hidden">
<div class="absolute inset-0 bg-gradient-to-r from-cyan-500/5 to-purple-500/5"></div>
<div class="relative z-10">
<h3 class="text-2xl font-exo font-bold text-gray-200 mb-6">QUANTUM HISTORY</h3>
<div id="history-list" class="space-y-3">
<p class="text-gray-400 text-center py-8">No quantum predictions in the temporal archive</p>
</div>
</div>
</div>
</div>
<!-- How to Use Content -->
<div id="howto-content" class="hidden">
<div class="bg-gradient-to-r from-gray-800/50 to-gray-900/50 backdrop-blur-lg border border-cyan-500/30 rounded-2xl shadow-2xl p-6 relative overflow-hidden">
<div class="absolute inset-0 bg-gradient-to-r from-cyan-500/5 to-purple-500/5"></div>
<div class="relative z-10">
<h3 class="text-2xl font-exo font-bold text-gray-200 mb-6">HOW TO USE MR. FLEN'S STOCK PREDICTION GAME</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-gray-900/50 p-5 rounded-xl border border-cyan-500/20">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-gradient-to-r from-cyan-500 to-purple-500 rounded-full flex items-center justify-center mr-3">
<i class="fas fa-1"></i>
</div>
<h4 class="font-exo font-bold text-xl text-cyan-400">SET UP YOUR PROFILE</h4>
</div>
<ul class="space-y-2 text-gray-300">
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Click the SETTINGS tab to create your username</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Customize your experience with themes</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Your data is stored locally on your device</span>
</li>
</ul>
</div>
<div class="bg-gray-900/50 p-5 rounded-xl border border-cyan-500/20">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-gradient-to-r from-cyan-500 to-purple-500 rounded-full flex items-center justify-center mr-3">
<i class="fas fa-2"></i>
</div>
<h4 class="font-exo font-bold text-xl text-cyan-400">MAKE PREDICTIONS</h4>
</div>
<ul class="space-y-2 text-gray-300">
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Enter a stock symbol (e.g., AAPL, GOOGL, TSLA)</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Click SCAN to view stock details and chart</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Choose prediction period (Today or Week)</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Select UP or DOWN prediction (or let system assign random)</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Click LAUNCH PREDICTION (only when market is closed)</span>
</li>
</ul>
</div>
<div class="bg-gray-900/50 p-5 rounded-xl border border-cyan-500/20">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-gradient-to-r from-cyan-500 to-purple-500 rounded-full flex items-center justify-center mr-3">
<i class="fas fa-3"></i>
</div>
<h4 class="font-exo font-bold text-xl text-cyan-400">RESOLVE PREDICTIONS</h4>
</div>
<ul class="space-y-2 text-gray-300">
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>When prediction date arrives, click RESOLVE</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Enter the opening and closing prices</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>System calculates points using two scoring systems:</span>
</li>
<li class="flex items-start ml-6">
<i class="fas fa-circle text-cyan-400 mt-1 mr-2 text-xs"></i>
<span><strong>System 1:</strong> +1 for correct, -1 for incorrect</span>
</li>
<li class="flex items-start ml-6">
<i class="fas fa-circle text-purple-400 mt-1 mr-2 text-xs"></i>
<span><strong>System 2:</strong> ±1 pt per 1% change in predicted direction</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>View results in HISTORY tab</span>
</li>
</ul>
</div>
<div class="bg-gray-900/50 p-5 rounded-xl border border-cyan-500/20">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-gradient-to-r from-cyan-500 to-purple-500 rounded-full flex items-center justify-center mr-3">
<i class="fas fa-4"></i>
</div>
<h4 class="font-exo font-bold text-xl text-cyan-400">COMPETE IN LEAGUE</h4>
</div>
<ul class="space-y-2 text-gray-300">
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Share your data with friends using COPY button</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Paste friends' data using IMPORT feature</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>View global leaderboard in LEAGUE tab</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-400 mt-1 mr-2"></i>
<span>Compete for the top spot in both scoring systems!</span>
</li>
</ul>
</div>
</div>
<div class="mt-8 bg-gradient-to-r from-purple-900/50 to-pink-900/50 p-5 rounded-xl border border-purple-500/30">
<h4 class="font-exo font-bold text-lg text-purple-400 mb-3">IMPORTANT RULES</h4>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<p class="text-gray-300 mb-2"><i class="fas fa-exclamation-triangle text-yellow-400 mr-2"></i> Predictions can only be made when the market is closed</p>
<p class="text-gray-300 mb-2"><i class="fas fa-exclamation-triangle text-yellow-400 mr-2"></i> US Market hours: 9:30 AM - 4:00 PM ET (Mon-Fri)</p>
</div>
<div>
<p class="text-gray-300 mb-2"><i class="fas fa-exclamation-triangle text-yellow-400 mr-2"></i> If no prediction selected, system assigns random UP/DOWN</p>
<p class="text-gray-300"><i class="fas fa-exclamation-triangle text-yellow-400 mr-2"></i> All data is stored locally on your device</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Navigation Tabs -->
<div class="flex border-b border-gray-700 mt-8">
<button id="dashboard-tab" class="tab-btn active px-5 py-3 font-exo font-bold border-b-2 border-cyan-400 text-cyan-400 bg-gray-800/30 backdrop-blur-sm">DASHBOARD</button>
<button id="history-tab" class="tab-btn px-5 py-3 font-exo font-bold text-gray-400 hover:text-cyan-300">HISTORY</button>
<button id="howto-tab" class="tab-btn px-5 py-3 font-exo font-bold text-gray-400 hover:text-cyan-300">HOW TO USE</button>
</div>
</div>
<!-- Resolve Modal -->
<div id="resolve-modal" class="fixed inset-0 bg-black/80 backdrop-blur-lg flex items-center justify-center hidden z-50">
<div class="bg-gradient-to-br from-gray-800 to-gray-900 border border-cyan-500/30 rounded-2xl shadow-2xl p-6 w-full max-w-md relative overflow-hidden">
<div class="absolute inset-0 bg-gradient-to-r from-cyan-500/5 to-purple-500/5"></div>
<div class="relative z-10">
<h3 class="text-xl font-exo font-bold text-gray-200 mb-4 text-center">QUANTUM RESOLUTION</h3>
<div id="resolve-prediction-details" class="mb-4"></div>
<form id="resolve-form">
<div class="mb-4">
<label class="block text-gray-300 font-exo font-medium mb-2" for="open-price">OPEN PRICE</label>
<input
type="number"
id="open-price"
step="0.01"
min="0"
class="w-full px-3 py-2 bg-gray-900/70 border border-cyan-500/30 rounded-lg focus:ring-2 focus:ring-cyan-500 focus:border-cyan-500 text-white font-exo backdrop-blur-sm"
required
>
</div>
<div class="mb-5">
<label class="block text-gray-300 font-exo font-medium mb-2" for="close-price">CLOSE PRICE</label>
<input
type="number"
id="close-price"
step="0.01"
min="0"
class="w-full px-3 py-2 bg-gray-900/70 border border-cyan-500/30 rounded-lg focus:ring-2 focus:ring-cyan-500 focus:border-cyan-500 text-white font-exo backdrop-blur-sm"
required
>
</div>
<div class="flex justify-end space-x-3">
<button
type="button"
id="cancel-resolve"
class="px-4 py-2 bg-gray-700 hover:bg-gray-600 text-gray-300 font-exo font-bold rounded-lg transition-all"
>
CANCEL
</button>
<button
type="submit"
class="px-4 py-2 bg-gradient-to-r from-green-600 to-cyan-600 hover:from-green-500 hover:to-cyan-500 text-white font-exo font-bold rounded-lg transition-all"
>
RESOLVE
</button>
</div>
</form>
</div>
</div>
</div>
<style>
body {
font-family: 'Exo 2', sans-serif;
}
.font-orbitron {
font-family: 'Orbitron', sans-serif;
}
.font-exo {
font-family: 'Exo 2', sans-serif;
}
</style>
<script>
// Data storage
let predictions = JSON.parse(localStorage.getItem('stockPredictions')) || [];
let users = JSON.parse(localStorage.getItem('predictionUsers')) || {};
let currentUser = localStorage.getItem('currentPredictionUser') || 'Guest User';
let currentResolveId = null;
// DOM Elements
const dashboardTab = document.getElementById('dashboard-tab');
const historyTab = document.getElementById('history-tab');
const howtoTab = document.getElementById('howto-tab');
const leagueTab = document.getElementById('league-tab');
const settingsTab = document.getElementById('settings-tab');
const dashboardContent = document.getElementById('dashboard-content');
const historyContent = document.getElementById('history-content');
const howtoContent = document.getElementById('howto-content');
const leagueContent = document.getElementById('league-content');
const settingsContent = document.getElementById('settings-content');
const mainContent = document.getElementById('main-content');
const predictionForm = document.getElementById('prediction-form');
const resolveModal = document.getElementById('resolve-modal');
const resolveForm = document.getElementById('resolve-form');
const cancelResolve = document.getElementById('cancel-resolve');
const marketStatusText = document.getElementById('market-status-text');
const marketStatusIcon = document.getElementById('market-status-icon');
const predictionFormContainer = document.getElementById('prediction-form-container');
const checkSymbolBtn = document.getElementById('check-symbol');
const stockDetails = document.getElementById('stock-details');
const closeDetailsBtn = document.getElementById('close-details');
const marketProgress = document.getElementById('market-progress');
const currentUserElement = document.getElementById('current-user');
const userPointsS1Element = document.getElementById('user-points-s1');
const userPointsS2Element = document.getElementById('user-points-s2');
const refreshLeaderboard = document.getElementById('refresh-leaderboard');
const importUserData = document.getElementById('import-user-data');
const importData = document.getElementById('import-data');
const exportData = document.getElementById('export-data');
const copyData = document.getElementById('copy-data');
const userSettingsForm = document.getElementById('user-settings-form');
const resetData = document.getElementById('reset-data');
// Tab switching
function showTab(tabName) {
// Hide all content
dashboardContent.classList.add('hidden');
historyContent.classList.add('hidden');
howtoContent.classList.add('hidden');
leagueContent.classList.add('hidden');
settingsContent.classList.add('hidden');
// Remove active class from all tabs
dashboardTab.classList.remove('active', 'text-cyan-400', 'border-cyan-400');
historyTab.classList.remove('active', 'text-cyan-400', 'border-cyan-400');
howtoTab.classList.remove('active', 'text-cyan-400', 'border-cyan-400');
leagueTab.classList.remove('active', 'text-cyan-400', 'border-cyan-400');
settingsTab.classList.remove('active', 'text-cyan-400', 'border-cyan-400');
// Show selected content and activate tab
if (tabName === 'dashboard') {
dashboardContent.classList.remove('hidden');
dashboardTab.classList.add('active', 'text-cyan-400', 'border-cyan-400');
} else if (tabName === 'history') {
historyContent.classList.remove('hidden');
historyTab.classList.add('active', 'text-cyan-400', 'border-cyan-400');
renderHistory();
} else if (tabName === 'howto') {
howtoContent.classList.remove('hidden');
howtoTab.classList.add('active', 'text-cyan-400', 'border-cyan-400');
} else if (tabName === 'league') {
leagueContent.classList.remove('hidden');
leagueTab.classList.add('active', 'text-cyan-400', 'border-cyan-400');
updateExportData();
renderLeaderboard();
} else if (tabName === 'settings') {
settingsContent.classList.remove('hidden');
settingsTab.classList.add('active', 'text-cyan-400', 'border-cyan-400');
// Populate settings form
document.getElementById('username').value = currentUser;
}
}
dashboardTab.addEventListener('click', () => showTab('dashboard'));
historyTab.addEventListener('click', () => showTab('history'));
howtoTab.addEventListener('click', () => showTab('howto'));
leagueTab.addEventListener('click', () => showTab('league'));
settingsTab.addEventListener('click', () => showTab('settings'));
// Market time functions
function isMarketOpen() {
const now = new Date();
const options = {
timeZone: 'America/New_York',
hour: '2-digit',
minute: '2-digit',
hour12: false,
weekday: 'long'
};
const nyTimeString = now.toLocaleTimeString('en-US', { ...options, hour: 'numeric', minute: 'numeric' });
const nyWeekday = now.toLocaleDateString('en-US', { timeZone: 'America/New_York', weekday: 'long' });
// Parse time
const [hours, minutes] = nyTimeString.split(':').map(Number);
const totalMinutes = hours * 60 + minutes;
// Check if weekend
const isWeekend = nyWeekday === 'Saturday' || nyWeekday === 'Sunday';
// Market hours: 9:30 AM to 4:00 PM ET
const marketOpenMinute = 9 * 60 + 30; // 9:30 AM
const marketCloseMinute = 16 * 60; // 4:00 PM
return !isWeekend && totalMinutes >= marketOpenMinute && totalMinutes < marketCloseMinute;
}
function updateMarketStatus() {
const isOpen = isMarketOpen();
if (isOpen) {
marketStatusText.textContent = 'QUANTUM MARKET IS ACTIVE';
marketStatusIcon.innerHTML = '<i class="fas fa-circle text-green-500 animate-pulse"></i>';
predictionFormContainer.classList.add('opacity-70', 'pointer-events-none');
marketProgress.style.width = '100%';
} else {
marketStatusText.textContent = 'QUANTUM MARKET IS DORMANT';
marketStatusIcon.innerHTML = '<i class="fas fa-circle text-red-500"></i>';
predictionFormContainer.classList.remove('opacity-70', 'pointer-events-none');
marketProgress.style.width = '30%';
}
}
// Date utility functions
function formatDate(date) {
return date.toLocaleDateString('en-US', {
weekday: 'short',
year: 'numeric',
month: 'short',
day: 'numeric'
});
}
function formatToYYYYMMDD(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
function getNextMarketDay() {
const now = new Date();
let date = new Date(now);
date.setDate(date.getDate() + 1);
// Skip weekends
while (date.getDay() === 0 || date.getDay() === 6) {
date.setDate(date.getDate() + 1);
}
return date;
}
function getNextFriday() {
const now = new Date();
let date = new Date(now);
const daysUntilFriday = (5 - date.getDay() + 7) % 7;
if (daysUntilFriday === 0) {
// If today is Friday, go to next Friday
date.setDate(date.getDate() + 7);
} else {
date.setDate(date.getDate() + daysUntilFriday);
}
return date;
}
// Scoring functions
function calculateSystem1Points(predictions) {
return predictions
.filter(p => p.status === 'resolved')
.reduce((total, prediction) => {
const actual = prediction.closePrice > prediction.openPrice ? 'up' : 'down';
return total + (prediction.prediction === actual ? 1 : -1);
}, 0);
}
function calculateSystem2Points(predictions) {
return predictions
.filter(p => p.status === 'resolved')
.reduce((total, prediction) => {
const actualChange = ((prediction.closePrice - prediction.openPrice) / prediction.openPrice) * 100;
if (prediction.prediction === 'up') {
return total + actualChange; // + points for % increase, - points for % decrease
} else {
return total - actualChange; // + points for % decrease, - points for % increase
}
}, 0);
}
// User management
function updateCurrentUser() {
currentUserElement.textContent = currentUser;
renderPoints();
}
function renderPoints() {
const userPredictions = predictions.filter(p => p.user === currentUser);
const pointsS1 = Math.round(calculateSystem1Points(userPredictions));
const pointsS2 = Math.round(calculateSystem2Points(userPredictions));
userPointsS1Element.textContent = pointsS1;
userPointsS2Element.textContent = pointsS2;
}
// Stock data simulation
function getStockData(symbol) {
const stockExchanges = [
{ name: 'New York Stock Exchange', code: 'NYSE' },
{ name: 'London Stock Exchange', code: 'LSE' },
{ name: 'NASDAQ', code: 'NASDAQ' },
{ name: 'Tokyo Stock Exchange', code: 'TSE' },
{ name: 'Euronext', code: 'EURONEXT' }
];
const sectors = [
'Technology', 'Consumer Goods', 'Financial', 'Healthcare',
'Energy', 'Industrial', 'Utilities', 'Telecommunications',
'Automotive', 'Aerospace', 'Pharmaceutical', 'Retail'
];
const randomExchange = stockExchanges[Math.floor(Math.random() * stockExchanges.length)];
const randomSector = sectors[Math.floor(Math.random() * sectors.length)];
const basePrice = Math.random() * 300 + 20;
const change = (Math.random() - 0.5) * 10;
const changePercent = (change / basePrice) * 100;
return {
symbol: symbol.toUpperCase(),
name: `${symbol.toUpperCase()} Quantum Corporation`,
exchange: randomExchange.name,
exchangeCode: randomExchange.code,
sector: randomSector,
price: parseFloat(basePrice.toFixed(2)),
change: parseFloat(change.toFixed(2)),
changePercent: parseFloat(changePercent.toFixed(2)),
marketCap: (Math.random() * 2000 + 100).toFixed(1) + 'B',
volume: (Math.random() * 50 + 1).toFixed(1) + 'M',
peRatio: (Math.random() * 30 + 5).toFixed(1),
dividendYield: (Math.random() * 5).toFixed(2) + '%'
};
}
function renderStockDetails(symbol) {
const stock = getStockData(symbol);
const stockInfo = document.getElementById('stock-info');
stockInfo.innerHTML = `
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-gray-900/50 p-3 rounded-lg border border-cyan-500/20">
<h5 class="font-exo font-bold text-cyan-400 mb-1">${stock.name}</h5>
<div class="text-gray-400 text-sm mb-1">${stock.exchange} (${stock.exchangeCode})</div>
<div class="text-xl font-orbitron font-bold mt-2 text-white">$${stock.price.toFixed(2)}</div>
<div class="mt-1 text-sm ${stock.change >= 0 ? 'text-green-400' : 'text-red-400'}">
${stock.change >= 0 ? '+' : ''}${stock.change.toFixed(2)} (${stock.change >= 0 ? '+' : ''}${stock.changePercent.toFixed(2)}%)
</div>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="bg-gray-900/50 p-2 rounded-lg border border-purple-500/20">
<div class="text-gray-400 text-xs">SECTOR</div>
<div class="font-exo font-bold text-purple-400 text-sm">${stock.sector}</div>
</div>
<div class="bg-gray-900/50 p-2 rounded-lg border border-purple-500/20">
<div class="text-gray-400 text-xs">P/E RATIO</div>
<div class="font-exo font-bold text-purple-400 text-sm">${stock.peRatio}</div>
</div>
<div class="bg-gray-900/50 p-2 rounded-lg border border-purple-500/20">
<div class="text-gray-400 text-xs">MARKET CAP</div>
<div class="font-exo font-bold text-purple-400 text-sm">${stock.marketCap}</div>
</div>
<div class="bg-gray-900/50 p-2 rounded-lg border border-purple-500/20">
<div class="text-gray-400 text-xs">DIVIDEND</div>
<div class="font-exo font-bold text-purple-400 text-sm">${stock.dividendYield}</div>
</div>
</div>
</div>
`;
renderStockChart(stock.symbol);
stockDetails.classList.remove('hidden');
}
function renderStockChart(symbol) {
const chartContainer = document.getElementById('stock-chart');
const dataPoints = 20;
const basePrice = 100 + Math.random() * 200;
const prices = [];
let currentPrice = basePrice;
for (let i = 0; i < dataPoints; i++) {
const change = (Math.random() - 0.5) * 10;
currentPrice += change;
prices.push(parseFloat(currentPrice.toFixed(2)));
}
const minPrice = Math.min(...prices);
const maxPrice = Math.max(...prices);
const priceRange = maxPrice - minPrice;
const bars = prices.map((price, index) => {
const height = ((price - minPrice) / priceRange) * 80 + 10;
const isUp = index === 0 ? true : prices[index] >= prices[index - 1];
return `<div class="flex-1 mx-px bg-gradient-to-t from-${isUp ? 'green' : 'red'}-600 to-${isUp ? 'green' : 'red'}-400 rounded-t" style="height: ${height}%"></div>`;
}).join('');
chartContainer.innerHTML = `
<div class="flex items-end h-32 border-b border-l border-gray-700 p-2">
${bars}
</div>
<div class="flex justify-between text-xs text-gray-500 mt-2 px-2">
<span>20 DAYS AGO</span>
<span>TODAY</span>
</div>
<div class="text-center text-xs text-gray-500 mt-2">QUANTUM PRICE MOVEMENT - ${symbol}</div>
`;
}
// Render functions
function renderPendingPredictions() {
const pendingPredictions = predictions.filter(p => p.status === 'pending' && p.user === currentUser);
const container = document.getElementById('pending-predictions-list');
if (pendingPredictions.length === 0) {
container.innerHTML = '<p class="text-gray-400 text-center py-8">No pending quantum predictions in the system</p>';
return;
}
container.innerHTML = pendingPredictions.map(prediction => {
const targetDate = new Date(prediction.targetDate);
const isPast = targetDate <= new Date();
const isUp = prediction.prediction === 'up';
return `
<div class="border border-cyan-500/20 rounded-xl p-4 hover:border-cyan-500/40 transition-all bg-gray-900/30 backdrop-blur-sm">
<div class="flex justify-between items-start">
<div>
<div class="flex items-center">
<span class="font-exo font-bold text-cyan-400">${prediction.symbol}</span>
<span class="ml-2 px-2 py-1 bg-gradient-to-r from-purple-600/50 to-pink-600/50 text-purple-300 text-xs font-exo font-bold rounded-full border border-purple-500/30">
${prediction.period === 'day' ? 'TODAY' : 'WEEK'}
</span>
</div>
<div class="mt-2 flex items-center">
<span class="mr-3 text-sm ${isUp ? 'text-green-400' : 'text-red-400'}">
<i class="fas fa-arrow-${prediction.prediction} mr-1"></i>
${prediction.prediction.toUpperCase()}
</span>
<span class="text-gray-400 text-xs">
<i class="far fa-calendar mr-1"></i>
${formatDate(targetDate)}
</span>
</div>
</div>
${isPast ? `
<button
class="resolve-btn px-3 py-1 bg-gradient-to-r from-cyan-600 to-purple-600 hover:from-cyan-500 hover:to-purple-500 text-white font-exo font-bold rounded-lg transition-all text-xs"
data-id="${prediction.id}"
>
RESOLVE
</button>
` : `
<span class="px-3 py-1 bg-gradient-to-r from-yellow-600/50 to-orange-600/50 text-yellow-300 font-exo font-bold rounded-lg border border-yellow-500/30 text-xs">
PENDING
</span>
`}
</div>
</div>
`;
}).join('');
document.querySelectorAll('.resolve-btn').forEach(button => {
button.addEventListener('click', (e) => {
const id = parseInt(e.target.dataset.id);
openResolveModal(id);
});
});
}
function renderHistory() {
const resolvedPredictions = predictions.filter(p => p.status === 'resolved' && p.user === currentUser);
const container = document.getElementById('history-list');
if (resolvedPredictions.length === 0) {
container.innerHTML = '<p class="text-gray-400 text-center py-8">No quantum predictions in the temporal archive</p>';
return;
}
container.innerHTML = resolvedPredictions.map(prediction => {
const actual = prediction.closePrice > prediction.openPrice ? 'up' : 'down';
const isCorrect = prediction.prediction === actual;
const actualChange = ((prediction.closePrice - prediction.openPrice) / prediction.openPrice) * 100;
const system1Points = isCorrect ? 1 : -1;
const system2Points = prediction.prediction === 'up' ? actualChange : -actualChange;
return `
<div class="border border-cyan-500/20 rounded-xl p-4 hover:border-cyan-500/40 transition-all bg-gray-900/30 backdrop-blur-sm">
<div class="flex justify-between items-start">
<div>
<div class="flex items-center">
<span class="font-exo font-bold text-cyan-400">${prediction.symbol}</span>
<span class="ml-2 px-2 py-1 bg-gradient-to-r from-purple-600/50 to-pink-600/50 text-purple-300 text-xs font-exo font-bold rounded-full border border-purple-500/30">
${prediction.period === 'day' ? 'TODAY' : 'WEEK'}
</span>
</div>
<div class="mt-2 flex items-center">
<span class="mr-3">
<span class="text-gray-400 mr-1 text-xs">PREDICTED:</span>
<span class="${prediction.prediction === 'up' ? 'text-green-400' : 'text-red-400'}">
<i class="fas fa-arrow-${prediction.prediction} mr-1"></i>
${prediction.prediction.toUpperCase()}
</span>
</span>
<span>
<span class="text-gray-400 mr-1 text-xs">ACTUAL:</span>
<span class="${actual === 'up' ? 'text-green-400' : 'text-red-400'}">
<i class="fas fa-arrow-${actual} mr-1"></i>
${actual.toUpperCase()}
</span>
</span>
</div>
<div class="mt-2 text-xs text-gray-400">
<span class="mr-3">
<i class="fas fa-coins mr-1 text-yellow-400"></i>
OPEN: $${prediction.openPrice.toFixed(2)}
</span>
<span>
<i class="fas fa-chart-line mr-1 text-cyan-400"></i>
CLOSE: $${prediction.closePrice.toFixed(2)}
</span>
<span class="ml-3">
<i class="fas fa-percentage mr-1 text-purple-400"></i>
CHANGE: ${actualChange >= 0 ? '+' : ''}${actualChange.toFixed(2)}%
</span>
</div>
</div>
<div class="text-right">
<div class="text-xs text-gray-400 mb-1">S1: <span class="${system1Points >= 0 ? 'text-green-400' : 'text-red-400'}">${system1Points >= 0 ? '+' : ''}${system1Points}</span></div>
<div class="text-xs text-gray-400 mb-1">S2: <span class="${system2Points >= 0 ? 'text-green-400' : 'text-red-400'}">${system2Points >= 0 ? '+' : ''}${system2Points.toFixed(1)}</span></div>
<div class="text-xs text-gray-500 mt-1">
${formatDate(new Date(prediction.targetDate))}
</div>
</div>
</div>
</div>
`;
}).join('');
}
// League functions
function updateExportData() {
const userPredictions = predictions.filter(p => p.user === currentUser);
const userData = {
user: currentUser,
predictions: userPredictions,
pointsS1: Math.round(calculateSystem1Points(userPredictions)),
pointsS2: Math.round(calculateSystem2Points(userPredictions))
};
exportData.value = JSON.stringify(userData);
}
function importUserDataFromText() {
try {
const data = JSON.parse(importData.value);
if (data.user && data.predictions && Array.isArray(data.predictions)) {
// Add user to users object
users[data.user] = {
predictions: data.predictions,
pointsS1: data.pointsS1 || 0,
pointsS2: data.pointsS2 || 0
};
// Save to localStorage
localStorage.setItem('predictionUsers', JSON.stringify(users));
// Clear import field
importData.value = '';
// Refresh leaderboard
renderLeaderboard();
alert(`Successfully imported data for user: ${data.user}`);
} else {
throw new Error('Invalid data format');
}
} catch (error) {
alert('Invalid data format. Please check the imported text.');
}
}
function renderLeaderboard() {
// Get all users including current user
const allUsers = {...users};
const currentUserPredictions = predictions.filter(p => p.user === currentUser);
allUsers[currentUser] = {
predictions: currentUserPredictions,
pointsS1: Math.round(calculateSystem1Points(currentUserPredictions)),
pointsS2: Math.round(calculateSystem2Points(currentUserPredictions))
};
// Convert to array and sort by points
const userList = Object.entries(allUsers)
.map(([username, userData]) => ({
username,
pointsS1: userData.pointsS1 || 0,
pointsS2: userData.pointsS2 || 0,
predictionCount: userData.predictions ? userData.predictions.length : 0
}))
.sort((a, b) => b.pointsS1 - a.pointsS1); // Sort by System 1 points
const container = document.getElementById('leaderboard');
if (userList.length === 0) {
container.innerHTML = '<p class="text-gray-400 text-center py-8">No league data available. Import user data to see rankings.</p>';
return;
}
container.innerHTML = `
<div class="bg-gray-900/50 rounded-lg overflow-hidden">
<div class="grid grid-cols-12 bg-gray-800/50 px-4 py-2 font-exo font-bold text-gray-300 text-sm">
<div class="col-span-1">RANK</div>
<div class="col-span-4">USER</div>
<div class="col-span-2 text-center">S1 POINTS</div>
<div class="col-span-2 text-center">S2 POINTS</div>
<div class="col-span-2 text-center">PREDICTIONS</div>
</div>
${userList.map((user, index) => `
<div class="grid grid-cols-12 px-4 py-3 border-b border-gray-700/50 hover:bg-gray-800/30 transition-all ${user.username === currentUser ? 'bg-cyan-900/20' : ''}">
<div class="col-span-1 flex items-center">
${index === 0 ? '<i class="fas fa-crown text-yellow-400 mr-1"></i>' :
index === 1 ? '<i class="fas fa-medal text-gray-300 mr-1"></i>' :
index === 2 ? '<i class="fas fa-medal text-amber-600 mr-1"></i>' :
`${index + 1}`}
</div>
<div class="col-span-4 font-exo font-bold ${user.username === currentUser ? 'text-cyan-400' : 'text-gray-300'}">
${user.username}
${user.username === currentUser ? '<i class="fas fa-user ml-2 text-cyan-400"></i>' : ''}
</div>
<div class="col-span-2 text-center font-orbitron font-bold ${user.pointsS1 >= 0 ? 'text-green-400' : 'text-red-400'}">
${user.pointsS1 >= 0 ? '+' : ''}${user.pointsS1}
</div>
<div class="col-span-2 text-center font-orbitron font-bold ${user.pointsS2 >= 0 ? 'text-green-400' : 'text-red-400'}">
${user.pointsS2 >= 0 ? '+' : ''}${Math.round(user.pointsS2)}
</div>
<div class="col-span-2 text-center text-gray-400">
${user.predictionCount}
</div>
</div>
`).join('')}
</div>
`;
}
// Modal functions
function openResolveModal(id) {
const prediction = predictions.find(p => p.id === id);
if (!prediction) return;
currentResolveId = id;
const targetDate = new Date(prediction.targetDate);
document.getElementById('resolve-prediction-details').innerHTML = `
<div class="bg-gray-900/50 p-4 rounded-lg border border-cyan-500/20 mb-4">
<div class="font-exo font-bold text-cyan-400">${prediction.symbol}</div>
<div class="text-gray-400 text-sm mt-1">
Predicted ${prediction.prediction.toUpperCase()} for ${prediction.period === 'day' ? 'today' : 'this week'}
</div>
<div class="text-gray-400 text-xs mt-1">
Target Date: ${formatDate(targetDate)}
</div>
</div>
`;
document.getElementById('open-price').value = '';
document.getElementById('close-price').value = '';
resolveModal.classList.remove('hidden');
}
function closeResolveModal() {
resolveModal.classList.add('hidden');
currentResolveId = null;
}
// Event Listeners
checkSymbolBtn.addEventListener('click', () => {
const symbol = document.getElementById('symbol').value.trim();
if (symbol) {
const chartContainer = document.getElementById('stock-chart');
chartContainer.innerHTML = `
<div class="text-center text-gray-500 py-8">
<i class="fas fa-spinner fa-spin text-2xl mb-2"></i>
<p>SCANNING QUANTUM DATABASE FOR ${symbol.toUpperCase()}...</p>
</div>
`;
stockDetails.classList.remove('hidden');
setTimeout(() => {
renderStockDetails(symbol);
}, 800);
} else {
alert('Please enter a stock symbol');
}
});
closeDetailsBtn.addEventListener('click', () => {
stockDetails.classList.add('hidden');
});
predictionForm.addEventListener('submit', (e) => {
e.preventDefault();
const symbol = document.getElementById('symbol').value.toUpperCase().trim();
const period = document.querySelector('input[name="period"]:checked').value;
const predictionElement = document.querySelector('input[name="prediction"]:checked');
let prediction = predictionElement ? predictionElement.value : null;
// If no prediction selected, assign random
if (!prediction) {
prediction = Math.random() > 0.5 ? 'up' : 'down';
alert(`No prediction selected. System assigned: ${prediction.toUpperCase()}`);
}
if (!symbol) return;
const targetDate = period === 'day' ? getNextMarketDay() : getNextFriday();
const newPrediction = {
id: Date.now(),
symbol,
prediction,
period,
madeAt: new Date().toISOString(),
targetDate: formatToYYYYMMDD(targetDate),
openPrice: null,
closePrice: null,
status: 'pending',
user: currentUser
};
predictions.push(newPrediction);
localStorage.setItem('stockPredictions', JSON.stringify(predictions));
predictionForm.reset();
document.querySelector('input[name="period"][value="day"]').checked = true;
stockDetails.classList.add('hidden');
renderPoints();
renderPendingPredictions();
alert(`Quantum prediction launched for ${symbol} - ${prediction.toUpperCase()} ${period === 'day' ? 'today' : 'this week'}!`);
});
resolveForm.addEventListener('submit', (e) => {
e.preventDefault();
const openPrice = parseFloat(document.getElementById('open-price').value);
const closePrice = parseFloat(document.getElementById('close-price').value);
if (isNaN(openPrice) || isNaN(closePrice) || openPrice <= 0 || closePrice <= 0) {
alert('Please enter valid prices');
return;
}
const predictionIndex = predictions.findIndex(p => p.id === currentResolveId);
if (predictionIndex !== -1) {
predictions[predictionIndex].openPrice = openPrice;
predictions[predictionIndex].closePrice = closePrice;
predictions[predictionIndex].status = 'resolved';
localStorage.setItem('stockPredictions', JSON.stringify(predictions));
renderPoints();
renderPendingPredictions();
renderHistory();
closeResolveModal();
const actual = closePrice > openPrice ? 'up' : 'down';
const isCorrect = predictions[predictionIndex].prediction === actual;
const actualChange = ((closePrice - openPrice) / openPrice) * 100;
const system1Points = isCorrect ? 1 : -1;
const system2Points = predictions[predictionIndex].prediction === 'up' ? actualChange : -actualChange;
alert(`Prediction resolved!\nActual movement: ${actual.toUpperCase()}\nChange: ${actualChange >= 0 ? '+' : ''}${actualChange.toFixed(2)}%\n\nSystem 1 Points: ${system1Points >= 0 ? '+' : ''}${system1Points}\nSystem 2 Points: ${system2Points >= 0 ? '+' : ''}${system2Points.toFixed(1)}`);
}
});
cancelResolve.addEventListener('click', closeResolveModal);
refreshLeaderboard.addEventListener('click', () => {
renderLeaderboard();
alert('Leaderboard refreshed!');
});
importUserData.addEventListener('click', importUserDataFromText);
copyData.addEventListener('click', () => {
exportData.select();
document.execCommand('copy');
alert('Your data has been copied to clipboard. Share it with friends!');
});
userSettingsForm.addEventListener('submit', (e) => {
e.preventDefault();
const newUsername = document.getElementById('username').value.trim();
if (newUsername && newUsername !== currentUser) {
currentUser = newUsername;
localStorage.setItem('currentPredictionUser', currentUser);
updateCurrentUser();
updateExportData();
alert(`Username updated to: ${currentUser}`);
}
});
resetData.addEventListener('click', () => {
if (confirm('Are you sure you want to reset all data? This cannot be undone.')) {
predictions = predictions.filter(p => p.user !== currentUser);
localStorage.setItem('stockPredictions', JSON.stringify(predictions));
renderPoints();
renderPendingPredictions();
renderHistory();
renderLeaderboard();
alert('Your data has been reset.');
}
});
// Initialize
function init() {
updateMarketStatus();
updateCurrentUser();
renderPendingPredictions();
updateExportData();
setInterval(updateMarketStatus, 60000);
// Show dashboard by default
showTab('dashboard');
}
init();
</script>
</body>
</html> |