/* The Wishing Tree: everything in the DOM over the 3D hall. Same house style as the Magic Mailroom: navy and gold rounds,
   a cream airmail card, Russo One for the shouting and Fraunces for the storybook names. */
:root { --gold1: #fff6c4; --gold2: #ffd45a; --gold3: #e8962a; --navy: #14204a; --navy2: #0b1233; --cream: #fbf3e1; --red: #c8232f; --red2: #8a1a14; --blue: #2a4fb0;
  --goldEdge: linear-gradient(150deg, var(--gold1), var(--gold2) 35%, var(--gold3) 65%, var(--gold1));
  --safeT: env(safe-area-inset-top, 0px); --safeR: env(safe-area-inset-right, 0px); --safeB: env(safe-area-inset-bottom, 0px); --safeL: env(safe-area-inset-left, 0px); }
* { -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a0c06; color: #fff; overscroll-behavior: none; }
body { font: 600 16px/1.3 'Chakra Petch', system-ui, sans-serif; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
canvas#hall { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#hud { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
#hud > .tools, #hud > .hits .hit { pointer-events: auto; }
#hud.busy .tools, #hud.busy .hit { pointer-events: none; }

.logo { position: absolute; margin: 0; left: calc(var(--safeL) + clamp(8px, 2vw, 32px)); top: calc(var(--safeT) + clamp(4px, 1.2vh, 18px)); width: clamp(180px, 22vw, 400px);
  filter: drop-shadow(0 8px 14px rgba(30,6,0,.55)); animation: logoIn 1.1s cubic-bezier(.2,1.3,.4,1) both .3s; transform-origin: 30% 30%; }
.logo img { width: 100%; height: auto; display: block; }
@keyframes logoIn { from { opacity: 0; transform: scale(.6) rotate(-6deg); } to { opacity: 1; transform: none; } }

.tools { position: absolute; top: calc(var(--safeT) + clamp(8px, 2vh, 24px)); right: calc(var(--safeR) + clamp(8px, 2vw, 30px)); display: flex; gap: clamp(8px, 1vw, 14px); align-items: center;
  animation: toolsIn .9s ease-out both .6s; }
@keyframes toolsIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.round { --s: clamp(48px, 5vw, 78px); width: var(--s); height: var(--s); border-radius: 50%; display: grid; place-items: center; box-sizing: border-box; padding: 0; cursor: pointer; color: var(--gold2);
  border: 3px solid transparent; background: radial-gradient(circle at 50% 35%, #2e3f86, #101a46 70%) padding-box, var(--goldEdge) border-box;
  box-shadow: 0 4px 0 rgba(40,20,0,.55), 0 8px 18px rgba(0,0,0,.45), inset 0 2px 6px rgba(255,255,255,.18); transition: transform .15s, filter .15s; }
.round img, .round svg { width: 74%; height: 74%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.round.small { --s: clamp(40px, 3.9vw, 58px); } .round.small svg { width: 60%; height: 60%; }
.round:hover { transform: translateY(-2px) scale(1.05); filter: brightness(1.12); }
.round:active { transform: translateY(2px) scale(.97); }
#sound .off { display: none; } #sound[aria-pressed="false"] .on { display: none; } #sound[aria-pressed="false"] .off { display: inline; }
.round:focus-visible, .wishes:focus-visible, .cGo:focus-visible, .cAlt:focus-visible, .cClose:focus-visible, .drawer button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.wishes { display: flex; align-items: center; gap: 8px; height: clamp(46px, 4.8vw, 66px); padding: 0 20px 0 5px; border-radius: 999px; box-sizing: border-box; cursor: pointer;
  border: 3px solid transparent; background: linear-gradient(#13204e, #0a1236) padding-box, var(--goldEdge) border-box; color: #fff3cf;
  box-shadow: 0 4px 0 rgba(40,20,0,.55), 0 8px 18px rgba(0,0,0,.45); font: 600 clamp(18px, 2vw, 28px)/1 'Fraunces', Georgia, serif; transition: transform .15s; }
.wishes img { height: 90%; filter: drop-shadow(0 0 6px rgba(255,200,60,.6)); }
.wishes b { font: 400 clamp(20px, 2.3vw, 32px)/1 'Russo One', sans-serif; color: var(--gold2); min-width: 1.3em; text-align: right; }
.wishes.bump { animation: bump .5s cubic-bezier(.2,1.6,.4,1); }
.wishes.want { animation: want .9s ease-in-out 2; }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.16); } 100% { transform: scale(1); } }
@keyframes want { 0%, 100% { box-shadow: 0 4px 0 rgba(40,20,0,.55), 0 0 0 rgba(255,200,60,0); } 50% { box-shadow: 0 4px 0 rgba(40,20,0,.55), 0 0 26px rgba(255,210,80,.95); } }

/* ---- hit targets over baubles and props -------------------------------------------------------------------------- */
.hits { position: absolute; inset: 0; pointer-events: none; }
.hit { position: absolute; left: 0; top: 0; margin: 0; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 50%; }
.hit.box { border-radius: 14px; }
.hit:focus-visible { outline: 3px solid rgba(255,236,160,.95); outline-offset: 2px; }

/* ---- tags, plaque, price, toasts ---------------------------------------------------------------------------------- */
.tag { position: absolute; margin: 0; left: 50%; bottom: calc(var(--safeB) + clamp(8px, 2vh, 24px)); transform: translateX(-50%); display: flex; gap: 14px; align-items: center; width: max-content; max-width: calc(100vw - 28px); text-align: center; text-wrap: balance;
  padding: clamp(8px, 1.2vh, 14px) clamp(20px, 2.6vw, 40px); border-radius: 16px; background: linear-gradient(#fff8e6, #f6e3bb); color: var(--red2);
  border: 3px solid #e7b95a; box-shadow: 0 6px 0 rgba(90,40,0,.5), 0 12px 26px rgba(0,0,0,.45); font: italic 600 clamp(20px, 2.4vw, 36px)/1 'Fraunces', Georgia, serif;
  animation: tagBob 2.4s ease-in-out infinite; transition: opacity .4s; }
.tag i { font-style: normal; color: #d49a2a; font-size: .7em; }
.tag[hidden] { display: flex; opacity: 0; pointer-events: none; }
@keyframes tagBob { 0%, 100% { transform: translateX(-50%) translateY(0) rotate(-1deg); } 50% { transform: translateX(-50%) translateY(-5px) rotate(1deg); } }

.plaque { position: absolute; margin: 0; left: 0; top: 0; transform: translate(-50%, -50%); padding: 6px clamp(14px, 1.6vw, 24px); border-radius: 8px; white-space: nowrap;
  background: linear-gradient(180deg, #fff2b8, #e8b54c 48%, #c98a22 52%, #f2cf6c); border: 2px solid #fff4c8; color: #4a2400;
  box-shadow: 0 4px 0 #7a4200, 0 8px 16px rgba(0,0,0,.45), inset 0 1px 0 #fff; font: 600 clamp(12px, 1.15vw, 18px)/1 'Fraunces', Georgia, serif; opacity: 0; transition: opacity .5s; }
.plaque.on { opacity: 1; }
.plaque span::before, .plaque span::after { content: '✦'; margin: 0 .6em; font-size: .7em; color: #8a5200; }

.price { position: absolute; margin: 0; left: 0; top: 0; transform: translate(-50%, 0); padding: 4px 12px 5px 6px; border-radius: 999px; display: flex; gap: 6px; align-items: center; white-space: nowrap;
  background: rgba(12,16,48,.92); border: 2px solid #e8b54c; color: var(--gold2); font: 400 15px/1 'Russo One', sans-serif; opacity: 0; transition: opacity .2s; }
.price.on { opacity: 1; }
.price img { width: 20px; height: 20px; }
.price small { font: 600 13px/1 'Chakra Petch', sans-serif; color: #e8e2ff; }

.toast { position: absolute; margin: 0; left: 50%; top: calc(var(--safeT) + clamp(90px, 14vh, 140px)); transform: translate(-50%, -10px); padding: 10px 18px; border-radius: 12px; text-align: center;
  background: rgba(12,16,48,.94); color: #ffe3a0; border: 2px solid #e8b54c; font: 600 clamp(15px, 1.4vw, 19px)/1.25 'Chakra Petch', sans-serif; max-width: min(80vw, 520px);
  box-shadow: 0 10px 26px rgba(0,0,0,.5); opacity: 0; transition: opacity .35s, transform .35s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast b { color: var(--gold2); font-family: 'Russo One', sans-serif; font-weight: 400; }

.float { position: absolute; margin: 0; left: 0; top: 0; transform: translate(-50%, -50%); font: 400 clamp(28px, 3vw, 44px)/1 'Russo One', sans-serif; color: var(--gold2); opacity: 0;
  text-shadow: 0 0 12px rgba(255,170,40,.9), 0 3px 0 #6a3000; pointer-events: none; }
.float.go { animation: floatUp 1.4s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }

/* ---- the shop card (airmail) ---------------------------------------------------------------------------------------- */
.card { position: fixed; z-index: 4; right: calc(var(--safeR) + clamp(10px, 2vw, 34px)); top: calc(var(--safeT) + clamp(96px, 14vh, 140px)); bottom: calc(var(--safeB) + clamp(10px, 2vh, 28px));
  width: clamp(300px, 28vw, 460px); display: flex; align-items: center; pointer-events: none; }
.card[hidden] { display: flex; visibility: hidden; }
.cCard { position: relative; width: 100%; max-height: 100%; overflow: auto; box-sizing: border-box; padding: clamp(20px, 2.4vw, 34px) clamp(16px, 2vw, 28px) clamp(18px, 2vw, 28px); pointer-events: auto; text-align: center;
  color: var(--navy); background: var(--cream) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: 0 18px 44px rgba(20,4,0,.6); border: clamp(9px, .9vw, 13px) solid transparent;
  border-image: repeating-linear-gradient(-45deg, var(--red) 0 16px, var(--cream) 16px 24px, var(--blue) 24px 40px, var(--cream) 40px 48px) 14;
  transform: translateX(125%) rotate(5deg); opacity: 0; transition: transform .6s cubic-bezier(.2,1.25,.4,1), opacity .3s; }
.card.open .cCard { transform: rotate(1.2deg); opacity: 1; }
.cHead { margin: 0 0 clamp(6px, 1.2vh, 14px); }
.cNo { display: inline-block; padding: 6px 16px; border-radius: 4px; font: 400 clamp(13px, 1.2vw, 17px)/1 'Russo One', sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #4a2400;
  background: linear-gradient(180deg, #fff2b8, #e8b54c 48%, #d49a2a 52%, #f2cf6c); box-shadow: 0 2px 0 #8a5200; }
.cMark { position: absolute; right: 52px; top: 12px; width: clamp(56px, 5vw, 80px); aspect-ratio: 1; border-radius: 50%; border: 3px solid rgba(200,35,47,.7); opacity: .75; transform: rotate(14deg);
  background: radial-gradient(circle, transparent 54%, rgba(200,35,47,.0) 55%); }
.cMark::before { content: '❄'; position: absolute; inset: 0; display: grid; place-items: center; color: rgba(200,35,47,.75); font-size: 1.6em; }
.cMark::after { content: ''; position: absolute; inset: 10%; border-radius: 50%; border: 2px dashed rgba(200,35,47,.55); }
.cMark.stamped { animation: stampIn .5s cubic-bezier(.2,1.6,.4,1); }
.cMark.new { width: clamp(90px, 8vw, 118px); right: auto; left: -14px; top: -18px; transform: rotate(-12deg); opacity: .95; border-width: 4px; }
.cMark.new::before { content: 'NEW TOY!'; font: 400 clamp(14px, 1.4vw, 20px)/1 'Russo One', sans-serif; letter-spacing: .04em; }
@keyframes stampIn { 0% { transform: scale(2.4) rotate(-30deg); opacity: 0; } 60% { transform: scale(.9) rotate(-10deg); opacity: 1; } 100% { transform: rotate(-12deg); } }
.cTitle { margin: 0 0 4px; font: italic 700 clamp(28px, 2.9vw, 46px)/1.02 'Fraunces', Georgia, serif; color: var(--red2); letter-spacing: -.01em; padding: 0 clamp(10px, 2vw, 30px); }
.cRule { display: flex; align-items: center; gap: 10px; margin: 6px auto 8px; width: 74%; color: #b07a1a; }
.cRule i { flex: 1; height: 0; border-top: 2px solid rgba(160,110,30,.5); } .cRule b { font-size: 18px; }
.cBlurb { margin: 0 0 clamp(10px, 1.8vh, 18px); font: italic 500 clamp(16px, 1.45vw, 22px)/1.3 'Fraunces', Georgia, serif; color: #2a2440; }
.cPrice { display: flex; align-items: center; justify-content: center; gap: 10px; width: fit-content; margin: 0 auto clamp(10px, 1.6vh, 16px); padding: 5px 24px 5px 5px; border-radius: 999px;
  border: 3px solid transparent; background: linear-gradient(#1b2a66, #0d1640) padding-box, var(--goldEdge) border-box; color: #fff3cf; font: 600 clamp(18px, 1.8vw, 26px)/1 'Fraunces', Georgia, serif; }
.cPrice img { width: clamp(34px, 3.2vw, 46px); }
.cPrice b { font: 400 clamp(20px, 2vw, 30px)/1 'Russo One', sans-serif; color: var(--gold2); }
.cPrice.owned { padding: 8px 20px; } .cPrice.owned img { display: none; }
.cGo { display: flex; width: 100%; align-items: center; justify-content: center; gap: 12px; min-height: clamp(62px, 6.4vw, 90px); border-radius: 999px; cursor: pointer; position: relative; overflow: hidden;
  border: 3px solid #fff2b0; color: #3a1c00; font: 400 clamp(28px, 3vw, 46px)/1 'Russo One', sans-serif; letter-spacing: .04em; text-transform: uppercase;
  background: linear-gradient(180deg, #fffbe0 0%, #ffe46a 30%, #ffc21e 52%, #f09a10 53%, #ffcf3a 100%);
  box-shadow: 0 6px 0 #9a5200, 0 12px 24px rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.9); transition: transform .12s, filter .12s; }
.cGo::after { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.65), transparent); animation: shine 2.8s ease-in-out infinite 1s; }
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.cGo:hover { filter: brightness(1.06); transform: translateY(-1px); }
.cGo:active { transform: translateY(4px); box-shadow: 0 2px 0 #9a5200, 0 6px 12px rgba(0,0,0,.35); }
.cGo.poor { color: #e8e2ff; border-color: #5d63a4; background: linear-gradient(180deg, #4c5180, #1d2048); box-shadow: 0 6px 0 #06061a; font-size: clamp(17px, 1.6vw, 24px); cursor: default; }
.cGo.poor::after, .cGo.soon::after { display: none; }
.cGo.soon { color: #36507a; border-color: #cfe0f5; background: linear-gradient(180deg, #f4f9ff, #d8e6f6 52%, #c4d6ee 53%, #e6eff9); box-shadow: 0 6px 0 #7d93b5; font-size: clamp(18px, 1.7vw, 26px); cursor: default; }
.cGo.busy { pointer-events: none; filter: saturate(.6) brightness(.95); }
.cAlt[hidden], .cPrice[hidden] { display: none; }
.cAlt { margin: 12px auto 0; display: block; padding: 8px 14px; border: 0; background: none; color: var(--navy); font: 700 clamp(14px, 1.2vw, 17px)/1.2 'Chakra Petch', sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cNote { margin: 10px 0 0; font: 600 clamp(13px, 1.1vw, 15px)/1.3 'Chakra Petch', sans-serif; color: #5a5470; min-height: 1em; }
.cNote:empty { display: none; }
.cClose { position: absolute; right: 8px; top: 8px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(20,32,74,.08); color: var(--navy); cursor: pointer; display: grid; place-items: center; }
.cClose svg { width: 20px; height: 20px; }

/* ---- drawers: the toy chest and the Wishes help -------------------------------------------------------------------- */
.drawer { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(20,6,0,.62); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); animation: fade .3s; }
.drawer[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.dPanel { position: relative; box-sizing: border-box; width: min(760px, 94vw); max-height: 90vh; overflow: auto; padding: 24px max(16px, 3vw) 24px; border-radius: 20px; text-align: center;
  border: 3px solid transparent; background: radial-gradient(ellipse at 50% 0%, #3a1a10, #1a0a06 70%) padding-box, var(--goldEdge) border-box; box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: pop .4s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.dPanel .cClose { background: rgba(255,230,160,.12); color: var(--gold2); }
.drK { margin: 0; font: 700 12px/1 'Chakra Petch', sans-serif; letter-spacing: .22em; text-transform: uppercase; color: #ffd98a; }
.drH { margin: 8px 0 16px; font: italic 700 clamp(30px, 4vw, 44px)/1 'Fraunces', Georgia, serif; color: var(--gold2); }
.drList { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.drList li { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px; border-radius: 14px; background: rgba(255,220,150,.07); border: 1px solid rgba(255,210,120,.25); }
.drList .ic { width: 96px; height: 96px; background-repeat: no-repeat; filter: drop-shadow(0 6px 8px rgba(0,0,0,.5)); }
.drList b { font: italic 700 17px/1.1 'Fraunces', Georgia, serif; color: #fff1cc; }
.drList button { min-height: 40px; padding: 0 22px; border-radius: 999px; cursor: pointer; border: 2px solid #fff2b0; color: #3a1c00; font: 400 17px/1 'Russo One', sans-serif; text-transform: uppercase;
  background: linear-gradient(180deg, #fffbe0, #ffd23a 52%, #f09a10 53%, #ffcf3a); box-shadow: 0 3px 0 #9a5200; }
.drEmpty { margin: 8px 0 0; font: italic 500 18px/1.4 'Fraunces', Georgia, serif; color: #f4dcae; }
.hpBig { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 14px; font: 400 54px/1 'Russo One', sans-serif; color: var(--gold2); }
.hpBig img { width: 64px; filter: drop-shadow(0 0 12px rgba(255,200,60,.7)); }
.hpList { list-style: none; margin: 0 auto; padding: 0; max-width: 520px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.hpList li { display: flex; gap: 14px; align-items: center; padding: 10px 14px; border-radius: 12px; background: rgba(255,220,150,.07); font: 600 16px/1.3 'Chakra Petch', sans-serif; color: #f6e8c8; }
.hpList b { min-width: 52px; font: 400 22px/1 'Russo One', sans-serif; color: var(--gold2); }
.hpNote { margin: 14px 0 0; font: italic 500 16px/1.4 'Fraunces', Georgia, serif; color: #f4dcae; }

/* ---- page transitions ------------------------------------------------------------------------------------------------ */
.iris { position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--ix, 50%) var(--iy, 50%), rgba(255,250,220,0) calc(var(--ir, 150) * 1vmax - 8vmax), #fff4cc calc(var(--ir, 150) * 1vmax), #ffd06a calc(var(--ir, 150) * 1vmax + 30vmax)); }
.curtain { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, #4a2010, #140804 70%); transition: opacity 1s ease; }
.curtain img { width: min(60vw, 440px); animation: pulse 1.6s ease-in-out infinite; filter: drop-shadow(0 8px 20px rgba(0,0,0,.5)); }
.curtain.out { opacity: 0; pointer-events: none; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* ---- phones (portrait): the card becomes a bottom sheet ---------------------------------------------------------------- */
@media (max-aspect-ratio: 4/5) {
  .logo { width: clamp(140px, 40vw, 240px); }
  .round { --s: clamp(42px, 11vw, 58px); } .round.small { --s: clamp(36px, 9.4vw, 48px); }
  .tools { gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 56vw; }
  .wishes { height: 44px; padding-right: 14px; font-size: 16px; } .wishes b { font-size: 22px; }
  .card { left: calc(var(--safeL) + 8px); right: calc(var(--safeR) + 8px); top: auto; bottom: calc(var(--safeB) + 8px); width: auto; max-height: 48vh; align-items: flex-end; }
  .cCard { transform: translateY(115%); padding: 16px 14px 16px; }
  .card.open .cCard { transform: none; }
  .cTitle { font-size: clamp(24px, 7vw, 32px); }
  .cBlurb { font-size: 15px; margin-bottom: 8px; }
  .cGo { min-height: 58px; font-size: 28px; }
  .tag { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .logo, .tools, .tag, .cGo::after, .curtain img, .wishes.bump, .wishes.want { animation: none !important; } }
