:root {
  --red: #e60033;
  --red-deep: #a8001f;
  --red-dark: #5c0012;
  --pink: #ff7aa2;
  --pink-pale: #ffe3ec;
  --pink-text: #d4386a;
  --cream: #fff7ef;
  --yellow: #ffe24a;
  --gold: #f5c542;
  --ink: #3b0614;
  --white: #fff;
  --shadow: 0 6px 0 var(--red-deep);
  --radius: 22px;
  --pop: "Mochiy Pop One", "Zen Maru Gothic", sans-serif;
  --heading: "Darumadrop One", "Mochiy Pop One", sans-serif;
  --body: "Mochiy Pop One", "Hiragino Maru Gothic ProN", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-weight: 400;
  font-synthesis: none; /* モッチーポップは1ウェイトなので擬似太字を出さない */
  color: var(--ink);
  background: linear-gradient(180deg, #fff4f1 0%, #ffd9e4 100%) fixed;
  overflow-x: hidden;
  min-height: 100vh;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }

/* ---------- 3D背景 ---------- */
.bg3d { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0; transition: opacity 1s; }
.bg3d.is-on { opacity: 1; }
.bg-fallback {
  position: fixed; inset: -50%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(circle, rgba(255,122,162,.18) 2px, transparent 3px) 0 0 / 28px 28px,
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,.45) 0 7deg, transparent 7deg 15deg);
  animation: rotateBurst 90s linear infinite;
}
main, .site-header, .site-footer { position: relative; z-index: 1; }

/* ---------- ローダー ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: var(--red); color: #fff; transition: opacity .6s, visibility .6s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader-wata { width: 120px; animation: bounce .5s cubic-bezier(.5,0,.5,1) infinite alternate; }
.loader-wata img { filter: drop-shadow(0 8px 0 rgba(0,0,0,.2)); animation: squish .5s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.loader-text { width: 110px; filter: invert(1); animation: wobble 1.6s ease-in-out infinite; }

/* ---------- ヘッダー ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 247, 239, .78);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 3px dotted var(--pink);
}
.logo { text-decoration: none; display: flex; flex-direction: column; line-height: 1; }
.logo-main {
  font-family: var(--pop); font-size: 22px; color: var(--red);
  -webkit-text-stroke: 1px var(--red-deep);
  text-shadow: 2px 2px 0 var(--yellow);
}
.logo-sub { font-size: 10px; letter-spacing: .35em; color: var(--red-deep); margin-top: 4px; }
.help-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--red); color: #fff; padding: 8px 14px 8px 8px; border-radius: 999px;
  box-shadow: 0 3px 0 var(--red-deep); font-size: 13px; font-family: var(--pop);
}
.help-btn > span { font-family: var(--body); }
.help-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--red-deep); }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--pop); font-size: 16px; text-decoration: none;
  padding: 14px 26px; border-radius: 999px; transition: transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-main { background: var(--red); color: #fff; box-shadow: var(--shadow); border: 3px solid #fff; outline: 3px solid var(--red); }
.btn-main:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--red-deep); }
.btn-main:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--red-deep); }
.btn-big { font-size: 20px; padding: 18px 34px; }
.btn-gold { background: linear-gradient(180deg, #ffe680, var(--gold)); color: var(--red-dark); box-shadow: 0 5px 0 #b8861a; width: 100%; }
.btn-gold:active { transform: translateY(3px); box-shadow: 0 2px 0 #b8861a; }
.btn-ghost { color: var(--red-deep); font-size: 14px; padding: 10px; font-family: var(--body); }
.btn-ghost-w { color: #fff; font-family: var(--body); font-size: 14px; text-decoration: underline; padding: 12px; }
.btn-heart { display: inline-block; width: 30px; height: 30px; margin: -6px 0; animation: beat 1s infinite; }
.pulse { animation: pulse 2s infinite; }

/* ---------- ヒーロー ---------- */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 24px;
  max-width: 1120px; margin: 0 auto; padding: 48px 24px 90px; position: relative; min-height: calc(100vh - 70px);
}
.hero-kicker {
  display: inline-block; background: #fff; color: var(--red); border: 2px solid var(--red);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; margin: 0 0 18px;
  transform: rotate(-2deg);
}
.hero-title { font-family: var(--pop); font-weight: 400; margin: 0 0 20px; line-height: 1.15; color: var(--red); }
.t-line { display: block; font-size: clamp(28px, 4.4vw, 46px); opacity: 0; transform: translateY(30px) rotate(-3deg); }
.t-big { font-size: clamp(42px, 7.6vw, 86px); color: var(--red); -webkit-text-stroke: 2px var(--red-deep); text-shadow: 4px 4px 0 var(--yellow), 8px 8px 0 var(--pink); }
.t-sub { font-size: clamp(30px, 5vw, 56px); -webkit-text-stroke: 1.5px var(--red-deep); text-shadow: 3px 3px 0 var(--yellow); margin-top: 6px; }
.t-sub em { font-style: normal; display: inline-block; color: var(--pink); -webkit-text-stroke: 1.5px var(--red-deep); }
.is-ready .t-line { animation: popIn .7s cubic-bezier(.2,1.6,.4,1) forwards; }
.is-ready .t-line:nth-child(2) { animation-delay: .15s; }
.is-ready .t-line:nth-child(3) { animation-delay: .3s; }
.hero-lead {
  /* 後ろを3Dのキャラが通っても読めるよう、すりガラスの札にのせる */
  display: inline-block; font-size: 14px; line-height: 2; margin: 0 0 28px; padding: 12px 20px;
  background: rgba(255,255,255,.82); border: 2px solid rgba(255,255,255,.95); border-radius: 18px;
  backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 6px 18px rgba(120,0,30,.12), 0 0 0 4px rgba(255,122,162,.18);
  color: var(--ink); position: relative; z-index: 1;
}

.hero-visual { position: relative; aspect-ratio: 1 / 1.05; perspective: 900px; }
.hero-visual > * { position: absolute; transition: transform .25s ease-out; will-change: transform; }
.polaroid {
  left: 14%; top: 2%; width: 62%; background: #fff; padding: 10px 10px 0; border-radius: 6px;
  box-shadow: 0 18px 40px rgba(120, 0, 30, .3); transform: rotate(-5deg);
}
.polaroid img { aspect-ratio: 3/4; object-fit: cover; object-position: center 20%; width: 100%; height: auto; border-radius: 3px; }
.polaroid p { font-family: "Mochiy Pop One"; color: var(--red); text-align: center; margin: 8px 0 12px; font-size: 16px; }
.hero-frame { width: 42%; filter: drop-shadow(0 12px 16px rgba(120,0,30,.35)); }
.hero-frame img { animation: wobble 6s ease-in-out infinite; }
.hero-frame-a { left: -4%; bottom: 0%; }
.hero-frame-b { right: -2%; bottom: 14%; width: 38%; }
.hero-frame-b img { animation-delay: -3s; }
.vip-tag {
  position: absolute; top: -6px; right: 4px; background: linear-gradient(180deg,#ffe680,var(--gold));
  color: var(--red-dark); font-family: var(--pop); font-size: 12px; padding: 4px 10px; border-radius: 999px; box-shadow: 0 3px 0 #b8861a;
}
.float-star { font-size: 44px; color: var(--red); pointer-events: none; }
.float-sticker { pointer-events: none; filter: drop-shadow(0 6px 8px rgba(120,0,30,.25)); }
.float-sticker.h1 { top: -2%; right: 0; width: 17%; animation: floaty 3s ease-in-out infinite; }
.float-sticker.h2 { bottom: 0; left: 42%; width: 13%; animation: floaty 3.6s ease-in-out infinite reverse; }
.float-sticker.c1 { top: -4%; left: -6%; width: 24%; animation: floaty 4.2s ease-in-out infinite; animation-delay: -1s; }
.float-star.s1 { top: 38%; left: -2%; color: var(--gold); font-size: 36px; animation: twinkle 1.6s infinite; }

.marquee { position: absolute; left: 0; right: 0; bottom: 18px; overflow: hidden; transform: rotate(-2deg); background: var(--red); padding: 10px 0; box-shadow: 0 4px 0 var(--red-deep); }
.marquee-track { display: flex; width: max-content; animation: marquee 22s linear infinite; }
.marquee-track span { color: #fff; font-family: var(--pop); font-size: 16px; white-space: nowrap; padding-right: 8px; }

/* ---------- メーカー ---------- */
.maker {
  max-width: 980px; margin: 60px auto 70px; padding: 28px 20px 36px;
  background: #fff; border-radius: 36px; border: 4px solid #fff;
  position: relative; scroll-margin-top: 80px;
}
.maker::before, .maker::after {
  content: ""; position: absolute; width: 72px; height: 72px; top: -50px; z-index: 2;
  background: center / contain no-repeat; filter: drop-shadow(0 4px 0 rgba(120,0,30,.18));
  animation: floaty 3.4s ease-in-out infinite;
}
.maker::before { left: 10px; background-image: url(assets/stickers/heart-bird.png); }
.maker::after { right: 10px; background-image: url(assets/stickers/wata-chick.png); animation-delay: -1.7s; }
.maker-lights {
  position: absolute; inset: -18px; border-radius: 52px; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, #ffe24a 0 4px, transparent 5px) -3px -3px / 24px 24px, var(--red);
  box-shadow: 0 10px 0 var(--red-deep), 0 30px 60px rgba(120,0,30,.25);
  animation: lights 1.2s steps(2) infinite;
}

.stepper { list-style: none; margin: 0 auto 26px; padding: 0; display: flex; justify-content: center; gap: 0; max-width: 420px; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; color: #c99; font-size: 12px; }
.stepper li::after { content: ""; position: absolute; top: 18px; left: 60%; width: 80%; height: 4px; background: #f3d3db; border-radius: 4px; }
.stepper li:last-child::after { display: none; }
.stepper b {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: #f3d3db; color: #fff; font-family: var(--pop); font-weight: 400; z-index: 1; transition: .3s;
}
.stepper li.is-active, .stepper li.is-done { color: var(--red); }
.stepper li.is-active b { background: var(--red); transform: scale(1.18); box-shadow: 0 0 0 5px var(--pink-pale); }
.stepper li.is-done b { background: var(--pink); }
.stepper li.is-done::after { background: var(--pink); }

.panel { display: none; }
.panel.is-active { display: block; animation: panelIn .5s cubic-bezier(.2,1.3,.4,1); }
.panel-title { text-align: center; font-family: var(--pop); font-weight: 400; font-size: clamp(20px, 3.4vw, 28px); color: var(--red); margin: 0 0 24px; }
.panel-title span { display: block; font-size: 12px; letter-spacing: .3em; color: var(--pink-text); margin-bottom: 4px; }

/* フレームカード（穴あきメダル） */
.frame-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 220px)); justify-content: center; gap: 18px; }
.frame-card { display: block; padding: 0; -webkit-tap-highlight-color: transparent; }
.card-inner {
  display: block; position: relative; padding: 22px 22px 56px; border-radius: 28px; overflow: hidden;
  /* メダルケースのベルベット */
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.14) 0 30%, transparent 62%),
    radial-gradient(circle at 50% 42%, #c8123c 0%, #8c0024 55%, #5c0014 100%);
  border: 3px solid var(--gold); box-shadow: 0 8px 0 #9c6d12, inset 0 0 0 3px rgba(255,255,255,.25), inset 0 0 40px rgba(0,0,0,.35);
  transition: transform .2s, box-shadow .2s;
}
.frame-card.is-selected .card-inner { box-shadow: 0 8px 0 #9c6d12, 0 0 0 6px var(--yellow), inset 0 0 40px rgba(0,0,0,.35); }
.card-label { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-size: 22px; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.card-badge { position: absolute; top: 12px; left: 12px; z-index: 3; background: #fff; color: var(--red); font-size: 11px; padding: 4px 10px; border-radius: 999px; }
.card-badge.gold { background: linear-gradient(180deg,#ffe680,var(--gold)); color: var(--red-dark); }

.medal-stage { position: relative; display: block; aspect-ratio: 1; perspective: 900px; --d: 1px; }
.medal-shadow {
  position: absolute; left: 18%; right: 18%; bottom: -2%; height: 9%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0,0,0,.45), transparent); transition: transform .4s, opacity .4s;
}
.medal-float { position: absolute; inset: 3%; transform-style: preserve-3d; animation: medalSway 5s ease-in-out infinite; }
.medal {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .3s cubic-bezier(.2,.8,.3,1);
}
.medal > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.m-face { transform: translateZ(.5px); backface-visibility: hidden; -webkit-user-drag: none; }
/* 縁の厚み：フレームのシルエットを金色にして重ねる（中央の穴のフチも一緒に立体になる） */
.m-edge { transform: translateZ(calc(var(--i) * var(--d) * -1)); filter: brightness(var(--b, .7)) sepia(1) saturate(3.2) hue-rotate(-12deg); pointer-events: none; }
.m-back {
  display: grid; place-content: center; justify-items: center; gap: 2%;
  transform: translateZ(calc(var(--d) * -15)) rotateY(180deg); backface-visibility: hidden;
  background:
    radial-gradient(circle at 35% 30%, #fff6c2 0 6%, transparent 30%),
    radial-gradient(circle, #ffe680 0%, #f5c542 45%, #c98f16 100%);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
.m-back img { width: 26%; position: static; filter: sepia(1) saturate(2) brightness(.95) drop-shadow(0 2px 0 rgba(120,70,0,.5)); }
.m-back b { position: static; font-family: var(--heading); font-weight: 400; font-size: clamp(10px, 2.4vw, 16px); color: #9c6d12; letter-spacing: .1em; }
.m-glint {
  transform: translateZ(1px); pointer-events: none; backface-visibility: hidden;
  background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,.85) 48%, rgba(255,255,255,.2) 54%, transparent 62%) no-repeat;
  background-size: 300% 100%; background-position: var(--gx, 120%) 0;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  animation: glint 4.5s ease-in-out infinite;
}
.frame-card:hover .medal-shadow { transform: scale(.85); opacity: .7; }
.frame-card.is-locked .medal-float, .medal.is-spinning { animation-play-state: paused; }
.frame-card.is-locked .m-glint { display: none; }
.medal.is-spinning { transition: none; animation: medalSpin .7s cubic-bezier(.3,.1,.2,1) forwards; }
.medal-stage.is-spinning .medal-shadow { animation: shadowSpin .7s cubic-bezier(.3,.1,.2,1); }
.medal.is-landed { animation: medalLand .45s cubic-bezier(.2,1.8,.4,1); }
.medal.is-landed .m-glint { animation: glintOnce .7s ease-out; }

.peta {
  position: absolute; left: 50%; top: 42%; z-index: 4; pointer-events: none; white-space: nowrap;
  font-family: var(--pop); font-size: clamp(26px, 6vw, 40px); color: var(--red);
  -webkit-text-stroke: 6px #fff; paint-order: stroke fill; text-shadow: 0 4px 0 rgba(120,0,30,.25);
  animation: petaPop .9s cubic-bezier(.2,1.8,.4,1) forwards;
}
.chosen-tag {
  position: absolute; top: 10px; right: 10px; z-index: 3; font-family: var(--pop); font-size: 12px;
  background: var(--yellow); color: var(--red-dark); padding: 4px 10px; border-radius: 999px; box-shadow: 0 3px 0 #c9a400;
  opacity: 0; transform: scale(.5) rotate(10deg); transition: .3s cubic-bezier(.2,1.6,.4,1);
}
.frame-card.is-selected .chosen-tag { opacity: 1; transform: rotate(8deg); }

.lock-cover {
  position: absolute; inset: 0; border-radius: 25px; display: grid; place-content: center; justify-items: center; gap: 8px;
  background: rgba(60, 0, 15, .55); backdrop-filter: blur(4px) saturate(.6); -webkit-backdrop-filter: blur(4px) saturate(.6);
  color: var(--gold); z-index: 5; overflow: hidden; transition: opacity .6s .6s, visibility .6s .6s;
}
.frame-card:not(.is-locked) .lock-cover { opacity: 0; visibility: hidden; }
.padlock { animation: swing 2.4s ease-in-out infinite; transform-origin: 50% 0; filter: drop-shadow(0 4px 0 #8a5a00); }
.lock-text {
  /* 鎖の上に重なって読めなくならないよう、前面の札にする */
  position: relative; z-index: 2; font-family: var(--pop); color: var(--red-dark); font-size: 14px; white-space: nowrap;
  background: linear-gradient(180deg, #fff6c2, var(--gold)); padding: 5px 14px; border-radius: 999px; box-shadow: 0 3px 0 #9c6d12;
}
.padlock { position: relative; z-index: 2; }
.chain { z-index: 1; }
.chain { position: absolute; width: 160%; height: 14px; left: -30%; top: 50%;
  background: repeating-linear-gradient(90deg, var(--gold) 0 18px, transparent 18px 22px, #c99a2e 22px 40px, transparent 40px 44px);
  border-radius: 7px; opacity: .9; transition: transform .8s cubic-bezier(.6,-0.4,.7,1), opacity .8s; }
.chain-a { transform: rotate(35deg); }
.chain-b { transform: rotate(-35deg); }
.is-unlocking .chain-a { transform: rotate(35deg) translateX(-120%); opacity: 0; }
.is-unlocking .chain-b { transform: rotate(-35deg) translateX(120%); opacity: 0; }
.is-unlocking .padlock { animation: unlockDrop 1s forwards; }
.is-unlocking .shackle { transform: translateY(-10px); transition: transform .3s; }

/* ドロップゾーン */
.dropzone {
  display: grid; justify-items: center; gap: 8px; max-width: 520px; margin: 0 auto 16px; padding: 44px 20px;
  border: 4px dashed var(--pink); border-radius: 30px; background: var(--pink-pale); cursor: pointer; transition: .2s; text-align: center;
}
.dropzone:hover, .dropzone.is-over { background: #ffd0de; border-color: var(--red); transform: scale(1.02); }
.dz-icon { width: 96px; animation: bounce 1s ease-in-out infinite alternate; }
.dz-main { font-family: var(--pop); font-size: 22px; color: #fff; background: var(--red); padding: 12px 30px; border-radius: 999px; box-shadow: var(--shadow); }
.dz-sub { font-size: 13px; color: var(--red-deep); }
.dz-note { font-size: 11px; color: #a06070; font-weight: 500; margin-top: 6px; }
#step2 { text-align: center; }

/* エディタ */
.editor { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 340px); justify-content: center; gap: 30px; align-items: start; }
.stage-wrap { position: relative; }
#stage {
  width: 100%; aspect-ratio: 1; display: block; touch-action: none; cursor: grab;
  border-radius: 24px; background:
    repeating-conic-gradient(#f6e6ea 0% 25%, #fff 0% 50%) 50% / 28px 28px;
  box-shadow: 0 0 0 4px var(--red), 0 8px 0 4px var(--red-deep);
  transition: border-radius .4s;
}
#stage.is-circle { border-radius: 50%; }
#stage:active { cursor: grabbing; }
.stage-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); white-space: nowrap;
  background: rgba(59,6,20,.78); color: #fff; font-size: 12px; padding: 6px 12px; border-radius: 999px; pointer-events: none; transition: opacity .5s;
}
.stage-hint.is-hidden { opacity: 0; }
.circle-toggle { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-size: 13px; color: var(--red-deep); }
.circle-toggle input { accent-color: var(--red); width: 18px; height: 18px; }

.controls { display: grid; gap: 16px; background: var(--pink-pale); padding: 20px; border-radius: 24px; }
.ctl { display: grid; gap: 6px; font-size: 14px; color: var(--red-deep); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 12px; border-radius: 999px; background: #fff; border: 2px solid var(--pink); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: var(--red); border: 4px solid #fff; box-shadow: 0 3px 0 var(--red-deep); }
input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--red); border: 4px solid #fff; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: #fff; border: 2px solid var(--red); color: var(--red); padding: 8px 12px; border-radius: 999px; font-size: 13px; transition: .15s; }
.chip:hover { background: var(--red); color: #fff; }
.chip:active { transform: scale(.94); }
.chip-alt { border-style: dashed; }
.change-row { justify-content: center; margin-top: 10px; }

/* ---------- about ---------- */
.about { text-align: center; padding: 20px 16px 50px; }
.about-sticker { width: 84px; margin: 0 auto -6px; animation: wobble 3s ease-in-out infinite; }
.about-title { font-family: var(--pop); font-weight: 400; color: var(--red); font-size: 22px; margin: 0 0 20px; }
.about-title span { display: block; font-size: 12px; letter-spacing: .3em; color: var(--pink-text); margin-bottom: 4px; }
.sns-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.sns-links a { text-decoration: none; background: #fff; border: 3px solid var(--red); color: var(--red); padding: 10px 18px; border-radius: 999px; box-shadow: 0 4px 0 var(--red-deep); transition: .15s; }
.sns-links a:hover { transform: translateY(-3px) rotate(-2deg); box-shadow: 0 7px 0 var(--red-deep); }

.site-footer { background: var(--red); color: #fff; text-align: center; padding: 22px 16px calc(22px + env(safe-area-inset-bottom)); font-size: 11px; font-weight: 500; }
.site-footer p { margin: 4px 0; }
/* ---------- モーダル ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(92, 0, 18, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal[hidden] { display: none; }
.modal-card {
  position: relative; width: min(420px, 100%); background: #fff; border-radius: 32px; padding: 32px 24px 24px;
  border: 4px solid var(--red); box-shadow: 0 10px 0 var(--red-deep); text-align: center;
  animation: modalIn .5s cubic-bezier(.2,1.6,.4,1);
}
.modal-close { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 50%; background: var(--pink-pale); color: var(--red); font-size: 22px; line-height: 1; }
.tut-slides { position: relative; min-height: 280px; }
.tut-slide { display: none; }
.tut-slide.is-active { display: block; animation: slideIn .45s cubic-bezier(.2,1.3,.4,1); }

.tut-slide p { font-size: 14px; line-height: 1.9; margin: 0; font-weight: 500; }
.tut-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; }
.tut-dots { display: flex; gap: 8px; }
.tut-dots i { width: 10px; height: 10px; border-radius: 50%; background: #f3d3db; transition: .3s; }
.tut-dots i.is-active { background: var(--red); width: 26px; border-radius: 6px; }

.vip-card { background: linear-gradient(180deg, #fff 0%, #fff3d6 100%); }
.vip-lock-big { color: var(--gold); filter: drop-shadow(0 5px 0 #b8861a); animation: swing 2.4s ease-in-out infinite; transform-origin: 50% 0; display: inline-block; }
.vip-card h3 { font-family: var(--pop); font-weight: 400; color: var(--red); font-size: 22px; margin: 12px 0 4px; }
.vip-card > p { margin: 0 0 16px; font-size: 14px; }
.vip-input {
  width: 100%; font-family: var(--pop); font-size: 20px; letter-spacing: .08em; text-align: center;
  padding: 14px; border-radius: 16px; border: 3px solid var(--gold); background: #fff; color: var(--red-dark); outline: none;
}
.vip-input:focus { border-color: var(--red); box-shadow: 0 0 0 4px var(--pink-pale); }
.vip-msg { min-height: 1.6em; font-size: 13px; color: var(--red); margin: 8px 0; }
.shake { animation: shake .45s; }
.vip-lock-big.is-open { animation: unlockDrop 1s forwards; }
.vip-lock-big.is-open .shackle { transform: translateY(-10px); transition: transform .3s; }

/* ---------- 完成（赤いベルベットのステージ） ---------- */
/* 演出の流れ: 幕が開き始めると同時に「？」のメダルが3回転しながら落ちてくる(0.3s〜0.95s着地)
   → 「？」がはじけて作品が現れる(1.2s) → 金の紙吹雪・タイトル・キャラのお祝いパレード → ボタン(2.0s〜) */
.complete {
  position: fixed; inset: 0; z-index: 80; overflow-y: auto; overflow-x: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 50% 40%, rgba(255,70,105,.35), transparent 70%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.28) 0, rgba(255,255,255,.05) 2.5%, rgba(0,0,0,.28) 5%),
    linear-gradient(180deg, #74001a 0%, #3c000d 100%);
  color: #fff; display: grid; justify-items: center; align-items: start; padding: 84px 16px calc(40px + env(safe-area-inset-bottom));
}
.complete[hidden] { display: none; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.gold-dust { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

/* スポットライト */
.spotlight {
  position: fixed; left: 50%; top: -6%; width: min(820px, 170vw); height: 108%; z-index: 1; pointer-events: none;
  transform: translateX(-50%); opacity: 0;
  background: linear-gradient(180deg, rgba(255,244,214,.65) 0%, rgba(255,214,190,.22) 55%, rgba(255,200,180,0) 92%);
  clip-path: polygon(44% 0, 56% 0, 88% 100%, 12% 100%);
  filter: blur(14px);
}
.complete.is-show .spotlight { animation: spotOn .9s ease-out .3s forwards, spotSway 6s ease-in-out 1.2s infinite; }

/* 幕 */
.curtain {
  position: fixed; top: 0; bottom: 0; width: 51%; z-index: 6; pointer-events: none;
  background:
    linear-gradient(180deg, transparent 60%, rgba(0,0,0,.4)),
    repeating-linear-gradient(90deg, #4e000f 0, #9c0e2c 2.6%, #d61a42 4.2%, #9c0e2c 6%, #4e000f 8.5%);
  transition: transform 1.25s cubic-bezier(.7,0,.25,1) .1s;
}
.curtain::after {
  /* 金のフリンジ */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26px;
  background:
    linear-gradient(180deg, #ffe680 0 7px, #b8861a 7px 9px, transparent 9px),
    repeating-linear-gradient(90deg, #f5c542 0 2px, #9c6d12 2px 4px);
  -webkit-mask: linear-gradient(#000 60%, transparent); mask: linear-gradient(#000 60%, transparent);
}
.curtain-l { left: 0; transform-origin: left center; box-shadow: inset -24px 0 40px rgba(0,0,0,.45); }
.curtain-r { right: 0; transform-origin: right center; box-shadow: inset 24px 0 40px rgba(0,0,0,.45); }
.complete.is-show .curtain { transform: scaleX(.14); }
.valance {
  position: fixed; top: 0; left: 0; right: 0; height: 70px; z-index: 7; pointer-events: none;
  background: repeating-linear-gradient(90deg, #5a0012 0, #b5123a 3%, #e0204c 4.5%, #b5123a 6%, #5a0012 9%);
  -webkit-mask: radial-gradient(circle at 50% 0, #000 31px, transparent 32px) 0 100% / 64px 32px repeat-x, linear-gradient(#000, #000) top / 100% calc(100% - 30px) no-repeat;
  mask: radial-gradient(circle at 50% 0, #000 31px, transparent 32px) 0 100% / 64px 32px repeat-x, linear-gradient(#000, #000) top / 100% calc(100% - 30px) no-repeat;
  filter: drop-shadow(0 4px 0 #f5c542) drop-shadow(0 6px 8px rgba(0,0,0,.45));
}

.complete-inner { position: relative; z-index: 3; width: min(460px, 100%); text-align: center; margin-block: auto; } /* 収まるときは上下中央 */
.complete-title { font-size: clamp(42px, 11vw, 66px); margin: 0 0 6px; line-height: 1.1; }
.complete-title span {
  display: inline-block; opacity: 0;
  background: linear-gradient(180deg, #fffbe0 10%, #ffd84a 45%, #e0a21c 70%, #fff1a6 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #5c0012) drop-shadow(0 0 14px rgba(255,214,90,.55));
}
.complete.is-show .complete-title span { animation: dropIn .6s cubic-bezier(.2,1.8,.4,1) 1.4s forwards; }
.complete.is-show .complete-title span:nth-child(2) { animation-delay: 1.48s; }
.complete.is-show .complete-title span:nth-child(3) { animation-delay: 1.56s; }
.complete.is-show .complete-title span:nth-child(4) { animation-delay: 1.64s; }
.complete.is-show .complete-title span:nth-child(5) { animation-delay: 1.72s; }

/* 金のメダルになった完成アイコン */
.result-3d { position: relative; perspective: 1000px; width: min(280px, 64vw); aspect-ratio: 1; margin: 14px auto 18px; }
.result-3d::after {
  /* 足元の光だまり */
  content: ""; position: absolute; left: -20%; right: -20%; bottom: -16%; height: 22%; z-index: -1;
  background: radial-gradient(closest-side, rgba(255,226,140,.55), transparent); opacity: 0;
}
.result-3d::before {
  /* 着地の光の輪 */
  content: ""; position: absolute; inset: -6%; border-radius: 50%; border: 6px solid #ffe680; opacity: 0; pointer-events: none;
}
.complete.is-show .result-3d::after { animation: fadeIn .5s ease-out .85s forwards; }
.complete.is-show .result-3d::before { animation: landFlash .8s ease-out 1.2s; }
.result-coin { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; opacity: 0; }
.complete.is-show .result-coin { animation: coinDrop .9s cubic-bezier(.3,.1,.3,1) .3s forwards; }
.result-coin.is-idle { opacity: 1; animation: coinIdle 5s ease-in-out infinite !important; }
.coin-face, .coin-back, .coin-edge { position: absolute; border-radius: 50%; }
.coin-face {
  inset: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  /* 実際の画像には金の縁は無いので、正面からは縁を見せず影と光だけにする */
  box-shadow: 0 18px 40px rgba(0,0,0,.45), 0 0 50px 10px rgba(255,214,90,.3);
}
.coin-edge {
  inset: 0; transform: translateZ(calc(var(--i) * -1.2px));
  background:
    repeating-conic-gradient(rgba(90,55,0,.55) 0 1.2deg, transparent 1.2deg 3deg),
    linear-gradient(90deg, #7a4c00, #ffe680 35%, #c98f16 60%, #7a4c00);
}
.coin-back {
  inset: 0; transform: translateZ(-21px) rotateY(180deg); backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
/* 「？」の刻印メダル（表のふたと裏面）。陰影は assets/medal-mystery.svg に描き込み済み */
.coin-mystery {
  position: absolute; inset: 0; border-radius: 50%; transform: translateZ(1px); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: url(assets/medal-mystery.svg) center / 100% 100% no-repeat;
  box-shadow: 0 18px 40px rgba(0,0,0,.5); overflow: hidden;
}
.coin-mystery::after {
  /* 回転に合わせて表面を走る光 */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.75) 45%, rgba(255,255,255,.15) 52%, transparent 62%) no-repeat;
  background-size: 300% 100%; background-position: 130% 0;
}
.complete.is-show .coin-mystery::after { animation: coinShine .22s linear .3s 3; }
.coin-back { background: url(assets/medal-mystery.svg) center / 100% 100% no-repeat; }
.complete.is-show .coin-mystery { animation: mysteryOut .5s cubic-bezier(.4,0,.6,1) 1.2s forwards; }

/* キャラのお祝いパレード */
.parade { position: absolute; inset: 0; pointer-events: none; }
.pc { position: absolute; width: 26%; left: calc(50% + var(--x)); top: calc(50% + var(--y)); transform: translate(-50%, -50%); }
.pc img {
  display: block; width: 100%; filter: drop-shadow(0 6px 4px rgba(40,0,10,.45));
  animation: paradeIn .75s cubic-bezier(.2,1.5,.4,1) var(--d) both, cheer 1.1s ease-in-out calc(var(--d) + .75s) infinite;
}

.complete-sub { margin: 22px 0 18px; font-size: 15px; }
.share-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.share-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  padding: 14px 10px; border-radius: 18px; font-size: 14px; background: #fff; color: var(--red);
  box-shadow: 0 5px 0 rgba(0,0,0,.35); transition: transform .15s, box-shadow .15s; opacity: 0;
}
.complete.is-show .share-btn { animation: popIn .5s cubic-bezier(.2,1.6,.4,1) forwards; }
.complete.is-show .share-btn:nth-child(1) { animation-delay: 2s; }
.complete.is-show .share-btn:nth-child(2) { animation-delay: 2.08s; }
.complete.is-show .share-btn:nth-child(3) { animation-delay: 2.16s; }
.complete.is-show .share-btn:nth-child(4) { animation-delay: 2.24s; }
.complete.is-show .share-btn:nth-child(5) { animation-delay: 2.32s; }
.complete.is-show .share-btn:nth-child(6) { animation-delay: 2.4s; }
.complete .complete-sub, .complete .share-note, .complete #againBtn { opacity: 0; }
.complete.is-show .complete-sub, .complete.is-show .share-note, .complete.is-show #againBtn { animation: fadeIn .5s ease-out 1.9s forwards; }
.share-btn[hidden] { display: none; }
.share-grid:not(:has(#shareBtn[hidden])) .s-copy { grid-column: 1 / -1; }
.share-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.share-btn i { font-style: normal; font-size: 18px; }
.s-save { grid-column: 1 / -1; background: var(--yellow); color: var(--red-dark); font-family: var(--pop); font-size: 17px; }
.s-x { background: #111; color: #fff; }
.s-line { background: #fff; color: #06c755; }
.sns-logo { width: 20px; height: 20px; object-fit: contain; flex: none; }
.share-btn .sns-logo { width: 22px; height: 22px; }
.share-btn .line-logo { width: 28px; height: 28px; }
.sns-links a { display: inline-flex; align-items: center; gap: 8px; }
.yt-logo { width: 26px; height: 26px; }
.s-insta { background: #fff; color: #c13584; }
.share-btn .insta-logo { width: 24px; height: 24px; }
.share-note {
  /* 幕のすそや紙吹雪と重なっても読めるよう、暗い札にのせる */
  display: inline-block; font-size: 11px; margin: 14px 0 4px; line-height: 1.6; padding: 8px 14px; border-radius: 12px;
  background: rgba(40, 0, 10, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); position: relative; z-index: 5;
}

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 120;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 8px 20px 8px 8px; border-radius: 999px; font-size: 14px; transition: .3s; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 10px;
}
.toast img { width: 36px; height: 36px; flex: none; }
.vip-msg img { width: 28px; display: inline-block; vertical-align: middle; margin-right: 4px; }
.toast.is-show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- アニメーション ---------- */
@keyframes bounce { to { transform: translateY(-14px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spinY { 0% { transform: translateZ(40px) rotateY(0); } 100% { transform: translateZ(40px) rotateY(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes beat { 0%,100% { transform: scale(1); } 30% { transform: scale(1.35); } 50% { transform: scale(.95); } }
@keyframes pulse { 0%,100% { outline-offset: 0; } 50% { outline-offset: 5px; } }
@keyframes popIn { from { opacity: 0; transform: translateY(30px) scale(.8) rotate(-3deg); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-80px) scale(1.6); } to { opacity: 1; transform: none; } }
@keyframes wobble { 0%,100% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(4deg) scale(1.04); } }
@keyframes floaty { 0%,100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-16px) rotate(8deg); } }
@keyframes twinkle { 50% { transform: scale(.6) rotate(45deg); opacity: .5; } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes panelIn { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.6) rotate(-6deg); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes swing { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-10px); } 40%,80% { transform: translateX(10px); } }
@keyframes unlockDrop { 0% { transform: rotate(0); } 30% { transform: rotate(-20deg) scale(1.2); } 100% { transform: translateY(160px) rotate(40deg); opacity: 0; } }
@keyframes medalSway { 0%, 100% { transform: rotateY(-14deg) rotateX(4deg) translateY(0); } 50% { transform: rotateY(14deg) rotateX(-2deg) translateY(-4%); } }
@keyframes glint { 0%, 55% { background-position: 120% 0; } 85%, 100% { background-position: -20% 0; } }
@keyframes glintOnce { from { background-position: 120% 0; } to { background-position: -20% 0; } }
@keyframes medalSpin {
  0% { transform: translate3d(0, 0, 0) rotateY(0) scale(1); }
  40% { transform: translate3d(0, -14%, 60px) rotateY(180deg) scale(1.12); }
  80% { transform: translate3d(0, 0, 0) rotateY(345deg) scale(1); }
  100% { transform: translate3d(0, 0, 0) rotateY(360deg) scale(1); }
}
@keyframes shadowSpin { 40% { transform: scale(.5); opacity: .35; } }
@keyframes medalLand { 0% { transform: scale(1.1, .9); } 100% { transform: none; } }
@keyframes petaPop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-12deg); } 30% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(-6deg); } 70% { opacity: 1; transform: translate(-50%, -60%) scale(1) rotate(-6deg); } 100% { opacity: 0; transform: translate(-50%, -90%) scale(.9) rotate(-6deg); } }
@keyframes squish { from { transform: scale(1.08, .9); } to { transform: scale(.95, 1.06); } }
@keyframes lights { 50% { filter: brightness(1.18) saturate(1.2); } }
@keyframes stickerPop { from { opacity: 0; transform: scale(0) rotate(-40deg); } to { opacity: 1; transform: none; } }
@keyframes rotateBurst { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes coinDrop {
  0% { opacity: 1; transform: translateY(-130vh) rotateY(0) rotateX(25deg) scale(.7); }
  72% { opacity: 1; transform: translateY(0) rotateY(1080deg) rotateX(0) scale(1); }
  84% { opacity: 1; transform: translateY(-7%) rotateY(1080deg) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) rotateY(1080deg) scale(1); }
}
@keyframes coinShine { from { background-position: 130% 0; } to { background-position: -30% 0; } }
@keyframes mysteryOut {
  0% { opacity: 1; transform: translateZ(1px) scale(1); filter: brightness(1); }
  35% { opacity: 1; transform: translateZ(1px) scale(1.06); filter: brightness(1.8); }
  100% { opacity: 0; transform: translateZ(1px) scale(1.35); filter: brightness(2.4) blur(6px); }
}
@keyframes spotOn { from { opacity: 0; } 30% { opacity: .5; } 45% { opacity: .2; } to { opacity: 1; } }
@keyframes spotSway { 0%, 100% { transform: translateX(-50%) rotate(0); } 50% { transform: translateX(-50%) rotate(1.5deg); } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes landFlash { from { opacity: 1; transform: scale(.85); } to { opacity: 0; transform: scale(1.7); } }
@keyframes paradeIn {
  from { opacity: 0; transform: translate(var(--fx), var(--fy)) rotate(-540deg) scale(.4); }
  to { opacity: 1; transform: none; }
}
@keyframes cheer {
  0%, 100% { transform: translateY(0) rotate(0) scale(1); }
  25% { transform: translateY(-22%) rotate(var(--tilt)) scale(.96, 1.06); }
  50% { transform: translateY(0) rotate(0) scale(1.08, .92); }
}
@keyframes coinIdle { 0%,100% { transform: rotateY(-12deg) rotateX(4deg); } 50% { transform: rotateY(12deg) rotateX(-4deg); } }

/* ---------- レスポンシブ ---------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding: 24px 16px 90px; text-align: center; min-height: auto; gap: 8px; }
  .hero-visual { order: -1; width: min(380px, 92%); margin: 0 auto; }
  .editor { grid-template-columns: 1fr; }
  .stage-col { width: min(460px, 100%); margin: 0 auto; text-align: center; }
}
@media (max-width: 560px) {
  .maker { margin: 50px 16px 50px; padding: 22px 14px 28px; border-radius: 28px; }
  .frame-cards { gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 3枚目は2段目の真ん中に */
  .frame-card:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 7px); }
  .card-inner { padding: 34px 10px 44px; border-radius: 22px; }
  .card-badge, .chosen-tag { top: 8px; font-size: 10px; }
  .card-label { font-size: 17px; bottom: 12px; }
  .medal-stage { --d: .7px; }
  .lock-text { font-size: 12px; }
  .padlock svg { width: 40px; height: 46px; }
  .btn-big { font-size: 18px; padding: 16px 26px; }
  .logo-main { font-size: 19px; }
  .maker::before, .maker::after { width: 56px; height: 56px; top: -42px; }
  .maker-lights { inset: -12px; border-radius: 40px; }
  .valance { height: 56px; }
  .complete.is-show .curtain { transform: scaleX(.07); } /* 狭い画面ではボタンに幕がかからないよう端まで開く */
  .complete { padding-top: 70px; }
  .pc { width: 24%; }
  .help-btn { padding: 7px 12px 7px 8px; font-size: 12px; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .t-line, .share-btn, .complete-title span, .result-coin, .complete-sub, .share-note, #againBtn, .pc img { opacity: 1 !important; transform: none !important; }
  .curtain, .coin-mystery { display: none; }
  .spotlight { opacity: 1 !important; }
}

.has-3d .bg-fallback { display: none; }

/* 見出しはだるまどろっぷ */
.logo-main, .hero-title, .panel-title, .about-title, .card-label, .tut-slide h3, .vip-card h3,
.complete-title, .peta { font-family: var(--heading); }

/* 追加アイコン（UI部品のみで使用） */
.ico { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -.28em; margin-right: .3em; flex: none; }
.ico-l { width: 1.5em; height: 1.5em; vertical-align: -.38em; }
.hero-kicker .ico, .site-footer .ico, .tut-slide p .ico, .complete-sub .ico { margin: 0 .15em; }
.ico-bubble { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; background: #fff; vertical-align: middle; }
.ico-bubble .ico { margin: 0; width: 16px; height: 16px; vertical-align: 0; }
.btn-heart.ico { width: 30px; height: 30px; margin: -6px 0; }
.share-btn .ico { margin-right: 0; }
.ico-st { width: 1.5em; height: 1.5em; vertical-align: -.4em; }

/* ロゴ画像（assets/logo.png が無いときは文字のロゴを表示） */
.logo-img { display: block; height: 46px; width: auto; filter: drop-shadow(0 2px 2px rgba(120,0,30,.2)); }
.logo:not(.no-img) .logo-main, .logo:not(.no-img) .logo-sub { display: none; }
.hero-logo { display: block; width: min(560px, 100%); height: auto; filter: drop-shadow(0 10px 14px rgba(120,0,30,.25)); }
.is-ready .hero-logo { animation: logoPop .9s cubic-bezier(.2,1.6,.4,1) both; }
.hero-title:not(.no-img) .t-line { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@keyframes logoPop { from { opacity: 0; transform: scale(.6) rotate(-4deg); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) {
  .logo-img { height: 38px; }
  .hero-logo { margin: 0 auto; }
}
.btn-ico { width: 22px; height: 22px; flex: none; }

/* チュートリアル（実際の画面のスクリーンショット付き） */
.tut-card { padding-top: 54px; } /* 右上の×と画像が重ならないように */
.tut-slides { min-height: 0; }
.tut-shot {
  height: min(250px, 34vh); border-radius: 18px; overflow: hidden; background: #fff1f5;
  border: 3px solid var(--pink-pale); box-shadow: inset 0 0 0 1px rgba(230,0,51,.08);
  position: relative;
}
.tut-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* 手順4は完成画面を見せないよう、イラストで表現 */
.tut-art4 { display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, #fff 0 30%, var(--pink-pale) 70%); }
.art4-save {
  width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; color: var(--red-dark);
  background: linear-gradient(180deg, #fff1a6, var(--yellow)); box-shadow: 0 6px 0 #c9a400, 0 0 0 6px #fff;
  animation: bounce .8s ease-in-out infinite alternate;
}
.art4-save svg { width: 58px; height: 58px; }
.art4-chara { position: absolute !important; inset: auto auto 14px 16px !important; width: 84px !important; height: auto !important; animation: wobble 3s ease-in-out infinite; }
.art4-sns { position: absolute; right: 14px; top: 16px; display: grid; grid-template-columns: repeat(2, 30px); gap: 8px; }
.art4-sns img { position: static !important; width: 30px !important; height: 30px !important; padding: 5px; background: #fff; border-radius: 10px; box-shadow: 0 2px 6px rgba(120,0,30,.15); }
.tut-nav { gap: 10px; }
.tut-skip { color: #a06070; font-size: 13px; padding: 10px 6px; text-decoration: underline; text-underline-offset: 3px; }
.tut-nav .btn { padding: 12px 22px; font-size: 15px; white-space: nowrap; }

/* スマホの完成画面：ボタンを小さめ・詰めめにして1画面に収まりやすく */
@media (max-width: 560px) {
  .complete { padding: 66px 16px calc(32px + env(safe-area-inset-bottom)); }
  .complete-title { font-size: 38px; }
  .result-3d { width: min(230px, 58vw); margin: 8px auto 12px; }
  .complete-sub { margin: 14px 0 12px; font-size: 13px; }
  .share-grid { gap: 8px; }
  .share-btn { padding: 10px 8px; font-size: 13px; border-radius: 14px; gap: 6px; box-shadow: 0 4px 0 rgba(0,0,0,.3); }
  .s-save { font-size: 15px; padding: 12px 8px; }
  .btn-ico { width: 18px; height: 18px; }
  .share-btn .sns-logo { width: 18px; height: 18px; }
  .share-btn .line-logo { width: 22px; height: 22px; }
  .share-btn .insta-logo { width: 20px; height: 20px; }
  .share-note { font-size: 10.5px; margin-top: 12px; }
  #againBtn { padding: 8px; }
}

/* ---------- チュートリアル：見出し → 画像 → 説明 のシンプルなカード ---------- */
.tut-card { width: min(360px, 94vw); padding: 0; background: none; border: 0; box-shadow: none; }
.tut-card .modal-close { top: -14px; right: 2px; z-index: 5; background: #fff; box-shadow: 0 3px 0 var(--red-deep); }
.tut-cardui {
  background: #fff; border: 4px solid var(--red); border-radius: 24px; padding: 18px 16px 16px;
  box-shadow: 0 8px 0 var(--red-deep), 0 16px 30px rgba(60,0,15,.3);
}
.tut-head {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px;
  font-family: var(--heading); font-weight: 400; font-size: 22px; line-height: 1.2; color: var(--red);
}
.tut-no {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--red); color: #fff; font-size: 17px;
}
.tut-cardui .tut-shot { height: min(220px, 30vh); border: 0; border-radius: 14px; background: var(--pink-pale); }
.tut-cardui .tut-desc { margin: 12px 0 0; font-size: 13px; line-height: 1.8; text-align: center; color: var(--ink); }
.tut-desc b { color: var(--red); }
.tut-card .tut-nav { margin-top: 14px; background: #fff; border-radius: 999px; padding: 6px 6px 6px 16px; box-shadow: 0 6px 0 var(--red-deep), 0 10px 24px rgba(60,0,15,.3); }
.tut-shot.is-tall img { object-fit: cover; object-position: 50% 18%; } /* 縦長の画面は写真まわりを大きく見せる */
.tut-desc .ln, .hero-lead .ln, .dz-note .ln, .share-note .ln { display: inline-block; } /* 意味のまとまりごとに改行する（収まる幅なら同じ行に並ぶ） */

/* ---------- アーカイブ（過去のフレーム） ---------- */
.archive-card .card-inner { background: radial-gradient(circle at 50% 42%, #6d3cc4 0%, #3d1f7a 60%, #24104d 100%); border-color: #c9b6ff; box-shadow: 0 8px 0 #2a1458, inset 0 0 40px rgba(0,0,0,.35); }
.archive-stack { position: relative; display: block; aspect-ratio: 1; perspective: 700px; }
.archive-stack::after {
  /* 3枚の足元の影 */
  content: ""; position: absolute; left: 14%; right: 14%; bottom: 2%; height: 9%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0,0,0,.5), transparent);
}
/* 厚みのあるミニメダル（中身は他のカードと同じ .medal の仕組み） */
.mini-medal { position: absolute; display: block; width: 62%; aspect-ratio: 1; top: 18%; left: 19%; transform-style: preserve-3d; transition: transform .35s cubic-bezier(.2,1.4,.4,1); }
.mini-medal .medal { --d: .9px; animation: medalSway 5s ease-in-out infinite; }
.mm-1 { transform: translate(-36%, 8%) rotateY(30deg) rotateZ(-10deg) scale(.8); }
.mm-2 { transform: translate(36%, 8%) rotateY(-30deg) rotateZ(10deg) scale(.8); }
.mm-3 { transform: translateY(-6%) translateZ(40px) scale(.92); }
.mm-1 .medal { animation-delay: -1.6s; }
.mm-2 .medal { animation-delay: -3.2s; }
.archive-card:hover .mm-1 { transform: translate(-42%, 6%) rotateY(38deg) rotateZ(-14deg) scale(.82); }
.archive-card:hover .mm-2 { transform: translate(42%, 6%) rotateY(-38deg) rotateZ(14deg) scale(.82); }
.mini-medal .medal > .m-coin {
  /* 穴の部分に金のコインをはめて、1枚ずつ中身の詰まったメダルに見せる */
  inset: 12%; width: auto; height: auto; border-radius: 50%; transform: translateZ(calc(var(--d) * -5));
  /* わたぁのイラストを打ち出した金のコイン */
  background: url(assets/archive/coin-wata.webp) center / cover no-repeat, #f5c542;
  box-shadow: inset 0 -6px 12px rgba(120,70,0,.3);
}
.archive-pick { display: none; position: absolute; inset: 18px 18px 50px; place-items: center; align-content: center; gap: 6px; perspective: 700px; }
.mm-pick { position: relative; top: auto; left: auto; width: 76%; }
.archive-pick-name { font-size: 11px; color: #fff; background: rgba(0,0,0,.35); padding: 2px 10px; border-radius: 999px; }
.archive-card.is-picked .archive-stack { visibility: hidden; }
.archive-card.is-picked .archive-pick { display: grid; }
.archive-pick.is-pop { animation: stickerPop .6s cubic-bezier(.2,1.8,.4,1); }

.archive-modal { width: min(600px, 94vw); max-height: 86vh; overflow-y: auto; padding: 26px 18px 20px; }
.archive-modal h3 { font-family: var(--heading); font-weight: 400; color: var(--red); font-size: 24px; margin: 0 0 4px; }
.archive-lead { font-size: 13px; margin: 0 0 16px; color: var(--ink); }
.arc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 10px; }
.arc-item { display: grid; justify-items: center; gap: 6px; padding: 6px 4px 8px; border-radius: 16px; transition: transform .15s, background .15s; }
.arc-item:hover { background: var(--pink-pale); transform: translateY(-3px); }
.arc-item.is-selected { background: #fff3a8; box-shadow: 0 0 0 3px var(--yellow); }
.arc-thumb { display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #fff 0 45%, var(--pink-pale) 46%); }
.arc-thumb img { width: 100%; height: 100%; object-fit: contain; }
.arc-name { font-size: 11px; line-height: 1.4; color: var(--ink); text-align: center; }
@media (max-width: 820px) {
  .frame-cards { grid-template-columns: repeat(2, minmax(0, 260px)); }
}
@media (max-width: 560px) {
  .arc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .archive-modal h3 { font-size: 21px; }
}
/* アーカイブのロック付きフレーム */
.arc-item { position: relative; }
.arc-thumb { position: relative; }
.arc-lock { display: none; position: absolute; top: 50%; left: 50%; z-index: 2; transform: translate(-50%, -50%); color: var(--gold); filter: drop-shadow(0 3px 0 #8a5a00); }
.arc-chains { display: none; position: absolute; inset: 0; border-radius: 50%; overflow: hidden; pointer-events: none; z-index: 1; }
.arc-chains .chain {
  height: 8px; margin-top: -4px; border-radius: 4px;
  background: repeating-linear-gradient(90deg, var(--gold) 0 10px, transparent 10px 12px, #c99a2e 12px 22px, transparent 22px 24px);
  box-shadow: 0 2px 2px rgba(60,30,0,.35);
}
.arc-item.is-locked .arc-chains { display: block; }
.arc-item.is-locked .arc-thumb img { filter: blur(3px) brightness(.55) saturate(.6); }
.arc-item.is-locked .arc-lock { display: block; }
.arc-item.is-locked .arc-name::after { content: "（合言葉）"; display: block; font-size: 10px; color: var(--pink-text); }
