/* しまなみ ぶんちょう家 公式サイト
   配色は番組と同じ絵本の色（黄色の壁・赤・青・緑）。紫〜青のグラデーションや光る枠は使わない（全体の決まり「AI感を出さない」） */
:root {
  --wall: #fde27c;
  --wall2: #f6cf5a;
  --red: #e0523f;
  --blue: #3f8fd0;
  --sea: #3d9ad8;
  --green: #8fd0a6;
  --ink: #4a3a30;
  --paper: #fff8ee;
  --pink: #ff8fb3;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); background: var(--wall);
  font-family: 'Zen Maru Gothic', sans-serif; font-weight: 500; line-height: 1.8;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

/* 読み込み：茶色の幕が丸く開く */
#loader {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 6px;
  background: #3a2a22; color: var(--paper); font-weight: 900;
  clip-path: circle(150% at 50% 50%); transition: clip-path .9s cubic-bezier(.7, 0, .3, 1);
}
#loader.open { clip-path: circle(0% at 50% 45%); }
.loader-bird { animation: hop .6s ease-in-out infinite; }
.loader-text { margin: 0; letter-spacing: .2em; }
@keyframes hop { 50% { transform: translateY(-14px) rotate(-6deg); } }

/* 上の帯 */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar-logo {
  font-weight: 900; font-size: 20px; color: var(--paper); text-decoration: none;
  -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; opacity: 0; transition: opacity .3s;
}
.bar-logo span { color: var(--red); }
.scrolled .bar-logo { opacity: 1; }
.menu-btn {
  display: flex; align-items: center; gap: 4px; background: var(--paper); border: 3px solid var(--ink);
  border-radius: 999px; padding: 4px 14px 4px 8px; font-weight: 900; letter-spacing: .1em; font-size: 14px;
  box-shadow: 0 3px 0 var(--ink); transition: transform .15s;
}
.menu-btn:active { transform: translateY(3px); box-shadow: none; }

/* ことばの切り替え（日本語・英語・繁体字・韓国語）。時間帯のボタンと同じ形 */
.bar-right { display: flex; align-items: center; gap: 8px; }
.lang { display: flex; gap: 1px; background: #ffffffcc; border: 2px solid var(--ink); border-radius: 999px; padding: 2px; }
.lang button { font-size: 12px; font-weight: 900; padding: 1px 8px; border-radius: 999px; line-height: 1.6; white-space: nowrap; }
.lang button.on { background: var(--ink); color: var(--paper); }
/* 字の形：繁体字は Noto Sans TC、韓国語は Noto Sans KR。日本語のまま残す所（題字・台詞）は丸い字のまま */
[lang="zh-Hant"] { font-family: 'Noto Sans TC', 'Zen Maru Gothic', sans-serif; }
[lang="ko"] { font-family: 'Noto Sans KR', 'Zen Maru Gothic', sans-serif; }
[lang="ja"] { font-family: 'Zen Maru Gothic', sans-serif; }
.bar-logo { white-space: nowrap; }
/* 携帯の幅で、ことばボタンが出ているときは帯がいっぱいになるので、上の小さな題字は出さない（いまは英語だけでボタンを隠している） */
@media (max-width: 420px) { .bar:has(.lang:not([hidden])) .bar-logo { display: none; } }
.lang[hidden], .lang button[hidden] { display: none; }
.head small:empty, .menu small:empty { display: none; }
@media (max-width: 340px) { .lang button { padding: 1px 6px; } }
.menu-open .menu-btn svg { animation: flap .3s ease-in-out infinite; }
@keyframes flap { 50% { transform: rotate(-14deg); } }

/* メニュー：海が下から上がってくる */
.menu {
  position: fixed; inset: 0; z-index: 40; background: var(--sea); display: grid; place-items: center;
  transform: translateY(calc(100% + 70px)); transition: transform .55s cubic-bezier(.7, 0, .2, 1);   /* 上の波の分も下げて、閉じているときは見せない */
}
.menu-open .menu { transform: none; }
.menu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; text-align: center; }
.menu a { display: block; text-decoration: none; color: #fff; }
.menu b { display: block; font-size: 24px; font-weight: 900; -webkit-text-stroke: 6px #1e5aa8; paint-order: stroke fill; transition: transform .2s; }
.menu small { font-size: 11px; letter-spacing: .3em; color: #cfe9fb; }
.menu a:hover b, .menu a:focus b { transform: rotate(-3deg) scale(1.08); }
.menu-sea { position: absolute; top: -59px; left: 0; width: 100%; height: 60px; animation: sway 3s ease-in-out infinite alternate; }
@keyframes sway { to { transform: translateX(-20px); } }

/* 表紙 */
.home {
  position: relative; min-height: 100svh; padding: 70px 16px 24px; display: flex; flex-direction: column; align-items: center;
  background:
    radial-gradient(circle at 20% 30%, #fff0a855 0 18%, transparent 19%),
    radial-gradient(circle at 80% 60%, #f6cf5a44 0 22%, transparent 23%),
    var(--wall);
  overflow: hidden;
}
.home::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 26%; background: #e9a85e; z-index: 0; }
.window {
  position: absolute; top: 56px; left: 50%; width: min(86vw, 460px); aspect-ratio: 400 / 260; transform: translateX(-50%);
  border: 12px solid #fff; border-radius: 4px; box-shadow: 0 6px 0 #00000014; overflow: hidden;
}
.window::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 8px; margin-left: -4px; background: #fff; }
.window svg { width: 100%; height: 100%; display: block; }
.window { z-index: 2; }
/* 朝・昼・夕・夜の色は main.js が入れる。切り替わるときは、ゆっくり変わる */
#view * { transition: fill 2s, stroke 2s, opacity 2s, stop-color 2s; }
#view stop { transition: stop-color 2s; }
.waves { animation: shimmer 2.4s ease-in-out infinite alternate; }
/* 部屋の明るさ：夜は青く暗く、夕方は橙に */
.home::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: var(--tint, transparent); transition: background 2s; }
.tod {
  position: absolute; z-index: 3; top: 76px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px;
  background: #ffffffcc; border: 2px solid var(--ink); border-radius: 999px; padding: 2px;
}
.tod button { font-size: 12px; font-weight: 900; padding: 1px 10px; border-radius: 999px; white-space: nowrap; }
.tod button.on { background: var(--ink); color: var(--paper); }
@keyframes shimmer { to { transform: translateX(12px); opacity: .6; } }

/* 題字：雲で囲んだ2行（2026-11-09）。雲の形は main.js が字の幅を測って描く（左右対称） */
.title {
  position: relative; z-index: 2; margin: calc(min(86vw, 460px) * 0.65 + 34px) 0 0; padding: .55em .9em .5em;
  font-size: clamp(24px, 6.8vw, 46px); font-weight: 900; text-align: center; line-height: 1.3; cursor: pointer;
}
.t-cloud { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: -1; }
.t-line { display: block; width: fit-content; margin: 0 auto; position: relative; }
.t-ja .t-l2 { transform: translateX(.2em); }                                      /* 日本語だけ：「。」の右の空きの分、見た目の真ん中に戻す */
.t-blue { color: var(--blue); }
.t-red { color: var(--red); }
.t-bird { position: absolute; width: 2.2em; transform-origin: 50% 90%; animation: perch 3.2s ease-in-out infinite; cursor: pointer; }
@keyframes perch { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-12deg) translateY(-4px); } 90% { transform: rotate(6deg); } }
.title .letter { display: inline-block; }
.title.boing .letter { animation: boing .5s ease both; animation-delay: calc(var(--i) * 40ms); }
@keyframes boing { 40% { transform: translateY(-12px) scaleY(1.1); } 70% { transform: translateY(2px) scaleY(.92); } }

.catch { position: relative; z-index: 2; text-align: center; font-weight: 700; margin: 8px 0 0; }
/* 題字とひと言の訳（日本語以外のとき） */
.title-sub { position: relative; z-index: 2; margin: 6px 0 0; font-size: 13px; font-weight: 900; line-height: 1.5; color: var(--ink); -webkit-text-stroke: 4px #fdf6e8; paint-order: stroke fill; text-align: center; }
.catch-sub { position: relative; z-index: 2; margin: 2px 0 0; font-size: 12px; text-align: center; line-height: 1.5; opacity: .8; }

.room { position: relative; z-index: 2; width: min(100%, 460px); height: 200px; margin-top: 14px; }
.rug { position: absolute; left: 4%; right: 4%; bottom: 0; height: 46px; background: var(--green); border-radius: 50%; z-index: -1; }
.who { position: absolute; bottom: 14px; transform-origin: 50% 100%; animation: breathe 2.6s ease-in-out infinite; }
.who img {
  width: 100%; pointer-events: none; user-select: none; -webkit-user-drag: none;
  transform-origin: 50% 100%; transform: rotate(var(--tilt, 0deg)) translateY(var(--lift, 0px)) scale(var(--grow, 1));
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
/* マウスのある端末だけ：乗せると浮き上がって、うれしい顔（顔の差し替えは main.js） */
@media (hover: hover) {
  .who:hover { --lift: -10px; --grow: 1.05; }
  .who:hover img { filter: drop-shadow(0 8px 0 #00000018); }
  .who.pii:hover svg { transform: translateY(-4px); transition: transform .2s; }
}
.who.papa { left: 6%; width: 30%; }
.who.mama { left: 34%; width: 29%; bottom: 22px; animation-delay: -.6s; }
.who.musume { left: 61%; width: 22%; animation-delay: -1.2s; }
.who.pii { right: 0; width: 17%; bottom: 8px; animation: none; }
.who.pii svg { width: 100%; display: block; overflow: visible; }
@keyframes breathe { 50% { transform: scaleY(1.025) rotate(.6deg); } }
.who.jump { animation: jump .5s ease; }
@keyframes jump { 30% { transform: translateY(-26px) scaleY(1.06); } 60% { transform: translateY(0) scaleY(.92); } }
.pii-bird.hop { animation: piihop .45s ease; transform-box: fill-box; }
@keyframes piihop { 40% { translate: 0 -18px; } }
.hint { position: relative; z-index: 2; font-size: 13px; margin: 10px 0 0; opacity: .75; }
.home .hint { color: var(--paper); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; font-weight: 700; opacity: 1; }

/* ふきだし（タップしたとき） */
.bubble {
  position: absolute; z-index: 30; transform: translate(-50%, -100%); background: #fff; border: 4px solid var(--ink);
  border-radius: 26px; padding: 6px 16px; font-weight: 900; font-size: 16px; white-space: nowrap; pointer-events: none;
  animation: pop .25s ease-out, fade .4s ease-in 1.7s forwards;
}
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -14px; margin-left: -9px; border: 9px solid transparent; border-top: 12px solid var(--ink); border-bottom: 0; }
.bubble.kandaka { border-color: #e0679a; color: #d0457e; background: #fff2f7; }
.bubble.kandaka::after { border-top-color: #e0679a; }
.bubble.tantan { border-radius: 10px; color: #4a4a52; border-color: #7a7a86; font-weight: 700; }
.bubble.tantan::after { border-top-color: #7a7a86; }
.bubble.pii { color: #b8862a; border-color: #d9a640; background: #fffaf0; }
.bubble.pii::after { border-top-color: #d9a640; }
/* 台詞の訳：日本語の下に、点線で区切って小さく（動画の「日本語とセット」と同じ形） */
.bubble .sub, .say .sub { display: block; font-size: 12px; font-weight: 700; line-height: 1.4; }
.bubble .sub { border-top: 2px dotted currentColor; margin-top: 3px; padding-top: 2px; opacity: .85; }
.say .sub { color: var(--ink); opacity: .75; }
@keyframes pop { from { transform: translate(-50%, -80%) scale(.6); } }
@keyframes fade { to { opacity: 0; transform: translate(-50%, -130%); } }

/* 文字を選ぶと出る、元の日本語（英語などのときだけ） */
.ja-pop {
  position: fixed; z-index: 70; max-width: min(340px, calc(100vw - 16px)); background: var(--paper); border: 3px solid var(--ink);
  border-radius: 14px; padding: 4px 14px 8px; box-shadow: 0 4px 0 var(--ink); pointer-events: none; animation: pop .2s ease-out;
}
.ja-pop[hidden] { display: none; }
.ja-pop small { display: block; font-size: 10px; font-weight: 700; letter-spacing: .1em; opacity: .6; }
.ja-pop span { display: block; font-size: 16px; font-weight: 900; line-height: 1.5; white-space: pre-line; }
.home .tip { margin-top: 4px; font-size: 12px; }
.home .tip[hidden] { display: none; }

/* 背景を押すと出る「ぴっ」 */
.pip { position: absolute; z-index: 30; pointer-events: none; font-weight: 900; color: #d9a640; -webkit-text-stroke: 4px #fff; paint-order: stroke fill; animation: pipup .9s ease-out forwards; }
@keyframes pipup { to { transform: translateY(-50px) rotate(-10deg); opacity: 0; } }

/* 各かたまり */
.sec { padding: 64px 16px; position: relative; }
.head { margin: 0 auto 26px; text-align: center; line-height: 1.1; }
.head span {
  display: inline-block; font-size: 30px; font-weight: 900; color: var(--paper); -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill;
  filter: url(#wobble); transform: rotate(-2deg);
}
.head small { display: block; margin-top: 6px; font-size: 11px; letter-spacing: .4em; color: var(--ink); opacity: .6; }

.about { background: var(--paper); }
.about::before, .family::before, .episodes::before, .sandan::before, .feed::before, .watch::before {
  content: ''; position: absolute; left: 0; right: 0; top: -18px; height: 20px;
  background: radial-gradient(circle at 12px 20px, currentColor 12px, transparent 13px) 0 0 / 24px 20px repeat-x;
}
.about::before { color: var(--paper); }
.about-body { max-width: 520px; margin: 0 auto; text-align: center; }
.about-body p { margin: 0 0 14px; }
.note { font-size: 12px; opacity: .7; }

.family { background: var(--green); color: var(--ink); }
.family::before { color: var(--green); }
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; max-width: 640px; margin: 0 auto; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(4, 1fr); } }
.card {
  background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 12px 10px 14px; text-align: center;
  box-shadow: 0 5px 0 var(--ink); cursor: pointer; transition: transform .2s; position: relative;
}
.card:nth-child(odd) { transform: rotate(-1.5deg); }
.card:nth-child(even) { transform: rotate(1.2deg); }
.card:hover, .card:focus { transform: rotate(0) translateY(-4px); outline: none; }
.card-face { height: 120px; display: grid; place-items: center; }
.card-face img { height: 110px; width: auto; transition: transform .3s; }
.card.talk .card-face img, .card.talk .card-face svg { animation: jump .5s ease; }
.pii-face svg { width: 110px; }
.card h3 { margin: 6px 0 0; font-size: 20px; font-weight: 900; }
.role { margin: 0; font-size: 12px; display: inline-block; background: var(--wall); border-radius: 999px; padding: 0 10px; }
.desc { font-size: 13px; margin: 8px 0 0; line-height: 1.6; }
.say { min-height: 1.6em; margin: 6px 0 0; font-weight: 900; font-size: 14px; color: var(--red); }

.episodes { background: var(--wall); }
.episodes::before { color: var(--wall); }
.drag-hint { text-align: center; font-size: 13px; margin: -12px 0 12px; }
.drag-hint i { font-style: normal; }
.drag-hint span { display: inline-block; animation: nudge 1.2s ease-in-out infinite; }
.drag-hint span:last-child { animation-direction: reverse; }
@keyframes nudge { 50% { transform: translateX(-5px); } }
.strip {
  display: flex; gap: 14px; overflow-x: auto; padding: 8px 16px 18px; margin: 0 -16px; cursor: grab;
  scroll-snap-type: x proximity; scrollbar-width: none; user-select: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip.dragging { cursor: grabbing; scroll-snap-type: none; }
.ep {
  flex: 0 0 150px; scroll-snap-align: center; background: var(--paper); border: 3px solid var(--ink); border-radius: 14px;
  overflow: hidden; box-shadow: 0 5px 0 var(--ink); transition: transform .2s;
}
.ep:nth-child(3n) { transform: rotate(-2deg); }
.ep:nth-child(3n+1) { transform: rotate(1.5deg); }
.ep:hover { transform: translateY(-6px) rotate(0); }
.ep img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.ep p { margin: 0; padding: 6px 8px 8px; font-size: 12px; line-height: 1.4; font-weight: 700; }
.ep b { display: block; font-size: 11px; color: var(--red); }
.ep-sub { display: block; margin-top: 3px; font-size: 11px; font-weight: 500; opacity: .75; }
.soon { text-align: center; font-size: 13px; margin: 10px 0 0; }

.sandan { background: var(--paper); }
.sandan::before { color: var(--paper); }
.machine { max-width: 520px; margin: 0 auto; display: grid; gap: 14px; justify-items: center; }
.m-papa img { height: 140px; width: auto; transform-origin: 50% 100%; }
.m-papa.dance img { animation: dance .35s ease-in-out infinite alternate; }
@keyframes dance { from { transform: rotate(-10deg) translateY(0); } to { transform: rotate(10deg) translateY(-8px); } }
.m-form { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: end; }
.m-form label { display: grid; font-size: 12px; font-weight: 700; }
.m-form input {
  width: 130px; font: inherit; font-weight: 900; font-size: 16px; padding: 6px 10px; border: 3px solid var(--ink); border-radius: 12px;
  background: #fff; color: var(--ink);
}
.btn {
  background: var(--red); color: #fff; font-weight: 900; padding: 8px 18px; border: 3px solid var(--ink); border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
}
.btn:active { transform: translateY(4px); box-shadow: none; }
.m-out { list-style: none; margin: 0; padding: 0; text-align: center; min-height: 7em; font-weight: 900; }
.m-out li { opacity: 0; transform: translateY(8px); transition: .3s; }
.m-out li.on { opacity: 1; transform: none; }
.m-out li:last-child { font-size: 22px; color: #d0457e; }

.feed { background: #f2c49b; }
.feed::before { color: #f2c49b; }
.feed-text { text-align: center; margin: -10px 0 12px; }
.feed-stage { position: relative; max-width: 420px; height: 300px; margin: 0 auto; background: var(--wall); border: 3px solid var(--ink); border-radius: 20px; overflow: hidden; touch-action: none; }
.feed-cage { position: absolute; right: 8%; bottom: 6px; width: 46%; }
.feed-cage svg { width: 100%; overflow: visible; display: block; }
.feed-cage.yum .pii-bird { animation: piihop .45s ease 3; }
.feed-cage.near { filter: drop-shadow(0 0 0 transparent); }
.feed-cage.near svg { transform: scale(1.04); transition: transform .15s; }
.awa { position: absolute; left: 14%; top: 60px; cursor: grab; touch-action: none; transform-origin: 50% 100%; animation: wiggle 2s ease-in-out infinite; }
.awa.held { cursor: grabbing; animation: none; transform: rotate(-12deg) scale(1.1); }
@keyframes wiggle { 50% { transform: rotate(6deg); } }
.feed-count { text-align: center; margin: 14px 0 0; font-weight: 700; }
.feed-count b { font-size: 22px; color: var(--red); }

.watch { background: var(--blue); color: #fff; }
.watch::before { color: var(--blue); }
.watch .head span { -webkit-text-stroke-color: #1e3a68; }
.watch .head small { color: #fff; }
.sns { list-style: none; padding: 0; margin: 0 auto; max-width: 420px; display: grid; gap: 10px; }
.sns li { display: flex; justify-content: space-between; align-items: center; background: #ffffff1f; border: 2px dashed #ffffff88; border-radius: 14px; padding: 10px 16px; }
.sns-name { font-weight: 900; font-size: 18px; }
.sns-state { font-size: 12px; background: #fff; color: var(--blue); border-radius: 999px; padding: 0 10px; font-weight: 700; }
a.sns-name { color: #fff; text-decoration: none; }
a.sns-state.on { background: var(--red); color: #fff; padding: 2px 14px; font-size: 13px; text-decoration: none; box-shadow: 0 3px 0 #1e3a68; }
/* 各話の帯：公開した回は YouTube へ。まだの回は「次」の札 */
a.ep { color: inherit; text-decoration: none; }
.ep.next { display: grid; place-content: center; text-align: center; padding: 16px 10px; background: #fff8eeaa; border-style: dashed; aspect-ratio: auto; }
.ep.next p { padding: 0; }
.ep.next .soon-small { margin-top: 10px; font-size: 11px; font-weight: 500; opacity: .7; }

.foot { background: #3a2a22; color: var(--paper); text-align: center; padding: 30px 16px 36px; font-size: 12px; }
.copy { margin: 4px 0 0; font-size: 11px; color: #fff8ee73; letter-spacing: .04em; }   /* コピーライトは目立たせない（本人） */
.to-top { display: inline-grid; justify-items: center; color: var(--paper); font-weight: 700; margin-bottom: 8px; }
.to-top.fly svg { animation: fly .8s ease-in forwards; }
@keyframes fly { to { transform: translate(40px, -160px) rotate(-20deg); opacity: 0; } }

/* 出てくるときに、ひょこっと */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s, transform .6s cubic-bezier(.3, 1.4, .5, 1); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #loader { display: none; }
}
