/* 色はロゴ（brand/README.md）と同じ4色 */
:root {
  --red: #e8453c;
  --blue: #2f7fc1;
  --yellow: #f2b136;
  --green: #2e9e5b;
  --ink: #1f1f1f;
  --muted: #5f5f5f;
  --line: #e6e6e6;
  --page: #ffffff;
  --soft: #f7f7f5;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: 'Hiragino Sans', 'BIZ UDPGothic', 'Meiryo', system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.7;
}
main { max-width: 680px; margin: 0 auto; padding: 40px 16px 56px; }
a { color: var(--blue); }
a:focus-visible, button:focus-visible, textarea:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 4px; }

/* 小さい見出し（下層ページ） */
.top-bar { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--red); font-weight: 900; letter-spacing: 0.06em; }
.top-bar img { width: 32px; height: 33px; }

/* トップの見出し */
.hero { text-align: center; }
.mark-button { width: 96px; margin: 0 auto 16px; }
.hero .mark { display: block; width: 96px; height: 99px; overflow: visible; }
.hero h1 { margin: 0; color: var(--red); font-weight: 900; font-size: clamp(1.6rem, 7.6vw, 2.4rem); letter-spacing: 0.06em; white-space: nowrap; }
.hero h1 span { display: inline-block; }
.hero p { margin: 8px 0 0; color: var(--muted); font-size: 1rem; }

/* ロゴの部品が落ちてきて組み上がる */
.piece { transform-box: fill-box; transform-origin: center; }
.mark.assemble .piece { animation: drop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes drop {
  0% { transform: translateY(-160px) rotate(var(--r)); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: none; opacity: 1; }
}
/* 揺れるのは外側の .wig。.piece の落ちる動きと別の要素にしないと、マウスを離したときに落ちる動きが最初から再生される */
.wig { transform-box: fill-box; transform-origin: center; }
.mark-button:hover .wig { animation: wiggle 0.5s ease-in-out both; animation-delay: calc(var(--i) * 40ms); }
@keyframes wiggle { 30% { transform: translateY(-6px) rotate(-6deg); } 60% { transform: translateY(0) rotate(4deg); } }

/* 名前の文字が順に弾む */
.hero h1 span { animation: hop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: calc(500ms + var(--i) * 45ms); }
@keyframes hop { 0% { transform: translateY(18px) scale(0.6); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* 積み木の遊び場 */
.playground { position: relative; height: 220px; margin: 20px -16px 0; border-bottom: 2px solid var(--line); overflow: hidden; }
.playground canvas { display: block; cursor: grab; }
.playground canvas:active { cursor: grabbing; }
.playground .still { position: absolute; left: 50%; bottom: 0; width: 100%; max-width: 360px; transform: translateX(-50%); }

/* 道具のカード：画面に入ったら跳ねて出る。押すと目印が跳ねる */
.tool.waiting { opacity: 0; transform: translateY(24px) scale(0.96); }
.tool.pop { animation: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: var(--d, 0ms); }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(0.96); } to { opacity: 1; transform: none; } }
.tool .icon { transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
a.tool:hover .icon, a.tool:active .icon { transform: translateY(-6px) rotate(-8deg); }
.tool .go { transition: transform 0.2s; }
a.tool:hover .go { transform: translateX(4px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tool.waiting { opacity: 1; transform: none; }
  }

h2.section { margin: 40px 0 14px; font-size: 1.05rem; color: var(--muted); letter-spacing: 0.1em; }
h2.section .section-sub { margin-left: 10px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); opacity: 0.8; }

/* 道具の一覧 */
.tools { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.tool { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; padding: 18px; border: 2px solid var(--line); border-radius: 18px; background: var(--page); color: inherit; text-decoration: none; }
a.tool:hover { border-color: var(--c); }
.tool .icon { width: 56px; height: 56px; border-radius: 12px; }
.tool-name { display: block; font-size: 1.15rem; font-weight: 800; }
.tool-desc { display: block; margin-top: 2px; font-size: 0.95rem; color: var(--muted); line-height: 1.6; }
.tool .go { font-size: 1.6rem; color: var(--c); font-weight: 700; }
.tool.soon { background: var(--soft); border-style: dashed; }
.tool.soon .tool-name { color: var(--muted); }
.badge { display: inline-block; margin-left: 6px; padding: 0 10px; border-radius: 999px; background: var(--line); color: var(--muted); font-size: 0.75rem; font-weight: 600; vertical-align: 2px; }

/* おしらせ */
.posts { list-style: none; margin: 0; padding: 0; }
.posts li { border-top: 1px solid var(--line); }
.posts li:last-child { border-bottom: 1px solid var(--line); }
.posts a { display: block; padding: 14px 4px; color: inherit; text-decoration: none; }
.posts time { display: block; font-size: 0.85rem; color: var(--muted); }
.posts .t { font-weight: 700; }
.more { display: inline-block; margin-top: 10px; font-size: 0.95rem; }

.links { list-style: none; margin: 0; padding: 0; }
.links li + li { margin-top: 6px; }

/* 窓口 */
.contact-box { margin-top: 40px; padding: 22px 20px; border-radius: 18px; background: var(--soft); text-align: center; }
.contact-box p { margin: 0 0 14px; font-size: 0.95rem; color: var(--muted); }
.button { display: inline-block; padding: 12px 22px; border: none; border-radius: 999px; background: var(--red); color: #fff; font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; }
.contact-box .x { display: block; margin-top: 12px; font-size: 0.95rem; color: var(--ink); }

footer { margin-top: 36px; font-size: 0.8rem; color: var(--muted); text-align: center; line-height: 1.8; }

/* 記事 */
article h1 { font-size: 1.6rem; line-height: 1.4; margin: 28px 0 4px; }
article time { color: var(--muted); font-size: 0.9rem; }
article h2 { font-size: 1.2rem; margin: 32px 0 8px; padding-left: 12px; border-left: 6px solid var(--yellow); }
article p, article li { line-height: 1.9; }

/* ご意見チャット */
.chat { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; }
.msg { max-width: 85%; padding: 12px 16px; border-radius: 18px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { background: var(--soft); border-top-left-radius: 4px; }
.msg.me { justify-self: end; background: var(--blue); color: #fff; border-top-right-radius: 4px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.choice { padding: 10px 16px; border: 2px solid var(--blue); border-radius: 999px; background: #fff; color: var(--blue); font: inherit; font-weight: 700; cursor: pointer; }
.choice.sub { border-color: var(--line); color: var(--muted); }
.composer { display: grid; gap: 8px; margin-top: 4px; }
.composer textarea { width: 100%; min-height: 120px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; font: inherit; resize: vertical; }
.composer .row { display: flex; gap: 8px; justify-content: flex-end; }
.note { margin-top: 24px; font-size: 0.8rem; color: var(--muted); }

/* 道具のタブ。積み木の色のボタン2つ。JavaScript があるときだけ出る */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 40px 0 16px; }
.tabs[hidden] { display: none; }
.tabs [role="tab"] { display: grid; gap: 2px; padding: 14px 10px; border: 2px solid var(--c); border-radius: 16px; background: #fff; color: var(--c); font: inherit; text-align: center; cursor: pointer; transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1); }
.tabs [role="tab"]:active { transform: scale(0.97); }
.tabs [role="tab"][aria-selected="true"] { background: var(--c); color: #fff; }
.tab-title { font-weight: 900; font-size: 1.05rem; letter-spacing: 0.06em; }
.tab-sub { font-size: 0.78rem; font-weight: 600; opacity: 0.9; }
/* タブがあるときは、欄の見出しを画面から隠す（読み上げには残す） */
.has-tabs .panel-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
