Spaces:
Running
Running
Download reading.html from RISEFinalYear/RISE: direct link, hf CLI and curl.
- Browser
- Download file 24.3 kB
-
https://huggingface.co/spaces/RISEFinalYear/RISE/resolve/refs%2Fpr%2F1/reading.html
- Command line
-
hf download hf://spaces/RISEFinalYear/RISE@refs/pr/1/reading.html
-
curl -L -o reading.html https://huggingface.co/spaces/RISEFinalYear/RISE/resolve/refs%2Fpr%2F1/reading.html
24.3 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Reading Practice - RISE</title> | |
| <link rel="stylesheet" href="style.css"> | |
| <style> | |
| /* ---------------------------------------------------------------- | |
| PAGE-SPECIFIC STYLES | |
| All colours and type follow style.css; these rules only handle | |
| layout and components that don't exist on other pages. | |
| ---------------------------------------------------------------- */ | |
| /* Hero */ | |
| .reading-hero { | |
| padding: 120px 5% 60px; | |
| text-align: center; | |
| max-width: 720px; | |
| margin: 0 auto; | |
| } | |
| .reading-hero h1 { | |
| font-size: clamp(2rem, 5vw, 3.2rem); | |
| line-height: 1.15; | |
| margin: 12px 0 20px; | |
| } | |
| .reading-hero p { | |
| font-size: 1.1rem; | |
| opacity: 0.75; | |
| max-width: 560px; | |
| margin: 0 auto 40px; | |
| line-height: 1.7; | |
| } | |
| /* Current level pill */ | |
| .current-pill { | |
| display: inline-flex; | |
| align-items: center; | |
| gap: 8px; | |
| background: rgba(255,255,255,0.07); | |
| border: 1px solid rgba(255,255,255,0.15); | |
| border-radius: 100px; | |
| padding: 8px 20px; | |
| font-size: 0.9rem; | |
| margin-bottom: 32px; | |
| } | |
| .current-pill .dot { | |
| width: 8px; | |
| height: 8px; | |
| border-radius: 50%; | |
| background: #7c6ff7; | |
| flex-shrink: 0; | |
| } | |
| /* ---------------------------------------------------------------- | |
| LEVELS GRID | |
| ---------------------------------------------------------------- */ | |
| .levels-section { | |
| padding: 20px 5% 80px; | |
| max-width: 1100px; | |
| margin: 0 auto; | |
| } | |
| .levels-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); | |
| gap: 24px; | |
| margin-top: 48px; | |
| } | |
| /* Each level card */ | |
| .level-card { | |
| border-radius: 16px; | |
| padding: 36px 32px; | |
| display: flex; | |
| flex-direction: column; | |
| gap: 16px; | |
| position: relative; | |
| overflow: hidden; | |
| transition: transform 0.2s, box-shadow 0.2s; | |
| cursor: pointer; | |
| border: 1px solid rgba(255,255,255,0.08); | |
| background: rgba(255,255,255,0.03); | |
| } | |
| .level-card:hover { | |
| transform: translateY(-4px); | |
| box-shadow: 0 16px 40px rgba(0,0,0,0.35); | |
| } | |
| /* Accent strip at the top of each card */ | |
| .level-card::before { | |
| content: ''; | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| right: 0; | |
| height: 3px; | |
| border-radius: 16px 16px 0 0; | |
| } | |
| .level-card.l1::before { background: #7c6ff7; } | |
| .level-card.l2::before { background: #56b0f5; } | |
| .level-card.l3::before { background: #4ecdc4; } | |
| .level-card.l4::before { background: #f5a623; } | |
| .level-card.l5::before { background: #f56565; } | |
| /* Number badge */ | |
| .level-badge { | |
| font-size: 0.75rem; | |
| font-weight: 700; | |
| letter-spacing: 0.08em; | |
| text-transform: uppercase; | |
| opacity: 0.5; | |
| } | |
| .level-card .level-icon { | |
| font-size: 2rem; | |
| line-height: 1; | |
| } | |
| .level-card h3 { | |
| font-size: 1.25rem; | |
| font-weight: 700; | |
| margin: 0; | |
| } | |
| .level-card .level-desc { | |
| font-size: 0.92rem; | |
| opacity: 0.65; | |
| line-height: 1.6; | |
| flex: 1; | |
| } | |
| /* Part pills inside each card */ | |
| .part-pills { | |
| display: flex; | |
| gap: 8px; | |
| flex-wrap: wrap; | |
| margin-top: 4px; | |
| } | |
| .part-pill { | |
| font-size: 0.75rem; | |
| font-weight: 600; | |
| padding: 4px 12px; | |
| border-radius: 100px; | |
| background: rgba(255,255,255,0.08); | |
| border: 1px solid rgba(255,255,255,0.12); | |
| opacity: 0.8; | |
| } | |
| /* Lock overlay for locked levels */ | |
| .level-card.locked { | |
| cursor: not-allowed; | |
| } | |
| .level-card.locked::after { | |
| content: 'π'; | |
| position: absolute; | |
| top: 20px; | |
| right: 20px; | |
| font-size: 1.1rem; | |
| opacity: 0.5; | |
| } | |
| .level-card.locked:hover { | |
| transform: none; | |
| box-shadow: none; | |
| } | |
| /* Active indicator for current level */ | |
| .level-card.active-level { | |
| border-color: rgba(124, 111, 247, 0.4); | |
| background: rgba(124, 111, 247, 0.05); | |
| } | |
| .active-badge { | |
| display: inline-block; | |
| font-size: 0.7rem; | |
| font-weight: 700; | |
| letter-spacing: 0.06em; | |
| text-transform: uppercase; | |
| background: rgba(124,111,247,0.2); | |
| border: 1px solid rgba(124,111,247,0.4); | |
| color: #a99ff7; | |
| padding: 3px 10px; | |
| border-radius: 100px; | |
| margin-top: -4px; | |
| } | |
| .level-card .start-btn { | |
| margin-top: 8px; | |
| display: inline-block; | |
| padding: 12px 24px; | |
| border-radius: 8px; | |
| font-size: 0.9rem; | |
| font-weight: 600; | |
| text-align: center; | |
| cursor: pointer; | |
| border: none; | |
| transition: opacity 0.15s; | |
| text-decoration: none; | |
| } | |
| .level-card.locked .start-btn { | |
| background: rgba(255,255,255,0.06); | |
| color: rgba(255,255,255,0.35); | |
| cursor: not-allowed; | |
| } | |
| .level-card:not(.locked) .start-btn { | |
| background: #7c6ff7; | |
| color: #fff; | |
| } | |
| .level-card:not(.locked) .start-btn:hover { | |
| opacity: 0.88; | |
| } | |
| /* ---------------------------------------------------------------- | |
| HOW THE LEVELS WORK β info strip | |
| ---------------------------------------------------------------- */ | |
| .how-levels-section { | |
| padding: 60px 5%; | |
| border-top: 1px solid rgba(255,255,255,0.07); | |
| border-bottom: 1px solid rgba(255,255,255,0.07); | |
| background: rgba(255,255,255,0.02); | |
| } | |
| .how-levels-inner { | |
| max-width: 1000px; | |
| margin: 0 auto; | |
| } | |
| .how-levels-steps { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); | |
| gap: 32px; | |
| margin-top: 48px; | |
| } | |
| .how-step { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 12px; | |
| } | |
| .how-step-icon { | |
| font-size: 1.6rem; | |
| } | |
| .how-step h4 { | |
| font-size: 1rem; | |
| font-weight: 700; | |
| margin: 0; | |
| } | |
| .how-step p { | |
| font-size: 0.88rem; | |
| opacity: 0.6; | |
| line-height: 1.6; | |
| margin: 0; | |
| } | |
| /* ---------------------------------------------------------------- | |
| GESTURE GUIDE | |
| ---------------------------------------------------------------- */ | |
| .gesture-section { | |
| padding: 70px 5%; | |
| max-width: 900px; | |
| margin: 0 auto; | |
| } | |
| .gesture-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); | |
| gap: 20px; | |
| margin-top: 40px; | |
| } | |
| .gesture-card { | |
| background: rgba(255,255,255,0.03); | |
| border: 1px solid rgba(255,255,255,0.08); | |
| border-radius: 12px; | |
| padding: 24px 20px; | |
| text-align: center; | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| gap: 10px; | |
| } | |
| .gesture-emoji { | |
| font-size: 2rem; | |
| } | |
| .gesture-label { | |
| font-size: 0.8rem; | |
| font-weight: 700; | |
| letter-spacing: 0.04em; | |
| text-transform: uppercase; | |
| opacity: 0.45; | |
| } | |
| .gesture-action { | |
| font-size: 0.9rem; | |
| font-weight: 600; | |
| margin: 0; | |
| } | |
| .gesture-card p { | |
| font-size: 0.8rem; | |
| opacity: 0.55; | |
| line-height: 1.5; | |
| margin: 0; | |
| } | |
| /* ---------------------------------------------------------------- | |
| MODAL β launched when user clicks Start (non-locked levels) | |
| ---------------------------------------------------------------- */ | |
| .modal-backdrop { | |
| display: none; | |
| position: fixed; | |
| inset: 0; | |
| background: rgba(0,0,0,0.75); | |
| z-index: 1000; | |
| align-items: center; | |
| justify-content: center; | |
| padding: 24px; | |
| } | |
| .modal-backdrop.open { | |
| display: flex; | |
| } | |
| .modal { | |
| background: #1a1a2e; | |
| border: 1px solid rgba(255,255,255,0.12); | |
| border-radius: 20px; | |
| padding: 44px 40px; | |
| max-width: 520px; | |
| width: 100%; | |
| position: relative; | |
| } | |
| .modal h2 { | |
| margin: 0 0 12px; | |
| font-size: 1.6rem; | |
| } | |
| .modal p { | |
| opacity: 0.65; | |
| line-height: 1.65; | |
| margin: 0 0 28px; | |
| font-size: 0.95rem; | |
| } | |
| .modal-parts { | |
| display: flex; | |
| gap: 12px; | |
| margin-bottom: 32px; | |
| } | |
| .modal-part { | |
| flex: 1; | |
| background: rgba(255,255,255,0.05); | |
| border: 1px solid rgba(255,255,255,0.1); | |
| border-radius: 10px; | |
| padding: 16px 12px; | |
| text-align: center; | |
| font-size: 0.82rem; | |
| } | |
| .modal-part .part-num { | |
| font-size: 1.4rem; | |
| margin-bottom: 4px; | |
| } | |
| .modal-part strong { | |
| display: block; | |
| font-size: 0.85rem; | |
| margin-bottom: 4px; | |
| } | |
| .modal-part span { | |
| opacity: 0.5; | |
| font-size: 0.78rem; | |
| } | |
| .modal-actions { | |
| display: flex; | |
| gap: 12px; | |
| } | |
| .modal-close { | |
| position: absolute; | |
| top: 16px; | |
| right: 20px; | |
| background: none; | |
| border: none; | |
| color: rgba(255,255,255,0.4); | |
| font-size: 1.4rem; | |
| cursor: pointer; | |
| line-height: 1; | |
| } | |
| .modal-close:hover { | |
| color: rgba(255,255,255,0.8); | |
| } | |
| .btn-secondary-modal { | |
| padding: 12px 24px; | |
| border-radius: 8px; | |
| font-size: 0.9rem; | |
| font-weight: 600; | |
| border: 1px solid rgba(255,255,255,0.15); | |
| background: transparent; | |
| color: rgba(255,255,255,0.7); | |
| cursor: pointer; | |
| } | |
| .btn-secondary-modal:hover { | |
| background: rgba(255,255,255,0.06); | |
| } | |
| /* Responsive */ | |
| @media (max-width: 600px) { | |
| .modal { padding: 32px 24px; } | |
| .modal-parts { flex-direction: column; } | |
| .modal-actions { flex-direction: column; } | |
| .levels-grid { grid-template-columns: 1fr; } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <!-- ================================================================ | |
| NAVIGATION (matches all other pages exactly) | |
| ================================================================ --> | |
| <nav class="navbar"> | |
| <div class="logo">RISE</div> | |
| <div class="nav-links"> | |
| <a href="dashboard.html">Home</a> | |
| <a href="reading.html" class="active">Reading</a> | |
| <a href="speaking.html">Speaking</a> | |
| </div> | |
| <a href="index.html" class="signin-btn">Log Out</a> | |
| </nav> | |
| <!-- ================================================================ | |
| HERO | |
| ================================================================ --> | |
| <section class="reading-hero"> | |
| <p class="small-title">READING PRACTICE</p> | |
| <h1>Build fluency,<br><span>one level at a time.</span></h1> | |
| <p> | |
| Read aloud, get real-time pronunciation feedback, and advance through | |
| five levels of increasing complexity β from simple sentences to full stories. | |
| </p> | |
| <div class="current-pill"> | |
| <span class="dot"></span> | |
| <span id="hero-level-text">You are on Level 1 β Beginner</span> | |
| </div> | |
| </section> | |
| <!-- ================================================================ | |
| HOW LEVELS WORK | |
| ================================================================ --> | |
| <section class="how-levels-section"> | |
| <div class="how-levels-inner"> | |
| <div class="section-heading" style="text-align:left; max-width:480px;"> | |
| <p>HOW IT WORKS</p> | |
| <h2>Each level has three parts</h2> | |
| </div> | |
| <div class="how-levels-steps"> | |
| <div class="how-step"> | |
| <div class="how-step-icon">π</div> | |
| <h4>Part 1 β Sentence</h4> | |
| <p>Read a set of short sentences. Good for warming up and building word-by-word accuracy.</p> | |
| </div> | |
| <div class="how-step"> | |
| <div class="how-step-icon">π</div> | |
| <h4>Part 2 β Paragraph</h4> | |
| <p>Read a connected paragraph on one topic. Builds reading flow and natural phrasing.</p> | |
| </div> | |
| <div class="how-step"> | |
| <div class="how-step-icon">π</div> | |
| <h4>Part 3 β Story</h4> | |
| <p>Read a short story with a beginning, middle and end. The full fluency challenge.</p> | |
| </div> | |
| <div class="how-step"> | |
| <div class="how-step-icon">π―</div> | |
| <h4>Score 85% to advance</h4> | |
| <p>You need 85% or above in each part. If you slip on Part 2 or 3, you restart from Part 1.</p> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- ================================================================ | |
| LEVELS GRID | |
| ================================================================ --> | |
| <section class="levels-section"> | |
| <div class="section-heading" style="text-align:center;"> | |
| <p>CHOOSE YOUR LEVEL</p> | |
| <h2>Where would you like to read today?</h2> | |
| </div> | |
| <div class="levels-grid" id="levels-grid"> | |
| <!-- Level 1 β always unlocked --> | |
| <div class="level-card l1" id="card-1" onclick="openModal(1)"> | |
| <div class="level-badge">Level 1</div> | |
| <div class="level-icon">π±</div> | |
| <h3>Beginner</h3> | |
| <p class="level-desc"> | |
| Short everyday sentences using simple, common words. A comfortable | |
| starting point focused on building word-level accuracy. | |
| </p> | |
| <div class="part-pills"> | |
| <span class="part-pill">Sentences</span> | |
| <span class="part-pill">Paragraph</span> | |
| <span class="part-pill">Story</span> | |
| </div> | |
| <button class="start-btn">Start Level 1</button> | |
| </div> | |
| <!-- Level 2 --> | |
| <div class="level-card l2" id="card-2" onclick="openModal(2)"> | |
| <div class="level-badge">Level 2</div> | |
| <div class="level-icon">π</div> | |
| <h3>Elementary</h3> | |
| <p class="level-desc"> | |
| Slightly longer sentences with a wider vocabulary. Introduces | |
| descriptive language and connected ideas. | |
| </p> | |
| <div class="part-pills"> | |
| <span class="part-pill">Sentences</span> | |
| <span class="part-pill">Paragraph</span> | |
| <span class="part-pill">Story</span> | |
| </div> | |
| <button class="start-btn">Start Level 2</button> | |
| </div> | |
| <!-- Level 3 --> | |
| <div class="level-card l3" id="card-3" onclick="openModal(3)"> | |
| <div class="level-badge">Level 3</div> | |
| <div class="level-icon">π</div> | |
| <h3>Intermediate</h3> | |
| <p class="level-desc"> | |
| Multi-clause sentences with richer vocabulary and descriptive | |
| passages. A step up in reading flow and phrasing. | |
| </p> | |
| <div class="part-pills"> | |
| <span class="part-pill">Sentences</span> | |
| <span class="part-pill">Paragraph</span> | |
| <span class="part-pill">Story</span> | |
| </div> | |
| <button class="start-btn">Start Level 3</button> | |
| </div> | |
| <!-- Level 4 --> | |
| <div class="level-card l4" id="card-4" onclick="openModal(4)"> | |
| <div class="level-badge">Level 4</div> | |
| <div class="level-icon">π</div> | |
| <h3>Upper Intermediate</h3> | |
| <p class="level-desc"> | |
| Complex sentence structures, abstract vocabulary and nuanced ideas. | |
| Designed for confident, fluid reading. | |
| </p> | |
| <div class="part-pills"> | |
| <span class="part-pill">Sentences</span> | |
| <span class="part-pill">Paragraph</span> | |
| <span class="part-pill">Story</span> | |
| </div> | |
| <button class="start-btn">Start Level 4</button> | |
| </div> | |
| <!-- Level 5 --> | |
| <div class="level-card l5" id="card-5" onclick="openModal(5)"> | |
| <div class="level-badge">Level 5</div> | |
| <div class="level-icon">π</div> | |
| <h3>Advanced</h3> | |
| <p class="level-desc"> | |
| Sophisticated academic and literary language. Complex syntax, | |
| formal register, and rich vocabulary throughout. | |
| </p> | |
| <div class="part-pills"> | |
| <span class="part-pill">Sentences</span> | |
| <span class="part-pill">Paragraph</span> | |
| <span class="part-pill">Story</span> | |
| </div> | |
| <button class="start-btn">Start Level 5</button> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- ================================================================ | |
| GESTURE GUIDE | |
| ================================================================ --> | |
| <section class="gesture-section"> | |
| <div class="section-heading" style="text-align:center;"> | |
| <p>HAND GESTURES</p> | |
| <h2>Navigate with your hands</h2> | |
| </div> | |
| <div class="gesture-grid"> | |
| <div class="gesture-card"> | |
| <div class="gesture-emoji">βοΈ</div> | |
| <div class="gesture-label">1 finger</div> | |
| <p class="gesture-action">Jump to Level 1</p> | |
| </div> | |
| <div class="gesture-card"> | |
| <div class="gesture-emoji">βοΈ</div> | |
| <div class="gesture-label">2 fingers</div> | |
| <p class="gesture-action">Jump to Level 2</p> | |
| </div> | |
| <div class="gesture-card"> | |
| <div class="gesture-emoji">π€</div> | |
| <div class="gesture-label">3 fingers</div> | |
| <p class="gesture-action">Jump to Level 3</p> | |
| </div> | |
| <div class="gesture-card"> | |
| <div class="gesture-emoji">π</div> | |
| <div class="gesture-label">4 fingers</div> | |
| <p class="gesture-action">Jump to Level 4</p> | |
| </div> | |
| <div class="gesture-card"> | |
| <div class="gesture-emoji">β</div> | |
| <div class="gesture-label">Open palm</div> | |
| <p class="gesture-action">Jump to Level 5</p> | |
| </div> | |
| <div class="gesture-card"> | |
| <div class="gesture-emoji">π</div> | |
| <div class="gesture-label">Thumbs up</div> | |
| <p class="gesture-action">Restart from Level 1</p> | |
| </div> | |
| <div class="gesture-card"> | |
| <div class="gesture-emoji">π</div> | |
| <div class="gesture-label">Thumbs down</div> | |
| <p class="gesture-action">Pause & see results</p> | |
| </div> | |
| </div> | |
| <p style="text-align:center; opacity:0.45; font-size:0.85rem; margin-top:28px;"> | |
| Gestures are detected automatically between passages inside the Colab session. | |
| </p> | |
| </section> | |
| <!-- ================================================================ | |
| FOOTER (matches all other pages) | |
| ================================================================ --> | |
| <footer> | |
| <div class="logo">RISE</div> | |
| <p>AI-powered social communication coaching.</p> | |
| <p class="copyright">Β© 2026 RISE. All rights reserved.</p> | |
| </footer> | |
| <!-- ================================================================ | |
| START MODAL | |
| ================================================================ --> | |
| <div class="modal-backdrop" id="modal-backdrop" onclick="closeModal(event)"> | |
| <div class="modal" id="modal"> | |
| <button class="modal-close" onclick="closeModalDirect()">β</button> | |
| <h2 id="modal-title">Level 1 β Beginner</h2> | |
| <p id="modal-desc"> | |
| You are about to start Level 1. Read each passage aloud and score 85% | |
| or above to move through the three parts. | |
| </p> | |
| <div class="modal-parts"> | |
| <div class="modal-part"> | |
| <div class="part-num">π</div> | |
| <strong>Part 1</strong> | |
| <span>Sentences</span> | |
| </div> | |
| <div class="modal-part"> | |
| <div class="part-num">π</div> | |
| <strong>Part 2</strong> | |
| <span>Paragraph</span> | |
| </div> | |
| <div class="modal-part"> | |
| <div class="part-num">π</div> | |
| <strong>Part 3</strong> | |
| <span>Story</span> | |
| </div> | |
| </div> | |
| <div class="modal-actions"> | |
| <a id="modal-colab-link" href="#" target="_blank" class="primary-btn" style="flex:1; text-align:center; padding:14px;"> | |
| Open in Colab | |
| </a> | |
| <button class="btn-secondary-modal" onclick="closeModalDirect()"> | |
| Cancel | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- ================================================================ | |
| JAVASCRIPT | |
| ================================================================ --> | |
| <script> | |
| // ---------------------------------------------------------------- | |
| // Level metadata | |
| // ---------------------------------------------------------------- | |
| const LEVELS = { | |
| 1: { | |
| name: "Beginner", | |
| label: "Level 1 β Beginner", | |
| colour: "#7c6ff7", | |
| desc: "You are about to start Level 1. Read short everyday sentences aloud and score 85%+ in each part to advance.", | |
| colab: "#", // replace with your Colab notebook URL | |
| }, | |
| 2: { | |
| name: "Elementary", | |
| label: "Level 2 β Elementary", | |
| colour: "#56b0f5", | |
| desc: "You are starting Level 2. Sentences are a little longer and vocabulary is wider. Score 85%+ in each part to move on.", | |
| colab: "#", | |
| }, | |
| 3: { | |
| name: "Intermediate", | |
| label: "Level 3 β Intermediate", | |
| colour: "#4ecdc4", | |
| desc: "Level 3 introduces multi-clause sentences and richer descriptions. Score 85%+ in all three parts to advance.", | |
| colab: "#", | |
| }, | |
| 4: { | |
| name: "Upper Intermediate", | |
| label: "Level 4 β Upper Intermediate", | |
| colour: "#f5a623", | |
| desc: "Level 4 uses complex structures and abstract vocabulary. Score 85%+ to reach the final level.", | |
| colab: "#", | |
| }, | |
| 5: { | |
| name: "Advanced", | |
| label: "Level 5 β Advanced", | |
| colour: "#f56565", | |
| desc: "The highest level. Literary and academic language, sophisticated syntax. Complete all three parts to finish the programme.", | |
| colab: "#", | |
| }, | |
| }; | |
| // ---------------------------------------------------------------- | |
| // Read progress from localStorage | |
| // ---------------------------------------------------------------- | |
| const savedLevel = Number(localStorage.getItem("readingLevel")) || 1; | |
| const savedPart = Number(localStorage.getItem("readingPart")) || 1; | |
| // ---------------------------------------------------------------- | |
| // Mark cards as locked / active on page load | |
| // ---------------------------------------------------------------- | |
| function applyLockStates() { | |
| for (let i = 1; i <= 5; i++) { | |
| const card = document.getElementById("card-" + i); | |
| if (!card) continue; | |
| // Remove any existing state classes | |
| card.classList.remove("locked", "active-level"); | |
| // Remove previous active badge if any | |
| const prevBadge = card.querySelector(".active-badge"); | |
| if (prevBadge) prevBadge.remove(); | |
| if (i > savedLevel) { | |
| // Future level β lock it | |
| card.classList.add("locked"); | |
| card.querySelector(".start-btn").textContent = "Locked"; | |
| } else if (i === savedLevel) { | |
| // Current level β mark as active | |
| card.classList.add("active-level"); | |
| const badge = document.createElement("span"); | |
| badge.className = "active-badge"; | |
| badge.textContent = "Current level Β· Part " + savedPart + " / 3"; | |
| card.querySelector("h3").insertAdjacentElement("afterend", badge); | |
| card.querySelector(".start-btn").textContent = "Continue Level " + i; | |
| } else { | |
| // Completed level | |
| card.querySelector(".start-btn").textContent = "Revisit Level " + i; | |
| } | |
| } | |
| // Update hero pill | |
| const heroText = document.getElementById("hero-level-text"); | |
| heroText.textContent = | |
| "You are on Level " + savedLevel + | |
| " β " + LEVELS[savedLevel].name + | |
| " (Part " + savedPart + " of 3)"; | |
| } | |
| applyLockStates(); | |
| // ---------------------------------------------------------------- | |
| // Modal | |
| // ---------------------------------------------------------------- | |
| let selectedLevel = null; | |
| function openModal(levelNum) { | |
| if (levelNum > savedLevel) return; // locked β do nothing | |
| selectedLevel = levelNum; | |
| const data = LEVELS[levelNum]; | |
| document.getElementById("modal-title").textContent = data.label; | |
| document.getElementById("modal-desc").textContent = data.desc; | |
| document.getElementById("modal-colab-link").href = data.colab; | |
| // Tint the modal accent strip to match the level colour | |
| document.getElementById("modal").style.borderTopColor = data.colour; | |
| document.getElementById("modal").style.borderTopWidth = "3px"; | |
| document.getElementById("modal-backdrop").classList.add("open"); | |
| } | |
| function closeModalDirect() { | |
| document.getElementById("modal-backdrop").classList.remove("open"); | |
| } | |
| function closeModal(e) { | |
| if (e.target === document.getElementById("modal-backdrop")) { | |
| closeModalDirect(); | |
| } | |
| } | |
| // Close on Escape | |
| document.addEventListener("keydown", e => { | |
| if (e.key === "Escape") closeModalDirect(); | |
| }); | |
| </script> | |
| </body> | |
| </html> | |