:root {
  --night: #1f2a44;
  --counter: #2a3757;
  --card: #33416a;
  --light: #ffe9a8;
  --rice: #fff8ea;
  --soft: #c9d2ea;
  --line: #3b3554;
  --hand: 'Yomogi', 'Zen Maru Gothic', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--counter);
  color: var(--rice);
  font-family: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
  font-weight: 500;
  font-size: 17px;
  line-height: 2;
  letter-spacing: .02em;
}

img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--light); outline-offset: 3px; border-radius: 12px; }

/* ---------- メニュー ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  transition: background .3s, box-shadow .3s;
}
.nav.scrolled, .nav.open { background: rgba(31, 42, 68, .94); box-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.nav-logo img { height: 34px; opacity: 0; transition: opacity .3s; }
.nav.scrolled .nav-logo img, .nav.open .nav-logo img { opacity: 1; }
.nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav ul a {
  display: block; padding: 4px 14px; border-radius: 999px;
  color: var(--rice); text-decoration: none; font-size: 15px; font-weight: 700;
}
.nav ul a:hover { background: var(--card); color: var(--light); }
.nav-toggle { display: none; width: 44px; height: 44px; padding: 11px 9px; border: 0; border-radius: 14px; background: var(--card); }
.nav-toggle i { display: block; height: 3px; margin: 4px 0; border-radius: 2px; background: var(--light); transition: transform .25s, opacity .25s; }
.nav.open .nav-toggle i:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.open .nav-toggle i:nth-child(2) { opacity: 0; }
.nav.open .nav-toggle i:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- トップ ---------- */
.hero {
  /* 舞台の下端の台（舞台の幅の 80/960）と同じ高さで、台の色を画面の端まで伸ばす */
  --w: min(960px, 100vw - 32px);
  --band: calc(var(--w) * 80 / 960 + 44px);
  --edge: calc(var(--w) * 6 / 960);
  background: linear-gradient(
    var(--night) calc(100% - var(--band)),
    #3a4a70 calc(100% - var(--band)) calc(100% - var(--band) + var(--edge)),
    var(--counter) calc(100% - var(--band) + var(--edge)));
  padding: 76px 16px 0;
  text-align: center;
  overflow: hidden;
}
.hero h1 { margin: 0; }
.logo { width: min(400px, 76vw); margin: 0 auto; }
.greeting {
  display: inline-block; margin: 6px 0 0; padding: 2px 20px;
  border-radius: 999px; background: rgba(51, 65, 106, .7);
  font-family: var(--hand); font-size: 18px; color: var(--light);
}
.hint { margin: 0; height: 44px; line-height: 44px; font-size: 13px; color: var(--soft); opacity: .8; }

.stage { position: relative; width: var(--w); aspect-ratio: 960 / 464; margin: calc(var(--w) * .04 + 8px) auto 0; }
.stage > * { position: absolute; }
.stage .glow, .stage .floor { inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage .glow { transition: opacity .6s; }
.stage button { padding: 0; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
.stage button img { width: 100%; pointer-events: none; }
.star { aspect-ratio: 1; background: url(img/star.svg) center / contain no-repeat; opacity: .6; animation: twinkle 3.6s var(--d) ease-in-out infinite; }
.steam { transform-origin: 50% 100%; animation: steam 3.2s ease-in-out infinite; pointer-events: none; }
.lamp { transform-origin: 50% 0; }
.lamp.swing { animation: swing 1.6s ease-out; }
.lamp img { transition: filter .5s; }
.chara { transform-origin: 50% 100%; transition: filter .6s; }
.chara:hover { animation: wiggle .5s ease-in-out; }
.chara[data-name="pou"] { animation: float 4s ease-in-out infinite; }
.chara.hop, .chara[data-name="pou"].hop { animation: hop .5s ease-out; }

.bubble {
  z-index: 5; margin: 0; padding: 2px 16px; transform: translate(-50%, -105%);
  border-radius: 18px; background: var(--rice); color: var(--line);
  font-family: var(--hand); font-size: clamp(13px, 2.1vw, 19px); line-height: 1.8; white-space: nowrap;
  animation: bubble-pop .25s ease-out;
}
.bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px;
  background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 3px;
}

/* 灯りを消したとき */
.lights-off .stage .glow { opacity: 0; }
.lights-off .lamp img { filter: brightness(.45) saturate(.6); }
.lights-off .chara:not([data-name="pou"]) { filter: brightness(.5) saturate(.7); }
.lights-off .steam { opacity: .25; animation: none; }
.lights-off .star { opacity: 1; }

/* ---------- 本文 ---------- */
main { max-width: 960px; margin: 0 auto; padding: 0 20px; }
section { padding: 72px 0 16px; }

h2 {
  margin: 0 0 20px; font-size: 26px; font-weight: 700;
  color: var(--light); letter-spacing: .12em; text-align: center;
}
h2::after {
  content: ''; display: block; width: 44px; height: 5px; margin: 10px auto 0;
  border-radius: 3px; background: var(--light); opacity: .5;
}
.lead { margin: -6px 0 26px; text-align: center; color: var(--soft); font-size: 15px; }
.about p, .goods p, .making p { max-width: 34em; margin: 0 auto 1em; }

.btn {
  display: inline-block; padding: 8px 28px; border: 0; border-radius: 999px;
  background: var(--light); color: var(--night); font-weight: 700; text-decoration: none;
  box-shadow: 0 5px 0 #c9a85a; transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translateY(2px); box-shadow: 0 3px 0 #c9a85a; }
.btn:active { transform: translateY(5px); box-shadow: none; }
.btn.ghost { background: var(--counter); color: var(--rice); box-shadow: 0 5px 0 #222c49; }
.btn small { display: block; font-size: 12px; font-weight: 500; line-height: 1.3; opacity: .7; }

/* なかまたち */
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
.cards li { flex: 1 1 250px; max-width: 300px; }
.card {
  display: block; width: 100%; height: 100%; padding: 26px 20px 20px;
  border: 0; border-radius: 28px; background: var(--card); text-align: center;
  transition: transform .2s, background .2s;
}
.card:hover { transform: translateY(-6px) rotate(-1deg); background: #3a4a78; }
.card img { height: 140px; margin: 0 auto 10px; transition: transform .25s; }
.card:hover img { transform: scale(1.08); }
.card span { display: block; }
.card .name { font-size: 24px; font-weight: 700; color: var(--light); letter-spacing: .1em; line-height: 1.5; }
.kind { color: var(--soft); font-size: 14px; }
.voice {
  margin: 12px 0 0; padding: 6px 14px; border-radius: 18px; background: var(--counter);
  font-family: var(--hand); font-size: 18px; color: var(--light);
}

/* プロフィール */
.profile {
  width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 34px 30px 30px; border: 0; border-radius: 32px;
  background: var(--counter); color: var(--rice); overflow: auto;
}
.profile[open] { display: grid; grid-template-columns: 1fr 1.1fr; gap: 28px; align-items: center; animation: pop .25s ease-out; }
.profile::backdrop { background: rgba(14, 20, 36, .72); }
.profile .close {
  position: absolute; top: 12px; right: 14px; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: var(--card); font-size: 24px; line-height: 1;
}
.profile-img { width: 100%; height: 220px; object-fit: contain; }
.exprs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.exprs button { padding: 0 14px; border: 0; border-radius: 999px; background: var(--card); font-size: 14px; }
.exprs button[aria-pressed="true"] { background: var(--light); color: var(--night); font-weight: 700; }
.profile h3 { margin: 0 0 8px; font-size: 32px; color: var(--light); letter-spacing: .1em; line-height: 1.4; }
.profile .kind, .profile .intro { margin: 0; }
.profile .intro { font-size: 16px; line-height: 1.9; }
.profile dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 16px 0 0; font-size: 15px; line-height: 1.8; }
.profile dt { padding: 0 12px; border-radius: 999px; background: var(--card); color: var(--soft); text-align: center; }
.profile dd { margin: 0; }
.profile .voice { text-align: center; background: var(--card); }

/* こんやのおとも */
.otomo-box { max-width: 420px; margin: 0 auto; padding: 28px 24px 30px; border-radius: 32px; background: var(--card); text-align: center; }
.otomo-box.pop { animation: pop .35s ease-out; }
.otomo-img { height: 150px; margin: 0 auto; }
.otomo-name { margin: 10px 0 0; font-size: 20px; font-weight: 700; color: var(--light); }
.otomo-line { margin: 0 0 18px; font-family: var(--hand); font-size: 20px; min-height: 2em; }
.otomo-box .btn { margin: 4px; }

/* かべがみ */
.papers { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 32px; }
.papers li { text-align: center; }
.papers img { margin: 0 auto 18px; border-radius: 18px; border: 5px solid var(--card); }
.papers li:first-child img { width: 170px; }
.papers li:last-child img { width: min(400px, 80vw); }

.paper-title { margin: 34px 0 18px; text-align: center; font-family: var(--hand); font-size: 22px; font-weight: 400; color: var(--light); }
.paper-title:first-of-type { margin-top: 0; }

/* おしらせ・SNS */
.news ul, .follow ul { list-style: none; margin: 0 auto; padding: 0; max-width: 34em; }
.news li { padding: 10px 0; border-bottom: 2px dotted rgba(201, 210, 234, .3); }
.news time { display: inline-block; margin-right: 1.2em; color: var(--soft); font-size: 15px; }
.follow ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.follow li a, .follow li span { display: block; padding: 6px 26px; border-radius: 999px; background: var(--card); color: var(--rice); font-weight: 700; text-decoration: none; }
.follow li span { opacity: .55; }
.follow li a:hover { background: var(--light); color: var(--night); }
.note { text-align: center; color: var(--soft); font-size: 15px; }

footer { padding: 80px 16px 40px; text-align: center; color: var(--soft); font-size: 14px; }
footer p { margin: 0; }
footer p a { color: inherit; }
.to-top { display: inline-block; margin-bottom: 14px; color: var(--light); font-family: var(--hand); font-size: 16px; text-decoration: none; }
.to-top img { margin: 0 auto; transition: transform .25s; }
.to-top:hover img { transform: translateY(-8px); }

/* 画面に入ったら、ふわっと出す（JavaScript が動くときだけ） */
.js-reveal .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s, transform .7s; }
.js-reveal .reveal.in { opacity: 1; transform: none; }

@keyframes twinkle { 50% { opacity: .15; transform: scale(.7); } }
@keyframes steam { 0%, 100% { transform: scaleY(1) translateX(0); opacity: .9; } 50% { transform: scaleY(1.12) translateX(2%); opacity: .5; } }
@keyframes swing { 0% { transform: rotate(0); } 20% { transform: rotate(5deg); } 45% { transform: rotate(-3.5deg); } 70% { transform: rotate(2deg); } 100% { transform: rotate(0); } }
@keyframes wiggle { 30% { transform: rotate(-3deg); } 70% { transform: rotate(3deg); } }
@keyframes hop { 30% { transform: translateY(-9%) scale(1.04, .97); } 60% { transform: translateY(0) scale(.97, 1.03); } }
@keyframes float { 50% { transform: translateY(-7%); } }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
@keyframes bubble-pop { from { transform: translate(-50%, -85%) scale(.8); opacity: 0; } }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav ul {
    position: absolute; inset: 100% 0 auto; display: none; flex-direction: column;
    padding: 8px 20px 20px; background: rgba(31, 42, 68, .97);
  }
  .nav.open ul { display: flex; }
  .nav ul a { padding: 8px 14px; font-size: 17px; }
  .profile[open] { grid-template-columns: 1fr; gap: 16px; padding: 30px 20px 24px; }
  .profile-img { height: 170px; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  section { padding-top: 56px; }
  h2 { font-size: 23px; }
  .hint { font-size: 12px; }
  .greeting { font-size: 15px; padding: 2px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 共有ページ（otomo/） */
.share { background: var(--night); }
.share main { min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 28px; padding: 24px 16px; }
.share img { width: min(900px, 100%); height: auto; border-radius: 24px; }
.share p { margin: 0; }
