/* 轉蛋屋字型：何某手寫（便條、對話框）、內海字體 Bold（招牌、價目牌、OPEN 牌、按鈕）。
   都是 SIL OFL 1.1；fonts/ 裡是只保留轉蛋頁用字的瘦身版，改了文字請重跑 tools/build_gacha_fonts.py。 */
@font-face { font-family: 'SoraGachaHand'; src: url('./fonts/gacha-hand.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'SoraGachaHand'; src: url('./fonts/gacha-hand-bold.woff') format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'SoraGachaSign'; src: url('./fonts/gacha-sign.woff') format('woff'); font-weight: 700; font-display: swap; }
/* 轉蛋委託頁（#gacha）。配色沿用 redesign.css 的星夜檔案館色票。 */
#gacha {
  --hand: 'SoraGachaHand', 'Noto Serif SC', serif;
  --sign: 'SoraGachaSign', 'Noto Serif SC', serif;
  --note-ink: #2f2a25;
  --g-night: #131b2b;
  --g-ink: #222b3f;
  --g-dim: #586377;
  --g-line: #d6dae5;
  --g-soft: #eeeaf7;
  --g-lav: #b8adf0;
  --g-violet: #665a9c;
  --g-plum: #8c5471;
  --g-gold: #d4b06b;
  --g-N: #a3abc2;
  --g-R: #8fb0d9;
  --g-SR: #b8adf0;
  --g-SSR: #e0b96a;
  --g-UR: linear-gradient(120deg, #f0a9b9 0%, #b8adf0 45%, #9fd3e6 100%);
}

/* ── 轉蛋屋場景（桌機一個畫面看完） ──
   場景是 size container：裡面的位置與大小都用 cqh／cqw，螢幕高矮都會等比縮放。
   便條紙用 position:absolute 貼在牆上；.gacha-wall-notes 在桌機是 display:contents，手機改成一排。 */
#gacha .gacha-shop {
  position: relative;
  height: clamp(560px, calc(100svh - 150px), 860px);
  container-type: size;
  overflow: hidden;
  border-radius: 6px;
  background:
    radial-gradient(ellipse 30% 44% at 50% 50%, rgba(255,255,255,.8), transparent 72%),
    repeating-linear-gradient(90deg, rgba(102,90,156,.05) 0 2px, transparent 2px 42px),
    radial-gradient(circle at 30% 30%, rgba(184,173,240,.22) 0 1.4px, transparent 2px) 0 0 / 42px 42px,
    linear-gradient(180deg, #e7e0f4 0%, #f1edf8 58%, #e9e2f5 100%);
  box-shadow: inset 0 0 0 1px var(--g-line);
}
#gacha .gacha-wall-notes { display: contents; }

/* 招牌 */
#gacha .gacha-sign {
  position: absolute;
  left: 50%;
  top: 3cqh;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: .4cqh;
  margin: 0;
  padding: 1.2cqh 3.4cqh 1.5cqh;
  transform: translateX(-50%) rotate(-1deg);
  border: 2px solid #d4b06b;
  border-radius: 10px;
  background: linear-gradient(180deg, #2b3657, #18203a);
  box-shadow: 0 8px 18px rgba(19,27,43,.25), inset 0 0 0 4px rgba(212,176,107,.18);
  color: #f6e6b8;
  font: 700 clamp(20px, 4.6cqh, 40px)/1.1 var(--sign);
  letter-spacing: .14em;
  white-space: nowrap;
}
#gacha .gacha-sign small { font: 700 clamp(9px, 1.35cqh, 12px)/1 'Outfit', sans-serif; letter-spacing: .34em; color: #b8adf0; }
#gacha .gacha-sign::before,
#gacha .gacha-sign::after {
  content: '';
  position: absolute;
  bottom: 100%;
  width: 2px;
  height: 3cqh;
  background: #8a7550;
}
#gacha .gacha-sign::before { left: 16%; }
#gacha .gacha-sign::after { right: 16%; }

/* redesign.css 對 #mainContent 底下所有元素強制 font-family（body.archive-site :is(#mainContent…) * 加 !important），
   這裡用更高的權重（html body #gacha …）蓋過去，只套在轉蛋屋的手寫與招牌文字。 */
html body #gacha .gacha-note,
html body #gacha .gacha-note *,
html body #gacha .gacha-note-big,
html body #gacha .gacha-note-big *,
html body #gacha .gacha-boss-say:not(.is-plain),
html body #gacha .gacha-ask-title,
html body #gacha .gacha-ask-chips button,
html body #gacha .gacha-ask-tip,
html body #gacha .gacha-ask-tip *,
html body #gacha .gacha-receipt-paper,
html body #gacha .gacha-receipt-paper span,
html body #gacha .gacha-open-sub,
html body #gacha .gacha-open-sub > span,
html body #gacha .gacha-field-tip,
html body #gacha .gacha-spin-note-title,
html body #gacha .gacha-spin-note-actions button { font-family: var(--hand) !important; }
html body #gacha .gacha-sign,
html body #gacha .gacha-menu-rail,
html body #gacha .gacha-tag-name,
html body #gacha .gacha-open-word,
html body #gacha .gacha-board,
html body #gacha .gacha-ask-sign-board,
html body #gacha .gacha-hot-label,
html body #gacha .gacha-dome-tip b,
html body #gacha .gacha-dome-tip small { font-family: var(--sign) !important; }
html body #gacha .gacha-note-tab b,
html body #gacha .gacha-receipt-paper b,
html body #gacha .gacha-sign small { font-family: 'Outfit', sans-serif !important; }

/* 便條紙（參考：白報紙＋紙膠帶＋綠色編號索引貼）
   結構：.gacha-note（外層：膠帶、索引貼、跟著紙形狀走的陰影）＞ .gacha-note-paper（紙本身）。
   滑過去時左下角往左上捲起：紙用 clip-path 裁掉左下角，::after 是捲起來那一角的紙背。
   折線從底邊 x=k 斜到左邊 y=H−2k，翻起的角落在 (1.6k, H−0.8k)，所以紙背的外框是 1.6k × 2k。 */
#gacha .gacha-note {
  --tilt: -3deg;
  --k: 0cqh;
  position: absolute;
  z-index: 1;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: var(--note-ink);
  font: 400 clamp(11px, 2cqh, 17px)/1.6 var(--hand);
  text-align: left;
  filter: drop-shadow(0 1px 1px rgba(40,30,20,.14)) drop-shadow(0 6px 7px rgba(40,30,20,.22));
  transform: rotate(var(--tilt));
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  transition: transform .35s ease;
}
#gacha .gacha-note-paper {
  display: grid;
  gap: .8cqh;
  align-content: start;
  padding: 3.4cqh 2.6cqh 2.2cqh;
  background:
    radial-gradient(circle at 20% 30%, rgba(120,110,90,.07) 0 1px, transparent 1.5px) 0 0 / 6px 6px,
    radial-gradient(circle at 70% 70%, rgba(255,255,255,.6) 0 1px, transparent 1.6px) 0 0 / 9px 9px,
    linear-gradient(175deg, #fbfaf5 0%, #f3f0e6 70%, #ebe6d8 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, var(--k) 100%, 0 calc(100% - var(--k) * 2));
  transition: clip-path .55s cubic-bezier(.3,1.25,.5,1);
}
/* 紙膠帶：兩端鋸齒、半透明 */
#gacha .gacha-note::before {
  content: '';
  position: absolute;
  z-index: 2;
  top: -1.6cqh;
  left: 50%;
  width: 11cqh;
  height: 3.2cqh;
  margin-left: -5.5cqh;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 2px, transparent 2px 7px),
    rgba(196,214,170,.82);
  clip-path: polygon(0 8%, 4% 0, 8% 10%, 12% 0, 88% 0, 92% 10%, 96% 0, 100% 8%, 100% 92%, 96% 100%, 92% 90%, 88% 100%, 12% 100%, 8% 90%, 4% 100%, 0 92%);
  transform: rotate(calc(var(--tilt) * -1.2));
}
/* 捲起來的那一角（紙背，靠折線亮、往尖端暗） */
#gacha .gacha-note::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc(var(--k) * 1.6);
  height: calc(var(--k) * 2);
  background: linear-gradient(63deg, #d6cfbf 0%, #f4f0e6 38%, #fffdf8 52%, #e4ddcc 100%);
  clip-path: polygon(0 0, 100% 60%, 62.5% 100%);
  transition: width .55s cubic-bezier(.3,1.25,.5,1), height .55s cubic-bezier(.3,1.25,.5,1);
  pointer-events: none;
}
#gacha .gacha-note:hover,
#gacha .gacha-note:focus-visible {
  --k: 7cqh;
  z-index: 6;
  transform: rotate(calc(var(--tilt) * .5)) translateY(-2px);
  outline: none;
}
#gacha .gacha-note:focus-visible .gacha-note-paper { outline: 3px solid var(--g-violet); outline-offset: 4px; }
#gacha .gacha-note-tab {
  position: absolute;
  z-index: 2;
  top: 2cqh;
  right: -3.2em;
  display: flex;
  align-items: baseline;
  gap: .8em;
  padding: .45em .8em .45em .9em;
  border-radius: 2px;
  background: #dfe8a6;
  box-shadow: 0 2px 3px rgba(60,60,20,.2);
  color: #4d5320;
  font: 400 max(12px, .8em)/1 var(--hand);
  transform: rotate(4deg);
}
#gacha .gacha-note-tab b { font: 400 1em/1 'Outfit', sans-serif; letter-spacing: .04em; }
#gacha .gacha-note-title {
  padding-bottom: .3em;
  border-bottom: 1.5px dashed rgba(47,42,37,.3);
  color: #1f1b17;
  font-size: 1.55em;
  font-weight: 700;
  line-height: 1.2;
}
#gacha .gacha-note-more { justify-self: end; color: #8a6d4a; font-size: .85em; }
#gacha .gacha-note-more::before { content: '🔍 '; }
#gacha .gacha-note-intro { --tilt: -3.5deg; left: 4cqw; top: 10cqh; width: 23cqw; }
#gacha .gacha-note-rules { --tilt: 2.5deg; left: 7cqw; top: 46cqh; width: 21cqw; }
#gacha .gacha-note-rules .gacha-note-paper { gap: .5cqh; padding-top: 3cqh; padding-bottom: 1.8cqh; }
#gacha .gacha-note-rules .gacha-note-text { line-height: 1.5; }

/* 獎池機率：一排掛著的木頭價目牌。滑過去時牌子輪流晃一下。 */
#gacha .gacha-menu {
  position: absolute;
  right: 3cqw;
  top: 4cqh;
  z-index: 1;
  width: 31cqw;
  padding: 0;
  border: 0;
  background: none;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
}
#gacha .gacha-menu:focus-visible { outline: 3px solid var(--g-violet); outline-offset: 6px; border-radius: 6px; }
#gacha .gacha-menu-rail {
  position: relative;
  z-index: 1;
  display: block;
  padding: .7cqh 0 .8cqh;
  border-radius: 4px;
  background:
    repeating-linear-gradient(0deg, rgba(70,35,10,.12) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #8a5a33, #6d4424);
  box-shadow: 0 4px 6px rgba(40,20,5,.35), inset 0 1px 0 rgba(255,220,170,.25);
  color: #f3dcb3;
  font: 700 clamp(12px, 2.1cqh, 18px)/1 var(--sign);
  letter-spacing: .5em;
  text-indent: .5em;
  text-align: center;
}
#gacha .gacha-menu-tags { display: flex; justify-content: space-between; gap: 1.1cqw; padding: 0 1.4cqw; }
#gacha .gacha-tag {
  --drop: 2cqh;
  position: relative;
  display: grid;
  justify-items: center;
  gap: .9cqh;
  flex: 1 1 0;
  min-width: 0;
  margin-top: var(--drop);
  padding: 2.4cqh .4cqw 1.6cqh;
  border-radius: 3px;
  background:
    radial-gradient(circle at 50% 1.3cqh, #3a2412 0 .55cqh, transparent .65cqh),
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(90,50,20,.13) 3px 4px, transparent 4px 9px, rgba(255,235,200,.08) 9px 10px, transparent 10px 14px),
    linear-gradient(90deg, #b47c49, #c99560 28%, #ad7444 52%, #c38b57 78%, #a46c3d);
  box-shadow: inset 0 0 0 1px rgba(60,30,10,.35), inset 0 -.8cqh 1.2cqh rgba(60,30,10,.2), 0 .8cqh 1.2cqh rgba(40,20,5,.3);
  transform-origin: 50% calc(var(--drop) * -1);
  transition: transform .2s ease;
}
/* 掛繩 */
#gacha .gacha-tag::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% - 1.3cqh);
  width: 2px;
  height: calc(var(--drop) + 1.3cqh);
  margin-left: -1px;
  background: #d8c4a0;
}
#gacha .gacha-tag-rarity {
  margin-top: .6cqh;
  color: #6c7690;
  font: 900 clamp(10px, 1.7cqh, 14px)/1.1 'Outfit', sans-serif;
  letter-spacing: .02em;
  /* 白邊：四個方向的 drop-shadow，漸層字（UR）也描得到 */
  filter: drop-shadow(1px 0 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 1px 0 #fff) drop-shadow(0 -1px 0 #fff) drop-shadow(0 1px 1px rgba(40,20,5,.35));
}
#gacha .gacha-tag[data-rarity="R"] .gacha-tag-rarity { color: #3f74c4; }
#gacha .gacha-tag[data-rarity="SR"] .gacha-tag-rarity { color: #7a5fd6; }
#gacha .gacha-tag[data-rarity="SSR"] .gacha-tag-rarity { color: #d48a12; }
#gacha .gacha-tag[data-rarity="UR"] .gacha-tag-rarity {
  background: linear-gradient(120deg, #ff5f9e 0%, #a46bff 50%, #36b6e8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
#gacha .gacha-tag-name {
  color: #2b170a;
  font: 700 clamp(13px, 2.5cqh, 21px)/1.05 var(--sign);
  letter-spacing: .08em;
  text-shadow: 0 1px 0 rgba(255,225,180,.35);
  writing-mode: vertical-rl;
  text-orientation: upright;
}
#gacha .gacha-tag-odds {
  color: #fff;
  font: 800 clamp(11px, 2.1cqh, 18px)/1 'Outfit', sans-serif;
  letter-spacing: -.02em;
  text-shadow: 0 1px 0 rgba(60,28,8,.85), 0 0 3px rgba(60,28,8,.6);
}

/* 滑鼠碰到時由 gacha.js 加上 .is-swinging：推一下之後照慣性擺完，擺幅一次比一次小，
   滑鼠移開也不會中斷；擺完（animationend）才拿掉 class。--amp 讓每塊牌子擺得不一樣大。 */
#gacha .gacha-tag.is-swinging { animation: gacha-tag-swing 2.8s linear calc(var(--i) * 80ms) both; }
@keyframes gacha-tag-swing {
  0%   { transform: rotate(0); animation-timing-function: cubic-bezier(.3, 0, .6, 1); }
  12%  { transform: rotate(calc(var(--amp, 7deg) * 1)); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  28%  { transform: rotate(calc(var(--amp, 7deg) * -.72)); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  44%  { transform: rotate(calc(var(--amp, 7deg) * .5)); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  59%  { transform: rotate(calc(var(--amp, 7deg) * -.33)); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  73%  { transform: rotate(calc(var(--amp, 7deg) * .2)); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  86%  { transform: rotate(calc(var(--amp, 7deg) * -.1)); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  100% { transform: rotate(0); }
}

/* 機台站在櫃台上 */
#gacha .gacha-machine {
  position: absolute;
  left: 50%;
  bottom: 17cqh;
  z-index: 4;
  height: 66cqh;
  aspect-ratio: 340 / 480;
  transform: translateX(-50%);
}
#gacha .gacha-machine:focus-visible { outline: 3px solid var(--g-violet); outline-offset: 6px; border-radius: 16px; }

/* 櫃台左邊的小史萊貓（gacha.js 的 deskSlimes）：站在桌面上，從牆邊到機台左邊這一段跳來跳去 */
#gacha .gacha-desk {
  position: absolute;
  left: 2.4cqw;
  bottom: 16.8cqh;
  z-index: 4;
  width: calc(50% - 25.5cqh - 2.4cqw);
  height: 20cqh;
  pointer-events: none;
}
#gacha .gacha-desk-slime {
  --size: 6.8cqh;
  position: absolute;
  bottom: 0;
  left: calc((100% - var(--size)) * var(--x, .5));
  width: var(--size);
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  -webkit-tap-highlight-color: transparent;
  transition: left .62s cubic-bezier(.35,.9,.45,1);
}
#gacha .gacha-desk-slime:focus-visible { outline: 2px dashed var(--g-violet); outline-offset: 2px; border-radius: 40%; }
#gacha .gacha-desk-slime .slime-jelly { transform-origin: 50% 90.7%; }
/* 移動時不左右翻面：兩隻永遠面向前方 */
#gacha .gacha-desk-slime .slime-doll { margin-bottom: -9.3%; filter: drop-shadow(0 .4cqh .3cqh rgba(60,35,10,.22)); }
#gacha .gacha-desk-slime:nth-child(2) .slime-jelly { animation-delay: -.7s; }
#gacha .gacha-desk-slime .slime-jelly:not(.is-poked) { animation: desk-breathe 2.8s ease-in-out infinite; }
#gacha .gacha-desk-slime.is-hop .slime-jelly:not(.is-poked) { animation: desk-hop .62s ease-in-out; }
#gacha .gacha-desk-slime.is-bump .slime-jelly:not(.is-poked) { animation: desk-bump .5s ease-out; }
#gacha .gacha-desk-slime.is-squish .slime-jelly:not(.is-poked) { animation: desk-squish .75s ease-in-out; }
@keyframes desk-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.04, .96); } }
@keyframes desk-hop {
  0% { transform: none; }
  18% { transform: scale(1.18, .82); }
  50% { transform: translateY(-34%) scale(.9, 1.12); }
  80% { transform: translateY(0) scale(1.16, .84); }
  100% { transform: none; }
}
@keyframes desk-bump { 0% { transform: none; } 25% { transform: scale(.78, 1.16); } 55% { transform: scale(1.12, .9); } 80% { transform: scale(.97, 1.03); } 100% { transform: none; } }
@keyframes desk-squish { 0% { transform: none; } 40% { transform: scale(1.26, .74); } 70% { transform: scale(.93, 1.08); } 100% { transform: none; } }
#gacha .gacha-shop.is-closed .gacha-desk-slime .slime-doll { filter: saturate(.6) brightness(.92); }

/* 櫃台 */
#gacha .gacha-counter { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; height: 20cqh; }
#gacha .gacha-counter::before {
  content: '';
  position: absolute;
  left: -1%;
  right: -1%;
  top: 0;
  height: 3.6cqh;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #d3a677 0%, #b07c4e 55%, #8b5e3c 100%);
  box-shadow: 0 3px 0 rgba(0,0,0,.14);
}
#gacha .gacha-counter-front {
  position: absolute;
  left: 0;
  right: 0;
  top: 3.6cqh;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 2px solid #d4b06b;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 1px, transparent 1px 72px),
    linear-gradient(180deg, #252f4d, #131b2b);
}
/* 機台熱點：位置照 SVG viewBox 340×480 換算。滑過去會亮圈＋小標籤。 */
#gacha .gacha-hot {
  position: absolute;
  z-index: 2;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
}
#gacha .gacha-hot-coin { left: 58.5%; top: 68.5%; width: 15.9%; height: 11.25%; }
#gacha .gacha-hot-crank { left: 22.5%; top: 70.5%; width: 27%; height: 19%; }
/* 觸控：投幣孔在手機上只有 20 多 px，外圍加一圈看不見的點擊範圍（不會碰到旁邊的把手） */
@media (pointer: coarse) {
  #gacha .gacha-hot-coin::after { content: ''; position: absolute; inset: -10px; border-radius: 50%; }
}
#gacha .gacha-hot::before {
  content: '';
  position: absolute;
  inset: -4%;
  border-radius: inherit;
  box-shadow: 0 0 0 3px rgba(246,230,184,0), 0 0 0 0 rgba(184,173,240,0);
  transition: box-shadow .25s ease;
}
#gacha .gacha-hot:hover::before,
#gacha .gacha-hot:focus-visible::before { box-shadow: 0 0 0 3px rgba(246,230,184,.95), 0 0 18px 6px rgba(184,173,240,.75); }
#gacha .gacha-hot:focus-visible { outline: none; }
#gacha .gacha-hot-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  padding: .35em .8em;
  border-radius: 999px;
  background: var(--g-night);
  color: #f6e6b8;
  font: 700 clamp(12px, 2cqh, 16px)/1 var(--sign);
  letter-spacing: .1em;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
#gacha .gacha-hot:hover .gacha-hot-label,
#gacha .gacha-hot:focus-visible .gacha-hot-label { opacity: 1; transform: translate(-50%, 0); }
/* 玻璃球的說明泡泡：取代瀏覽器內建的灰色 title 提示框，樣式跟投幣孔／轉把的標籤同一套 */
#gacha .gacha-dome-tip {
  position: absolute;
  left: 50%;
  top: 7%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45em;
  padding: .7em 1.1em .65em;
  border-radius: 12px;
  background: var(--g-night);
  color: #f6e6b8;
  box-shadow: 0 0 0 2px rgba(246,230,184,.5), 0 12px 24px rgba(19,27,43,.26);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity .2s ease, transform .2s ease;
}
#gacha .gacha-dome-tip::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  border: 7px solid transparent;
  border-top-color: var(--g-night);
  transform: translateX(-50%);
}
#gacha .gacha-dome-tip b { font: 700 clamp(13px, 2.2cqh, 17px)/1 var(--sign); letter-spacing: .14em; }
#gacha .gacha-dome-tip small { font: 700 clamp(12px, 1.6cqh, 13px)/1 var(--sign); letter-spacing: .08em; color: #cfc6f5; }
#gacha .gacha-machine-art:hover ~ .gacha-dome-tip { opacity: 1; transform: translate(-50%, 0); }
@media (hover: none) { #gacha .gacha-dome-tip { display: none; } }
#gacha .gacha-hot:disabled { cursor: default; }
#gacha .gacha-hot:disabled::before { box-shadow: none !important; }
#gacha .gacha-hot:disabled .gacha-hot-label { opacity: 0 !important; }
/* 卡填好了：把手一直發光、標籤「轉我！」一直顯示 */
#gacha .gacha-machine.is-armed .gacha-hot-crank::before { animation: gacha-crank-glow 1.1s ease-in-out infinite; }
#gacha .gacha-machine.is-armed .gacha-hot-crank .gacha-hot-label { opacity: 1; transform: translate(-50%, 0); background: var(--g-plum); color: #fff; animation: gacha-hop .9s ease-in-out infinite; }
#gacha .gacha-machine.is-armed .gacha-crank { animation: gacha-crank-nudge 1.1s ease-in-out infinite; }
@keyframes gacha-crank-glow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(246,230,184,.9), 0 0 10px 2px rgba(196,138,168,.5); }
  50% { box-shadow: 0 0 0 4px rgba(246,230,184,1), 0 0 24px 10px rgba(196,138,168,.85); }
}
@keyframes gacha-hop { 0%, 100% { margin-bottom: 0; } 50% { margin-bottom: 6px; } }
@keyframes gacha-crank-nudge { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-22deg); } }

/* 櫃台正面的木牌（說明怎麼轉；用 gacha-board，避免跟機台 SVG 上的 .gacha-plate 字撞名） */
#gacha .gacha-board {
  position: relative;
  display: flex;
  gap: 3cqh;
  margin: 0;
  padding: 1.5cqh 4.4cqh 1.6cqh;
  border-radius: 6px;
  background:
    radial-gradient(circle at 2.2cqh 50%, #5a3a1c 0 .5cqh, #d9b98a .55cqh .75cqh, transparent .8cqh),
    radial-gradient(circle at calc(100% - 2.2cqh) 50%, #5a3a1c 0 .5cqh, #d9b98a .55cqh .75cqh, transparent .8cqh),
    repeating-linear-gradient(176deg, transparent 0 5px, rgba(110,60,20,.12) 5px 6px, transparent 6px 13px, rgba(255,240,210,.12) 13px 14px, transparent 14px 22px),
    linear-gradient(180deg, #d9a96f, #c4904f 55%, #b07a42);
  box-shadow: inset 0 0 0 1px rgba(80,45,15,.4), inset 0 -.6cqh 1cqh rgba(80,45,15,.2), 0 .8cqh 1.4cqh rgba(0,0,0,.4);
  color: #3b2210;
  font: 700 clamp(14px, 2.8cqh, 23px)/1.2 var(--sign);
  letter-spacing: .08em;
  text-shadow: 0 1px 0 rgba(255,232,195,.5), 0 -1px 0 rgba(60,30,10,.35);
  white-space: nowrap;
}
#gacha .gacha-shop.is-closed .gacha-board { filter: brightness(.85) saturate(.7); }

/* 收據：躺在櫃台桌面上，機台與老闆之間 */
#gacha .gacha-receipt-btn {
  position: absolute;
  left: calc(50% - 24.5cqh - 15cqh);
  bottom: 17.2cqh;
  z-index: 4;
  width: 15cqh;
  padding: 0;
  border: 0;
  background: none;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  transform: perspective(300px) rotateX(38deg) rotate(8deg);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 4px 3px rgba(60,35,10,.35));
}
#gacha .gacha-receipt-btn[hidden] { display: none; }
#gacha .gacha-receipt-btn:focus-visible { outline: none; }
#gacha .gacha-receipt-btn:hover .gacha-receipt-paper,
#gacha .gacha-receipt-btn:focus-visible .gacha-receipt-paper { transform: translateY(-4px) rotateX(-14deg); }
#gacha .gacha-receipt-paper {
  display: grid;
  justify-items: center;
  gap: .5cqh;
  padding: 1.4cqh 1cqh 2cqh;
  background:
    linear-gradient(135deg, transparent 6px, #fffdf7 6px) 0 100% / 12px 12px repeat-x,
    #fffdf7;
  clip-path: polygon(0 0, 100% 0, 100% 94%, 92% 100%, 84% 94%, 76% 100%, 68% 94%, 60% 100%, 52% 94%, 44% 100%, 36% 94%, 28% 100%, 20% 94%, 12% 100%, 4% 94%, 0 100%);
  color: var(--note-ink);
  font: 400 clamp(10px, 1.7cqh, 14px)/1.2 var(--hand);
  transform-origin: 50% 100%;
  transition: transform .3s ease;
}
#gacha .gacha-receipt-paper b { font: 800 clamp(8px, 1.3cqh, 11px)/1 'Outfit', sans-serif; letter-spacing: .2em; color: #7a7266; }
#gacha .gacha-receipt-paper i { display: block; width: 80%; height: 1px; border-top: 1px dashed rgba(47,42,37,.35); }

/* 投幣視窗一次只顯示一步 */
#gacha .gacha-card-dialog { width: min(600px, calc(100vw - 32px)); }
#gacha .gacha-card-dialog .gacha-card-grid { grid-template-columns: minmax(0, 1fr); }
#gacha .gacha-card-dialog[data-step="pay"] [data-step="card"],
#gacha .gacha-card-dialog[data-step="card"] [data-step="pay"] { display: none; }
#gacha .gacha-dialog-title { display: none; }
#gacha .gacha-next {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 13px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--g-night);
  color: #fff;
  font: 600 15px/1.2 inherit;
  font-family: inherit;
  letter-spacing: .06em;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
}
#gacha .gacha-next:hover { background: #2b3657; }
#gacha .gacha-back { margin: -4px 0 14px; padding: 0; border: 0; background: none; color: var(--g-violet); font: inherit; font-size: 13.5px; cursor: url('images/cursors/sora-link-select.cur'), pointer; }
#gacha .gacha-back:hover { text-decoration: underline; }
#gacha .gacha-ecpay { margin-right: 10px; }

/* 營業木牌：用皮繩掛在櫃台左邊，OPEN／CLOSED。字是刻上去的感覺。 */
#gacha .gacha-open-sign {
  position: absolute;
  left: 5cqw;
  top: 2.6cqh;
  display: grid;
  justify-items: center;
  gap: .4cqh;
  padding: 1.1cqh 2.4cqh 1.3cqh;
  border-radius: 6px;
  background:
    repeating-linear-gradient(100deg, transparent 0 5px, rgba(110,60,20,.12) 5px 6px, transparent 6px 13px, rgba(255,240,210,.12) 13px 14px, transparent 14px 22px),
    linear-gradient(170deg, #e0b27a, #cc9660 50%, #bd8752);
  box-shadow: inset 0 0 0 1px rgba(80,45,15,.35), inset 0 -.6cqh 1cqh rgba(80,45,15,.18), 0 .8cqh 1.2cqh rgba(0,0,0,.35);
  transform-origin: 50% -2.6cqh;
  animation: gacha-plank-sway 6s ease-in-out infinite;
}
#gacha .gacha-open-sign::before,
#gacha .gacha-open-sign::after {
  content: '';
  position: absolute;
  bottom: 100%;
  width: 2px;
  height: 3.2cqh;
  background: #e9dcc3;
  box-shadow: 0 0 0 .5px rgba(90,60,30,.4);
}
#gacha .gacha-open-sign::before { left: 30%; transform-origin: 50% 100%; transform: rotate(24deg); }
#gacha .gacha-open-sign::after { right: 30%; transform-origin: 50% 100%; transform: rotate(-24deg); }
#gacha .gacha-open-word {
  color: #3b2210;
  font: 700 clamp(15px, 3.2cqh, 28px)/1 var(--sign);
  letter-spacing: .16em;
  text-indent: .16em;
  text-shadow: 0 1px 0 rgba(255,232,195,.5), 0 -1px 0 rgba(60,30,10,.4);
}
#gacha .gacha-open-sub { color: #5a3a1c; font: 400 clamp(12px, 1.7cqh, 14px)/1 var(--hand); }
#gacha .gacha-open-sign.is-flipping { animation: gacha-plank-flip .7s ease-in-out; }
@keyframes gacha-plank-sway { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2deg); } }
@keyframes gacha-plank-flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }

/* 公休：老闆躲到櫃台後、對話框收起、店裡暗一點、按鈕變「今日公休」 */
#gacha .gacha-shop.is-closed::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(19,27,43,.14);
  pointer-events: none;
}
#gacha .gacha-shop.is-closed .gacha-open-word { color: #8c2b1f; }
/* 本月完售：木牌翻成 SOLD OUT（老闆照常在，已付款的人還能點把手開獎） */
#gacha .gacha-shop.is-sold-out .gacha-open-word { color: #8c2b1f; font-size: clamp(13px, 2.6cqh, 23px); letter-spacing: .1em; text-indent: .1em; }
#gacha .gacha-shop.is-closed .gacha-boss-art { transform: translateY(110%); }
#gacha .gacha-shop.is-closed .gacha-ask-sign { transform: translateY(170%); }
#gacha .gacha-shop.is-closed .gacha-boss-say { opacity: 0; visibility: hidden; }
#gacha .gacha-shop.is-closed .gacha-machine { filter: saturate(.55) brightness(.9); cursor: default; }

/* 小白老闆：手搭在櫃台桌面上（分層圖最下面那截手壓在桌面木板上，下緣切齊桌面前緣）
   老闆整塊是一個圖層（z 4，寫在機台後面所以疊在機台前），clip-path 只切下緣：公休時人往下沉就會被櫃台「藏」起來。 */
#gacha .gacha-boss {
  position: absolute;
  right: calc(1.5cqw + 7.5cqh);
  bottom: 16.4cqh;
  z-index: 4;
  width: min(44cqh, 31cqw);
  clip-path: inset(-300% -60% 0 -60%);
}
#gacha .gacha-boss-art { position: relative; z-index: 2; display: block; width: 100%; aspect-ratio: 1136 / 1206; cursor: url('images/cursors/sora-link-select.cur'), pointer; transition: transform .7s cubic-bezier(.5,-.35,.4,1.35); }
#gacha .gacha-boss-art .slime-jelly { position: absolute; left: 0; right: 0; bottom: 0; transform-origin: 50% 100%; }
#gacha .shiro-stack { position: relative; width: 100%; aspect-ratio: 1136 / 1206; transform-origin: 50% 100%; }
#gacha .shiro-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; -webkit-user-select: none; user-select: none; }
#gacha .gacha-boss-art.is-placeholder .slime-jelly { left: 6%; right: 6%; bottom: 14%; }
#gacha .gacha-boss-art .slime-shadow,
#gacha .gacha-boss-art .slime-fx { display: none; }

/* 摸小白：各部位是透明按鈕（位置由 gacha.js 依畫布百分比寫進 style） */
#gacha .gacha-boss-zone {
  position: absolute;
  z-index: 1;
  padding: 0;
  border: 0;
  border-radius: 45%;
  background: none;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  -webkit-tap-highlight-color: transparent;
}
#gacha .gacha-boss-zone:focus-visible { outline: 2px dashed var(--g-violet); outline-offset: 1px; }
#gacha .gacha-boss-zone:disabled { pointer-events: none; }
#gacha .shiro-stack.is-pat { animation: shiro-pat .6s ease-out; }
#gacha .shiro-stack.is-wiggle { animation: shiro-wiggle .55s ease-in-out; }
#gacha .shiro-stack.is-hop { animation: shiro-hop .6s cubic-bezier(.3,.7,.4,1); }
#gacha .shiro-stack.is-nod { animation: shiro-nod .7s ease-in-out; }
#gacha .shiro-stack.is-shake { animation: shiro-shake .6s ease-in-out; }
/* 小白的原形（gacha.js 的 nap）：話說完一陣子沒人理，人形縮下去、變成純白琥珀眼的史萊貓攤在櫃台上 */
#gacha .gacha-boss.is-napping .gacha-boss-art {
  opacity: 0;
  transform: translateY(14%) scale(.82, .3);
  transform-origin: 50% 100%;
  pointer-events: none;
  transition: opacity .3s ease .1s, transform .45s cubic-bezier(.6,-.3,.7,1);
}
#gacha .gacha-boss:not(.is-napping) .gacha-boss-art { transition: opacity .35s ease .15s, transform .55s cubic-bezier(.3,1.5,.5,1) .1s; }
#gacha .shiro-nap {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 3;
  width: 64%;
  margin: 0 0 0 -32%;
  padding: 0;
  border: 0;
  background: none;
  opacity: 0;
  visibility: hidden;
  transform: scale(.3, 1.3);
  transform-origin: 50% 100%;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .25s ease, transform .35s ease, visibility 0s .35s;
}
#gacha .shiro-nap:focus-visible { outline: 2px dashed var(--g-violet); outline-offset: 2px; border-radius: 40%; }
#gacha .gacha-boss.is-napping .shiro-nap { opacity: 1; visibility: visible; transform: none; transition: opacity .3s ease .2s, transform .7s cubic-bezier(.3,1.6,.5,1) .2s, visibility 0s; }
/* 史萊貓型態的分層圖跟人形同一張 1136×1206 畫布；只露出身體那一段（y 262–952），下緣就是果凍貼著桌面的地方 */
#gacha .shiro-nap-art { position: relative; aspect-ratio: 1136 / 690; }
#gacha .shiro-nap-layer {
  position: absolute;
  left: 0;
  top: -37.97%;
  width: 100%;
  height: 174.78%;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
/* 平常閉眼睡；滑鼠移過去（is-peeking）換成半瞇眼 */
#gacha .shiro-nap-layer[data-part="peek"] { opacity: 0; }
#gacha .shiro-nap.is-peeking .shiro-nap-layer[data-part="peek"] { opacity: 1; }
#gacha .shiro-nap.is-peeking .shiro-nap-layer[data-part="sleep"] { opacity: 0; }
/* 軟趴趴：本來就扁的身體再壓扁一點，慢慢呼吸 */
#gacha .shiro-nap .slime-jelly { transform-origin: 50% 99%; }
#gacha .gacha-boss.is-napping .shiro-nap .slime-jelly:not(.is-poked) { animation: shiro-melt 3.8s ease-in-out infinite; }
@keyframes shiro-melt {
  0%, 100% { transform: scale(1.1, .84); }
  50% { transform: scale(1.15, .79); }
}
/* 睡覺的 zZ：從右上方一個接一個飄出來；滑鼠移過去（半睜眼）時先收起來 */
#gacha .shiro-nap-z {
  position: absolute;
  right: 4%;
  top: -2%;
  width: 1em;
  color: var(--g-violet);
  font: 800 clamp(20px, 4.2cqh, 36px)/1 'Outfit', sans-serif;
  text-shadow: 0 0 .25em #fff, 0 0 .5em #fff;
  opacity: 0;
  pointer-events: none;
}
#gacha .shiro-nap-z::before { content: 'Z'; }
#gacha .shiro-nap-z::after { content: 'z'; position: absolute; left: .8em; top: -.95em; font-size: .7em; }
#gacha .gacha-boss.is-napping .shiro-nap-z { animation: shiro-z 3.2s ease-in-out 1s infinite; }
#gacha .gacha-boss.is-napping .shiro-nap.is-peeking .shiro-nap-z { animation: none; opacity: 0; transition: opacity .2s; }
@keyframes shiro-z { 0% { opacity: 0; transform: translate(0, 0) scale(.7); } 30%, 70% { opacity: .9; } 100% { opacity: 0; transform: translate(.7em, -1.4em) scale(1.1); } }
/* 變身時的白煙 */
#gacha .shiro-poof { position: absolute; left: 50%; bottom: 4%; z-index: 4; width: 76%; aspect-ratio: 1.5; translate: -50% 0; pointer-events: none; }
#gacha .shiro-poof i {
  position: absolute;
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #fff 0 45%, #eeeafc 75%, rgba(238,234,252,0) 76%);
  filter: drop-shadow(0 2px 3px rgba(102,90,156,.25));
  opacity: 0;
}
#gacha .shiro-poof i:nth-child(1) { left: 33%; top: 30%; width: 40%; }
#gacha .shiro-poof i:nth-child(2) { left: 8%; top: 44%; }
#gacha .shiro-poof i:nth-child(3) { left: 58%; top: 42%; }
#gacha .shiro-poof i:nth-child(4) { left: 20%; top: 10%; width: 28%; }
#gacha .shiro-poof i:nth-child(5) { left: 52%; top: 6%; width: 30%; }
#gacha .shiro-poof i:nth-child(6) { left: 0; top: 18%; width: 20%; }
#gacha .shiro-poof i:nth-child(7) { left: 78%; top: 20%; width: 22%; }
#gacha .shiro-poof.is-on i { animation: shiro-poof .75s cubic-bezier(.2,.8,.3,1) both; }
#gacha .shiro-poof.is-on i:nth-child(even) { animation-delay: .06s; }
@keyframes shiro-poof {
  0% { opacity: 0; transform: scale(.2); }
  30% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.35) translateY(-12%); }
}
#gacha .gacha-shop.is-closed .shiro-nap { transform: translateY(130%); }

/* 左右差分：碰哪一邊，頭就往哪邊歪（tilt）或身體往另一邊躲（lean）。l／r 是畫面的左右 */
#gacha .shiro-stack.is-tilt-l { animation: shiro-tilt-l .75s ease-in-out; }
#gacha .shiro-stack.is-tilt-r { animation: shiro-tilt-r .75s ease-in-out; }
#gacha .shiro-stack.is-lean-l { animation: shiro-lean-l .7s cubic-bezier(.3,1.4,.5,1); }
#gacha .shiro-stack.is-lean-r { animation: shiro-lean-r .7s cubic-bezier(.3,1.4,.5,1); }
@keyframes shiro-tilt-l { 30% { transform: rotate(-3.2deg); } 60% { transform: rotate(1.2deg); } 82% { transform: rotate(-.4deg); } }
@keyframes shiro-tilt-r { 30% { transform: rotate(3.2deg); } 60% { transform: rotate(-1.2deg); } 82% { transform: rotate(.4deg); } }
@keyframes shiro-lean-l { 35% { transform: translateX(-2.4%) rotate(-1.6deg) scale(1.01, .985); } 70% { transform: translateX(.6%) rotate(.4deg); } }
@keyframes shiro-lean-r { 35% { transform: translateX(2.4%) rotate(1.6deg) scale(1.01, .985); } 70% { transform: translateX(-.6%) rotate(-.4deg); } }
@keyframes shiro-hop {
  18% { transform: scale(1.05, .93); }
  45% { transform: translateY(-7%) scale(.97, 1.04); }
  70% { transform: translateY(0) scale(1.04, .96); }
  85% { transform: scale(.99, 1.01); }
}
@keyframes shiro-nod {
  25%, 65% { transform: translateY(1.6%) rotate(.6deg) scale(1, .985); }
  45%, 85% { transform: none; }
}
@keyframes shiro-shake {
  15% { transform: rotate(-2.4deg); }
  35% { transform: rotate(2.4deg); }
  55% { transform: rotate(-1.6deg); }
  75% { transform: rotate(1deg); }
}
/* 疊在臉上的效果：陰沉臉（face-01，正片疊底）、臉紅、汗滴、青筋、腦中的罐罐；平常透明，換表情時淡入 */
#gacha .shiro-layer[hidden] { display: none; }
#gacha .shiro-layer:is([data-part="shade"], [data-part="blush"], [data-part="sweat"], [data-part="anger"], [data-part="can"]) {
  opacity: 0;
  transition: opacity .35s ease, transform .35s cubic-bezier(.3,1.5,.5,1);
}
#gacha .shiro-layer[data-part="shade"] { mix-blend-mode: multiply; }
#gacha .shiro-layer[data-part="sweat"] { transform: translateY(-3%); }
#gacha .shiro-layer[data-part="anger"] { transform-origin: 29% 32%; transform: scale(.6); }
/* 桌上的罐罐：原圖畫在手臂旁邊（底部約 82%），往下移到跟手一樣壓在桌面上 */
#gacha .shiro-layer[data-part="can"] { transform-origin: 81% 96%; transform: translateY(9%); }
#gacha .gacha-boss-art.show-shade .shiro-layer[data-part="shade"],
#gacha .gacha-boss-art.show-blush .shiro-layer[data-part="blush"] { opacity: 1; }
#gacha .gacha-boss-art.show-sweat .shiro-layer[data-part="sweat"] { opacity: 1; transform: none; }
#gacha .gacha-boss-art.show-anger .shiro-layer[data-part="anger"] { opacity: 1; transform: none; animation: shiro-anger .9s ease-in-out .35s infinite; }
#gacha .gacha-boss-art.has-can .shiro-layer[data-part="can"] { opacity: 1; transform: translateY(15.5%); }
/* 被碰的時候拉到手邊護著 */
/* 抱起來的時候桌上那罐先收起來（手上那罐畫在 body-04 裡） */
#gacha .gacha-boss-art.has-can.is-guarding .shiro-layer[data-part="can"] { opacity: 0; transition-duration: .12s; }

/* 耳朵（ear-01／02，墊在身體後面）：繞著耳根（頭頂那條邊的內側端點）轉。
   耳朵的上緣同時是頭頂的輪廓，只能往下轉；往上轉頭頂兩側會露出縫。earR＝畫面左邊。
   姿勢（垂耳、飛機耳）用 transform 慢慢轉過去；抖一下用 rotate 屬性另外疊上去 */
#gacha .shiro-layer:is([data-part="earR"], [data-part="earL"]) { transition: transform .4s cubic-bezier(.3,1.4,.5,1); }
#gacha .shiro-layer[data-part="earR"] { transform-origin: 41.2% 15.4%; }
#gacha .shiro-layer[data-part="earL"] { transform-origin: 58.8% 15.4%; }
#gacha .gacha-boss-art.ears-droop .shiro-layer[data-part="earR"] { transform: rotate(-3.5deg); }
#gacha .gacha-boss-art.ears-droop .shiro-layer[data-part="earL"] { transform: rotate(3.5deg); }
#gacha .gacha-boss-art:is(.ears-flat, .is-patted) .shiro-layer[data-part="earR"] { transform: rotate(-7deg); }
#gacha .gacha-boss-art:is(.ears-flat, .is-patted) .shiro-layer[data-part="earL"] { transform: rotate(7deg); }
#gacha .shiro-layer[data-part="earR"].is-flick { animation: shiro-flick-r .5s ease-in-out; }
#gacha .shiro-layer[data-part="earL"].is-flick { animation: shiro-flick-l .5s ease-in-out; }
/* 已經壓成飛機耳就不再抖（疊起來角度太大會露縫） */
#gacha .gacha-boss-art:is(.ears-flat, .is-patted) .shiro-layer.is-flick { animation: none; }
@keyframes shiro-flick-r { 22% { rotate: -6deg; } 48% { rotate: 0deg; } 68% { rotate: -3deg; } }
@keyframes shiro-flick-l { 22% { rotate: 6deg; } 48% { rotate: 0deg; } 68% { rotate: 3deg; } }
/* 呆毛：平常慢慢晃，被碰到或整個人晃的時候彈一下 */
#gacha .shiro-layer[data-part="ahoge"] { transform-origin: 49.7% 17%; animation: shiro-ahoge-sway 4.6s ease-in-out infinite; }
#gacha .shiro-layer[data-part="ahoge"].is-boing { animation: shiro-ahoge-boing .85s ease-out; }
@keyframes shiro-ahoge-sway { 0%, 100% { rotate: -2deg; } 50% { rotate: 2.5deg; } }
@keyframes shiro-ahoge-boing {
  0% { rotate: 0deg; }
  15% { rotate: 10deg; }
  35% { rotate: -7deg; }
  55% { rotate: 4deg; }
  75% { rotate: -2deg; }
  100% { rotate: 0deg; }
}

/* 思考泡泡：右上方、從頭頂冒出兩顆小泡泡，大泡泡裡飄著罐罐 */
#gacha .shiro-thought {
  position: absolute;
  left: 70%;
  top: 1%;
  z-index: 1;
  width: 30%;
  aspect-ratio: 1.15;
  border-radius: 50%;
  background: #fff;
  /* 整朵雲（含小泡泡）描一圈跟小白線稿同色的邊，白頭髮上才看得清楚 */
  filter: drop-shadow(1.5px 0 0 #7a4a33) drop-shadow(-1.5px 0 0 #7a4a33) drop-shadow(0 1.5px 0 #7a4a33) drop-shadow(0 -1.5px 0 #7a4a33) drop-shadow(0 .4cqh .6cqh rgba(19,27,43,.18));
  opacity: 0;
  transform: translate(-12%, 18%) scale(.4);
  transform-origin: 0 100%;
  transition: opacity .3s ease, transform .4s cubic-bezier(.3,1.5,.5,1);
  pointer-events: none;
}
/* 雲朵的鼓包 */
#gacha .shiro-thought::before,
#gacha .shiro-thought::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: #fff;
}
#gacha .shiro-thought::before { left: 8%; top: -12%; width: 46%; height: 52%; }
#gacha .shiro-thought::after { right: 4%; top: -6%; width: 40%; height: 46%; }
#gacha .shiro-thought-dot {
  position: absolute;
  border-radius: 50%;
  background: #fff;
}
#gacha .shiro-thought-dot:nth-child(1) { left: -16%; bottom: -24%; width: 9%; aspect-ratio: 1; }
#gacha .shiro-thought-dot:nth-child(2) { left: -4%; bottom: -8%; width: 15%; aspect-ratio: 1; }
/* object-02 是整張畫布，用背景裁出罐罐那一塊（約 480–659 × 356–528） */
#gacha .shiro-thought-can {
  position: absolute;
  left: 20%;
  top: 8%;
  z-index: 1;
  width: 62%;
  aspect-ratio: 179 / 172;
  background-repeat: no-repeat;
  background-size: 634.6% auto;
  background-position: 50.16% 34.43%;
}
#gacha .gacha-boss-art.show-thought .shiro-thought { opacity: 1; transform: none; }
#gacha .gacha-boss-art.show-thought .shiro-thought-can { animation: shiro-float 2.4s ease-in-out .4s infinite; }
@keyframes shiro-anger { 50% { transform: scale(1.12); } }
@keyframes shiro-float { 50% { transform: translateY(-1.6%) rotate(-3deg); } }
/* 罐罐不在桌上時，點不到那一塊 */
#gacha .gacha-boss-art:not(.has-can) .gacha-boss-zone[data-part="can"] { display: none; }
@keyframes shiro-pat {
  25% { transform: scale(1.04, .94); }
  55% { transform: scale(.98, 1.03); }
  80% { transform: scale(1.01, .99); }
}
@keyframes shiro-wiggle {
  20% { transform: rotate(-2.2deg); }
  45% { transform: rotate(1.8deg); }
  70% { transform: rotate(-1deg); }
}

/* 問問木牌：小白右手邊、立在桌面上的小木牌 */
#gacha .gacha-ask-sign {
  position: absolute;
  left: calc(100% - 2.5cqh);
  bottom: .9cqh;
  z-index: 3;
  width: 10cqh;
  padding: 0 0 2.6cqh;
  border: 0;
  background: none;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  filter: drop-shadow(0 .5cqh .4cqh rgba(60,35,10,.35));
  transform: rotate(4deg);
  transform-origin: 50% 100%;
  transition: transform .7s cubic-bezier(.5,-.35,.4,1.35);
}
#gacha .gacha-ask-sign::before,
#gacha .gacha-ask-sign::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: .7cqh;
  height: 3.4cqh;
  border-radius: 2px;
  background: linear-gradient(90deg, #7a5230, #5a3a1c);
}
#gacha .gacha-ask-sign::before { left: 26%; transform: rotate(9deg); }
#gacha .gacha-ask-sign::after { right: 26%; transform: rotate(-9deg); }
#gacha .gacha-ask-sign-board {
  position: relative;
  z-index: 1;
  display: block;
  padding: 1.1cqh 0 1.2cqh;
  border-radius: 1.2cqh;
  background:
    repeating-linear-gradient(176deg, transparent 0 5px, rgba(110,60,20,.12) 5px 6px, transparent 6px 13px, rgba(255,240,210,.12) 13px 14px, transparent 14px 22px),
    linear-gradient(180deg, #e3b57c, #cc9660 55%, #b98350);
  box-shadow: inset 0 0 0 1px rgba(80,45,15,.4), inset 0 -.5cqh .8cqh rgba(80,45,15,.2);
  color: #3b2210;
  font: 700 clamp(13px, 2.6cqh, 22px)/1 var(--sign);
  letter-spacing: .12em;
  text-indent: .12em;
  text-shadow: 0 1px 0 rgba(255,232,195,.5), 0 -1px 0 rgba(60,30,10,.35);
  white-space: nowrap;
  transition: transform .25s cubic-bezier(.3,1.6,.5,1);
}
/* 右上角的小問號泡泡 */
#gacha .gacha-ask-sign-board::after {
  content: '?';
  position: absolute;
  top: -1.5cqh;
  right: -1.3cqh;
  width: 2.8cqh;
  height: 2.8cqh;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 .3cqh .6cqh rgba(19,27,43,.2);
  color: var(--g-violet);
  font: 800 clamp(10px, 1.9cqh, 16px)/2.8cqh 'Outfit', sans-serif;
  letter-spacing: 0;
  text-indent: 0;
  text-align: center;
  text-shadow: none;
}
#gacha .gacha-ask-sign:hover .gacha-ask-sign-board,
#gacha .gacha-ask-sign:focus-visible .gacha-ask-sign-board { transform: translateY(-.7cqh) rotate(-4deg); }
#gacha .gacha-ask-sign.is-open .gacha-ask-sign-board { transform: translateY(-.3cqh) rotate(-2deg); }
#gacha .gacha-ask-sign:focus-visible { outline: none; }
#gacha .gacha-ask-sign:focus-visible .gacha-ask-sign-board { outline: 3px solid var(--g-violet); outline-offset: 3px; }

/* 小白頭上的對話框：說完幾秒就收起來（.is-gone） */
#gacha .gacha-boss-say {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 1.4cqh);
  z-index: 5;
  translate: -50% 0;
  width: max-content;
  max-width: min(30cqw, 52cqh);
  margin: 0;
  padding: 1.1cqh 1.8cqh;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(19,27,43,.16);
  color: var(--g-ink);
  font: 400 clamp(12px, 2cqh, 16px)/1.55 var(--hand);
  animation: gacha-say .4s cubic-bezier(.3,1.4,.5,1);
  transition: opacity .4s ease, visibility .4s;
}
#gacha .gacha-boss-say.is-plain { font-size: clamp(12px, 1.85cqh, 15px); }
/* 句子裡插進去、手寫字型沒收的字（訪客名字、委託狀態）：只有這段用一般字型，字級跟 .is-plain 一樣 */
#gacha .gacha-boss-say .gacha-say-plain { font-size: .93em; }
#gacha .gacha-boss-say.is-gone { opacity: 0; visibility: hidden; }
#gacha .gacha-boss-say::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  margin-left: -8px;
  border: 8px solid transparent;
  border-top-color: #fff;
  border-bottom-width: 0;
}

/* 問小白便條：從木牌攤開，貼在左邊牆上（小白和頭上的對話框保持看得到） */
#gacha .gacha-ask {
  position: absolute;
  left: 2.5cqw;
  bottom: 21cqh;
  z-index: 6;
  display: grid;
  gap: 1.3cqh;
  width: min(34cqw, 60cqh);
  max-height: 74cqh;
  padding: 2.8cqh 2.4cqh 1.8cqh;
  border-radius: 3px;
  background:
    repeating-linear-gradient(180deg, transparent 0 calc(2.6cqh - 1px), rgba(102,90,156,.09) calc(2.6cqh - 1px) 2.6cqh),
    #fffdf7;
  box-shadow: 0 1.4cqh 3cqh rgba(19,27,43,.22), 0 0 0 1px rgba(80,60,30,.08);
  color: var(--note-ink);
  rotate: -1deg;
  overflow: auto;
  animation: gacha-ask-in .35s cubic-bezier(.3,1.35,.5,1);
}
#gacha .gacha-ask[hidden] { display: none; }
#gacha .gacha-ask::before {
  content: '';
  position: absolute;
  top: -1.1cqh;
  left: 50%;
  width: 10cqh;
  height: 2.6cqh;
  margin-left: -5cqh;
  background: rgba(184,173,240,.55);
  rotate: 2deg;
}
@keyframes gacha-ask-in { from { opacity: 0; transform: translateY(2cqh) scale(.94); } }
#gacha .gacha-ask-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#gacha .gacha-ask-title { margin: 0; color: var(--note-ink); font: 700 clamp(17px, 3.2cqh, 26px)/1.2 var(--hand); }
#gacha .gacha-ask-close {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(19,27,43,.07);
  color: var(--g-ink);
  font-size: 14px;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
}
#gacha .gacha-ask-close:hover { background: rgba(19,27,43,.13); }
#gacha .gacha-ask-chips { display: flex; flex-wrap: wrap; gap: .8cqh; }
#gacha .gacha-ask-chips button {
  padding: .5cqh 1.3cqh;
  border: 1px solid rgba(102,90,156,.28);
  border-radius: 999px;
  background: #fff;
  color: var(--g-ink);
  font: 400 clamp(12px, 1.85cqh, 15px)/1.45 var(--hand);
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  transition: background .2s, border-color .2s;
}
#gacha .gacha-ask-chips button:hover { border-color: var(--g-violet); background: #f1edf8; }
#gacha .gacha-ask-chips button:disabled { opacity: .5; cursor: default; }
#gacha .gacha-ask-log {
  display: grid;
  gap: .6cqh;
  min-height: 5cqh;
  max-height: 22cqh;
  overflow: auto;
  padding: 1cqh 1.3cqh;
  border-radius: 8px;
  background: rgba(184,173,240,.13);
  color: var(--g-ink);
  font-size: clamp(12.5px, 1.8cqh, 14.5px);
  line-height: 1.6;
}
#gacha .gacha-ask-log:empty { display: none; }
#gacha .gacha-ask-line { display: flex; gap: .7em; margin: 0; }
#gacha .gacha-ask-line b { flex: none; color: var(--g-violet); font-weight: 700; }
#gacha .gacha-ask-line.is-user b { color: #8a8fa8; }
#gacha .gacha-ask-form { display: flex; align-items: flex-end; gap: 1cqh; }
#gacha .gacha-ask-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  max-height: 96px;
  padding: 9px 12px;
  border: 1px solid var(--g-line);
  border-radius: 10px;
  background: #fff;
  color: var(--g-ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  resize: none;
}
#gacha .gacha-ask-form textarea:focus { outline: 2px solid var(--g-violet); outline-offset: 0; border-color: transparent; }
#gacha .gacha-ask-form button {
  flex: none;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: #2b3657;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
}
#gacha .gacha-ask-form button:hover { background: #18203a; }
#gacha .gacha-ask-form button:disabled { opacity: .6; cursor: progress; }
#gacha .gacha-ask-verify:empty { display: none; }
#gacha .gacha-ask-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #8a8fa8; font-size: 12px; }
#gacha .gacha-ask-foot button { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: url('images/cursors/sora-link-select.cur'), pointer; }
/* 請小白吃罐罐：自由贊助，連到「支持小天」頁 */
#gacha .gacha-ask-tip {
  display: flex;
  align-items: center;
  gap: 1.2cqh;
  margin-top: .2cqh;
  padding: 1cqh 1.4cqh;
  border: 1.5px dashed rgba(201,140,70,.55);
  border-radius: 10px;
  background: #fff6e6;
  color: #5a3a1c;
  text-decoration: none;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  transition: background .2s, border-color .2s;
}
#gacha .gacha-ask-tip:hover,
#gacha .gacha-ask-tip:focus-visible { border-color: #c98c46; background: #ffeccc; }
#gacha .gacha-ask-tip:focus-visible { outline: 3px solid var(--g-violet); outline-offset: 2px; }
#gacha .gacha-ask-tip > span:nth-child(2) { display: grid; flex: 1; min-width: 0; gap: .2cqh; }
#gacha .gacha-ask-tip b { font-size: clamp(13px, 2.1cqh, 17px); font-weight: 700; line-height: 1.3; }
#gacha .gacha-ask-tip small { color: #8a6a48; font-size: clamp(11px, 1.55cqh, 13px); line-height: 1.4; }
#gacha .gacha-ask-tip-go { flex: none; font-size: 16px; transition: transform .2s; }
#gacha .gacha-ask-tip:hover .gacha-ask-tip-go { transform: translateX(3px); }
/* 小罐頭：罐身＋拉環 */
#gacha .gacha-ask-tip-can {
  position: relative;
  flex: none;
  width: 4.2cqh;
  height: 3.2cqh;
  min-width: 26px;
  min-height: 20px;
  border-radius: 4px 4px 6px 6px;
  background:
    linear-gradient(180deg, transparent 0 30%, #f0a9b9 30% 70%, transparent 70%),
    linear-gradient(180deg, #e6e9f2, #b9bfd0);
  box-shadow: inset 0 0 0 1px rgba(60,70,100,.35);
}
#gacha .gacha-ask-tip-can::before {
  content: '';
  position: absolute;
  top: -22%;
  left: 18%;
  right: 18%;
  height: 34%;
  border-radius: 50%;
  background: #d5d9e4;
  box-shadow: inset 0 0 0 1px rgba(60,70,100,.35);
}
#gacha .gacha-ask-tip:hover .gacha-ask-tip-can { animation: gacha-can-wiggle .5s ease-in-out; }
@keyframes gacha-can-wiggle { 25% { transform: rotate(-10deg); } 60% { transform: rotate(7deg); } }
#gacha .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@keyframes gacha-say { from { opacity: 0; transform: translateY(6px) scale(.9); } }

/* ── 彈出視窗（便條放大、投幣轉蛋、開獎收據） ── */
#gacha .gacha-dialog {
  width: min(640px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
#gacha .gacha-dialog::backdrop { background: rgba(19,27,43,.55); backdrop-filter: blur(2px); }
#gacha .gacha-dialog[open] { animation: gacha-pop-in .3s cubic-bezier(.3,1.35,.5,1); }
@keyframes gacha-pop-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
#gacha .gacha-dialog-close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--g-night);
  box-shadow: 0 4px 10px rgba(0,0,0,.3);
  color: #fff;
  font-size: 15px;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
}
#gacha .gacha-sheet { max-height: calc(100dvh - 32px); overflow: auto; padding: 26px 28px; border-radius: 10px; background: #fff; }
#gacha .gacha-card-dialog { width: min(980px, calc(100vw - 32px)); }
#gacha .gacha-result-dialog { width: min(520px, calc(100vw - 32px)); }
#gacha .gacha-dialog-title { margin: 0 0 18px; color: var(--g-ink); font-size: 22px; letter-spacing: -.02em; }
#gacha .gacha-card-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 30px; align-items: start; }
#gacha .gacha-card-grid .gacha-h { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 17px; }
#gacha .gacha-card-grid .gacha-step-no {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--g-night);
  color: #fff;
  font: 700 13px/1 'Outfit', sans-serif;
}
#gacha .gacha-result-dialog .gacha-tray { padding: 0; border: 0; }
#gacha .gacha-card-grid .gacha-pay-grid { grid-template-columns: minmax(0, 1fr); }

/* 放大的便條（沿用獎池與規則的版型，換成白報紙配色） */
#gacha .gacha-note-big {
  --g-line: rgba(47,42,37,.2);
  --g-ink: #1f1b17;
  --g-dim: #5d554b;
  position: relative;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 40px 34px 30px;
  border-radius: 2px;
  background:
    radial-gradient(circle at 20% 30%, rgba(120,110,90,.07) 0 1px, transparent 1.5px) 0 0 / 6px 6px,
    radial-gradient(circle at 70% 70%, rgba(255,255,255,.6) 0 1px, transparent 1.6px) 0 0 / 9px 9px,
    linear-gradient(175deg, #fbfaf5 0%, #f3f0e6 70%, #ebe6d8 100%);
  box-shadow: 0 24px 40px -12px rgba(0,0,0,.5);
  color: var(--note-ink);
  font: 400 16px/1.85 var(--hand);
  transform: rotate(-.6deg);
}
#gacha .gacha-note-big::before {
  content: '';
  position: sticky;
  top: -40px;
  display: block;
  width: 120px;
  height: 30px;
  margin: -54px auto 18px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 2px, transparent 2px 7px), rgba(196,214,170,.85);
  clip-path: polygon(0 8%, 4% 0, 8% 10%, 12% 0, 88% 0, 92% 10%, 96% 0, 100% 8%, 100% 92%, 96% 100%, 92% 90%, 88% 100%, 12% 100%, 8% 90%, 4% 100%, 0 92%);
}
#gacha .gacha-note-big[hidden] { display: none; }
#gacha .gacha-note-big h2 { margin: 0 0 12px; color: #3a2614; font-size: 26px; line-height: 1.3; }
#gacha .gacha-note-big h3 { margin: 20px 0 8px; color: #3a2614; font-size: 18px; }
#gacha .gacha-note-big p { margin: 0; }
#gacha .gacha-note-big .gacha-series { border-color: var(--g-line); background: rgba(255,255,255,.18); }
#gacha .gacha-big-steps { display: grid; gap: 10px; margin: 0; padding-left: 1.4em; }
#gacha .gacha-big-steps strong { display: block; color: #3a2614; font-size: 16px; }
#gacha .gacha-rules ul { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: gacha-rule; }
#gacha .gacha-rules li { position: relative; padding-left: 30px; counter-increment: gacha-rule; }
#gacha .gacha-rules li::before {
  content: counter(gacha-rule);
  position: absolute;
  left: 0;
  top: 4px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: rgba(47,42,37,.85);
  color: #f3e3c3;
  font: 700 11px/21px 'Outfit', sans-serif;
  text-align: center;
}
#gacha .gacha-rules strong { color: #1f1b17; }

/* ── 機台細節 ── */
#gacha .gacha-machine-art { display: block; width: 100%; height: auto; overflow: visible; }
#gacha .gacha-plate { font: 700 10.5px/1 'Outfit', sans-serif; letter-spacing: .24em; fill: #4d427c; }
#gacha .gacha-price-tag { font: 700 9px/1 'Outfit', sans-serif; letter-spacing: .12em; fill: var(--g-gold); }
#gacha .gacha-crank,
#gacha .gacha-pile,
#gacha .gacha-coin,
#gacha .gacha-twinkles use { transform-box: fill-box; transform-origin: center; }
#gacha .gacha-crank { transform-origin: 122px 384px; transform-box: view-box; transition: transform .5s cubic-bezier(.3,1.4,.5,1); }
#gacha .gacha-machine:hover .gacha-crank { transform: rotate(-18deg); }
#gacha .gacha-coin { opacity: 0; }
#gacha .gacha-twinkles use { animation: gacha-twinkle 3.2s ease-in-out infinite; }
#gacha .gacha-twinkles use:nth-child(2) { animation-delay: -1.1s; }
#gacha .gacha-twinkles use:nth-child(3) { animation-delay: -2.2s; }

#gacha .gacha-machine.is-spinning .gacha-crank { animation: gacha-crank 1.1s cubic-bezier(.55,0,.35,1) infinite; }
#gacha .gacha-machine.is-spinning .gacha-pile { animation: gacha-shake .28s ease-in-out infinite alternate; }
#gacha .gacha-machine.is-spinning .gacha-coin { animation: gacha-coin .7s ease-in forwards; }

#gacha .gacha-drop-layer { position: absolute; inset: 0; pointer-events: none; }
/* 從出蛋口滾出來的蛋（大小跟著機台縮放；滾動由 gacha.js 的 Web Animations 控制） */
#gacha .gacha-drop {
  position: absolute;
  left: 66.5%;
  top: 87.6%;
  width: 10.5%;
  height: auto;
  aspect-ratio: 1;
  margin: -5.25% 0 0 -5.25%;
}
#gacha .gacha-machine.is-dropping .gacha-pile { animation: gacha-shake .22s ease-in-out infinite alternate; }

@keyframes gacha-crank { to { transform: rotate(360deg); } }
@keyframes gacha-shake {
  0% { transform: translate(-2px, 1px) rotate(-1.5deg); }
  100% { transform: translate(2px, -2px) rotate(1.5deg); }
}
/* 硬幣從上面落下、轉成側面，對準直的投幣口滑進去 */
@keyframes gacha-coin {
  0% { opacity: 0; transform: translateY(-36px); }
  20% { opacity: 1; transform: translateY(-26px); }
  55% { opacity: 1; transform: translateY(-8px) scaleX(.22); }
  85% { opacity: 1; transform: translateY(8px) scale(.2, .9); }
  100% { opacity: 0; transform: translateY(14px) scale(.2, .7); }
}
/* 出蛋口的擋板：蛋滾出來時往外翻 */
#gacha .gacha-flap { transform-box: fill-box; transform-origin: 50% 0; }
#gacha .gacha-flap.is-pushed { animation: gacha-flap .55s cubic-bezier(.3,1.6,.5,1); }
@keyframes gacha-flap { 35% { transform: scaleY(.25) skewX(-8deg); } }
@keyframes gacha-twinkle { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.1); } }

/* ── 扭蛋（HTML 版，用在掉落與開獎卡） ── */
#gacha .gacha-capsule {
  --cap: var(--g-N);
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 6px rgba(19,27,43,.16));
}
#gacha .gacha-drop.gacha-capsule { width: 10.5%; height: auto; }
#gacha .gacha-capsule[data-rarity="R"] { --cap: var(--g-R); }
#gacha .gacha-capsule[data-rarity="SR"] { --cap: var(--g-SR); }
#gacha .gacha-capsule[data-rarity="SSR"] { --cap: var(--g-SSR); }
#gacha .gacha-capsule[data-rarity="UR"] { --cap: var(--g-UR); }
#gacha .gacha-capsule-top,
#gacha .gacha-capsule-bottom { position: absolute; left: 0; right: 0; height: 50%; }
/* 裡面的小史萊貓：上半透明看得到頭，下半被有顏色的殼擋住 */
#gacha .gacha-capsule-slime {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: rgba(255,255,255,.6) no-repeat 50% 0 / 84% auto;
}
#gacha .gacha-capsule-top {
  top: 0;
  border-radius: 999px 999px 0 0;
  background: radial-gradient(ellipse 22% 14% at 30% 30%, #fff 0 60%, transparent 70%), rgba(238,234,252,.22);
  border: 1px solid rgba(19,27,43,.1);
  border-bottom: 0;
  transform-origin: 8% 100%;
  transition: transform .55s cubic-bezier(.3,1.5,.5,1);
}
#gacha .gacha-capsule-bottom {
  bottom: 0;
  border-radius: 0 0 999px 999px;
  background: var(--cap);
  border: 1px solid rgba(19,27,43,.12);
  border-top: 2px solid rgba(19,27,43,.12);
  opacity: .94;
}

/* ── 開獎托盤 ── */
#gacha .gacha-tray {
  padding: 20px 20px 18px;
  border: 1px solid var(--g-line);
  border-radius: 4px;
  background: #fff;
}
#gacha .gacha-tray[hidden] { display: none; }
#gacha .gacha-tray-head h3 { margin: 2px 0 14px; font-size: 20px; letter-spacing: -.02em; color: var(--g-ink); }
#gacha .gacha-prize-cards { display: grid; gap: 10px; }
#gacha .gacha-prize-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--g-line);
  border-radius: 4px;
  background: #fbfbfd;
}
#gacha .gacha-prize-card .gacha-capsule { width: 46px; height: 46px; }
#gacha .gacha-prize-card-body { display: grid; gap: 1px; transition: opacity .4s ease, transform .4s ease; }
#gacha .gacha-prize-card-body strong { font-size: 16px; color: var(--g-ink); line-height: 1.4; }
#gacha .gacha-prize-card-body small { font-size: 12px; color: var(--g-dim); }
#gacha .gacha-prize-card-body .gacha-badge { justify-self: start; }
#gacha .gacha-prize-card.is-sealed .gacha-prize-card-body { opacity: 0; transform: translateX(-8px); }
#gacha .gacha-prize-card.is-sealed .gacha-capsule { animation: gacha-wobble .5s ease-in-out infinite alternate; }
#gacha .gacha-prize-card.is-open .gacha-capsule-top { transform: translate(-3px, -10px) rotate(-38deg); }
#gacha .gacha-prize-card[data-rarity="SSR"].is-open { border-color: var(--g-SSR); background: #fffaf0; }
#gacha .gacha-prize-card[data-rarity="UR"].is-open {
  border-color: transparent;
  background: linear-gradient(#fff, #fff) padding-box, var(--g-UR) border-box;
  border-width: 2px;
}
@keyframes gacha-wobble { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
#gacha .gacha-tray-note { margin: 14px 0 12px; font-size: 13px; line-height: 1.8; color: var(--g-dim); }
#gacha .gacha-receipt { margin: 10px 0 0; font: 500 11px/1 'Outfit', sans-serif; letter-spacing: .12em; color: #8a93a6; }
#gacha .gacha-again {
  padding: 8px 14px;
  border: 1px solid var(--g-line);
  border-radius: 999px;
  background: #fff;
  color: var(--g-ink);
  font: inherit;
  font-size: 13px;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
}
#gacha .gacha-again:hover { border-color: var(--g-violet); color: var(--g-violet); }

#gacha .gacha-h { margin: 0 0 16px; font-size: 19px; letter-spacing: -.02em; color: var(--g-ink); }

#gacha .gacha-pool-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 14px; }
#gacha .gacha-pool-head .gacha-h { margin: 0; }
#gacha .gacha-ev { margin: 0; font-size: 13px; color: var(--g-dim); }
#gacha .gacha-rarity-bar { display: flex; height: 42px; margin-bottom: 18px; border-radius: 4px; overflow: hidden; }
#gacha .gacha-rarity-seg {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 34px;
  background: var(--g-N);
  color: var(--g-night);
  line-height: 1.15;
}
#gacha .gacha-rarity-seg b { font: 800 12px/1.1 'Outfit', sans-serif; letter-spacing: .04em; }
#gacha .gacha-rarity-seg small { font: 500 10.5px/1.1 'Outfit', sans-serif; }
#gacha .gacha-rarity-seg[data-rarity="R"] { background: var(--g-R); }
#gacha .gacha-rarity-seg[data-rarity="SR"] { background: var(--g-SR); }
#gacha .gacha-rarity-seg[data-rarity="SSR"] { background: var(--g-SSR); }
#gacha .gacha-rarity-seg[data-rarity="UR"] { background: var(--g-UR); }
#gacha .gacha-series-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
#gacha .gacha-prizes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
#gacha .gacha-prize:nth-child(2) { border-top: 0; }
#gacha .gacha-series { padding: 16px 16px 10px; border: 1px solid var(--g-line); border-radius: 4px; }
#gacha .gacha-series-head h3 { margin: 0; font-size: 16px; color: var(--g-ink); }
#gacha .gacha-series-head p { margin: 2px 0 8px; font-size: 12.5px; color: var(--g-dim); }
#gacha .gacha-prizes { margin: 0; padding: 0; list-style: none; }
#gacha .gacha-prize {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas: "badge name odds" "badge value odds";
  align-items: center;
  column-gap: 10px;
  padding: 9px 0;
  border-top: 1px dashed var(--g-line);
}
#gacha .gacha-prize:first-child { border-top: 0; }
#gacha .gacha-prize .gacha-badge { grid-area: badge; justify-self: start; }
#gacha .gacha-prize-name { grid-area: name; font-size: 14.5px; font-weight: 600; color: var(--g-ink); line-height: 1.4; }
#gacha .gacha-prize-value { grid-area: value; font-size: 12px; color: #8a93a6; line-height: 1.4; }
#gacha .gacha-prize-odds { grid-area: odds; font: 700 16px/1 'Outfit', sans-serif; color: var(--g-ink); letter-spacing: -.02em; }
#gacha .gacha-badge {
  display: inline-block;
  min-width: 36px;
  padding: 3px 7px;
  border-radius: 3px;
  background: var(--g-N);
  color: var(--g-night);
  font: 800 11px/1.2 'Outfit', sans-serif;
  letter-spacing: .06em;
  text-align: center;
}
#gacha [data-rarity="R"] > .gacha-badge, #gacha [data-rarity="R"] .gacha-badge { background: var(--g-R); }
#gacha [data-rarity="SR"] .gacha-badge { background: var(--g-SR); }
#gacha [data-rarity="SSR"] .gacha-badge { background: var(--g-SSR); }
#gacha [data-rarity="UR"] .gacha-badge { background: var(--g-UR); }
#gacha .gacha-fine { margin: 14px 0 0; font-size: 12.5px; line-height: 1.85; color: var(--g-dim); }

#gacha .gacha-bank { display: grid; gap: 0; margin: 0; border: 1px solid var(--g-line); border-radius: 4px; }
#gacha .gacha-bank > div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 11px 16px; border-top: 1px solid var(--g-line); }
#gacha .gacha-bank > div:first-child { border-top: 0; }
#gacha .gacha-bank dt { font-size: 13px; color: var(--g-dim); }
#gacha .gacha-bank dd { margin: 0; font-size: 15px; font-weight: 600; color: var(--g-ink); overflow-wrap: anywhere; }
#gacha #gachaPayAmount, #gacha #gachaPayTicket { font-family: 'Outfit', sans-serif; letter-spacing: .06em; }

#gacha .gacha-ticket {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label copy" "code copy";
  align-items: center;
  gap: 2px 16px;
  margin-bottom: 16px;
  padding: 16px 20px;
  border: 1.5px dashed var(--g-violet);
  border-radius: 6px;
  background: var(--g-soft);
}
#gacha .gacha-ticket::before,
#gacha .gacha-ticket::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
}
#gacha .gacha-ticket::before { left: -9px; }
#gacha .gacha-ticket::after { right: -9px; }
#gacha .gacha-ticket-label { grid-area: label; font-size: 12.5px; color: var(--g-dim); }
#gacha .gacha-ticket-code { grid-area: code; font: 800 clamp(24px, 3vw, 30px)/1.2 'Outfit', sans-serif; letter-spacing: .08em; color: var(--g-night); user-select: all; }
#gacha .gacha-copy {
  grid-area: copy;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--g-night);
  color: #fff;
  font: inherit;
  font-size: 13.5px;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  white-space: nowrap;
}
#gacha .gacha-copy:hover { background: #2b3657; }
#gacha .gacha-pay-grid { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 16px; align-items: end; }
#gacha .gacha-ecpay {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--g-violet);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
  text-decoration: none;
  transition: background .2s ease, transform .2s ease;
}
#gacha .gacha-ecpay:hover { background: #4d427c; transform: translateY(-1px); }
#gacha .gacha-ticket-input { font-family: 'Outfit', sans-serif; letter-spacing: .08em; text-transform: uppercase; }

/* ── 轉蛋卡 ── */
#gacha .gacha-done { margin: 0; padding: 14px 16px; border-radius: 4px; background: var(--g-soft); color: #4d427c; font-size: 14px; line-height: 1.85; }
#gacha .gacha-done[hidden] { display: none; }
#gacha .gacha-form { display: grid; gap: 16px; }
#gacha .gacha-form[hidden] { display: none; }
#gacha .gacha-field { display: grid; gap: 6px; min-width: 0; }
#gacha .gacha-field .form-label { margin: 0; }
#gacha .gacha-field .form-hint { margin: 0; font-size: 12px; color: var(--g-dim); }
#gacha .gacha-form textarea { resize: vertical; min-height: 64px; }
#gacha .gacha-agree { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 4px; background: #f7f6fb; font-size: 13.5px; line-height: 1.75; color: var(--g-ink); cursor: url('images/cursors/sora-link-select.cur'), pointer; }
#gacha .gacha-agree input { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 4px; accent-color: var(--g-violet); }
/* 漏填提示（gacha.js 的 showFieldTip）：取代瀏覽器自己的泡泡。冒在那一欄底下，那一欄輕輕抖一下 */
#gacha .gacha-field,
#gacha .gacha-agree { position: relative; }
#gacha .gacha-field-tip {
  position: absolute;
  left: 2px;
  top: calc(100% + 10px);
  z-index: 4;
  max-width: min(340px, 100%);
  margin: 0;
  padding: 7px 14px 7px 40px;
  border: 2px solid #e0525a;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 0 rgba(224,82,90,.14), 0 10px 22px rgba(160,40,48,.16);
  color: #8c2b2b;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: .02em;
  cursor: default;
  animation: gacha-tip-pop .35s cubic-bezier(.3,1.5,.5,1) both;
}
#gacha .gacha-field-tip[hidden] { display: none; }
/* 左邊的紅色「!」圓章（CSS 畫的，不用等圖片下載） */
#gacha .gacha-field-tip::after {
  content: '!';
  position: absolute;
  left: 10px;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  border-radius: 50%;
  background: #e0525a;
  box-shadow: 0 2px 0 rgba(140,43,43,.25);
  color: #fff;
  font: 900 13px/20px 'Outfit', Arial, sans-serif;
  text-align: center;
  animation: gacha-tip-bang .9s ease-in-out .35s 2;
}
@keyframes gacha-tip-bang { 0%, 100% { transform: none; } 30% { transform: scale(1.2) rotate(-8deg); } 60% { transform: scale(.95) rotate(4deg); } }
/* 往上指的小尖角 */
#gacha .gacha-field-tip::before {
  content: '';
  position: absolute;
  left: 18px;
  top: -8px;
  width: 12px;
  height: 12px;
  border-top: 2px solid #e0525a;
  border-left: 2px solid #e0525a;
  border-radius: 3px 0 0;
  background: #fff;
  transform: rotate(45deg);
}
/* 勾選框那格的提示往上冒，才不會蓋住底下的「去轉把手」按鈕 */
#gacha .gacha-agree .gacha-field-tip { top: auto; bottom: calc(100% + 10px); left: 4px; }
#gacha .gacha-agree .gacha-field-tip::before { top: auto; bottom: -8px; border: 0; border-right: 2px solid #e0525a; border-bottom: 2px solid #e0525a; border-radius: 0 0 3px; }
#gacha .gacha-field.is-missing .form-control { border-color: #e0525a; box-shadow: 0 0 0 3px rgba(224,82,90,.18); animation: gacha-nudge .42s ease; }
#gacha .gacha-agree.is-missing { box-shadow: inset 0 0 0 2px #e0525a; }
#gacha .gacha-agree.is-missing input { animation: gacha-nudge .42s ease; }
@keyframes gacha-tip-pop { from { opacity: 0; transform: translateY(-6px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes gacha-nudge { 20% { translate: -4px 0; } 40% { translate: 4px 0; } 60% { translate: -2px 0; } 80% { translate: 2px 0; } }
#gacha .gacha-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
#gacha .gacha-lever {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px 10px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--g-night);
  color: #fff;
  font: 600 15px/1.2 inherit;
  font-family: inherit;
  letter-spacing: .04em;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  transition: background .2s ease, transform .2s ease;
}
#gacha .gacha-lever:hover:not(:disabled) { background: #2b3657; transform: translateY(-1px); }
#gacha .gacha-lever:disabled { opacity: .55; cursor: not-allowed; }
#gacha .gacha-lever-knob {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--g-lav);
  transition: transform .5s cubic-bezier(.3,1.4,.5,1);
}
#gacha .gacha-lever-knob::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 4px;
  bottom: 4px;
  width: 6px;
  margin-left: -3px;
  border-radius: 3px;
  background: var(--g-violet);
}
#gacha .gacha-lever:hover:not(:disabled) .gacha-lever-knob { transform: rotate(90deg); }
#gacha .gacha-lever[aria-busy="true"] .gacha-lever-knob { animation: gacha-crank 1.1s linear infinite; }
#gacha .gacha-form.is-confirming .gacha-lever { background: var(--g-plum); animation: gacha-pulse 1.2s ease-in-out infinite; }
@keyframes gacha-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(140,84,113,.45); } 50% { box-shadow: 0 0 0 8px rgba(140,84,113,0); } }
#gacha .gacha-cancel { padding: 9px 4px; border: 0; background: none; color: var(--g-dim); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: url('images/cursors/sora-link-select.cur'), pointer; }
#gacha .gacha-cancel[hidden] { display: none; }
#gacha .gacha-status { margin: 0; min-height: 1.5em; font-size: 13.5px; line-height: 1.7; color: var(--g-dim); }
#gacha .gacha-status[data-tone="warn"] { color: var(--g-plum); font-weight: 600; }
#gacha .gacha-status[data-tone="error"] { color: #b3261e; }

/* ── 測試模式（?gachatest） ── */
#gacha .gacha-test-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 12px 16px;
  border: 1.5px dashed #c48a2c;
  border-radius: 6px;
  background: #fff7e6;
  color: #6b4a12;
  font-size: 13.5px;
}
#gacha .gacha-test-bar strong { padding: 2px 8px; border-radius: 3px; background: #c48a2c; color: #fff; font-size: 12px; letter-spacing: .1em; }
#gacha .gacha-test-bar label { display: inline-flex; align-items: center; gap: 6px; cursor: url('images/cursors/sora-link-select.cur'), pointer; }
#gacha .gacha-test-bar select { padding: 3px 6px; border: 1px solid #d9b77a; border-radius: 4px; background: #fff; font: inherit; }
#gacha .gacha-test-bar small { flex-basis: 100%; color: #8a6a2e; }

/* ── 結果卡上的史萊貓 ── */
#gacha .gacha-card-slime { flex: 0 0 auto; width: 60px; }
#gacha .gacha-card-slime .slime-svg { display: block; width: 100%; height: auto; }
#gacha .gacha-card-slime .slime-fx { display: none; }
#gacha .gacha-card-slogan { margin-top: 3px; font-size: 12.5px; line-height: 1.6; color: var(--g-violet); }

/* ── 開蛋動畫（移到 body 底下，所以不掛在 #gacha 之下） ── */
html.gacha-reveal-open { overflow: hidden; }
.gacha-reveal {
  --rc: #a3abc2;
  --rc-soft: rgba(163,171,194,.35);
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  grid-template-rows: auto auto auto auto;
  justify-items: center;
  align-content: center;
  gap: 6px;
  padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 42%, #2b3657 0%, #131b2b 62%, #0b101c 100%);
  color: #eef0f8;
  font-family: 'Outfit', 'Noto Serif SC', serif;
  overflow: hidden;
  animation: gacha-reveal-in .35s ease both;
}
.gacha-reveal[hidden] { display: none; }
.gacha-reveal[data-rarity="R"] { --rc: #8fb0d9; --rc-soft: rgba(143,176,217,.4); }
.gacha-reveal[data-rarity="SR"] { --rc: #b8adf0; --rc-soft: rgba(184,173,240,.45); }
.gacha-reveal[data-rarity="SSR"] { --rc: #f1c665; --rc-soft: rgba(241,198,101,.5); }
.gacha-reveal[data-rarity="UR"] { --rc: #ffb3d1; --rc-soft: rgba(255,179,209,.5); }
@keyframes gacha-reveal-in { from { opacity: 0; } to { opacity: 1; } }

.gacha-reveal-count { margin: 0; font-size: 13px; letter-spacing: .3em; color: #9aa3c0; }
.gacha-reveal-rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 260%;
  height: 260%;
  margin: -130% 0 0 -130%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, var(--rc-soft) 0deg 7deg, transparent 7deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 0%, rgba(0,0,0,.55) 16%, transparent 40%);
  mask: radial-gradient(circle, #000 0%, rgba(0,0,0,.55) 16%, transparent 40%);
  opacity: 0;
  transition: opacity .6s ease;
  pointer-events: none;
}
.gacha-reveal[data-rarity="UR"] .gacha-reveal-rays {
  background: repeating-conic-gradient(from 0deg, rgba(255,179,199,.5) 0deg 6deg, transparent 6deg 12deg, rgba(159,208,255,.5) 12deg 18deg, transparent 18deg 24deg, rgba(255,226,154,.5) 24deg 30deg, transparent 30deg 36deg);
}
.gacha-reveal:is([data-phase="open"], [data-phase="done"]) .gacha-reveal-rays { opacity: 1; animation: gacha-rays 18s linear infinite; }
.gacha-reveal[data-rarity="N"] .gacha-reveal-rays { opacity: .35; }
@keyframes gacha-rays { to { transform: rotate(360deg); } }

.gacha-reveal-stage { position: relative; width: min(340px, 76vw, 46vh); aspect-ratio: 1; }
.gacha-reveal-glow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--rc) 0%, transparent 65%);
  opacity: 0;
  transform: scale(.6);
}
.gacha-reveal[data-phase="shake"] .gacha-reveal-glow { animation: gacha-glow-build var(--shake, 1.2s) ease-in forwards; }
.gacha-reveal:is([data-phase="open"], [data-phase="done"]) .gacha-reveal-glow { opacity: .55; transform: scale(1.05); transition: opacity .4s, transform .4s; }
@keyframes gacha-glow-build { to { opacity: .8; transform: scale(1); } }

/* 蛋 */
.gacha-reveal-egg { position: absolute; left: 50%; top: 50%; width: 58%; aspect-ratio: 1; margin: -29% 0 0 -29%; opacity: 0; }
.gacha-reveal-egg-top,
.gacha-reveal-egg-bottom { position: absolute; left: 0; right: 0; height: 50%; border: 3px solid #2a2230; }
.gacha-reveal-egg-top {
  top: 0;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  background: radial-gradient(circle at 30% 40%, #fff 0 16%, rgba(255,255,255,.88) 17% 100%);
  transform-origin: 10% 100%;
}
.gacha-reveal-egg-bottom {
  bottom: 0;
  border-top: 6px solid rgba(42,34,48,.3);
  border-radius: 0 0 999px 999px;
  background: var(--rc);
}
.gacha-reveal[data-rarity="UR"] .gacha-reveal-egg-bottom { background: linear-gradient(110deg, #ffb3c7, #ffe29a, #a8e6c9, #9fd0ff, #c7a8ff); }
.gacha-reveal[data-phase="enter"] .gacha-reveal-egg { opacity: 1; animation: gacha-egg-drop .65s cubic-bezier(.3,.7,.4,1) both; }
.gacha-reveal[data-phase="shake"] .gacha-reveal-egg { opacity: 1; animation: gacha-egg-shake .32s ease-in-out infinite; }
.gacha-reveal:is([data-phase="open"], [data-phase="done"]) .gacha-reveal-egg { opacity: 1; }
.gacha-reveal:is([data-phase="open"], [data-phase="done"]) .gacha-reveal-egg-top { animation: gacha-egg-top .7s cubic-bezier(.2,.8,.3,1) forwards; }
.gacha-reveal:is([data-phase="open"], [data-phase="done"]) .gacha-reveal-egg-bottom { animation: gacha-egg-bottom .7s cubic-bezier(.5,0,.8,.5) forwards; }
@keyframes gacha-egg-drop {
  0% { transform: translateY(-70vh) rotate(-30deg); }
  70% { transform: translateY(6%) rotate(8deg) scale(1.04, .94); }
  100% { transform: none; }
}
@keyframes gacha-egg-shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-11deg) translateX(-3%); }
  75% { transform: rotate(11deg) translateX(3%); }
}
@keyframes gacha-egg-top { to { transform: translate(-70%, -160%) rotate(-75deg); opacity: 0; } }
@keyframes gacha-egg-bottom { to { transform: translateY(140%) rotate(12deg); opacity: 0; } }

/* 光爆與彩紙 */
.gacha-reveal-burst { position: absolute; inset: 0; pointer-events: none; }
.gacha-reveal-burst::before,
.gacha-reveal-burst::after {
  content: '';
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  border: 3px solid var(--rc);
  opacity: 0;
}
.gacha-reveal:is([data-phase="open"]) .gacha-reveal-burst::before { animation: gacha-ring .8s ease-out forwards; }
.gacha-reveal:is([data-phase="open"]) .gacha-reveal-burst::after { animation: gacha-ring .8s .15s ease-out forwards; }
@keyframes gacha-ring { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(1.7); } }
.gacha-confetti {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 2px;
  background: var(--c, var(--rc));
  opacity: 0;
  animation: gacha-confetti 1.1s var(--delay, 0s) cubic-bezier(.2,.8,.3,1) forwards;
}
.gacha-confetti.is-star { border-radius: 0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); width: 16px; height: 16px; margin: -8px 0 0 -8px; }
@keyframes gacha-confetti {
  0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(.6); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--d) * -1)) rotate(220deg) scale(1); }
}

/* 史萊貓：Q 彈果凍動畫。.slime-jelly 裡可能是小天畫的圖（.slime-art）或向量暫代（.slime-svg）。
   圖的腳底大約在畫布高度 92% 的地方，所以變形的支點設在那裡，壓扁時腳底不會浮起來。 */
.gacha-reveal-slime { position: absolute; left: 50%; bottom: 4%; width: 88%; margin-left: -44%; opacity: 0; }
.gacha-reveal-slime::before {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  top: 88%;
  height: 8%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0,0,0,.42), transparent);
  transform: scale(0);
}
.slime-jelly { position: relative; transform-origin: 50% 92%; will-change: transform; }
.slime-jelly .slime-svg { display: block; width: 100%; height: auto; overflow: visible; -webkit-user-select: none; user-select: none; }
.gacha-reveal .slime-shadow { display: none; }
.gacha-reveal-egg, .gacha-reveal-glow, .gacha-reveal-rays { pointer-events: none; }

/* ── 分層史萊貓（gacha-slime.js 的 doll）：1000×1000 畫布對齊的圖層疊在一起 ──
   身體白底換色：.slime-tint 用身體的形狀當遮罩、正片疊底（白×色＝色，黑線稿維持黑）。
   陰沉臉 face_02 一樣用身體裁切後正片疊底。isolation 讓疊底只跟史萊貓自己混，不會染到背景。 */
.slime-doll { position: relative; width: 100%; aspect-ratio: 1; isolation: isolate; -webkit-user-select: none; user-select: none; }
.slime-doll .slime-l { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; margin: 0; padding: 0; border: 0; pointer-events: none; }
.slime-doll img.slime-l[hidden] { display: none; }
.slime-doll :is(.slime-tint, .slime-gloom, .slime-shine) {
  -webkit-mask: var(--body) 0 0 / 100% 100% no-repeat;
  mask: var(--body) 0 0 / 100% 100% no-repeat;
}
.slime-doll .slime-tint { mix-blend-mode: multiply; background: radial-gradient(ellipse 58% 52% at 44% 50%, var(--t-light) 0%, var(--t-base) 55%, var(--t-dark) 100%); }
.slime-doll.is-rainbow .slime-tint {
  background: linear-gradient(115deg, #ffc4d6, #ffe7a8, #c4efd9, #bfe0ff, #dccaff, #ffc4d6) 0 0 / 300% 100%;
  animation: slime-rainbow 6s linear infinite;
}
@keyframes slime-rainbow { to { background-position: 300% 0; } }
.slime-doll .slime-gloom { background: url('images/gacha/99-slimecat_face_02.png') 0 0 / 100% 100% no-repeat; mix-blend-mode: multiply; opacity: 0; transition: opacity .45s ease; }
.slime-doll.show-gloom .slime-gloom { opacity: 1; }
/* 果凍的亮面反光 */
.slime-doll .slime-shine {
  background:
    radial-gradient(ellipse 7% 4.5% at 31% 52%, rgba(255,255,255,.95), rgba(255,255,255,0)),
    radial-gradient(ellipse 3% 2.2% at 37% 46%, rgba(255,255,255,.9), rgba(255,255,255,0)),
    radial-gradient(ellipse 40% 9% at 52% 92%, rgba(40,30,60,.12), rgba(40,30,60,0));
}
.slime-doll :is(.slime-blush, .slime-fx-tearR, .slime-fx-tearL, .slime-fx-sweat, .slime-fx-anger) { opacity: 0; transition: opacity .3s ease; }
.slime-doll.show-blush .slime-blush,
.slime-doll.show-tearR .slime-fx-tearR,
.slime-doll.show-tearL .slime-fx-tearL,
.slime-doll.show-sweat .slime-fx-sweat,
.slime-doll.show-anger .slime-fx-anger { opacity: 1; }
.slime-doll.show-anger .slime-fx-anger { transform-origin: 31.5% 39.6%; animation: slime-anger .9s ease-in-out infinite; }
.slime-doll.show-sweat .slime-fx-sweat { animation: slime-sweat 1.8s ease-in-out infinite; }
.slime-doll.show-tearR .slime-fx-tearR { transform-origin: 65.6% 62%; animation: slime-tear 1.1s ease-in-out infinite alternate; }
.slime-doll.show-tearL .slime-fx-tearL { transform-origin: 34% 62%; animation: slime-tear 1.1s ease-in-out -.5s infinite alternate; }
@keyframes slime-anger { 50% { transform: scale(1.18); } }
@keyframes slime-sweat { 0%, 100% { transform: translateY(0); } 60% { transform: translateY(1.6%); } }
@keyframes slime-tear { from { transform: scaleY(.85); } to { transform: scaleY(1.12); } }
/* 眼睛染色（星星眼、小白原形的琥珀眼）：眼睛圖當遮罩、正片疊底，白色眼珠變色、黑框不變 */
.slime-doll .slime-eye-tint { display: none; -webkit-mask: var(--eye) 0 0 / 100% 100% no-repeat; mask: var(--eye) 0 0 / 100% 100% no-repeat; background: var(--eye-tint); mix-blend-mode: multiply; }
.slime-doll.has-eye-tint .slime-eye-tint { display: block; }
.slime-doll.is-blinking .slime-eye-tint { display: none; }

/* 三種動作：hop 原地跳、squish 壓扁扁、jelly Q 彈晃動（.is-alive 或開蛋完成後才動） */
.slime-jelly.is-alive:not(.is-poked)[data-motion="hop"],
.gacha-reveal[data-phase="done"] .slime-jelly:not(.is-poked)[data-motion="hop"] { animation: slime-m-hop 1.9s infinite; }
.slime-jelly.is-alive:not(.is-poked)[data-motion="squish"],
.gacha-reveal[data-phase="done"] .slime-jelly:not(.is-poked)[data-motion="squish"] { animation: slime-m-squish 3.4s infinite; }
.slime-jelly.is-alive:not(.is-poked)[data-motion="jelly"],
.gacha-reveal[data-phase="done"] .slime-jelly:not(.is-poked)[data-motion="jelly"] { animation: slime-m-jelly 2.6s ease-in-out infinite; }
.gacha-reveal[data-phase="done"] .gacha-reveal-slime:has(.slime-jelly[data-motion="hop"])::before { animation: slime-m-hop-shadow 1.9s infinite; }
@keyframes slime-m-hop {
  0%, 46%, 100% { transform: none; animation-timing-function: ease-in-out; }
  10% { transform: scale(1.03, .97); }
  22% { transform: scale(1.18, .8); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  40% { transform: translateY(-22%) scale(.88, 1.14); animation-timing-function: cubic-bezier(.6, 0, .8, .4); }
  58% { transform: translateY(0) scale(1.22, .78); animation-timing-function: ease-out; }
  70% { transform: scale(.94, 1.07); }
  82% { transform: scale(1.04, .97); }
}
@keyframes slime-m-hop-shadow { 0%, 100% { transform: none; } 22% { transform: scale(1.15, 1); } 40% { transform: scale(.62); } 58% { transform: scale(1.2, 1); } }
@keyframes slime-m-squish {
  0%, 100% { transform: none; }
  30% { transform: scale(1.32, .62); animation-timing-function: ease-in; }
  48% { transform: scale(1.34, .6); animation-timing-function: cubic-bezier(.2, .9, .3, 1.4); }
  58% { transform: translateY(-6%) scale(.86, 1.16); }
  68% { transform: scale(1.1, .9); }
  78% { transform: scale(.97, 1.03); }
  88% { transform: scale(1.01, .99); }
}
@keyframes slime-m-jelly {
  0%, 100% { transform: scale(1, 1) skewX(0); }
  20% { transform: scale(1.07, .94) skewX(-4deg); }
  40% { transform: scale(.95, 1.06) skewX(3deg); }
  60% { transform: scale(1.04, .97) skewX(-2deg); }
  80% { transform: scale(.99, 1.01) skewX(1deg); }
}

.gacha-reveal:is([data-phase="open"], [data-phase="done"]) .gacha-reveal-slime { opacity: 1; }
.gacha-reveal[data-phase="open"] .slime-jelly { animation: slime-pop 1.15s .1s linear both; }
.gacha-reveal[data-phase="open"] .gacha-reveal-slime::before { animation: slime-pop-shadow 1.15s .1s linear both; }
.gacha-reveal[data-phase="done"] .gacha-reveal-slime { cursor: url('images/cursors/sora-link-select.cur'), pointer; }
.gacha-reveal[data-phase="done"] .slime-jelly { animation: slime-idle 3.6s ease-in-out infinite; }
.gacha-reveal[data-phase="done"] .gacha-reveal-slime::before { transform: none; animation: slime-idle-shadow 3.6s ease-in-out infinite; }
.gacha-reveal .slime-fx { opacity: 0; }
.gacha-reveal[data-phase="done"] .slime-fx { opacity: 1; transition: opacity .3s; animation: gacha-fx 1.6s ease-in-out infinite; }
/* 戳一下：蓋過待機動畫，彈完 JS 會移除 class 回到待機 */
.slime-jelly.is-poked,
.gacha-reveal[data-phase="done"] .slime-jelly.is-poked { animation: slime-poke .75s ease-out; }
#gacha .gacha-card-slime { cursor: url('images/cursors/sora-link-select.cur'), pointer; }

/* 從蛋裡噴出：拉長往上 → 頂點變圓 → 落地壓扁 → 小回彈 → 果凍抖動收尾 */
@keyframes slime-pop {
  0%   { opacity: 0; transform: translateY(40%) scale(.3, .3); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  20%  { opacity: 1; transform: translateY(-30%) scale(.78, 1.26); animation-timing-function: cubic-bezier(.3, 0, .7, .4); }
  36%  { transform: translateY(-38%) scale(1.02, .98); animation-timing-function: cubic-bezier(.5, 0, .9, .5); }
  50%  { transform: translateY(0) scale(1.32, .7); animation-timing-function: cubic-bezier(.2, .8, .4, 1); }
  62%  { transform: translateY(-9%) scale(.84, 1.18); animation-timing-function: ease-in; }
  73%  { transform: translateY(0) scale(1.16, .86); animation-timing-function: ease-out; }
  83%  { transform: scale(.94, 1.07); }
  91%  { transform: scale(1.04, .97); }
  100% { opacity: 1; transform: none; }
}
@keyframes slime-pop-shadow {
  0% { transform: scale(0); }
  20% { transform: scale(.5); }
  36% { transform: scale(.42); }
  50% { transform: scale(1.3, 1); }
  62% { transform: scale(.8); }
  73% { transform: scale(1.12, 1); }
  100% { transform: none; }
}
/* 待機：呼吸般的果凍晃動，每輪最後蹲一下、小跳一下 */
@keyframes slime-idle {
  0%, 48%, 100% { transform: scale(1, 1); }
  12% { transform: scale(1.03, .97); }
  24% { transform: scale(.985, 1.02); }
  36% { transform: scale(1.02, .98); }
  60% { transform: scale(1.14, .86); animation-timing-function: cubic-bezier(.3, 0, .6, 1); }
  68% { transform: translateY(-14%) scale(.9, 1.12); animation-timing-function: cubic-bezier(.4, 0, .8, .6); }
  76% { transform: translateY(0) scale(1.16, .85); }
  83% { transform: scale(.95, 1.06); }
  90% { transform: scale(1.03, .98); }
}
@keyframes slime-idle-shadow {
  0%, 48%, 100% { transform: none; }
  60% { transform: scale(1.12, 1); }
  68% { transform: scale(.72); }
  76% { transform: scale(1.14, 1); }
}
@keyframes slime-poke {
  0%   { transform: scale(1, 1); }
  12%  { transform: scale(1.24, .76); }
  28%  { transform: translateY(-6%) scale(.82, 1.2) rotate(-3deg); }
  44%  { transform: translateY(0) scale(1.12, .9) rotate(2deg); }
  58%  { transform: scale(.94, 1.07) rotate(-1deg); }
  72%  { transform: scale(1.04, .97); }
  86%  { transform: scale(.99, 1.01); }
  100% { transform: none; }
}
@keyframes gacha-fx { 50% { transform: translateY(-4px); } }

/* 文字：史萊貓的對話框（尾巴朝上指著史萊貓）＋一張半透明的獎品卡 */
.gacha-reveal-info {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(440px, 100%);
  min-height: 150px;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .45s ease, transform .45s ease;
}
.gacha-reveal[data-phase="done"] .gacha-reveal-info { opacity: 1; transform: none; }
.gacha-reveal-say {
  position: relative;
  max-width: 100%;
  margin: 0;
  padding: 10px 18px 11px;
  border-radius: 18px;
  background: #fffdf8;
  box-shadow: 0 0 0 3px var(--rc-soft), 0 10px 24px rgba(0,0,0,.28);
  color: #2a2230;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.55;
  text-wrap: balance;
}
.gacha-reveal-say::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 16px;
  height: 11px;
  margin-left: -8px;
  background: #fffdf8;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.gacha-reveal-who {
  position: absolute;
  left: 14px;
  top: 0;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--rc);
  color: #131b2b;
  font: 800 11px/1.4 'Outfit', 'Noto Serif SC', sans-serif;
  letter-spacing: .08em;
  transform: translateY(-62%);
  white-space: nowrap;
}
.gacha-reveal[data-rarity="UR"] .gacha-reveal-who { background: linear-gradient(120deg, #f0a9b9, #b8adf0, #9fd3e6); }
.gacha-reveal[data-phase="done"] .gacha-reveal-say { animation: gacha-say-pop .5s .15s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes gacha-say-pop { from { opacity: 0; transform: translateY(8px) scale(.8); } }
.gacha-reveal-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 100%;
  padding: 14px 22px 16px;
  border: 1px solid var(--rc-soft);
  border-radius: 20px;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--rc-soft), transparent 60%),
    rgba(255,255,255,.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 14px 30px rgba(0,0,0,.25);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.gacha-reveal-tags { display: flex; align-items: center; gap: 8px; }
.gacha-reveal-badge {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--rc);
  color: #131b2b;
  font: 800 13px/1.3 'Outfit', sans-serif;
  letter-spacing: .12em;
  box-shadow: 0 0 14px var(--rc-soft);
}
.gacha-reveal[data-rarity="UR"] .gacha-reveal-badge { background: linear-gradient(120deg, #f0a9b9, #b8adf0, #9fd3e6); }
.gacha-reveal-stars { color: var(--rc); font-size: 14px; letter-spacing: .14em; text-shadow: 0 0 8px var(--rc-soft); }
.gacha-reveal[data-phase="done"] .gacha-reveal-stars { animation: gacha-stars 2.4s ease-in-out infinite; }
@keyframes gacha-stars { 50% { opacity: .6; } }
.gacha-reveal-info h3 { margin: 6px 0 0; font-size: clamp(24px, 6vw, 32px); line-height: 1.25; letter-spacing: .02em; color: #fff; text-shadow: 0 2px 16px var(--rc-soft); }
.gacha-reveal-series { margin: 2px 0 0; font-size: 13px; letter-spacing: .06em; color: #aeb5cf; }
.gacha-reveal-slogan {
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 100%;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(255,255,255,.18);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: .04em;
  color: var(--rc);
}
.gacha-reveal-slip {
  padding: 1px 10px 2px;
  border: 1px solid var(--rc-soft);
  border-radius: 4px;
  color: #cfd4e6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3em;
  text-indent: .3em;
}
.gacha-reveal-slip::before { content: '🍀 '; letter-spacing: 0; }
.gacha-reveal-actions { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px; min-height: 46px; }
.gacha-reveal-next {
  padding: 11px 30px;
  border: 0;
  border-radius: 999px;
  background: var(--rc);
  color: #131b2b;
  font: 700 15px/1.2 inherit;
  font-family: inherit;
  letter-spacing: .06em;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .2s ease;
}
.gacha-reveal[data-rarity="UR"] .gacha-reveal-next { background: linear-gradient(120deg, #f0a9b9, #b8adf0, #9fd3e6); }
.gacha-reveal[data-phase="done"] .gacha-reveal-next { opacity: 1; pointer-events: auto; }
.gacha-reveal-next:hover { transform: translateY(-1px); }
.gacha-reveal-skip { padding: 11px 4px; border: 0; background: none; color: #9aa3c0; font: inherit; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; cursor: url('images/cursors/sora-link-select.cur'), pointer; }
.gacha-reveal-skip[hidden] { display: none; }

@media (max-height: 640px) {
  .gacha-reveal-stage { width: min(220px, 60vw); }
  .gacha-reveal-info { min-height: 0; gap: 8px; }
  .gacha-reveal-card { padding: 10px 16px 12px; }
  .gacha-reveal-slogan { margin-top: 6px; padding-top: 8px; }
}

/* ── 窄螢幕：轉蛋屋改成直式（招牌 → 一排便條 → 機台＋老闆 → 櫃台），可以捲動 ── */
@media (max-width: 1000px) {
  #gacha .gacha-shop {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "sign sign" "ask ask" "machine boss" "counter counter" "desk desk" "notes notes" "menu menu";
    align-items: end;
    gap: 16px 6px;
    height: auto;
    padding: 30px 14px 22px;
    container-type: normal;
  }
  #gacha .gacha-sign { grid-area: sign; position: relative; left: auto; top: auto; justify-self: center; transform: rotate(-1deg); padding: 8px 22px 10px; font-size: 26px; gap: 3px; }
  #gacha .gacha-sign small { font-size: 10px; }
  #gacha .gacha-sign::before, #gacha .gacha-sign::after { height: 30px; }
  /* 手機：轉蛋機放最上面，便條和機率木牌排在櫃台下面 */
  #gacha .gacha-wall-notes { grid-area: notes; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding-top: 18px; }
  #gacha .gacha-note-tab { top: -12px; right: 4px; font-size: 12px; }
  #gacha .gacha-menu { grid-area: menu; position: relative; right: auto; top: auto; width: 100%; }
  #gacha .gacha-menu-rail { padding: 6px 0 7px; font-size: 14px; }
  #gacha .gacha-menu-tags { gap: 8px; padding: 0 10px; }
  #gacha .gacha-tag { --drop: 8px; gap: 4px; padding: 13px 2px 8px; }
  #gacha .gacha-tag-name { font-size: 14px; }
  #gacha .gacha-tag-odds { font-size: 12px; }
  #gacha .gacha-tag-rarity { font-size: 10px; }
  #gacha .gacha-open-sign { left: 10px; padding: 6px 10px 7px; }
  #gacha .gacha-open-word { font-size: 15px; }
  /* 手機：營業木牌的小字疊成兩行、說明木牌靠右，兩塊才不會互相蓋住 */
  #gacha .gacha-open-sub { display: grid; justify-items: center; gap: 3px; font-size: 12px; }
  #gacha .gacha-counter-front { justify-content: flex-end; padding-right: 12px; }
  #gacha .gacha-note { position: relative; left: auto; right: auto; top: auto; width: auto; gap: 6px; padding: 18px 10px 12px; font-size: 13px; }
  #gacha .gacha-note::before { top: -9px; width: 54px; height: 16px; margin-left: -27px; }
  #gacha .gacha-note::after { width: 16px; height: 16px; }
  #gacha .gacha-note-title { font-size: 15px; }
  #gacha .gacha-note-text { display: none; }
  #gacha .gacha-note-more { justify-self: start; font-size: 12px; white-space: nowrap; letter-spacing: 0; }
  #gacha .gacha-machine { grid-area: machine; position: relative; left: auto; bottom: auto; justify-self: center; width: min(100%, 270px); height: auto; margin-bottom: -16px; transform: none; }
  #gacha .gacha-boss { grid-area: boss; position: relative; right: auto; bottom: auto; width: min(38vw, 180px); margin-bottom: -30px; }
  #gacha .gacha-ask-sign { left: auto; right: -8px; bottom: 3px; width: 50px; padding-bottom: 14px; }
  #gacha .gacha-ask-sign::before, #gacha .gacha-ask-sign::after { width: 4px; height: 18px; }
  #gacha .gacha-ask-sign-board { padding: 6px 0 7px; border-radius: 7px; font-size: 13px; }
  #gacha .gacha-ask-sign-board::after { top: -9px; right: -7px; width: 17px; height: 17px; font-size: 11px; line-height: 17px; }
  #gacha .gacha-ask { grid-area: ask; position: relative; left: auto; bottom: auto; width: auto; max-height: none; gap: 10px; padding: 22px 16px 14px; rotate: none; overflow: visible; }
  #gacha .gacha-ask::before { top: -9px; width: 64px; height: 18px; margin-left: -32px; }
  #gacha .gacha-ask-chips { gap: 6px; }
  #gacha .gacha-ask-chips button { padding: 4px 10px; font-size: 13.5px; }
  #gacha .gacha-ask-log { max-height: 160px; padding: 8px 10px; font-size: 13.5px; }
  #gacha .gacha-ask-form textarea { font-size: 16px; }
  #gacha .gacha-boss-say { left: auto; right: 0; bottom: calc(100% + 6px); translate: none; max-width: min(62vw, 240px); padding: 7px 11px; font-size: 13px; }
  #gacha .gacha-boss-say::after { left: auto; right: 30%; margin-left: 0; }
  #gacha .gacha-counter { grid-area: counter; position: relative; height: 100px; margin: 0 -14px; }
  #gacha .gacha-counter::before { height: 14px; }
  #gacha .gacha-counter-front { top: 14px; }
  #gacha .gacha-board { flex-direction: column; gap: 2px; padding: 8px 22px; font-size: 13px; }
  /* 手機：小史萊貓住在櫃台下面的一塊小木架上 */
  #gacha .gacha-desk { grid-area: desk; position: relative; left: auto; bottom: auto; width: auto; height: 64px; margin: 4px 4px 0; }
  #gacha .gacha-desk::after { content: ''; position: absolute; left: -6px; right: -6px; bottom: -8px; height: 10px; border-radius: 4px; background: linear-gradient(180deg, #d3a677, #a87449); box-shadow: 0 3px 4px rgba(60,35,10,.25); }
  #gacha .gacha-desk-slime { --size: 42px; }
  #gacha .gacha-note:hover, #gacha .gacha-note:focus-visible { --k: 14px; }
  #gacha .gacha-receipt-btn { left: 6px; bottom: 100px; width: 56px; }
  #gacha .gacha-card-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  #gacha .gacha-sheet { padding: 22px 18px; }
  #gacha .gacha-note-big { padding: 28px 20px 22px; font-size: 14px; }
  #gacha .gacha-dialog-close { top: -10px; right: -6px; }
}
@media (max-width: 360px) {
  /* 小手機的便條比較窄：「點我看…」改小一號、拿掉放大鏡，一行放得下，不會被紙邊切掉 */
  #gacha .gacha-note-more { font-size: 11px; }
  #gacha .gacha-note-more::before { content: none; }
}
@media (max-width: 760px) {
  #gacha .gacha-prizes { grid-template-columns: minmax(0, 1fr); }
  #gacha .gacha-prize:nth-child(2) { border-top: 1px dashed var(--g-line); }
  #gacha .gacha-pay-grid { grid-template-columns: minmax(0, 1fr); }
  #gacha .gacha-ticket { grid-template-columns: minmax(0, 1fr); grid-template-areas: "label" "code" "copy"; gap: 4px; }
  #gacha .gacha-copy { justify-self: start; margin-top: 8px; }
  #gacha .gacha-rarity-seg small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #gacha *, #gacha *::before, #gacha *::after,
  .gacha-reveal, .gacha-reveal *, .gacha-reveal *::before, .gacha-reveal *::after { animation: none !important; transition: none !important; }
  .gacha-reveal:is([data-phase="open"], [data-phase="done"]) .gacha-reveal-egg { opacity: 0; }
}

/* 開獎沒成功的小框（gacha.js 的 showSpinNote）：白底柔和粉紅框（取自道歉圖的臉紅色，是「不好意思」的語氣，
   跟漏填提示的紅框區隔開），形狀跟網站選單載入中的小框一樣。
   擺在轉蛋屋正中央、玻璃球前面。用 bottom 定位：下緣固定在把手「轉我！」標籤上方（約店面高度的 42%），
   小框往上長，不管視窗多寬都不會蓋住「轉我！」 */
#gacha .gacha-spin-note {
  position: absolute;
  left: 50%;
  bottom: 42%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: min(380px, 86cqw);
  /* 店面矮（視窗窄）時，小框的留白、圖和字一起跟著店面高度（cqh）縮，才不會長出店面、蓋住招牌 */
  padding: clamp(6px, 1.4cqh, 12px) 28px clamp(12px, 2.6cqh, 22px);
  border: 2.5px solid #f2a9c4;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 0 0 5px #fdeef4, 0 8px 0 5px rgba(225,146,177,.16), 0 22px 40px rgba(180,90,130,.18);
  color: #4a3f74;
  text-align: center;
  translate: -50% 0;
  animation: gacha-spin-note-pop .4s cubic-bezier(.3,1.5,.5,1) both;
}
#gacha .gacha-spin-note[hidden] { display: none; }
#gacha .gacha-spin-note::before,
#gacha .gacha-spin-note::after { position: absolute; font: 400 13px/1 sans-serif; pointer-events: none; animation: gacha-spin-note-twinkle 2.4s ease-in-out infinite; }
#gacha .gacha-spin-note::before { content: '♡'; left: 22px; top: 20px; color: #f2a9c4; }
#gacha .gacha-spin-note::after { content: '✦'; right: 24px; top: 34px; font-size: 10px; color: #f7c3d6; animation-delay: -1.2s; }
/* 道歉圖（images/99-sorry.webp，跟網站選單載入失敗時同一張）：不加框和底，下緣淡出（手臂不會被硬切）。
   動作是「鞠躬」：往下壓扁再 Q 彈回來，停一下再來一次 */
#gacha .gacha-spin-note-art {
  display: block;
  width: clamp(72px, 13cqh, 112px);
  height: clamp(72px, 13cqh, 112px);
  margin: 4px 0 0;
  -webkit-mask-image: linear-gradient(180deg, #000 80%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 80%, transparent 100%);
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  transform-origin: 50% 100%;
  animation: gacha-spin-note-sorry 2.2s ease-in-out infinite;
}
/* 標題：偏紅但不刺眼；「抱歉！」自己一行（gacha.js 在標題裡放了換行） */
#gacha .gacha-spin-note-title { margin: 6px 0 0; color: #c8505b; font-size: clamp(15px, 2.1cqh, 18px); font-weight: 700; letter-spacing: .04em; line-height: 1.5; white-space: pre-line; }
/* 說明每句一行（gacha.js 每句包一個 span），句子裡再依「，」「；」切成不拆開的小段（inline-block）：
   一句太長時只會在標點後面折行；小段本身比整行還寬時（很窄的手機）才在段內折 */
#gacha .gacha-spin-note-text { margin: clamp(4px, 1cqh, 8px) 0 clamp(8px, 1.6cqh, 14px); color: #6d5f72; font-size: clamp(12px, 1.52cqh, 13px); line-height: 1.65; }
#gacha .gacha-spin-note-text > span { display: block; text-wrap: balance; }
#gacha .gacha-spin-note-part { display: inline-block; max-width: 100%; }
#gacha .gacha-spin-note-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
#gacha .gacha-spin-note-actions button {
  padding: 7px 22px 8px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ef7d86, #da5562);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 4px 0 #b03a47, 0 7px 12px rgba(176,58,71,.25);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: url('images/cursors/sora-link-select.cur'), pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
#gacha .gacha-spin-note-actions .gacha-spin-note-edit { background: #fff; box-shadow: inset 0 0 0 2px #f1aab1, 0 4px 0 #f6d2d6, 0 7px 12px rgba(176,58,71,.12); color: #c8505b; }
#gacha .gacha-spin-note-actions button:hover { transform: translateY(-2px); }
#gacha .gacha-spin-note-actions button:active { transform: translateY(2px); }
#gacha .gacha-spin-note-actions button:focus-visible { outline: 3px dashed #e57a84; outline-offset: 3px; }
/* 窄螢幕的店面是格線排版（小白在機台右邊、櫃台在下面一列）：小框蓋在櫃台那一格往下，小白、對話框和把手都看得到 */
@media (max-width: 1000px) {
  #gacha .gacha-spin-note { grid-area: counter; left: 50%; top: 8px; bottom: auto; z-index: 6; width: min(360px, calc(100% - 20px)); padding: 12px 22px 22px; translate: -50% 0; }
  #gacha .gacha-spin-note-title { font-size: 15px; letter-spacing: .02em; }
}
@keyframes gacha-spin-note-pop { from { opacity: 0; transform: translateY(4%) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes gacha-spin-note-twinkle { 0%, 100% { opacity: .35; transform: scale(.75); } 50% { opacity: 1; transform: scale(1.1) rotate(15deg); } }
@keyframes gacha-spin-note-sorry {
  0%, 50%, 100% { transform: none; }
  9% { transform: scale(1.1, .86); }
  19% { transform: scale(.94, 1.07); }
  28% { transform: scale(1.04, .96); }
  37% { transform: scale(.99, 1.01); }
}

/* ===== 2026-10-25 手機轉蛋頁（只在 760px 以下） =====
   拿掉小史萊貓木架；「怎麼玩／規則」便條縮小貼在櫃台上、OPEN 木牌右邊，操作說明木牌改一行放櫃台下緣；
   本店機率縮小放小白頭頂（點了照樣打開大的）；問問牌移到小白左邊，才不會擋到桌上的罐罐；轉蛋機往下站穩在櫃台上 */
@media (max-width: 760px) {
  #gacha .gacha-shop {
    grid-template-areas: "sign sign" "ask ask" "machine menu" "machine boss" "counter counter";
    grid-template-rows: auto auto auto auto auto;
  }
  #gacha .gacha-desk { display: none; }
  #gacha .gacha-machine { margin-bottom: -28px; }
  #gacha .gacha-menu { grid-area: menu; align-self: end; justify-self: center; width: 330px; zoom: .44; margin-bottom: 24px; }
  #gacha .gacha-boss { width: min(40vw, 170px); }
  #gacha .gacha-ask-sign { left: -22px; right: auto; width: 40px; padding-bottom: 11px; }
  #gacha .gacha-ask-sign::before, #gacha .gacha-ask-sign::after { width: 3px; height: 14px; }
  #gacha .gacha-ask-sign-board { padding: 4px 0 5px; border-radius: 6px; font-size: 11px; }
  #gacha .gacha-ask-sign-board::after { top: -8px; right: -6px; width: 14px; height: 14px; font-size: 9px; line-height: 14px; }
  #gacha .gacha-counter { height: 190px; }
  #gacha .gacha-counter-front { align-items: flex-end; justify-content: center; padding: 0 12px 14px; }
  #gacha .gacha-board { flex-direction: row; gap: 12px; padding: 8px 34px; font-size: 12.5px; }
  #gacha .gacha-receipt-btn { bottom: 100%; }
  #gacha .gacha-wall-notes {
    grid-area: counter; align-self: start; justify-self: end; position: relative; z-index: 5;
    width: 330px; margin: 42px 18px 0 0; padding-top: 0; gap: 18px; zoom: .62;
  }
}
@media (max-width: 360px) {
  #gacha .gacha-wall-notes { grid-template-columns: repeat(2, 78px); gap: 8px; margin-right: 10px; }
  #gacha .gacha-note-title { font-size: 11px; }
  #gacha .gacha-note-more { font-size: 9px; }
  #gacha .gacha-menu { zoom: .36; }
  #gacha .gacha-board { padding: 7px 28px; gap: 8px; font-size: 12px; }
}

/* ===== 2026-10-26 手機轉蛋頁修正 =====
   便條不再用 zoom 縮小（iPhone 的字會比框大、被切掉），改成直接給小尺寸，「點我看…」可以換行；
   本店機率往下一點，稀有度字移到釘孔下面、白邊改用 text-shadow（iPhone 畫得出來） */
@media (max-width: 760px) {
  #gacha .gacha-wall-notes { zoom: 1; width: auto; grid-template-columns: repeat(2, 96px); gap: 10px; margin: 32px 12px 0 0; }
  #gacha .gacha-note { padding: 0; gap: 4px; font-size: 10px; }
  #gacha .gacha-note-paper { padding: 12px 7px 7px; gap: 4px; }
  #gacha .gacha-note::before { top: -6px; width: 36px; height: 10px; margin-left: -18px; }
  #gacha .gacha-note-tab { top: -11px; right: -2px; font: 400 9px/1 var(--hand); padding: 3px 5px; gap: 4px; }
  #gacha .gacha-note-title { font-size: 12.5px; }
  #gacha .gacha-note-more { justify-self: start; font-size: 9.5px; white-space: normal; line-height: 1.35; }
  #gacha .gacha-note-more::before { content: none; }
  #gacha .gacha-menu { margin-bottom: 6px; }
  #gacha .gacha-tag { padding-top: 26px; }
  #gacha .gacha-tag-rarity { margin-top: 0; font-size: 15px; filter: none; text-shadow: 1.5px 0 0 #fff, -1.5px 0 0 #fff, 0 1.5px 0 #fff, 0 -1.5px 0 #fff, 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff; }
  #gacha .gacha-tag[data-rarity="UR"] .gacha-tag-rarity { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: #a24fd6; }

  /* 問小白：縮小、蓋在轉蛋機那一格上（不再佔上面一整排）；快速提問改成標題右邊的下拉選單；罐罐提示縮小 */
  #gacha .gacha-shop { grid-template-areas: "sign sign" "machine menu" "machine boss" "counter counter"; grid-template-rows: auto auto auto auto; }
  #gacha .gacha-ask {
    grid-area: machine; position: absolute; left: 0; right: auto; top: auto; bottom: 6px; z-index: 8;
    width: min(76vw, 290px); max-height: min(70vh, 430px); overflow: auto;
    gap: 8px; padding: 16px 12px 11px; margin: 0; rotate: -1deg;
  }
  #gacha .gacha-ask::before { top: -7px; width: 48px; height: 13px; margin-left: -24px; }
  #gacha .gacha-ask-head { gap: 8px; }
  #gacha .gacha-ask-title { font-size: 17px; white-space: nowrap; }
  #gacha .gacha-ask-select {
    flex: 1 1 auto; min-width: 0; height: 30px; padding: 0 8px;
    border: 1px solid rgba(102,90,156,.32); border-radius: 999px; background: #fff;
    color: var(--g-ink); font: 400 16px/1 var(--hand); /* 16px：iPhone 點下拉選單時才不會自動放大畫面 */
    transform: scale(.82); transform-origin: right center;
  }
  #gacha .gacha-ask-close { width: 26px; height: 26px; font-size: 12px; }
  #gacha .gacha-ask-chips { display: none; }
  #gacha .gacha-ask-log { max-height: 130px; padding: 7px 9px; font-size: 12.5px; }
  #gacha .gacha-ask-form textarea { min-height: 36px; padding: 7px 10px; }
  #gacha .gacha-ask-form button { height: 36px; padding: 0 12px; font-size: 13px; }
  #gacha .gacha-ask-foot { font-size: 11px; }
  #gacha .gacha-ask-tip { gap: 8px; padding: 5px 9px; border-width: 1px; }
  #gacha .gacha-ask-tip-can { min-width: 18px; min-height: 14px; width: 18px; height: 14px; }
  #gacha .gacha-ask-tip b { font-size: 12px; }
  #gacha .gacha-ask-tip small { font-size: 9.5px; }
  #gacha .gacha-ask-tip-go { font-size: 12px; }
}
#gacha .gacha-ask-select { display: none; }
@media (max-width: 760px) {
  #gacha .gacha-ask-select { display: block; }
}
@media (max-width: 360px) {
  #gacha .gacha-wall-notes { grid-template-columns: repeat(2, 78px); gap: 8px; margin-right: 10px; }
  #gacha .gacha-note-title { font-size: 11px; }
  #gacha .gacha-note-more { font-size: 9px; }
}

/* ===== 2026-10-26 手機轉蛋頁（第四輪） =====
   機率木牌的釘孔改用 px 定位、稀有度字往下，不會蓋到釘孔；
   問小白只佔轉蛋機那一欄（小白左邊），不擋小白；便條裡的字全部用手寫體 */
@media (max-width: 760px) {
  #gacha .gacha-tag {
    padding-top: 38px;
    background:
      radial-gradient(circle at 50% 12px, #3a2412 0 5px, transparent 6px),
      repeating-linear-gradient(90deg, transparent 0 3px, rgba(90,50,20,.13) 3px 4px, transparent 4px 9px, rgba(255,235,200,.08) 9px 10px, transparent 10px 14px),
      linear-gradient(90deg, #b47c49, #c99560 28%, #ad7444 52%, #c38b57 78%, #a46c3d);
  }
  #gacha .gacha-tag::before { bottom: calc(100% - 12px); height: calc(var(--drop) + 12px); }
  #gacha .gacha-ask { left: 0; right: 0; width: auto; max-height: min(64vh, 380px); padding: 13px 9px 9px; gap: 6px; }
  #gacha .gacha-ask-title { font-size: 15px; }
  #gacha .gacha-ask-head { gap: 4px; }
  #gacha .gacha-ask { grid-template-columns: minmax(0, 1fr); }
  #gacha .gacha-ask > * { min-width: 0; }
  #gacha .gacha-ask-select { flex: 1 1 0; width: 0; min-width: 0; height: 26px; padding: 0 4px; font-size: 16px; transform: none; zoom: .75; }
  #gacha .gacha-ask-form textarea { font-size: 16px; zoom: .8; }
  #gacha .gacha-ask-tip small { white-space: normal; }
  #gacha .gacha-ask-foot { font-size: 9px; white-space: nowrap; gap: 4px; }
  #gacha .gacha-ask-log { font-size: 11px; line-height: 1.5; }
  #gacha .gacha-ask-form textarea { white-space: nowrap; overflow: hidden; }
  #gacha .gacha-ask-close { width: 22px; height: 22px; font-size: 11px; }
  #gacha .gacha-ask-log { max-height: 110px; padding: 6px 7px; font-size: 12px; }
  #gacha .gacha-ask-line { gap: .45em; }
  #gacha .gacha-ask-form { gap: 5px; }
  #gacha .gacha-ask-form textarea { min-height: 32px; padding: 6px 8px; }
  #gacha .gacha-ask-form button { height: 32px; padding: 0 9px; font-size: 12px; }
  #gacha .gacha-ask-foot { font-size: 10px; }
  #gacha .gacha-ask-tip { gap: 6px; padding: 4px 7px; }
  #gacha .gacha-ask-tip b { font-size: 11px; }
  #gacha .gacha-ask-tip small { font-size: 8.5px; }
  html body #gacha .gacha-ask,
  html body #gacha .gacha-ask * { font-family: var(--hand) !important; }
}

/* 手機（第五輪）：小白頭上的對話泡泡只在小白那一欄（不被問小白便條蓋到）；最下面的操作說明木牌往上一點 */
@media (max-width: 760px) {
  #gacha .gacha-boss { z-index: 9; }
  #gacha .gacha-boss-say { left: auto; right: 0; width: max-content; max-width: 100%; font-size: 12px; }
  #gacha .gacha-counter { height: 176px; }
  #gacha .gacha-counter-front { padding-bottom: 26px; }
}

/* 手機（第六輪）：問小白便條改蓋在櫃台下方（OPEN 牌、兩張便條、操作說明木牌那一區），不擋轉蛋機和小白 */
@media (max-width: 760px) {
  #gacha .gacha-ask { grid-area: counter; top: 10px; bottom: auto; left: 10px; right: 10px; max-height: none; padding: 16px 12px 11px; gap: 7px; rotate: -.6deg; }
  #gacha .gacha-ask-title { font-size: 17px; }
  #gacha .gacha-ask-select { zoom: .85; }
  #gacha .gacha-ask-close { width: 26px; height: 26px; font-size: 12px; }
  #gacha .gacha-ask-log { max-height: 120px; font-size: 12.5px; }
  #gacha .gacha-ask-form textarea { zoom: .9; }
  #gacha .gacha-ask-form button { height: 34px; padding: 0 14px; font-size: 13px; }
  #gacha .gacha-ask-foot { font-size: 11px; }
  #gacha .gacha-ask-tip b { font-size: 12.5px; }
  #gacha .gacha-ask-tip small { font-size: 10px; }
}
