:root {
    --bg-0: #1d1109;
    --bg-1: #100a05;
    --room-glow: rgba(255, 170, 80, 0.55);
    --room-glow-soft: rgba(255, 158, 70, 0.16);
    --text: #f3e7d3;
    --muted: rgba(243, 231, 211, 0.55);
    --accent: #e8a85a;
    --glow-strength: 0;   /* 0 unlit, 1 lit */
    --ambient-strength: 0;
    --flame-bright: 1;    /* JS-driven flicker, ~0.8..1.15 */
    --flame-stretch: 1;   /* JS-driven vertical lick, couples size to brightness */
    --lean: 0deg;
    --flame-edge: #ff7b1a;
    --flame-mid: #ffd75e;
    --flame-core: #fff7d8;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; }

  body {
    font-family: "Inter", system-ui, sans-serif;
    color: var(--text);
    background: radial-gradient(140% 100% at 50% 112%, var(--bg-0) 0%, var(--bg-1) 58%, #060301 100%);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background 1.2s var(--ease);
  }

  .ambient {
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background: radial-gradient(circle at 50% 46%, var(--room-glow-soft) 0%, transparent 50%);
    opacity: calc(var(--ambient-strength) * var(--flame-bright));
    transition: opacity 0.18s linear;
  }
  /* second, softer fill of light to round out the room */
  .ambient::after {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(circle at 50% 44%, rgba(255,150,60,0.10) 0%, transparent 38%);
    opacity: var(--ambient-strength);
    transition: opacity 1.4s var(--ease);
  }

  .stage {
    position: relative; z-index: 1; height: 100%;
    display: grid; grid-template-rows: auto 1fr auto;
    align-items: center; justify-items: center;
    padding: clamp(14px, 2.5vh, 32px) 18px;
  }

  /* ---- Greeting ---- */
  .greeting { text-align: center; z-index: 3; }
  .greeting .eyebrow {
    font-size: 0.72rem; letter-spacing: 0.42em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 0.7rem; padding-left: 0.42em;
  }
  .greeting .title {
    font-family: "Cormorant Garamond", serif; font-weight: 300;
    font-size: clamp(2rem, 6.5vw, 3.6rem); line-height: 1; letter-spacing: 0.01em;
  }
  .greeting .title em { font-style: italic; color: var(--accent); }

  /* ---- Scene ---- */
  .scene {
    position: relative; display: flex; align-items: flex-end; justify-content: center;
    width: 100%; height: 100%; cursor: pointer;
    padding-bottom: clamp(8px, 4vh, 52px);
  }
  .surface {
    position: absolute; bottom: -34px; left: 50%;
    width: 340px; height: 120px; transform: translateX(-50%);
    background: radial-gradient(ellipse at center, var(--room-glow) 0%, transparent 68%);
    filter: blur(16px);
    opacity: calc(var(--glow-strength) * var(--flame-bright) * 0.7);
    pointer-events: none;
  }
  .candle-rig {
    position: relative; transform-origin: 50% 100%;
    transform: scale(var(--rig-scale, 1));
    transition: transform .4s var(--ease);
  }
  /* candle size is measured and set in JS so it fills the available space on any device */

  /* ---- Flame ---- */
  .flame {
    position: absolute; left: 50%; bottom: 100%;
    width: calc(70px * var(--scale, 1));
    height: calc(180px * var(--scale, 1));
    transform: translate(-50%, calc(20px * var(--scale,1))) rotate(var(--lean));
    transform-origin: 50% 92%;
    transition: opacity 0.5s var(--ease), transform 0.35s var(--ease);
    pointer-events: none; opacity: 0;
  }
  body.is-lit .flame { opacity: 1; }

  .flame__halo {
    position: absolute; left: 50%; top: 46%;
    width: calc(330px * var(--scale, 1)); height: calc(330px * var(--scale, 1));
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--room-glow) 0%, transparent 60%);
    filter: blur(7px);
    opacity: calc(var(--glow-strength) * var(--flame-bright) * 0.9);
    transition: opacity 0.16s linear;
  }

  .flame__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
    transform-origin: 50% 92%; transform: scaleY(var(--flame-stretch)); }

  /* the dancing part of the flame (body + tip) */
  .flame__dance {
    transform-origin: 50% 92%;
    animation: sway 3.7s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(255, 140, 50, calc(0.55 * var(--flame-bright))));
  }
  @keyframes sway {
    0%, 100% { transform: rotate(0deg)   translateX(0); }
    28% { transform: rotate(1.4deg)  translateX(0.6px); }
    52% { transform: rotate(-1.1deg) translateX(-0.6px); }
    76% { transform: rotate(0.7deg)  translateX(0.3px); }
  }
  /* the hot core barely moves */
  .flame__core { animation: corePulse 2.3s ease-in-out infinite; transform-origin: 50% 80%; }
  @keyframes corePulse {
    0%,100% { transform: scaleY(1) scaleX(1); }
    50% { transform: scaleY(1.06) scaleX(0.96); }
  }

  /* lighting catch */
  body.is-catching .flame { animation: catch 0.65s var(--ease); }
  @keyframes catch {
    0%  { opacity: 0; transform: translate(-50%, calc(28px * var(--scale,1))) rotate(var(--lean)) scaleY(0.15); }
    45% { opacity: 1; transform: translate(-50%, calc(8px * var(--scale,1)))  rotate(var(--lean)) scaleY(1.22); }
    100%{ opacity: 1; transform: translate(-50%, calc(20px * var(--scale,1))) rotate(var(--lean)) scaleY(1); }
  }

  /* wick */
  .wick {
    position: absolute; left: 50%; bottom: 100%;
    width: 3px; height: 13px; transform: translateX(-50%);
    background: linear-gradient(to top, #4a3422 0%, #241712 55%, #0c0a09 100%);
    border-radius: 2px; z-index: 2;
  }
  .wick::after { /* ember */
    content: ""; position: absolute; top: -3px; left: 50%; width: 5px; height: 6px;
    transform: translateX(-50%); border-radius: 50%;
    background: radial-gradient(circle, #ffd98a, #ff7a1a 70%, transparent);
    opacity: calc(var(--glow-strength) * var(--flame-bright)); filter: blur(0.6px);
  }

  /* ---- Reading: pillar ---- */
  .pillar {
    position: relative; width: 116px; height: 168px; border-radius: 10px 10px 9px 9px;
    background:
      linear-gradient(90deg, rgba(0,0,0,0.34) 0%, rgba(255,255,255,0.12) 30%, transparent 46%, transparent 70%, rgba(0,0,0,0.36) 100%),
      linear-gradient(to bottom, #f4e4c4, #e7cfa0 55%, #d3b582);
    box-shadow:
      inset 0 -16px 24px rgba(120, 80, 30, 0.28),
      0 0 34px rgba(255,170,80, calc(var(--glow-strength) * var(--flame-bright) * 0.5));
  }
  .pillar::before { /* warm translucent top rim (subsurface) */
    content: ""; position: absolute; top: -10px; left: 50%; width: 116px; height: 24px;
    transform: translateX(-50%); border-radius: 50%;
    background: linear-gradient(to bottom, #fff1d4, #e3c896);
    box-shadow:
      inset 0 5px 9px rgba(160,110,50,0.45),
      0 0 18px rgba(255,180,90, calc(var(--glow-strength) * var(--flame-bright) * 0.7));
  }
  .pillar::after { /* molten pool glow */
    content: ""; position: absolute; top: -7px; left: 50%; width: 74px; height: 15px;
    transform: translateX(-50%); border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255,200,120,0.95), rgba(255,150,70,0.4) 55%, transparent 72%);
    opacity: calc(var(--glow-strength) * var(--flame-bright)); filter: blur(1.5px);
  }

  /* ---- Dinner: taper + holder ---- */
  .taper-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
  .taper {
    position: relative; width: 28px; height: 168px; border-radius: 14px 14px 4px 4px;
    background:
      linear-gradient(90deg, rgba(0,0,0,0.32) 0%, rgba(255,255,255,0.14) 28%, transparent 44%, transparent 72%, rgba(0,0,0,0.34) 100%),
      linear-gradient(to bottom, #fbf3e2, #f0e3cb 60%, #e4d2b0);
    box-shadow: 0 0 28px rgba(255,160,80, calc(var(--glow-strength) * var(--flame-bright) * 0.45)); z-index: 2;
  }
  .taper::before {
    content: ""; position: absolute; top: -4px; left: 50%; width: 28px; height: 13px;
    transform: translateX(-50%); border-radius: 50%;
    background: radial-gradient(ellipse at 50% 30%, #fff3da, #d9c099);
    box-shadow: 0 0 14px rgba(255,180,90, calc(var(--glow-strength) * var(--flame-bright) * 0.7));
  }
  .holder { position: relative; margin-top: -10px; z-index: 1; }
  .holder .cup {
    width: 56px; height: 22px; border-radius: 0 0 8px 8px;
    background: linear-gradient(to bottom, #6b4a1c, #c79548 35%, #7a571f);
    box-shadow: inset 0 2px 5px rgba(255,220,150,0.45);
  }
  .holder .stem { width: 14px; height: 30px; margin: 0 auto;
    background: linear-gradient(90deg, #5a3d18, #c79548 50%, #5a3d18); }
  .holder .foot { width: 84px; height: 16px; border-radius: 50%;
    background: linear-gradient(to bottom, #b3863e, #6b4a1c); box-shadow: 0 6px 16px rgba(0,0,0,0.5); }

  /* ---- Birthday: cake ---- */
  .cake { position: relative; }
  .cake .candles {
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    display: flex; gap: 26px; align-items: flex-end;
  }
  .bcandle {
    position: relative; width: 12px; height: 64px; border-radius: 3px;
    background: repeating-linear-gradient(-52deg, #ff5d8f 0 7px, #fdf3f7 7px 14px);
    box-shadow: inset -2px 0 3px rgba(0,0,0,0.25), 0 0 14px rgba(255,170,90, calc(var(--glow-strength) * var(--flame-bright) * 0.4));
  }
  .bcandle:nth-child(odd) { background: repeating-linear-gradient(-52deg, #5ec5e8 0 7px, #fdfaf3 7px 14px); }
  .bcandle:nth-child(3)   { background: repeating-linear-gradient(-52deg, #b78bff 0 7px, #fdfaf3 7px 14px); }
  .cake .tier { margin: 0 auto; border-radius: 10px 10px 6px 6px; position: relative; }
  .cake .tier.top {
    width: 190px; height: 64px;
    background: var(--cake-color, #efc79a);
    background: linear-gradient(to bottom,
      color-mix(in srgb, var(--cake-color, #efc79a) 76%, #fff),
      var(--cake-color, #efc79a) 60%,
      color-mix(in srgb, var(--cake-color, #efc79a) 82%, #000));
    box-shadow: inset 0 -10px 14px rgba(80,45,15,0.3), 0 0 30px rgba(255,170,80, calc(var(--glow-strength) * var(--flame-bright) * 0.5));
  }
  .cake .tier.top::before {
    content: ""; position: absolute; top: -6px; left: 0; right: 0; height: 18px;
    background:
      radial-gradient(circle at 14% 0, #fff5e6 0 14px, transparent 15px),
      radial-gradient(circle at 38% 0, #fff5e6 0 12px, transparent 13px),
      radial-gradient(circle at 62% 0, #fff5e6 0 14px, transparent 15px),
      radial-gradient(circle at 86% 0, #fff5e6 0 12px, transparent 13px);
  }
  .cake .tier.base {
    width: 240px; height: 78px; margin-top: 4px;
    background: var(--cake-color, #e2b27f);
    background: linear-gradient(to bottom,
      color-mix(in srgb, var(--cake-color, #efc79a) 66%, #fff),
      color-mix(in srgb, var(--cake-color, #efc79a) 90%, #000) 60%,
      color-mix(in srgb, var(--cake-color, #efc79a) 70%, #000));
    box-shadow: inset 0 -12px 16px rgba(80,45,15,0.32);
  }
  .cake .tier.base::after {
    content: ""; position: absolute; top: 20px; left: 0; right: 0; height: 16px;
    background:
      radial-gradient(circle at 12% 50%, #ff6ba8 0 3px, transparent 4px),
      radial-gradient(circle at 28% 30%, #ffd23f 0 3px, transparent 4px),
      radial-gradient(circle at 44% 60%, #4ecdc4 0 3px, transparent 4px),
      radial-gradient(circle at 60% 35%, #b78bff 0 3px, transparent 4px),
      radial-gradient(circle at 76% 55%, #ff6ba8 0 3px, transparent 4px),
      radial-gradient(circle at 90% 40%, #ffd23f 0 3px, transparent 4px);
  }

  /* vessel visibility */
  .vessel { display: none; }
  body[data-theme="reading"]  .vessel--reading  { display: block; }
  body[data-theme="dinner"]   .vessel--dinner   { display: flex; }

  /* dinner: a row of candles spanning the screen */
  .dinner-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; width: 94vw; position: relative; z-index: 1; }
  body[data-theme="dinner"] .candle-rig { transform: none; }   /* don't zoom the row */
  body[data-theme="dinner"] .vessel--dinner { position: relative; }
  body[data-theme="dinner"] .surface { width: 92vw; height: 150px; bottom: -46px; }
  .dcandle {
    position: relative; flex: 0 0 auto; width: 34px; border-radius: 8px 8px 6px 6px;
    background:
      linear-gradient(90deg, rgba(0,0,0,0.34) 0%, rgba(255,255,255,0.12) 30%, transparent 46%, transparent 70%, rgba(0,0,0,0.36) 100%),
      linear-gradient(to bottom, #f4e4c4, #e7cfa0 55%, #d3b582);
    box-shadow:
      inset 0 -14px 20px rgba(120, 80, 30, 0.28),
      0 0 26px rgba(255,170,80, calc(var(--glow-strength) * var(--flame-bright) * 0.45));
  }
  .dcandle::before {   /* warm translucent top rim, like the reading candle */
    content: ""; position: absolute; top: -6px; left: 50%; width: 34px; height: 13px;
    transform: translateX(-50%); border-radius: 50%;
    background: linear-gradient(to bottom, #fff1d4, #e3c896);
    box-shadow:
      inset 0 4px 7px rgba(160,110,50,0.45),
      0 0 14px rgba(255,180,90, calc(var(--glow-strength) * var(--flame-bright) * 0.7));
  }
  .dcandle::after {    /* molten pool glow at the wick */
    content: ""; position: absolute; top: -4px; left: 50%; width: 22px; height: 9px;
    transform: translateX(-50%); border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255,200,120,0.95), rgba(255,150,70,0.4) 55%, transparent 72%);
    opacity: calc(var(--glow-strength) * var(--flame-bright)); filter: blur(1px);
  }

  /* dinner: framed photo standing behind the candles */
  .photo-frame {
    position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%);
    width: clamp(150px, 26vw, 260px); display: none; z-index: 0;
    padding: 10px; border-radius: 6px;
    background: linear-gradient(145deg, #7a643c, #4a3c24);
    border: 1px solid rgba(255,220,160,0.3);
    box-shadow: 0 12px 34px rgba(0,0,0,0.55), 0 0 34px rgba(255,170,80, calc(var(--glow-strength) * var(--flame-bright) * 0.45));
  }
  .photo-frame img { display: block; width: 100%; height: auto; max-height: 42vh; object-fit: cover; border-radius: 3px; }
  body[data-theme="dinner"] .photo-frame.has-photo { display: block; }

  /* dinner-only customise controls */
  .dinner-only { display: none; }
  body[data-theme="dinner"] .dinner-only { display: flex; }
  .photo-btn {
    font-family: "Cormorant Garamond", serif; font-size: 0.92rem; letter-spacing: 0.05em;
    color: #1a0f06; background: var(--accent); border: none; border-radius: 999px;
    padding: 7px 16px; cursor: pointer; transition: filter .3s; white-space: nowrap;
  }
  .photo-btn:hover { filter: brightness(1.08); }
  body[data-theme="birthday"] .vessel--birthday { display: block; }

  .hint {
    position: absolute; bottom: calc(100% + 30px); left: 50%; transform: translateX(-50%);
    font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
    white-space: nowrap; animation: hintPulse 2.4s ease-in-out infinite;
  }
  body.is-lit .hint { display: none; }
  @keyframes hintPulse { 0%,100%{opacity:.4} 50%{opacity:.85} }

  /* ---- Controls ---- */
  .controls { display: flex; flex-direction: column; align-items: center; gap: 14px; z-index: 4; width: 100%; }
  .bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }
  .panel {
    display: none; flex-direction: column; align-items: center; gap: 14px;
    padding: 14px 18px; border-radius: 18px; max-width: min(580px, 92vw);
    background: rgba(20, 12, 8, 0.55); border: 1px solid rgba(255, 230, 200, 0.1); backdrop-filter: blur(10px);
  }
  .panel.open { display: flex; }
  .customise {
    font-family: "Cormorant Garamond", serif; font-size: 0.98rem; letter-spacing: 0.07em; color: var(--text);
    background: transparent; border: 1px solid rgba(255, 225, 190, 0.28); padding: 8px 18px; border-radius: 999px;
    cursor: pointer; transition: border-color .3s, background .3s, color .3s;
  }
  .customise:hover { border-color: var(--accent); background: rgba(232, 168, 90, 0.12); }
  .customise[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
  .themes {
    display: flex; gap: 8px; padding: 5px; border-radius: 999px;
    background: rgba(255, 240, 215, 0.05); border: 1px solid rgba(255, 230, 200, 0.1); backdrop-filter: blur(6px);
  }
  .themes button {
    font-family: inherit; font-size: 0.82rem; letter-spacing: 0.04em; color: var(--muted);
    background: transparent; border: none; padding: 9px 18px; border-radius: 999px; cursor: pointer;
    transition: color 0.3s, background 0.3s;
  }
  .themes button:hover { color: var(--text); }
  .themes button[aria-pressed="true"] { color: #1a0f06; background: var(--accent); }
  .action {
    font-family: "Cormorant Garamond", serif; font-size: 0.98rem; letter-spacing: 0.07em; color: var(--text);
    background: transparent; border: 1px solid rgba(255, 225, 190, 0.28); padding: 8px 20px; border-radius: 999px;
    cursor: pointer; transition: border-color 0.3s, background 0.3s;
  }
  .action:hover { border-color: var(--accent); background: rgba(232, 168, 90, 0.12); }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

  /* smoke */
  .smoke {
    position: absolute; left: 50%; bottom: 100%; width: 6px; height: 6px; transform: translateX(-50%);
    border-radius: 50%; background: rgba(220, 215, 205, 0.5); filter: blur(3px);
    pointer-events: none; animation: smokeRise 2.6s ease-out forwards;
  }
  @keyframes smokeRise {
    0% { opacity: 0; transform: translate(-50%, 0) scale(0.6); }
    20% { opacity: 0.65; }
    100% { opacity: 0; transform: translate(calc(-50% + 14px), -120px) scale(3); }
  }

  /* confetti */
  .confetti { position: fixed; top: -12px; width: 9px; height: 14px; z-index: 6; pointer-events: none; animation: confettiFall linear forwards; }
  @keyframes confettiFall { 0% { transform: translateY(0) rotateZ(0deg); opacity: 1; } 100% { transform: translateY(105vh) rotateZ(720deg); opacity: 0.9; } }

  /* dust motes */
  .mote {
    position: absolute; width: 3px; height: 3px; border-radius: 50%;
    background: rgba(255, 210, 150, 0.7); filter: blur(0.5px); pointer-events: none;
    animation: moteFloat linear infinite; opacity: var(--glow-strength);
  }
  @keyframes moteFloat { 0% { transform: translate(0,0); opacity: 0; } 20% { opacity: 0.7; } 80% { opacity: 0.5; } 100% { transform: translate(var(--mx, 20px), -160px); opacity: 0; } }

  /* ---- Sound toggle ---- */
  .sound {
    position: fixed; top: 18px; right: 18px; z-index: 10;
    width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
    color: var(--text); background: rgba(255,240,215,0.05);
    border: 1px solid rgba(255,230,200,0.12); cursor: pointer; transition: border-color .3s, color .3s;
  }
  .sound:hover { border-color: var(--accent); color: var(--accent); }
  .sound .slash { opacity: 0; }
  .sound.muted .wave { opacity: 0; }
  .sound.muted .slash { opacity: 1; }

  .lang {
    position: fixed; top: 18px; left: 18px; z-index: 10;
    font-family: inherit; font-size: 0.8rem; color: var(--text);
    background: rgba(255,240,215,0.05); border: 1px solid rgba(255,230,200,0.12);
    border-radius: 999px; padding: 9px 14px; cursor: pointer; outline: none;
    transition: border-color .3s;
  }
  .lang:hover { border-color: var(--accent); }
  .lang option { color: #1a0f06; }

  .fs-btn {
    position: fixed; top: 18px; right: 68px; z-index: 10;
    width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
    color: var(--text); background: rgba(255,240,215,0.05);
    border: 1px solid rgba(255,230,200,0.12); cursor: pointer; transition: border-color .3s, color .3s;
  }
  .fs-btn:hover { border-color: var(--accent); color: var(--accent); }
  .fs-btn .fs-exit { display: none; }
  .fs-btn.is-fs .fs-enter { display: none; }
  .fs-btn.is-fs .fs-exit { display: inline; }

  /* ---- Cake name (piped icing) ---- */
  .cake-name {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    padding-top: 18px; pointer-events: none; z-index: 3;
    font-family: "Great Vibes", cursive; font-size: 30px; line-height: 1; color: var(--name-color, #fff7ef);
    text-shadow: 0 1px 0 #e7adc1, 0 2px 1px rgba(120,40,60,0.4),
                 0 0 12px rgba(255,180,120, calc(var(--glow-strength) * var(--flame-bright) * 0.85));
  }

  /* ---- Birthday-only extras ---- */
  .birthday-only { display: none; }
  body[data-theme="birthday"] .birthday-only { display: flex; }
  .bx { gap: 10px; align-items: center; }
  .cake-input {
    font-family: inherit; font-size: 0.8rem; color: var(--text); text-align: center; width: 136px;
    background: rgba(255,240,215,0.06); border: 1px solid rgba(255,230,200,0.16);
    border-radius: 999px; padding: 7px 12px; outline: none; transition: border-color .3s;
  }
  .cake-input:focus { border-color: var(--accent); }
  .cake-input::placeholder { color: var(--muted); }
  .age-input {
    font-family: inherit; font-size: 0.8rem; color: var(--text); text-align: center; width: 58px;
    background: rgba(255,240,215,0.06); border: 1px solid rgba(255,230,200,0.16);
    border-radius: 999px; padding: 7px 8px; outline: none; transition: border-color .3s;
  }
  .age-input:focus { border-color: var(--accent); }
  .age-input::placeholder { color: var(--muted); }
  .age-input::-webkit-outer-spin-button, .age-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .age-input { -moz-appearance: textfield; }
  .cake-age {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    pointer-events: none; z-index: 3;
    font-family: "Cormorant Garamond", serif; font-weight: 500; font-size: 34px; line-height: 1;
    color: var(--age-color, #fff3d4);
    text-shadow: 0 1px 1px rgba(120,70,20,0.5),
                 0 0 16px rgba(255,190,110, calc(var(--glow-strength) * var(--flame-bright) * 0.95));
  }

  /* ---- colour swatches ---- */
  .swatches { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
  .swatch { display: flex; flex-direction: column; align-items: center; gap: 5px;
    font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
  .swatch input[type="color"] {
    width: 30px; height: 30px; border: none; border-radius: 50%; background: none; cursor: pointer; padding: 0;
  }
  .swatch input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
  .swatch input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(255,255,255,0.3); border-radius: 50%; }
  .swatch input[type="color"]::-moz-color-swatch { border: 1px solid rgba(255,255,255,0.3); border-radius: 50%; }
  .reset-btn {
    font-family: inherit; font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--muted); background: transparent; border: 1px solid rgba(255,230,200,0.16);
    border-radius: 999px; padding: 7px 12px; cursor: pointer; transition: color .3s, border-color .3s; align-self: center;
  }
  .reset-btn:hover { color: var(--text); border-color: var(--accent); }
  .wish-btn {
    font-family: "Cormorant Garamond", serif; font-size: 0.92rem; letter-spacing: 0.05em;
    color: #1a0f06; background: var(--accent); border: none; border-radius: 999px;
    padding: 7px 16px; cursor: pointer; transition: filter .3s; white-space: nowrap;
  }
  .wish-btn:hover { filter: brightness(1.08); }
  .wish-btn:disabled { opacity: 0.45; cursor: default; filter: none; }

  /* ---- Wish countdown ---- */
  .wish {
    position: absolute; top: 13%; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    opacity: 0; pointer-events: none; transition: opacity .5s var(--ease); z-index: 5; text-align: center;
  }
  .wish.show { opacity: 1; }
  .wish .dial { position: relative; width: 118px; height: 118px; }
  .wish svg { width: 118px; height: 118px; transform: rotate(-90deg); }
  .wish .ring-track { fill: none; stroke: rgba(255,255,255,0.12); stroke-width: 4; }
  .wish .ring-prog  { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
  .wish .num {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-family: "Cormorant Garamond", serif; font-size: 2.8rem; color: var(--text);
  }
  .wish .msg { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.3rem; letter-spacing: .03em; color: var(--text); }

  @media (max-width: 520px) {
    .greeting .title { font-size: 2.6rem; }
    .cake .tier.base { width: 200px; } .cake .tier.top { width: 160px; } .cake .candles { gap: 18px; }
    .taper { height: 150px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .flame__dance, .flame__core, .ambient, .hint, .mote { animation: none !important; }
    .ambient { transition: opacity 0.6s ease; }
    body.is-catching .flame { animation: none; }
    .confetti { animation-duration: 2s !important; }
  }

/* link back to the site */
.home-link {
  position: fixed; bottom: 16px; left: 18px; z-index: 10;
  font-family: "Inter", system-ui, sans-serif; font-size: 0.74rem; letter-spacing: 0.08em;
  color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 999px;
  background: rgba(255,240,215,0.05); border: 1px solid rgba(255,230,200,0.12);
  transition: color .3s, border-color .3s;
}
.home-link:hover { color: var(--text); border-color: var(--accent); }

/* ---- Meditation: a low stone bowl with a tealight ---- */
.bowl { position: relative; width: 160px; height: 66px; }
.bowl .dish {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 160px; height: 46px;
  border-radius: 12px 12px 80px 80px / 10px 10px 44px 44px;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.3) 0%, transparent 22%, transparent 78%, rgba(0,0,0,0.32) 100%),
    linear-gradient(to bottom, #4a4640 0%, #322e28 55%, #211e19 100%);
  box-shadow: inset 0 6px 12px rgba(0,0,0,0.4), 0 0 34px rgba(255,170,80, calc(var(--glow-strength) * var(--flame-bright) * 0.5));
}
.bowl .dish::before {
  content: ""; position: absolute; top: -2px; left: 50%; transform: translateX(-50%);
  width: 150px; height: 14px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 30%, rgba(255,200,140,0.35), transparent 70%);
  opacity: var(--glow-strength);
}
.bowl .tealight {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  width: 46px; height: 24px; border-radius: 6px 6px 4px 4px;
  background: linear-gradient(to bottom, #f6ecd8, #e6d4b0 60%, #d8c199);
  box-shadow: inset 0 -6px 10px rgba(150,110,50,0.3), 0 0 18px rgba(255,180,90, calc(var(--glow-strength) * var(--flame-bright) * 0.6));
}
.bowl .tealight::before {
  content: ""; position: absolute; top: -3px; left: 50%; transform: translateX(-50%);
  width: 44px; height: 9px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,200,120,0.9), transparent 70%);
  opacity: var(--glow-strength);
}
body[data-theme="meditation"] .vessel--meditation { display: block; }

/* meditation-only greeting note */
.med-only { display: none; }
body[data-theme="meditation"] .med-only { display: block; }
.med-note { margin-top: 1rem; font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }

/* link to support/donate */
.support-link {
  position: fixed; bottom: 16px; right: 18px; z-index: 10;
  font-family: "Inter", system-ui, sans-serif; font-size: 0.74rem; letter-spacing: 0.06em;
  color: #1a0f06; background: var(--accent); text-decoration: none;
  padding: 7px 14px; border-radius: 999px; border: 1px solid transparent; transition: filter .3s;
}
.support-link:hover { filter: brightness(1.08); }
