/*
  試作デザイン「夜空の占い館」(design/cosmic-app)
  - <html class="cosmic"> のときだけ効く上書きレイヤー。?theme=classic で元のデザインに戻る
  - 動き(星空・画面の切り替え・きらめき)は fx.js
*/
:root.cosmic {
  --bg: #120d2e;
  --bg2: #1d1546;
  --card: #1a1440;
  --glass: rgba(255, 255, 255, .065);
  --glass-hi: rgba(255, 255, 255, .11);
  --ink: #f5f0ff;
  --muted: #a9a0d2;
  --accent: #ff7eb6;
  --accent2: #9a86ff;
  --gold: #f6d58e;
  --gold2: #c9a24f;
  --accent-ink: #1b0f2e;
  --border: rgba(255, 255, 255, .12);
  --yes: #ff8fc0;
  --no: #8fb4ff;
  --unk: #c9c0ee;
  --shadow: 0 18px 50px rgba(5, 2, 20, .55);
  --glow: 0 0 24px rgba(255, 126, 182, .45), 0 0 60px rgba(154, 134, 255, .25);
  --red: #ff8a9e;
  --ease-spring: cubic-bezier(.2, 1.4, .4, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: dark;
}

/* ---------- 夜空の背景 ---------- */
:root.cosmic { background: #07051a; }
:root.cosmic body {
  background:
    radial-gradient(80% 50% at 50% -10%, #3b1f6e 0%, transparent 70%),
    radial-gradient(70% 40% at 100% 100%, #2a1150 0%, transparent 70%),
    linear-gradient(180deg, #0d0926 0%, #0a0720 55%, #07051a 100%);
  background-attachment: fixed;
  min-height: 100dvh;
}
/* ゆっくり流れるオーロラ */
:root.cosmic body::before,
:root.cosmic body::after {
  content: '';
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  opacity: .55;
}
:root.cosmic body::before {
  width: 70vmax; height: 50vmax; left: -25vmax; top: -12vmax;
  background: radial-gradient(closest-side, rgba(255, 110, 180, .45), rgba(255, 110, 180, 0));
}
:root.cosmic body::after {
  width: 60vmax; height: 60vmax; right: -28vmax; bottom: -20vmax;
  background: radial-gradient(closest-side, rgba(110, 120, 255, .4), rgba(110, 120, 255, 0));
}
@keyframes aurora-a { to { transform: translate(18vmax, 14vmax) scale(1.2) rotate(20deg); } }
@keyframes aurora-b { to { transform: translate(-16vmax, -18vmax) scale(1.15) rotate(-15deg); } }
.fx-sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; width: 100%; height: 100%; }
:root.cosmic #app { position: relative; z-index: 1; }

/* ---------- 文字 ---------- */
:root.cosmic h1 {
  background: linear-gradient(100deg, #fff 0%, #ffd9ec 35%, #e3d8ff 65%, #fff 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
  letter-spacing: .02em;
}
@keyframes shimmer-text { to { background-position: -200% 0; } }
:root.cosmic .tagline {
  color: var(--gold);
  font-family: 'Cinzel', 'M PLUS Rounded 1c', serif;
  letter-spacing: .14em;
  font-size: 11px;
  text-transform: uppercase;
}
:root.cosmic :lang(ja) .tagline { text-transform: none; letter-spacing: .08em; font-family: inherit; }
:root.cosmic .label {
  display: flex; align-items: center; gap: 8px;
  color: var(--gold); font-size: 11px; letter-spacing: .12em;
}
:root.cosmic .label::before { content: '✦'; font-size: 9px; color: var(--accent); text-shadow: 0 0 8px var(--accent); }
:root.cosmic .label-row .label::before { content: '✦'; }
:root.cosmic .lead, :root.cosmic .hint { color: var(--muted); }

/* ---------- ヘッダー ---------- */
:root.cosmic .top { padding: 10px 0 2px; position: sticky; top: 0; z-index: 6; }
:root.cosmic .brand {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .25), rgba(255, 255, 255, .04) 60%);
  border: 1px solid var(--border);
  box-shadow: 0 0 18px rgba(154, 134, 255, .35), inset 0 0 12px rgba(255, 255, 255, .08);
  font-size: 18px;
}
:root.cosmic .lang, :root.cosmic .back {
  background: var(--glass); color: var(--ink); border: 1px solid var(--border);
  font-weight: 700; padding: 6px 14px;
}

/* ---------- ガラスのパネル ---------- */
:root.cosmic .card, :root.cosmic .panel {
  position: relative;
  background: linear-gradient(160deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 28px;
  padding: 18px 16px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .12);
}
/* パネルのふちを光がゆっくり一周する */
:root.cosmic .panel::before, :root.cosmic .card::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 126, 182, .55), transparent 35%, transparent 65%, rgba(246, 213, 142, .45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .8;
}
@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes orbit-border { to { --ang: 360deg; } }

/* ---------- タイル・チップ ---------- */
:root.cosmic .tile, :root.cosmic .chip, :root.cosmic .pick-pill, :root.cosmic input.name-input {
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  color: var(--ink);
}
:root.cosmic .tile {
  border-radius: 18px;
  transition: transform .35s var(--ease-spring), background .25s, border-color .25s, box-shadow .25s;
}
:root.cosmic .tile .ti { transition: transform .4s var(--ease-spring); }
:root.cosmic .tile:hover { background: rgba(255, 255, 255, .09); }
:root.cosmic .tile.on, :root.cosmic .chip.on {
  background: linear-gradient(160deg, rgba(255, 126, 182, .28), rgba(154, 134, 255, .22));
  border-color: rgba(255, 170, 210, .85);
  box-shadow: 0 0 0 1px rgba(255, 126, 182, .4), 0 8px 24px rgba(255, 126, 182, .35), inset 0 0 18px rgba(255, 255, 255, .08);
}
:root.cosmic .tile.on .ti { transform: translateY(-3px) scale(1.15); }
:root.cosmic .tile.fx-pop { animation: tile-pop .45s var(--ease-spring); }
:root.cosmic .tile.fx-pop .ti { animation: ti-pop .5s var(--ease-spring); }
@keyframes ti-pop { from { transform: none; } }
@keyframes tile-pop { 40% { transform: scale(1.07); } }
:root.cosmic .pick-pill { color: var(--muted); }
:root.cosmic .pick-pill.on { border-color: rgba(255, 170, 210, .85); box-shadow: 0 0 16px rgba(255, 126, 182, .25); }
:root.cosmic .pick-pill select { color: var(--ink); }
:root.cosmic .pick-pill select option { background: #1a1440; color: #f5f0ff; }
:root.cosmic input.name-input { border-radius: 16px; transition: border-color .2s, box-shadow .2s; }
:root.cosmic input.name-input::placeholder { color: rgba(201, 192, 238, .55); }
:root.cosmic input.name-input:focus { outline: none; border-color: rgba(255, 170, 210, .8); box-shadow: 0 0 0 4px rgba(255, 126, 182, .15), 0 0 24px rgba(255, 126, 182, .2); }
:root.cosmic .link, :root.cosmic .mine-link { border-color: rgba(255, 255, 255, .15); color: var(--muted); background: rgba(0, 0, 0, .2); }
:root.cosmic .tile-line { background: linear-gradient(135deg, #06c755, #00a54a); border-color: transparent; color: #fff; }
:root.cosmic .tile-ig { border-color: transparent; color: #fff; }

/* ---------- ボタン ---------- */
:root.cosmic .btn { border-radius: 18px; background: var(--glass); border: 1px solid var(--border); color: var(--ink); transition: transform .3s var(--ease-spring), background .2s; }
:root.cosmic .btn:active { transform: scale(.96); }
:root.cosmic .btn.primary {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(120deg, #ff7eb6 0%, #ffb38a 40%, #f6d58e 55%, #b69bff 100%);
  background-size: 220% 100%;
  color: #2a0f2e; font-weight: 900; letter-spacing: .03em;
  box-shadow: 0 10px 30px rgba(255, 126, 182, .45), 0 0 0 1px rgba(255, 255, 255, .25) inset;
  
}
:root.cosmic .btn.primary::after { /* 光がすっと通る */
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .75) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: btn-shine 3.6s ease-in-out infinite 1s;
}
@keyframes btn-flow { to { background-position: 100% 0; } }
@keyframes btn-breathe { 50% { box-shadow: 0 12px 40px rgba(255, 126, 182, .65), 0 0 0 1px rgba(255, 255, 255, .25) inset; } }
@keyframes btn-shine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
:root.cosmic .btn.primary small { color: #4a2346; opacity: .8; }
:root.cosmic .btn.mini { border-radius: 14px; }
:root.cosmic .sub { color: var(--muted); }
:root.cosmic .bulk-toggle { background: var(--glass); color: var(--accent); }
:root.cosmic .sent-link { color: var(--gold); }

/* ---------- 水晶玉(fx.js が差し込む) ---------- */
.crystal-wrap { display: block; position: relative; width: var(--size, 132px); height: calc(var(--size, 132px) * 1.12); margin: 0 auto; }
.crystal {
  position: absolute; left: 0; top: 0; width: var(--size, 132px); height: var(--size, 132px); border-radius: 50%; overflow: hidden;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .95) 0 4%, rgba(255, 255, 255, .35) 9%, transparent 22%),
    radial-gradient(circle at 50% 55%, rgba(170, 140, 255, .55), rgba(40, 20, 90, .9) 70%),
    #1b1045;
  box-shadow: 0 0 40px rgba(170, 140, 255, .55), 0 0 90px rgba(255, 126, 182, .3), inset 0 -10px 30px rgba(0, 0, 0, .45), inset 0 6px 18px rgba(255, 255, 255, .25);
  animation: crystal-float 4.2s ease-in-out infinite;
}
.crystal .neb { /* 玉の中で渦を巻く星雲 */
  position: absolute; inset: -30%;
  background:
    conic-gradient(from 0deg, rgba(255, 126, 182, 0), rgba(255, 126, 182, .7), rgba(246, 213, 142, .0), rgba(140, 170, 255, .7), rgba(255, 126, 182, 0)),
    radial-gradient(circle, transparent 30%, rgba(20, 10, 60, .6) 70%);
  opacity: .55;
  animation: neb-spin 9s linear infinite;
}
.crystal .neb + .neb { animation-duration: 14s; animation-direction: reverse; opacity: .7; inset: -10%; }
.crystal .dots { position: absolute; inset: 0; background-image: radial-gradient(1.2px 1.2px at 30% 60%, #fff, transparent), radial-gradient(1px 1px at 65% 40%, #fff, transparent), radial-gradient(1.4px 1.4px at 55% 72%, #ffe6f3, transparent), radial-gradient(1px 1px at 40% 35%, #e8e2ff, transparent), radial-gradient(1.2px 1.2px at 72% 62%, #fff, transparent); animation: neb-spin 30s linear infinite; }
.crystal .shine { position: absolute; left: 18%; top: 12%; width: 34%; height: 20%; border-radius: 50%; background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0)); transform: rotate(-24deg); }
.crystal-base {
  position: absolute; left: 50%; bottom: 0; width: 62%; height: 18%; transform: translateX(-50%);
  background: linear-gradient(180deg, #e9c779, #a67c32 60%, #6e4f1d);
  clip-path: polygon(14% 0, 86% 0, 100% 100%, 0 100%);
  border-radius: 4px;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .5));
}
.crystal-base::before { content: ''; position: absolute; left: 10%; right: 10%; top: 0; height: 3px; background: rgba(255, 255, 255, .5); border-radius: 2px; }
.crystal-wrap::after { /* 足元の光 */
  content: ''; position: absolute; left: 50%; bottom: -10px; width: 120%; height: 30px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(170, 140, 255, .45), transparent);
}
@keyframes crystal-float { 50% { transform: translateY(-6px); } }
@keyframes crystal-glow { 50% { opacity: .6; transform: translateX(-50%) scale(.9); } }
@keyframes neb-spin { to { transform: rotate(360deg); } }
/* 周りをまわるアイコン */
.orbit { position: absolute; left: 50%; top: calc(var(--size, 132px) / 2); width: 0; height: 0; }
.orbit span {
  position: absolute; left: 0; top: 0; font-size: 24px; line-height: 1;
  animation: orbit 9s linear infinite; animation-delay: calc(var(--k) * -3s);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .45));
}
@keyframes orbit {
  0% { transform: rotate(0deg) translateX(calc(var(--size, 132px) * .82)) rotate(0deg) scale(1); z-index: 2; }
  25% { transform: rotate(90deg) translateX(calc(var(--size, 132px) * .82)) rotate(-90deg) scale(1.15); }
  50% { transform: rotate(180deg) translateX(calc(var(--size, 132px) * .82)) rotate(-180deg) scale(.85); }
  75% { transform: rotate(270deg) translateX(calc(var(--size, 132px) * .82)) rotate(-270deg) scale(.7); opacity: .5; }
  100% { transform: rotate(360deg) translateX(calc(var(--size, 132px) * .82)) rotate(-360deg) scale(1); }
}
.orbit-ring { position: absolute; left: 50%; top: calc(var(--size, 132px) / 2); width: calc(var(--size, 132px) * 1.64); height: calc(var(--size, 132px) * .5); transform: translate(-50%, -50%) rotate(-12deg); border-radius: 50%; border: 1px solid rgba(246, 213, 142, .35); box-shadow: 0 0 12px rgba(246, 213, 142, .2); }
.loader-stage { display: grid; place-items: center; gap: 18px; min-height: 60vh; }
.loader-stage .crystal .neb { animation-duration: 2.2s; }
.loader-stage p { color: var(--muted); font-size: 13px; letter-spacing: .2em; animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- 贈る側のトップ ---------- */
:root.cosmic .hero { padding: 4px 4px 14px; }
:root.cosmic .hero-art.cosmic-hero { display: block; height: 170px; margin: 4px 0 6px; --size: 118px; }
:root.cosmic .hero-art.cosmic-hero span { animation: none; }
:root.cosmic .hero-art.cosmic-hero .orbit span { animation: orbit 9s linear infinite; animation-delay: calc(var(--k) * -3s + var(--el, 0s)); }
:root.cosmic .hero-art.cosmic-hero .crystal, :root.cosmic .hero-art.cosmic-hero .crystal-wrap::after, :root.cosmic .hero-art.cosmic-hero .neb, :root.cosmic .hero-art.cosmic-hero .dots { animation-delay: var(--el, 0s); }
:root.cosmic .hero-small .hero-art.cosmic-hero { height: 130px; --size: 86px; }
:root.cosmic h1 { font-size: 28px; }
:root.cosmic .made { border-top-color: rgba(255, 255, 255, .12); }

/* ---------- 真ん中に寄せる画面 ---------- */
:root.cosmic .stage-art { height: 170px; }
:root.cosmic .stage-art .orb { filter: drop-shadow(0 0 24px rgba(170, 140, 255, .6)); z-index: 1; }
:root.cosmic .stage-art .orb::before { /* 絵文字のうしろの光輪 */
  content: ''; position: absolute; left: 50%; top: 50%; width: 150%; height: 150%; transform: translate(-50%, -50%); z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 200, 230, .35), rgba(154, 134, 255, .15) 60%, transparent);
  animation: halo 3s ease-in-out infinite;
}
@keyframes halo { 50% { transform: translate(-50%, -50%) scale(1.15); opacity: .7; } }
:root.cosmic .stage-art .orb.has-crystal { font-size: 0; filter: none; --size: 120px; }
:root.cosmic .stage-art .orb.has-crystal::before { display: none; }
:root.cosmic .stage-art .letter { z-index: 2; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .5)); }
:root.cosmic .stage-art .spark { filter: drop-shadow(0 0 8px rgba(255, 230, 160, .9)); }
:root.cosmic .chips li {
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); color: var(--muted);
}
:root.cosmic .done-pill { background: rgba(80, 220, 150, .15); color: #8be0ad; border: 1px solid rgba(139, 224, 173, .35); box-shadow: 0 0 20px rgba(139, 224, 173, .2); }
:root.cosmic .opt-tag { border-color: var(--border); }
:root.cosmic .hint-box {
  background: linear-gradient(160deg, rgba(255, 126, 182, .16), rgba(154, 134, 255, .14));
  border: 1px solid rgba(246, 213, 142, .35);
  box-shadow: 0 0 40px rgba(246, 213, 142, .12), var(--shadow);
}
:root.cosmic .hint-box strong { color: var(--gold); text-shadow: 0 0 16px rgba(246, 213, 142, .4); }

/* ---------- 答える側: タロット風のカード ---------- */
:root.cosmic .quiz-top { margin-top: 4px; }
:root.cosmic .progress { height: 6px; background: rgba(255, 255, 255, .08); overflow: visible; position: relative; }
:root.cosmic .progress span {
  position: relative;
  background: linear-gradient(90deg, #9a86ff, #ff7eb6, #f6d58e);
  box-shadow: 0 0 12px rgba(255, 126, 182, .7);
  transition: width .6s var(--ease-out);
}
:root.cosmic .progress span::after { /* 先頭の星 */
  content: '✦'; position: absolute; right: -7px; top: 50%; transform: translateY(-52%);
  font-size: 15px; color: #fff; text-shadow: 0 0 6px #fff, 0 0 14px #ff7eb6, 0 0 22px #f6d58e;
  animation: twinkle-star 1.4s ease-in-out infinite;
}
@keyframes twinkle-star { 50% { transform: translateY(-52%) scale(.75) rotate(45deg); } }
:root.cosmic .deck { perspective: 1200px; margin: 18px 0 16px; }
:root.cosmic .card-bg { background: linear-gradient(160deg, #241a55, #150f36); border: 1px solid rgba(246, 213, 142, .2); }
:root.cosmic .card-bg.b1 { transform: translateY(12px) scale(.95) rotate(-2deg); opacity: .75; }
:root.cosmic .card-bg.b2 { transform: translateY(24px) scale(.9) rotate(2.5deg); opacity: .45; }
:root.cosmic .qcard {
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 30% 20%, rgba(255, 255, 255, .12), transparent 55%),
    radial-gradient(circle at 50% 115%, hsl(var(--hue) 85% 62% / .38), transparent 60%),
    radial-gradient(90% 60% at 100% 0%, rgba(154, 134, 255, .25), transparent 70%),
    linear-gradient(165deg, #2c1f66, #170f3d 60%, #100a2c);
  border: 1px solid rgba(246, 213, 142, .55);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 40px hsl(var(--hue) 90% 70% / .25), inset 0 0 40px rgba(0, 0, 0, .35);
  /* 出てくる演出は短く（動いている間は指でつかめないため） */
  animation: card-in .32s var(--ease-out);
  transition: transform .26s ease-in;
  will-change: transform;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* 指で動かしている間は遅れなく追従させる */
:root.cosmic .qcard.drag { transition: none; }
:root.cosmic .qcard.tutorial { animation: tut-card 2.6s ease-in-out .5s 1 both; }
@keyframes card-in {
  from { transform: translateY(18px) rotateY(-35deg) scale(.95); opacity: 0; }
}
/* 回答画面: ボタンやカードを触っても文字が選択されない・端から横に滑らせてもページが戻りにくい */
:root.cosmic .quiz, :root.cosmic .quiz * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
:root.cosmic body:has(.quiz) { overscroll-behavior: none; }
:root.cosmic .quiz .answers-row { touch-action: manipulation; }
:root.cosmic .qcard::before { /* 金の内枠と四隅の飾り */
  content: ''; position: absolute; inset: 10px; border-radius: 20px; pointer-events: none;
  border: 1px solid rgba(246, 213, 142, .45);
  background:
    radial-gradient(circle at 0 0, rgba(246, 213, 142, .9) 0 2px, transparent 3px),
    radial-gradient(circle at 100% 0, rgba(246, 213, 142, .9) 0 2px, transparent 3px),
    radial-gradient(circle at 0 100%, rgba(246, 213, 142, .9) 0 2px, transparent 3px),
    radial-gradient(circle at 100% 100%, rgba(246, 213, 142, .9) 0 2px, transparent 3px);
}
:root.cosmic .qcard::after { /* ホログラムの光(指やマウス、傾きで動く) */
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; mix-blend-mode: screen; opacity: .55;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 150, 200, .25) calc(var(--mx, 30%) - 10%), rgba(170, 220, 255, .28) var(--mx, 30%), rgba(246, 213, 142, .22) calc(var(--mx, 30%) + 10%), transparent 80%);
}
:root.cosmic .qemoji {
  font-size: 64px; position: relative; margin-bottom: 30px;
  filter: drop-shadow(0 0 18px hsl(var(--hue) 90% 75% / .55));
  animation: emoji-in .5s var(--ease-spring) .05s both;
}
:root.cosmic .qemoji::before { /* 絵文字のうしろの魔法陣 */
  content: ''; position: absolute; left: 50%; top: 50%; width: 104px; height: 104px; transform: translate(-50%, -50%); z-index: -1; border-radius: 50%;
  border: 1px dashed rgba(246, 213, 142, .45);
  box-shadow: 0 0 0 10px rgba(246, 213, 142, .05), inset 0 0 30px hsl(var(--hue) 90% 70% / .25);
  animation: neb-spin 24s linear infinite;
}
@keyframes emoji-in { from { transform: scale(.3) rotate(-30deg); opacity: 0; } }
:root.cosmic .qnum {
  font-family: 'Cinzel', serif; color: var(--gold); letter-spacing: .3em; font-size: 13px;
  text-shadow: 0 0 10px rgba(246, 213, 142, .5);
}
:root.cosmic .qtext { font-size: 22px; text-shadow: 0 2px 16px rgba(0, 0, 0, .4); animation: text-in .4s var(--ease-out) .1s both; }
@keyframes text-in { from { opacity: 0; transform: translateY(8px); } }
:root.cosmic .stamp { background: rgba(14, 10, 38, .85); box-shadow: 0 0 20px currentColor; }
:root.cosmic .tip-text { background: rgba(255, 255, 255, .92); color: #1b0f2e; }
:root.cosmic .round { background: rgba(255, 255, 255, .08); color: var(--ink); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
:root.cosmic .round.mid { color: var(--gold); }
:root.cosmic .arrow { filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .4)); }
:root.cosmic .arrow.yes { background: linear-gradient(135deg, #ff7eb6, #ffb38a); color: #2a0f2e; }
:root.cosmic .arrow.no { background: linear-gradient(135deg, #7d8cff, #8fd3f4); color: #0e1440; }
:root.cosmic .swipe-hint { color: rgba(201, 192, 238, .7); }

/* ---------- 伝書鳩・モーダル ---------- */
:root.cosmic .pigeon-stage { background: radial-gradient(circle at 50% 55%, rgba(40, 24, 90, .92), rgba(8, 5, 26, .94)); }
:root.cosmic .heart { color: var(--accent); text-shadow: 0 0 12px var(--accent); }
:root.cosmic .sent-toast { background: rgba(255, 255, 255, .1); border: 1px solid var(--border); }
:root.cosmic .img-modal-box { background: #1a1440; border: 1px solid var(--border); }
:root.cosmic .warn { background: rgba(246, 213, 142, .14); color: var(--gold); border: 1px solid rgba(246, 213, 142, .3); }

/* ---------- 結果: 3枚のカードがめくれる ---------- */
:root.cosmic .picks { perspective: 1400px; }
:root.cosmic .pick {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  border: 1px solid rgba(246, 213, 142, .35);
  border-radius: 24px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
  transform-origin: 50% 0;
  animation: reveal 1s var(--ease-out) both; animation-delay: calc(.25s + var(--i, 0) * .35s);
}
:root.cosmic .pick:first-child { border-color: rgba(246, 213, 142, .8); box-shadow: 0 0 0 1px rgba(246, 213, 142, .3), 0 0 50px rgba(246, 213, 142, .25), 0 14px 40px rgba(0, 0, 0, .4); }
:root.cosmic .pick::before { /* めくれたあと一度だけ光が走る */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: btn-shine 1.4s ease-out 1 both; animation-delay: calc(1s + var(--i, 0) * .35s);
}
@keyframes reveal {
  0% { opacity: 0; transform: rotateX(-75deg) translateY(-20px); filter: blur(6px); }
  60% { opacity: 1; filter: none; }
  100% { transform: none; }
}
:root.cosmic .rank {
  display: inline-block; font-family: 'Cinzel', 'M PLUS Rounded 1c', serif; letter-spacing: .12em;
  padding: 3px 12px; border-radius: 99px; color: #2a1a05;
  background: linear-gradient(120deg, #f6d58e, #fff2c8, #d9ad55);
  box-shadow: 0 0 14px rgba(246, 213, 142, .45);
}
:root.cosmic .pick h3 { font-size: 20px; margin: 10px 0 4px; }
:root.cosmic .stores .btn.amazon { border-color: rgba(243, 168, 71, .7); }
:root.cosmic .stores .btn.rakuten { color: #ff9a9a; border-color: rgba(255, 138, 138, .6); }
:root.cosmic .fb-fit, :root.cosmic .fb-none { background: var(--glass); color: var(--muted); border-color: var(--border); }
:root.cosmic .fb-fit.on, :root.cosmic .fb-none.on, :root.cosmic .fb-reactions .btn.on { background: var(--accent); color: #2a0f2e; border-color: var(--accent); }
:root.cosmic .fb-lead { background: rgba(255, 255, 255, .05); }
:root.cosmic .others summary { color: var(--gold); }
:root.cosmic .other-list a { color: var(--ink); }
:root.cosmic .for-whom { color: var(--gold); }
:root.cosmic .badge { background: var(--glass); }
:root.cosmic .badge.ok { background: var(--accent); color: #2a0f2e; }
:root.cosmic .try-others { border: 1px solid rgba(246, 213, 142, .5); }
:root.cosmic .debug { background: rgba(0, 0, 0, .3); }

/* ---------- 広告枠 ---------- */
:root.cosmic .ad { border-color: rgba(255, 255, 255, .12); color: rgba(201, 192, 238, .6); }
:root.cosmic .ad-banner { background: rgba(12, 8, 32, .82); border-top: 1px solid rgba(255, 255, 255, .1); }

/* ---------- 画面の切り替え(fx.js が main に .fx-in をつける) ---------- */
:root.cosmic main.fx-in > * { animation: rise .5s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 50ms); }
:root.cosmic main.fx-in > .quiz { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* タップしたところから星が散る(fx.js) */
.fx-spark {
  position: fixed; z-index: 40; pointer-events: none; width: 10px; height: 10px; margin: -5px 0 0 -5px;
  color: var(--c, #fff); font-size: 10px; line-height: 10px; text-align: center;
  text-shadow: 0 0 6px currentColor;
  animation: spark .75s var(--ease-out) forwards;
}
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.2) rotate(180deg); opacity: 0; } }

/* 背の低い画面 */
@media (max-height: 720px) {
  :root.cosmic .hero-art.cosmic-hero { display: block; height: 120px; --size: 78px; }
  :root.cosmic .stage-art { height: 130px; }
  :root.cosmic .stage-art .orb.has-crystal { --size: 92px; }
}

/* ---------- トップをスクロールなしで1画面に収める ---------- */
:root.cosmic #app:has(> main > .hero:not(.hero-small)) > .top { position: absolute; top: 0; right: 16px; padding-top: 12px; }
:root.cosmic #app:has(> main > .hero:not(.hero-small)) { padding-bottom: 62px; }
:root.cosmic #app:has(> main > .hero:not(.hero-small)) .lang {
  /* トップでは地球儀アイコンだけにして、タイトルの幅を広げる（切り替え先の略語 EN / JP を出す。元の文字は読み上げ用に残る） */
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: 0;
}
:root.cosmic #app:has(> main > .hero:not(.hero-small)) .lang::before {
  content: 'EN'; font-size: 12px; font-weight: 800; letter-spacing: .04em; line-height: 1; color: var(--gold); transform: translateY(1px);
}
:root.cosmic:lang(en) #app:has(> main > .hero:not(.hero-small)) .lang::before { content: 'JP'; }
:root.cosmic main > .hero:not(.hero-small) {
  display: grid; grid-template-columns: 60px 1fr; column-gap: 12px; align-items: center;
  text-align: left; padding: 10px 46px 6px 0;
}
:root.cosmic main > .hero:not(.hero-small) .hero-art.cosmic-hero { grid-row: 1 / span 2; height: 67px; margin: 0; --size: 60px; }
:root.cosmic main > .hero:not(.hero-small) h1 { font-size: clamp(15px, 5.45vw, 24px); margin: 0; align-self: end; white-space: nowrap; }
:root.cosmic main > .hero:not(.hero-small) .tagline { font-size: 12px; letter-spacing: .03em; line-height: 1.45; margin-top: 2px; align-self: start; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel {
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 8px; padding: 12px 12px 14px; border-radius: 24px;
}
:root.cosmic main > .hero:not(.hero-small) ~ .panel > * { grid-column: 1 / -1; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel .label { margin: 6px 0 4px; font-size: 10.5px; letter-spacing: .05em; line-height: 1.6; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel .label:first-child { margin-top: 0; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel .tiles-5 .tile { min-height: 46px; padding: 4px 2px; font-size: 10.5px; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel .tiles-4 .tile { min-height: 42px; padding: 4px 2px; font-size: 11.5px; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel .tile .ti { font-size: 18px; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel .pick-pill { height: 38px; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel .pick-note { font-size: 10px; margin: 3px 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel input.name-input { padding: 7px 12px; }
/* 呼び名ふたつを横に並べる（まとめて送るときは縦のまま） */
:root.cosmic main > .hero:not(.hero-small) ~ .panel:has(> #to) > h2.label:nth-of-type(4) { grid-column: 1; grid-row: 8; align-self: end; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel:has(> #to) > #nick { grid-column: 1; grid-row: 9; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel:has(> #to) > .label-row { display: contents; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel:has(> #to) > .label-row > .label { grid-column: 2; grid-row: 8; align-self: end; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel:has(> #to) > h2.label:nth-of-type(4)::before,
:root.cosmic main > .hero:not(.hero-small) ~ .panel:has(> #to) > .label-row > .label::before { content: none; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel:has(> #to) > #to { grid-column: 2; grid-row: 9; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel:has(> #to) > .label-row > .bulk-toggle { grid-column: 1 / -1; grid-row: 10; justify-self: end; margin-top: 5px; padding: 2px 10px; }
:root.cosmic main > .hero:not(.hero-small) ~ .panel .btn.primary { margin-top: 10px; }
:root.cosmic main > .hero:not(.hero-small) ~ .legal { margin-top: 8px; }
@media (max-width: 360px) {
  :root.cosmic main > .hero:not(.hero-small) { padding-right: 42px; }
  :root.cosmic main > .hero:not(.hero-small) h1 { font-size: 15.5px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .legal { font-size: 9.5px; gap: 3px; flex-wrap: nowrap; white-space: nowrap; }
}
/* 使い方（タップで開け閉め） */
:root.cosmic .howto {
  margin: 0 0 8px; border-radius: 16px; overflow: hidden;
  background: linear-gradient(160deg, rgba(246, 213, 142, .1), rgba(154, 134, 255, .08));
  border: 1px solid rgba(246, 213, 142, .28);
}
:root.cosmic .howto summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 14px; cursor: pointer; list-style: none; -webkit-user-select: none; user-select: none;
}
:root.cosmic .howto summary::-webkit-details-marker { display: none; }
:root.cosmic .howto-title { font-size: 13px; font-weight: 800; color: var(--gold); }
:root.cosmic .howto-open { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
:root.cosmic .howto-open::after { content: '▾'; display: inline-block; transition: transform .3s var(--ease-spring); color: var(--gold); }
:root.cosmic .howto[open] .howto-open { font-size: 0; }
:root.cosmic .howto[open] .howto-open::after { transform: rotate(180deg); font-size: 12px; }
:root.cosmic .howto-body { padding: 0 14px 12px; }
:root.cosmic .howto[open] .howto-body { animation: howto-in .35s var(--ease-out); }
@keyframes howto-in { from { opacity: 0; transform: translateY(-6px); } }
:root.cosmic .howto-lead { margin: 0 0 8px; font-size: 12.5px; font-weight: 700; line-height: 1.55; }
:root.cosmic .howto-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: s; }
:root.cosmic .howto-steps li {
  position: relative; display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 8px;
  font-size: 12px; line-height: 1.5; color: var(--ink);
}
:root.cosmic .howto[open] .howto-steps li { animation: howto-in .4s var(--ease-out) both; animation-delay: calc(var(--n) * 70ms + 60ms); }
:root.cosmic .howto-ic {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: 15px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(246, 213, 142, .35);
}
/* ステップをつなぐ点線 */
:root.cosmic .howto-steps li:not(:last-child)::after {
  content: ''; position: absolute; left: 14.5px; top: 31px; height: calc(100% - 25px); border-left: 1px dashed rgba(246, 213, 142, .35);
}
:root.cosmic .howto-note { margin: 8px 0 0; font-size: 11px; color: var(--muted); }

/* リンクができた画面なども、見出しを横並びにして詰める */
:root.cosmic main > .hero-small { display: grid; grid-template-columns: 56px 1fr; column-gap: 12px; align-items: center; text-align: left; padding: 6px 0 12px; }
:root.cosmic main > .hero-small .hero-art.cosmic-hero { grid-row: 1 / span 2; height: 62px; margin: 0; --size: 56px; }
:root.cosmic main > .hero-small h1 { font-size: 22px; margin: 0; }
:root.cosmic main > .hero-small .lead { margin: 2px 0 0; font-size: 12px; }
:root.cosmic main > .hero-small:not(:has(.hero-art)) { display: block; text-align: center; }
:root.cosmic main > .hero-small { padding: 2px 0 10px; }
:root.cosmic main > .hero-small + .panel { padding: 14px 14px 12px; }
:root.cosmic main > .hero-small + .panel .share .tile { min-height: 48px; }
:root.cosmic main > .hero-small + .panel .link { margin-top: 8px; }
:root.cosmic main > .hero-small + .panel .btn.mini.another { margin-top: 10px; }
:root.cosmic main > .hero-small + .panel .sub { margin-top: 8px; }
:root.cosmic main > .hero-small ~ .panel.mine { margin-top: 10px; padding: 12px 14px; }
:root.cosmic main > .hero-small ~ .panel.mine .hint { font-size: 11px; line-height: 1.55; }
/* iPhone SE など背の低い画面 */
/* 背の高い画面では余白を広げる（iPhone SE などの低い画面はスクロールでよい） */
@media (min-height: 720px) {
  :root.cosmic main > .hero:not(.hero-small) { padding: 14px 46px 10px 0; }
  :root.cosmic .howto { margin-bottom: 12px; }
  :root.cosmic .howto summary { padding: 9px 14px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel { padding: 16px 14px 16px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel .label { margin: 10px 0 6px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel .tiles-5 .tile { min-height: 52px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel .tiles-4 .tile { min-height: 48px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel .pick-pill { height: 40px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel input.name-input { padding: 9px 12px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel:has(> #to) > .label-row > .bulk-toggle { margin-top: 8px; padding: 3px 12px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel .btn.primary { margin-top: 14px; padding: 13px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .legal { margin-top: 12px; }
}
@media (min-height: 780px) {
  :root.cosmic main > .hero:not(.hero-small) { padding: 16px 46px 12px 0; }
  :root.cosmic main > .hero:not(.hero-small) .hero-art.cosmic-hero { height: 76px; --size: 68px; }
  :root.cosmic main > .hero:not(.hero-small) h1 { font-size: clamp(15px, 5.85vw, 26px); }
  :root.cosmic main > .hero:not(.hero-small) .tagline { font-size: 13px; }
  :root.cosmic .howto { margin-bottom: 14px; }
  :root.cosmic .howto summary { padding: 11px 16px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel { padding: 18px 16px 16px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel .label { margin: 12px 0 6px; font-size: 11px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel .tiles-5 .tile { min-height: 56px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel .tiles-4 .tile { min-height: 50px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel .tile .ti { font-size: 20px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel .pick-pill { height: 44px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel input.name-input { padding: 10px 14px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel:has(> #to) > .label-row > .bulk-toggle { margin-top: 10px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .panel .btn.primary { margin-top: 16px; padding: 14px; }
  :root.cosmic main > .hero:not(.hero-small) ~ .legal { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  :root.cosmic body::before, :root.cosmic body::after { animation: none; }
}

/* 横はみ出し防止を clip にする（hidden だと body がスクロール枠になり、ヘッダーが上に残らない） */
:root.cosmic, :root.cosmic body { overflow-x: clip; }
/* ---------- ヘッダー: タイトルが見えている間は小さいマークを隠し、スクロールで隠れたら上に残す ---------- */
:root.cosmic #app > .top { position: sticky; top: 0; z-index: 8; }
:root.cosmic #app > .top::before {
  content: ''; position: absolute; left: -16px; right: -16px; top: 0; height: 58px; z-index: -1; pointer-events: none;
  background: #f3ece1; box-shadow: 0 1px 0 var(--border), 0 6px 14px rgba(80, 50, 20, .06);
  opacity: 0; transition: opacity .2s;
}
:root.cosmic #app.stuck > .top::before { opacity: 1; }
:root.cosmic #app > .top .brand { transition: opacity .2s, transform .2s; }
:root.cosmic #app.titled:not(.stuck) > .top .brand { opacity: 0; visibility: hidden; transform: scale(.8); }
/* トップは場所を取らないように高さ0で上に重ねる */
:root.cosmic #app:has(> main > .hero:not(.hero-small)) > .top { position: sticky; top: 0; right: auto; height: 0; padding: 0; align-items: flex-start; }
:root.cosmic #app:has(> main > .hero:not(.hero-small)) > .top > * { margin-top: 11px; }
/* 見出しの上に置く大きなマーク（結果の画面など） */
:root.cosmic .page-mark { display: flex; justify-content: center; margin: 2px 0 10px; --size: 76px; }
:root.cosmic .page-mark .crystal-wrap { height: var(--size); }
