:root {
  --night: #0d0b1a;
  --night2: #1b1530;
  --ink: #f3ead8;
  --ink-dim: #b9aec8;
  --flame: #ffb347;
  --flame-hot: #ff6a3d;
  --line: rgba(243, 234, 216, 0.18);
  --card: rgba(22, 18, 40, 0.66);
  --mincho: 'Shippori Mincho B1', serif;
  --brush: 'Yuji Syuku', 'Shippori Mincho B1', serif;
  --kaku: 'Zen Kaku Gothic New', sans-serif;
  --maru: 'Zen Maru Gothic', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--night);
  color: var(--ink);
  font-family: var(--maru);
  line-height: 1.8;
  overflow-x: hidden;
  word-break: auto-phrase;
  text-wrap: pretty;
}

/* 夜空と灯の粒 */
.sky {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background: #0d0b1a;
}
.bgv {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 30%;
  filter: saturate(1.1) brightness(0.75);
}
.sky::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 110%, rgba(255, 120, 60, 0.18), transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 0%, rgba(120, 90, 200, 0.25), transparent 70%),
    linear-gradient(180deg, rgba(13, 11, 26, 0.35) 0%, rgba(13, 11, 26, 0.55) 45%, rgba(13, 11, 26, 0.88) 100%);
}

/* 飾り：上の藤、下のススキ */
.deco { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.deco img { position: absolute; opacity: 0.85; }
.wis { top: -18px; width: clamp(110px, 30vw, 260px); transform-origin: 50% 0; animation: sway 7s ease-in-out infinite; }
.wis-l { left: -14px; }
.wis-r { right: -14px; animation-delay: -3.5s; }
.grass { bottom: -30px; width: clamp(140px, 38vw, 340px); opacity: 0.5; filter: brightness(0.55) saturate(0.8); transform-origin: 50% 100%; animation: sway 9s ease-in-out infinite; }
.grass-l { left: -40px; }
.grass-r { right: -40px; transform: scaleX(-1); animation-name: sway-r; }
@keyframes sway { 0%, 100% { rotate: -2deg; } 50% { rotate: 2deg; } }
@keyframes sway-r { 0%, 100% { rotate: 2deg; } 50% { rotate: -2deg; } }
.embers { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.embers span {
  position: absolute; bottom: -20px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--flame);
  box-shadow: 0 0 10px 3px rgba(255, 160, 70, 0.6);
  opacity: 0;
  animation: rise linear infinite;
}
@keyframes rise {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 0.9; }
  100% { transform: translate(var(--drift, 20px), -110vh); opacity: 0; }
}

main { max-width: 560px; margin: 0 auto; padding: 32px 16px 24px; }

.screen { display: none; text-align: center; animation: fade 0.5s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.kicker { color: var(--flame); letter-spacing: 0.15em; font-size: 0.9rem; margin: 0 0 8px; }

/* ロゴ：小さな前置き → 大きな筆文字「妖怪」 → 帯「診断」。左に縦書きのタグ、右にほおずき */
.logo {
  position: relative; display: inline-flex; flex-direction: column; align-items: center;
  margin: 12px auto 26px; padding: 0 30px; font-weight: 400;
}
.logo-sub {
  font: 700 clamp(0.95rem, 4.4vw, 1.2rem) var(--kaku); letter-spacing: 0.32em;
  color: var(--ink); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}
.logo-main {
  font-family: var(--brush); font-size: clamp(5.4rem, 30vw, 8.5rem); line-height: 1.05;
  color: #fff4dc; letter-spacing: 0.02em;
  text-shadow: 0 0 6px rgba(255, 200, 120, 0.9), 0 0 28px rgba(255, 120, 50, 0.75), 0 0 60px rgba(255, 90, 40, 0.45);
}
.logo-band {
  display: inline-block; margin-top: 4px; padding: 3px 26px 3px 32px;
  font: 700 clamp(1.15rem, 5.4vw, 1.5rem) var(--kaku); letter-spacing: 0.5em;
  color: #24100a; background: linear-gradient(90deg, var(--flame), var(--flame-hot));
  box-shadow: 0 4px 18px rgba(255, 110, 50, 0.45);
}
.logo-tate {
  position: absolute; left: 0; top: 50%; translate: 0 -50%;
  writing-mode: vertical-rl; white-space: nowrap; font: 700 0.68rem var(--kaku); letter-spacing: 0.18em; color: var(--flame);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
.hozuki {
  position: absolute; right: -26px; top: -10px; width: 74px;
  transform-origin: 50% 0; animation: sway 4s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(255, 150, 60, 0.8));
}
.halloween {
  display: inline-block; margin: 0 0 4px; padding: 2px 14px; border-radius: 999px;
  font: 700 0.82rem var(--kaku); letter-spacing: 0.1em; color: #ffcf8a;
  background: rgba(120, 50, 160, 0.45); border: 1px solid rgba(255, 179, 71, 0.5);
}

/* 案内役・灯運び（小さな灯の小鬼） */
.guide {
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; gap: 14px; align-items: flex-start; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin: 0 0 28px;
}
.guide p { margin: 0; font-size: 0.95rem; line-break: strict; }
.guide p .nb { display: inline-block; }
.guide.small { margin-top: 24px; }
.hikobi {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 50% 60%, #fff3c4 0%, var(--flame) 35%, var(--flame-hot) 70%, transparent 72%);
  position: relative;
  animation: flicker 2.2s ease-in-out infinite;
}
.hikobi i::before, .hikobi i::after {
  content: ''; position: absolute; top: 20px; width: 5px; height: 7px; border-radius: 50%; background: #2a1a10;
}
.hikobi i::before { left: 14px; }
.hikobi i::after { right: 14px; }
.hikobi.big { width: 96px; height: 96px; margin: 60px auto 24px; }
.hikobi.big i::before, .hikobi.big i::after { top: 44px; width: 9px; height: 13px; }
.hikobi.big i::before { left: 30px; }
.hikobi.big i::after { right: 30px; }
@keyframes flicker {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(255, 150, 60, 0.7)); }
  50% { transform: scale(1.06) translateY(-2px); filter: drop-shadow(0 0 18px rgba(255, 150, 60, 0.9)); }
}

.btn {
  display: inline-block; width: 100%; max-width: 360px;
  padding: 14px 20px; margin: 6px 0;
  border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06); color: var(--ink);
  font: 700 1rem var(--maru); text-decoration: none; cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.12); }
.btn.primary, .btn.x {
  background: linear-gradient(135deg, var(--flame), var(--flame-hot));
  color: #2a1208; border: none;
  box-shadow: 0 6px 24px rgba(255, 110, 50, 0.35);
}
.btn.ghost { background: transparent; }
.btn.small { width: auto; padding: 10px 20px; font-size: 0.9rem; }
.note { color: var(--ink-dim); font-size: 0.85rem; }

/* 質問 */
.progress { height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; }
.bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--flame), var(--flame-hot)); transition: width 0.3s; }
.qnum { color: var(--flame); font-family: var(--mincho); margin: 20px 0 4px; }
.question { font-family: var(--mincho); font-size: 1.35rem; line-height: 1.6; margin: 0 0 24px; min-height: 4.4em; }
.answers { display: grid; gap: 12px; }
.answers button {
  padding: 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  font: 500 1rem var(--maru); text-align: left; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.answers button:hover { border-color: var(--flame); transform: translateX(3px); }
.back {
  margin-top: 20px; background: none; border: none; color: var(--ink-dim);
  font: 500 0.85rem var(--maru); cursor: pointer; text-decoration: underline;
}
.back[hidden] { display: none; }

.hozuki-swing {
  display: block; width: 120px; margin: 40px auto 16px;
  transform-origin: 50% 0; animation: swing 1.6s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(255, 150, 60, 0.9));
}
@keyframes swing { 0%, 100% { rotate: -8deg; } 50% { rotate: 8deg; } }
.loading-text { font-family: var(--mincho); font-size: 1.1rem; }

/* 結果 */
.portrait {
  position: relative; width: min(300px, 78vw); aspect-ratio: 1; margin: 8px auto 0;
  display: grid; place-items: center;
}
.portrait .flame {
  position: absolute; inset: -8%; width: 116%; height: 116%; object-fit: contain;
  opacity: 0.55; filter: blur(1px); animation: spin 40s linear infinite;
}
@keyframes spin { to { rotate: 360deg; } }
.portrait #r-img {
  position: relative; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5)); }
.kana { color: var(--ink-dim); font-size: 0.85rem; margin: 8px 0 0; letter-spacing: 0.1em; }
.rname { font-family: var(--brush); font-weight: 400; font-size: clamp(2rem, 9.5vw, 2.8rem); text-shadow: 0 0 20px rgba(255, 120, 50, 0.6); margin: 0; line-height: 1.4; }
.catch { color: var(--flame); font-family: var(--mincho); font-size: 1.15rem; margin: 6px 0 16px; }
.desc { text-align: left; margin: 0 0 20px; }
.facts { display: grid; gap: 10px; margin: 0; text-align: left; }
.facts div { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.facts dt { color: var(--flame); font-size: 0.85rem; }
.facts dd { margin: 0; }
.share { margin: 28px 0; }

.teaser {
  border: 1px dashed rgba(255, 179, 71, 0.5); border-radius: 16px;
  padding: 18px 16px; margin: 8px 0 0; background: rgba(255, 140, 60, 0.06);
}
.teaser p { margin: 0 0 8px; font-size: 0.95rem; }
.teaser-kicker { color: var(--flame); font-family: var(--mincho); letter-spacing: 0.2em; }

footer { max-width: 560px; margin: 0 auto; padding: 24px 16px 40px; text-align: center; color: var(--ink-dim); font-size: 0.78rem; border-top: 1px solid var(--line); }
footer a { color: var(--ink-dim); }
body[data-screen="s-quiz"] footer, body[data-screen="s-loading"] footer { display: none; }
footer p { margin: 0 0 8px; }

@media (prefers-reduced-motion: reduce) {
  .embers, .hikobi, .wis, .grass, .hozuki, .hozuki-swing, .portrait .flame { animation: none; }
  .bgv { display: none; }
  .embers span { display: none; }
}

/* PC：真ん中の器は読みやすい幅のまま、飾りを大きく見せる */
@media (min-width: 900px) {
  main { max-width: 600px; padding-top: 56px; }
  .answers { grid-template-columns: 1fr 1fr; }
  .question { min-height: 3em; }
  .hozuki { width: 92px; right: -40px; }
}
