/* My Altar: layered scene. Only transform and opacity are animated. */
.al-wrap { position: relative; width: min(100%, max(300px, calc((100vh - 250px) * .5625))); aspect-ratio: 9 / 16; margin: 6px auto 12px; border-radius: 20px; overflow: hidden; background: #1a2320; isolation: isolate; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.al-wrap > * { position: absolute; inset: 0; }
.al-bg { contain: layout paint style; }
.al-bg svg, .al-shafts svg, .al-text { width: 100%; height: 100%; display: block; }
.al-text { pointer-events: none; z-index: 12; }
.al-items { isolation: isolate; z-index: 2; }
.al-shafts { z-index: 3; pointer-events: none; opacity: calc(.3 + .7 * var(--k, .5)); animation: al-breathe 9s ease-in-out infinite alternate; }
.al-dim { z-index: 4; pointer-events: none; background: #060a14; opacity: calc(.03 + .2 * (1 - var(--k, .5))); }
.al-wash { z-index: 4; pointer-events: none; background: linear-gradient(180deg, rgba(150, 180, 255, .22), rgba(150, 180, 255, 0) 70%); opacity: calc(.25 + .75 * var(--k, .5)); }
.al-halos { z-index: 5; pointer-events: none; }
.al-warm { z-index: 5; pointer-events: none; background: radial-gradient(ellipse 72% 34% at 50% 72%, rgba(255, 170, 80, .36), rgba(255, 170, 80, 0)); opacity: 0; transition: opacity 1.2s ease; }
.al-wrap.lit .al-warm { opacity: var(--warm, .4); }
.al-motes { z-index: 6; pointer-events: none; }
.al-vig { z-index: 7; pointer-events: none; background: radial-gradient(ellipse at 50% 46%, rgba(6, 8, 12, 0) 48%, rgba(6, 8, 12, .86) 100%); opacity: calc(.92 - .42 * var(--k, .5)); }
.al-halo { position: absolute; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); background: radial-gradient(circle closest-side, rgb(255 190 100 / calc(.28 + .22 * (1 - var(--k, .5)))) 0%, rgb(255 165 80 / calc(.11 + .1 * (1 - var(--k, .5)))) 40%, rgb(255 150 70 / 0) 100%); animation: al-halo 3.4s ease-in-out var(--d, 0s) infinite alternate; }
.al-mote { position: absolute; width: var(--s, 4px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle closest-side, rgba(236, 244, 255, .95) 0%, rgba(210, 226, 255, 0) 100%); opacity: 0; animation: al-mote var(--t, 12s) ease-in-out var(--d, 0s) infinite; }
.al-star { position: absolute; width: 3px; aspect-ratio: 1; border-radius: 50%; background: #fff6dc; opacity: .2; animation: al-twinkle var(--t, 4s) ease-in-out var(--d, 0s) infinite alternate; }
@keyframes al-twinkle { 0% { opacity: .15; transform: scale(.7); } 100% { opacity: 1; transform: scale(1.3); } }
.al-moonbtn { inset: auto; left: calc(196 / 360 * 100% - 11%); top: calc(118 / 640 * 100% - 6.4%); width: 22%; aspect-ratio: 1; z-index: 20; background: none; border: 0; border-radius: 50%; padding: 0; cursor: pointer; }
.al-moonbtn:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }

.al-item { position: absolute; aspect-ratio: 112 / 124; transform: translate(-50%, -89.3%) rotate(var(--rot, 0deg)); transform-origin: 50% 89.3%; pointer-events: none; touch-action: none; cursor: grab; outline: none; -webkit-tap-highlight-color: transparent; }
.al-item svg { width: 100%; height: 100%; display: block; overflow: visible; pointer-events: none; }
.al-item .hit { pointer-events: all; }
.al-item:focus-visible { outline: none; }
.al-item:focus-visible .selring { opacity: 1; stroke-dasharray: 0; stroke-width: 2.8; }
.al-item .selring.bar { fill: #f3d98a; stroke: none; }
.al-item[data-id="card"].lifting { filter: none; }
.al-item.lifting { cursor: grabbing; transform: translate(-50%, -89.3%) translateY(-8px) scale(1.07) rotate(var(--rot, 0deg)); filter: drop-shadow(0 12px 8px rgba(0, 0, 0, .35)); transition: transform .12s ease-out; }
.al-item.settle { transition: left .22s cubic-bezier(.3, 1.4, .5, 1), top .22s cubic-bezier(.3, 1.4, .5, 1), width .22s; }
.al-item.arrive { animation: al-arrive .5s cubic-bezier(.3, 1.4, .5, 1); }
.al-item .selring { fill: none; stroke: #f3d98a; stroke-width: 1.8; stroke-dasharray: 3 4; opacity: 0; transition: opacity .2s; }
.al-item.sel .selring { opacity: .85; }

.flame { transform-box: fill-box; transform-origin: 50% 100%; animation: al-flame 1.9s ease-in-out var(--d, 0s) infinite alternate; }
.smoke { transform-box: fill-box; transform-origin: 50% 100%; animation: al-smoke 6s ease-in var(--d, 0s) infinite; }
.glint { transform-box: fill-box; transform-origin: 50% 50%; opacity: 0; animation: al-glint 8s ease-in-out var(--d, 0s) infinite; }
.jar-glow, .jar-halo { animation: al-jar 4.6s ease-in-out infinite alternate; }
.bell-swing { transform-box: fill-box; transform-origin: 50% 0; }
.al-item.ringing .bell-swing { animation: al-swing 2.3s cubic-bezier(.25, .5, .5, 1); }
.al-item.hop svg { animation: al-hop .9s cubic-bezier(.3, .7, .4, 1); }
.al-item.joy svg .c-all { animation: al-joy 9s ease-in-out infinite; }
@keyframes al-flame { 0% { transform: scale(1, 1) skewX(0deg); } 30% { transform: scale(.93, 1.07) skewX(2.5deg); } 60% { transform: scale(1.04, .95) skewX(-2deg); } 100% { transform: scale(.96, 1.05) skewX(1.5deg); } }
@keyframes al-halo { 0% { opacity: .8; transform: translate(-50%, -50%) scale(.96); } 100% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } }
@keyframes al-smoke { 0% { opacity: 0; transform: translate(0, 4px) scale(.7, .5); } 22% { opacity: .5; } 100% { opacity: 0; transform: translate(6px, -22px) scale(1.2, 1.3); } }
@keyframes al-glint { 0%, 84%, 100% { opacity: 0; transform: scale(.2) rotate(0deg); } 90% { opacity: 1; transform: scale(1) rotate(25deg); } 96% { opacity: 0; transform: scale(.3) rotate(50deg); } }
@keyframes al-jar { 0% { opacity: .45; } 100% { opacity: 1; } }
@keyframes al-swing { 0% { transform: rotate(0); } 12% { transform: rotate(13deg); } 28% { transform: rotate(-10deg); } 46% { transform: rotate(6deg); } 64% { transform: rotate(-3.5deg); } 82% { transform: rotate(1.6deg); } 100% { transform: rotate(0); } }
@keyframes al-hop { 0% { transform: translateY(0) scale(1.03, .95); } 35% { transform: translateY(-9%) scale(.98, 1.04); } 70% { transform: translateY(0) scale(1.03, .96); } 100% { transform: translateY(0); } }
@keyframes al-joy { 0%, 86%, 100% { transform: translateY(0); } 90% { transform: translateY(-5px) scale(.98, 1.03); } 95% { transform: translateY(0) scale(1.02, .98); } }
@keyframes al-arrive { 0% { opacity: 0; transform: translate(-50%, -89.3%) translateY(-16px) scale(.9) rotate(var(--rot, 0deg)); } 100% { opacity: 1; } }
@keyframes al-mote { 0% { opacity: 0; transform: translate(0, 0); } 20% { opacity: .85; } 80% { opacity: .6; } 100% { opacity: 0; transform: translate(var(--dx, 8px), var(--dy, -30px)); } }
@keyframes al-breathe { 0% { opacity: calc((.3 + .7 * var(--k, .5)) * .8); } 100% { opacity: calc(.3 + .7 * var(--k, .5)); } }
.al-wrap.igniting::after { content: ""; position: absolute; inset: 0; z-index: 8; background: radial-gradient(circle at 50% 66%, rgba(255, 211, 107, .5), rgba(255, 211, 107, 0) 65%); animation: al-ignite 1.5s ease-out forwards; pointer-events: none; }
@keyframes al-ignite { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }

.al-bubble { inset: auto; width: max-content; max-width: 84%; text-align: center; transform: translate(-50%, 6px); margin: 0; padding: 5px 12px; border-radius: 99px; background: rgba(248, 243, 230, .94); color: #3a4833; font-size: .78rem; font-style: italic; opacity: 0; pointer-events: none; transition: opacity .5s, transform .5s; z-index: 18; }
.al-bubble.show { opacity: 1; transform: translate(-50%, 0); }

.al-menu { inset: 8px 8px auto; z-index: 25; background: rgba(34, 42, 30, .94); color: var(--cream); border-radius: 16px; padding: 8px 10px 10px; opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
.al-menu[hidden] { display: none; }
.al-menu.show { opacity: 1; transform: none; }
.al-mtitle { margin: 0 0 6px; font-family: var(--font-display); font-size: .95rem; text-align: center; }
.al-mrow { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.al-mbtn { min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 0; background: var(--sage-100); color: #26301f; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }
.al-mbtn.danger { background: #f2d6cc; color: #6d2518; }
.al-mbtn:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }

.al-drawer { inset: auto 0 0; height: clamp(148px, 26%, 188px); z-index: 24; background: linear-gradient(180deg, #5b4430, #3d2c1e); color: var(--cream); border-radius: 18px 18px 0 0; transform: translateY(102%); visibility: hidden; transition: transform .32s cubic-bezier(.3, .9, .4, 1), visibility 0s .32s; box-shadow: 0 -8px 18px rgba(0, 0, 0, .35); padding: 8px 8px 6px; display: flex; flex-direction: column; }
.al-drawer.open { transform: none; visibility: visible; transition: transform .32s cubic-bezier(.3, .9, .4, 1); }
.al-drawer.away { background: linear-gradient(180deg, #7a4636, #4d281f); }
.al-dhead { display: flex; align-items: flex-start; gap: 4px; }
.al-tabs { display: flex; flex-wrap: wrap; gap: 4px; overflow: visible; flex: 1; align-content: flex-start; }
.al-tab { flex: none; min-height: 32px; padding: 0 8px; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .1); color: #f0e6cf; font: inherit; font-size: .72rem; cursor: pointer; white-space: nowrap; }
.al-tab[aria-pressed="true"] { background: var(--gold-soft); color: #2d2410; font-weight: 700; }
.al-dclose { flex: none; width: 44px; height: 32px; border: 0; background: none; color: #f0e6cf; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.al-tray { display: flex; gap: 6px; overflow-x: auto; flex: 1; align-items: stretch; padding-top: 6px; scrollbar-width: none; }
.al-tray::-webkit-scrollbar { display: none; }
.al-chip { flex: none; width: 72px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 1px; padding: 2px 2px 3px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .07); color: #f0e6cf; font: inherit; font-size: .68rem; line-height: 1.1; cursor: grab; touch-action: pan-x; }
.al-chip svg { width: 100%; height: auto; flex: 1; min-height: 0; pointer-events: none; overflow: visible; }
.al-chip span { text-align: center; padding-bottom: 1px; }
.al-chip:focus-visible, .al-tab:focus-visible, .al-dclose:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 1px; }
.al-empty { color: #f0e6cf; margin: 12px 4px; }
.al-ghost { position: fixed; left: 0; top: 0; width: 84px; pointer-events: none; z-index: 1000; opacity: .94; filter: drop-shadow(0 12px 8px rgba(0, 0, 0, .35)); }
.al-ghost svg { width: 100%; height: auto; display: block; overflow: visible; }
.al-wrap.dropping::before { content: ""; position: absolute; inset: 0; z-index: 9; box-shadow: inset 0 0 0 3px rgba(243, 217, 138, .6); border-radius: 20px; pointer-events: none; }
.al-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.al-tools [hidden] { display: none; }
#screen-altar .btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
#screen-altar .btn-row .btn { flex: 1 1 40%; }
#screen-altar .btn-row #altar-light { flex-basis: 100%; }


/* Your altar's energy: floating chip and pull-up sheet */
.al-en-chip { inset: auto 8px 12px auto; width: auto; height: auto; min-height: 44px; z-index: 28; border: 0; border-radius: 99px; padding: 0 12px 0 10px; background: rgba(246, 241, 228, .94); color: #2a3324; font: inherit; font-weight: 700; font-size: .82rem; letter-spacing: .02em; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .28); display: flex; align-items: center; gap: 6px; }
.al-wrap.drawer-open .al-en-chip { inset: 8px 8px auto auto; }
.al-en-chip[aria-expanded="true"] { background: var(--gold-soft); color: #2d2410; }
.al-en-chip:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.al-energy { position: relative; width: min(100%, max(300px, calc((100vh - 250px) * .5625))); margin: 0 auto 12px; background: linear-gradient(180deg, #f7f2e4, #e7eed9); color: #2a3324; border-radius: 16px; box-shadow: 0 6px 18px rgba(42, 51, 36, .14); padding: 6px 16px 14px; display: none; }
.al-energy.open { display: block; animation: al-en-in .28s ease; }
@keyframes al-en-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.al-en-chip-ico { display: flex; width: 16px; height: 16px; }
.al-en-chip-ico svg { width: 16px; height: 16px; display: block; }
.al-en-head { display: flex; align-items: flex-start; gap: 8px; }
.al-en-title { margin: 0; flex: 1; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: #2a3324; outline: none; }
.al-en-close { flex: none; width: 44px; height: 44px; margin: -8px -8px 0 0; border: 0; background: none; color: #3a4833; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.al-en-close:focus-visible, .al-en-why summary:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.al-en-moon { margin: 4px 0 8px; color: #4a5840; }
.al-en-themes { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.al-en-theme { display: flex; align-items: center; gap: 8px; }
.al-en-ico { flex: none; width: 28px; height: 28px; display: block; }
.al-en-ico svg { display: block; }
.al-en-tm { flex: 1; min-width: 0; }
.al-en-tn { display: block; font-weight: 700; font-size: .88rem; }
.al-en-bar { display: block; height: 7px; margin-top: 3px; border-radius: 99px; background: rgba(80, 96, 70, .16); overflow: hidden; }
.al-en-bar i { display: block; height: 100%; border-radius: 99px; max-width: 100%; }
.al-en-reading { margin: 0 0 8px; font-family: Georgia, serif; font-style: italic; font-size: .95rem; line-height: 1.45; }
.al-en-nudge, .al-en-note { margin: 0 0 8px; padding: 8px 10px; border-radius: 12px; font-size: .88rem; line-height: 1.4; }
.al-en-nudge { background: rgba(201, 162, 75, .18); }
.al-en-note { background: rgba(110, 138, 160, .16); }
.al-en-why { margin: 4px 0 10px; }
.al-en-why summary { cursor: pointer; font-weight: 700; font-size: .88rem; }
.al-en-why ul { margin: 6px 0 0; padding: 0 0 0 1.1em; }
.al-en-why li { margin: 0 0 4px; font-size: .86rem; }
.al-en-why a { color: #3d5a38; text-decoration: underline; text-underline-offset: 2px; }
.al-en-foot { margin: 8px 0 0; color: #5a6650; }

@media (prefers-reduced-motion: reduce) {
  .flame, .smoke, .glint, .jar-glow, .jar-halo, .al-halo, .al-mote, .al-star, .al-shafts, .al-item.ringing .bell-swing, .al-item.hop svg, .al-item.joy svg .c-all, .al-item.arrive, .al-wrap.igniting::after, .al-energy.open { animation: none !important; }
  .smoke { opacity: .38; }
  .al-mote { opacity: .5; }
  .al-drawer, .al-menu, .al-bubble, .al-item.settle, .al-warm, .al-energy, .al-en-chip { transition: none; }
}
