Psychologist Clinical Review

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PPU Clinical Card Viewer — 4 Deck Suite</title>
<link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Jost:wght@300;400;500;600&display=swap" rel="stylesheet">
<style>
:root {
  --burg:       #6B1A2A;
  --burg-deep:  #4A0F1C;
  --burg-mid:   #8B2438;
  --burg-light: #F5E8EB;
  --burg-pale:  #FBF3F5;
  --gold:       #C9963A;
  --gold-light: #E8C67A;
  --gold-pale:  #FDF6E8;
  --gold-dark:  #9A7020;
  --cream:      #FAF7F2;
  --ink:        #1C1008;
  --ink-mid:    #4A3728;
  --ink-light:  #8A7060;
  --border:     rgba(107,26,42,0.15);
  --shadow:     0 4px 24px rgba(74,15,28,0.12);
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
body{font-family:'Jost',sans-serif;background:var(--cream);color:var(--ink);min-height:100vh}
body::before{content:'';position:fixed;inset:0;background:radial-gradient(ellipse 80% 60% at 10% 20%,rgba(107,26,42,0.05) 0%,transparent 60%),radial-gradient(ellipse 60% 80% at 90% 80%,rgba(201,150,58,0.05) 0%,transparent 60%);pointer-events:none;z-index:0}
.wrap{position:relative;z-index:1;max-width:1060px;margin:0 auto;padding:0 20px 60px}

/* Header */
.hdr{display:flex;align-items:center;justify-content:space-between;padding:24px 0 20px;border-bottom:1px solid var(--border);margin-bottom:28px}
.logo{font-family:'Cormorant Garamond',serif;font-size:20px;font-weight:600;color:var(--burg-deep)}
.logo span{color:var(--gold)}
.logo small{display:block;font-family:'Jost',sans-serif;font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-light);font-weight:500;margin-top:2px}
.hdr-right{display:flex;align-items:center;gap:10px}
.badge{background:var(--burg-light);border:1px solid rgba(107,26,42,.2);border-radius:20px;padding:4px 12px;font-size:11px;color:var(--burg);font-weight:600;letter-spacing:.05em}
.export-btn{background:var(--burg);color:white;border:none;border-radius:6px;padding:7px 14px;font-size:11px;font-family:'Jost',sans-serif;font-weight:500;cursor:pointer;letter-spacing:.04em}
.export-btn:hover{background:var(--burg-deep)}

/* Deck selector */
.deck-selector{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:24px}
.deck-btn{padding:12px 8px;border-radius:10px;border:1.5px solid var(--border);background:white;cursor:pointer;text-align:center;transition:all .2s;font-family:'Jost',sans-serif}
.deck-btn:hover{border-color:var(--gold);background:var(--gold-pale)}
.deck-btn.active{border-color:var(--burg);background:var(--burg-light)}
.deck-btn .dk-icon{font-size:20px;margin-bottom:5px}
.deck-btn .dk-name{font-size:12px;font-weight:600;color:var(--burg-deep)}
.deck-btn.active .dk-name{color:var(--burg)}
.deck-btn .dk-count{font-size:10px;color:var(--ink-light);margin-top:2px}

/* Stats */
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:24px}
.stat{background:white;border:1px solid var(--border);border-radius:10px;padding:12px 14px;box-shadow:0 2px 8px rgba(74,15,28,.05)}
.stat-n{font-family:'Cormorant Garamond',serif;font-size:26px;font-weight:600;color:var(--burg);line-height:1}
.stat-l{font-size:10px;color:var(--ink-light);letter-spacing:.06em;text-transform:uppercase;font-weight:500;margin-top:3px}

/* Progress */
.prog-wrap{margin-bottom:24px}
.prog-row{display:flex;justify-content:space-between;margin-bottom:6px}
.prog-row span{font-size:11px;color:var(--ink-light);font-weight:500}
.prog-row strong{font-size:11px;color:var(--burg);font-weight:600}
.prog-track{height:3px;background:var(--burg-light);border-radius:3px}
.prog-fill{height:3px;background:linear-gradient(90deg,var(--burg),var(--gold));border-radius:3px;transition:width .5s}

/* Main layout */
.main{display:grid;grid-template-columns:240px 1fr;gap:20px;align-items:start}

/* Grid panel */
.grid-panel{background:white;border:1px solid var(--border);border-radius:12px;padding:14px;position:sticky;top:20px;box-shadow:0 2px 10px rgba(74,15,28,.06)}
.panel-title{font-size:10px;text-transform:uppercase;letter-spacing:.1em;color:var(--ink-light);font-weight:600;margin-bottom:10px;padding-bottom:8px;border-bottom:1px solid var(--border)}
.card-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:4px;max-height:460px;overflow-y:auto}
.card-grid::-webkit-scrollbar{width:3px}
.card-grid::-webkit-scrollbar-thumb{background:var(--burg-light);border-radius:3px}
.mini{aspect-ratio:.75;border-radius:4px;border:1px solid var(--border);background:var(--cream);display:flex;align-items:center;justify-content:center;font-size:7px;text-align:center;color:var(--ink-light);cursor:pointer;transition:all .12s;padding:2px;line-height:1.2;overflow:hidden;position:relative}
.mini img{width:100%;height:100%;object-fit:cover;border-radius:3px;position:absolute;inset:0}
.mini span{position:relative;z-index:1;font-size:7px;font-weight:600;text-shadow:0 1px 3px rgba(0,0,0,.4);color:white;padding:1px}
.mini.no-img span{color:var(--ink-light);text-shadow:none}
.mini:hover{border-color:var(--gold)}
.mini.active{border:2px solid var(--burg);box-shadow:0 0 0 2px var(--burg-light)}
.mini.done{opacity:.7}
.mini.done::after{content:'✓';position:absolute;top:1px;right:2px;font-size:7px;color:var(--gold);font-weight:700;z-index:2}
.legend{display:flex;gap:8px;margin-top:10px;padding-top:8px;border-top:1px solid var(--border);flex-wrap:wrap}
.leg-item{display:flex;align-items:center;gap:3px;font-size:9px;color:var(--ink-light)}
.leg-dot{width:7px;height:7px;border-radius:2px}

/* Active card panel */
.active-panel{display:flex;flex-direction:column;gap:18px}

/* Card display */
.card-display{background:white;border:1px solid var(--border);border-radius:14px;padding:24px;box-shadow:0 6px 32px rgba(74,15,28,.14);display:grid;grid-template-columns:190px 1fr;gap:24px;align-items:start}
.card-face{width:190px;height:256px;border-radius:12px;overflow:hidden;position:relative;box-shadow:0 8px 28px rgba(74,15,28,.2);cursor:pointer;transition:transform .2s;flex-shrink:0}
.card-face:hover{transform:translateY(-3px)}
.card-face img{width:100%;height:100%;object-fit:cover}
.card-face.ppu-card{background:linear-gradient(145deg,var(--burg-deep),var(--burg));display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px}
.card-face.ppu-card::after{content:'';position:absolute;inset:10px;border:1px solid rgba(201,150,58,.3);border-radius:8px;pointer-events:none}
.ppu-phrase{font-family:'Cormorant Garamond',serif;font-size:22px;font-weight:600;color:white;text-align:center;padding:0 14px;line-height:1.3;position:relative;z-index:1}
.ppu-num{font-size:9px;color:rgba(255,255,255,.4);letter-spacing:.12em;text-transform:uppercase;position:relative;z-index:1}
.card-meta{}
.card-deck-tag{display:inline-block;font-size:9px;letter-spacing:.1em;text-transform:uppercase;font-weight:600;border-radius:20px;padding:3px 10px;margin-bottom:8px}
.tag-modal{background:#EEF6FF;color:#1A5FA8;border:1px solid #B3D4F5}
.tag-action{background:#FFF3E0;color:#8B4A00;border:1px solid #F5C97A}
.tag-pila{background:#E8F5E9;color:#1B5E20;border:1px solid #81C784}
.tag-ppu{background:var(--burg-light);color:var(--burg);border:1px solid rgba(107,26,42,.2)}
.card-title-main{font-family:'Cormorant Garamond',serif;font-size:28px;font-weight:600;color:var(--burg-deep);line-height:1.1;margin-bottom:6px}
.card-sub{font-size:12px;color:var(--ink-light);margin-bottom:12px;font-style:italic}
.card-desc{font-size:13px;color:var(--ink-mid);line-height:1.65;margin-bottom:14px}
.fw-tags{display:flex;gap:5px;flex-wrap:wrap;margin-bottom:16px}
.fw-tag{font-size:9px;background:var(--burg-pale);border:1px solid var(--border);border-radius:4px;padding:2px 7px;color:var(--burg);font-weight:500}
.nav-btns{display:flex;gap:8px}
.btn-prev{padding:8px 16px;border:1px solid var(--border);background:white;border-radius:7px;font-family:'Jost',sans-serif;font-size:11px;font-weight:500;color:var(--ink-mid);cursor:pointer;transition:all .15s}
.btn-prev:hover{border-color:var(--burg);color:var(--burg)}
.btn-next{padding:8px 18px;border:none;background:linear-gradient(135deg,var(--burg),var(--burg-mid));border-radius:7px;font-family:'Jost',sans-serif;font-size:11px;font-weight:600;color:white;cursor:pointer;box-shadow:0 3px 10px rgba(107,26,42,.3);transition:all .15s}
.btn-next:hover{transform:translateY(-1px)}

/* Response panel */
.resp-panel{background:white;border:1px solid var(--border);border-radius:12px;padding:20px;box-shadow:0 2px 10px rgba(74,15,28,.05)}
.resp-title{font-size:10px;text-transform:uppercase;letter-spacing:.1em;color:var(--ink-light);font-weight:600;margin-bottom:16px;padding-bottom:10px;border-bottom:1px solid var(--border)}
.q-block{margin-bottom:16px}
.q-text{font-size:12px;color:var(--ink);font-weight:500;margin-bottom:8px}
.q-opts{display:flex;gap:6px;flex-wrap:wrap}
.q-opt{padding:5px 12px;border-radius:20px;border:1px solid var(--border);background:var(--cream);font-size:11px;color:var(--ink-mid);cursor:pointer;transition:all .12s;font-family:'Jost',sans-serif}
.q-opt:hover{border-color:var(--gold);background:var(--gold-pale)}
.q-opt.sel{background:var(--burg);border-color:var(--burg);color:white;font-weight:500}
.scale-wrap{display:flex;gap:5px;align-items:center}
.scale-lbl{font-size:10px;color:var(--ink-light);width:38px}
.scale-lbl:last-child{text-align:right}
.scale-btns{display:flex;gap:4px;flex:1;justify-content:center}
.sc-btn{width:30px;height:30px;border-radius:50%;border:1px solid var(--border);background:var(--cream);font-size:11px;font-weight:600;color:var(--ink-mid);cursor:pointer;transition:all .12s;font-family:'Jost',sans-serif;display:flex;align-items:center;justify-content:center}
.sc-btn:hover{border-color:var(--gold);background:var(--gold-pale)}
.sc-btn.sel{background:var(--burg);border-color:var(--burg);color:white}
.q-notes{width:100%;border:1px solid var(--border);border-radius:8px;padding:9px 11px;font-size:12px;font-family:'Jost',sans-serif;color:var(--ink);background:var(--cream);resize:none;height:58px;outline:none;transition:border-color .15s}
.q-notes:focus{border-color:var(--burg-mid);background:white}
.save-row{display:flex;justify-content:space-between;align-items:center;padding-top:12px;border-top:1px solid var(--border);margin-top:4px}
.save-note{font-size:10px;color:var(--ink-light)}
.save-btn{padding:7px 18px;background:linear-gradient(135deg,var(--gold-dark),var(--gold));border:none;border-radius:6px;color:white;font-family:'Jost',sans-serif;font-size:11px;font-weight:600;cursor:pointer;letter-spacing:.05em;transition:all .15s}
.save-btn:hover{transform:translateY(-1px)}
.save-btn.saved{background:linear-gradient(135deg,#2D7A4F,#3DAA6A)}

/* Shopify upload notice */
.upload-notice{background:var(--gold-pale);border:1px solid rgba(201,150,58,.3);border-radius:10px;padding:14px 16px;margin-bottom:20px;display:flex;gap:12px;align-items:flex-start}
.upload-notice.hidden{display:none}
.un-icon{font-size:16px;flex-shrink:0;margin-top:1px}
.un-text{font-size:12px;color:var(--ink-mid);line-height:1.6}
.un-text strong{color:var(--gold-dark)}
.un-close{margin-left:auto;cursor:pointer;font-size:16px;color:var(--ink-light);flex-shrink:0}

/* Footer */
.footer{margin-top:40px;padding-top:18px;border-top:1px solid var(--border);display:flex;justify-content:space-between;align-items:center}
.footer-l{font-size:10px;color:var(--ink-light);line-height:1.6}
.footer-l strong{color:var(--burg)}
.footer-r{font-size:10px;color:var(--ink-light);text-align:right}

/* Toast */
.toast{position:fixed;bottom:20px;right:20px;z-index:999;background:var(--burg-deep);color:white;padding:10px 18px;border-radius:8px;font-size:12px;font-weight:500;box-shadow:0 6px 20px rgba(74,15,28,.3);transform:translateY(60px);opacity:0;transition:all .3s}
.toast.show{transform:translateY(0);opacity:1}

@media(max-width:680px){
  .main{grid-template-columns:1fr}
  .stats{grid-template-columns:repeat(2,1fr)}
  .deck-selector{grid-template-columns:repeat(2,1fr)}
  .card-display{grid-template-columns:1fr}
  .card-face{width:100%;height:200px}
  .grid-panel{position:static}
}
</style>
</head>
<body>
<div class="wrap">

<!-- Upload notice -->
<div class="upload-notice" id="upload-notice">
  <div class="un-icon">📋</div>
  <div class="un-text">
    <strong>Action needed for Modal Verb &amp; Power Action card images:</strong>
    Go to Shopify → Content → Files → Upload all your card JPG files.
    Then replace the <code>SHOPIFY_CDN_URL/filename.jpg</code> placeholders in this HTML with your actual Shopify CDN URLs.
    PILA card images are already live from your website and will display correctly.
  </div>
  <div class="un-close" onclick="document.getElementById('upload-notice').classList.add('hidden')">✕</div>
</div>

<!-- Header -->
<header class="hdr">
  <div class="logo">
    Power Phrase <span>Universe</span>
    <small>Clinical Card Viewer — 4 Deck Suite</small>
  </div>
  <div class="hdr-right">
    <div class="badge">AHPRA Verified</div>
    <button class="export-btn" onclick="exportSession()">Export session ↓</button>
  </div>
</header>

<!-- Deck selector -->
<div class="deck-selector" id="deck-selector"></div>

<!-- Stats -->
<div class="stats">
  <div class="stat"><div class="stat-n" id="s-shown">0</div><div class="stat-l">Cards shown</div></div>
  <div class="stat"><div class="stat-n" id="s-resp">0</div><div class="stat-l">Responses logged</div></div>
  <div class="stat"><div class="stat-n" id="s-deck">—</div><div class="stat-l">Active deck</div></div>
  <div class="stat"><div class="stat-n" id="s-top">—</div><div class="stat-l">Top response</div></div>
</div>

<!-- Progress -->
<div class="prog-wrap">
  <div class="prog-row"><span>Session progress</span><strong id="prog-pct">0%</strong></div>
  <div class="prog-track"><div class="prog-fill" id="prog-fill" style="width:0%"></div></div>
</div>

<!-- Main -->
<div class="main">
  <div class="grid-panel">
    <div class="panel-title">Cards — tap to present</div>
    <div class="card-grid" id="card-grid"></div>
    <div class="legend">
      <div class="leg-item"><div class="leg-dot" style="border:2px solid var(--burg)"></div>Active</div>
      <div class="leg-item"><div class="leg-dot" style="background:var(--gold-light)"></div>Shown ✓</div>
      <div class="leg-item"><div class="leg-dot" style="background:var(--cream);border:1px solid var(--border)"></div>Unseen</div>
    </div>
  </div>

  <div class="active-panel">
    <div class="card-display" id="card-display">
      <div class="card-face ppu-card" id="card-face" onclick="nextCard(1)">
        <div class="ppu-phrase" id="card-phrase-txt">I Might Be</div>
        <div class="ppu-num" id="card-num-txt">Card 1 of 50</div>
      </div>
      <div class="card-meta">
        <div class="card-deck-tag tag-ppu" id="card-deck-tag">PPU</div>
        <div class="card-title-main" id="card-title">I Might Be</div>
        <div class="card-sub" id="card-sub">Opening possibility without pressure</div>
        <div class="card-desc" id="card-desc">A gentle phrase that opens the door to self-exploration without demanding certainty. Invites curiosity rather than declaration, activating the prefrontal cortex's reflective capacity.</div>
        <div class="fw-tags" id="card-tags"></div>
        <div class="nav-btns">
          <button class="btn-prev" onclick="nextCard(-1)">← Previous</button>
          <button class="btn-next" onclick="nextCard(1)">Next card →</button>
        </div>
      </div>
    </div>

    <div class="resp-panel">
      <div class="resp-title">Child response — log for this card</div>
      <div class="q-block">
        <div class="q-text">1. How did the child respond?</div>
        <div class="q-opts" id="q1">
          <div class="q-opt" onclick="selQ(this,'q1')">Strong resonance</div>
          <div class="q-opt" onclick="selQ(this,'q1')">Some interest</div>
          <div class="q-opt" onclick="selQ(this,'q1')">Neutral</div>
          <div class="q-opt" onclick="selQ(this,'q1')">Avoidance</div>
          <div class="q-opt" onclick="selQ(this,'q1')">Distress</div>
        </div>
      </div>
      <div class="q-block">
        <div class="q-text">2. Emotional category observed</div>
        <div class="q-opts" id="q2">
          <div class="q-opt" onclick="selQ(this,'q2')">Safety / Calm</div>
          <div class="q-opt" onclick="selQ(this,'q2')">Identity</div>
          <div class="q-opt" onclick="selQ(this,'q2')">Regulation</div>
          <div class="q-opt" onclick="selQ(this,'q2')">Connection</div>
          <div class="q-opt" onclick="selQ(this,'q2')">Resilience</div>
          <div class="q-opt" onclick="selQ(this,'q2')">Anxiety</div>
        </div>
      </div>
      <div class="q-block">
        <div class="q-text">3. Articulation improvement rating (1 = none → 10 = breakthrough)</div>
        <div class="scale-wrap">
          <div class="scale-lbl">None</div>
          <div class="scale-btns" id="q3">
            <div class="sc-btn" onclick="selScale(this,'q3',1)">1</div>
            <div class="sc-btn" onclick="selScale(this,'q3',2)">2</div>
            <div class="sc-btn" onclick="selScale(this,'q3',3)">3</div>
            <div class="sc-btn" onclick="selScale(this,'q3',4)">4</div>
            <div class="sc-btn" onclick="selScale(this,'q3',5)">5</div>
            <div class="sc-btn" onclick="selScale(this,'q3',6)">6</div>
            <div class="sc-btn" onclick="selScale(this,'q3',7)">7</div>
            <div class="sc-btn" onclick="selScale(this,'q3',8)">8</div>
            <div class="sc-btn" onclick="selScale(this,'q3',9)">9</div>
            <div class="sc-btn" onclick="selScale(this,'q3',10)">10</div>
          </div>
          <div class="scale-lbl">Breakthrough</div>
        </div>
      </div>
      <div class="q-block">
        <div class="q-text">4. Practitioner notes</div>
        <textarea class="q-notes" id="q-notes" placeholder="Record observations, verbatim responses, or breakthrough moments…"></textarea>
      </div>
      <div class="save-row">
        <div class="save-note">Saved per card — export full session as CSV</div>
        <button class="save-btn" id="save-btn" onclick="saveResp()">Save response ✦</button>
      </div>
    </div>
  </div>
</div>

<!-- Footer -->
<footer class="footer">
  <div class="footer-l"><strong>Power Phrase Universe</strong> — Clinical Suite · AHPRA-compliant referral program<br>Developed in alignment with SEL frameworks and evidence-based psychological principles.</div>
  <div class="footer-r">powerphraseuniverse.com<br>Founder: Shree Danistha | Australian Teacher, 20+ Years</div>
</footer>
</div>
<div class="toast" id="toast">Response saved ✦</div>

<script>
// ─────────────────────────────────────────────
// SHOPIFY CDN BASE — update this to your store CDN
// Go to Shopify → Content → Files, upload your images,
// then copy the CDN URL prefix here
// Example: https://cdn.shopify.com/s/files/1/XXXX/XXXX/files/
// ─────────────────────────────────────────────
const CDN = 'https://cdn.shopify.com/s/files/1/0788/5298/0952/files/';

// ─────────────────────────────────────────────
// DECK DEFINITIONS
// ─────────────────────────────────────────────
const DECKS = [
  {
    id: 'ppu',
    name: 'Power Phrase Universe',
    icon: '✦',
    tagClass: 'tag-ppu',
    tagLabel: 'PPU — SEL Leading Tool',
    cards: [
      {phrase:'I Might Be',      sub:'Opening possibility without pressure',      desc:'Opens the door to self-exploration without demanding certainty. Invites curiosity over declaration — activating prefrontal cortex reflection.',tags:['CBT','ACT','CASEL: Self-Awareness'],img:null},
      {phrase:'I Can Try',       sub:'Building courage gently over time',          desc:'Removes pressure of guaranteed success while affirming the child\'s capacity to engage. Ideal for fear-of-failure or treatment-resistant clients.',tags:['CBT','CASEL: Self-Management'],img:null},
      {phrase:"It's Okay",       sub:'Validating difficult emotions with grace',   desc:'Provides permission to experience difficult emotions without shame. Activates top-down regulation by engaging the prefrontal cortex.',tags:['DBT','ACT','CASEL: Self-Awareness'],img:null},
      {phrase:'I Feel Safe',     sub:'Anchoring the child in emotional security',  desc:'A grounding phrase that activates the parasympathetic nervous system. Particularly effective at session opening to establish psychological safety.',tags:['CBT','CASEL: Self-Management'],img:null},
      {phrase:'I Am Enough',     sub:'Reinforcing intrinsic self-worth',           desc:'Directly challenges negative core beliefs common in children with anxiety, depression, or social difficulties. Maps to Cognitive Restructuring in CBT.',tags:['CBT','CASEL: Self-Awareness'],img:null},
      {phrase:'I Can Pause',     sub:'Teaching emotional regulation skills',       desc:'Introduces the "cognitive pause" — the gap between stimulus and response. A foundational DBT skill for emotional regulation.',tags:['DBT','CASEL: Self-Management'],img:null},
      {phrase:'I Notice',        sub:'Building mindful self-awareness',            desc:'A mindfulness anchor phrase. Encourages observational distance from emotional states — central to ACT.',tags:['ACT','CASEL: Self-Awareness'],img:null},
      {phrase:'I Choose',        sub:'Strengthening internal agency and will',     desc:'Reinforces internal locus of control. Particularly powerful for children who feel powerless. Supports executive function development.',tags:['CBT','CASEL: Decision-Making'],img:null},
      {phrase:'I Belong',        sub:'Fostering community and inclusion',          desc:'Addresses core social belonging needs. Maps to CASEL\'s Social Awareness domain. Effective in group therapy or classroom settings.',tags:['CASEL: Social Awareness','Narrative Therapy'],img:null},
      {phrase:'I Am Brave',      sub:'Growing confidence through small acts',      desc:'Reframes bravery as an internal quality rather than a performance. Effective for anxious children who avoid challenge.',tags:['CBT','CASEL: Self-Confidence'],img:null},
      {phrase:'I Can Ask',       sub:'Normalising the act of seeking help',        desc:'Reduces shame associated with not knowing or needing support. Critical for self-reliant children who resist asking for help.',tags:['CBT','CASEL: Social Awareness'],img:null},
      {phrase:'I Am Learning',   sub:'Embracing a growth mindset identity',        desc:'A growth mindset anchor. Reframes mistakes as part of a developmental process rather than evidence of inadequacy.',tags:['CBT','CASEL: Self-Management'],img:null},
      {phrase:'I Can Rest',      sub:'Giving permission for recovery',             desc:'Addresses the cultural pressure to "keep going." Validates rest as a healthy and necessary part of emotional regulation.',tags:['DBT','ACT'],img:null},
      {phrase:'I Am Kind',       sub:'Connecting kindness to identity',            desc:'Anchors prosocial behaviour to identity rather than external expectation. Most effective with children showing aggression or social withdrawal.',tags:['CASEL: Social Awareness','Narrative Therapy'],img:null},
      {phrase:'I Feel Strong',   sub:'Building on moments of felt strength',       desc:'Helps the child locate internal evidence of resilience. Pairs with narrative therapy — "Tell me about a time you felt this."',tags:['Narrative Therapy','CASEL: Self-Awareness'],img:null},
      {phrase:'I Can Wait',      sub:'Building tolerance for uncertainty',         desc:'Develops distress tolerance — a core DBT skill. Effective for children with impulsivity, ADHD, or attachment challenges.',tags:['DBT','CASEL: Self-Management'],img:null},
      {phrase:'I Am Heard',      sub:'Affirming the need to be witnessed',         desc:'Addresses the deep need for validation. Particularly powerful with children who have experienced dismissal or emotional neglect.',tags:['Attachment Theory','CASEL: Social Awareness'],img:null},
      {phrase:'I Can Change',    sub:'Affirming neuroplasticity in language',      desc:'Reflects the science of neuroplasticity back to the child in accessible language. Supports hope and reduces helplessness.',tags:['CBT','ACT','CASEL: Self-Management'],img:null},
      {phrase:'I Feel Calm',     sub:'Language for the regulated state',           desc:'Provides language for the experience of calm — which many dysregulated children cannot name. Creates a target state the child can seek.',tags:['DBT','Somatic','CASEL: Self-Management'],img:null},
      {phrase:'I Am Curious',    sub:'Activating exploration over anxiety',        desc:'Reframes anxiety as curiosity — an ACT technique. Shifts from "I am afraid of" to "I am curious about," lowering threat response.',tags:['ACT','CASEL: Self-Awareness'],img:null},
      {phrase:'I Can Breathe',   sub:'Somatic regulation through language',        desc:'Connects the Power Phrase to the physical act of breathing. Provides an immediate physiological regulation tool bridging mind and body.',tags:['DBT','Somatic','CASEL: Self-Management'],img:null},
      {phrase:'I Am Worthy',     sub:'Challenging unworthiness at the core',       desc:'Directly targets the core belief of unworthiness — the most common underlying belief in depression and social anxiety in children.',tags:['CBT','Schema Therapy'],img:null},
      {phrase:'I Feel Joy',      sub:'Naming and anchoring positive states',       desc:'Many dysregulated children cannot identify or allow positive emotions. This phrase gives language to joy and permission to experience it.',tags:['ACT','Positive Psychology'],img:null},
      {phrase:'I Can Grow',      sub:'Identity-level growth language',             desc:'Frames growth as part of the child\'s identity. Pairs with CASEL\'s growth-oriented competencies.',tags:['CASEL: Self-Management','CBT'],img:null},
      {phrase:'I Am Present',    sub:'Grounding in the here and now',             desc:'A mindfulness phrase anchoring the child in the present moment. Particularly effective for children with trauma histories.',tags:['ACT','Trauma-Informed','CASEL: Self-Awareness'],img:null},
      {phrase:'I Can Forgive',   sub:'Opening the path through difficult feelings',desc:'Introduces forgiveness as a process rather than an event. Effective in later stages of therapy when the relationship is established.',tags:['ACT','Narrative Therapy'],img:null},
      {phrase:'I Feel Proud',    sub:'Internalising achievement and effort',       desc:'Builds internal pride not dependent on external validation. Critical for children raised in praise-dependent or critical environments.',tags:['CBT','Positive Psychology','CASEL: Self-Awareness'],img:null},
      {phrase:'I Am Resilient',  sub:'Identity-level resilience framing',          desc:'Moves resilience from a behaviour to an identity. Once a child identifies as resilient, they access resilient behaviours under stress.',tags:['Narrative Therapy','CBT','CASEL: Self-Management'],img:null},
      {phrase:'I Can Share',     sub:'Lowering the barrier to vulnerability',      desc:'Normalises the act of sharing as safe and relational. Reduces the isolation many children feel when carrying difficult emotions alone.',tags:['CASEL: Social Awareness','Attachment Theory'],img:null},
      {phrase:'I Am Grateful',   sub:'Building the gratitude-wellbeing link',      desc:'Gratitude practice is one of the most evidenced positive psychology interventions. Makes gratitude accessible as an identity anchor.',tags:['Positive Psychology','CASEL: Social Awareness'],img:null},
      {phrase:'I Feel Loved',    sub:'Language for felt love and connection',      desc:'Many children with insecure attachment cannot name or feel love. This phrase creates a cognitive-linguistic bridge to the experience.',tags:['Attachment Theory','CASEL: Relationship Skills'],img:null},
      {phrase:'I Can Adapt',     sub:'Flexibility as a strength',                  desc:'Teaches cognitive flexibility — the ability to shift perspective and strategy. A key executive function skill and predictor of resilience.',tags:['CBT','CASEL: Self-Management'],img:null},
      {phrase:'I Am Honest',     sub:'Connecting honesty to core identity',        desc:'Anchors honesty to identity rather than rule-following. Supports children with conduct difficulties or where honesty has felt unsafe.',tags:['Narrative Therapy','CASEL: Responsible Decision-Making'],img:null},
      {phrase:'I Feel Seen',     sub:'Affirming the need for visibility',           desc:'Addresses the deep need to be witnessed and understood. Extremely powerful for children who have felt invisible or marginalised.',tags:['Attachment Theory','Trauma-Informed'],img:null},
      {phrase:'I Can Heal',      sub:'Framing healing as possible and personal',   desc:'Offers hope without pressure. Positions healing as a personal journey the child has agency over — core to trauma-informed practice.',tags:['Trauma-Informed','ACT','CASEL: Self-Management'],img:null},
      {phrase:'I Am Capable',    sub:'Building competence-based identity',         desc:'Challenges the core belief of incompetence. Maps to CBT technique of identifying evidence for capability versus incapability.',tags:['CBT','CASEL: Self-Awareness'],img:null},
      {phrase:'I Feel Wonder',   sub:'Rekindling curiosity and delight',           desc:'Reconnects the child to wonder as a coping state. Wonder activates the same neural circuits as curiosity, reducing threat response.',tags:['Positive Psychology','ACT'],img:null},
      {phrase:'I Can Connect',   sub:'Agency in building relationships',           desc:'Positions connection as an active choice the child can make. Reduces passivity that accompanies social anxiety and isolation.',tags:['CASEL: Relationship Skills','CBT'],img:null},
      {phrase:'I Am Unique',     sub:'Celebrating individual difference',          desc:'Particularly powerful for children who experience bullying due to perceived difference. Reframes uniqueness as strength.',tags:['Narrative Therapy','CASEL: Self-Awareness'],img:null},
      {phrase:'I Feel Hope',     sub:'Language for future orientation',            desc:'Hope is a measurable psychological construct. Children who can name hope have better therapeutic outcomes across modalities.',tags:['CBT','Positive Psychology','CASEL: Self-Management'],img:null},
      {phrase:'I Can Imagine',   sub:'Activating the creative-reflective mind',    desc:'Engages the default mode network — the brain\'s reflective and creative centre. Helps children access alternative futures beyond current distress.',tags:['ACT','Narrative Therapy'],img:null},
      {phrase:'I Am Creative',   sub:'Creativity as a core self-strength',         desc:'Anchors creativity to identity. For children who have received repeated criticism, being named as creative can shift their entire self-narrative.',tags:['Positive Psychology','Narrative Therapy'],img:null},
      {phrase:'I Feel Peace',    sub:'Language for the still, settled state',      desc:'Provides language for the experience of inner peace — which many anxious or traumatised children have never been able to name consciously.',tags:['DBT','ACT','Somatic'],img:null},
      {phrase:'I Can Lead',      sub:'Positioning the child as a capable leader',  desc:'Shifts the child from a passive to an active role. Particularly powerful in group settings and for children with a "victim" narrative.',tags:['Narrative Therapy','CASEL: Social Awareness'],img:null},
      {phrase:'I Am Whole',      sub:'Countering fragmentation and shame',         desc:'A direct counter to the fragmentation experienced in trauma. Positions the self as complete rather than broken.',tags:['Trauma-Informed','Schema Therapy'],img:null},
      {phrase:'I Feel Light',    sub:'Language for relief and emotional lightness', desc:'Gives language to the experience of emotional relief. Creates a target state children can consciously seek.',tags:['Somatic','DBT'],img:null},
      {phrase:'I Can Support',   sub:'Building the capacity to give care',         desc:'Develops empathic capacity and prosocial behaviour. Shifts the child\'s identity from receiver of care to giver — supporting self-worth.',tags:['CASEL: Social Awareness','Positive Psychology'],img:null},
      {phrase:'I Am Ready',      sub:'Language for empowered forward movement',    desc:'A threshold phrase — signals readiness to engage with challenge. Effective at end of session or before a difficult real-world situation.',tags:['CBT','CASEL: Self-Management'],img:null},
      {phrase:'I Feel Free',     sub:'Language for liberation from constraint',    desc:'Particularly powerful for children who feel trapped by circumstance or thought patterns. Maps to ACT\'s psychological flexibility construct.',tags:['ACT','Positive Psychology'],img:null},
      {phrase:'I Am Me',         sub:'The foundational identity affirmation',      desc:'The culminating phrase. Returns the child to the most fundamental affirmation — that being themselves is enough, valid, and worthy of respect and love.',tags:['Narrative Therapy','CASEL: Self-Awareness','CBT'],img:null},
    ]
  },
  {
    id: 'pila',
    name: 'PILA Cards',
    icon: '🌿',
    tagClass: 'tag-pila',
    tagLabel: 'PILA — Practitioner Tool',
    cards: [
      {phrase:'Choose What Comes Next', sub:'Agency and forward movement',          desc:'Invites the child to take ownership of next steps. Builds internal locus of control and reduces feelings of helplessness.',tags:['CBT','CASEL: Decision-Making'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_05_7e596a92-50b3-45b3-a1c9-dcc83e60c26c.jpg?v=1777794697"},
      {phrase:'Breathe Slowly',         sub:'Somatic regulation anchor',            desc:'A direct physiological intervention. Slow breathing activates the parasympathetic nervous system, reducing cortisol and amygdala activation.',tags:['DBT','Somatic','Trauma-Informed'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_04_d49ac21c-c333-48e6-af2f-c6bd2b734192.jpg?v=1777794697"},
      {phrase:'Breathe Slowly',         sub:'Alternate version',                    desc:'Second version for use when presenting pairs. Both versions reinforce the somatic regulation message with different visual anchors.',tags:['DBT','Somatic'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_16.jpg?v=1777794697"},
      {phrase:'Take Space',             sub:'Permission for self-regulation',       desc:'Validates the need for physical and emotional space as a healthy coping strategy. Counters the expectation to "push through."',tags:['DBT','Trauma-Informed','CASEL: Self-Management'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_17.jpg?v=1777794697"},
      {phrase:'Try Again',              sub:'Resilience without shame',             desc:'Reframes failure as part of the learning process. Removes the shame associated with not succeeding first time.',tags:['CBT','Growth Mindset','CASEL: Self-Management'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_07_47325ce4-9550-40da-b11f-9a9093932aa6.jpg?v=1777794697"},
      {phrase:'Try Again',              sub:'Alternate version',                    desc:'Second version reinforcing persistence. Use alongside the first for contrast and discussion.',tags:['CBT','Growth Mindset'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_14.jpg?v=1777794696"},
      {phrase:"I Won't Leave",          sub:'Safety and relational anchoring',      desc:'A powerful statement from practitioner to client. Establishes relational safety and models secure attachment language.',tags:['Attachment Theory','Trauma-Informed'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_15_b83cc810-5237-4364-ac4e-6a884537e0b0.jpg?v=1777794697"},
      {phrase:"I Won't Leave",          sub:'Alternate version',                    desc:'Second version for different session contexts. The repeated message reinforces the therapeutic relationship.',tags:['Attachment Theory'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_12_9ad690ff-befb-43b7-a14d-f14e36c5e483.jpg?v=1777794696"},
      {phrase:"I Won't Rush You",       sub:'Pacing and emotional safety',          desc:'Communicates unconditional patience. Particularly powerful for children who feel pressure to "perform" their healing.',tags:['Trauma-Informed','Attachment Theory'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_08_285a39b9-be6f-4753-b230-17d8bdc76c00.jpg?v=1777794696"},
      {phrase:"I Won't Rush You",       sub:'Alternate version',                    desc:'Second version reinforcing the no-pressure environment of the therapeutic space.',tags:['Trauma-Informed'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_11.jpg?v=1777794697"},
      {phrase:"I Won't Judge You",      sub:'Unconditional acceptance',             desc:'Removes the fear of judgment — one of the most significant barriers to therapeutic disclosure in children and adolescents.',tags:['ACT','Person-Centred','CASEL: Social Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_09_6800d3d3-cedc-4ca9-98de-83cafdaeb385.jpg?v=1777794696"},
      {phrase:"I Won't Judge You",      sub:'Alternate version',                    desc:'Second version for different session dynamics.',tags:['ACT','Person-Centred'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_06_3d17683e-fa96-4604-8738-f2dbb03930b0.jpg?v=1777794695"},
      {phrase:"I Won't Make This Harder",sub:'Reducing perceived threat',           desc:'Directly addresses the fear that therapy will increase suffering. Establishes the practitioner as an ally, not a challenger.',tags:['Trauma-Informed','CBT'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_36.jpg?v=1777794687"},
      {phrase:'I Am Still Here',        sub:'Consistent relational presence',       desc:'Models secure attachment and relational constancy. Particularly powerful after ruptures or difficult sessions.',tags:['Attachment Theory','Trauma-Informed'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_34.jpg?v=1777794686"},
      {phrase:"You're Important",       sub:'Affirming inherent worth',             desc:'A direct statement of value from practitioner to client. Counters the core belief of worthlessness that underlies many presentations.',tags:['CBT','Person-Centred'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_32.jpg?v=1777794686"},
      {phrase:'Big Feelings Are Okay',  sub:'Normalising emotional intensity',      desc:'Validates emotional dysregulation as a normal human experience rather than a pathology. Reduces shame around "big" reactions.',tags:['DBT','ACT','CASEL: Self-Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_29.jpg?v=1777794685"},
      {phrase:'You Belong Here',        sub:'Inclusion and relational safety',      desc:'Establishes the therapeutic or educational space as safe and belonging to the child. Counters the "I don\'t fit" narrative.',tags:['CASEL: Social Awareness','Attachment Theory'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_33.jpg?v=1777794685"},
      {phrase:'You Belong Here',        sub:'Alternate version',                    desc:'Second version for classroom or group settings.',tags:['CASEL: Social Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_35_f9118c63-ac94-45a1-a025-97737050d340.jpg?v=1777794685"},
      {phrase:'We Are Figuring This Out',sub:'Collaborative problem-solving',       desc:'Positions the practitioner and child as co-investigators. Reduces the power differential and increases therapeutic alliance.',tags:['Narrative Therapy','CBT'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_28.jpg?v=1777794684"},
      {phrase:'We Will Figure This Out', sub:'Confidence in the process',           desc:'Forward-oriented version. Expresses confidence without pressure — the problem will be solved, at the child\'s pace.',tags:['CBT','Narrative Therapy'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_27.jpg?v=1777794682"},
      {phrase:'Your Learning Matters',  sub:'Affirming educational identity',       desc:'Connects the child\'s learning to their sense of value. Particularly effective in school-based psychology settings.',tags:['CASEL: Self-Awareness','Growth Mindset'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_31.jpg?v=1777794682"},
      {phrase:'Right Now Is Okay',      sub:'Present-moment acceptance',            desc:'An ACT-grounded phrase bringing the child back to the present. Counters future-oriented anxiety and catastrophising.',tags:['ACT','DBT','CASEL: Self-Management'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_30.jpg?v=1777794682"},
      {phrase:'Pause',                  sub:'The foundational regulation anchor',   desc:'The most fundamental regulation tool. A single word that invites the child to create space between stimulus and response.',tags:['DBT','ACT','Somatic','CASEL: Self-Management'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_24.jpg?v=1777794681"},
    ]
  },
  {
    id: 'modal',
    name: 'Modal Verb Cards',
    icon: '🗣️',
    tagClass: 'tag-modal',
    tagLabel: 'Modal Verb Cards',
    cards: [
      {phrase:'I could',        sub:'Possibility language',          desc:'Opens up possibility thinking. Reduces the perceived weight of commitment while expanding the child\'s sense of available options.',tags:['CBT','ACT','CASEL: Decision-Making'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_02_b3cc21a4-8f86-474e-b2bd-6471d7c4e659.jpg?v=1777794680"},
      {phrase:'I am going to',  sub:'Intentional forward commitment', desc:'Transforms vague hope into concrete intention. Activates the prefrontal cortex\'s planning function.',tags:['CBT','CASEL: Self-Management'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_03_11eb11a2-5a2f-4ea8-8065-d87ff56affc7.jpg?v=1777794678"},
      {phrase:'I might be',     sub:'Tentative identity exploration', desc:'A softer identity phrase allowing the child to try on new self-concepts without full commitment.',tags:['ACT','Narrative Therapy'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/POWER_PHRASE_CARDS_SUNDAY_Page_23.jpg"},
      {phrase:'I AM',           sub:'Core identity declaration',      desc:'The foundational identity statement. Present, certain, and grounded. Pairs with any adjective the child chooses.',tags:['CBT','CASEL: Self-Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_58_12f73258-e18e-48b4-bd07-ab7403db1b41.jpg?v=1777794555"},
      {phrase:'I WILL',         sub:'Future commitment language',     desc:'Expresses confident future intention. Builds motivation and activates goal-directed behaviour in the prefrontal cortex.',tags:['CBT','CASEL: Self-Management'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/powerphrasecardimagesPage534a8f1f39-57a5-42cf-8ab8-6faa4bc4bd5e.jpg?v=1777857579"},
      {phrase:'I AM',           sub:'Identity — alternate version',   desc:'Second version of the core identity card. Use for comparison or when two versions support different children in the same session.',tags:['CBT','CASEL: Self-Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_55_77ce46cf-5bec-424d-a727-fa5bfab204fa.jpg?v=1777794555"},
      {phrase:'I AM',           sub:'Identity — card version',        desc:'Third version with card border format. Provides a different visual anchor for the same powerful affirmation.',tags:['CBT','CASEL: Self-Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_62_b71d8ddc-2483-4a68-8515-59be919b8b81.jpg?v=1777794555"},
      {phrase:'We shall',       sub:'Collaborative future language',  desc:'Introduces shared commitment and collective agency. Effective in group settings or to reinforce the therapeutic alliance.',tags:['CASEL: Social Awareness','Relationship Skills'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_24_5871a381-46cd-4cdf-a55c-6137f2c90a38.jpg?v=1777794556"},
      {phrase:'I would',        sub:'Conditional desire language',    desc:'Opens up wishes and desires without pressure. "I would like to..." is a safe entry point for children who struggle to express wants.',tags:['CBT','ACT'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_09.jpg'},
      {phrase:'I WOULD',        sub:'Desire — alternate version',     desc:'Second version with stronger visual emphasis. Useful for children who respond to bold visual cues.',tags:['CBT','ACT'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_10.jpg'},
      {phrase:'I will',         sub:'Personal commitment',            desc:'A quieter, more personal version of commitment language. Lowercase styling makes it feel more intimate and achievable.',tags:['CBT','CASEL: Self-Management'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_11.jpg'},
      {phrase:'She will',       sub:'Third-person empowerment',       desc:'Introduces third-person perspective-taking. Helps children externalize and observe the empowered version of themselves.',tags:['Narrative Therapy','CASEL: Social Awareness'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_12.jpg'},
      {phrase:'I need to',      sub:'Needs identification language',  desc:'Gives language to unmet needs. One of the most clinically significant phrases — children who can name needs can begin to have them met.',tags:['DBT','CASEL: Self-Awareness'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_14.jpg'},
      {phrase:'I need to',      sub:'Needs — alternate version',      desc:'Second version. Use when exploring different contexts in which the child experiences needs.',tags:['DBT','CASEL: Self-Awareness'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_15.jpg'},
      {phrase:'I need to',      sub:'Needs — third version',          desc:'Third version. Repetition across versions reinforces the safety of naming needs in the therapeutic space.',tags:['DBT'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_16.jpg'},
      {phrase:'I could',        sub:'Possibility — alternate version', desc:'Second version with lighter visual styling. Offers the same possibility-opening language in a different visual register.',tags:['CBT','ACT'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_17.jpg'},
      {phrase:'WE CAN',         sub:'Collective capability language',  desc:'Affirms collective agency and shared strength. Reduces isolation and reinforces the power of community and relationship.',tags:['CASEL: Social Awareness','Relationship Skills'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_20.jpg'},
      {phrase:'WE CAN',         sub:'Collective — alternate version',  desc:'Second version with more diverse representation. Select based on the child\'s background and context.',tags:['CASEL: Social Awareness'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_21.jpg'},
      {phrase:'I might be',     sub:'Tentative identity — alternate',  desc:'Second version of the tentative identity card. Slightly different visual tone for different session contexts.',tags:['ACT','Narrative Therapy'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_22.jpg'},
      {phrase:'I WANT TO',      sub:'Desire and aspiration language',  desc:'Names desire explicitly. Children who have suppressed wanting — due to trauma, neglect, or invalidation — find this phrase particularly powerful.',tags:['ACT','DBT','CASEL: Self-Awareness'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_23.jpg'},
      {phrase:'I NEED TO',      sub:'Needs — emphatic version',        desc:'Emphasised version of the needs phrase. Use when the child needs strong visual reinforcement to feel safe naming needs.',tags:['DBT','CASEL: Self-Awareness'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_24.jpg'},
      {phrase:'I might be',     sub:'Tentative identity — third version',desc:'Third version. Multiple versions allow the practitioner to find the visual register that resonates most with each individual child.',tags:['ACT'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_26.jpg'},
      {phrase:'I will',         sub:'Commitment — quiet version',      desc:'Quieter, lowercase commitment card. For children who are overwhelmed by strong visual language.',tags:['CBT','CASEL: Self-Management'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_27.jpg'},
      {phrase:'I WILL',         sub:'Commitment — bold version',       desc:'Bold version. For children who respond to strong, confident visual declarations.',tags:['CBT','CASEL: Self-Management'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_28.jpg'},
      {phrase:'I AM',           sub:'Identity — fourth version',       desc:'Fourth identity card version. The breadth of versions ensures every child finds a visual anchor for this foundational phrase.',tags:['CBT','CASEL: Self-Awareness'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_29.jpg'},
      {phrase:'I might be',     sub:'Tentative identity — fourth',     desc:'Fourth version for thorough exploration of tentative identity language across different visual registers.',tags:['ACT','Narrative Therapy'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_30.jpg'},
      {phrase:'I might be',     sub:'Tentative identity — fifth',      desc:'Fifth version. Rich variety supports personalised selection during session.',tags:['ACT'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_31.jpg'},
      {phrase:'HE WILL',        sub:'Third-person male empowerment',   desc:'Third-person male empowerment card. Supports perspective-taking and externalisation of the empowered self.',tags:['Narrative Therapy','CASEL: Social Awareness'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_32.jpg'},
      {phrase:'I would',        sub:'Desire — quiet version',          desc:'Quieter lowercase version. For children who find direct desire language threatening, this softer version provides a gentler entry point.',tags:['CBT','ACT'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_33.jpg'},
      {phrase:'I will',         sub:'Commitment — purple version',     desc:'Third will version with different colour context. Colour variation helps children with sensory preferences engage more deeply.',tags:['CBT','CASEL: Self-Management'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_34.jpg'},
      {phrase:'SHE WILL',       sub:'Third-person female empowerment', desc:'Third-person female empowerment card. Supports girls in externalising and observing the empowered version of themselves.',tags:['Narrative Therapy','CASEL: Social Awareness'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_35.jpg'},
      {phrase:'I could',        sub:'Possibility — third version',     desc:'Third possibility card. Use when exploring the full range of the child\'s options and building a sense of open futures.',tags:['CBT','ACT'],img:'https://www.powerphraseuniverse.com/cdn/shop/files/POWER_PHRASE_CARDS_SUNDAY_Page_36.jpg'},
    ]
  },
  {
    id: 'action',
    name: 'Power Action Cards',
    icon: '⚡',
    tagClass: 'tag-action',
    tagLabel: 'Power Action Cards',
    cards: [
      {phrase:'Helping',        sub:'Prosocial action and contribution',  desc:'Depicts the act of helping as a core identity strength. Children who help feel more connected, more capable, and more valued.',tags:['CASEL: Social Awareness','Prosocial Behaviour'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_01_ca751799-e38a-4096-9f23-312fd30bbd74.jpg?v=1777794556"},
      {phrase:'Comfort',        sub:'Emotional warmth and self-soothing', desc:'Names comfort as both something to receive and to give. Activates the attachment system and reduces cortisol.',tags:['Attachment Theory','DBT','Somatic'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_08_3cab43f2-ea0c-4d47-a953-69c6e6481cab.jpg?v=1777794555"},
      {phrase:'Empowered',      sub:'Internal power and capability',      desc:'A full-body felt-sense of power. Use when the child needs to locate strength in their body rather than their thoughts.',tags:['Somatic','CASEL: Self-Awareness','CBT'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_59_e05f8b03-e347-4dd3-b493-790bb5ee38f5.jpg?v=1777794555"},
      {phrase:'Survive',        sub:'Resilience through adversity',       desc:'Frames survival as a strength. Particularly powerful for children who have been through difficult experiences.',tags:['Trauma-Informed','Narrative Therapy','Resilience'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_03_d375d1bd-29a4-4938-8e19-5e8d8fe2f1ee.jpg?v=1777794555"},
      {phrase:'Carry On',       sub:'Persistence and forward movement',   desc:'Action-oriented resilience. The child is moving forward despite difficulty — not despite the weight, but carrying it.',tags:['CBT','ACT','Growth Mindset'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_66_6661ad36-28ae-4479-bdd2-bca8c473356a.jpg?v=1777794556"},
      {phrase:'Present',        sub:'Mindful engagement with now',        desc:'Being fully present — grounded in the body and the moment. Counteracts dissociation and future-oriented anxiety.',tags:['ACT','Somatic','CASEL: Self-Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_35_13426525-4b5d-448f-b2aa-c34bda862784.jpg?v=1777794555"},
      {phrase:'Bear',           sub:'Bearing difficulty with dignity',    desc:'Holding difficulty without being destroyed by it. A distress tolerance concept from DBT rendered visually.',tags:['DBT','ACT','Resilience'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_25_b08e7603-87d1-4cc4-9487-31c23fc3ac9c.jpg?v=1777794555"},
      {phrase:'Abundant',       sub:'Abundance mindset and possibility',  desc:'Shifts the child from a scarcity to an abundance orientation. Supports hope, generosity, and openness.',tags:['Positive Psychology','CBT','Growth Mindset'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_61_cf608139-6646-432f-ac4c-c6aec5129b7a.jpg?v=1777794555"},
      {phrase:'Joyful',         sub:'Permission for and celebration of joy',desc:'Many children with difficult histories feel unsafe experiencing joy. This card gives explicit permission and a name for the feeling.',tags:['ACT','Positive Psychology','CASEL: Self-Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_20_dfe3eca5-c05a-45ec-b827-510e5de0ddbc.jpg?v=1777794555"},
      {phrase:'Persist',        sub:'Determination and grit',             desc:'The emotional and physical felt-sense of persistence. Not comfortable — but purposeful and powerful.',tags:['CBT','Growth Mindset','CASEL: Self-Management'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_19_f2d3cb8a-40e5-4ba8-b973-bad442f01db3.jpg?v=1777794555"},
      {phrase:'Satisfied',      sub:'Contentment and completion',         desc:'Names the experience of satisfaction — often absent in children with anxiety or perfectionism. Anchors the felt sense of "enough."',tags:['DBT','ACT','Positive Psychology'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_54_8f02b5cd-71fd-43eb-93c6-463db5240ce9.jpg?v=1777794555"},
      {phrase:'Energised',      sub:'Vitality and activation',            desc:'The experience of positive energy and activation. Helps children distinguish between anxious arousal and excited readiness.',tags:['Somatic','CASEL: Self-Awareness','Positive Psychology'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_56_269441fb-cb9c-4ed0-a7ca-bf673f351638.jpg?v=1777794555"},
      {phrase:'Important',      sub:'Inherent significance and value',    desc:'The felt sense of mattering. Directly counters the belief "I am not important" — one of the most damaging beliefs in childhood.',tags:['CBT','Person-Centred','CASEL: Self-Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_34_1dc22a8c-2e21-4060-a97e-18a34abc4145.jpg?v=1777794555"},
      {phrase:'Brighten',       sub:'Bringing light to self and others',  desc:'The experience of brightening — both internally and relationally. Supports prosocial identity and positive impact awareness.',tags:['Positive Psychology','CASEL: Social Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_40_ec2e3c5d-89b4-4903-8023-0850efa09fbb.jpg?v=1777794555"},
      {phrase:'Brighten',       sub:'Alternate version',                  desc:'Second version with torch imagery. Different visual anchors support different children.',tags:['Positive Psychology'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_21_13f87c46-5fb1-451c-9b38-4052396264dd.jpg?v=1777794556"},
      {phrase:'Applaud',        sub:'Celebrating self and others',        desc:'The act of celebration and acknowledgement. Builds the capacity to both give and receive praise — important for children with shame.',tags:['Positive Psychology','CASEL: Social Awareness','Prosocial'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_30_cb495d72-00ba-44c5-b7a5-03019dcbe439.jpg?v=1777794555"},
      {phrase:'Ordering',       sub:'Understanding power dynamics',       desc:'Shows an unhelpful communication pattern. Use therapeutically to help children name experiences of being ordered rather than heard.',tags:['Narrative Therapy','CASEL: Social Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_65_033ece20-c3b4-4911-860f-12da0e601a90.jpg?v=1777794555"},
      {phrase:'Lecturing',      sub:'Recognising unhelpful communication', desc:'Names the experience of being lectured. Supports children in articulating when adult communication feels dismissive of their voice.',tags:['Narrative Therapy','CBT'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_26_8be2a93f-a7e0-46d6-aced-3d1fa5911c23.jpg?v=1777794555"},
      {phrase:'Defend',         sub:'Protection and advocacy',            desc:'The act of defending someone who needs protection. Builds advocacy identity and connects to the child\'s sense of justice.',tags:['CASEL: Social Awareness','Prosocial','Resilience'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_29_8143b610-7efe-4548-9798-6a89463457cf.jpg?v=1777794555"},
      {phrase:'Support',        sub:'Active relational care',             desc:'Depicts active support in a moment of need. Builds the identity of both supporter and supported — both are valid and valued.',tags:['CASEL: Relationship Skills','Attachment Theory'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_23_cf221f10-3501-48e5-8395-a22c7a2f3070.jpg?v=1777794555"},
      {phrase:'Safeguard',      sub:'Protection and safety',              desc:'The experience of being protected. Particularly powerful for children who have lacked consistent adult protection.',tags:['Attachment Theory','Trauma-Informed'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_37_36be3ebf-5ddb-412d-ac55-be3e159bf068.jpg?v=1777794556"},
      {phrase:'Stand Guard',    sub:'Active protection and vigilance',    desc:'The act of standing guard — protecting others. Builds the prosocial guardian identity in children who feel powerless.',tags:['CASEL: Social Awareness','Prosocial'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_46_13cd9d32-0462-42e2-bb3d-32bee88fed52.jpg?v=1777794555"},
      {phrase:'Shade',          sub:'Shelter, comfort, and rest together', desc:'The act of providing shade — shelter from difficulty. Evokes community, family, and collective care.',tags:['Attachment Theory','CASEL: Relationship Skills'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_12_23bfd960-e91b-41e0-a3b3-1364e3663429.jpg?v=1777794555"},
      {phrase:'Safe',           sub:'The felt sense of safety',           desc:'The embodied experience of safety — relaxed, at peace, held. The foundation of all therapeutic work and learning.',tags:['Attachment Theory','Trauma-Informed','Somatic'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_22_93903b61-e412-4346-b0df-e1a97afb733e.jpg?v=1777794555"},
      {phrase:'Preserve',       sub:'Protecting what is precious',        desc:'The act of preserving something valuable. Helps children identify and protect their own inner resources and valued relationships.',tags:['ACT','Narrative Therapy','Positive Psychology'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_13_542e2a4b-a6b4-4abb-99d9-fdd78bed68be.jpg?v=1777794556"},
      {phrase:'Reassuring',     sub:'Comfort through relationship',       desc:'The experience of being reassured by a caring other. Activates attachment security and reduces anxiety.',tags:['Attachment Theory','DBT'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_39_0f1d1dd6-d83a-4b56-b7b9-34fd56aad54c.jpg?v=1777794555"},
      {phrase:'Recover',        sub:'Healing and restoration',            desc:'The gentle process of recovery — not dramatic, but real. Normalises the need for rest and restoration after difficulty.',tags:['Trauma-Informed','ACT','Somatic'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_45_eaab8628-2430-4199-aef6-b7e10abd0da3.jpg?v=1777794555"},
      {phrase:'Reassuring',     sub:'Reassurance — alternate version',    desc:'Second reassurance card with different visual context. Both versions reinforce the message of comfort through relationship.',tags:['Attachment Theory'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_04_e0d4afea-b29b-48a2-b8db-e84409587796.jpg?v=1777794555"},
      {phrase:'Helping',        sub:'Helping — peer support version',     desc:'Second helping card depicting peer support. Widens the concept of helping to include child-to-child care.',tags:['CASEL: Social Awareness','Prosocial'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/powerphrasecardimages_Page_11.jpg?v=1777238540"},
      {phrase:'Helping',        sub:'Helping — gentle version',           desc:'Third helping card with gentler, quieter imagery. For children who find the more active helping cards overwhelming.',tags:['CASEL: Social Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/powerphrasecardimages_Page_07.jpg?v=1777238540"},
      {phrase:'Trick Card',     sub:'Mirror Me — game mechanic',          desc:'A playful engagement card. Use to break tension, build rapport, and introduce playfulness into the session. Not a clinical phrase — a connection tool.',tags:['Rapport-Building','Engagement'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/powerphrasecardimages_Page_05.jpg?v=1777238540"},
      {phrase:'Helping',        sub:'Helping — fourth version',           desc:'Fourth helping card. The breadth of helping imagery reflects how many forms care can take — all valid.',tags:['CASEL: Social Awareness','Prosocial'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/powerphrasecardimages_Page_04.jpg?v=1777238540"},
      {phrase:'Helping',        sub:'Helping — fifth version',            desc:'Fifth helping card. The repeated theme emphasises that helping is a core value across the entire Power Action deck.',tags:['CASEL: Social Awareness'],img:"https://cdn.shopify.com/s/files/1/0788/5298/0952/files/power_phrase_card_images_Page_31.jpg?v=1777238416"},
    ]
  }
];

// ─────────────────────────────────────────────
// STATE
// ─────────────────────────────────────────────
let activeDeck = 0;
let currentCard = 0;
let shown = {};
let responses = {};
let resonanceCounts = {};

DECKS.forEach((_,i) => { shown[i] = new Set(); responses[i] = {}; });

// ─────────────────────────────────────────────
// BUILD DECK SELECTOR
// ─────────────────────────────────────────────
function buildDeckSelector() {
  const sel = document.getElementById('deck-selector');
  sel.innerHTML = DECKS.map((d,i) => `
    <div class="deck-btn${i===activeDeck?' active':''}" onclick="switchDeck(${i})">
      <div class="dk-icon">${d.icon}</div>
      <div class="dk-name">${d.name}</div>
      <div class="dk-count">${d.cards.length} cards</div>
    </div>`).join('');
}

// ─────────────────────────────────────────────
// SWITCH DECK
// ─────────────────────────────────────────────
function switchDeck(i) {
  activeDeck = i;
  currentCard = 0;
  buildDeckSelector();
  updateCard();
  buildGrid();
}

// ─────────────────────────────────────────────
// BUILD GRID
// ─────────────────────────────────────────────
function buildGrid() {
  const deck = DECKS[activeDeck];
  const g = document.getElementById('card-grid');
  g.innerHTML = deck.cards.map((c,i) => {
    const isActive = i === currentCard;
    const isDone = shown[activeDeck].has(i);
    let inner = '';
    if (c.img) {
      inner = `<img src="${c.img}" alt="${c.phrase}" onerror="this.style.display='none'"><span>${c.phrase}</span>`;
    } else {
      inner = `<span style="color:var(--ink-light);font-size:7px;font-weight:500;text-shadow:none">${c.phrase}</span>`;
    }
    return `<div class="mini${!c.img?' no-img':''}${isActive?' active':''}${isDone?' done':''}" 
      onclick="goCard(${i})" title="${c.phrase}">${inner}</div>`;
  }).join('');
}

// ─────────────────────────────────────────────
// GO TO CARD
// ─────────────────────────────────────────────
function goCard(i) {
  shown[activeDeck].add(currentCard);
  currentCard = i;
  updateCard();
  buildGrid();
}

function nextCard(dir) {
  shown[activeDeck].add(currentCard);
  const len = DECKS[activeDeck].cards.length;
  currentCard = Math.max(0, Math.min(len-1, currentCard + dir));
  updateCard();
  buildGrid();
}

// ─────────────────────────────────────────────
// UPDATE ACTIVE CARD DISPLAY
// ─────────────────────────────────────────────
function updateCard() {
  const deck = DECKS[activeDeck];
  const c = deck.cards[currentCard];

  // Card face
  const face = document.getElementById('card-face');
  if (c.img) {
    face.className = 'card-face';
    face.innerHTML = `<img src="${c.img}" alt="${c.phrase}" style="width:100%;height:100%;object-fit:cover" 
      onerror="this.parentElement.className='card-face ppu-card';this.parentElement.innerHTML='<div class=\\'ppu-phrase\\'>${c.phrase}</div><div class=\\'ppu-num\\'>Card ${currentCard+1} of ${deck.cards.length}</div>'">`;
  } else {
    face.className = 'card-face ppu-card';
    face.innerHTML = `<div class="ppu-phrase">${c.phrase}</div><div class="ppu-num">Card ${currentCard+1} of ${deck.cards.length}</div>`;
  }

  document.getElementById('card-deck-tag').className = 'card-deck-tag ' + deck.tagClass;
  document.getElementById('card-deck-tag').textContent = deck.tagLabel;
  document.getElementById('card-title').textContent = c.phrase;
  document.getElementById('card-sub').textContent = c.sub;
  document.getElementById('card-desc').textContent = c.desc;
  document.getElementById('card-tags').innerHTML = c.tags.map(t => `<span class="fw-tag">${t}</span>`).join('');

  restoreResponses();
  updateStats();
}

// ─────────────────────────────────────────────
// RESTORE SAVED RESPONSES
// ─────────────────────────────────────────────
function restoreResponses() {
  document.querySelectorAll('.q-opt').forEach(o => o.classList.remove('sel'));
  document.querySelectorAll('.sc-btn').forEach(o => o.classList.remove('sel'));
  document.getElementById('q-notes').value = '';
  const btn = document.getElementById('save-btn');
  btn.textContent = 'Save response ✦';
  btn.classList.remove('saved');

  const key = activeDeck + '-' + currentCard;
  if (responses[activeDeck] && responses[activeDeck][currentCard]) {
    const r = responses[activeDeck][currentCard];
    if (r.q1) document.querySelectorAll('#q1 .q-opt').forEach(o => { if(o.textContent===r.q1) o.classList.add('sel'); });
    if (r.q2) document.querySelectorAll('#q2 .q-opt').forEach(o => { if(o.textContent===r.q2) o.classList.add('sel'); });
    if (r.q3) document.querySelectorAll('#q3 .sc-btn').forEach(o => { if(o.textContent==r.q3) o.classList.add('sel'); });
    if (r.notes) document.getElementById('q-notes').value = r.notes;
    if (r.q1) { btn.textContent = 'Saved ✓'; btn.classList.add('saved'); }
  }
}

// ─────────────────────────────────────────────
// STATS
// ─────────────────────────────────────────────
function updateStats() {
  const totalShown = Object.values(shown).reduce((a,s) => a + s.size, 0);
  const totalResp = Object.values(responses).reduce((a,d) => a + Object.keys(d).length, 0);
  document.getElementById('s-shown').textContent = totalShown + 1;
  document.getElementById('s-resp').textContent = totalResp;
  document.getElementById('s-deck').textContent = DECKS[activeDeck].name.split(' ')[0];
  const topR = Object.entries(resonanceCounts).sort((a,b)=>b[1]-a[1])[0];
  document.getElementById('s-top').textContent = topR ? topR[0].split(' ')[0] : '—';
  const deck = DECKS[activeDeck];
  const pct = Math.round(((shown[activeDeck].size + 1) / deck.cards.length) * 100);
  document.getElementById('prog-fill').style.width = Math.min(pct,100) + '%';
  document.getElementById('prog-pct').textContent = Math.min(pct,100) + '%';
}

// ─────────────────────────────────────────────
// QUESTION SELECTION
// ─────────────────────────────────────────────
function selQ(el, groupId) {
  document.querySelectorAll('#'+groupId+' .q-opt').forEach(o => o.classList.remove('sel'));
  el.classList.add('sel');
}
function selScale(el, groupId, val) {
  document.querySelectorAll('#'+groupId+' .sc-btn').forEach(o => o.classList.remove('sel'));
  el.classList.add('sel');
}

// ─────────────────────────────────────────────
// SAVE RESPONSE
// ─────────────────────────────────────────────
function saveResp() {
  const q1el = document.querySelector('#q1 .q-opt.sel');
  const q2el = document.querySelector('#q2 .q-opt.sel');
  const q3el = document.querySelector('#q3 .sc-btn.sel');
  const card = DECKS[activeDeck].cards[currentCard];
  responses[activeDeck][currentCard] = {
    deck: DECKS[activeDeck].name,
    card: card.phrase,
    q1: q1el ? q1el.textContent : null,
    q2: q2el ? q2el.textContent : null,
    q3: q3el ? q3el.textContent : null,
    notes: document.getElementById('q-notes').value
  };
  if (q1el) resonanceCounts[q1el.textContent] = (resonanceCounts[q1el.textContent]||0)+1;
  shown[activeDeck].add(currentCard);
  const btn = document.getElementById('save-btn');
  btn.textContent = 'Saved ✓';
  btn.classList.add('saved');
  showToast();
  updateStats();
  buildGrid();
}

// ─────────────────────────────────────────────
// TOAST
// ─────────────────────────────────────────────
function showToast() {
  const t = document.getElementById('toast');
  t.classList.add('show');
  setTimeout(() => t.classList.remove('show'), 2200);
}

// ─────────────────────────────────────────────
// EXPORT SESSION
// ─────────────────────────────────────────────
function exportSession() {
  let csv = 'Deck,Card,Response,Emotional Category,Rating (1-10),Notes\n';
  DECKS.forEach((deck,di) => {
    Object.values(responses[di]).forEach(r => {
      csv += `"${r.deck}","${r.card}","${r.q1||''}","${r.q2||''}","${r.q3||''}","${(r.notes||'').replace(/"/g,'""')}"\n`;
    });
  });
  const blob = new Blob([csv], {type:'text/csv'});
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = 'PPU_Clinical_Session_' + new Date().toISOString().slice(0,10) + '.csv';
  a.click();
}

// ─────────────────────────────────────────────
// INIT
// ─────────────────────────────────────────────
buildDeckSelector();
buildGrid();
updateCard();
</script>
</body>
</html>