:root {
  --bg: #0b0d12;
  --surface: #12151c;
  --surface-2: #181c25;
  --line: #ffffff14;
  --line-2: #ffffff22;
  --text: #eef0f4;
  --muted: #8b93a3;
  --accent: #f5b14c;
  --accent-2: #ff7a59;
  --ok: #3ddc97;
  --cell-h: 76px;
  --radius: 18px;
  --font: "Inter", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font-family: var(--font);
  background:
    radial-gradient(900px 500px at 15% -10%, #f5b14c1c, transparent 60%),
    radial-gradient(800px 500px at 100% 0%, #6d5dfc1a, transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
kbd {
  font-family: "Inter", ui-monospace, monospace; font-size: .72em; font-weight: 600;
  padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); border-bottom-width: 2px;
  background: #ffffff0a; color: var(--muted);
}

/* ---------- top bar ---------- */
.topbar {
  max-width: 1200px; margin: 0 auto; padding: 20px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.logo {
  width: 38px; height: 38px; border-radius: 11px; display: flex; gap: 3px; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 20px #f5b14c40;
}
.logo i { width: 6px; height: 18px; border-radius: 2px; background: #0b0d12; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; letter-spacing: .2px; }
.brand-text small { font-size: 12px; color: var(--muted); }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); transition: .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }

/* ---------- layout ---------- */
.layout {
  max-width: 1200px; margin: 0 auto; padding: 28px 24px 56px;
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start;
}
.stage { min-width: 0; }

/* ---------- packs (segmented control) ---------- */
.packs {
  display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 20px; max-width: 100%; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; scrollbar-width: none;
}
.packs button {
  border: 0; background: none; padding: 8px 16px; border-radius: 10px; white-space: nowrap;
  font-size: 14px; font-weight: 500; color: var(--muted); transition: .15s;
}
.packs button:hover { color: var(--text); }
.packs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 0 #ffffff10 inset, 0 2px 8px #0006; }

/* ---------- cabinet：實體機台 ---------- */
.cabinet { position: relative; display: flex; align-items: flex-start; gap: 0; padding-right: 4px; }
.machine {
  --chrome: linear-gradient(180deg, #f4f6fa 0%, #a9b0bd 18%, #5d6473 45%, #c9ced8 62%, #6a7180 82%, #2b2f38 100%);
  position: relative; flex: 1; min-width: 0;
  padding: 0 18px 0;
  border-radius: 34px 34px 20px 20px;
  /* 機身：深酒紅烤漆 */
  background:
    linear-gradient(90deg, #00000080, transparent 7%, transparent 93%, #00000080),
    radial-gradient(120% 60% at 50% 0%, #ffffff14, transparent 60%),
    linear-gradient(180deg, #5a1020 0%, #3a0912 45%, #24050b 100%);
  box-shadow:
    0 0 0 2px #0a0204,
    0 0 0 5px #8c939f, 0 0 0 6px #e7eaf0, 0 0 0 8px #3b3f48, 0 0 0 9px #000,
    0 40px 80px -20px #000e, 0 0 120px -30px #ff5a3c33,
    inset 0 2px 0 #ffffff26, inset 0 -6px 18px #0009;
  transition: box-shadow .4s;
}
.cabinet.win .machine { box-shadow:
    0 0 0 2px #0a0204, 0 0 0 5px #c9a14a, 0 0 0 6px #ffe7a8, 0 0 0 8px #6b4a12, 0 0 0 9px #000,
    0 40px 80px -20px #000e, 0 0 140px -10px #ffb84d88, inset 0 2px 0 #ffffff26, inset 0 -6px 18px #0009; }

/* 頂部燈箱 */
.topper {
  position: relative; margin: 0 -18px 0; padding: 16px 22px 14px;
  border-radius: 34px 34px 0 0;
  background: linear-gradient(180deg, #2a0710, #14030a);
  border-bottom: 3px solid #000;
  box-shadow: inset 0 -1px 0 #ffffff14, 0 4px 0 #8c939f, 0 5px 0 #e7eaf0, 0 7px 0 #3b3f48;
}
.topper-face {
  position: relative; padding: 12px 12px 10px; border-radius: 18px; text-align: center; overflow: hidden;
  background:
    radial-gradient(80% 140% at 50% 120%, #ff7a2a66, transparent 60%),
    repeating-linear-gradient(90deg, #ffffff06 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #3b0a12, #1a0408);
  box-shadow: inset 0 0 0 2px #000, inset 0 0 0 4px #c9a14a, inset 0 0 0 5px #000, inset 0 0 30px #000c;
}
.topper-face::after { /* 壓克力反光 */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(170deg, #ffffff22 0 22%, transparent 23%);
}
.marquee-title {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font: 900 clamp(26px, 4.6vw, 44px)/1 "Inter", sans-serif; letter-spacing: 6px;
  color: #ffe6a8;
  text-shadow: 0 0 2px #fff, 0 0 10px #ffb84d, 0 0 24px #ff7a1a, 0 3px 0 #7a2a00, 0 5px 10px #000;
}
.cabinet.spinning .marquee-title { animation: neon 1.2s ease-in-out infinite; }
@keyframes neon { 50% { text-shadow: 0 0 2px #fff, 0 0 16px #ffd27a, 0 0 36px #ff8a2a, 0 3px 0 #7a2a00, 0 5px 10px #000; } }
.sevens { font-style: normal; font-size: .6em; color: #ff5a3c; text-shadow: 0 0 10px #ff3c1a; }
.marquee-sub { margin-top: 6px; font: 600 11px "Inter", "Noto Sans TC", sans-serif; letter-spacing: 4px; color: #e7b77a; opacity: .75; }

.leds { display: flex; justify-content: space-between; gap: 2px; min-width: 0; margin: 12px 6px 0; }
.leds i, .side-bulbs i {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #6b4a20, #3a2410); box-shadow: inset 0 1px 1px #0008, 0 0 0 1px #000;
  transition: background .25s, box-shadow .25s;
}
.cabinet.spinning .leds i, .cabinet.spinning .side-bulbs i { animation: chase .9s linear infinite; animation-delay: var(--d); }
@keyframes chase { 0%, 30% { background: radial-gradient(circle at 35% 30%, #fff8e0, #ffcf73 50%, #ff9a2a); box-shadow: 0 0 10px #ffb84d, 0 0 0 1px #000; } 31%, 100% { } }
.leds i.hit { animation: hit .6s ease-out !important; }
@keyframes hit { 0% { background: radial-gradient(circle at 35% 30%, #fff, #fff4d6 60%, #ffcf73); box-shadow: 0 0 14px #ffcf73, 0 0 0 1px #000; } }
.cabinet.win .leds i, .cabinet.win .side-bulbs i { animation: winblink .22s steps(2) 6 !important; animation-delay: calc(var(--d) * -.3) !important; }
@keyframes winblink { 50% { background: radial-gradient(circle at 35% 30%, #fff8e0, #ffcf73 50%, #ff9a2a); box-shadow: 0 0 12px #ffb84d, 0 0 0 1px #000; } }

/* 機身中段：側燈 + 轉輪框 */
.body { display: flex; align-items: stretch; gap: 10px; padding: 22px 0 16px; }
.side-bulbs { width: 14px; flex: none; display: flex; flex-direction: column; justify-content: space-around; align-items: center;
  padding: 10px 0; border-radius: 8px; background: #12030680; box-shadow: inset 0 0 0 1px #000, inset 0 2px 4px #000; }
.bezel {
  position: relative; flex: 1; min-width: 0; padding: 12px; border-radius: 18px;
  background: var(--chrome);
  box-shadow: 0 0 0 1px #000, 0 6px 14px #000a, inset 0 1px 0 #fff;
}
.screw { position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #8a909c 55%, #3b3f48); box-shadow: 0 0 0 1px #0008; }
.screw::after { content: ""; position: absolute; left: 1px; right: 1px; top: 3.5px; height: 1px; background: #0009; transform: rotate(35deg); }
.bezel .tl { top: 3px; left: 3px; } .bezel .tr { top: 3px; right: 3px; }
.bezel .bl { bottom: 3px; left: 3px; } .bezel .br { bottom: 3px; right: 3px; }
.glass {
  position: relative; padding: 10px 12px 12px; border-radius: 10px;
  background: linear-gradient(180deg, #0a0b0f, #12141a);
  box-shadow: inset 0 0 0 2px #000, inset 0 8px 18px #000, inset 0 -4px 10px #000a;
}
.glass::after { /* 整片玻璃的斜反光 */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 5;
  background: linear-gradient(115deg, transparent 0 30%, #ffffff10 34%, transparent 46%, transparent 70%, #ffffff08 74%, transparent 80%);
}

/* 控制台：計數器 + HOLD 按鈕 */
.deck {
  display: flex; align-items: center; gap: 12px; margin: 0 -18px; padding: 14px 22px 16px;
  background: linear-gradient(180deg, #1a1c22, #0c0d11);
  border-top: 3px solid #000;
  box-shadow: inset 0 1px 0 #ffffff1c, 0 -4px 0 #8c939f, 0 -5px 0 #e7eaf0, 0 -7px 0 #3b3f48;
  border-bottom: 1px solid #000;
}
.deck-buttons { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.meter {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 10px; border-radius: 6px; min-width: 64px;
  background: #050505; box-shadow: inset 0 0 0 1px #000, inset 0 2px 6px #000, 0 1px 0 #ffffff14;
}
.meter small { font: 700 8px "Inter", sans-serif; letter-spacing: 2px; color: #7a5a30; }
.meter b { font: 700 17px ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: 2px; color: #ff8a2a; text-shadow: 0 0 8px #ff6a0099; }
.meter.dim b { color: #3ddc97; text-shadow: 0 0 8px #3ddc9799; }

/* 投幣盤 */
.tray { margin: 0 -18px; padding: 10px 22px 16px; border-radius: 0 0 20px 20px;
  background: linear-gradient(180deg, #2a0710, #14030a); border-top: 2px solid #000; }
.tray-mouth { height: 18px; margin: 0 18%; border-radius: 0 0 40px 40px;
  background: linear-gradient(180deg, #000, #1b1d22 70%, #3b3f48);
  box-shadow: 0 0 0 2px #8c939f, 0 0 0 3px #e7eaf0, 0 0 0 4px #000, inset 0 6px 8px #000; }

.reels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.reel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.reel.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
.reel-head { display: flex; align-items: center; gap: 8px; padding: 0 4px; min-width: 0; }
.reel-letter {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex: none;
  font: 700 12px "Inter", sans-serif; color: #0b0d12; background: var(--hue);
}
.reel-label { font-size: 13px; font-weight: 500; color: #9aa1b0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 轉輪視窗：外框是凹進機台的金屬框，內部是圓筒 */
.window {
  position: relative; height: calc(var(--cell-h) * 3); overflow: hidden; cursor: pointer;
  border-radius: 12px; background: #e9e5dc;
  box-shadow: 0 0 0 1px #000, 0 0 0 3px #1c1f27, 0 0 0 4px #000;
  transition: box-shadow .25s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.reels { padding: 4px; }
.window::before { /* 圓筒明暗 + 玻璃反光 */
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(100deg, transparent 0 18%, #ffffff30 22%, transparent 34%),
    linear-gradient(180deg, #05060a 0%, #05060ab0 14%, #05060a40 30%, transparent 42%, transparent 58%, #05060a40 70%, #05060ab0 86%, #05060a 100%),
    linear-gradient(90deg, #0004, transparent 12%, transparent 88%, #0004);
}
.window::after { /* 中線 */
  content: ""; position: absolute; left: 0; right: 0; top: calc(50% - var(--cell-h) / 2); height: var(--cell-h);
  z-index: 3; pointer-events: none;
  border-top: 1px solid #00000022; border-bottom: 1px solid #00000022;
  box-shadow: 0 1px 0 #ffffff40 inset, 0 -1px 0 #ffffff40 inset;
}
.drum { position: absolute; inset: 0; z-index: 1; }
.cell {
  position: absolute; left: 0; right: 0; top: calc(50% - var(--cell-h) / 2); height: var(--cell-h);
  display: flex; align-items: center; justify-content: center; padding: 6px 10px;
  text-align: center; color: #15171c; will-change: transform, opacity;
  font-weight: 800; font-size: clamp(13px, 1.45vw, 17px); line-height: 1.3; letter-spacing: .2px;
  background: linear-gradient(180deg, #f6f3ec, #ece8df);
  border-bottom: 1px solid #0000000d;
  user-select: none; -webkit-user-select: none;
}
.reel.landed .window { animation: thud .28s ease-out; }
@keyframes thud { 30% { transform: translateY(2px); } }
.reel:not(.spinning) .window:hover { box-shadow: 0 0 0 1px #000, 0 0 0 3px #3a3f4c, 0 0 0 4px #000; }

.reel.locked .window { box-shadow: 0 0 0 1px #000, 0 0 0 3px var(--hue), 0 0 0 4px #000, 0 0 22px -2px var(--hue); }
.reel.locked .window::after { background: color-mix(in srgb, var(--hue) 12%, transparent); }
.lock {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0; border: 0; background: none;
  -webkit-tap-highlight-color: transparent;
}
.lock .cap {
  width: 100%; max-width: 92px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  color: #ffffffcc;
  background: linear-gradient(180deg, color-mix(in srgb, var(--hue) 55%, #fff) 0%, color-mix(in srgb, var(--hue) 55%, #222) 100%);
  box-shadow: 0 5px 0 color-mix(in srgb, var(--hue) 35%, #000), 0 6px 0 #000, 0 9px 10px #000a,
              inset 0 1px 0 #fff8, inset 0 -2px 4px #0005;
  filter: saturate(.55) brightness(.7);
  transition: transform .06s, box-shadow .06s, filter .2s;
}
.lock .cap svg { width: 16px; height: 16px; filter: drop-shadow(0 1px 0 #0006); }
.lock .lbl { font: 800 10px "Inter", sans-serif; letter-spacing: 2px; color: #ffffff55; }
.lock:hover .cap { filter: saturate(.7) brightness(.85); }
.lock:active .cap { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--hue) 35%, #000), 0 2px 0 #000, 0 3px 4px #000a, inset 0 1px 0 #fff8, inset 0 -2px 4px #0005; }
.lock.on .cap { filter: none; color: #1a1205; transform: translateY(3px);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--hue) 35%, #000), 0 3px 0 #000, 0 0 18px var(--hue), inset 0 1px 0 #fff, inset 0 -2px 4px #0003; }
.lock.on .lbl { color: var(--hue); text-shadow: 0 0 6px var(--hue); }

.reels { position: relative; --head: 32px; }
.payline-mark { position: absolute; top: calc(4px + var(--head) + var(--cell-h) * 1.5); width: 0; height: 0;
  border: 7px solid transparent; transform: translateY(-50%); pointer-events: none; filter: drop-shadow(0 0 4px #f5b14c); }
.payline-mark.left { left: -11px; border-left-color: var(--accent); }
.payline-mark.right { right: -11px; border-right-color: var(--accent); }

/* ---------- 拉桿 ---------- */
.lever-wrap {
  position: relative; width: 58px; height: 250px; flex: none; margin-top: 190px; margin-left: 4px;
}
.lever-mount {
  position: absolute; left: 0; right: 6px; top: 120px; height: 96px; border-radius: 4px 16px 16px 4px;
  background: var(--chrome, linear-gradient(180deg, #f4f6fa, #5d6473 45%, #c9ced8 62%, #2b2f38));
  background: linear-gradient(90deg, #2b2f38, #c9ced8 30%, #f4f6fa 45%, #8a909c 70%, #3b3f48);
  box-shadow: 0 0 0 1px #000, 0 10px 20px #000a;
}
.lever-mount .screw { left: 8px; } .lever-mount .screw:first-child { top: 8px; } .lever-mount .screw:last-child { bottom: 8px; }
.lever {
  --pull: 0; --travel: 150px; --top: 0px;
  position: absolute; inset: 0; width: 100%; border: 0; padding: 0; background: none;
  cursor: grab; touch-action: none; -webkit-tap-highlight-color: transparent;
}
.lever.grab { cursor: grabbing; }
.lever .slot { display: none; position: absolute; left: 50%; top: calc(var(--top) + 10px); width: 10px; height: calc(var(--travel) + 20px); transform: translateX(-50%);
  border-radius: 5px; background: #05060a; box-shadow: inset 0 2px 4px #000, 0 1px 0 #ffffff12; }
.lever .hub { position: absolute; left: 50%; top: calc(var(--top) + var(--travel) + 22px); width: 34px; height: 34px; transform: translate(-50%, -50%);
  border-radius: 50%; background: radial-gradient(circle at 38% 32%, #fff, #b9bfca 30%, #5d6473 70%, #2b2f38); box-shadow: 0 0 0 2px #000, 0 4px 10px #000c; }
.lever .rod { /* 從底部軸心伸到球 */
  position: absolute; left: 50%; width: 8px; transform: translateX(-50%);
  top: calc(var(--top) + 17px + var(--pull) * var(--travel));
  height: max(0px, calc(var(--travel) + 5px - var(--pull) * var(--travel)));
  border-radius: 4px; background: linear-gradient(90deg, #5a6274, #e6e9ef 45%, #7a8396);
  box-shadow: 0 0 6px #0008;
}
.lever .ball {
  position: absolute; left: 50%; top: var(--top); width: 38px; height: 38px; border-radius: 50%;
  transform: translate(-50%, calc(var(--pull) * var(--travel))) scale(calc(1 + var(--pull) * .12));
  background: radial-gradient(circle at 34% 28%, #fff1d6 0 6%, #ffc56a 22%, #f08a2c 58%, #8a3d0c 100%);
  box-shadow: 0 8px 16px #000b, inset 0 -3px 6px #0005, 0 0 calc(var(--pull) * 24px) #ff9a3c88;
}
.lever:hover .ball { filter: brightness(1.08); }
.lever:focus-visible { outline: none; }
.lever:focus-visible .ball { box-shadow: 0 0 0 3px #fff8, 0 8px 16px #000b; }
.lever-wrap::after { content: "PULL"; position: absolute; bottom: -6px; left: 0; right: 0; text-align: center;
  font: 700 10px "Inter", sans-serif; letter-spacing: 3px; color: #ffffff30; }
body.is-spinning .lever { cursor: default; }
body.is-spinning .lever .ball { filter: saturate(.6) brightness(.85); }

/* ---------- result ---------- */
.result {
  margin-top: 22px; padding: 22px 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.result-label { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 1.5px; color: var(--muted); }
.sentence {
  margin: 0; min-height: 2.9em; font-size: clamp(18px, 2.3vw, 26px); font-weight: 500; line-height: 1.55; color: #c9ced8;
}
.sentence .w { white-space: nowrap; font-weight: 800; color: var(--text); padding: 0 .1em; border-radius: 3px;
  background: linear-gradient(transparent 62%, color-mix(in srgb, var(--hue) 42%, transparent) 62%); }
.sentence .w.in { animation: rise .35s cubic-bezier(.2,.9,.3,1.2) both; }
.sentence .w.ph { display: inline-block; width: 3.2em; height: .9em; vertical-align: -.05em; background: color-mix(in srgb, var(--hue) 18%, transparent);
  animation: shimmer 1s ease-in-out infinite alternate; }
@keyframes shimmer { to { background: color-mix(in srgb, var(--hue) 32%, transparent); } }
.sentence.pending { color: var(--muted); font-size: clamp(16px, 1.8vw, 20px); }
.sentence .hl { color: var(--accent); font-weight: 700; margin: 0 .2em; }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.96); } }

.actions { margin-top: 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spin {
  display: inline-flex; align-items: center; gap: 12px; height: 50px; padding: 0 26px; border: 0; border-radius: 14px;
  font-size: 17px; font-weight: 800; letter-spacing: 1px; color: #1a1205;
  background: linear-gradient(135deg, #ffc76a, var(--accent) 45%, var(--accent-2));
  box-shadow: 0 10px 30px -8px #f5b14c99, 0 1px 0 #fff6 inset; transition: transform .1s, filter .15s;
}
.spin kbd { color: #1a1205aa; border-color: #1a120533; background: #ffffff33; }
.spin:hover { filter: brightness(1.06); }
.spin:active { transform: scale(.98); }
.spin.stop { background: linear-gradient(135deg, #3a4152, #252a35); color: var(--text); box-shadow: 0 0 0 1px var(--line-2) inset; }
.spin.stop kbd { color: var(--muted); border-color: var(--line-2); background: #ffffff0a; }
.spin span { min-width: 3.4em; text-align: left; }
.secondary { display: flex; gap: 8px; margin-left: auto; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; font-weight: 500; transition: .15s;
}
.btn:hover { border-color: var(--line-2); background: #1f2430; }
.btn svg { width: 16px; height: 16px; color: var(--muted); }
.btn.on { border-color: #f5b14c55; }
.btn.on svg { color: var(--accent); fill: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.pop svg { animation: pop .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { 40% { transform: scale(1.6) rotate(-12deg); } }
body.is-spinning #fav, body.is-spinning #copy, body.is-spinning #share { opacity: .45; pointer-events: none; }

.shortcuts { margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); }

/* ---------- 側欄：收藏／紀錄 ---------- */
.side {
  position: sticky; top: 20px; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  max-height: calc(100vh - 40px); display: flex; flex-direction: column; min-height: 0;
}
.tabs { display: flex; gap: 4px; padding: 3px; margin-bottom: 12px; border-radius: 12px; background: #0b0d12; border: 1px solid var(--line); }
.tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border: 0; border-radius: 9px;
  background: none; font-size: 14px; font-weight: 600; color: var(--muted); transition: .15s; }
.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 2px 8px #0006; }
.count { font: 600 11px "Inter", sans-serif; padding: 1px 7px; border-radius: 99px; background: #ffffff10; color: var(--muted); }
.panel { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.panel[hidden] { display: none; }
.panel ol { list-style: none; margin: 0; padding: 0 2px 0 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.panel li {
  padding: 11px 12px 9px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13.5px; line-height: 1.55; color: #c9ced8; transition: .15s;
}
.panel li p { margin: 0; }
.panel li.restorable { cursor: pointer; }
.panel li.restorable:hover { border-color: var(--line-2); background: #1c212b; }
.meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.chip { padding: 1px 7px; border-radius: 6px; background: #ffffff0c; }
.acts { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: .15s; }
.panel li:hover .acts, .panel li:focus-within .acts { opacity: 1; }
.acts button { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--muted); }
.acts button:hover { background: #ffffff12; color: var(--text); }
.acts button svg { width: 14px; height: 14px; }
.acts button.on svg { color: var(--accent); fill: var(--accent); }
.panel .empty { padding: 30px 12px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.8; background: none; border: 1px dashed var(--line-2); }
.panel-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--line); }
.panel-foot[hidden] { display: none; }
.muted { font-size: 12px; color: var(--muted); }
.link-btn { border: 0; background: none; font-size: 13px; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { color: var(--text); background: #ffffff0a; }
.link-btn.danger:hover { color: var(--accent-2); }
@media (hover: none) { .acts { opacity: 1; } }

/* ---------- 音量 ---------- */
.audio { display: flex; align-items: center; gap: 10px; }
#volume { width: 90px; accent-color: var(--accent); }
#volume:disabled { opacity: .35; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 12px; background: #eef0f4; color: #0b0d12; font-size: 14px; font-weight: 600;
  box-shadow: 0 12px 30px #0008; transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: 520px; }
}
@media (max-width: 640px) {
  :root { --cell-h: 60px; }
  .topbar { padding: 14px 16px 0; }
  .layout { padding: 18px 12px 40px; gap: 20px; }
  .lever-wrap, .payline-mark, .side-bulbs { display: none; }
  .machine { padding: 0 10px; border-radius: 24px 24px 16px 16px; }
  .topper, .deck, .tray { margin-left: -10px; margin-right: -10px; }
  .topper { padding: 10px 12px; border-radius: 24px 24px 0 0; }
  .topper-face { padding: 8px; }
  .marquee-title { letter-spacing: 3px; gap: 8px; }
  .marquee-sub { letter-spacing: 2px; font-size: 9px; }
  .body { padding: 14px 0 12px; }
  .bezel { padding: 7px; border-radius: 12px; }
  .glass { padding: 6px 6px 8px; }
  .deck { padding: 12px 12px 14px; gap: 8px; }
  .deck .meter { display: none; }
  .deck-buttons { gap: 6px; }
  .lock .lbl { font-size: 8px; letter-spacing: 1px; }
  .tray { padding: 6px 12px 10px; }
  .leds { margin: 8px 2px 0; }
  .leds i { width: 6px; height: 6px; }
  #volume { display: none; }
  .reels { gap: 5px; }
  .reel { gap: 6px; }
  .reel-head { justify-content: center; padding: 0; }
  .reel-label { display: none; }
  .window { border-radius: 10px; }
  .cell { font-size: 12px; padding: 4px; line-height: 1.25; }
  .result { padding: 18px; }
  .actions { flex-direction: column; align-items: stretch; }
  .spin { justify-content: center; }
  .spin kbd { display: none; }
  .secondary { margin: 0; }
  .secondary .btn { flex: 1; justify-content: center; }
  .shortcuts { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, .leds i { animation: none !important; transition: none !important; }
}
