/* wadai.me/mogmog — シールバイキング mogmog の特設ページ（wadai.me 本体の CSS とは独立） */
:root {
  --paper: #fbf6ea;
  --paper-2: #f3ecdb;
  --ink: #23463f;
  --ink-soft: #5d7a72;
  --teal: #3e8b7e;
  --teal-soft: #64a599;
  --leaf: #cfe6b8;
  --line: rgba(35, 70, 63, .14);
  --card: #fffdf7;
  --shadow: 35, 50, 45;
  /* Adobe Fonts（キット uqx8sca）。ウェイトは 600 だけを使う（キットにあるのは 100 と 600） */
  --font: "nitalago-rera", "Hiragino Maru Gothic ProN", "Hiragino Sans", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1d2624; --paper-2: #232e2b; --ink: #eef4ef; --ink-soft: #a9bdb6;
    --teal: #7cc3b5; --teal-soft: #5aa496; --leaf: #2f4a3a; --line: rgba(238, 244, 239, .14);
    --card: #26312e; --shadow: 0, 0, 0; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1d2624; --paper-2: #232e2b; --ink: #eef4ef; --ink-soft: #a9bdb6;
  --teal: #7cc3b5; --teal-soft: #5aa496; --leaf: #2f4a3a; --line: rgba(238, 244, 239, .14);
  --card: #26312e; --shadow: 0, 0, 0; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-weight: 600;
  line-height: 1.7; overflow-x: hidden;
  /* コピーガード: 選択・長押しメニュー・ドラッグ保存を止める */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
canvas { display: block; -webkit-user-drag: none; }
button { font: inherit; color: inherit; }
a { color: var(--teal); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- ヒーロー ---------- */
.hero {
  position: relative; min-height: min(100svh, 860px); display: grid; place-items: center;
  padding: 72px 16px 56px; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(circle at 1px 1px, var(--line) 1.2px, transparent 1.6px) 0 0 / 22px 22px,
    var(--paper);
}
.hero::after { /* 下端をなじませる */
  content: ""; position: absolute; inset: auto 0 0; height: 120px; z-index: -1;
  background: linear-gradient(transparent, var(--paper));
}
.hero-inner { position: relative; z-index: 2; text-align: center; pointer-events: none; }
.hero-inner a { pointer-events: auto; }
.logo {
  margin: 0 auto; width: min(78vw, 520px); aspect-ratio: 539 / 161; background: var(--teal);
  -webkit-mask: url(/mogmog/logo.png) center / contain no-repeat; mask: url(/mogmog/logo.png) center / contain no-repeat;
  animation: logo-in .9s cubic-bezier(.2, .9, .3, 1.25) both;
}
.tagline { margin: 22px 0 4px; font-size: clamp(20px, 4.4vw, 30px); font-weight: 600; letter-spacing: .08em; animation: rise .7s .25s both; }
.lead { margin: 0; color: var(--ink-soft); font-size: clamp(14px, 3.4vw, 17px); animation: rise .7s .4s both; }
.lead b { color: var(--teal); font-weight: 600; }
.scroll-cue {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 36px;
  color: var(--ink-soft); text-decoration: none; font-size: 13px; letter-spacing: .2em; animation: rise .7s .55s both;
}
.scroll-cue svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; animation: bob 2s ease-in-out infinite; }
@keyframes logo-in { from { opacity: 0; transform: scale(.8) rotate(-4deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes bob { 50% { transform: translateY(5px); } }

/* ---------- 見出し ---------- */
section { padding: 56px 16px; max-width: 1080px; margin: 0 auto; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: clamp(22px, 5vw, 30px); font-weight: 600; line-height: 1.2; letter-spacing: .06em; }
.section-head .en { display: block; font-size: 12px; letter-spacing: .3em; color: var(--teal); font-weight: 600; text-transform: uppercase; margin-bottom: 6px; }
.count { margin: 0; color: var(--ink-soft); font-size: 14px; white-space: nowrap; }
#book-bonus { display: block; text-align: right; font-size: 12px; line-height: 1.4; color: var(--teal); }
#book-bonus:empty { display: none; }
.count b { font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; margin-right: 2px; }

/* ---------- おしながき ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--card); font-weight: 600; font-size: 14px;
  transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.chip:active { transform: scale(.96); }
.chip.is-on { background: var(--teal); border-color: var(--teal); color: var(--paper); }
.dot { display: inline-block; width: 10px; height: 10px; border: 2px solid currentColor; }
.dot.round { border-radius: 50%; }
.dot.square { border-radius: 2px; }
.hint { margin: 12px 0 0; font-size: 13px; color: var(--ink-soft); }
.hint-touch { display: none; }
@media (hover: none) { .hint-mouse { display: none; } .hint-touch { display: inline; } }

.tray {
  list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 28px 18px;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}
@media (max-width: 480px) { .tray { grid-template-columns: repeat(3, 1fr); gap: 22px 10px; } }
.tray li { display: flex; flex-direction: column; align-items: center; gap: 8px; transition: opacity .3s, transform .3s; }
.tray li.is-hidden { display: none; }
.tray .item {
  position: relative; width: 100%; aspect-ratio: 1; display: grid; place-items: center; padding: 0; border: 0; background: none;
  cursor: grab; touch-action: pan-y; -webkit-tap-highlight-color: transparent; border-radius: 16px;
}
.tray .item:focus-visible { outline: 3px solid var(--teal); outline-offset: 4px; }
.tray .label { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.35; }
.tray li.is-holo .sticker .twinkles { inset: -12%; }
.tray .meta { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 600; }

/* シール（台紙の上の1枚） */
.sticker { position: relative; display: block; transform: rotate(var(--r, 0deg)); transition: transform .35s cubic-bezier(.2, .9, .3, 1.3); }
.sticker canvas { width: 100%; height: 100%; }
.sticker::after { /* つや */
  content: ""; position: absolute; inset: 0; border-radius: var(--radius); pointer-events: none; opacity: .0; transition: opacity .3s;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .55) 46%, transparent 60%) var(--sx, 120%) 0 / 260% 100% no-repeat;
}
.round { --radius: 50%; }
.square { --radius: 3%; }
/* 影はシールといっしょに回るので、回した角度（--r）のぶん逆向きにずらして、いつも画面の真下へ落とす */
.sticker .shade {
  position: absolute; inset: 0; border-radius: var(--radius); pointer-events: none;
  box-shadow: calc(sin(var(--r, 0deg)) * 1px) calc(cos(var(--r, 0deg)) * 1px) 1.5px rgba(var(--shadow), .28),
    calc(sin(var(--r, 0deg)) * 3px) calc(cos(var(--r, 0deg)) * 3px) 8px rgba(var(--shadow), .12);
}
.tray .item .sticker { width: calc(var(--mm) / 60 * 82%); aspect-ratio: 1; }
.tray .item:hover .sticker { transform: rotate(var(--r, 0deg)) translateY(-3px) scale(1.04); }
.tray .item:hover .sticker::after { opacity: 1; animation: sheen 1.1s ease-out; }
@keyframes sheen { from { background-position: 120% 0; } to { background-position: -20% 0; } }
.loading canvas { opacity: 0; }
.sticker canvas { transition: opacity .4s; }
.sticker.loading .shade { background: var(--c); opacity: .35; }

/* ---------- シール帳 ---------- */
.book {
  position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: 20px; overflow: hidden; touch-action: pan-y;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 28px 100%,
    var(--card);
  box-shadow: inset 0 0 0 1.5px var(--line), 0 18px 40px -24px rgba(var(--shadow), .45);
  transition: box-shadow .25s, transform .25s;
}
@media (max-width: 640px) { .book { aspect-ratio: 3 / 4; } }
.book.is-over { box-shadow: inset 0 0 0 3px var(--teal), 0 22px 48px -22px rgba(var(--shadow), .5); }
.book-empty {
  position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--ink-soft);
  font-weight: 600; letter-spacing: .1em; pointer-events: none; transition: opacity .3s;
}
.book.has-stickers .book-empty { opacity: 0; }
.placed { position: absolute; left: 0; top: 0; cursor: grab; touch-action: none; -webkit-tap-highlight-color: transparent; }
.placed canvas { width: 100%; height: 100%; }
.book-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.btn {
  appearance: none; border: 0; border-radius: 999px; padding: 12px 24px; cursor: pointer; font-weight: 600; font-size: 15px;
  background: var(--teal); color: var(--paper); box-shadow: 0 3px 0 rgba(var(--shadow), .25); transition: transform .12s, box-shadow .12s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(var(--shadow), .25); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn:focus-visible, .chip:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.note { margin: 14px 0 0; text-align: center; font-size: 12px; color: var(--ink-soft); }

/* ヒーローに散らばるシール */
.hero .placed { z-index: 1; touch-action: pan-y; }

/* つかんでいるシール */
.flyer { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; will-change: transform; }
.flyer canvas { width: 100%; height: 100%; }
.flyer .twinkles { inset: -18%; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }

/* ---------- フッター ---------- */
.foot { text-align: center; padding: 48px 16px 64px; color: var(--ink-soft); font-size: 12px; border-top: 1px dashed var(--line); max-width: 1080px; margin: 24px auto 0; }
.foot-logo { width: 140px; aspect-ratio: 539 / 161; margin: 0 auto 16px; background: var(--ink-soft); -webkit-mask: url(/mogmog/logo.png) center / contain no-repeat; mask: url(/mogmog/logo.png) center / contain no-repeat; }
.foot .small { margin-top: 10px; }
.wadai-logo {
  display: block; width: 132px; aspect-ratio: 2300 / 500; margin: 22px auto 0; background: var(--ink-soft); transition: background .2s;
  -webkit-mask: url(/assets/logo-black.svg) center / contain no-repeat; mask: url(/assets/logo-black.svg) center / contain no-repeat;
}
.wadai-logo:hover { background: var(--teal); }
.wadai-logo:focus-visible { outline: 3px solid var(--teal); outline-offset: 6px; }

/* ---------- キラキラシール ---------- */
.holo-shine {
  position: absolute; inset: 0; border-radius: var(--radius); pointer-events: none; mix-blend-mode: soft-light; opacity: .9;
  /* 斜めの帯ではなく、やわらかい虹色の光がゆっくり漂う */
  background: radial-gradient(circle, rgba(255, 255, 255, .9), rgba(255, 216, 107, .7) 18%, rgba(255, 122, 192, .55) 34%,
    rgba(111, 214, 255, .45) 50%, transparent 68%) 0 0 / 220% 220% no-repeat;
  animation: holo 5s ease-in-out infinite; transition: opacity .3s;
}
@keyframes holo { 0%, 100% { background-position: 10% 15%; } 33% { background-position: 90% 35%; } 66% { background-position: 35% 90%; } }
/* ごほうびのシールのフチ（虹色の光がまわる） */
@property --rim { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.rim {
  position: absolute; inset: -2.2%; padding: 2.2%; pointer-events: none; border-radius: 50%;
  background: conic-gradient(from var(--rim), #ffd86b, #ff7ac0, #b48cff, #6fd6ff, #86f7a4, #ffd86b);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, .9)) drop-shadow(0 0 10px rgba(255, 190, 230, .7));
  animation: rim 3s linear infinite; transition: opacity .3s;
}
.rim.square { border-radius: 5%; }
@keyframes rim { to { --rim: 360deg; } }
.twinkles.edge { inset: 0; }
.is-landing .rim, .is-landing .holo-shine, .is-landing .twinkles, .placed.is-holo:hover .holo-shine { opacity: 0; }
.spark {
  position: fixed; left: 0; top: 0; z-index: 55; pointer-events: none;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

/* ---------- 大きく見る ---------- */
.viewer { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; }
.viewer[hidden] { display: none; }
.viewer-backdrop { position: absolute; inset: 0; background: rgba(20, 32, 29, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .25s both; }
.viewer-body {
  position: relative; width: min(100%, 460px); background: var(--paper); border-radius: 28px; padding: 22px 20px 22px;
  display: flex; flex-direction: column; align-items: center; gap: 14px; animation: pop .35s cubic-bezier(.2, .9, .3, 1.2) both;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .4);
}
.viewer.is-closing .viewer-backdrop { animation: fade .2s reverse both; }
.viewer.is-closing .viewer-body { animation: pop .2s reverse both; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.94); } }
.viewer-stage { width: 100%; aspect-ratio: 1; display: grid; place-items: center; perspective: 900px; touch-action: none; }
.viewer-stage { cursor: grab; }
.viewer-stage.is-grabbing { cursor: grabbing; }
.viewer-card { position: relative; width: 86%; aspect-ratio: 1; transform-style: preserve-3d; will-change: transform; }
.viewer-card.small { width: 69%; }
.viewer-card .face { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: var(--radius); }
/* 影は filter ではなく box-shadow で（Safari では 3D の中の drop-shadow が四角く描かれるため） */
.viewer-card canvas { position: relative; width: 100%; height: 100%; }
.viewer-card .front::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius); pointer-events: none;
  box-shadow: 0 18px 26px -6px rgba(var(--shadow), .35), 0 4px 8px rgba(var(--shadow), .12);
}
/* 3D の中で mix-blend-mode を使うと平らにされて裏が出なくなるので、ここでは普通の重ね方にする */
.viewer-card .holo-shine { display: none; animation: none; opacity: .28; mix-blend-mode: normal; background-position: var(--mx, 50%) var(--my, 50%); filter: hue-rotate(var(--hue, 0deg)); }
.viewer-card.is-holo .holo-shine { display: block; }
.viewer-card .back {
  transform: rotateY(180deg); overflow: hidden; display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, #f3efe6 0 6px, #ece6da 6px 7px); box-shadow: 0 18px 30px -12px rgba(var(--shadow), .35), inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.viewer-card .back-logo {
  width: 58%; aspect-ratio: 539 / 161; background: #cfc6b4;
  -webkit-mask: url(/mogmog/logo.png) center / contain no-repeat; mask: url(/mogmog/logo.png) center / contain no-repeat;
}
/* キラキラシールを選んだとき（大きく見る・つかんでいる間）にまたたく星 */
.twinkles { position: absolute; inset: -8%; pointer-events: none; }
.viewer-card:not(.is-holo) .twinkles { display: none; }
.twinkles i {
  position: absolute; width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  filter: drop-shadow(0 0 2px var(--glow, #ffd86b)) drop-shadow(0 0 8px var(--glow, #ffd86b));
  animation: twinkle var(--d, 1.6s) var(--delay, 0s) ease-in-out infinite both; transform: scale(0);
}
.twinkles i::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, #fff 30%, var(--glow, #ffd86b) 75%); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); }
@keyframes twinkle { 0%, 100% { transform: scale(0) rotate(0deg); opacity: 0; } 45% { transform: scale(1) rotate(45deg); opacity: 1; } 60% { transform: scale(.85) rotate(60deg); opacity: .9; } }
.viewer-card .sheen {
  position: absolute; inset: 0; border-radius: var(--radius, 50%); pointer-events: none; opacity: .4;
  background: radial-gradient(circle at var(--mx, 30%) var(--my, 25%), rgba(255, 255, 255, .85), rgba(255, 255, 255, 0) 45%);
}
.viewer-info { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; width: 100%; gap: 8px; }
.viewer-text { text-align: center; }
.viewer-name { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: .06em; }
.viewer-meta { margin: 0; font-size: 13px; color: var(--ink-soft); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--paper-2); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.close { position: absolute; top: 12px; right: 12px; z-index: 2; }

/* ---------- 実績のポップ ---------- */
.award { position: fixed; inset: 0; z-index: 52; display: grid; place-items: center; padding: 16px; background: rgba(20, 32, 29, .4); animation: fade .25s both; }
.award[hidden] { display: none; }
.award.is-closing { animation: fade .2s reverse both; }
.award-card {
  position: relative; width: min(100%, 360px); padding: 30px 24px 24px; border-radius: 28px; text-align: center; background: var(--paper);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .45); animation: award-pop .55s cubic-bezier(.2, 1.3, .3, 1) both;
}
.award.is-closing .award-card { animation: pop .2s reverse both; }
@keyframes award-pop { from { opacity: 0; transform: scale(.6) rotate(-6deg); } }
.award-medal {
  width: 84px; height: 84px; margin: -72px auto 8px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(from 0deg, #ffd86b, #ff9fd0, #8fe0ff, #a6f5be, #ffd86b); box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .35), inset 0 0 0 5px rgba(255, 255, 255, .7);
  animation: medal 4s linear infinite;
}
.award-medal svg { width: 44px; height: 44px; fill: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .2)); animation: medal 4s linear infinite reverse; }
@keyframes medal { to { transform: rotate(360deg); } }
.award-kicker { margin: 0; font-size: 13px; letter-spacing: .3em; color: var(--teal); }
.award-title { margin: 2px 0 6px; font-size: 34px; line-height: 1.3; letter-spacing: .08em; color: var(--ink); }
.award-text { margin: 0; font-size: 15px; }
.award-sub { margin: 4px 0 18px; font-size: 13px; color: var(--ink-soft); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60; transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  transition: opacity .25s, transform .25s; pointer-events: none; white-space: nowrap;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* 印刷はさせない */
.print-guard { display: none; }
@media print {
  body > *:not(.print-guard) { display: none !important; }
  .print-guard { display: block; padding: 40vh 0; text-align: center; font: 600 18px var(--font); }
}
