/* ホーム画面（じぶんの聞こえプロジェクト）
   色はアルビーの服と毛の色から：紺（パーカー）・ミント（毛）・オレンジ（パーカー）・黄（星のワッペン）・空色（スニーカー）
   背景は方眼ノート。ステップはワッペン（ぬい目つき）、記録があると「できた！」のはんこ。 */
:root {
  --navy: #1E2A55;
  --mint: #8FD9B6;
  --mint-deep: #1D7F68;
  --orange: #F28A2E;
  --sun: #FFC94A;
  --sky: #9FC3F5;
  --paper: #F4FAF7;
  --shu: #C8361F;
  --ink-soft: #4A5476;
  --display: "Zen Maru Gothic", "BIZ UDPGothic", "Hiragino Maru Gothic ProN", sans-serif;
  --body: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--navy);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.75;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(29, 127, 104, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 127, 104, .08) 1px, transparent 1px);
  background-size: 28px 28px;
}

h1, h2, h3 { font-family: var(--display); font-weight: 900; margin: 0; }
/* 丸ゴシックの見出しは、かなの間を詰める */
h1, h2, h3, .mark, .nametag, .sayings li, .t b, .cheer span, .loop, .stop, .tile.done::after { font-feature-settings: "palt"; letter-spacing: -.02em; }
.nowrap { white-space: nowrap; }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; height: auto; }

/* ---------- 上のロゴ ---------- */
.top { max-width: 1040px; margin: 0 auto; padding: 18px 24px 0; }
.mark {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 900; font-size: 20px;
  text-decoration: none;
}
.mark-ear { width: 36px; height: 36px; }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }   /* ロゴ＋「ホームにもどる」（ホーム以外のページ） */

/* ---------- アルビーの吹き出し ---------- */
.hero {
  max-width: 1040px; margin: 10px auto 0; padding: 0 24px;
  display: grid; grid-template-columns: 330px 1fr; gap: 30px; align-items: end;
}
.alby { margin: 0; position: relative; text-align: center; }
.alby::before {                       /* 足もとの地面 */
  content: ""; position: absolute; left: 8%; right: 8%; bottom: 58px; height: 46px;
  border-radius: 50%; background: var(--mint); opacity: .55; z-index: -1;
}
.alby img { display: block; width: 100%; margin: 0 auto; }
.nametag {
  display: inline-block; margin-top: -26px; position: relative;
  padding: 10px 20px 12px; border: 3px solid var(--navy); border-radius: 14px;
  background: var(--orange); outline: 2px dashed rgba(30, 42, 85, .55); outline-offset: -8px;
  transform: rotate(-3deg); font-family: var(--display); font-weight: 700; font-size: 16px; line-height: 1.4;
}
.nametag b { display: block; font-size: 22px; font-weight: 900; }

.bubble {
  position: relative; margin-bottom: 70px;
  padding: 32px 36px 30px; background: #fff;
  border: 3px solid var(--navy); border-radius: 28px; box-shadow: 8px 8px 0 var(--navy);
}
.bubble::before {                    /* 吹き出しのしっぽ（アルビーの方を向く） */
  content: ""; position: absolute; left: -20px; bottom: 74px; width: 34px; height: 34px;
  background: #fff; border-left: 3px solid var(--navy); border-bottom: 3px solid var(--navy);
  transform: rotate(45deg) skew(10deg, 10deg);
}
.bubble h1 { font-size: 39px; line-height: 1.3; margin-bottom: 14px; }
.bubble p + p { margin-top: 14px; }
.lead { font-size: 20px; line-height: 1.8; }
.lead strong { background: linear-gradient(transparent 58%, var(--sun) 58%); padding: 0 2px; }
.example-intro { font-weight: 700; color: var(--mint-deep); }
.sayings { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.sayings li {
  padding: 7px 16px; background: #E4F6EE; border: 2px solid var(--mint-deep);
  border-radius: 999px 999px 999px 6px; font-family: var(--display); font-weight: 700; font-size: 17px;
}

/* ページを開いたときだけ：アルビーがはねて、吹き出しが出る */
@media (prefers-reduced-motion: no-preference) {
  .alby img { animation: hop .8s cubic-bezier(.2, .9, .3, 1.3) both; }
  .bubble { animation: say .5s .35s cubic-bezier(.2, .9, .3, 1.2) both; transform-origin: 0 85%; }
}
@keyframes hop { from { transform: translateY(40px) scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes say { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 4つのステップ（すごろくの道） ---------- */
.route { max-width: 1040px; margin: 30px auto 0; padding: 0 24px; }
.route h2 { font-size: 31px; }
.route-sub { margin-top: 4px; color: var(--ink-soft); font-size: 16px; }

.steps { list-style: none; margin: 28px 0 0; padding: 0; position: relative; }
.steps::before {                     /* 道 */
  content: ""; position: absolute; left: 29px; top: 34px; bottom: 90px;
  border-left: 6px dashed rgba(30, 42, 85, .3);
}
.step { display: grid; grid-template-columns: 64px 1fr; gap: 22px; margin-bottom: 40px; position: relative; }
.s1 { --c: var(--mint); --cd: var(--mint-deep); --tint: #E7F7EF; }
.s2 { --c: var(--sun); --cd: #9A7108; --tint: #FFF5D9; }
.s3 { --c: var(--orange); --cd: #B0560F; --tint: #FFEBD9; }
.s4 { --c: var(--sky); --cd: #2F5FA8; --tint: #E8F0FD; }

.stop {
  width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--navy); background: var(--c);
  display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 30px;
  box-shadow: 0 5px 0 var(--navy); position: relative; z-index: 1;
}

.patch {
  position: relative; padding: 24px 28px 26px; background: #fff;
  border: 3px solid var(--navy); border-radius: 22px; box-shadow: 7px 7px 0 var(--c);
}
.patch::after {                      /* ワッペンのぬい目 */
  content: ""; position: absolute; inset: 8px; border: 2px dashed var(--cd);
  border-radius: 15px; opacity: .45; pointer-events: none;
}
.s1 .patch { transform: rotate(-.5deg); }
.s2 .patch { transform: rotate(.4deg); }
.s3 .patch { transform: rotate(-.3deg); }
.s4 .patch { transform: rotate(.5deg); }

.patch h3 { font-size: 27px; line-height: 1.35; }
.patch h3 span {
  display: inline-block; margin-left: 12px; font-family: var(--body); font-weight: 700;
  font-size: 15px; color: var(--cd); vertical-align: 4px;
}
.why { margin: 6px 0 4px; font-size: 16px; color: var(--ink-soft); }

.tile {
  position: relative; z-index: 1; display: grid; grid-template-columns: 54px 1fr; gap: 16px; align-items: start;
  margin-top: 12px; padding: 14px 18px 15px 14px; border-radius: 14px; border: 2px solid transparent;
  background: var(--tint); text-decoration: none; transition: transform .15s ease, border-color .15s ease;
}
.tile:hover { transform: translateY(-2px); border-color: var(--navy); }
.tile:focus-visible { outline: 4px solid var(--navy); outline-offset: 3px; }
.ico {
  width: 54px; height: 54px; padding: 5px; background: #fff; border: 2px solid var(--navy); border-radius: 13px;
  fill: none; stroke: var(--navy); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
}
.t { font-size: 16px; line-height: 1.65; }
.t b { display: block; margin-bottom: 3px; font-family: var(--display); font-weight: 700; font-size: 21px; line-height: 1.35; }

/* 記録があると押される「できた！」のはんこ */
.tile.done { padding-right: 104px; }
.tile.done::after {
  content: "できた！"; position: absolute; right: 16px; top: 50%; margin-top: -38px;
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  color: var(--shu); background: rgba(255, 255, 255, .9); border: 3px solid var(--shu);
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px var(--shu);
  font-family: var(--display); font-weight: 900; font-size: 15px; transform: rotate(-14deg);
}

.stamp-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.cheer { position: absolute; right: 22px; top: -86px; width: 116px; z-index: 2; }
.cheer img { display: block; width: 100%; }
.cheer span {
  position: absolute; right: 104%; top: 22px; white-space: nowrap; padding: 6px 12px;
  background: #fff; border: 2px solid var(--navy); border-radius: 14px;
  font-family: var(--display); font-weight: 900; font-size: 15px; line-height: 1.35; text-align: center;
}

.loop {
  display: flex; align-items: center; gap: 14px; margin-top: 18px;
  font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1.6;
}
.loop img { width: 104px; flex: none; }

/* ---------- この端末の記録 ---------- */
.device {
  max-width: 992px; margin: 16px auto 56px; padding: 24px 30px;
  display: grid; grid-template-columns: 140px 1fr; gap: 26px; align-items: center;
  background: #fff; border: 3px solid var(--navy); border-radius: 22px;
}
.device img { width: 140px; }
.device h2 { font-size: 25px; margin-bottom: 6px; }
.device p { font-size: 16px; }
.device p + p { margin-top: 8px; }
.device-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.btn-plain, .btn-danger {
  display: inline-block; padding: 10px 20px; border-radius: 999px; font-family: var(--body); font-weight: 700;
  font-size: 16px; line-height: 1.4; text-decoration: none; cursor: pointer;
}
.btn-plain { border: 2px solid var(--navy); background: #fff; color: var(--navy); }
.btn-danger { border: 2px solid #A8231A; background: #A8231A; color: #fff; }
.btn-plain:focus-visible, .btn-danger:focus-visible, .mark:focus-visible { outline: 4px solid var(--orange); outline-offset: 3px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 12px 22px;
  border-radius: 999px; background: var(--navy); color: #fff; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.toast.show { opacity: 1; }

/* ---------- タブレット・スマホ ---------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 0; }
  .alby { display: flex; align-items: flex-end; gap: 12px; text-align: left; }
  .alby::before { left: 0; width: 170px; bottom: 0; height: 30px; }
  .alby img { width: 170px; margin: 0; }
  .nametag { margin: 0 0 16px; }
  .bubble { margin: 16px 0 0; padding: 24px 22px; }
  .bubble::before { left: 64px; top: -20px; bottom: auto; transform: rotate(135deg) skew(10deg, 10deg); }
  .bubble h1 { font-size: 25px; }
  .sayings li { font-size: 15px; }
  .lead { font-size: 18px; }
  .route { margin-top: 44px; }
  .route h2 { font-size: 26px; }
  .steps::before { left: 21px; }
  .step { grid-template-columns: 48px 1fr; gap: 12px; }
  .stop { width: 48px; height: 48px; font-size: 24px; }
  .patch { padding: 20px 18px 22px; }
  .patch h3 { font-size: 24px; }
  .patch h3 span { display: block; margin: 2px 0 0; }
  .cheer { width: 80px; top: -58px; right: 10px; }
  .cheer span { font-size: 13px; }
  .tile { grid-template-columns: 46px 1fr; gap: 12px; }
  .ico { width: 46px; height: 46px; }
  .tile.done { padding-right: 18px; padding-top: 74px; }
  .tile.done::after { top: 8px; right: 10px; margin-top: 0; width: 60px; height: 60px; font-size: 12px; }
  .device { grid-template-columns: 1fr; margin: 16px 24px 48px; padding: 22px; }
  .device img { width: 110px; }
}
