One out, TV anatomy studies by inspections of the chest and second in the palpitation and palpitation precautions, ECG and endoscopy, bronchoscopy, gastroscopy, and radiography, electromyography, and diagram and EEG.

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
I now have sufficient textbook content to construct a comprehensive answer. Let me compile the full response covering all the topics requested: chest inspection, palpation (with precautions), ECG, endoscopy/bronchoscopy/gastroscopy, radiography, electromyography (EMG), and EEG.

Clinical Examination & Diagnostic Procedures

1. Inspection of the Chest (Physical Examination)

Physical examination begins the moment the clinician first sees the patient. For chest inspection, sufficient clothing must be removed and the patient suitably draped so the entire thorax is visible. The patient ordinarily sits upright.
What to observe:
  • Shape and symmetry - reveals kyphoscoliosis, pectus excavatum (sunken sternum), pectus carinatum (pigeon chest), ankylosing spondylitis, gynecomastia, or surgical scars
  • Breathing pattern - rate, depth, rhythm, and type (e.g., Cheyne-Stokes, Kussmaul, Biot's)
  • Accessory muscle use - suggests increased work of breathing
  • Smell - tobacco stains on teeth/fingers/clothing; odor of ethanol or ketones (diabetic ketoacidosis); foul odor of anaerobic lung abscess; sweet smell of Pseudomonas infection
Murray & Nadel's Textbook of Respiratory Medicine, p. 397

2. Palpation of the Chest

Technique and findings:
  • Detect bony abnormalities - cervical rib, subcutaneous calcinosis (in systemic sclerosis)
  • Point tenderness and thoracic spinal tenderness - essential when evaluating chest pain
  • Fluctuant areas - suggest empyema necessitans
  • Crepitant areas - suggest subcutaneous emphysema
  • Tracheal deviation from the suprasternal notch - indicates mediastinal shift (toward collapse, away from tension pneumothorax or large effusion)
  • Chest wall lag - place both hands symmetrically over each hemithorax and feel/observe whether movement is symmetric
Vocal Fremitus:
  • Elicited by having the patient say "one, two, three" while the examiner's palms move top to bottom across both hemithoraces
  • Increased fremitus - consolidation (pneumonia) enhances sound transmission
  • Decreased fremitus - pleural effusion impairs sound transmission
Cardiac palpation:
  • Always search for apical impulse, heaves/lifts, thrills, and palpable valve closure
  • In severe COPD, abnormal cardiac movements are often better felt in the subxiphoid region than over the precordium
Murray & Nadel's Textbook of Respiratory Medicine, p. 397
Palpation Precautions:
  • Avoid deep palpation over areas of suspected rib fractures or flail chest
  • Be gentle over areas of known or suspected pathology (abscess, empyema)
  • In suspected spinal injury, avoid any movement that could compromise the cord
  • Subcutaneous emphysema (crepitus) should not be forcefully compressed
  • Assess for tenderness before applying full pressure

3. Percussion of the Chest

Skillful percussion depends on a uniform, free, easy stroke of the plexor finger onto the pleximeter finger. It is predominantly felt, not just heard.
Percussion NoteCondition
ResonantNormal air-containing lung
Hyperresonant / TympaniticPneumothorax (tympanitic when under tension)
DullPleural effusion, pneumonia/consolidation
FlatPercussing over liver (solid tissue)
With large pleural effusions, three tonal zones are detected: resonance above the fluid, dullness in the middle, and flatness at the bottom.

4. Auscultation of the Chest

The diaphragm of the stethoscope detects higher-pitched sounds; the bell detects lower-pitched sounds (must be applied lightly - e.g., for the low rumble of mitral stenosis).
Breath sound classification (American Thoracic Society):
Sound TypeCharacteristicsSignificance
Normal breath sounds200-600 Hz, decreasing power, soft, inspiratoryNormal lung
Crackles (fine)Short, explosive, discontinuousInterstitial fibrosis, pulmonary edema
Crackles (coarse)Louder, lower pitchPneumonia, bronchiectasis
WheezesHigh-pitched (>400 Hz), continuous (>250 ms)Airway obstruction, asthma
RhonchiLow-pitched (<200 Hz), continuous; may clear with coughSecretions in larger airways
Voice-generated sounds:
  • Egophony ("E to A" test) - "E" sounds like "A" over consolidated lung (pneumonia)
  • Bronchophony / Pectoriloquy - spoken or whispered words transmitted with increased intensity and clarity through consolidation
Murray & Nadel's Textbook of Respiratory Medicine, p. 398

5. ECG (Electrocardiogram)

The ECG records electrical potentials generated by the heart at the body surface.
Generation of the ECG waveform:
  • P wave - SA node fires → impulse propagates through atria via specialized conduction tissue → atrial depolarization and contraction
  • PR interval - represents the conduction delay at the AV node (normally 120-200 ms)
  • QRS complex - impulse travels through the His bundle → left and right bundle branches → Purkinje fibers → ventricular cardiomyocytes depolarize
  • T wave - ventricular repolarization
The AV node is a region of relatively slow conduction, creating the delay between atrial and ventricular contraction. From the distal His bundle, the impulse passes through the bundle branches and finally the Purkinje system, which activates the ventricular myocardium.
Miller's Anesthesia, 10e, p. 1364-1367
Cardiac cycle diagram showing ECG with ventricular pressure, aortic flow, and ventricular volume
ECG correlated with cardiac mechanical events - Miller's Anesthesia

6. Endoscopy

Bronchoscopy - visual examination of the tracheobronchial tree via a flexible or rigid bronchoscope. Used to:
  • Diagnose lung cancer, infections, hemoptysis
  • Obtain BAL (bronchoalveolar lavage), brushings, or biopsies
  • Remove foreign bodies or mucus plugs
Gastroscopy (Upper GI Endoscopy) - visual examination of the esophagus, stomach, and duodenum. Used to:
  • Diagnose peptic ulcer disease, esophagitis, gastric cancer
  • Identify sources of GI bleeding (e.g., varices, Mallory-Weiss tears)
  • Obtain mucosal biopsies (e.g., H. pylori, Barrett's esophagus)
Rigid Sigmoidoscopy (lower endoscopy) - obligatory in patients with symptoms of large bowel or anal disease. The instrument (Lloyd Davies pattern, 14 or 19 mm diameter, up to 30 cm length) is lubricated and passed gently. Examines the rectal mucosa to at least 10 cm from the anal verge.
ERCP (Endoscopic Retrograde Cholangiopancreatography) - a specialized endoscopic procedure where the bile and pancreatic ducts are cannulated via a catheter introduced through a side-viewing duodenoscope, then visualized radiographically after contrast injection. Used to:
  • Detect common bile duct stones and strictures
  • Diagnose pancreatic duct obstruction (diagnostic of pancreatic cancer)
  • Obtain bile and pancreatic juice for cytology
Pye's Surgical Handicraft, 22nd Ed, p. 287-298

7. Radiography

Plain radiography provides important anatomical and pathological information:
  • Soft tissue X-ray - shows an enlarged liver or spleen; demonstrates radio-opaque gallstones
  • Barium meal / swallow - discloses esophageal varices, alimentary tract cancer, widening of the duodenal loop (suggesting cancer of the head of the pancreas)
  • Targeted films of the second part of the duodenum - may show an ampullary carcinoma
In the chest, CXR assesses:
  • Lung fields (consolidation, collapse, effusions, pneumothorax)
  • Cardiac size and mediastinal width
  • Bony thorax abnormalities
Pye's Surgical Handicraft, 22nd Ed, p. 287

8. Electromyography (EMG)

EMG records the electrical activity of skeletal muscle using needle electrodes inserted into the muscle or surface electrodes on the skin.
What it measures:
  • Insertional activity - brief burst on needle insertion (normally brief; increased in inflammatory myopathies, decreased in fibrosis)
  • Spontaneous activity at rest - normally silent; fibrillation potentials and positive sharp waves indicate denervation
  • Motor unit action potentials (MUAPs) - assessed for amplitude, duration, polyphasia
    • Large, long-duration MUAPs = re-innervation (chronic neurogenic disease)
    • Small, short-duration, polyphasic MUAPs = myopathy
Clinical uses:
  • Distinguishing neuropathy (nerve damage) from myopathy (muscle disease)
  • Diagnosing neuromuscular junction disorders (e.g., myasthenia gravis, Lambert-Eaton syndrome)
  • Nerve conduction studies (NCS) are often done alongside EMG

9. EEG (Electroencephalography)

EEG records spontaneous electrical activity of the brain via electrodes placed on the scalp (typically 19-21 electrodes in the 10-20 international system).
Brain wave patterns:
WaveFrequencyState
Delta (δ)<4 HzDeep sleep, encephalopathy, lesions
Theta (θ)4-8 HzDrowsiness, some encephalopathies
Alpha (α)8-13 HzRelaxed wakefulness, eyes closed
Beta (β)>13 HzActive thinking, benzodiazepines
Clinical uses:
  • Epilepsy diagnosis - identifies seizure type (generalized vs. focal), inter-ictal spikes
  • Encephalopathy - diffuse slowing in metabolic or toxic encephalopathy
  • Brain death - electrocerebral silence (flat EEG)
  • Sleep disorders - polysomnography includes EEG
  • Monitoring during cardiac/neurosurgery (depth of anesthesia)

Summary Table

ProcedureWhat it ExaminesPrimary Use
InspectionVisual thorax assessmentStructural abnormalities, breathing patterns
PalpationTactile chest assessmentFremitus, tenderness, tracheal deviation
PercussionResonance of thoraxFluid vs. air vs. solid
AuscultationBreath/heart soundsCrackles, wheezes, murmurs
ECGCardiac electrical activityArrhythmias, ischemia, conduction defects
BronchoscopyTracheobronchial treeLung cancer, infection, hemoptysis
GastroscopyUpper GI tractUlcers, bleeding, cancer
RadiographyStructural imagingBones, soft tissues, organ size
EMGSkeletal muscle electrical activityNeuropathy vs. myopathy
EEGBrain electrical activityEpilepsy, encephalopathy, brain death

Bhai ECG ko hum jo ek zero to hig level 3d animation and simple and clear way me aise samjhao ki main ecg ka report dekh Saku bhai basic to deep level padhao bhai please

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/ecg-guide && echo "Directory ready"

Writing File

~/ecg-guide/ECG_Zero_to_Deep.html

<!DOCTYPE html>
<html lang="hi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ECG - Zero to Deep Level | Complete Guide</title>
<style>
  :root {
    --green: #00ff88;
    --red: #ff4466;
    --blue: #4488ff;
    --yellow: #ffdd44;
    --orange: #ff8833;
    --purple: #aa66ff;
    --bg: #0a0e1a;
    --card: #111827;
    --card2: #1a2235;
    --text: #e8eaf6;
    --dim: #8892b0;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.7;
  }
  /* ===== HEADER ===== */
  header {
    background: linear-gradient(135deg, #0d1b2a 0%, #1a2a4a 50%, #0d1b2a 100%);
    padding: 40px 20px 30px;
    text-align: center;
    border-bottom: 2px solid var(--green);
    position: relative;
    overflow: hidden;
  }
  header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(0,255,136,0.04) 20px),
                repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(0,255,136,0.04) 20px);
  }
  header h1 {
    font-size: 2.5em;
    color: var(--green);
    text-shadow: 0 0 30px rgba(0,255,136,0.5);
    position: relative;
    z-index: 1;
  }
  header p {
    color: var(--dim);
    font-size: 1.1em;
    margin-top: 8px;
    position: relative;
    z-index: 1;
  }
  /* ===== LIVE ECG CANVAS ===== */
  #ecg-canvas-wrap {
    background: #050d12;
    padding: 10px 0;
    border-bottom: 1px solid #1a3a2a;
    position: relative;
  }
  #ecg-canvas-wrap::before {
    content: '● LIVE ECG MONITOR';
    position: absolute;
    top: 8px; left: 16px;
    color: var(--green);
    font-size: 0.75em;
    font-weight: bold;
    letter-spacing: 2px;
    animation: blink 1.2s infinite;
  }
  @keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
  canvas#ecgLine {
    display: block;
    width: 100%;
    height: 120px;
  }
  /* ===== NAV ===== */
  nav {
    background: var(--card);
    padding: 14px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    border-bottom: 1px solid #1e2d40;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  nav a {
    color: var(--dim);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    border: 1px solid #2a3a50;
    transition: all 0.2s;
  }
  nav a:hover { background: var(--green); color: #000; border-color: var(--green); }
  /* ===== MAIN LAYOUT ===== */
  main { max-width: 1100px; margin: 0 auto; padding: 30px 16px 60px; }
  /* ===== SECTION TITLES ===== */
  .level-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 6px;
  }
  .level-zero { background: #1a3a1a; color: var(--green); border: 1px solid var(--green); }
  .level-basic { background: #1a2a3a; color: var(--blue); border: 1px solid var(--blue); }
  .level-inter { background: #2a1a3a; color: var(--purple); border: 1px solid var(--purple); }
  .level-deep { background: #3a1a1a; color: var(--red); border: 1px solid var(--red); }

  section {
    margin-bottom: 50px;
    scroll-margin-top: 70px;
  }
  section h2 {
    font-size: 1.6em;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1e2d40;
  }
  section h3 {
    font-size: 1.15em;
    color: var(--yellow);
    margin: 20px 0 10px;
  }
  /* ===== CARDS ===== */
  .card {
    background: var(--card2);
    border: 1px solid #1e2d40;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 18px;
  }
  .card-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
  }
  /* ===== HEART ANIMATION ===== */
  #heart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 0;
  }
  .heart-svg-wrap {
    position: relative;
    width: 320px;
    height: 280px;
  }
  /* ===== WAVE DIAGRAM CANVAS ===== */
  .wave-section {
    background: #050d12;
    border: 1px solid #1a3040;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    position: relative;
  }
  canvas.wave-canvas {
    width: 100%;
    height: 200px;
    display: block;
  }
  .wave-label-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
  }
  .wave-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
  }
  .wave-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
  }
  /* ===== LEAD GRID ===== */
  .lead-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
  }
  .lead-box {
    background: #050d12;
    border: 1px solid #1a3040;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
  }
  .lead-box:hover { border-color: var(--green); transform: translateY(-2px); }
  .lead-box .lead-name { font-weight: bold; color: var(--green); font-size: 1.1em; }
  .lead-box .lead-info { color: var(--dim); font-size: 0.78em; margin-top: 4px; }
  .lead-box canvas { width: 100%; height: 60px; margin-top: 8px; }
  /* ===== INTERVALS TABLE ===== */
  table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.9em;
  }
  th {
    background: #0d1b2a;
    color: var(--green);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--green);
  }
  td {
    padding: 10px 14px;
    border-bottom: 1px solid #1e2d40;
    vertical-align: top;
  }
  tr:hover td { background: #111e30; }
  .normal { color: var(--green); font-weight: bold; }
  .abnormal { color: var(--red); }
  /* ===== RATE CALCULATOR ===== */
  .calc-box {
    background: #0a1520;
    border: 2px solid var(--blue);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
  }
  .calc-box input[type=range] {
    width: 100%;
    accent-color: var(--green);
    margin: 10px 0;
  }
  .calc-result {
    font-size: 2em;
    color: var(--green);
    font-weight: bold;
    text-align: center;
    margin: 10px 0;
  }
  /* ===== STEP FLOW ===== */
  .step-flow {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 40px;
  }
  .step-flow::before {
    content: '';
    position: absolute;
    left: 15px; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--green), var(--blue), var(--purple), var(--red));
  }
  .step {
    background: var(--card2);
    border: 1px solid #1e2d40;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 14px;
    position: relative;
  }
  .step::before {
    content: attr(data-step);
    position: absolute;
    left: -32px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px; height: 26px;
    background: var(--green);
    color: #000;
    font-weight: bold;
    font-size: 0.8em;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .step-title { color: var(--yellow); font-weight: bold; margin-bottom: 4px; }
  /* ===== ABNORMAL PATTERNS ===== */
  .pattern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
  }
  .pattern-card {
    background: #0a0f1e;
    border: 1px solid #2a1a1a;
    border-radius: 10px;
    padding: 16px;
    transition: border-color 0.2s;
  }
  .pattern-card:hover { border-color: var(--red); }
  .pattern-card .p-title { color: var(--red); font-weight: bold; font-size: 1em; margin-bottom: 6px; }
  .pattern-card .p-ecg { color: var(--yellow); font-size: 0.85em; margin-bottom: 6px; font-family: monospace; }
  .pattern-card .p-desc { color: var(--dim); font-size: 0.82em; }
  /* ===== AXIS DIAGRAM ===== */
  #axis-canvas-wrap { text-align: center; margin-bottom: 20px; }
  /* ===== TOOLTIPS ===== */
  .tooltip {
    position: relative;
    cursor: help;
    border-bottom: 1px dashed var(--dim);
  }
  .tooltip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a2a4a;
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    white-space: nowrap;
    border: 1px solid var(--blue);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 200;
  }
  .tooltip:hover::after { opacity: 1; }
  /* ===== HIGHLIGHT BOX ===== */
  .highlight {
    border-left: 4px solid var(--green);
    background: #051a0e;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin: 14px 0;
    font-size: 0.95em;
  }
  .highlight.warn { border-color: var(--red); background: #1a0505; }
  .highlight.info { border-color: var(--blue); background: #050a1a; }
  .highlight.tip { border-color: var(--yellow); background: #1a1400; }
  /* ===== QUIZ ===== */
  .quiz-box {
    background: #0a1020;
    border: 2px solid var(--purple);
    border-radius: 12px;
    padding: 20px;
    margin-top: 30px;
  }
  .quiz-q { font-size: 1em; margin-bottom: 14px; color: var(--text); }
  .quiz-opts button {
    display: block;
    width: 100%;
    text-align: left;
    background: #111827;
    border: 1px solid #2a3a50;
    color: var(--text);
    padding: 10px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
  }
  .quiz-opts button:hover { background: #1a2a40; }
  .quiz-opts button.correct { background: #0a3a1a; border-color: var(--green); color: var(--green); }
  .quiz-opts button.wrong { background: #3a0a0a; border-color: var(--red); color: var(--red); }
  .quiz-feedback { margin-top: 10px; padding: 10px; border-radius: 8px; display: none; font-size: 0.9em; }
  /* ===== FOOTER ===== */
  footer {
    text-align: center;
    padding: 30px;
    color: var(--dim);
    font-size: 0.8em;
    border-top: 1px solid #1e2d40;
  }
  /* ===== RESPONSIVE ===== */
  @media (max-width: 600px) {
    header h1 { font-size: 1.6em; }
    .step-flow { padding-left: 30px; }
    .step::before { left: -24px; width: 20px; height: 20px; font-size: 0.7em; }
  }
</style>
</head>
<body>

<!-- HEADER -->
<header>
  <h1>⚡ ECG - Zero to Deep Level</h1>
  <p>Zero se ECG report padhna sikhein — Animated | Interactive | Hinglish</p>
</header>

<!-- LIVE ECG MONITOR -->
<div id="ecg-canvas-wrap">
  <canvas id="ecgLine" height="120"></canvas>
</div>

<!-- NAV -->
<nav>
  <a href="#s0">🫀 Kya hai ECG?</a>
  <a href="#s1">⚡ Heart ka Electrical System</a>
  <a href="#s2">📈 Waves & Intervals</a>
  <a href="#s3">📄 ECG Paper</a>
  <a href="#s4">🔌 12 Leads</a>
  <a href="#s5">💓 Heart Rate</a>
  <a href="#s6">📐 Cardiac Axis</a>
  <a href="#s7">📋 ECG Padhne ka Tarika</a>
  <a href="#s8">🚨 Abnormal Patterns</a>
  <a href="#s9">🧠 Quiz</a>
</nav>

<main>

<!-- ======================== SECTION 0 ======================== -->
<section id="s0">
  <span class="level-badge level-zero">LEVEL 0 — ZERO</span>
  <h2>🫀 ECG Kya Hota Hai?</h2>
  <div class="card">
    <p><strong>ECG (Electrocardiogram)</strong> = Dil ki <span class="tooltip" data-tip="Electrical activity = bijli ki activity">electrical activity</span> ko paper ya screen pe record karna.</p>
    <br>
    <p>Jaise ek musician guitar bajata hai aur uski awaaz record hoti hai — waise hi dil ki har dhadkan ek electrical signal produce karti hai, jo body ke surface pe electrodes se pakdi jaati hai aur line (waveform) ki tarah print hoti hai.</p>
    <br>
    <div class="highlight">
      💡 <strong>Simple rule:</strong> ECG ek "bijli ka naksha" hai jo dikhata hai — dil sahi jagah se, sahi time pe, sahi speed se dhadak raha hai ya nahi.
    </div>
  </div>
  <div class="card-row">
    <div class="card">
      <h3>ECG kab kiya jaata hai?</h3>
      <ul style="padding-left:18px; color:var(--dim); font-size:0.9em; line-height:2">
        <li>Seene mein dard (chest pain)</li>
        <li>Dhadkan ka tez/dheemi/irregular hona</li>
        <li>Sans lene mein takleef</li>
        <li>Surgery se pehle routine check</li>
        <li>High BP, diabetes check</li>
        <li>Behoshi (syncope/fainting)</li>
      </ul>
    </div>
    <div class="card">
      <h3>ECG kaise kiya jaata hai?</h3>
      <ul style="padding-left:18px; color:var(--dim); font-size:0.9em; line-height:2">
        <li>Patient leta hai (supine position)</li>
        <li>10 electrodes lagate hain body pe</li>
        <li>4 limb leads (haath-paon pe)</li>
        <li>6 chest leads (seene pe)</li>
        <li>Machine 10 seconds record karti hai</li>
        <li>12 views milte hain — 12-lead ECG</li>
      </ul>
    </div>
  </div>
</section>

<!-- ======================== SECTION 1 ======================== -->
<section id="s1">
  <span class="level-badge level-zero">LEVEL 1 — BASICS</span>
  <h2>⚡ Dil Ka Electrical System (Conduction System)</h2>
  <div id="heart-container">
    <canvas id="heartCanvas" width="560" height="320" style="max-width:100%; border-radius:10px; background:#050d12; border:1px solid #1a3040;"></canvas>
    <p style="color:var(--dim); font-size:0.8em; margin-top:8px;">↑ Heart ka conduction system animation (click to pause)</p>
  </div>
  <div class="card">
    <h3>Conduction ka Sequence (Order of Electrical Flow)</h3>
    <div class="step-flow">
      <div class="step" data-step="1">
        <div class="step-title">SA Node (Sinoatrial Node)</div>
        <div style="color:var(--dim); font-size:0.88em">Right atrium ke upar, superior vena cava ke paas hota hai. Ye <strong>natural pacemaker</strong> hai — automatically 60-100 baar/min fire karta hai. P wave produce karta hai.</div>
      </div>
      <div class="step" data-step="2">
        <div class="step-title">Atria depolarize hote hain</div>
        <div style="color:var(--dim); font-size:0.88em">SA node se signal dono atria (left + right) mein phailta hai. Bachmann bundle left atrium ko jaldi activate karta hai. Result = <strong>P wave</strong> on ECG.</div>
      </div>
      <div class="step" data-step="3">
        <div class="step-title">AV Node (Atrioventricular Node)</div>
        <div style="color:var(--dim); font-size:0.88em">Signal atria se ventricles mein jaane ke liye AV node se guzarta hai. Ye signal ko <strong>80-120ms delay</strong> deta hai — taaki atria pehle squeeze ho sakein aur ventricles mein blood aa sake. Result = <strong>PR interval</strong>.</div>
      </div>
      <div class="step" data-step="4">
        <div class="step-title">Bundle of His → Bundle Branches</div>
        <div style="color:var(--dim); font-size:0.88em">AV node ke baad signal Bundle of His mein jaata hai, jo Left Bundle Branch (LBB) aur Right Bundle Branch (RBB) mein split ho jaata hai.</div>
      </div>
      <div class="step" data-step="5">
        <div class="step-title">Purkinje Fibers</div>
        <div style="color:var(--dim); font-size:0.88em">Bundle branches fastest conducting fibers — Purkinje system — mein split hote hain. Ye signal ventricle ke har muscle cell tak pohonchate hain. Result = <strong>QRS complex</strong>.</div>
      </div>
      <div class="step" data-step="6">
        <div class="step-title">Ventricular Repolarization</div>
        <div style="color:var(--dim); font-size:0.88em">Ventricles contract karte hain, phir relax karne ke liye repolarize hote hain. Result = <strong>ST segment + T wave</strong>.</div>
      </div>
    </div>
  </div>
</section>

<!-- ======================== SECTION 2 ======================== -->
<section id="s2">
  <span class="level-badge level-basic">LEVEL 2 — WAVES & INTERVALS</span>
  <h2>📈 ECG Waves, Segments & Intervals</h2>
  <div class="wave-section">
    <canvas id="waveCanvas" height="200"></canvas>
    <div class="wave-label-row">
      <div class="wave-label"><div class="wave-dot" style="background:#4488ff"></div> P wave</div>
      <div class="wave-label"><div class="wave-dot" style="background:#ff8833"></div> PR interval</div>
      <div class="wave-label"><div class="wave-dot" style="background:#00ff88"></div> QRS complex</div>
      <div class="wave-label"><div class="wave-dot" style="background:#ffdd44"></div> ST segment</div>
      <div class="wave-label"><div class="wave-dot" style="background:#ff4466"></div> T wave</div>
      <div class="wave-label"><div class="wave-dot" style="background:#aa66ff"></div> QT interval</div>
    </div>
  </div>

  <table>
    <tr>
      <th>Wave / Interval</th>
      <th>Kya Represent Karta Hai</th>
      <th>Normal Value</th>
      <th>Abnormal Matlab</th>
    </tr>
    <tr>
      <td><strong style="color:#4488ff">P wave</strong></td>
      <td>Atria ka depolarization (dono atria ka contract hona)</td>
      <td><span class="normal">&lt;120ms (3 small boxes)<br>Amplitude &lt;2.5mm</span></td>
      <td><span class="abnormal">Tall P = Right atrial hypertrophy<br>Bifid P = Left atrial hypertrophy</span></td>
    </tr>
    <tr>
      <td><strong style="color:#ff8833">PR Interval</strong></td>
      <td>SA node se ventricle depolarization tak ka time (AV node delay)</td>
      <td><span class="normal">120–200ms (3–5 small boxes)</span></td>
      <td><span class="abnormal">&gt;200ms = 1st degree heart block<br>&lt;120ms = WPW syndrome</span></td>
    </tr>
    <tr>
      <td><strong style="color:#00ff88">QRS Complex</strong></td>
      <td>Ventricles ka depolarization (main pumping action)</td>
      <td><span class="normal">&lt;120ms (3 small boxes)</span></td>
      <td><span class="abnormal">&gt;120ms = Bundle Branch Block<br>Very tall = Ventricular hypertrophy</span></td>
    </tr>
    <tr>
      <td><strong style="color:#ffdd44">ST Segment</strong></td>
      <td>Ventricular action potential ka plateau — ventricles contracted hain</td>
      <td><span class="normal">Isoelectric (flat baseline pe)</span></td>
      <td><span class="abnormal">Elevation = MI (Heart Attack!)<br>Depression = Ischemia</span></td>
    </tr>
    <tr>
      <td><strong style="color:#ff4466">T wave</strong></td>
      <td>Ventricles ka repolarization (relaxing)</td>
      <td><span class="normal">Upright in I, II, V4-V6<br>Height &lt; 5mm limb, &lt;10mm chest</span></td>
      <td><span class="abnormal">Inverted = Ischemia, PE, HCM<br>Tall/Peaked = Hyperkalemia</span></td>
    </tr>
    <tr>
      <td><strong style="color:#aa66ff">QT Interval</strong></td>
      <td>Total ventricular electrical activity (depol + repol)</td>
      <td><span class="normal">QTc &lt; 440ms (men)<br>QTc &lt; 460ms (women)</span></td>
      <td><span class="abnormal">Prolonged QT = Torsades de Pointes risk<br>Short QT = Hypercalcemia</span></td>
    </tr>
    <tr>
      <td><strong style="color:#8888ff">U wave</strong></td>
      <td>Purkinje fiber repolarization (kabhi kabhi dikhta hai)</td>
      <td><span class="normal">Small, same direction as T wave</span></td>
      <td><span class="abnormal">Prominent U = Hypokalemia<br>Inverted U = LVH, Ischemia</span></td>
    </tr>
  </table>

  <div class="highlight tip">
    💡 <strong>Memory Trick:</strong> "P-QRS-T — <u>P</u>lease <u>Q</u>uickly <u>R</u>ead <u>S</u>tudent <u>T</u>ext" — Atria fire → delay → Ventricles fire → Ventricles relax
  </div>
</section>

<!-- ======================== SECTION 3 ======================== -->
<section id="s3">
  <span class="level-badge level-basic">LEVEL 3 — ECG PAPER</span>
  <h2>📄 ECG Paper Ko Samjhein</h2>
  <div class="card-row">
    <div class="card">
      <h3>🟫 Horizontal Axis = TIME</h3>
      <ul style="padding-left:18px; color:var(--dim); font-size:0.9em; line-height:2.2">
        <li>1 <strong>small box</strong> = <span class="normal">0.04 seconds (40ms)</span></li>
        <li>1 <strong>big box</strong> (5 small) = <span class="normal">0.2 seconds (200ms)</span></li>
        <li>Standard speed = <strong>25 mm/sec</strong></li>
        <li>10 seconds = 1 standard ECG strip</li>
      </ul>
    </div>
    <div class="card">
      <h3>📏 Vertical Axis = VOLTAGE (Amplitude)</h3>
      <ul style="padding-left:18px; color:var(--dim); font-size:0.9em; line-height:2.2">
        <li>1 <strong>small box</strong> = <span class="normal">0.1 mV</span></li>
        <li>1 <strong>big box</strong> (10mm) = <span class="normal">1 mV</span></li>
        <li>Standard calibration = <strong>10mm = 1mV</strong></li>
        <li>Calibration pulse left side pe hota hai</li>
      </ul>
    </div>
  </div>
  <canvas id="paperCanvas" height="200" style="width:100%; background:#050d12; border:1px solid #1a3040; border-radius:8px; display:block; margin-bottom:16px;"></canvas>
  <div class="highlight info">
    📌 <strong>Yaad rakho:</strong> Horizontal = Time (kitni der), Vertical = Amplitude (kitni badi wave). Dono milake wave ka size aur shape batate hain.
  </div>
</section>

<!-- ======================== SECTION 4 ======================== -->
<section id="s4">
  <span class="level-badge level-inter">LEVEL 4 — 12 LEADS</span>
  <h2>🔌 12 Leads — 12 Angles Se Dil Dekhna</h2>
  <div class="card">
    <p>Camera ek hi cheez ko alag-alag angle se shoot karta hai. Waise hi ECG ke <strong>12 leads</strong> dil ko 12 alag directions se dekhte hain.</p>
    <br>
    <div class="highlight info">
      📐 <strong>3 types of leads:</strong><br>
      1. <strong>Limb leads (I, II, III)</strong> — Einthoven's triangle — haath aur paon se<br>
      2. <strong>Augmented leads (aVR, aVL, aVF)</strong> — Amplified unipolar limb leads<br>
      3. <strong>Precordial/Chest leads (V1–V6)</strong> — Seene pe directly
    </div>
  </div>
  <div class="lead-grid" id="leadGrid"></div>
  <table>
    <tr>
      <th>Lead Group</th>
      <th>Leads</th>
      <th>Dil ka Kaunsa Hissa</th>
      <th>Artery</th>
    </tr>
    <tr>
      <td><strong style="color:var(--blue)">Inferior</strong></td>
      <td>II, III, aVF</td>
      <td>Inferior wall of Left Ventricle (neeche)</td>
      <td>Right Coronary Artery (RCA)</td>
    </tr>
    <tr>
      <td><strong style="color:var(--green)">Lateral</strong></td>
      <td>I, aVL, V5, V6</td>
      <td>Lateral wall of Left Ventricle (side)</td>
      <td>Left Circumflex (LCx)</td>
    </tr>
    <tr>
      <td><strong style="color:var(--orange)">Anterior</strong></td>
      <td>V1, V2, V3, V4</td>
      <td>Anterior wall + Septum (aage)</td>
      <td>LAD (Left Anterior Descending)</td>
    </tr>
    <tr>
      <td><strong style="color:var(--red)">Reciprocal</strong></td>
      <td>aVR</td>
      <td>Cavity of Left Ventricle (opposite view)</td>
      <td>—</td>
    </tr>
  </table>
  <div class="highlight warn">
    🚨 <strong>Clinical pearl:</strong> Jis lead group mein ST elevation dikhta hai — woh area ischemic (blood supply band) hai. Opposite leads mein ST depression dikhega (reciprocal changes).
  </div>
</section>

<!-- ======================== SECTION 5 ======================== -->
<section id="s5">
  <span class="level-badge level-inter">LEVEL 5 — HEART RATE</span>
  <h2>💓 Heart Rate Calculate Karna</h2>
  <div class="card-row">
    <div class="card">
      <h3>Method 1: 300 Rule (Regular Rhythm)</h3>
      <p style="color:var(--dim); font-size:0.9em; margin-bottom:10px">Do consecutive R waves ke beech kitne <strong>big boxes</strong> hain — <strong>300 ÷ big boxes</strong> = Heart Rate</p>
      <div style="text-align:center; font-size:1.3em; color:var(--green); font-weight:bold; padding:10px; background:#051a0e; border-radius:8px;">
        HR = 300 / (R-R big boxes)
      </div>
      <div style="margin-top:10px; font-size:0.85em; color:var(--dim)">
        1 box=300, 2=150, 3=100, 4=75, 5=60, 6=50
      </div>
    </div>
    <div class="card">
      <h3>Method 2: 1500 Rule (Precise)</h3>
      <p style="color:var(--dim); font-size:0.9em; margin-bottom:10px">R-R interval ko <strong>small boxes</strong> mein count karo, phir <strong>1500 ÷ small boxes</strong></p>
      <div style="text-align:center; font-size:1.3em; color:var(--blue); font-weight:bold; padding:10px; background:#05081a; border-radius:8px;">
        HR = 1500 / (R-R small boxes)
      </div>
    </div>
  </div>
  <div class="calc-box">
    <h3 style="color:var(--blue); margin-bottom:12px">🧮 Interactive Heart Rate Calculator</h3>
    <label>R-R interval (big boxes): <strong id="rrVal">4</strong></label>
    <input type="range" id="rrSlider" min="1" max="10" value="4" step="0.5">
    <div class="calc-result" id="hrResult">75 bpm</div>
    <div style="text-align:center; color:var(--dim); font-size:0.85em" id="hrClassify">Normal (60-100 bpm) ✅</div>
  </div>
  <table>
    <tr><th>Rate</th><th>Name</th><th>Causes</th></tr>
    <tr><td>&lt;60 bpm</td><td style="color:var(--blue)">Bradycardia</td><td>Athletes, beta-blockers, hypothyroidism, heart block</td></tr>
    <tr><td>60-100 bpm</td><td style="color:var(--green)">Normal Sinus Rhythm</td><td>Normal</td></tr>
    <tr><td>>100 bpm</td><td style="color:var(--red)">Tachycardia</td><td>Fever, anxiety, anemia, hyperthyroidism, SVT</td></tr>
  </table>
</section>

<!-- ======================== SECTION 6 ======================== -->
<section id="s6">
  <span class="level-badge level-inter">LEVEL 6 — CARDIAC AXIS</span>
  <h2>📐 Cardiac Axis — Dil Ka Direction</h2>
  <div class="card">
    <p>Cardiac axis = ventricular depolarization wave ka main direction (degrees mein). Ye batata hai ki signal kaunsi taraf jaa raha hai.</p>
  </div>
  <div id="axis-canvas-wrap">
    <canvas id="axisCanvas" width="400" height="400" style="max-width:100%; border-radius:10px; background:#050d12; border:1px solid #1a3040; cursor:pointer;"></canvas>
    <p style="color:var(--dim); font-size:0.8em; margin-top:6px">↑ Click to rotate axis (interactive)</p>
  </div>
  <table>
    <tr><th>Axis</th><th>Degrees</th><th>Lead I & aVF</th><th>Common Causes</th></tr>
    <tr><td><span class="normal">Normal</span></td><td>-30° to +90°</td><td>Both positive</td><td>Normal</td></tr>
    <tr><td><span style="color:var(--yellow)">Left Axis Deviation (LAD)</span></td><td>-30° to -90°</td><td>I positive, aVF negative</td><td>LBBB, Left anterior fascicular block, Inferior MI</td></tr>
    <tr><td><span style="color:var(--orange)">Right Axis Deviation (RAD)</span></td><td>>+90°</td><td>I negative, aVF positive</td><td>RBBB, Right ventricular hypertrophy, PE, Lateral MI</td></tr>
    <tr><td><span class="abnormal">Extreme RAD</span></td><td>-90° to ±180°</td><td>Both negative</td><td>Ventricular tachycardia, hyperkalemia</td></tr>
  </table>
  <div class="highlight tip">
    💡 <strong>Quick Axis Trick:</strong> Lead I aur aVF dekho.<br>
    ✅ Dono upward (positive) = Normal axis<br>
    👈 I up, aVF down = Left axis deviation<br>
    👉 I down, aVF up = Right axis deviation<br>
    ❌ Dono down = Extreme axis deviation
  </div>
</section>

<!-- ======================== SECTION 7 ======================== -->
<section id="s7">
  <span class="level-badge level-inter">LEVEL 7 — SYSTEMATIC READING</span>
  <h2>📋 ECG Report Padhne Ka Systematic Tarika</h2>
  <p style="color:var(--dim); margin-bottom:20px">Har ECG ko ek fixed order mein padhna chahiye — kuch miss nahi hoga.</p>
  <div class="step-flow">
    <div class="step" data-step="1">
      <div class="step-title">Rate (Heart Rate) Check Karo</div>
      <div style="color:var(--dim); font-size:0.88em">300 rule ya 1500 rule se calculate karo. Normal: 60-100 bpm. Tachy ya Brady hai?</div>
    </div>
    <div class="step" data-step="2">
      <div class="step-title">Rhythm Check Karo</div>
      <div style="color:var(--dim); font-size:0.88em">R-R intervals equal hain? P wave har QRS ke pehle hai? Regular? Sinus rhythm = har P ke baad QRS aata hai.</div>
    </div>
    <div class="step" data-step="3">
      <div class="step-title">P Wave Dekho</div>
      <div style="color:var(--dim); font-size:0.88em">Har QRS se pehle P wave hai? Shape kya hai? Duration &lt;120ms? II mein upright?</div>
    </div>
    <div class="step" data-step="4">
      <div class="step-title">PR Interval Measure Karo</div>
      <div style="color:var(--dim); font-size:0.88em">Normal: 120-200ms (3-5 small boxes). Lamba = Heart block. Chota = WPW/pre-excitation.</div>
    </div>
    <div class="step" data-step="5">
      <div class="step-title">QRS Complex Dekho</div>
      <div style="color:var(--dim); font-size:0.88em">Width &lt;120ms? Q waves pathological hain (>40ms aur >25% R height)? Voltage normal? LBBB/RBBB?</div>
    </div>
    <div class="step" data-step="6">
      <div class="step-title">Cardiac Axis Calculate Karo</div>
      <div style="color:var(--dim); font-size:0.88em">Lead I aur aVF dekho. Normal axis? LAD? RAD? (Upar table dekho)</div>
    </div>
    <div class="step" data-step="7">
      <div class="step-title">ST Segment & T Wave Dekho</div>
      <div style="color:var(--dim); font-size:0.88em">ST elevation? (STEMI!) ST depression? (NSTEMI/Ischemia) T wave inverted? Hyperacute T waves?</div>
    </div>
    <div class="step" data-step="8">
      <div class="step-title">QT Interval Measure Karo</div>
      <div style="color:var(--dim); font-size:0.88em">QTc calculate karo = QT ÷ √(R-R in seconds). Normal &lt;440ms men, &lt;460ms women. Long QT = dangerous arrhythmia risk.</div>
    </div>
    <div class="step" data-step="9">
      <div class="step-title">Conclusion / Impression Likho</div>
      <div style="color:var(--dim); font-size:0.88em">Normal sinus rhythm? STEMI? AF? LBBB? Sab findings combine karo ek final statement mein.</div>
    </div>
  </div>
  <div class="highlight">
    ✅ <strong>Mnemonic:</strong> <strong>R-RAPE-QQST</strong> — Rate, Rhythm, Axis, P wave, PR, Everything (QRS), QT, ST/T
  </div>
</section>

<!-- ======================== SECTION 8 ======================== -->
<section id="s8">
  <span class="level-badge level-deep">LEVEL 8 — DEEP / ABNORMAL PATTERNS</span>
  <h2>🚨 Important Abnormal ECG Patterns</h2>
  <div class="pattern-grid">
    <div class="pattern-card">
      <div class="p-title">🔴 STEMI (Myocardial Infarction)</div>
      <div class="p-ecg">ST elevation ≥1mm (limb) / ≥2mm (chest) in ≥2 contiguous leads</div>
      <div class="p-desc">Heart attack! Full thickness infarct. Emergency coronary angioplasty (PCI) needed within 90 mins. Later Q waves develop (pathological Q = >40ms, >25% R).</div>
    </div>
    <div class="pattern-card">
      <div class="p-title">🟠 NSTEMI / Ischemia</div>
      <div class="p-ecg">ST depression, T wave inversion, no ST elevation</div>
      <div class="p-desc">Partial thickness infarct ya ischemia. Troponin elevated hoga. Less urgent but still emergency.</div>
    </div>
    <div class="pattern-card">
      <div class="p-title">💜 Atrial Fibrillation (AF)</div>
      <div class="p-ecg">No P waves + Irregularly irregular rhythm + Fibrillatory baseline</div>
      <div class="p-desc">Atria chaotically fire kar rahe hain. Most common arrhythmia. Stroke risk high. Rate control + anticoagulation.</div>
    </div>
    <div class="pattern-card">
      <div class="p-title">🔵 1st Degree Heart Block</div>
      <div class="p-ecg">PR interval >200ms (>5 big boxes)</div>
      <div class="p-desc">AV node mein delay hai. Benign usually. P wave har QRS ke pehle aata hai. Causes: vagal tone, beta-blockers, inferior MI.</div>
    </div>
    <div class="pattern-card">
      <div class="p-title">🟡 Left Bundle Branch Block (LBBB)</div>
      <div class="p-ecg">QRS >120ms + WILLIAM pattern (V1=W, V6=M)</div>
      <div class="p-desc">Left bundle branch blocked hai. New LBBB in chest pain = STEMI equivalent! Emergency treatment.</div>
    </div>
    <div class="pattern-card">
      <div class="p-title">🟢 Right Bundle Branch Block (RBBB)</div>
      <div class="p-ecg">QRS >120ms + MARROW pattern (V1=M, V6=W)</div>
      <div class="p-desc">Right bundle blocked. Often benign. RSR' pattern in V1 (bunny ears). Can be seen in PE, RVH, ASD.</div>
    </div>
    <div class="pattern-card">
      <div class="p-title">⚡ Ventricular Tachycardia (VT)</div>
      <div class="p-ecg">Wide QRS (>120ms) + Rate >100 + AV dissociation</div>
      <div class="p-desc">Life-threatening! Ventricles khud pace kar rahe hain, AV node bypass karke. Defibrillation/Cardioversion needed.</div>
    </div>
    <div class="pattern-card">
      <div class="p-title">⚡ Ventricular Fibrillation (VF)</div>
      <div class="p-ecg">Chaotic baseline, no recognizable waves</div>
      <div class="p-desc">Cardiac arrest! CPR + immediate defibrillation. Agar treat nahi kiya — death in minutes.</div>
    </div>
    <div class="pattern-card">
      <div class="p-title">🔥 Hyperkalemia (High K⁺)</div>
      <div class="p-ecg">Peaked T waves → Wide QRS → Sine wave → VF</div>
      <div class="p-desc">Progressive sequence. Tall tent-like T waves pehle aate hain. Calcium gluconate dena urgent.</div>
    </div>
    <div class="pattern-card">
      <div class="p-title">💉 Hypokalemia (Low K⁺)</div>
      <div class="p-ecg">Flattened T waves + Prominent U waves + ST depression</div>
      <div class="p-desc">Potassium replace karo. Long QT bhi ho sakta hai → Torsades risk.</div>
    </div>
    <div class="pattern-card">
      <div class="p-title">🏃 WPW Syndrome</div>
      <div class="p-ecg">Short PR (<120ms) + Delta wave + Wide QRS</div>
      <div class="p-desc">Accessory pathway (Bundle of Kent) hai jo AV node ko bypass karta hai. Tachycardia episodes ho sakte hain. RF ablation curative.</div>
    </div>
    <div class="pattern-card">
      <div class="p-title">❄️ Hypothermia</div>
      <div class="p-ecg">J wave (Osborn wave) + Bradycardia + Prolonged intervals</div>
      <div class="p-desc">J wave = positive deflection at end of QRS. Classic finding in hypothermia. Sinus bradycardia common.</div>
    </div>
  </div>
</section>

<!-- ======================== SECTION 9 ======================== -->
<section id="s9">
  <span class="level-badge level-deep">LEVEL 9 — QUIZ</span>
  <h2>🧠 Quick Quiz — Test Yourself!</h2>

  <div class="quiz-box" id="q1">
    <div class="quiz-q">Q1. Ek patient ki ECG mein PR interval 240ms hai. Ye kya suggest karta hai?</div>
    <div class="quiz-opts">
      <button onclick="ans(this,'q1',false)">A. Normal finding</button>
      <button onclick="ans(this,'q1',false)">B. WPW Syndrome</button>
      <button onclick="ans(this,'q1',true)">C. 1st Degree Heart Block</button>
      <button onclick="ans(this,'q1',false)">D. Atrial Fibrillation</button>
    </div>
    <div class="quiz-feedback" id="fb_q1" style="background:#0a3a1a; color:var(--green)">✅ Correct! PR > 200ms = 1st degree heart block. AV node mein conduction delay hai.</div>
  </div>

  <div class="quiz-box" id="q2" style="margin-top:16px">
    <div class="quiz-q">Q2. Lead II mein ST elevation aur III, aVF mein bhi ST elevation. Kaunsi artery blocked hai?</div>
    <div class="quiz-opts">
      <button onclick="ans(this,'q2',false)">A. LAD (Left Anterior Descending)</button>
      <button onclick="ans(this,'q2',false)">B. Left Circumflex</button>
      <button onclick="ans(this,'q2',true)">C. Right Coronary Artery (RCA)</button>
      <button onclick="ans(this,'q2',false)">D. Left Main Coronary</button>
    </div>
    <div class="quiz-feedback" id="fb_q2" style="background:#0a3a1a; color:var(--green)">✅ Correct! II, III, aVF = Inferior leads = RCA territory. Inferior STEMI!</div>
  </div>

  <div class="quiz-box" id="q3" style="margin-top:16px">
    <div class="quiz-q">Q3. ECG mein koi P wave nahi hai, rhythm irregularly irregular hai. Diagnosis kya hai?</div>
    <div class="quiz-opts">
      <button onclick="ans(this,'q3',false)">A. Ventricular Tachycardia</button>
      <button onclick="ans(this,'q3',true)">B. Atrial Fibrillation</button>
      <button onclick="ans(this,'q3',false)">C. Complete Heart Block</button>
      <button onclick="ans(this,'q3',false)">D. SVT (Supraventricular Tachycardia)</button>
    </div>
    <div class="quiz-feedback" id="fb_q3" style="background:#0a3a1a; color:var(--green)">✅ Correct! AF = No P waves + Irregularly irregular = Classic AF pattern.</div>
  </div>

  <div class="quiz-box" id="q4" style="margin-top:16px">
    <div class="quiz-q">Q4. ECG paper pe do R waves ke beech 3 big boxes hain. Heart rate kya hai?</div>
    <div class="quiz-opts">
      <button onclick="ans(this,'q4',false)">A. 60 bpm</button>
      <button onclick="ans(this,'q4',false)">B. 75 bpm</button>
      <button onclick="ans(this,'q4',true)">C. 100 bpm</button>
      <button onclick="ans(this,'q4',false)">D. 150 bpm</button>
    </div>
    <div class="quiz-feedback" id="fb_q4" style="background:#0a3a1a; color:var(--green)">✅ Correct! 300 ÷ 3 = 100 bpm. Normal upper limit. Just at the edge!</div>
  </div>
</section>

</main>

<footer>
  Sources: Costanzo Physiology 7e | Goldman-Cecil Medicine | Medical Physiology (Boron &amp; Boulpaep) | Miller's Anesthesia 10e<br>
  Educational use only. Clinical decisions ke liye qualified physician se consult karein.
</footer>

<!-- ======================== SCRIPTS ======================== -->
<script>
// ===== LIVE ECG MONITOR =====
const ecgCanvas = document.getElementById('ecgLine');
const ecgCtx = ecgCanvas.getContext('2d');
let ecgW, ecgH, ecgX = 0;
const ecgData = [];

function resizeECG() {
  ecgW = ecgCanvas.parentElement.clientWidth;
  ecgH = 120;
  ecgCanvas.width = ecgW;
  ecgCanvas.height = ecgH;
}

function ecgWaveform(x) {
  // One cardiac cycle over ~160px
  const cycle = 160;
  const t = (x % cycle) / cycle;
  const baseline = 0;
  if (t < 0.10) return baseline; // flat
  if (t < 0.14) return (t-0.10)/0.04 * 0.08; // P up
  if (t < 0.20) return 0.08 - (t-0.14)/0.06 * 0.08; // P down
  if (t < 0.30) return baseline; // PR segment
  if (t < 0.33) return -(t-0.30)/0.03 * 0.12; // Q down
  if (t < 0.37) return -0.12 + (t-0.33)/0.04 * 1.12; // R up
  if (t < 0.40) return 1.0 - (t-0.37)/0.03 * 1.15; // S down
  if (t < 0.43) return -0.15 + (t-0.40)/0.03 * 0.15; // back to base
  if (t < 0.52) return baseline; // ST segment
  if (t < 0.62) return Math.sin((t-0.52)/0.10 * Math.PI) * 0.22; // T wave
  return baseline;
}

let ecgOffset = 0;
function drawECG() {
  resizeECG();
  ecgCtx.fillStyle = '#050d12';
  ecgCtx.fillRect(0, 0, ecgW, ecgH);

  // Grid
  ecgCtx.strokeStyle = 'rgba(0,80,30,0.3)';
  ecgCtx.lineWidth = 0.5;
  for (let x = 0; x < ecgW; x += 20) { ecgCtx.beginPath(); ecgCtx.moveTo(x,0); ecgCtx.lineTo(x,ecgH); ecgCtx.stroke(); }
  for (let y = 0; y < ecgH; y += 20) { ecgCtx.beginPath(); ecgCtx.moveTo(0,y); ecgCtx.lineTo(ecgW,y); ecgCtx.stroke(); }

  // Waveform
  ecgCtx.beginPath();
  ecgCtx.strokeStyle = '#00ff88';
  ecgCtx.lineWidth = 2;
  ecgCtx.shadowColor = '#00ff88';
  ecgCtx.shadowBlur = 6;
  for (let x = 0; x < ecgW; x++) {
    const v = ecgWaveform(x + ecgOffset);
    const y = ecgH/2 - v * (ecgH * 0.38);
    if (x === 0) ecgCtx.moveTo(x, y);
    else ecgCtx.lineTo(x, y);
  }
  ecgCtx.stroke();
  ecgCtx.shadowBlur = 0;
  ecgOffset += 1.5;
  requestAnimationFrame(drawECG);
}
drawECG();

// ===== HEART CONDUCTION ANIMATION =====
const hc = document.getElementById('heartCanvas');
const hctx = hc.getContext('2d');
let heartPhase = 0;
let heartPaused = false;
hc.addEventListener('click', () => heartPaused = !heartPaused);

const nodes = [
  { name: 'SA Node', x: 390, y: 90, r: 14, color: '#ffdd44' },
  { name: 'AV Node', x: 310, y: 200, r: 12, color: '#ff8833' },
  { name: 'Bundle of His', x: 310, y: 240, r: 8, color: '#ff8833' },
  { name: 'LBB', x: 260, y: 280, r: 9, color: '#00ff88' },
  { name: 'RBB', x: 360, y: 280, r: 9, color: '#4488ff' },
  { name: 'Purkinje (L)', x: 220, y: 330, r: 8, color: '#00ff88' },
  { name: 'Purkinje (R)', x: 400, y: 330, r: 8, color: '#4488ff' },
];

const paths = [
  { from: 0, to: 1, delay: 0.1, color: '#ffdd44' },
  { from: 1, to: 2, delay: 0.25, color: '#ff8833' },
  { from: 2, to: 3, delay: 0.35, color: '#00ff88' },
  { from: 2, to: 4, delay: 0.35, color: '#4488ff' },
  { from: 3, to: 5, delay: 0.48, color: '#00ff88' },
  { from: 4, to: 6, delay: 0.48, color: '#4488ff' },
];

function drawHeart() {
  if (!heartPaused) heartPhase = (heartPhase + 0.008) % 1;
  hctx.clearRect(0, 0, hc.width, hc.height);
  hctx.fillStyle = '#050d12';
  hctx.fillRect(0, 0, hc.width, hc.height);

  // Heart outline (simple)
  hctx.strokeStyle = '#1a3a2a';
  hctx.lineWidth = 1;
  hctx.beginPath();
  // Left side border
  hctx.moveTo(200, 80);
  hctx.bezierCurveTo(170, 60, 120, 100, 150, 180);
  hctx.bezierCurveTo(170, 240, 260, 310, 310, 360);
  hctx.bezierCurveTo(360, 310, 450, 240, 470, 180);
  hctx.bezierCurveTo(500, 100, 450, 60, 420, 80);
  hctx.bezierCurveTo(410, 50, 370, 40, 310, 80);
  hctx.bezierCurveTo(250, 40, 210, 50, 200, 80);
  hctx.closePath();
  hctx.fillStyle = 'rgba(30,10,10,0.8)';
  hctx.fill();
  hctx.strokeStyle = '#2a1a1a';
  hctx.stroke();

  // Labels
  hctx.font = '11px Arial';
  hctx.fillStyle = '#445566';
  hctx.fillText('Right Atrium', 350, 70);
  hctx.fillText('Left Ventricle', 160, 290);
  hctx.fillText('Right Ventricle', 370, 290);
  hctx.fillText('AV Septum', 280, 230);

  // Paths (animated)
  paths.forEach(p => {
    const from = nodes[p.from];
    const to = nodes[p.to];
    const localPhase = (heartPhase - p.delay + 1) % 1;
    const progress = Math.min(1, localPhase / 0.15);

    hctx.beginPath();
    hctx.strokeStyle = 'rgba(255,255,255,0.08)';
    hctx.lineWidth = 2;
    hctx.moveTo(from.x, from.y);
    hctx.lineTo(to.x, to.y);
    hctx.stroke();

    if (localPhase < 0.3) {
      const ex = from.x + (to.x - from.x) * progress;
      const ey = from.y + (to.y - from.y) * progress;
      hctx.beginPath();
      hctx.strokeStyle = p.color;
      hctx.lineWidth = 3;
      hctx.shadowColor = p.color;
      hctx.shadowBlur = 10;
      hctx.moveTo(from.x, from.y);
      hctx.lineTo(ex, ey);
      hctx.stroke();
      hctx.shadowBlur = 0;
    }
  });

  // Nodes
  nodes.forEach((n, i) => {
    const pulse = paths.some(p => p.from === i && (heartPhase - p.delay + 1) % 1 < 0.2);
    const r = n.r + (pulse ? 3 : 0);
    hctx.beginPath();
    hctx.arc(n.x, n.y, r, 0, Math.PI*2);
    hctx.fillStyle = n.color;
    hctx.shadowColor = n.color;
    hctx.shadowBlur = pulse ? 20 : 8;
    hctx.fill();
    hctx.shadowBlur = 0;
    hctx.font = 'bold 10px Arial';
    hctx.fillStyle = '#000';
    hctx.textAlign = 'center';
    hctx.textBaseline = 'middle';
    hctx.fillText(n.name.split(' ')[0], n.x, n.y);
    hctx.fillStyle = '#aabbcc';
    hctx.font = '10px Arial';
    hctx.fillText(n.name, n.x, n.y + r + 10);
    hctx.textAlign = 'left';
  });

  requestAnimationFrame(drawHeart);
}
drawHeart();

// ===== WAVE DIAGRAM =====
const wc = document.getElementById('waveCanvas');
const wctx = wc.getContext('2d');
wc.width = wc.parentElement.clientWidth || 800;
wc.height = 200;

function drawWaveDiagram() {
  wc.width = wc.parentElement.clientWidth || 800;
  const W = wc.width, H = 200;
  wctx.fillStyle = '#050d12';
  wctx.fillRect(0, 0, W, H);

  // Grid
  wctx.strokeStyle = 'rgba(0,60,30,0.4)';
  wctx.lineWidth = 0.5;
  for (let x = 0; x < W; x += W/20) { wctx.beginPath(); wctx.moveTo(x,0); wctx.lineTo(x,H); wctx.stroke(); }
  for (let y = 0; y < H; y += H/5) { wctx.beginPath(); wctx.moveTo(0,y); wctx.lineTo(W,y); wctx.stroke(); }

  const mid = H * 0.62;
  const scale = H * 0.35;
  const startX = W * 0.07;

  // Define wave points
  const cycle = W * 0.86;

  // Helper
  function seg(points, color, lineW) {
    wctx.beginPath();
    wctx.strokeStyle = color;
    wctx.lineWidth = lineW || 2.5;
    wctx.shadowColor = color; wctx.shadowBlur = 5;
    points.forEach((p, i) => i===0 ? wctx.moveTo(startX+p[0]*cycle, mid - p[1]*scale) : wctx.lineTo(startX+p[0]*cycle, mid - p[1]*scale));
    wctx.stroke();
    wctx.shadowBlur = 0;
  }

  // Baseline before P
  seg([[0,0],[0.10,0]], '#445566', 1.5);
  // P wave
  seg([[0.10,0],[0.13,0.03],[0.16,0.12],[0.19,0.03],[0.22,0]], '#4488ff', 2.5);
  // PR segment
  seg([[0.22,0],[0.32,0]], '#ff8833', 1.5);
  // Q
  seg([[0.32,0],[0.35,-0.08]], '#00ff88', 2.5);
  // R spike
  seg([[0.35,-0.08],[0.39,1.0],[0.43,-0.12]], '#00ff88', 3);
  // S back to baseline
  seg([[0.43,-0.12],[0.46,0]], '#00ff88', 2.5);
  // ST segment
  seg([[0.46,0],[0.56,0]], '#ffdd44', 1.5);
  // T wave
  seg([[0.56,0],[0.62,0.05],[0.69,0.22],[0.75,0.05],[0.80,0]], '#ff4466', 2.5);
  // After T
  seg([[0.80,0],[1.0,0]], '#445566', 1.5);

  // Labels
  function lbl(text, x, y, color) {
    wctx.font = 'bold 12px Arial';
    wctx.fillStyle = color;
    wctx.textAlign = 'center';
    wctx.fillText(text, startX + x*cycle, mid - y*scale);
  }
  lbl('P', 0.16, 0.22, '#4488ff');
  lbl('Q', 0.33, -0.2, '#00ff88');
  lbl('R', 0.39, 1.15, '#00ff88');
  lbl('S', 0.44, -0.22, '#00ff88');
  lbl('T', 0.69, 0.35, '#ff4466');

  // Bracket labels
  function bracket(x1, x2, y, color, text) {
    const y2 = mid + y;
    wctx.strokeStyle = color; wctx.lineWidth = 1.5;
    wctx.beginPath();
    wctx.moveTo(startX+x1*cycle, y2); wctx.lineTo(startX+x2*cycle, y2);
    wctx.moveTo(startX+x1*cycle, y2-5); wctx.lineTo(startX+x1*cycle, y2+5);
    wctx.moveTo(startX+x2*cycle, y2-5); wctx.lineTo(startX+x2*cycle, y2+5);
    wctx.stroke();
    wctx.font = '10px Arial'; wctx.fillStyle = color; wctx.textAlign = 'center';
    wctx.fillText(text, startX+(x1+x2)/2*cycle, y2+16);
  }

  bracket(0.10, 0.32, 28, '#ff8833', 'PR interval (120-200ms)');
  bracket(0.32, 0.46, 44, '#00ff88', 'QRS (<120ms)');
  bracket(0.46, 0.80, 28, '#ffdd44', 'ST seg + T = QT interval');
  bracket(0.10, 0.80, 62, '#aa66ff', 'QT interval');

  wctx.textAlign = 'left';
}
drawWaveDiagram();
window.addEventListener('resize', drawWaveDiagram);

// ===== ECG PAPER =====
const pc = document.getElementById('paperCanvas');
const pctx = pc.getContext('2d');
pc.width = pc.parentElement.clientWidth || 800;
pc.height = 200;

function drawPaper() {
  pc.width = pc.parentElement.clientWidth || 800;
  const W = pc.width, H = 200;
  pctx.fillStyle = '#050d12';
  pctx.fillRect(0,0,W,H);

  const cellSm = 20; // 1mm = 20px

  // Small boxes
  pctx.strokeStyle = 'rgba(0,100,50,0.35)';
  pctx.lineWidth = 0.5;
  for (let x = 0; x <= W; x += cellSm) { pctx.beginPath(); pctx.moveTo(x,0); pctx.lineTo(x,H); pctx.stroke(); }
  for (let y = 0; y <= H; y += cellSm) { pctx.beginPath(); pctx.moveTo(0,y); pctx.lineTo(W,y); pctx.stroke(); }

  // Big boxes (5x5)
  pctx.strokeStyle = 'rgba(0,180,80,0.6)';
  pctx.lineWidth = 1;
  for (let x = 0; x <= W; x += cellSm*5) { pctx.beginPath(); pctx.moveTo(x,0); pctx.lineTo(x,H); pctx.stroke(); }
  for (let y = 0; y <= H; y += cellSm*5) { pctx.beginPath(); pctx.moveTo(0,y); pctx.lineTo(W,y); pctx.stroke(); }

  // Labels
  pctx.font = '11px Arial'; pctx.fillStyle = '#00ff88'; pctx.textAlign = 'center';
  pctx.fillText('1 small box = 0.04s / 0.1mV', cellSm*2.5, H-5);
  pctx.fillText('1 big box = 0.2s / 0.5mV', cellSm*2.5 + cellSm*5, H-5);

  // Arrows
  pctx.strokeStyle = '#ffdd44'; pctx.lineWidth = 1.5;
  // Horizontal time arrow
  pctx.beginPath(); pctx.moveTo(10, 15); pctx.lineTo(W-10, 15);
  pctx.moveTo(W-20, 10); pctx.lineTo(W-10, 15); pctx.lineTo(W-20, 20); pctx.stroke();
  pctx.fillStyle = '#ffdd44'; pctx.font = '11px Arial'; pctx.textAlign = 'left';
  pctx.fillText('TIME →', W-70, 13);

  // Vertical amplitude arrow
  pctx.beginPath(); pctx.moveTo(15, H-10); pctx.lineTo(15, 10);
  pctx.moveTo(10, 20); pctx.lineTo(15, 10); pctx.lineTo(20, 20); pctx.stroke();
  pctx.save(); pctx.translate(10, H/2); pctx.rotate(-Math.PI/2);
  pctx.fillStyle = '#ff8833'; pctx.textAlign = 'center'; pctx.fillText('VOLTAGE (mV) ↑', 0, 0);
  pctx.restore();
}
drawPaper();

// ===== LEAD MINI WAVEFORMS =====
const leads = [
  { name: 'I', info: 'Lateral — RA to LA', territory: 'High Lateral', type: 'lat' },
  { name: 'II', info: 'Inferior — RA to LL', territory: 'Inferior', type: 'inf' },
  { name: 'III', info: 'Inferior — LA to LL', territory: 'Inferior', type: 'inf' },
  { name: 'aVR', info: 'Augmented — RA', territory: 'Cavity view', type: 'avr' },
  { name: 'aVL', info: 'Augmented — LA', territory: 'High Lateral', type: 'lat' },
  { name: 'aVF', info: 'Augmented — LL (Foot)', territory: 'Inferior', type: 'inf' },
  { name: 'V1', info: 'Chest — Right sternal', territory: 'Septal', type: 'ant' },
  { name: 'V2', info: 'Chest — Left sternal', territory: 'Septal', type: 'ant' },
  { name: 'V3', info: 'Chest — Anterior', territory: 'Anterior', type: 'ant' },
  { name: 'V4', info: 'Chest — Apex', territory: 'Anterior', type: 'ant' },
  { name: 'V5', info: 'Chest — Lateral', territory: 'Lateral', type: 'lat' },
  { name: 'V6', info: 'Chest — Lateral', territory: 'Lateral', type: 'lat' },
];

const grid = document.getElementById('leadGrid');
leads.forEach(lead => {
  const div = document.createElement('div');
  div.className = 'lead-box';
  const colors = { inf: '#ffdd44', lat: '#00ff88', ant: '#4488ff', avr: '#ff4466' };
  const c = colors[lead.type] || '#aaa';
  div.innerHTML = `<div class="lead-name" style="color:${c}">${lead.name}</div>
    <div class="lead-info">${lead.info}</div>
    <div class="lead-info" style="color:${c}">${lead.territory}</div>
    <canvas width="140" height="55"></canvas>`;
  grid.appendChild(div);

  const canvas = div.querySelector('canvas');
  const ctx = canvas.getContext('2d');
  ctx.fillStyle = '#050d12';
  ctx.fillRect(0, 0, 140, 55);
  ctx.strokeStyle = c;
  ctx.lineWidth = 1.5;
  ctx.shadowColor = c; ctx.shadowBlur = 4;
  ctx.beginPath();
  const mid2 = 30, sc2 = 20;
  const isAVR = lead.name === 'aVR';
  const flip = isAVR ? -1 : 1;
  const pts = [[0,0],[0.1,0],[0.16,flip*0.08],[0.22,0],[0.32,0],[0.35,flip*-0.1],[0.39,flip*0.95],[0.43,flip*-0.15],[0.46,0],[0.56,0],[0.69,flip*0.18],[0.80,0],[1.0,0]];
  pts.forEach((p,i) => i===0 ? ctx.moveTo(10+p[0]*120, mid2-p[1]*sc2) : ctx.lineTo(10+p[0]*120, mid2-p[1]*sc2));
  ctx.stroke();
  ctx.shadowBlur = 0;
});

// ===== RATE CALCULATOR =====
const slider = document.getElementById('rrSlider');
const rrVal = document.getElementById('rrVal');
const hrResult = document.getElementById('hrResult');
const hrClass = document.getElementById('hrClassify');
slider.addEventListener('input', () => {
  const v = parseFloat(slider.value);
  rrVal.textContent = v;
  const hr = Math.round(300 / v);
  hrResult.textContent = hr + ' bpm';
  if (hr < 60) { hrClass.textContent = '⚠️ Bradycardia (<60 bpm)'; hrClass.style.color='#4488ff'; }
  else if (hr <= 100) { hrClass.textContent = '✅ Normal Sinus Rate (60-100 bpm)'; hrClass.style.color='#00ff88'; }
  else { hrClass.textContent = '⚡ Tachycardia (>100 bpm)'; hrClass.style.color='#ff4466'; }
});

// ===== AXIS DIAGRAM =====
const ac = document.getElementById('axisCanvas');
const actx = ac.getContext('2d');
let axisDeg = 60;
ac.addEventListener('click', () => { axisDeg = (axisDeg + 30) % 360; drawAxis(); });

function drawAxis() {
  actx.clearRect(0,0,400,400);
  actx.fillStyle = '#050d12';
  actx.fillRect(0,0,400,400);
  const cx=200, cy=200, r=140;

  // Background zones
  function zone(start, end, color) {
    actx.beginPath();
    actx.moveTo(cx,cy);
    actx.arc(cx,cy,r, (start-90)*Math.PI/180, (end-90)*Math.PI/180);
    actx.closePath();
    actx.fillStyle = color;
    actx.fill();
  }
  zone(-30,90,'rgba(0,255,136,0.06)');  // Normal
  zone(90,180,'rgba(255,136,50,0.08)'); // RAD
  zone(-90,-30,'rgba(255,220,50,0.08)');// LAD
  zone(180,270,'rgba(255,50,50,0.06)'); // Extreme

  // Circle
  actx.strokeStyle = '#1a3040'; actx.lineWidth = 1.5;
  actx.beginPath(); actx.arc(cx,cy,r,0,Math.PI*2); actx.stroke();

  // Lead lines
  const leadLines = [
    {name:'I',   angle:0,  color:'#00ff88'},
    {name:'II',  angle:60, color:'#ffdd44'},
    {name:'III', angle:120,color:'#ffdd44'},
    {name:'aVR', angle:-150+180,color:'#ff4466'},
    {name:'aVL', angle:-30,color:'#00ff88'},
    {name:'aVF', angle:90, color:'#4488ff'},
  ];
  leadLines.forEach(l => {
    const rad = (l.angle - 90) * Math.PI / 180;
    actx.strokeStyle = 'rgba(255,255,255,0.15)'; actx.lineWidth = 1;
    actx.beginPath();
    actx.moveTo(cx - Math.cos(rad)*r, cy - Math.sin(rad)*r);
    actx.lineTo(cx + Math.cos(rad)*r, cy + Math.sin(rad)*r);
    actx.stroke();
    actx.fillStyle = l.color; actx.font = 'bold 12px Arial'; actx.textAlign = 'center';
    actx.fillText(l.name, cx + Math.cos(rad)*(r+16), cy + Math.sin(rad)*(r+16) + 4);
  });

  // Degree marks
  actx.fillStyle = '#334455'; actx.font = '9px Arial'; actx.textAlign = 'center';
  [-90,-60,-30,0,30,60,90,120,150,180].forEach(deg => {
    const rad = (deg-90)*Math.PI/180;
    actx.fillText(deg+'°', cx+Math.cos(rad)*(r-20), cy+Math.sin(rad)*(r-20)+4);
  });

  // Axis arrow
  const aRad = (axisDeg - 90) * Math.PI / 180;
  actx.strokeStyle = '#ff4466'; actx.lineWidth = 3;
  actx.shadowColor = '#ff4466'; actx.shadowBlur = 12;
  actx.beginPath();
  actx.moveTo(cx,cy);
  actx.lineTo(cx+Math.cos(aRad)*r*0.85, cy+Math.sin(aRad)*r*0.85);
  actx.stroke();
  actx.shadowBlur = 0;

  // Arrowhead
  actx.fillStyle = '#ff4466';
  actx.beginPath();
  actx.arc(cx+Math.cos(aRad)*r*0.85, cy+Math.sin(aRad)*r*0.85, 6, 0, Math.PI*2);
  actx.fill();

  // Label
  let axisLabel, axisColor;
  const d = ((axisDeg % 360) + 360) % 360;
  const norm = d <= 90 || d >= 330;
  const lad = (d >= 270 && d < 330);
  const rad2 = (d > 90 && d < 270);
  if (norm) { axisLabel = `Normal Axis (${axisDeg}°)`; axisColor = '#00ff88'; }
  else if (lad) { axisLabel = `Left Axis Deviation (${axisDeg}°)`; axisColor = '#ffdd44'; }
  else if (rad2 && d <= 180) { axisLabel = `Right Axis Deviation (${axisDeg}°)`; axisColor = '#ff8833'; }
  else { axisLabel = `Extreme Axis (${axisDeg}°)`; axisColor = '#ff4466'; }

  actx.fillStyle = axisColor; actx.font = 'bold 13px Arial'; actx.textAlign = 'center';
  actx.fillText(axisLabel, cx, 22);
  actx.fillStyle = '#445566'; actx.font = '11px Arial';
  actx.fillText('(Click to rotate)', cx, 385);

  // Zone labels
  actx.font = '10px Arial'; actx.fillStyle = 'rgba(0,255,136,0.5)'; actx.textAlign = 'center';
  actx.fillText('NORMAL', cx+60, cy-20);
  actx.fillStyle = 'rgba(255,136,50,0.5)';
  actx.fillText('RAD', cx+80, cy+80);
  actx.fillStyle = 'rgba(255,220,50,0.5)';
  actx.fillText('LAD', cx-70, cy-80);
  actx.fillStyle = 'rgba(255,50,50,0.5)';
  actx.fillText('EXTREME', cx-70, cy+70);
}
drawAxis();

// ===== QUIZ =====
function ans(btn, qid, correct) {
  const btns = btn.parentElement.querySelectorAll('button');
  btns.forEach(b => b.disabled = true);
  btn.classList.add(correct ? 'correct' : 'wrong');
  const fb = document.getElementById('fb_' + qid);
  fb.style.display = 'block';
  if (!correct) {
    fb.style.background = '#3a0a0a';
    fb.style.color = '#ff4466';
    fb.textContent = '❌ Wrong! ' + fb.textContent.replace(/^✅ Correct! /,'');
  }
}
</script>
</body>
</html>
Running Command

wc -c /home/daytona/workspace/ecg-guide/ECG_Zero_to_Deep.html && echo "File size OK"

Bhai, teri file taiyaar hai! 🎉

⚡ ECG - Zero to Deep Level Interactive Guide

Download kar aur browser mein khol:

ECG Zero to Deep

HTML File · HTML


Is file mein kya-kya hai? (9 Levels)

LevelTopicFeatures
0ECG kya haiSimple explanation, kab/kaise hota hai
1Heart ka Electrical SystemLive animated conduction diagram - SA → AV → Bundle → Purkinje glow karta dikhega
2Waves & IntervalsAnimated labeled waveform - P, QRS, T, ST, QT sab color-coded
3ECG PaperInteractive paper grid - time vs voltage explained visually
412 Leads12 mini ECG waveforms - har lead ka territory dikhata hai
5Heart RateInteractive slider calculator - RR interval drag karo, rate calculate
6Cardiac AxisClick-to-rotate axis diagram - Normal/LAD/RAD zones dikhata hai
7Systematic ReadingStep-by-step 9-step protocol
8Abnormal Patterns12 diseases - STEMI, AF, VT, Hyperkalemia sab
9Quiz4 interactive questions with instant feedback

Quick Reference - Sabse Important Numbers

Wave/IntervalNormal ValueYaad karo
P wave<120ms, <2.5mm3 small boxes
PR interval120-200ms3-5 small boxes
QRS<120ms3 small boxes
QTc<440ms (men)2 big boxes
ST segmentIsoelectric (flat)Elevated = Emergency!
Heart Rate60-100 bpm300 ÷ big boxes = HR

ECG Report Padhne Ka Order (9 Steps)

R-R-P-PR-QRS-Axis-ST-QT-Conclusion
  1. Rate 2. Rhythm 3. P waves 4. PR interval 5. QRS 6. Axis 7. ST/T 8. QT 9. Summary
Sources: Costanzo Physiology 7e | Goldman-Cecil Medicine | Boron & Boulpaep Medical Physiology | Miller's Anesthesia 10e
This is a shared conversation. Sign in to Orris to start your own chat.