/* たからもの帳 — おじいちゃん・おばあちゃんが親指だけで使う前提のスタイル。
   ・本文20px以上、ボタンは22px以上
   ・押せる所は必ず高さ64px以上
   ・クリーム地に濃い茶。差し色は金(たからもの)と落ち着いた藍
   ・ホバーでしか出ないUIは作らない(指では触れないため) */

:root {
  --paper: #fffdf8;
  --cream: #fbf5e7;
  --cream-deep: #f4ead3;
  --ink: #3b322a;
  --ink-soft: #7b6f61;
  --line: #e7dcc6;

  --gold: #b8892b;
  --gold-deep: #8f6a1d;
  --gold-pale: #f6e9c8;

  --indigo: #3d5a80;
  --indigo-pale: #e3eaf2;

  --red: #b4483f;
  --red-pale: #f7e3e1;

  --shadow: 0 2px 12px rgba(94, 74, 48, .10);
  --shadow-soft: 0 1px 5px rgba(94, 74, 48, .07);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: rgba(184, 137, 43, .18); }
html { -webkit-text-size-adjust: 100%; }

/* display を持つ部品にも hidden を効かせる */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Hiragino Sans", "ヒラギノ角ゴ ProN", "Yu Gothic", "YuGothic",
               "Meiryo", system-ui, sans-serif;
  font-size: 20px;
  line-height: 1.7;
  padding-bottom: 48px;
}

#main { max-width: 560px; margin: 0 auto; padding: 16px 16px 0; }

/* ---------- 上のバー ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}
.bar-title {
  flex: 1; text-align: center;
  font-size: 23px; font-weight: 800; letter-spacing: .08em;
}
.bar-back, .bar-menu {
  min-height: 48px; min-width: 72px;
  padding: 0 14px;
  font-size: 18px; font-weight: 700;
  color: var(--gold-deep);
  background: var(--gold-pale);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.bar-back[hidden], .bar-menu[hidden] { display: none; }

/* ---------- 見出し ---------- */
.hero { text-align: center; padding: 28px 8px 18px; }
.hero-mark {
  width: 96px; height: 96px;
  border-radius: 22px; border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}
.hero-title {
  margin: 10px 0 12px;
  font-size: 34px; font-weight: 800; letter-spacing: .1em;
  color: var(--gold-deep);
}
.hero-lead { margin: 0; font-size: 19px; color: var(--ink-soft); }

.home-lead {
  margin: 6px 0 16px;
  font-size: 22px; font-weight: 700; text-align: center;
}

/* ---------- カード ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 16px;
  margin: 0 0 18px;
  box-shadow: var(--shadow-soft);
}
.card-title { margin: 0 0 10px; font-size: 21px; font-weight: 800; }
.note { margin: 0 0 14px; font-size: 18px; color: var(--ink-soft); }
.note.small { font-size: 16px; margin-bottom: 0; }
.note b { color: var(--ink); }
.setup-warn { border-color: var(--red); background: var(--red-pale); }
code {
  background: var(--cream-deep); padding: 2px 6px; border-radius: 6px;
  font-size: 16px;
}

/* ---------- ボタン ---------- */
.big-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 68px;
  margin: 0 0 12px;
  padding: 12px 16px;
  font-size: 23px; font-weight: 800; letter-spacing: .04em;
  font-family: inherit;
  border: none; border-radius: 16px;
  box-shadow: var(--shadow);
  text-decoration: none;
}
.big-btn:last-child { margin-bottom: 0; }
.big-btn.primary { background: var(--indigo); color: #fff; }
.big-btn.gold { background: var(--gold); color: #fff; }
.big-btn.ghost {
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--line); box-shadow: none;
}
.big-btn:disabled { opacity: .45; }
.big-btn:active { transform: translateY(1px); }

.text-btn {
  display: block; width: 100%; min-height: 56px;
  margin: 4px 0 0;
  font-size: 18px; font-weight: 700; font-family: inherit;
  color: var(--indigo);
  background: none; border: none;
}
.text-btn.danger { color: var(--red); }

.wide-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 76px;
  margin: 0 0 12px; padding: 12px 18px;
  font-family: inherit; text-align: left;
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-soft);
}
.wide-btn-icon { font-size: 32px; }
.wide-btn-text { font-size: 21px; font-weight: 700; color: var(--ink); }
.wide-btn-text small {
  display: block; font-size: 15px; font-weight: 500; color: var(--ink-soft);
}

/* ---------- カテゴリー ---------- */
.cat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 22px;
}
.cat-btn {
  min-height: 132px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 12px 8px;
  font-family: inherit;
  background: var(--paper);
  border: 2px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-soft);
}
.cat-btn:active { background: var(--gold-pale); }
.cat-btn .cat-emoji { font-size: 40px; line-height: 1; }
.cat-btn .cat-name { font-size: 20px; font-weight: 800; color: var(--ink); }
.cat-btn .cat-sub { font-size: 14px; color: var(--ink-soft); text-align: center; }

.cat-badge {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 16px; padding: 8px 16px;
  font-size: 19px; font-weight: 800;
  background: var(--gold-pale); color: var(--gold-deep);
  border-radius: 999px;
}

/* ---------- ステップ ---------- */
.step {
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
}
.step-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
  font-size: 21px; font-weight: 800;
}
.step-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--gold); color: #fff;
  border-radius: 50%; font-size: 19px;
}
.step-hint { margin: 0 0 12px; font-size: 17px; color: var(--ink-soft); }

.photo-area {
  margin-bottom: 12px; border-radius: 14px; overflow: hidden;
  background: var(--cream-deep);
  min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.photo-area img { width: 100%; display: block; }
.photo-empty { padding: 34px 10px; font-size: 17px; color: var(--ink-soft); }

/* ---------- 録音 ---------- */
.rec-area { text-align: center; }
.rec-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 84px;
  padding: 12px 18px;
  font-size: 23px; font-weight: 800; font-family: inherit;
  color: #fff; background: var(--indigo);
  border: none; border-radius: 18px; box-shadow: var(--shadow);
}
.rec-btn.on { background: var(--red); }
.rec-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; flex: none;
}
.rec-btn.on .rec-dot { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { opacity: .15; } }
.rec-time {
  margin-top: 12px;
  font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--red);
}
#audioPreview { width: 100%; margin-top: 14px; }

/* ---------- 入力 ---------- */
.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block; margin-bottom: 6px;
  font-size: 17px; font-weight: 700; color: var(--ink-soft);
}
.field-input {
  width: 100%; min-height: 58px;
  padding: 12px 14px;
  font-size: 20px; font-family: inherit; color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line); border-radius: 12px;
}
textarea.field-input { min-height: 110px; line-height: 1.6; }
.field-input:focus { outline: none; border-color: var(--gold); }

.detail-list { margin-bottom: 12px; }
/* 項目名が長くなることがあるので、横並びにせず上下に積む。
   細い列に文字が押し込まれて読めなくなるのを避けるため。 */
.detail-row {
  padding: 12px 0; border-top: 1px solid var(--line);
}
.detail-row .k {
  display: block; margin-bottom: 2px;
  font-size: 16px; font-weight: 700; color: var(--ink-soft);
}
.detail-row .v { display: block; font-size: 19px; }

.raw { margin-top: 6px; }
.raw summary { font-size: 17px; color: var(--indigo); min-height: 44px; padding: 10px 0; }
.raw-text { font-size: 17px; color: var(--ink-soft); white-space: pre-wrap; }

/* ---------- 一覧 ---------- */
.filter-row {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px;
  margin-bottom: 4px;
}
.filter-pill {
  flex: none; min-height: 48px; padding: 0 16px;
  font-size: 17px; font-weight: 700; font-family: inherit;
  color: var(--ink-soft); background: var(--paper);
  border: 2px solid var(--line); border-radius: 999px;
}
.filter-pill.on { background: var(--gold); color: #fff; border-color: var(--gold); }

.item-list { display: flex; flex-direction: column; gap: 12px; }
.item-card {
  display: flex; gap: 14px; align-items: center;
  width: 100%; min-height: 92px; padding: 12px 14px;
  font-family: inherit; text-align: left;
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-soft);
}
.item-thumb {
  flex: none; width: 68px; height: 68px; border-radius: 12px;
  object-fit: cover; background: var(--cream-deep);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
img.item-thumb { display: block; border: 1px solid var(--line); }
.item-body { flex: 1; min-width: 0; }
.item-title {
  font-size: 20px; font-weight: 800; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-meta { font-size: 15px; color: var(--ink-soft); }

/* ---------- 詳細 ---------- */
.detail-photo { width: 100%; border-radius: 16px; margin-bottom: 16px; display: block; }
.detail-title { font-size: 25px; font-weight: 800; margin: 0 0 6px; }

/* ---------- 規約へのリンク ---------- */
.legal-links {
  margin: 26px 0 8px; text-align: center;
  font-size: 16px; color: var(--ink-soft);
}
.legal-links a {
  display: inline-block; padding: 10px 6px;
  color: var(--indigo);
}

/* ---------- 手順 ---------- */
.howto { margin: 14px 0 0; padding-left: 1.4em; font-size: 18px; color: var(--ink-soft); }
.howto li { margin-bottom: 8px; }

/* ---------- 進行中 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(59, 50, 42, .5);
  display: flex; align-items: center; justify-content: center;
}
.overlay-box {
  background: var(--paper); border-radius: 20px;
  padding: 28px 32px; text-align: center;
  font-size: 20px; font-weight: 700;
  box-shadow: var(--shadow);
}
.overlay-box p { margin: 16px 0 0; }
.spinner {
  width: 44px; height: 44px; margin: 0 auto;
  border: 5px solid var(--gold-pale); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- お知らせ ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 60; max-width: 90vw;
  padding: 14px 22px;
  font-size: 18px; font-weight: 700;
  color: #fff; background: var(--ink);
  border-radius: 14px; box-shadow: var(--shadow);
}
.toast.err { background: var(--red); }

@media (max-width: 360px) {
  body { font-size: 19px; }
  .cat-btn { min-height: 118px; }
  .cat-btn .cat-name { font-size: 18px; }
}
