/* なりたち図鑑 — 和紙×墨 テーマ */
:root {
  --paper: #f7f1e5;
  --paper2: #fffbf2;
  --ink: #33302a;
  --ink-soft: #6b6459;
  --line: #e2d8c4;
  --accent: #c65540;      /* 朱色 */
  --accent-soft: #f3ddd6;
  --gold: #c9a03c;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(70, 60, 40, .08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  background-image: radial-gradient(rgba(180,160,120,.06) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 500;
  line-height: 1.7;
  min-height: 100dvh;
}
#app { max-width: 560px; margin: 0 auto; padding: 14px 14px calc(90px + env(safe-area-inset-bottom)); }
button { font-family: inherit; font-weight: 700; cursor: pointer; border: none; }

.serif, .big-kanji, .tile-k, .oracle-label { font-family: 'Shippori Mincho', serif; }

/* ===== boot ===== */
.boot { text-align: center; padding-top: 30vh; color: var(--ink-soft); }
.boot-mark {
  width: 74px; height: 74px; margin: 0 auto 10px; border-radius: 20px;
  background: var(--accent); color: #fff; font-family: 'Shippori Mincho', serif;
  font-size: 44px; line-height: 74px; font-weight: 800;
}

/* ===== header ===== */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 2px 12px;
}
.top h1 { font-size: 20px; margin: 0; font-weight: 900; letter-spacing: .04em; }
.top h1 .sub { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 700; letter-spacing: .1em; }
.top .streak { font-size: 13px; color: var(--ink-soft); font-weight: 700; }

/* ===== bottom nav ===== */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: center; gap: 4px;
  background: rgba(255, 251, 242, .95); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
.nav button {
  flex: 1; max-width: 130px; background: none; border-radius: 12px;
  padding: 7px 4px 5px; font-size: 11px; color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.nav button .ic { font-size: 21px; line-height: 1.2; }
.nav button.on { background: var(--accent-soft); color: var(--accent); }

/* ===== cards / common ===== */
.card {
  background: var(--paper2); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.h2 { font-size: 15px; font-weight: 900; margin: 0 0 8px; }
.muted { color: var(--ink-soft); font-size: 12.5px; }
.btn {
  display: block; width: 100%; padding: 14px; border-radius: 14px;
  background: var(--accent); color: #fff; font-size: 16px; letter-spacing: .05em;
  box-shadow: 0 3px 0 #9c4030;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #9c4030; }
.btn.ghost { background: var(--paper2); color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }

/* ===== home ===== */
.hero { text-align: center; padding: 22px 16px; }
.hero .big-kanji { font-size: 58px; font-weight: 800; line-height: 1.15; }
.hero .catch { font-size: 13.5px; color: var(--ink-soft); margin: 8px 0 0; }
.progress-bar { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 10px 0 4px; }
.progress-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #e0bd62); border-radius: 6px; }
.home-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-menu .wide { grid-column: 1 / -1; }
.menu-tile {
  background: var(--paper2); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px 12px; text-align: left; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
}
.menu-tile .ic { font-size: 26px; }
.menu-tile b { display: block; font-size: 15px; }
.menu-tile span { font-size: 11px; color: var(--ink-soft); }
.cat-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ===== category badge ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 900; color: #fff;
  padding: 2px 10px; border-radius: 999px; letter-spacing: .05em;
}

/* ===== 図鑑 grid ===== */
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 6px 13px; border-radius: 999px; font-size: 12.5px;
  background: var(--paper2); border: 1.5px solid var(--line); color: var(--ink-soft);
}
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.tile {
  position: relative; background: var(--paper2); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 10px 4px 6px; text-align: center; box-shadow: var(--shadow);
}
.tile-k { font-size: 34px; font-weight: 800; line-height: 1.2; display: block; }
.tile .stars { font-size: 9.5px; letter-spacing: 1px; color: var(--gold); display: block; height: 14px; }
.tile .dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; }

/* ===== detail ===== */
.detail-head { display: flex; align-items: center; gap: 14px; }
.big-kanji { font-size: 76px; font-weight: 800; line-height: 1.1; }
.detail-info { flex: 1; }
.reading { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.stars-l { color: var(--gold); font-size: 15px; letter-spacing: 2px; }

.evolution { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 14px 0 4px; }
.oracle-box {
  width: 108px; height: 108px; border-radius: 14px; padding: 8px;
  background: #efe5cf; border: 1.5px solid #ddcfae; color: #7a5b34;
  display: flex; flex-direction: column; align-items: center;
}
.oracle-box svg { width: 100%; height: 100%; }
.oracle-box svg * { fill: none; stroke: currentColor; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.oracle-box svg [fill="currentColor"] { fill: currentColor; stroke: none; }
.oracle-label { font-size: 10px; margin-top: 2px; }
.evo-arrow { font-size: 22px; color: var(--ink-soft); }
.modern-box {
  width: 108px; height: 108px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--paper2); display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.modern-box .big-kanji { font-size: 62px; }
.evo-note { text-align: center; font-size: 10.5px; color: var(--ink-soft); margin: 2px 0 10px; }

.formula { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; gap: 6px; margin: 14px 0; }
.formula .op { align-self: center; font-size: 22px; font-weight: 900; color: var(--ink-soft); }
.part-box {
  min-width: 84px; padding: 8px 10px; border-radius: 12px; text-align: center;
  background: var(--paper2); border: 1.5px solid var(--line); cursor: pointer;
}
.part-box .p-char { font-family: 'Shippori Mincho', serif; font-size: 34px; font-weight: 800; line-height: 1.2; display: block; }
.part-box .p-mean { font-size: 10.5px; color: var(--ink-soft); display: block; }
.part-box.role-i { border-color: #b7d6c6; background: #eef7f1; }
.part-box.role-o { border-color: #d8c2e2; background: #f6eefa; }
.part-box .p-role { display: inline-block; font-size: 9.5px; font-weight: 900; border-radius: 999px; padding: 0 8px; color: #fff; margin-bottom: 2px; }
.part-box.role-i .p-role { background: #3a9b6e; }
.part-box.role-o .p-role { background: #a05fb5; }
.formula .eq-result { border-color: var(--accent); background: var(--accent-soft); }

.story { font-size: 14.5px; background: var(--paper2); border-left: 4px solid var(--accent); padding: 10px 12px; border-radius: 0 12px 12px 0; margin: 10px 0; }
.family { margin-top: 10px; }
.family .tile { display: inline-block; width: 66px; margin-right: 6px; }
.detail-nav { display: flex; gap: 8px; margin-top: 14px; }
.detail-nav .btn { flex: 1; }

/* ===== parts dict ===== */
.part-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--paper2); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow);
}
.part-row .p-char { font-family: 'Shippori Mincho', serif; font-size: 30px; font-weight: 800; width: 54px; text-align: center; flex-shrink: 0; }
.part-row b { font-size: 13.5px; }
.part-row .muted { display: block; }
.part-detail .examples { font-family: 'Shippori Mincho', serif; font-size: 24px; letter-spacing: 8px; }

/* ===== quiz ===== */
.quiz-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }
.q-text { font-size: 16px; font-weight: 700; margin: 4px 0 14px; }
.q-text .q-kanji { font-family: 'Shippori Mincho', serif; font-size: 40px; display: block; text-align: center; margin: 8px 0; }
.q-text .q-part { color: var(--accent); font-family: 'Shippori Mincho', serif; font-size: 1.3em; }
.choices { display: grid; gap: 8px; }
.choices.k2 { grid-template-columns: 1fr 1fr; }
.choice {
  padding: 13px 10px; border-radius: 13px; font-size: 15px;
  background: var(--paper2); border: 2px solid var(--line); color: var(--ink); text-align: center;
}
.choice.kanji-choice { font-family: 'Shippori Mincho', serif; font-size: 30px; font-weight: 800; }
.choice.sel-ok { border-color: #3a9b6e; background: #e7f5ee; }
.choice.sel-ng { border-color: var(--accent); background: var(--accent-soft); }
.choice:disabled { opacity: .92; }
.feedback { margin-top: 12px; }
.feedback .verdict { font-size: 17px; font-weight: 900; }
.feedback .verdict.ok { color: #3a9b6e; }
.feedback .verdict.ng { color: var(--accent); }
.result-num { text-align: center; font-size: 40px; font-weight: 900; margin: 6px 0; }
.gained { text-align: center; font-size: 13px; color: var(--ink-soft); }
.gained .serif { font-size: 22px; letter-spacing: 6px; color: var(--ink); }

.fade { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.back-btn { background: none; color: var(--ink-soft); font-size: 13px; padding: 4px 0 10px; display: inline-flex; align-items: center; gap: 4px; }
