/* ===== BACKGROUND GRID PATTERN ===== */
    /* Subtle dot grid for hero/section backgrounds */
    .bg-grid {
      background-image: radial-gradient(currentColor 1px, transparent 1px);
      background-size: 20px 20px;
      opacity: .08;
      pointer-events: none;
    }

    /* ===== EXAMPLES PANEL ANIMATION ===== */
    /* Smooth expand/collapse for inline examples panels */
    .examples-panel {
      display: grid;
      grid-template-rows: 0fr;
      transition: grid-template-rows 0.28s ease;
    }
    .examples-panel.open {
      grid-template-rows: 1fr;
    }
    .examples-panel > .examples-inner {
      overflow: hidden;
    }

    /* ===== EXAMPLES TOGGLE ARROW ===== */
    /* Rotates the arrow icon on expand */
    .examples-arrow {
      display: inline-block;
      transition: transform 0.22s ease;
    }
    .examples-toggle[aria-expanded="true"] .examples-arrow {
      transform: rotate(180deg);
    }

    /* ===== OUTPUT SECTION STYLES ===== */
    /* Script output formatting — role card layout */
    .script-output {
      font-family: Georgia, 'Times New Roman', serif;
      line-height: 1.8;
      max-width: 720px;
      margin: 0 auto;
    }

    /* ===== SECTION HEADER ===== */
    /* Uppercase section labels with divider */
    .script-section-header {
      font-family: system-ui, -apple-system, sans-serif;
      font-weight: 700;
      font-size: 0.75rem;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #36D6B5;
      margin-top: 40px;
      margin-bottom: 8px;
      padding-bottom: 8px;
      border-bottom: 1px solid rgba(54, 214, 181, 0.25);
    }

    /* ===== SENDER ROLE CARD ===== */
    /* Soft sage green — warm, primary speaker */
    .role-card-sender {
      background: #DDEBE3;
      color: #1F2933;
      border-radius: 16px;
      padding: 20px 24px;
      margin-bottom: 16px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.05);
      break-inside: avoid;
      page-break-inside: avoid;
    }
    .dark .role-card-sender {
      background: #1e3a2f;
      color: #d4ede3;
    }

    /* ===== RECEIVER ROLE CARD ===== */
    /* Neutral light gray — calm, listening partner */
    .role-card-receiver {
      background: #F1F3F4;
      color: #2D3748;
      border-radius: 16px;
      padding: 20px 24px;
      margin-bottom: 16px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.05);
      break-inside: avoid;
      page-break-inside: avoid;
    }
    .dark .role-card-receiver {
      background: #2d3748;
      color: #e2e8f0;
    }

    /* ===== ROLE LABEL ===== */
    /* Small uppercase label above each card's dialogue line */
    .role-label-sender {
      font-family: system-ui, -apple-system, sans-serif;
      font-size: 0.68rem;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: #2d6a4f;
      margin-bottom: 6px;
      display: block;
    }
    .dark .role-label-sender {
      color: #74c69d;
    }
    .role-label-receiver {
      font-family: system-ui, -apple-system, sans-serif;
      font-size: 0.68rem;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: #718096;
      margin-bottom: 6px;
      display: block;
    }
    .dark .role-label-receiver {
      color: #a0aec0;
    }

    /* ===== SENDER DIALOGUE TEXT ===== */
    /* Slightly larger than Receiver for emphasis */
    .role-card-sender .card-text {
      font-size: 1rem;
      line-height: 1.75;
    }

    /* ===== RECEIVER DIALOGUE TEXT ===== */
    .role-card-receiver .card-text {
      font-size: 0.93rem;
      line-height: 1.7;
    }

    /* ===== MIRROR LINE STYLE ===== */
    /* Italic for mirrored content inside Receiver card */
    .mirror-text {
      font-style: italic;
    }

    /* ===== LOADING SPINNER ===== */
    @keyframes spin {
      to { transform: rotate(360deg); }
    }
    .spinner {
      display: inline-block;
      width: 1.1rem;
      height: 1.1rem;
      border: 2px solid rgba(255,255,255,0.4);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin 0.7s linear infinite;
      vertical-align: middle;
      margin-right: 0.4rem;
    }

    /* ===== REQUIRED FIELD INDICATOR ===== */
    .required-star {
      color: #ef4444;
      margin-left: 2px;
    }

    /* ===== VALIDATION ERROR STATE ===== */
    .field-error textarea {
      border-color: #ef4444 !important;
    }
    .error-msg {
      color: #ef4444;
      font-size: 0.78rem;
      margin-top: 0.3rem;
      display: none;
    }
    .field-error .error-msg {
      display: block;
    }

    /* ============================================================ */
    /* RETURN-TO-FORM BANNER                                         */
    /* Shown at top of output section — non-intrusive, clear        */
    /* ============================================================ */
    .return-banner {
      border-left: 3px solid #36D6B5;
    }

    /* ============================================================ */
    /* PRINT STYLESHEET                                              */
    /* Hides form + controls; prints output section only            */
    /* Preserves role card background colors in print               */
    /* ============================================================ */
    @media print {
      body * { visibility: hidden; }
      #output-section, #output-section * { visibility: visible; }
      #output-section {
        position: absolute;
        inset: 0;
        padding: 2rem;
        background: white;
        color: black;
      }
      .no-print { display: none !important; }
      .script-section-header { color: #2d6a4f !important; border-bottom-color: #b7e4c7 !important; }

      /* ===== PRINT COLOR PRESERVATION ===== */
      /* Ensures role card backgrounds render in PDF/print output */
      .role-card-sender {
        background: #DDEBE3 !important;
        color: #1F2933 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
      }
      .role-card-receiver {
        background: #F1F3F4 !important;
        color: #2D3748 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
      }
      .role-label-sender { color: #2d6a4f !important; }
      .role-label-receiver { color: #718096 !important; }

      /* Avoid awkward page breaks between script sections */
      .role-card-sender, .role-card-receiver, .script-block {
        page-break-inside: avoid;
        break-inside: avoid;
      }
    }

    /* ===== PROMPT LABEL STYLES ===== */
    .prompt-label {
      font-size: 0.7rem;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: #36D6B5;
    }

    /* ===== PROMPT INSTRUCTION STYLES ===== */
    .prompt-instruction {
      font-size: 0.9rem;
      font-weight: 600;
      color: inherit;
      line-height: 1.4;
    }

    /* ===== PROMPT ENCOURAGEMENT STYLES ===== */
    .prompt-encouragement {
      font-size: 0.8rem;
      color: #64748b;
      font-style: italic;
      margin-top: 0.2rem;
    }
    .dark .prompt-encouragement {
      color: #94a3b8;
    }