# Interactive panel ideas & templates

> Ready-to-paste interactive panels for LoreHat Studio — pick the right template for your genre, paste it in, or copy our AI remix prompt to restyle any template for your story.

Want to see what interactive panels can add to a story — or grab a working starting point without writing a single line from scratch? Below is a complete **"collect clues and confront the character"** mini-system made of four clean panels and one matching script, followed by two interactive keepsakes from our demo card _The Late-Night Study_.

**You don't have to use all four!** Pick just the one piece that fits your story, paste it into **Studio → Components**, and either use it as-is or hand it to an AI assistant with the remix prompt below to match your story's exact colors, theme, and variables.

![Studio Components page where you create each panel, pick its placement, and preview it live](/illustrations/studio-systems/studio-components.webp)

## Pick the template that matches your story

| Template | Placement in Studio | Great for… | What players can do |
| :-- | :-- | :-- | :-- |
| **Clue card** (`clue-card`) | **In reply** | Mystery, RPG loot, café keepsakes, diary drops | Appears inside a reply when something important is found, with a **Note this clue** button |
| **Relationship panel** (`relationship`) | **After reply** (pinned) | Romance, drama, faction reputation, study progress | Shows a live 0–100 progress bar and mood badge beside the chat |
| **Clue board** (`clue-board`) | **After reply** (pinned) | Mystery, quest logs, inventory checklists | Lists saved items; click **Ask** to confront the character about one, or **✕** to cross it off |
| **Theater intro** (`theater-intro`) | **Theater** | Any story that wants a striking card detail page | Displays cover artwork, hook, and story highlights before the player presses **Start** |
| **The Study Window** | **Theater** | Cozy / atmospheric cards | Drag across a foggy windowpane to wipe the glass clear and reveal a hidden detail |
| **Evening Candles** | **After reply** (pinned) | Cozy check-ins, daily mood trackers, rating rituals | Light 1 to 5 candles (or **Clear**) to save a rating silently with no extra chat turn |

## Copy-paste prompt: Ask your AI to restyle any template for your story

Don't touch HTML by hand if you'd rather not! Copy one of the templates below, then paste it into ChatGPT, Claude, or Gemini with this prompt:

````text
Adapt this working LoreHat Studio component template to fit my story. Keep it a single self-contained HTML file using Vue.createApp({...}).mount('#app'), keep all LoreHat rules intact (no fetch, no external images, readable at 320px wide, 44px button touch targets, supports light and dark themes), and return the complete HTML in one ```html block so I can paste it straight into Studio.

My story & aesthetic: [e.g., Neon cyber-noir detective story — deep slate background, soft amber highlights, clean monospace labels]
Variables I already declared in Studio:
- [e.g., suspicion (Number, 0–100)]
- [e.g., attitude (Options: cold, curious, shaken)]
What I want changed from the template:
- [e.g., Rename "Trust" to "Suspicion", swap the mood icons, and adjust the colors to match my theme]

Template to adapt:
[paste one of the HTML templates from this page]
````

> **Already pasted it into Studio?** Even easier — open the component inside Studio, click **Copy AI prompt** (which automatically includes your exact variables and current HTML), and tell your AI what colors, wording, or layout changes you want!

---

## Step 1: Add the three Work variables

If you want to try the full four-panel mystery kit (Examples 1–4), open **Work variables** in Studio and add these three variables first:

| Name | Type | Initial value | Change sources to enable | Purpose |
| :-- | :-- | :-- | :-- | :-- |
| `trust` | Number | `20` | **Allow AI to adjust**, **Allow components to change** | How much the character trusts the player (0–100) |
| `mood` | Options: `guarded`, `warm`, `hurt` | `guarded` | **Allow AI to adjust** | The character's current attitude |
| `clues` | JSON | `{}` | **Allow components to change** | Saved clues (`{ "clue-id": "Clue title" }`) |

> **Quick tip:** Open **Components → + Add component** for each panel you want, set its name and placement, and paste the HTML straight into the editor. For **Theater intro**, upload a cover image under **Visuals & interactivity → Media**, attach it to the component as `cover`, and insert the panel in **Showcase → Curtain up → Mini Theater**.

## Example 1: In-reply Clue card (`clue-card`)

**Placement:** **In reply**

Add this short instruction to **Story → Global story guidance** (or the component's **When to use** box) so the AI knows when to drop the card into its reply:

```text
When the player discovers a key clue, output this on its own line at the end of the reply:
<Component componentId="clue-card" clueId="clue-id" title="Clue title" detail="One-sentence description" />
Use only lowercase letters, digits, and hyphens in clueId; keep title under 40 characters and detail under 120; never use quotes or angle brackets in attribute values.
```

Clicking **Note this clue** saves the clue silently without interrupting the conversation.

```html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
      * {
        box-sizing: border-box;
      }
      body {
        margin: 0;
        color: #f6ece2;
        font:
          14px/1.5 system-ui,
          sans-serif;
      }
      .card {
        padding: 14px 16px;
        border: 1px solid #4a3f38;
        border-radius: 12px;
        background: #2a2320;
      }
      .kicker {
        margin: 0;
        color: #d9c7b5;
      }
      h1 {
        margin: 2px 0 6px;
        font-size: 18px;
        line-height: 1.3;
        overflow-wrap: anywhere;
      }
      .detail {
        margin: 0;
        overflow-wrap: anywhere;
      }
      button {
        width: 100%;
        min-height: 44px;
        margin-top: 12px;
        border: 1px solid #e7b073;
        border-radius: 10px;
        background: transparent;
        color: #f6ece2;
        font:
          600 14px system-ui,
          sans-serif;
        cursor: pointer;
      }
      button:hover:not(:disabled) {
        background: #3a302b;
      }
      button:focus-visible {
        outline: 2px solid #e7b073;
        outline-offset: 2px;
      }
      button:disabled {
        cursor: not-allowed;
        opacity: 0.6;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <article class="card" aria-labelledby="title">
        <p class="kicker"><span aria-hidden="true">🔎</span> New clue</p>
        <h1 id="title">{{ title }}</h1>
        <p class="detail">{{ detail }}</p>
        <button type="button" :disabled="disabled" @click="note">{{ label }}</button>
      </article>
    </div>
    <script>
      const { createApp } = Vue;
      createApp({
        props: { clueId: String, title: String, detail: String },
        data() {
          return { state: 'idle' };
        },
        computed: {
          id() {
            return (this.clueId ?? '').slice(0, 40);
          },
          name() {
            return (this.title ?? '').trim().slice(0, 40) || this.id;
          },
          disabled() {
            return !this.id || this.state === 'busy' || this.state === 'saved';
          },
          label() {
            if (this.state === 'saved') return 'Noted';
            if (this.state === 'busy') return 'Noting…';
            if (this.state === 'retry') return 'Try again';
            return 'Note this clue';
          },
        },
        methods: {
          async note() {
            if (!this.id) return;
            this.state = 'busy';
            const result = await card.emit('clue.note', { clueId: this.id, title: this.name });
            this.state = result.ok ? 'saved' : 'retry';
          },
        },
      }).mount('#app');
    </script>
  </body>
</html>
```

## Example 2: Pinned Relationship panel (`relationship`)

**Placement:** **After reply**

Automatically updates its progress bar and mood indicator whenever `trust` or `mood` changes. Works completely on its own — no script needed!

```html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
      * {
        box-sizing: border-box;
      }
      body {
        margin: 0;
        color: #f6ece2;
        font:
          14px/1.5 system-ui,
          sans-serif;
      }
      .panel {
        padding: 14px 16px;
        border-radius: 12px;
        background: #2a2320;
      }
      h1 {
        margin: 0 0 8px;
        font-size: 16px;
      }
      .row {
        display: flex;
        justify-content: space-between;
        gap: 8px;
      }
      .track {
        height: 10px;
        margin-top: 6px;
        overflow: hidden;
        border-radius: 999px;
        background: #4a3f38;
      }
      .fill {
        max-width: 100%;
        height: 100%;
        border-radius: 999px;
        background: #e7b073;
        transition: width 0.3s ease;
      }
      .mood {
        margin: 10px 0 0;
      }
      @media (prefers-reduced-motion: reduce) {
        .fill {
          transition: none;
        }
      }
    </style>
  </head>
  <body>
    <div id="app">
      <main class="panel" aria-labelledby="heading">
        <h1 id="heading">Relationship</h1>
        <div class="row">
          <span id="trust-label">Trust</span>
          <strong>{{ trust }} / 100</strong>
        </div>
        <div
          class="track"
          role="progressbar"
          aria-labelledby="trust-label"
          aria-valuemin="0"
          aria-valuemax="100"
          :aria-valuenow="trust"
        >
          <div class="fill" :style="{ width: trust + '%' }"></div>
        </div>
        <p class="mood"><span aria-hidden="true">{{ mood[0] }}</span> {{ mood[1] }}</p>
      </main>
    </div>
    <script>
      const { createApp } = Vue;
      const moods = {
        guarded: ['🛡️', 'Guarded'],
        hurt: ['💧', 'Hurt'],
        warm: ['☀️', 'Warm'],
      };

      createApp({
        data() {
          return { vars: card.vars };
        },
        computed: {
          trust() {
            return Math.max(0, Math.min(100, Number(this.vars.trust) || 0));
          },
          mood() {
            const [icon, label] = moods[this.vars.mood] ?? ['·', 'Unknown'];
            return [icon, `Mood: ${label}`];
          },
        },
      }).mount('#app');
    </script>
  </body>
</html>
```

## Example 3: Pinned Clue board (`clue-board`)

**Placement:** **After reply**

Shows every saved clue. Clicking **Ask** sends a message confronting the character about that clue; clicking **✕** crosses the clue off silently.

```html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
      * {
        box-sizing: border-box;
      }
      body {
        margin: 0;
        color: #f6ece2;
        font:
          14px/1.5 system-ui,
          sans-serif;
      }
      .panel {
        padding: 14px 16px;
        border-radius: 12px;
        background: #2a2320;
      }
      h1 {
        margin: 0 0 8px;
        font-size: 16px;
      }
      ul {
        display: grid;
        gap: 8px;
        margin: 0;
        padding: 0;
        list-style: none;
      }
      li {
        display: flex;
        align-items: center;
        gap: 8px;
      }
      .name {
        flex: 1;
        min-width: 0;
        overflow-wrap: anywhere;
      }
      button {
        flex: none;
        min-width: 44px;
        min-height: 44px;
        padding: 0 12px;
        border: 1px solid #e7b073;
        border-radius: 10px;
        background: transparent;
        color: #f6ece2;
        font:
          600 14px system-ui,
          sans-serif;
        cursor: pointer;
      }
      button:hover:not(:disabled) {
        background: #3a302b;
      }
      button:focus-visible {
        outline: 2px solid #e7b073;
        outline-offset: 2px;
      }
      button:disabled {
        cursor: not-allowed;
        opacity: 0.6;
      }
      .empty {
        margin: 0;
        color: #d9c7b5;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <main class="panel" aria-labelledby="heading">
        <h1 id="heading">Clue board</h1>
        <p class="empty" v-if="entries.length === 0">No clues noted yet.</p>
        <p class="empty" role="status" v-if="busy">Wait for the reply, then ask again.</p>
        <ul>
          <li v-for="[id, name] in entries" :key="id">
            <span class="name">{{ name }}</span>
            <button type="button" :aria-label="askLabel(name)" @click="ask(id, name)">Ask</button>
            <button type="button" :aria-label="removeLabel(name)" @click="remove(id)">✕</button>
          </li>
        </ul>
      </main>
    </div>
    <script>
      const { createApp } = Vue;
      createApp({
        data() {
          return { vars: card.vars, busy: false };
        },
        computed: {
          entries() {
            const value = this.vars.clues;
            if (!value || typeof value !== 'object' || Array.isArray(value)) return [];
            return Object.entries(value).filter(([, name]) => typeof name === 'string');
          },
        },
        methods: {
          askLabel: (name) => `Ask about "${name}"`,
          removeLabel: (name) => `Cross out "${name}"`,
          async ask(id, name) {
            const message = `I hold up "${name}" and press you about it.`;
            card.emit('clue.ask', { clueId: id });
            const result = await card.send(message);
            this.busy = !result.ok && result.error?.code === 'turn_in_progress';
          },
          remove(id) {
            const { [id]: _removed, ...rest } = this.vars.clues;
            this.vars.clues = rest;
          },
        },
      }).mount('#app');
    </script>
  </body>
</html>
```

## Example 4: Intro Theater card (`theater-intro`)

**Placement:** **Theater** (attach an image asset named `cover`, and insert it under **Showcase → Curtain up → Mini Theater**)

Displays a polished story introduction with a graceful text fallback while the cover loads. Works completely on its own — no variables or script needed!

```html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
      * {
        box-sizing: border-box;
      }
      body {
        margin: 0;
        color: #f6ece2;
        font:
          14px/1.6 system-ui,
          sans-serif;
      }
      .stage {
        overflow: hidden;
        border-radius: 16px;
        background: #1f1a17;
      }
      .cover {
        display: block;
        width: 100%;
        aspect-ratio: 16 / 9;
        object-fit: cover;
      }
      .fallback {
        display: grid;
        place-items: center;
        aspect-ratio: 16 / 9;
        padding: 16px;
        background: linear-gradient(160deg, #3a2c26, #1f1a17);
        font-size: 24px;
        text-align: center;
      }
      .body {
        padding: 16px;
      }
      h1 {
        margin: 0 0 6px;
        font-size: 22px;
        line-height: 1.3;
      }
      p {
        margin: 0 0 12px;
      }
      ul {
        margin: 0;
        padding-inline-start: 20px;
      }
      [hidden] {
        display: none !important;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <main class="stage" aria-labelledby="heading">
        <img
          class="cover"
          v-show="loaded"
          :src="assets.cover"
          alt="The Foghaven docks at night"
          @load="loaded = true"
        />
        <div class="fallback" v-show="!loaded" aria-hidden="true">Letters from Foghaven</div>
        <div class="body">
          <h1 id="heading">Letters from Foghaven</h1>
          <p>An unsigned letter brings you back to a harbor you left ten years ago.</p>
          <ul>
            <li>Talk with the lighthouse keeper and piece together a disappearance.</li>
            <li>Note clues and bring them up at the moments that matter.</li>
            <li>Your choices change how much she trusts you.</li>
          </ul>
        </div>
      </main>
    </div>
    <script>
      const { createApp } = Vue;
      createApp({
        data() {
          return { assets: card.assets, loaded: false };
        },
      }).mount('#app');
    </script>
  </body>
</html>
```

## Matching script for Example 1 (`clue-card`) & Example 3 (`clue-board`)

Paste this under **Advanced → Script** whenever you use **Example 1 (`clue-card`)** (even on its own — `clue-card` emits `clue.note`, and this script is what saves the clue into `clues`!) or both clue panels together. Clicking **Note this clue** saves to `clues`, clicking **Ask** nudges the AI to address that clue directly, and collecting the **third clue** raises `trust` by 10 automatically:

```js
const maxClueChars = Number('256');

function readClues(value) {
  if (value && typeof value === 'object' && !Array.isArray(value)) return { ...value };
  return {};
}

card.on('component.action', (event) => {
  const clueId = String(event.payload.clueId ?? '');
  if (!/^[a-z0-9-]{1,40}$/.test(clueId)) return;
  const clues = readClues(card.vars.clues);

  if (event.componentId === 'clue-card' && event.action === 'clue.note') {
    if (clues[clueId]) return;
    const title =
      String(event.payload.title ?? '')
        .trim()
        .slice(0, 40) || clueId;
    const nextClues = { ...clues, [clueId]: title };
    if (JSON.stringify(nextClues).length > maxClueChars) {
      throw new Error('Clue board full — remove a clue first');
    }
    card.vars.set('clues', nextClues);
    return;
  }

  if (event.componentId === 'clue-board' && event.action === 'clue.ask') {
    const title = clues[clueId];
    if (!title) return;
    card.prompt.note(
      `The player holds up the clue "${title}" and presses the character. Have the character respond to this clue directly instead of avoiding it.`,
      70,
    );
  }
});

card.on('variables.changed', (event) => {
  if (!event.changed.includes('clues')) return;
  const before = Object.keys(readClues(event.previous.clues)).length;
  const after = Object.keys(readClues(card.vars.clues)).length;
  if (before >= 3 || after < 3) return;
  card.vars.add('trust', 10);
});
```

## Bonus inspiration: _The Late-Night Study_

![Artwork from The Late-Night Study demo card showing a warmly lit green banker's lamp on a rainy evening](/illustrations/late-study.webp)

Two cozy interactive keepsakes from our demo story _The Late-Night Study_ (paste the HTML starting from `<!doctype html>` into **Studio → Components**):

### The Study Window (Theater placement)

Drag across the foggy windowpane to briefly clear the glass and peek at a fictional passphrase right on the card's detail page.

```text
---
placements:
  - id: study-window
    segment: theater
title: The Study Window
---
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
      * { box-sizing: border-box; }
      body { margin: 0; color: #171717; font: 14px/1.45 system-ui, sans-serif; }
      .stage {
        display: grid;
        gap: 12px;
        width: min(100%, 540px);
        margin: auto;
        padding: clamp(12px, 6vw, 36px);
        border: 1px solid #dedbd8;
        border-radius: 14px;
        background: #fff;
      }
      .heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
      label { font-weight: 550; }
      button {
        min-height: 44px;
        padding: 0 12px;
        border: 1px solid #00000024;
        border-radius: 6px;
        background: #fff;
        color: #171717;
        font: inherit;
        cursor: pointer;
      }
      button:hover { background: #f4f4f4; }
      button:focus-visible, input:focus-visible { outline: 2px solid #005fcc; outline-offset: 3px; }
      .pane {
        position: relative;
        isolation: isolate;
        display: grid;
        align-items: center;
        min-height: clamp(165px, 64vw, 300px);
        border-radius: 6px;
        touch-action: pan-y;
        background:
          linear-gradient(90deg, transparent 57%, #281e1c 58% 60%, transparent 61%),
          linear-gradient(0deg, transparent 25%, #2d2223 26% 29%, transparent 30%),
          radial-gradient(ellipse at 20% 73%, #c68853 0%, #79513f 17%, transparent 46%),
          radial-gradient(ellipse at 77% 25%, #758391 0%, #3b4853 40%, #2a202a 85%);
        box-shadow: 0 0 0 1px #00000024;
      }
      .condensation, .condensation::after {
        position: absolute;
        inset: 0;
        border-radius: inherit;
        pointer-events: none;
      }
      .condensation {
        background: linear-gradient(150deg, #c9d2dc45, #9b888048 65%, #2b253b55);
        backdrop-filter: blur(12px);
        transition: opacity 220ms ease;
      }
      .condensation::after {
        content: '';
        background:
          radial-gradient(ellipse at 24% 26%, #f3f8ff73 2%, #1714215e 4%, transparent 7%) 0 0 / 31px 38px,
          radial-gradient(ellipse at 70% 58%, #fef9ec66 3%, #24182268 5%, transparent 8%) 0 0 / 19px 41px,
          radial-gradient(ellipse at 34% 18%, #f5eff65e 1%, #2418226a 3%, transparent 5%) 0 0 / 53px 29px;
      }
      .wiping .condensation {
        mask-image: radial-gradient(circle at var(--wipe-x) var(--wipe-y), transparent 0 22px, #000 60px);
      }
      .revealed .condensation { opacity: 0.55; }
      input {
        position: relative;
        width: calc(100% - 24px);
        min-width: 0;
        min-height: 54px;
        margin: 12px;
        padding: 6px;
        border: 0;
        border-radius: 6px;
        background: #211c278c;
        color: #fff;
        caret-color: #fff;
        font: 500 clamp(17px, 6vw, 34px)/1.2 ui-monospace, monospace;
        letter-spacing: 0.03em;
        text-align: center;
      }
      @media (prefers-reduced-motion: reduce) { .condensation { transition: none; } }
      @media (forced-colors: active) {
        input { border: 1px solid CanvasText; }
        button:focus-visible, input:focus-visible { outline-color: CanvasText; }
      }
    </style>
  </head>
  <body>
    <div id="app">
      <section class="stage" :class="{ revealed }" aria-labelledby="study-label">
        <div class="heading">
          <label id="study-label" for="study-phrase">Study passphrase</label>
          <button
            type="button"
            aria-controls="study-phrase"
            :aria-label="revealed ? 'Hide passphrase' : 'Show passphrase'"
            @click="revealed = !revealed"
          >
            {{ revealed ? 'Hide' : 'Show' }}
          </button>
        </div>
        <div class="pane" @pointermove="wipe" @pointerleave="stopWipe" @pointerup="stopWipe" @pointercancel="stopWipe">
          <div class="condensation" aria-hidden="true"></div>
          <input
            id="study-phrase"
            v-model="phrase"
            :type="revealed ? 'text' : 'password'"
            autocomplete="off"
            spellcheck="false"
            maxlength="16"
          />
        </div>
      </section>
    </div>
    <script>
      Vue.createApp({
        data() {
          // Only the preview holds this fictional phrase. It never enters chat or card state.
          return { phrase: 'rain-and-oolong', revealed: false };
        },
        methods: {
          wipe(event) {
            if (!event.buttons || event.target !== event.currentTarget) {
              this.stopWipe(event);
              return;
            }
            const pane = event.currentTarget;
            const bounds = pane.getBoundingClientRect();
            pane.style.setProperty('--wipe-x', event.clientX - bounds.left + 'px');
            pane.style.setProperty('--wipe-y', event.clientY - bounds.top + 'px');
            pane.classList.add('wiping');
          },
          stopWipe(event) {
            event.currentTarget.classList.remove('wiping');
          },
        },
      }).mount('#app');
    </script>
  </body>
</html>
```

### Evening Candles (After-reply pinned panel)

Lets the player light 1 to 5 candles (or click **Clear**) to rate the evening — saved silently into the `evening_rating` variable with no extra chat message.

First add the `evening_rating` variable (`Number`, initial value `0`, with **Allow components to change** turned on):

```markdown
---
initial: "0"
integer: true
max: 5
min: 0
playerWritable: true
type: number
---
The player's evening rating in this chat. Zero means the player has not rated the evening or has cleared the rating. It does not change Qinghuai's mood or closeness.
```

Then paste the candle panel into **Components**:

```text
---
placements:
  - id: evening-candles
    segment: after-reply
title: Evening Candles
---
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
      * { box-sizing: border-box; }
      body { margin: 0; color: #ededed; font: 14px/1.45 system-ui, sans-serif; }
      .rating {
        --flame: #ffc680;
        display: grid;
        align-content: end;
        width: min(100%, 540px);
        min-height: clamp(226px, 86vw, 388px);
        margin: auto;
        padding: clamp(12px, 7vw, 40px);
        overflow: hidden;
        border: 1px solid #39312b;
        border-radius: 14px;
        background:
          radial-gradient(ellipse at 50% 70%, #302017 0%, transparent 68%),
          linear-gradient(#050505 58%, #181615 59%, #090807 100%);
      }
      fieldset { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0; margin: 0; border: 0; min-inline-size: 0; }
      .candle {
        position: relative;
        display: grid;
        justify-items: center;
        align-content: end;
        min-height: clamp(116px, 44vw, 218px);
        padding: 8px 0;
        border-radius: 8px;
        cursor: pointer;
      }
      .candle input { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
      .candle:has(:focus-visible), button:focus-visible { outline: 2px solid var(--flame); outline-offset: -2px; }
      .candle:has(:checked) .number { color: #120d09; background: var(--flame); }
      .wax {
        position: relative;
        width: 60%;
        max-width: 52px;
        height: clamp(31px, 14vw, 74px);
        border-radius: 48% 48% 40% 40% / 14% 14% 9% 9%;
        background: linear-gradient(90deg, #291d18, #735b4b 25%, #4c372d 63%, #201715);
        box-shadow: 3px 7px 8px #000a;
      }
      .wax::before {
        content: '';
        position: absolute;
        inset: 0 0 auto;
        height: 25%;
        border-radius: 50%;
        background: radial-gradient(ellipse, #39291e 35%, #87705c 100%);
      }
      .wax::after {
        content: '';
        position: absolute;
        bottom: 92%;
        left: calc(50% - 1px);
        width: 2px;
        height: 9px;
        background: #a38b74;
      }
      .lit .wax {
        background: linear-gradient(90deg, #5c3628, #dfaf81 25%, #ae7352 63%, #3d261f);
        box-shadow: 3px 8px 10px #000b, 0 4px 24px #fa8a2b52;
      }
      .lit .wax::before { background: radial-gradient(ellipse, #e8a25f 28%, #ffe6a9 67%, #a16950 100%); }
      .flame {
        position: absolute;
        z-index: 1;
        left: 50%;
        bottom: calc(100% + 2px);
        width: clamp(7px, 3vw, 15px);
        height: clamp(19px, 7vw, 42px);
        transform: translateX(-50%);
        transform-origin: 50% 100%;
        border-radius: 75% 25% 52% 48% / 75% 65% 35% 25%;
        background: linear-gradient(#ff9d3e, #fff6c6 58%, #ffc876 85%, #803b27);
        box-shadow: 0 0 14px #ff9b43, 0 0 38px #f87c29ad, 0 0 60px #e47b3766;
        opacity: 0;
        pointer-events: none;
      }
      .lit .flame { opacity: 1; animation: flicker 1.8s ease-in-out infinite alternate; }
      .candle:nth-of-type(even) .flame { animation-delay: -0.8s; }
      @keyframes flicker {
        0%, 100% { transform: translateX(-50%) rotate(-3deg) scaleY(0.94); }
        40% { transform: translateX(-50%) rotate(4deg) scaleY(1.04); }
        66% { transform: translateX(-50%) rotate(1deg) scaleY(0.98); }
      }
      .number { display: grid; place-items: center; width: 24px; height: 24px; margin-top: 9px; border-radius: 50%; color: #c6b7ac; }
      .number, output { font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; }
      .footer {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        column-gap: 12px;
        margin-top: 12px;
        border-top: 1px solid #ffffff24;
        color: #c6b7ac;
      }
      .result { display: flex; align-items: center; gap: 6px; }
      output { color: #ededed; }
      button { min-height: 44px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
      button:hover { color: #fff1db; }
      [role='status'] { margin: 0; }
      [role='status']:empty { display: none; }
      @media (prefers-reduced-motion: reduce) { .lit .flame { animation: none; } }
      @media (forced-colors: active) {
        .candle:has(:checked) .number { outline: 2px solid Highlight; }
        .candle:has(:focus-visible), button:focus-visible { outline-color: CanvasText; }
      }
    </style>
  </head>
  <body>
    <div id="app">
      <section class="rating" aria-labelledby="question">
        <fieldset aria-labelledby="question" :aria-busy="saving">
          <label v-for="step in 5" :key="step" class="candle" :class="{ lit: step <= score }">
            <input
              :id="'candle-' + step"
              type="radio"
              name="evening-rating"
              :checked="step === score"
              :aria-label="step + ' of 5'"
              @change="choose(step, $event)"
            />
            <span class="wax" aria-hidden="true"><span class="flame"></span></span>
            <span class="number" aria-hidden="true">{{ step }}</span>
          </label>
        </fieldset>
        <div class="footer">
          <span id="question">How was the evening?</span>
          <div class="result">
            <output aria-label="Evening rating">{{ score }} of 5</output>
            <button type="button" @click="choose(0, $event)">Clear</button>
          </div>
        </div>
        <p role="status">{{ error }}</p>
      </section>
    </div>
    <script>
      Vue.createApp({
        data() {
          return { vars: card.vars, saving: false, error: '' };
        },
        computed: {
          score() {
            return this.vars.evening_rating ?? 0;
          },
        },
        methods: {
          async choose(value, event) {
            // The bridge updates the visible score optimistically and restores it on rejection.
            if (!this.saving && value !== this.score) {
              this.saving = true;
              this.error = '';
              const result = await card.vars.set('evening_rating', value);
              this.saving = false;
              if (!result.ok) this.error = 'Rating could not be saved. Try again.';
            }
            // Native radio activation changes checked before Vue renders. Reconcile it after a rejected or overlapping selection.
            if (event.target instanceof HTMLInputElement && value !== this.score) {
              event.target.checked = false;
              const selected = document.getElementById('candle-' + this.score);
              if (selected) selected.checked = true;
            }
          },
        },
      }).mount('#app');
    </script>
  </body>
</html>
```

## Four quick tips when customizing templates

- **Keep action names aligned:** If you rename `clue.note` inside a panel, rename it in the matching Script too (or ask your AI to update both together).
- **Show any variable easily:** Write `{{ vars.your_variable }}` anywhere in a panel — pinned panels automatically receive every declared variable.
- **Count safely:** Use `vars.gold += 1` (or `card.vars.add('gold', 1)`) for counters so updates never overwrite each other.
- **Check on phone widths:** Test every panel in **Preview chat** and in a private **Only you** publication on both desktop and phone widths — if anything wraps awkwardly, click **Copy fix prompt** or **Copy AI prompt** and ask your AI to tighten the narrow-screen layout.

Related: [Interactive panels & overlays guide](/en/creator/components-reference/) · [Test, review, publish, and update a work](/en/creator/publish/)
