/* =========================================================
   そらもちおみくじ — スタイル
   白・生成り・朱色・金色を基調にした、和モダンなデザイン
   ========================================================= */

:root {
  --paper: #f5f0e6;
  --kinari: #fbf7ee;
  --white: #fffdf8;
  --ink: #2b2622;
  --ink-2: #625950;
  --ink-3: #958a7c;
  --shu: #d9472b;
  --shu-deep: #b1361c;
  --shu-soft: #ec9a86;
  --gold: #c9a14a;
  --gold-deep: #a47c2c;
  --gold-light: #f1dc9f;
  --ai: #3f4763;
  --line: rgba(43, 38, 34, 0.12);
  --serif: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", "YuMincho", "Noto Serif JP", "Noto Serif CJK JP", serif;
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --washi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .25 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --fiber: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.025 .35' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .58 0 0 0 0 .48 0 0 0 0 .34 0 0 0 2.4 -1.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.01' numOctaves='3' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .7 0 0 0 0 .6 0 0 0 0 .42 0 0 0 .32 -.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
  --ease-out: cubic-bezier(.2, .8, .3, 1);
  --ease-back: cubic-bezier(.2, .9, .3, 1.25);
}

/* ---------- リセット ---------- */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
dialog { margin: auto; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.has-dialog { overflow: hidden; }

body {
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.7;
  background-color: var(--paper);
  background-image: var(--fiber), var(--mottle), var(--washi);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

:focus-visible { outline: 2px solid var(--shu); outline-offset: 3px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- レイヤー ---------- */
.fx { position: fixed; left: 0; top: 0; pointer-events: none; }
.fx-back { z-index: 0; }
.fx-front { z-index: 50; }
.veil {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: #1e2238; opacity: 0;
  transition: opacity 1s ease, background-color 1s ease;
}
.veil[data-kind="gloom"] { opacity: .17; }
.veil[data-kind="gloom-after"] { opacity: .08; transition-duration: 2s; }
.veil[data-kind="abyss"] { opacity: .5; background: #171b2e; transition-duration: .9s; }
.veil[data-kind="abyss-after"] { opacity: .1; transition-duration: 2.6s; }
body.theme-legend::before {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 70% at 50% 28%, rgba(255, 213, 120, .38), rgba(255, 213, 120, 0) 70%);
  animation: fadeIn 1.2s ease both;
}
.page { position: relative; z-index: 2; overflow-x: clip; }

/* ---------- ヘッダー ---------- */
.site-header {
  position: relative; z-index: 6;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1080px; margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px 4px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-family: var(--serif); font-weight: 800; font-size: 19px; letter-spacing: .12em; white-space: nowrap; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn, .pill-btn {
  height: 40px; border: 1px solid var(--line); background: rgba(255, 253, 248, .78);
  color: var(--ink-2);
  transition: transform .15s var(--ease-out), color .2s, border-color .2s, background-color .2s;
}
.icon-btn { width: 40px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.icon-btn .ic { width: 20px; height: 20px; }
.ic-sound-on { display: none; }
.icon-btn.is-on { color: var(--shu); border-color: rgba(217, 71, 43, .4); }
.icon-btn.is-on .ic-sound-on { display: block; animation: popIn .35s var(--ease-back); }
.icon-btn.is-on .ic-sound-off { display: none; }
.pill-btn {
  position: relative; border-radius: 999px; padding: 0 15px 0 12px;
  display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink);
}
.pill-btn .ic { width: 18px; height: 18px; color: var(--shu); }
.icon-btn:hover, .pill-btn:hover { background: #fff; }
.icon-btn:active, .pill-btn:active { transform: scale(.92); }
.dot {
  position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--shu); box-shadow: 0 0 0 2px #fffdf8; animation: popIn .4s var(--ease-back);
}

/* =========================================================
   ステージ
   ========================================================= */
.stage-section { max-width: 640px; margin: 0 auto; padding: 0 12px; }

.stage {
  --sw: max(230px, min(84vw, 360px, calc((100vh - 170px) / 1.45)));
  --sh: calc(var(--sw) * 1.45);
  --stage-h: max(400px, calc(var(--sh) + 56px));
  --box-h: calc(var(--stage-h) * .44);
  --box-w: calc(var(--box-h) * 2 / 3);
  position: relative;
  max-width: 560px;
  height: var(--stage-h);
  margin: 0 auto;
}
@supports (height: 100svh) {
  .stage { --sw: max(230px, min(84vw, 360px, calc((100svh - 170px) / 1.45))); }
}

.stage-lead {
  position: absolute; left: 0; right: 0; top: 6px; z-index: 4;
  text-align: center; font-family: var(--serif); font-size: 14px; letter-spacing: .24em;
  color: var(--ink-2); transition: opacity .4s ease;
}
.stage:not([data-mode="idle"]) .stage-lead { opacity: 0; }

/* 光・放射 */
.stage-glow {
  position: absolute; left: 50%; top: 50%; z-index: 0; pointer-events: none;
  width: min(150%, 900px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow-c, rgba(255, 222, 160, .7)), rgba(255, 222, 160, 0));
  transform: translate(-50%, -50%) scale(.5); opacity: 0;
  transition: opacity 1s ease, transform 1.3s var(--ease-out);
}
.stage[data-fx] .stage-glow { transform: translate(-50%, -50%) scale(1); }
.stage[data-fx="legend"] .stage-glow, .stage[data-fx="legend-pre"] .stage-glow { opacity: 1; --glow-c: rgba(255, 205, 105, .85); }
.stage[data-fx="great"] .stage-glow { opacity: .9; --glow-c: rgba(255, 214, 140, .75); }
.stage[data-fx="warm"] .stage-glow { opacity: .75; --glow-c: rgba(255, 208, 196, .7); }
.stage[data-fx="calm"] .stage-glow { opacity: .5; --glow-c: rgba(255, 240, 214, .8); }
.stage[data-fx="gloom"] .stage-glow { opacity: .4; --glow-c: rgba(206, 214, 236, .6); }
.stage[data-fx="abyss"] .stage-glow { opacity: .35; --glow-c: rgba(180, 190, 228, .5); }

.rays {
  position: absolute; left: 50%; top: 50%; z-index: 0; pointer-events: none;
  width: min(200%, 1150px); aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%) scale(.55); opacity: 0;
  -webkit-mask-image: radial-gradient(closest-side, #000 12%, rgba(0, 0, 0, .6) 45%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 12%, rgba(0, 0, 0, .6) 45%, transparent 100%);
  transition: opacity 1.2s ease, transform 1.6s var(--ease-out);
}
.rays::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 204, 96, 0) 0deg 4deg, rgba(255, 204, 96, .34) 6deg 9deg, rgba(255, 204, 96, 0) 11deg 15deg);
  animation: spin 46s linear infinite;
}
.stage[data-fx="legend"] .rays, .stage[data-fx="legend-pre"] .rays { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.stage[data-fx="great"] .rays { opacity: .5; transform: translate(-50%, -50%) scale(.8); }

.rainbow {
  position: absolute; left: 50%; z-index: 1; pointer-events: none;
  top: calc(50% - var(--sh) / 2 - var(--sw) * .2);
  width: calc(var(--sw) * 1.5); aspect-ratio: 2 / 1;
  transform: translateX(-50%) translateY(14px); opacity: 0;
  border-radius: 999px 999px 0 0;
  background: radial-gradient(circle at 50% 100%,
    rgba(255, 255, 255, 0) 55%, rgba(255, 140, 140, .5) 56%, rgba(255, 196, 120, .5) 60%,
    rgba(255, 236, 140, .5) 64%, rgba(150, 214, 150, .5) 68%, rgba(126, 186, 240, .5) 72%,
    rgba(176, 146, 226, .5) 76%, rgba(176, 146, 226, 0) 77%);
  transition: opacity 1.8s ease, transform 1.8s var(--ease-out);
}
.rainbow.is-on { opacity: .85; transform: translateX(-50%) translateY(0); }

/* 待機中のキャラクター */
.idle-chara {
  position: absolute; z-index: 4; left: 50%;
  top: calc(var(--stage-h) * .095);
  width: min(62%, calc(var(--box-w) * 1.9), 300px);
  transform: translateX(-58%);
  transition: opacity .45s ease, transform .55s var(--ease-out);
}
.idle-chara-swim { animation: swim 7s ease-in-out infinite; }
.idle-chara img {
  display: block; width: 100%; height: auto;
  filter: drop-shadow(0 12px 14px rgba(70, 130, 180, .16));
}
.bubble {
  position: absolute; right: -14%; top: -10%;
  padding: 6px 12px; border-radius: 14px;
  background: #fffdf8; border: 1px solid var(--line);
  font-size: 12.5px; white-space: nowrap; color: var(--ink);
  box-shadow: 0 6px 16px -8px rgba(60, 40, 20, .35);
  transition: opacity .3s ease, transform .3s var(--ease-back);
  animation: bubbleIn .6s var(--ease-back) .5s both;
}
.bubble::after {
  content: ""; position: absolute; left: 18px; bottom: -6px; width: 10px; height: 10px;
  background: #fffdf8; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.bubble.is-hide { opacity: 0; transform: translateY(4px) scale(.92); }
.stage:not([data-mode="idle"]) .idle-chara {
  opacity: 0; pointer-events: none;
  transform: translateX(-58%) translate(18%, -20px) scale(.9);
}

/* おみくじ箱 */
.box-wrap {
  position: absolute; z-index: 3;
  width: var(--box-w); height: var(--box-h);
  left: calc(50% - var(--box-w) / 2);
  bottom: 100px;
  transition: opacity .3s ease, visibility .3s;
}
.stage[data-mode="result"] .box-wrap { opacity: 0; visibility: hidden; }
.box-shadow {
  position: absolute; left: 6%; right: 6%; bottom: -5%; height: 9%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(90, 50, 25, .26), rgba(90, 50, 25, 0));
  animation: shadowPulse 3.6s ease-in-out infinite;
}
.box-float { position: absolute; inset: 0; animation: float 3.6s ease-in-out infinite; }
.box-float.is-still { animation: none; }
.box-shake { position: absolute; inset: 0; transform-origin: 50% 92%; }
.box-svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 10px 18px rgba(120, 40, 20, .18)); }
.box-label { font-family: var(--serif); font-weight: 700; }

/* おみくじ棒 */
.stick-slot {
  position: absolute; z-index: 2; pointer-events: none;
  left: -60%; right: -60%; top: -320%; bottom: 79.33%;
  overflow: hidden;
}
.stick {
  position: absolute; left: 50%; top: 100%;
  width: calc(var(--box-w) * .078); height: calc(var(--box-w) * .74);
  margin-left: calc(var(--box-w) * -.039);
  border-radius: 3px 3px 2px 2px;
  background: #ecdcb7;
  box-shadow: inset -2px 0 0 rgba(130, 90, 40, .2), inset 1px 0 0 rgba(255, 255, 255, .5), 0 3px 6px rgba(60, 30, 10, .18);
}
.stick::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 15%;
  background: var(--shu); border-radius: 3px 3px 0 0;
}
.stick-num {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%);
  writing-mode: vertical-rl; font-family: var(--serif); font-weight: 700;
  font-size: calc(var(--box-w) * .052); line-height: 1; letter-spacing: -.02em; color: var(--ink);
}
.stick.is-gold {
  background: #efcf7a;
  box-shadow: inset -2px 0 0 rgba(150, 100, 20, .3), inset 2px 0 0 rgba(255, 250, 220, .8),
    0 0 12px rgba(255, 205, 90, .95), 0 0 34px rgba(255, 200, 90, .7);
  animation: goldPulse 1s ease-in-out infinite;
}
.stick.is-glint::after, .stick.is-gold::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .85) 50%, rgba(255, 255, 255, 0) 70%);
  background-size: 100% 300%;
  animation: glint 1.2s ease-in-out .3s infinite;
}
.stick-glow {
  position: absolute; left: 50%; z-index: 1; pointer-events: none;
  top: calc(20.67% - var(--box-w) * .444);
  width: calc(var(--box-w) * 1.4); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 230, 160, .95), rgba(255, 214, 130, .4) 45%, rgba(255, 214, 130, 0));
  transform: translate(-50%, -50%) scale(.4); opacity: 0;
}
.stick-tag {
  position: absolute; z-index: 3; opacity: 0;
  left: calc(50% + var(--box-w) * .13);
  top: calc(20.67% - var(--box-w) * .86);
  writing-mode: vertical-rl;
  font-family: var(--serif); font-size: clamp(13px, calc(var(--box-w) * .085), 17px);
  letter-spacing: .2em; line-height: 1;
  padding: .75em .5em; border-radius: 4px;
  background: #fffdf8; border: 1px solid rgba(201, 161, 74, .7);
  box-shadow: 0 6px 14px -6px rgba(80, 50, 20, .3);
}
.stick-tag b { color: var(--shu); font-weight: 800; }
.hush {
  position: absolute; z-index: 3; opacity: 0;
  right: calc(50% + var(--box-w) * .14);
  top: calc(20.67% - var(--box-w) * .62);
  font-family: var(--serif); font-size: 20px; letter-spacing: .1em; color: #e9e6f2;
}

/* ボタン */
.draw-area {
  position: absolute; left: 0; right: 0; bottom: 26px; z-index: 6;
  display: flex; justify-content: center;
  transition: opacity .35s ease, transform .35s var(--ease-out), visibility .35s;
}
.stage[data-mode="result"] .draw-area, .stage.is-slip .draw-area { opacity: 0; visibility: hidden; transform: translateY(10px); }
.draw-btn {
  position: relative; overflow: hidden;
  min-width: 232px; padding: 18px 40px 18px 46px;
  border: none; border-radius: 999px;
  background: var(--shu); color: #fffaf1;
  font-family: var(--serif); font-weight: 800; font-size: 18px; letter-spacing: .2em; line-height: 1;
  box-shadow: 0 5px 0 var(--shu-deep), 0 14px 26px -8px rgba(177, 54, 28, .55);
  transition: transform .12s ease, box-shadow .12s ease, background-color .2s;
  touch-action: manipulation;
}
.draw-btn::before {
  content: ""; position: absolute; inset: 4px; border-radius: inherit;
  border: 1px solid rgba(246, 217, 168, .55); pointer-events: none;
}
.draw-btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 50%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .32), rgba(255, 255, 255, 0));
  transform: skewX(-18deg);
  animation: btnShine 5s ease-in-out 1.6s infinite;
  pointer-events: none;
}
.draw-btn:hover { background: #df5134; transform: translateY(-1px); box-shadow: 0 6px 0 var(--shu-deep), 0 18px 30px -8px rgba(177, 54, 28, .55); }
.draw-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--shu-deep), 0 6px 12px -6px rgba(177, 54, 28, .5); }
.draw-btn:disabled { cursor: default; transform: translateY(4px); box-shadow: 0 1px 0 var(--shu-deep), 0 6px 12px -6px rgba(177, 54, 28, .5); background: #d55a40; }
.draw-btn:disabled::after { animation: none; opacity: 0; }
.draw-btn-text { position: relative; z-index: 1; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255, 250, 235, .45); transform: scale(0);
  animation: ripple .65s ease-out forwards;
}

.skip-btn {
  position: absolute; z-index: 20; top: 6px; right: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(255, 253, 248, .88); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2); letter-spacing: .08em;
  animation: fadeIn .3s ease both;
  transition: transform .15s ease;
}
.skip-btn:active { transform: scale(.94); }

/* 画面切り替え（超大吉） */
.flash {
  position: fixed; inset: 0; z-index: 80; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--fx-x, 50%) var(--fx-y, 40%), #fffdf4 0%, #fff0c6 22%, #f5d07a 58%, #e2ad48 100%);
  clip-path: circle(0 at 50% 50%);
}
.flash::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-conic-gradient(from 0deg at var(--fx-x, 50%) var(--fx-y, 40%), rgba(255, 255, 255, 0) 0deg 6deg, rgba(255, 255, 255, .38) 8deg 11deg, rgba(255, 255, 255, 0) 13deg 18deg);
}

/* =========================================================
   おみくじの紙（3つ折り）
   ========================================================= */
.slip-wrap {
  position: absolute; z-index: 5;
  left: calc(50% - var(--sw) / 2);
  top: calc(50% - var(--sh) / 2);
  width: var(--sw); height: var(--sh);
  perspective: 1600px;
  visibility: hidden; opacity: 0;
}
.slip-wrap.is-shown, .stage[data-mode="result"] .slip-wrap { visibility: visible; opacity: 1; }
.slip-wrap::before {
  content: ""; position: absolute; left: 2%; right: 2%; top: 31%; bottom: 31%;
  border-radius: 4px;
  box-shadow: 0 22px 44px -10px rgba(80, 50, 25, .32), 0 3px 8px rgba(80, 50, 25, .1);
  transition: top .58s cubic-bezier(.45, .05, .2, 1), bottom .58s cubic-bezier(.45, .05, .2, 1) .24s;
}
.slip-wrap.is-opening::before, .slip-wrap.is-open-static::before,
.stage[data-mode="result"] .slip-wrap::before { top: 1%; bottom: 1%; }

.slip { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.slip-panel { position: absolute; left: 0; width: 100%; transform-style: preserve-3d; }
.slip-top { top: 0; height: 30%; transform-origin: 50% 100%; }
.slip-mid { top: 30%; height: 40%; }
.slip-bot { top: 70%; height: 30%; transform-origin: 50% 0%; }
.slip.is-folded .slip-top { transform: translateZ(2px) rotateX(-180deg); }
.slip.is-folded .slip-bot { transform: translateZ(1px) rotateX(180deg); }

.face {
  position: absolute; inset: 0; overflow: hidden;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  background-color: var(--kinari);
  background-image: var(--washi);
}
.face-back {
  transform: rotateX(180deg);
  background-color: #f1e8d6;
}
.face-back::before {
  content: ""; position: absolute; inset: 7% 5%;
  border-top: 1px solid rgba(217, 71, 43, .35); border-bottom: 1px solid rgba(217, 71, 43, .35);
}
.slip-top .face-front::after, .slip-bot .face-front::after {
  content: ""; position: absolute; left: 0; right: 0; height: 12%; pointer-events: none;
}
.slip-top .face-front::after { bottom: 0; background: linear-gradient(to top, rgba(120, 88, 50, .09), rgba(120, 88, 50, 0)); }
.slip-bot .face-front::after { top: 0; background: linear-gradient(to bottom, rgba(120, 88, 50, .09), rgba(120, 88, 50, 0)); }

.sc-holder { position: absolute; left: 0; width: 100%; height: var(--sh); }
.slip-top .sc-holder { top: 0; }
.slip-mid .sc-holder { top: calc(var(--sh) * -.3); }
.slip-bot .sc-holder { top: calc(var(--sh) * -.7); }

.slip-band {
  position: absolute; z-index: 3;
  left: 42%; width: 16%; top: 27%; height: 46%;
  display: grid; place-items: center;
  background: var(--shu);
  border-left: 2px solid var(--gold-light); border-right: 2px solid var(--gold-light);
  box-shadow: 0 4px 10px rgba(100, 40, 20, .25);
  opacity: 0; visibility: hidden;
}
.slip-band span {
  writing-mode: vertical-rl; font-family: var(--serif); font-weight: 700;
  font-size: calc(var(--sw) * .046); letter-spacing: .35em; color: #fbf3df;
}
.slip-band[data-effect="legend"] { background: #d4a94e; border-color: #fff1c4; box-shadow: 0 0 18px rgba(255, 205, 100, .75); }
.slip-band[data-effect="legend"] span { color: #5a3d0c; }
.slip-band[data-effect="abyss"], .slip-band[data-effect="gloom"] { background: #4b5370; border-color: #aab3cf; }
.slip-wrap.is-shown .slip-band { opacity: 1; visibility: visible; }
.stage[data-mode="result"] .slip-band, .slip-wrap.is-open-static .slip-band { opacity: 0; visibility: hidden; }

/* 紙の中身 */
.sc {
  --frame: rgba(217, 71, 43, .78);
  position: absolute; inset: 0;
  display: grid; grid-template-rows: 30% 40% 30%;
  color: var(--ink);
}
.slip[data-effect="legend"] .sc { --frame: rgba(196, 150, 60, .95); }
.slip[data-effect="gloom"] .sc, .slip[data-effect="abyss"] .sc { --frame: rgba(86, 96, 122, .6); }
.sc::before, .sc::after { content: ""; position: absolute; pointer-events: none; }
.sc::before { inset: calc(var(--sw) * .034); border: calc(var(--sw) * .006) solid var(--frame); }
.sc::after { inset: calc(var(--sw) * .048); border: 1px solid var(--frame); opacity: .55; }
.slip[data-effect="legend"] .sc::before { box-shadow: 0 0 0 1px rgba(255, 240, 200, .8) inset; }

.sc-row { position: relative; min-height: 0; }
.sc-top { display: flex; flex-direction: column; align-items: center; padding-top: calc(var(--sw) * .085); }
.sc-head {
  display: flex; align-items: center; gap: calc(var(--sw) * .03);
  font-family: var(--serif); font-size: calc(var(--sw) * .036); letter-spacing: .3em; color: var(--ink-2);
  line-height: 1;
}
.sc-head i, .sc-sub i {
  display: inline-block; width: calc(var(--sw) * .014); height: calc(var(--sw) * .014);
  background: var(--frame); transform: rotate(45deg);
}
.sc-label {
  display: flex; justify-content: center;
  margin-top: calc(var(--sw) * .03);
  font-family: var(--serif); font-weight: 800; line-height: 1;
  font-size: calc(var(--sw) * .2); letter-spacing: .06em;
  color: var(--fc, var(--shu));
}
.sc-label[data-len="1"] { font-size: calc(var(--sw) * .23); }
.sc-label[data-len="3"] { font-size: calc(var(--sw) * .17); letter-spacing: .02em; }
.sc-label .ch { display: inline-block; opacity: 0; }

.sc-mid { display: grid; place-items: center; }
.sc-chara-box { width: 100%; aspect-ratio: 2 / 1; }
.sc-chara {
  display: block; width: 100%; height: 100%;
  object-fit: var(--fit, contain); object-position: var(--focus, 50% 50%);
  opacity: 0;
}

.sc-bot { display: flex; flex-direction: column; align-items: center; padding-top: calc(var(--sw) * .025); }
.sc-sub {
  display: flex; align-items: center; gap: calc(var(--sw) * .025);
  font-size: calc(var(--sw) * .031); letter-spacing: .18em; color: var(--ink-3); line-height: 1.4;
  opacity: 0;
}
.sc-words {
  margin-top: calc(var(--sw) * .03);
  padding: 0 calc(var(--sw) * .13);
  font-family: var(--serif); font-weight: 600;
  font-size: calc(var(--sw) * .05); line-height: 1.7;
  text-align: center; text-wrap: balance;
  opacity: 0;
}
.sc-seal {
  position: absolute; right: calc(var(--sw) * .085); bottom: calc(var(--sw) * .085);
  width: calc(var(--sw) * .1); height: calc(var(--sw) * .1);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--sw) * .006);
  writing-mode: vertical-rl;
  border-radius: calc(var(--sw) * .012);
  background: rgba(217, 71, 43, .9); color: #fbf3df;
  font-family: var(--serif); font-weight: 700; font-size: calc(var(--sw) * .027); line-height: 1.05;
  opacity: 0; transform: rotate(-6deg);
}

/* 開いたあとの登場アニメーション */
.slip.is-revealed .ch { animation: stamp .55s var(--ease-back) both; animation-delay: calc(var(--i) * 110ms); }
.slip.is-revealed .sc-chara { animation: charaPop .75s var(--ease-back) .28s both, charaFloat 4.2s ease-in-out 1.2s infinite; }
.slip.is-revealed .sc-sub { animation: fadeUp .6s ease .55s both; }
.slip.is-revealed .sc-words { animation: fadeUp .7s ease .7s both; }
.slip.is-revealed .sc-seal { animation: sealStamp .45s var(--ease-back) 1s both; }

/* 大吉：きらりと光る文字 */
.slip[data-effect="great"] .ch { text-shadow: 0 0 calc(var(--sw) * .03) rgba(255, 210, 120, .7); }

/* 超大吉：金色の文字 */
.slip[data-effect="legend"] .ch {
  background-image: linear-gradient(100deg, #b98a30 0%, #d7a944 33%, #f1d27c 45%, #fff6d2 50%, #f1d27c 55%, #d7a944 67%, #b98a30 100%);
  background-size: 300% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 calc(var(--sw) * .018) rgba(245, 185, 70, .65));
  padding: 0 .02em;
}
.slip.is-revealed[data-effect="legend"] .ch {
  animation: goldDrop .8s var(--ease-back) both, sheen 3.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * 170ms + .1s), calc(1.3s + var(--i) * .12s);
}
.slip.is-revealed[data-effect="legend"] .sc-chara { animation: charaPop .9s var(--ease-back) .55s both, charaFloat 3.6s ease-in-out 1.6s infinite; }

/* 凶・大凶 */
.slip.is-revealed[data-effect="abyss"] .ch { animation: heavyDrop .85s cubic-bezier(.3, 1.3, .5, 1) both; animation-delay: calc(var(--i) * 220ms + .15s); }
.slip.is-revealed[data-effect="abyss"] .sc-chara { animation: charaDroop 1.2s ease .7s both, charaFloat 5s ease-in-out 2s infinite; }
.slip.is-revealed[data-effect="gloom"] .sc-chara { animation: charaDroop 1s ease .35s both, charaFloat 5s ease-in-out 1.6s infinite; }

/* スキップ時は素早く */
.slip.is-quick .ch, .slip.is-quick .sc-sub, .slip.is-quick .sc-words, .slip.is-quick .sc-seal {
  animation-duration: .35s !important; animation-delay: 0s !important;
}
.slip.is-quick[data-effect="legend"] .ch { animation-delay: 0s, 1s !important; animation-duration: .35s, 3.2s !important; }
.slip.is-quick .sc-chara { animation-delay: .05s, 1s !important; }

/* 前向きメッセージ */
.cheer {
  position: absolute; z-index: 8;
  top: calc(50% - var(--sh) * .2 - 14px);
  right: calc(50% - var(--sw) / 2 - 8px);
  max-width: calc(var(--sw) * .64);
  padding: 10px 14px; border-radius: 16px;
  background: #fffdf8; border: 1.5px solid var(--shu-soft);
  font-size: 13.5px; line-height: 1.6; font-weight: 600; color: var(--ink);
  box-shadow: 0 10px 24px -10px rgba(60, 40, 20, .35);
  transform-origin: 30% 100%;
}
.cheer::after {
  content: ""; position: absolute; left: 26px; bottom: -8px; width: 14px; height: 14px;
  background: #fffdf8; border-right: 1.5px solid var(--shu-soft); border-bottom: 1.5px solid var(--shu-soft);
  transform: rotate(45deg);
}
.stage[data-fx="gloom"] .cheer { right: auto; left: calc(50% - var(--sw) / 2 - 8px); transform-origin: 70% 100%; }
.stage[data-fx="gloom"] .cheer::after { left: auto; right: 26px; }
.cheer.is-in { animation: cheerIn .65s var(--ease-back) both; }

/* ステージ下 */
.stage-meta {
  min-height: 24px; margin-top: 6px;
  text-align: center; font-size: 13px; color: var(--ink-2); letter-spacing: .04em;
}
.stage-meta b { font-family: var(--serif); font-size: 15px; color: var(--ink); }
.meta-preview {
  display: block; width: fit-content; margin: 0 auto 4px; padding: 1px 10px; border-radius: 4px;
  background: rgba(43, 38, 34, .08); font-size: 11.5px;
}
.meta-jump {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border: none; border-radius: 999px; background: rgba(255, 253, 248, .7);
  font-size: 13px; color: var(--ink-2);
  animation: fadeIn .5s ease 1s both;
}
.meta-jump span { display: inline-block; animation: nudge 1.6s ease-in-out infinite; }

.shared-banner {
  display: flex; align-items: center; gap: 10px;
  max-width: 560px; margin: 6px auto 4px; padding: 8px 8px 8px 14px;
  border-radius: 12px; background: rgba(255, 253, 248, .9); border: 1px solid var(--line);
  border-left: 3px solid var(--shu);
  font-size: 13px; color: var(--ink-2); line-height: 1.5;
  animation: fadeUp .5s ease both;
}
.shared-banner p { flex: 1; }
.shared-close {
  flex: none; width: 28px; height: 28px; border-radius: 50%; border: none; background: transparent;
  font-size: 18px; line-height: 1; color: var(--ink-3);
}

/* =========================================================
   結果
   ========================================================= */
.result { position: relative; z-index: 3; max-width: 640px; margin: 22px auto 0; padding: 0 16px; }
.result.is-in .result-card { animation: riseIn .75s var(--ease-out) .1s both; }
.result.is-in .share { animation: riseIn .75s var(--ease-out) .2s both; }
.result.is-in .result-actions { animation: riseIn .75s var(--ease-out) .28s both; }
.result.is-in .pr { animation: riseIn .75s var(--ease-out) .36s both; }
.result.is-leaving { opacity: 0; transition: opacity .25s ease; }

.result-card {
  position: relative;
  padding: 28px 22px 26px; border-radius: 20px;
  background: var(--white); border: 1px solid var(--line);
  box-shadow: 0 24px 50px -28px rgba(80, 50, 20, .35);
}
.result-card::before {
  content: ""; position: absolute; left: 28px; right: 28px; top: -1px; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--fc, var(--shu));
}
.result[data-effect="legend"] .result-card { border-color: rgba(201, 161, 74, .55); box-shadow: 0 0 0 4px rgba(241, 220, 159, .35), 0 24px 50px -28px rgba(120, 80, 20, .45); }
.result[data-effect="legend"] .result-card::before { background: var(--gold); }

.result-head { text-align: center; padding-bottom: 18px; border-bottom: 1px dashed var(--line); }
.result-date { font-size: 12.5px; color: var(--ink-3); letter-spacing: .12em; }
.result-title { margin: 6px 0 6px; font-family: var(--serif); line-height: 1.15; outline: none; }
.rt-label { display: block; font-size: 42px; font-weight: 800; letter-spacing: .14em; color: var(--fc, var(--shu)); }
.result[data-effect="legend"] .rt-label {
  background: linear-gradient(180deg, #e8c46a, #b88628);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
}
.rt-reading { display: block; margin-top: 4px; font-family: var(--sans); font-size: 11.5px; font-weight: 400; letter-spacing: .32em; color: var(--ink-3); }
.result-rarity {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px;
  font-size: 12.5px; color: var(--ink-2);
}
.result-rarity .sep { color: var(--ink-3); }
.badge { font-size: 11px; font-weight: 700; letter-spacing: .1em; padding: 2px 9px; border-radius: 999px; color: #fff; }
.badge-gold { background: var(--gold); }
.badge-ai { background: var(--ai); }

.result-block { padding: 18px 0; border-bottom: 1px dashed var(--line); }
.rb-title {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-family: var(--serif); font-size: 15px; font-weight: 700; letter-spacing: .14em;
}
.rb-title::before { content: ""; width: 6px; height: 6px; background: var(--shu); transform: rotate(45deg); flex: none; }
.result-overall p { font-size: 15px; line-height: 1.95; }

.result-cats { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 18px 0; border-bottom: 1px dashed var(--line); }
.cat { padding: 12px 14px; border-radius: 12px; background: #faf6ee; }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.cat h3 { font-family: var(--serif); font-size: 14px; font-weight: 700; letter-spacing: .1em; }
.stars { font-size: 14px; letter-spacing: 1px; white-space: nowrap; }
.stars .on { color: var(--gold); }
.stars .off { color: rgba(43, 38, 34, .13); }
.cat p { font-size: 13.5px; line-height: 1.75; color: var(--ink-2); }

.result-lucky { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px 0; border-bottom: 1px dashed var(--line); }
.lucky { padding: 12px 8px; border-radius: 12px; border: 1px solid var(--line); text-align: center; }
.lucky-k { display: block; margin-bottom: 6px; font-size: 11.5px; letter-spacing: .14em; color: var(--ink-3); }
.lucky-v { display: inline-flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 700; font-size: 16px; line-height: 1.4; }
.swatch { width: 18px; height: 18px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.lucky-ic { width: 20px; height: 20px; flex: none; color: var(--shu); }

.result-words { padding-bottom: 0; border-bottom: none; text-align: center; }
.result-words .rb-title { justify-content: center; }
.result-words p { font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.7; }

/* シェア */
.share { margin-top: 22px; text-align: center; }
.share-title {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px;
  font-size: 12.5px; letter-spacing: .18em; color: var(--ink-3);
}
.share-title::before, .share-title::after { content: ""; width: 28px; height: 1px; background: var(--line); }
.share-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
.share-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 10px; border-radius: 12px;
  background: var(--white); border: 1px solid var(--line);
  font-size: 13.5px;
  transition: transform .15s var(--ease-out), box-shadow .15s ease, border-color .15s ease;
}
.share-btn svg { width: 18px; height: 18px; flex: none; }
.share-btn:hover { transform: translateY(-2px); border-color: rgba(217, 71, 43, .35); box-shadow: 0 10px 18px -12px rgba(80, 50, 20, .4); }
.share-btn:active { transform: scale(.95); }
.share-btn:active svg { animation: popIn .35s var(--ease-back); }

.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.again-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 15px 36px; border: none; border-radius: 999px;
  background: var(--shu); color: #fffaf1; text-decoration: none;
  font-family: var(--serif); font-weight: 800; font-size: 16px; letter-spacing: .16em; line-height: 1;
  box-shadow: 0 4px 0 var(--shu-deep), 0 12px 22px -10px rgba(177, 54, 28, .55);
  transition: transform .12s ease, box-shadow .12s ease;
}
.again-btn:hover { transform: translateY(-1px); }
.again-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shu-deep); }
.again-btn.is-disabled { opacity: .5; pointer-events: none; }
.ghost-btn {
  padding: 13px 24px; border-radius: 999px;
  border: 1px solid rgba(43, 38, 34, .2); background: rgba(255, 253, 248, .5);
  font-size: 14px; color: var(--ink);
  transition: transform .15s ease, background-color .15s ease;
}
.ghost-btn:hover { background: #fff; }
.ghost-btn:active { transform: scale(.95); }

/* 商品紹介（PR） */
.pr {
  margin: 34px auto 0; padding: 14px 14px 12px; border-radius: 16px;
  background: rgba(255, 253, 248, .66); border: 1px solid var(--line);
}
.pr-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; letter-spacing: .1em; color: var(--ink-3); }
.pr-badge {
  padding: 1px 6px; border-radius: 4px; border: 1px solid currentColor;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--ink-2);
}
.pr-list { display: grid; gap: 10px; }
.pr-card {
  display: flex; align-items: center; gap: 12px; padding: 10px;
  border-radius: 12px; background: #fff; border: 1px solid var(--line);
  text-decoration: none;
  transition: transform .15s var(--ease-out), box-shadow .15s ease;
}
.pr-card:hover { transform: translateY(-2px); box-shadow: 0 12px 22px -14px rgba(80, 50, 20, .4); }
.pr-card img { width: 88px; height: 88px; flex: none; border-radius: 8px; object-fit: cover; background: #f3ede1; }
.pr-body { min-width: 0; }
.pr-why { font-size: 11.5px; color: var(--shu); }
.pr-name { margin: 2px 0; font-size: 14.5px; font-weight: 700; line-height: 1.5; }
.pr-desc { font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.pr-link { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.pr-embed { text-align: center; }
.pr-embed .pr-why { margin-bottom: 8px; }
.pr-frame {
  position: relative; width: 100%; max-width: 375px; height: 162px; margin: 0 auto;
  border-radius: 12px; overflow: hidden; background: #fff;
}
.pr-frame::before {
  content: "SUZURIの商品を読み込み中…"; position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 12px; color: var(--ink-3);
}
.pr-frame.is-loaded::before { display: none; }
.pr-frame iframe { position: relative; display: block; width: 100%; height: 100%; border: 0; }
.pr-frame-link { display: inline-block; margin-top: 6px; font-size: 11.5px; color: var(--ink-3); text-underline-offset: 3px; }
.pr-note { margin-top: 10px; font-size: 11px; line-height: 1.6; color: var(--ink-3); }
.pr-shop { margin-top: 6px; font-size: 12.5px; text-align: right; }

/* =========================================================
   コレクション
   ========================================================= */
.collection { position: relative; z-index: 3; max-width: 640px; margin: 44px auto 0; padding: 0 16px; }
.col-head { display: flex; align-items: baseline; justify-content: space-between; }
.col-title { font-family: var(--serif); font-size: 17px; letter-spacing: .14em; }
.col-progress { font-size: 13px; color: var(--ink-2); }
.col-progress b { font-family: var(--serif); font-size: 20px; color: var(--shu); }
.progress { height: 4px; margin: 10px 0 14px; border-radius: 4px; background: rgba(43, 38, 34, .08); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--shu); border-radius: 4px; transition: width .9s var(--ease-out); }
.collection.is-complete .progress span { background: var(--gold); }

.col-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.col-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 4px; border-radius: 12px; text-align: center;
  background: var(--white); border: 1px solid var(--line);
}
.col-item.is-got[data-fx="legend"] { border-color: rgba(201, 161, 74, .7); box-shadow: 0 0 0 3px rgba(241, 220, 159, .35); }
.ci-img { position: relative; width: 100%; aspect-ratio: 2 / 1; }
.ci-img img { display: block; width: 100%; height: 100%; }
.col-item.is-locked img { filter: brightness(0); opacity: .09; }
.ci-q {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--serif); font-size: 18px; font-weight: 800; color: rgba(43, 38, 34, .3);
}
.ci-label { font-family: var(--serif); font-size: 14px; font-weight: 800; letter-spacing: .06em; color: var(--fc); line-height: 1.5; }
.col-item.is-locked .ci-label { color: var(--ink-3); }
.ci-count { font-size: 10.5px; color: var(--ink-3); }
.col-more { display: block; margin: 16px auto 0; }

/* =========================================================
   フッター
   ========================================================= */
.site-footer {
  position: relative; z-index: 3;
  margin-top: 64px; padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  text-align: center; font-size: 12px; line-height: 1.8; color: var(--ink-3);
}
.footer-note { max-width: 560px; margin: 0 auto 6px; }
.footer-nav { display: flex; justify-content: center; gap: 20px; margin: 14px 0 8px; }
.footer-nav a { color: var(--ink-2); text-underline-offset: 3px; }
.copyright { letter-spacing: .08em; }

/* =========================================================
   通知
   ========================================================= */
.toasts {
  position: fixed; z-index: 90; left: 50%; top: calc(12px + env(safe-area-inset-top));
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100vw - 24px); pointer-events: none;
}
.toast {
  background: var(--white); border-radius: 14px;
  box-shadow: 0 14px 34px -10px rgba(60, 40, 20, .35);
  animation: toastIn .5s var(--ease-back) both;
}
.toast.is-out { animation: toastOut .4s ease forwards; }
.toast-mini { padding: 10px 18px; border: 1px solid var(--line); font-size: 13px; }
.toast-ach {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
  min-width: 250px; padding: 10px 20px 10px 10px;
  border: 1px solid rgba(201, 161, 74, .65);
}
.toast-ach::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, rgba(255, 236, 180, 0) 35%, rgba(255, 236, 180, .9) 50%, rgba(255, 236, 180, 0) 65%);
  transform: translateX(-110%);
  animation: shineSweep 1.1s ease-out .4s forwards;
}
.toast-medal { width: 42px; height: 42px; flex: none; color: var(--gold); animation: medalSpin .9s var(--ease-back) .1s both; }
.toast-medal svg { display: block; width: 100%; height: 100%; }
.toast-body { position: relative; z-index: 1; }
.toast-k { display: block; font-size: 10.5px; letter-spacing: .28em; color: var(--gold-deep); }
.toast-title { display: block; font-family: var(--serif); font-size: 15px; font-weight: 800; line-height: 1.4; }
.toast-desc { display: block; font-size: 11.5px; color: var(--ink-2); }

/* =========================================================
   ダイアログ
   ========================================================= */
.dialog {
  width: min(600px, calc(100vw - 24px)); max-height: min(88vh, 820px);
  padding: 0; border: none; border-radius: 20px; overflow: hidden;
  background: var(--kinari); background-image: var(--washi); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(40, 25, 10, .5);
}
.dialog[open] { animation: dialogIn .32s var(--ease-back) both; }
.dialog.is-closing { animation: dialogOut .18s ease forwards; }
.dialog::backdrop { background: rgba(35, 28, 20, .45); }
.dialog[open]::backdrop { animation: fadeIn .3s ease; }
.dialog-inner { display: flex; flex-direction: column; max-height: inherit; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px; }
.dialog-head h2 { font-family: var(--serif); font-size: 19px; letter-spacing: .2em; }
.dialog-close {
  width: 36px; height: 36px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: transparent;
  font-size: 20px; line-height: 1; color: var(--ink-2);
  transition: transform .15s ease, background-color .15s ease;
}
.dialog-close:hover { background: #fff; }
.dialog-close:active { transform: scale(.9); }
.dialog-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px 20px 20px; }
.dialog-foot { display: flex; justify-content: center; padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

.tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.tab {
  position: relative; flex: 1; padding: 10px 6px 12px;
  border: none; background: none;
  font-family: var(--serif); font-size: 14px; font-weight: 700; letter-spacing: .1em; color: var(--ink-3);
  transition: color .2s ease;
}
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 2px;
  border-radius: 2px; background: var(--shu); animation: growX .3s var(--ease-out);
}
.tab-panel { padding-top: 16px; animation: fadeIn .25s ease; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.stat { padding: 10px 6px; border-radius: 12px; background: var(--white); border: 1px solid var(--line); text-align: center; }
.stat-k { display: block; font-size: 11px; letter-spacing: .1em; color: var(--ink-3); }
.stat-v { font-size: 12px; color: var(--ink-2); }
.stat-v b { margin-right: 2px; font-family: var(--serif); font-size: 24px; color: var(--ink); }
.stat-gold b { color: var(--gold-deep); }
.stat-bar { grid-column: 1 / -1; }
.stat-bar .bar { height: 6px; border-radius: 6px; background: rgba(43, 38, 34, .08); overflow: hidden; }
.stat-bar .bar span { display: block; height: 100%; border-radius: 6px; background: var(--shu); }
.stat-bar.is-complete .bar span { background: var(--gold); }
.stat-bar em { display: block; margin-top: 4px; font-size: 12px; font-style: normal; text-align: center; color: var(--ink-2); }

.book-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.col-item.is-big { padding: 10px 8px; }
.col-item.is-big .ci-label { font-size: 16px; }
.ci-rate { width: 100%; margin-top: 6px; }
.ci-rate-bar { display: block; height: 4px; border-radius: 4px; background: rgba(43, 38, 34, .08); overflow: hidden; }
.ci-rate-bar i { display: block; height: 100%; background: var(--fc); }
.ci-rate-t { display: block; margin-top: 3px; font-size: 11px; color: var(--ink-2); }
.ci-rate-t small { font-size: 10px; color: var(--ink-3); }

.ach-summary { margin-bottom: 10px; font-size: 13px; color: var(--ink-2); text-align: center; }
.ach-list { display: grid; gap: 8px; }
.ach {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 14px 10px 10px; border-radius: 12px;
  background: var(--white); border: 1px solid var(--line);
}
.ach.is-on { border-color: rgba(201, 161, 74, .5); background: #fffcf1; }
.ach-medal { width: 40px; height: 40px; color: var(--gold); }
.ach-medal svg { display: block; width: 100%; height: 100%; }
.ach.is-off .ach-medal { color: rgba(43, 38, 34, .13); }
.ach-title { display: block; font-family: var(--serif); font-size: 14.5px; font-weight: 800; line-height: 1.4; }
.ach.is-off .ach-title { color: var(--ink-3); }
.ach-desc { display: block; font-size: 12px; color: var(--ink-2); }
.ach-date { font-size: 11px; color: var(--ink-3); white-space: nowrap; }

.hist-list { display: grid; gap: 6px; }
.hist {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--white); border: 1px solid var(--line);
}
.hist-chip {
  flex: none; min-width: 64px; padding: 6px; border-radius: 8px;
  border: 1.5px solid var(--fc); color: var(--fc);
  font-family: var(--serif); font-size: 15px; font-weight: 800; text-align: center; letter-spacing: .06em; line-height: 1.3;
}
.hist-chip[data-effect="legend"] { background: #fbf1d6; border-color: var(--gold); color: var(--gold-deep); }
.hist-body { min-width: 0; }
.hist-meta { display: block; font-size: 11.5px; color: var(--ink-3); }
.hist-meta .sep { margin: 0 4px; }
.hist-words { display: block; overflow: hidden; font-size: 13px; color: var(--ink-2); text-overflow: ellipsis; white-space: nowrap; }
.hist-empty { padding: 30px 0; font-size: 13px; color: var(--ink-3); text-align: center; }

.danger-link {
  padding: 6px 10px; border: none; background: none;
  font-size: 13px; color: var(--shu-deep); text-decoration: underline; text-underline-offset: 3px;
}
.confirm { width: min(420px, calc(100vw - 32px)); }
.confirm .dialog-inner { padding: 24px 22px 20px; }
.confirm h2 { margin-bottom: 8px; font-family: var(--serif); font-size: 17px; letter-spacing: .06em; }
.confirm p { font-size: 13.5px; line-height: 1.8; color: var(--ink-2); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.danger-btn {
  padding: 12px 22px; border: none; border-radius: 999px;
  background: var(--shu-deep); color: #fff; font-size: 14px; font-weight: 700;
  transition: transform .12s ease;
}
.danger-btn:active { transform: scale(.95); }

.share-body { display: flex; flex-direction: column; align-items: center; }
.share-preview { display: grid; place-items: center; width: 100%; min-height: 200px; }
.share-preview img {
  display: block; width: auto; max-width: 100%; height: auto; max-height: 58vh;
  border-radius: 10px; box-shadow: 0 12px 30px -12px rgba(60, 40, 20, .4);
  animation: fadeUp .4s ease both;
}
.share-loading { font-size: 13px; color: var(--ink-3); }
.share-hint { margin-top: 12px; font-size: 11.5px; color: var(--ink-3); text-align: center; }

.noscript { position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; padding: 12px; background: var(--ink); color: #fff; text-align: center; font-size: 13px; }

/* =========================================================
   レスポンシブ
   ========================================================= */
@media (min-width: 560px) {
  .result-cats { grid-template-columns: 1fr 1fr; }
  .result-card { padding: 32px 30px 28px; }
  .book-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 760px) {
  .collection { max-width: 880px; }
  .col-grid { grid-template-columns: repeat(8, 1fr); }
  .stage-lead { font-size: 15px; top: 10px; }
}
@media (max-width: 600px) {
  .dialog.book, .dialog.share-dialog {
    width: 100%; max-width: 100%; max-height: 90vh;
    margin: auto 0 0; border-radius: 22px 22px 0 0;
  }
  .dialog.book[open], .dialog.share-dialog[open] { animation: sheetIn .38s var(--ease-out) both; }
  .dialog.book.is-closing, .dialog.share-dialog.is-closing { animation: sheetOut .2s ease forwards; }
}
@media (max-width: 430px) {
  .brand { gap: 8px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-name { font-size: 17px; letter-spacing: .06em; }
  .pill-btn span:not(.dot) { display: none; }
  .pill-btn { width: 40px; padding: 0; justify-content: center; }
}
@media (max-width: 380px) {
  .draw-btn { min-width: 210px; padding: 17px 30px 17px 36px; font-size: 17px; }
  .result-card { padding: 24px 16px 22px; }
  .cheer { font-size: 12.5px; }
}
@media (max-height: 640px) {
  .box-wrap { bottom: 92px; }
  .draw-area { bottom: 18px; }
}

/* =========================================================
   キーフレーム
   ========================================================= */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4.5%); } }
@keyframes shadowPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.86); opacity: .7; } }
@keyframes swim {
  0%, 100% { transform: translate(0, 0) rotate(-2deg); }
  25% { transform: translate(4%, -7%) rotate(1.5deg); }
  50% { transform: translate(8%, 0) rotate(3deg); }
  75% { transform: translate(3%, 6%) rotate(0deg); }
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes btnShine { 0% { left: -60%; } 22%, 100% { left: 130%; } }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes goldPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }
@keyframes glint { 0% { background-position: 0 100%; } 60%, 100% { background-position: 0 -100%; } }
@keyframes stamp {
  0% { opacity: 0; transform: scale(1.7); filter: blur(4px); }
  60% { opacity: 1; transform: scale(.94); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
@keyframes goldDrop {
  0% { opacity: 0; transform: translateY(-55%) scale(1.5) rotate(-8deg); }
  60% { opacity: 1; transform: translateY(4%) scale(.96) rotate(1deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes sheen { 0% { background-position: 100% 0; } 55%, 100% { background-position: 0% 0; } }
@keyframes heavyDrop {
  0% { opacity: 0; transform: translateY(-80%); }
  55% { opacity: 1; transform: translateY(3%) scale(1.1, .84); }
  75% { transform: translateY(-4%) scale(.97, 1.04); }
  100% { opacity: 1; transform: none; }
}
@keyframes charaPop {
  0% { opacity: 0; transform: translateY(10%) scale(.7); }
  65% { opacity: 1; transform: translateY(-2%) scale(1.04); }
  100% { opacity: 1; transform: none; }
}
@keyframes charaDroop {
  0% { opacity: 0; transform: translateY(-8%); }
  100% { opacity: 1; transform: none; }
}
@keyframes charaFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5%); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sealStamp {
  0% { opacity: 0; transform: rotate(-6deg) scale(1.8); }
  70% { opacity: .95; transform: rotate(-6deg) scale(.92); }
  100% { opacity: .9; transform: rotate(-6deg) scale(1); }
}
@keyframes cheerIn {
  0% { opacity: 0; transform: translateY(10px) scale(.6); }
  100% { opacity: 1; transform: none; }
}
@keyframes riseIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(.96); } }
@keyframes shineSweep { to { transform: translateX(110%); } }
@keyframes medalSpin { from { transform: perspective(200px) rotateY(-540deg) scale(.4); } to { transform: perspective(200px) rotateY(0) scale(1); } }
@keyframes dialogIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes dialogOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetOut { to { transform: translateY(100%); } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* =========================================================
   動きを減らす設定
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .stage-glow, .rays, .rainbow, .veil { transition-duration: .4s !important; }
}

/* =========================================================
   プライバシーポリシー・お問い合わせ
   ========================================================= */
.doc { position: relative; z-index: 3; max-width: 720px; margin: 18px auto 0; padding: 0 16px; }
.doc-card {
  padding: 32px 24px 30px; border-radius: 20px;
  background: var(--white); border: 1px solid var(--line);
  box-shadow: 0 24px 50px -30px rgba(80, 50, 20, .35);
}
.doc h1 { font-family: var(--serif); font-size: 24px; letter-spacing: .14em; margin-bottom: 14px; }
.doc h2 {
  display: flex; align-items: center; gap: 8px;
  margin: 26px 0 8px; font-family: var(--serif); font-size: 16px; letter-spacing: .08em;
}
.doc h2::before { content: ""; width: 6px; height: 6px; flex: none; background: var(--shu); transform: rotate(45deg); }
.doc p, .doc li { font-size: 14px; line-height: 1.95; color: var(--ink-2); }
.doc p + p { margin-top: 8px; }
.doc strong { color: var(--ink); }
.doc-lead { color: var(--ink) !important; }
.doc-list { display: grid; gap: 6px; }
.doc-list li { position: relative; padding-left: 1.1em; }
.doc-list li::before { content: "・"; position: absolute; left: 0; }
.doc-date { margin-top: 28px !important; font-size: 12.5px !important; color: var(--ink-3) !important; text-align: right; }
.contact-box {
  margin: 22px 0 6px; padding: 20px; border-radius: 14px; text-align: center;
  background: #faf6ee; border: 1px dashed rgba(217, 71, 43, .35);
}
.contact-label { font-size: 12px !important; letter-spacing: .18em; color: var(--ink-3) !important; }
.contact-value { margin-top: 8px !important; font-size: 15px !important; color: var(--ink) !important; }
.site-header .pill-btn { text-decoration: none; padding: 0 16px; }
@media (max-width: 430px) {
  .site-header .pill-btn { width: auto; padding: 0 12px; font-size: 12.5px; }
}
