/* ================================================================
   よきつぶ — 挿絵主導デザイン（E案：中性的な子ども × 線画）
   生成りの紙にやわらかい線。丸ゴシックの見出し。差し色はテラコッタ。
   挿絵と地続きになるよう、ライトテーマ固定。
   ================================================================ */

:root {
  --paper: #f7f2e7;          /* 挿絵と同じ生成り */
  --card: #fffcf3;
  --ink: #4a3b2f;            /* 挿絵の線と同じ温かい焦茶 */
  --ink-soft: #7d6e5c;   /* 本文に使える濃さ */
  --ink-faint: #a49582;  /* 飾りだけに使う薄さ */
  --line: #e6dcc9;
  --terra: #d96f4e;          /* Tシャツのテラコッタ */
  --terra-deep: #c75f3f;
  --sage: #a8b894;
  --blue: #9db8c4;
  --maru: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  --shadow: 0 6px 24px rgba(120, 90, 60, 0.10);
  --shadow-sm: 0 3px 10px rgba(120, 90, 60, 0.07);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

.app {
  min-height: 100dvh;
  max-width: 440px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 22px calc(env(safe-area-inset-bottom) + 22px);
  display: flex; flex-direction: column;
}

.screen { display: none; }
.screen.active { display: flex; flex-direction: column; flex: 1; animation: page 0.45s ease both; }
@keyframes page { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── ホーム ─────────────────────────────── */
#screen-home { justify-content: center; }

.masthead { text-align: center; padding: 18px 0 0; }
.brand {
  font-family: var(--maru);
  font-weight: 700;
  font-size: 27px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
}
.tagline {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-soft);
  letter-spacing: 0.14em;
}

.hero {
  width: 100%;
  max-width: 340px;
  margin: 4px auto 0;
  display: block;
  animation: page 0.7s ease both;
}

/* 粒ダイヤル：挿絵つきの三択 */
.dial { display: flex; gap: 10px; margin: 6px 0 18px; }
.dial-btn {
  flex: 1;
  appearance: none; cursor: pointer;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 11px 6px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.dial-btn:active { transform: scale(0.97); }
.dial-btn.on {
  border-color: var(--terra);
  box-shadow: var(--shadow-sm);
}
.dial-img {
  width: 84px; height: 84px;
  object-fit: cover;
  border-radius: 12px;
  filter: saturate(0.9);
  opacity: 0.55;
  transition: opacity 0.18s ease;
}
.dial-btn.on .dial-img { opacity: 1; }
.dial-label {
  font-family: var(--maru); font-weight: 700;
  font-size: 14px; margin-top: 4px;
  color: var(--ink-soft);
}
.dial-btn.on .dial-label { color: var(--terra); }

.dial-hint { font-size: 9.5px; color: var(--ink-soft); letter-spacing: 0.02em; margin-top: 1px; }
.home-links {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  margin: 14px 0 0; font-size: 12.5px; color: var(--ink-faint);
}
.home-links a { color: var(--ink-soft); text-decoration: none; letter-spacing: 0.06em; padding: 6px 2px; }
.home-links a:active { color: var(--terra); }

/* 報告への返し */
.tsubu-reply {
  padding: 16px 4px 14px;
  text-align: center;
  font-family: var(--maru); font-weight: 700;
  font-size: 15px; color: var(--terra);
  letter-spacing: 0.08em;
  animation: page 0.4s ease both;
}

/* つぶし中の「ほか◯件」 */
.tsubu-more {
  appearance: none; border: 0; background: none; cursor: pointer;
  display: block; margin: 2px auto 0; padding: 6px 10px;
  font-family: var(--sans); font-size: 12px; color: var(--ink-soft);
  letter-spacing: 0.06em;
}
.tsubu-more:active { color: var(--terra); }

/* 粒の数 */
.tally {
  margin: 10px 0 0; text-align: center;
  font-size: 12px; color: var(--ink-soft); letter-spacing: 0.08em;
}
.tally[hidden] { display: none; }

/* あしあとの棚 */
.fp-tabs { display: flex; gap: 8px; margin: 4px 0 14px; }
.fp-tabs[hidden] { display: none; }
.fp-tab {
  appearance: none; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 7px 14px;
  font-family: var(--sans); font-size: 12px; color: var(--ink-soft);
  letter-spacing: 0.04em;
}
.fp-tab.on { border-color: var(--terra); color: var(--terra); }

.load-fail {
  margin: 10px 0; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  font-size: 13px; line-height: 1.9; color: var(--ink-soft); text-align: center;
}

/* 引くボタン */
.cta {
  appearance: none; border: none; cursor: pointer;
  background: var(--terra); color: #fffdf6;
  font-family: var(--maru); font-weight: 700;
  font-size: 17px; letter-spacing: 0.22em; text-indent: 0.22em;
  padding: 17px 16px;
  border-radius: 999px;
  box-shadow: 0 5px 0 rgba(160, 80, 50, 0.25), var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.18s ease;
}
.cta:hover { background: var(--terra-deep); }
.cta:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(160, 80, 50, 0.25), var(--shadow-sm); }

/* つぶし中 */
.tsubu-slot { margin: 12px 0 4px; }
.tsubu-title {
  font-family: var(--maru); font-weight: 700;
  font-size: 11.5px; letter-spacing: 0.3em; text-indent: 0.3em;
  color: var(--ink-soft);
  text-align: center; margin-bottom: 8px;
}
.tsubu { margin-bottom: 8px; }
.tsubu-row {
  display: block; width: 100%; text-align: left;
  appearance: none; cursor: pointer;
  border: 1.5px solid var(--line);
  border-left: 4px solid var(--terra);
  background: var(--card);
  color: var(--ink);
  font-family: var(--sans); font-size: 13.5px; line-height: 1.7;
  padding: 11px 14px;
  border-radius: 6px 14px 14px 6px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.tsubu-row:hover { border-color: var(--terra); box-shadow: var(--shadow-sm); }
.tsubu-row.open {
  border-color: var(--terra); border-bottom-color: var(--line);
  border-radius: 6px 14px 0 0;
}
.tsubu-expand {
  border: 1.5px solid var(--terra); border-top: none; border-left: 4px solid var(--terra);
  background: var(--card);
  border-radius: 0 0 14px 6px;
  padding: 12px 14px 14px;
  animation: page 0.25s ease;
}
.tsubu-q {
  font-family: var(--maru); font-weight: 700;
  font-size: 12px; letter-spacing: 0.16em;
  color: var(--ink-soft); margin-bottom: 10px;
}
.tsubu-feels { display: flex; flex-direction: column; gap: 6px; }

.feel {
  appearance: none; cursor: pointer;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  padding: 10px 14px;
  border-radius: 12px;
  display: flex; align-items: center; gap: 10px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.feel:hover { border-color: var(--terra); background: var(--card); }
.feel:active { transform: scale(0.98); }
.feel-icon { display: inline-flex; width: 19px; height: 19px; color: var(--ink-soft); flex: none; }
.feel-icon svg { width: 100%; height: 100%; }
.feel-surprised { border-color: var(--terra); }
.feel-surprised .feel-label { color: var(--terra); font-weight: 700; }
.feel-surprised .feel-icon { color: var(--terra); }
.feel-keep { border-style: dashed; color: var(--ink-soft); }

.review-memo-toggle {
  appearance: none; border: none; background: transparent;
  color: var(--ink-soft); font-family: var(--sans); font-size: 12px;
  cursor: pointer; margin-top: 10px; padding: 4px 0;
}
.review-memo-toggle:hover { color: var(--terra); }
.review-memo {
  width: 100%; margin-top: 8px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink);
  font-family: var(--sans); font-size: 14px; line-height: 1.7;
  padding: 10px 12px; resize: vertical; min-height: 58px;
}
.review-memo:focus { outline: none; border-color: var(--terra); }

.footprints-link {
  appearance: none; border: none; background: transparent;
  color: var(--ink-soft);
  font-family: var(--maru); font-weight: 700;
  font-size: 12.5px; letter-spacing: 0.3em; text-indent: 0.3em;
  margin: 22px auto 0; padding: 8px 6px; cursor: pointer;
  border-bottom: 1.5px solid var(--line);
  transition: color 0.18s ease, border-color 0.18s ease;
}
.footprints-link:hover { color: var(--terra); border-color: var(--terra); }

/* ── スプレッド ───────────────────────────── */
#screen-spread { justify-content: center; }
.spread-caption {
  font-family: var(--maru); font-weight: 700;
  text-align: center; font-size: 12px; letter-spacing: 0.26em; text-indent: 0.26em;
  color: var(--ink-soft);
  margin: 0 0 16px;
}
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card {
  appearance: none; cursor: pointer;
  border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink);
  border-radius: 18px;
  padding: 20px 16px;
  min-height: 148px;
  display: flex; align-items: center; text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  opacity: 0;
  animation: deal 0.45s ease forwards;
}
.card:nth-child(1) { animation-delay: 0.03s; }
.card:nth-child(2) { animation-delay: 0.11s; }
.card:nth-child(3) { animation-delay: 0.19s; }
.card:nth-child(4) { animation-delay: 0.27s; }
@keyframes deal { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.card:hover { border-color: var(--terra); transform: translateY(-2px); box-shadow: var(--shadow); }
.card:active { transform: scale(0.98); }
.card-text { font-size: 14.5px; font-weight: 500; line-height: 1.85; }

.spread-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.ghost {
  appearance: none; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--card);
  color: var(--ink-soft);
  font-family: var(--maru); font-weight: 700; font-size: 13px;
  padding: 11px 20px; border-radius: 999px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.ghost:hover:not(:disabled) { border-color: var(--terra); color: var(--terra); }
.ghost:disabled { opacity: 0.35; cursor: default; }
.giveup {
  appearance: none; border: none; background: transparent; cursor: pointer;
  color: var(--ink-soft);
  font-family: var(--sans); font-size: 13px;
  padding: 11px 4px;
  text-decoration: underline; text-underline-offset: 4px;
  text-decoration-color: var(--line);
}
.giveup:hover { color: var(--ink); text-decoration-color: var(--ink-soft); }

/* ── あしあと ─────────────────────────────── */
.foot-head { display: flex; align-items: baseline; gap: 16px; padding: 18px 0 20px; }
.back {
  appearance: none; border: none; background: transparent; cursor: pointer;
  color: var(--ink-soft); font-family: var(--sans); font-size: 13px;
}
.back:hover { color: var(--terra); }
.foot-title { font-family: var(--maru); font-weight: 700; font-size: 19px; letter-spacing: 0.3em; }

.footprints { display: flex; flex-direction: column; }
.fp { padding: 15px 2px 17px; border-bottom: 1.5px solid var(--line); }
.fp:first-child { border-top: 1.5px solid var(--line); }
.fp-head { display: flex; align-items: center; margin-bottom: 5px; }
.fp-feeling {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--terra); font-weight: 700;
}
.fp-feel-icon { display: inline-flex; width: 15px; height: 15px; }
.fp-feel-icon svg { width: 100%; height: 100%; }
.fp-date { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.06em; margin-left: auto; }
.fp-grain { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; }
.fp-grain img { width: 20px; height: 20px; opacity: 0.85; }
.fp-grain span { font-size: 11.5px; color: var(--ink-soft); letter-spacing: 0.04em; }
.fp-text { font-size: 14.5px; font-weight: 500; line-height: 1.9; color: var(--ink); }
.fp-memo { margin-top: 10px; }
.memo-text {
  font-size: 13.5px; color: var(--ink); cursor: pointer;
  white-space: pre-wrap; line-height: 1.85;
  border-left: 2px solid var(--sage);
  padding: 2px 0 2px 12px;
}
.memo-text:hover { border-left-color: var(--terra); }
.memo-add {
  appearance: none; border: none; background: transparent; cursor: pointer;
  color: var(--ink-soft); font-family: var(--sans); font-size: 12.5px; padding: 4px 0;
}
.memo-add:hover { color: var(--terra); }
.memo-edit {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink);
  font-family: var(--sans); font-size: 13.5px; line-height: 1.7;
  padding: 10px; resize: vertical; min-height: 52px;
}
.memo-edit:focus { outline: none; border-color: var(--terra); }
.memo-save {
  appearance: none; border: none; cursor: pointer;
  background: var(--terra); color: #fffdf6;
  font-family: var(--maru); font-weight: 700; font-size: 12px;
  padding: 8px 20px; border-radius: 999px; margin-top: 8px;
}
.memo-save:hover { background: var(--terra-deep); }
.empty { text-align: center; margin-top: 24px; }
.empty-img { width: 100%; max-width: 330px; display: block; margin: 0 auto 6px; }
.empty p {
  color: var(--ink-soft);
  font-family: var(--maru); font-weight: 500;
  font-size: 13px; letter-spacing: 0.1em; line-height: 2.2;
  margin: 0;
}

/* ── トースト ─────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 44px;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: var(--paper);
  font-family: var(--maru); font-weight: 700;
  font-size: 14px; letter-spacing: 0.16em; text-indent: 0.16em;
  padding: 12px 28px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; z-index: 20;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

:focus-visible { outline: 2px solid var(--terra); outline-offset: 2px; }
