:root {
  --bg: #F8F5EE;
  --panel: #FFFDF6;
  --ink: #2C2623;
  --ink-soft: #655E59;
  --line: #E2DCD0;
  --accent: #B83B26;
  --accent-ink: #ffffff;
  --gold: #C29B38;
  --navy: #1F2A44;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --stage1: #f5b942; /* 橙 */
  --stage1-bg: #fff4dc;
  --stage2: #e8768c; /* 桃 */
  --stage2-bg: #fce7ea;
  --stage3: #2d4373; /* 紺 */
  --stage3-bg: #e3e9f5;
  --stage4: #3f8f5f; /* 緑 */
  --stage4-bg: #e4f3ea;
  --stage5: #6a4c93; /* 紫 */
  --stage5-bg: #ece5f6;
  --danger: #b3261e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: linear-gradient(180deg, #2A3A5E 0%, var(--navy) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 2px solid var(--gold);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.brand {
  color: #F5ECD8;
  font-weight: 700;
  font-size: 1.05rem;
  font-family: var(--serif);
  letter-spacing: 0.08em;
  text-decoration: none;
}
.brand:hover { opacity: 0.85; }

/* トップへ戻る印（全システム共通・ヘッダーの左端） */
.homebadge {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 5px 11px 5px 8px;
  margin-right: 12px;
  border: 1px solid #c5a059;
  border-radius: 9px;
  background: rgba(197, 160, 89, 0.12);
  color: #e5c178;
  text-decoration: none;
  line-height: 1.15;
  transition: background .18s, box-shadow .18s;
}
.homebadge:hover {
  background: rgba(197, 160, 89, 0.26);
  box-shadow: 0 0 0 1px rgba(229, 193, 120, 0.5), 0 2px 10px rgba(0, 0, 0, 0.35);
}
.homebadge-kamon { width: 22px; height: 22px; flex: none; }
.homebadge-txt { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; white-space: nowrap; }
@media (max-width: 640px) {
  .homebadge { padding: 5px 8px; margin-right: 8px; }
  .homebadge-txt { display: none; }   /* 狭い画面では家紋だけにする */
  .homebadge-kamon { width: 24px; height: 24px; }
}

/* 参考イラストの帯（絵巻風バナー） */
.hero-band {
  height: 150px;
  overflow: hidden;
  border-bottom: 2px solid var(--gold);
  background: var(--navy);
}
.hero-band img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 38%;
  display: block;
}
@media (max-width: 700px) {
  .hero-band { height: 92px; }
}
.nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 0.92rem; }
.nav a, .nav button.linklike { color: #f2ede0; }
.nav .user-tag { color: #b9b2a0; margin-right: 4px; }
button.linklike {
  background: none; border: none; cursor: pointer; font: inherit; padding: 0;
  text-decoration: underline;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

h1 {
  font-size: 1.45rem;
  margin: 0 0 4px;
  font-family: var(--serif);
  letter-spacing: 0.06em;
  position: relative;
  padding-left: 14px;
}
h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 5px;
  background: var(--accent);
  border-radius: 2px;
}
h2 { font-size: 1.15rem; margin: 0 0 12px; font-family: var(--serif); letter-spacing: 0.04em; }
.subtitle { color: var(--ink-soft); margin: 0 0 20px; font-size: 0.92rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(44, 38, 35, 0.05), inset 0 0 0 1px rgba(194, 155, 56, 0.08);
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn:hover { opacity: 0.9; }
.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn.danger { background: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 0.8rem; }

/* 校舎名のセル。ふだんはリンク（塾生一覧へ）で、鉛筆を押すと入力欄に変わる */
.campus-name-cell { white-space: nowrap; }
.campus-name-cell a { text-decoration: none; }
.campus-name-cell a:hover { text-decoration: underline; }
.icon-btn {
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.4;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
}
.icon-btn:hover, .icon-btn:focus-visible {
  opacity: 1;
  border-color: var(--line);
  background: #fff;
  color: var(--accent);
  outline: none;
}

/* 校舎名をその場で直す入力欄 */
.campus-name {
  width: 100%;
  min-width: 140px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--accent);
}
.campus-name:hover { border-color: var(--line); background: #fff; }
.campus-name:focus { border-color: var(--accent); background: #fff; outline: none; }

.form-row { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 0.82rem; color: var(--ink-soft); }
.form-row input, .form-row select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-weight: 600; font-size: 0.82rem; }
tr:hover td { background: #faf8f2; }

.error { color: var(--danger); font-size: 0.88rem; margin: 8px 0; }
.hint { color: var(--ink-soft); font-size: 0.85rem; }

.progress-bar {
  background: #e9e4d6;
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  width: 100%;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #D97B32 70%, var(--gold));
}
.progress-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.progress-cell .pct { font-size: 0.8rem; color: var(--ink-soft); min-width: 32px; text-align: right; }

.login-wrap { max-width: 380px; margin: 60px auto; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  z-index: 100;
}
.toast.error { background: var(--danger); }

/* ロードマップボード */
.year-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.year-tab {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-size: 0.9rem;
}
.year-tab.active { background: var(--navy); color: #F5ECD8; border-color: var(--gold); }
.year-theme { color: var(--ink-soft); font-size: 0.88rem; margin-bottom: 18px; }

.stage-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 14px;
  overflow-x: auto;
}
@media (max-width: 1000px) {
  .stage-grid { grid-template-columns: repeat(5, 220px); }
}

.stage-col { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.stage-head {
  padding: 10px 12px;
  color: #fff;
  font-size: 0.85rem;
}
.stage-head .stage-no { font-weight: 700; font-size: 0.95rem; display: block; }
.stage-col[data-stage="1"] .stage-head { background: var(--stage1); color: #4a3200; }
.stage-col[data-stage="2"] .stage-head { background: var(--stage2); color: #4a1522; }
.stage-col[data-stage="3"] .stage-head { background: var(--stage3); }
.stage-col[data-stage="4"] .stage-head { background: var(--stage4); }
.stage-col[data-stage="5"] .stage-head { background: var(--stage5); }

.stage-body { padding: 10px; background: #fff; }
.event-box {
  font-size: 0.78rem;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-weight: 600;
  line-height: 1.4;
}
.stage-col[data-stage="1"] .event-box, .stage-col[data-stage="1"] .stage-body { background: var(--stage1-bg); }
.stage-col[data-stage="2"] .event-box, .stage-col[data-stage="2"] .stage-body { background: var(--stage2-bg); }
.stage-col[data-stage="3"] .event-box, .stage-col[data-stage="3"] .stage-body { background: var(--stage3-bg); }
.stage-col[data-stage="4"] .event-box, .stage-col[data-stage="4"] .stage-body { background: var(--stage4-bg); }
.stage-col[data-stage="5"] .event-box, .stage-col[data-stage="5"] .stage-body { background: var(--stage5-bg); }

.item-group-label {
  font-size: 0.72rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 10px 0 4px;
}
.item-group-label:first-child { margin-top: 0; }

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  padding: 5px 4px;
  border-radius: 4px;
  cursor: pointer;
}
.check-item:hover { background: rgba(0,0,0,0.04); }
.check-item input { margin-top: 3px; }
.check-item.done span.label { text-decoration: line-through; color: var(--ink-soft); }
.check-item .meta { display: block; font-size: 0.7rem; color: var(--ink-soft); }

.student-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.student-head .summary { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; }
.summary-box { min-width: 140px; }
.summary-box .num { font-size: 1.3rem; font-weight: 700; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  background: #eee7d6;
  color: #6b5a2a;
}
.tag.status-graduated { background: #dfe8df; color: #2f5c34; }
.tag.status-withdrawn { background: #f0dede; color: #7a2b2b; }

.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* 機能タブ（ロードマップ／評価シート／宮大工ログ） */
.feature-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--line);
}
.feature-tab {
  padding: 10px 22px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.feature-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* 評価シート */
.num-sm { font-size: 1.05rem; font-weight: 700; }
.hyoka-summary { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.chart-panel h2 { margin-bottom: 8px; }
.hyoka-chart { width: 100%; max-width: 640px; height: auto; display: block; }
.chart-legend { display: flex; gap: 16px; font-size: 0.82rem; margin-top: 4px; }
.lg-self { color: #2d4373; }
.lg-teacher { color: #a8461e; }

.hyoka-cat {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  margin: 14px 0;
  overflow: hidden;
}
.hyoka-cat > h3 {
  margin: 0;
  color: #fff;
  padding: 8px 14px;
  font-size: 0.95rem;
}
.hyoka-cat .form-row { padding: 0 14px 12px; }
.hyoka-item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.hyoka-item-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.criteria summary { cursor: pointer; font-size: 0.8rem; color: var(--accent); margin-bottom: 6px; }
.criteria-table { font-size: 0.8rem; margin: 6px 0; }
.criteria-table th { white-space: nowrap; width: 44px; }
.hyoka-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 700px) { .hyoka-grid { grid-template-columns: 1fr; } }
.hyoka-grid label { display: block; font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 3px; }
.hyoka-grid select, .hyoka-grid input {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: inherit;
}
.hyoka-grid input { width: 100%; margin-top: 4px; box-sizing: border-box; }

.detail-row td { background: #faf8f2; }
.hyoka-detail-cat h4 { margin: 10px 0 6px; padding-left: 8px; font-size: 0.88rem; }
.hyoka-detail-table { font-size: 0.82rem; }
.hyoka-detail-table th, .hyoka-detail-table td { padding: 5px 6px; }
.photo-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.photo-thumb {
  height: 110px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}

/* 宮大工ログ */
.basic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 16px;
}
.log-cat h2 { font-size: 1.02rem; }
.log-entry { border-top: 1px solid var(--line); padding: 8px 2px; }
.log-entry-head { display: flex; gap: 12px; align-items: baseline; font-size: 0.8rem; }
.log-date { font-weight: 600; color: var(--ink-soft); }
.log-actions { margin-left: auto; display: flex; gap: 10px; }
.log-text { font-size: 0.9rem; margin-top: 3px; white-space: pre-wrap; }
.danger-link { color: var(--danger) !important; }
button.linklike { color: var(--accent); }

/* タグ形式の複数選択（資格・他技術）とマスター編集 */
.multi-field { margin: 14px 0; }
.multi-field > label { display: block; font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eee7d6;
  color: #4a3b18;
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 0.85rem;
}
.chip-x {
  border: none;
  background: none;
  cursor: pointer;
  color: #8a6d2f;
  font-size: 0.9rem;
  padding: 0 2px;
  line-height: 1;
}
.chip-x:hover { color: var(--danger); }
.chip-add select, .chip-add input {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: inherit;
}
.age-display { padding: 8px 0; font-weight: 600; }

/* 予備校の巻へのリンク（ロードマップ項目の下に表示） */
.yobi-link {
  display: block;
  margin: 2px 0 6px 26px;
  font-size: 0.75rem;
  color: #b3592b;
  text-decoration: none;
}
.yobi-link:hover { text-decoration: underline; }

/* ===== 塾生の横断比較 ===== */
.compare-invite {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.tab-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tab-btn {
  font-family: inherit;
  cursor: pointer;
  background: #fff;
  border: 1px solid #d9d0bd;
  border-bottom: 3px solid #d9d0bd;
  color: #6b6255;
  padding: 8px 18px;
  font-size: 0.9rem;
  border-radius: 6px 6px 0 0;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: #3a3128; }
.tab-btn.active { color: #3a3128; border-color: #b3592b; font-weight: 600; }
.tab-count {
  display: inline-block;
  margin-left: 8px;
  background: #f0e9db;
  color: #6b6255;
  border-radius: 9px;
  padding: 0 7px;
  font-size: 0.75rem;
}
.tab-btn.active .tab-count { background: #f7e2d6; color: #a8461e; }

.compare-avg {
  margin-left: auto;
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.82rem;
  color: #6b6255;
  padding-bottom: 6px;
}
.compare-avg b { font-size: 1.1rem; color: #3a3128; font-variant-numeric: tabular-nums; }

.compare-table { width: 100%; }
.compare-table th { white-space: nowrap; font-size: 0.78rem; }
.compare-table td { vertical-align: middle; font-size: 0.85rem; }
.compare-table .progress-cell { min-width: 90px; }

.score-pill {
  display: inline-block;
  min-width: 3.1em;
  text-align: center;
  padding: 2px 8px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.score-pill.excellent { background: #fdf3d7; color: #8a6100; border: 1px solid #e6c96a; }
.score-pill.good { background: #e8f3ea; color: #2b6b38; border: 1px solid #a8d4b2; }
.score-pill.warn { background: #fdf0e3; color: #96541a; border: 1px solid #e8c095; }
.score-pill.bad { background: #fbe9e7; color: #a3271b; border: 1px solid #e8a79f; }
.ref-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 0 6px;
  font-size: 0.68rem;
  color: #8a7d6a;
  border: 1px solid #d9d0bd;
  border-radius: 8px;
}

@media (max-width: 700px) {
  .compare-avg { margin-left: 0; width: 100%; }
  .compare-table thead { display: none; }
  .compare-table, .compare-table tbody, .compare-table tr, .compare-table td { display: block; width: 100%; }
  .compare-table tr {
    border: 1px solid #e2dccc;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 6px 4px;
    background: #fffdf8;
  }
  .compare-table td {
    border: none;
    padding: 4px 8px;
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .compare-table td::before {
    content: attr(data-label);
    flex: none;
    width: 5em;
    color: #8a7d6a;
    font-size: 0.75rem;
  }
  .compare-table td[data-label="塾生"] {
    font-weight: 600;
    font-size: 1rem;
    border-bottom: 1px solid #efe9dc;
    padding-bottom: 6px;
  }
}

/* ===== 評価シート: 5段階平均・励ましメッセージ・継続週数 ===== */
.avg5 {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  background: #f2ede0;
  color: #6b4b1f;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.avg5-inline { font-size: 0.85rem; font-weight: normal; color: #6b6255; }

.score-msg {
  margin-top: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}
.score-msg.excellent { background: #fdf3d7; color: #8a6100; border: 1px solid #e6c96a; }
.score-msg.good { background: #e8f3ea; color: #2b6b38; border: 1px solid #a8d4b2; }
.score-msg.warn { background: #fdf0e3; color: #96541a; border: 1px solid #e8c095; }
.score-msg.bad { background: #fbe9e7; color: #a3271b; border: 1px solid #e8a79f; }

.streak-badge {
  margin-top: 6px;
  font-size: 0.78rem;
  color: #b3592b;
  font-weight: 600;
}
.streak-badge b { font-size: 1rem; }

/* 累計の平均点を大きく見せるパネル */
.overall-panel {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
  border-left: 6px solid #c9a227;
}
.overall-panel.excellent { border-left-color: #d4a017; background: linear-gradient(90deg, #fdf8e8, #fff); }
.overall-panel.good { border-left-color: #4c7a4f; background: linear-gradient(90deg, #eef5ef, #fff); }
.overall-panel.warn { border-left-color: #c9782b; background: linear-gradient(90deg, #fdf3e9, #fff); }
.overall-panel.bad { border-left-color: #b3261e; background: linear-gradient(90deg, #fcecea, #fff); }
.overall-left { text-align: center; min-width: 150px; }
.overall-score {
  font-size: 3.4rem;
  font-weight: 700;
  line-height: 1.1;
  color: #3a3128;
  font-variant-numeric: tabular-nums;
}
.overall-right { flex: 1; min-width: 220px; }
.overall-msg {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.5;
}
.overall-msg.excellent { color: #8a6100; }
.overall-msg.good { color: #2b6b38; }
.overall-msg.warn { color: #96541a; }
.overall-msg.bad { color: #a3271b; }
.streak-big {
  margin-top: 10px;
  font-size: 1rem;
  color: #b3592b;
  font-weight: 600;
}
.streak-big b { font-size: 1.3rem; }

/* スマホでは週次記録の詳細をカード型にして、コメントが隠れないようにする */
@media (max-width: 700px) {
  .hyoka-detail-table thead { display: none; }
  .hyoka-detail-table, .hyoka-detail-table tbody, .hyoka-detail-table tr, .hyoka-detail-table td {
    display: block;
    width: 100%;
  }
  .hyoka-detail-table tr {
    border: 1px solid #e2dccc;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 6px 4px;
    background: #fffdf8;
  }
  .hyoka-detail-table td {
    border: none;
    padding: 4px 8px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
  }
  .hyoka-detail-table td::before {
    content: attr(data-label);
    flex: none;
    width: 4.5em;
    color: #8a7d6a;
    font-size: 0.75rem;
    padding-top: 2px;
  }
  .hyoka-detail-table td[data-label="要点"] {
    font-weight: 600;
    border-bottom: 1px solid #efe9dc;
    padding-bottom: 6px;
    margin-bottom: 2px;
  }
  /* コメント・メモは折り返して全文表示する */
  .hyoka-detail-table td[data-label="コメント"],
  .hyoka-detail-table td[data-label="メモ"] {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .overall-score { font-size: 2.8rem; }
  .overall-panel { gap: 12px; }
}

/* ===== 育ち具合のアバター（16ドット） ===== */
.grow-panel {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  flex-wrap: wrap;
  border-left: 5px solid #c9a227;
}
.grow-avatar { flex: none; text-align: center; min-width: 120px; }
.avatar-sprite {
  display: block;
  margin: 0 auto 6px;
  image-rendering: pixelated;
  background: #fffdf8;
  border: 1px solid #e2dccc;
  border-radius: 6px;
  padding: 4px;
}
.grow-stage { font-weight: 700; font-size: 1.05rem; color: #3a3128; }
.grow-body { flex: 1; min-width: 260px; }
.grow-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.grow-label { flex: none; width: 6.5em; font-size: 0.85rem; color: #6b6255; }
.grow-bar {
  flex: 1;
  min-width: 120px;
  height: 9px;
  background: #efe9dc;
  border-radius: 5px;
  overflow: hidden;
}
.grow-bar > span { display: block; height: 100%; }
.grow-num {
  flex: none;
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #3a3128;
}
.grow-num small { font-weight: 400; color: #8a7d6a; }
.grow-caption { margin: 10px 0 4px; font-size: 0.9rem; }
.grow-parts { margin: 0 0 4px; }

/* ロードマップ項目に出す「座学の済み」の印 */
.study-mark {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 9px;
  font-size: 0.68rem;
  border: 1px solid;
  vertical-align: middle;
}
.study-mark.all { color: #2b6b38; border-color: #a8d4b2; background: #e8f3ea; }
.study-mark.part { color: #96541a; border-color: #e8c095; background: #fdf0e3; }
.study-mark.none { color: #8a7d6a; border-color: #e2dccc; background: #f6f2e8; }
.yobi-link.studied { color: #2b6b38; }

@media (max-width: 640px) {
  .grow-panel { gap: 14px; }
  .grow-avatar { min-width: 96px; }
  .grow-label { width: 5.5em; font-size: 0.8rem; }
}

/* 一覧の中の育ち具合の姿（16ドット）。進捗バーの左隣に、段位の名前と並べて出す */
.list-avatar { display: inline-flex; align-items: center; gap: 6px; image-rendering: pixelated; }
.list-avatar svg { display: block; flex: none; }
.list-avatar-name { font-size: 12px; color: var(--ink-soft, #5a5248); line-height: 1.3; white-space: nowrap; }

/* ---------- 道具の完成写真（マイ道具館） ---------- */
.tool-photos { display: flex; gap: 6px; margin: 2px 0 6px 28px; }
.photo-badge, .photo-add {
  font-size: 0.78rem;
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  color: var(--ink-soft);
}
.photo-badge { border-color: var(--gold); }
.photo-badge:hover, .photo-add:hover { background: #f3ead6; }

/* 写真の拡大表示 */
.photo-viewer {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(20, 16, 10, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.photo-viewer-panel {
  background: var(--panel, #fff);
  border-radius: 12px;
  max-width: 720px; width: 100%;
  max-height: 88vh; overflow-y: auto;
  padding: 14px;
}
.photo-viewer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.photo-viewer-head .btn { margin-left: auto; }
.photo-viewer-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.photo-viewer-body figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.photo-viewer-body img { width: 100%; border-radius: 8px; border: 1px solid var(--line); }

/* マイ道具館 */
.dokan-hero {
  text-align: center;
  padding: 18px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fdf8ec, #f6eeda);
  margin-bottom: 16px;
}
.dokan-strip { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; }
.dokan-chara { line-height: 0; opacity: 0.45; cursor: pointer; transition: opacity .2s, transform .2s; }
.dokan-chara.talking { opacity: 1; transform: translateY(-4px) scale(1.15); }
.dokan-bubble {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--gold);
  border-radius: 18px;
  font-size: 0.95rem;
}
.dokan-bubble small { color: var(--ink-soft); margin-left: 8px; }
.dokan-lede { margin: 10px 0 2px; }
.dokan-lede b { font-size: 1.3rem; color: var(--navy); }
.dokan-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.dokan-card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 10px; }
.dokan-card-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.dokan-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; cursor: pointer; }
.dokan-thumbs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) {
  .dokan-chara { transition: none; }
}

/* 入力を断られた理由を、そのボタンのすぐ横に出す */
.form-error {
  flex-basis: 100%;
  margin: 6px 0 0;
  padding: 8px 12px;
  border-radius: 6px;
  background: #fbe9e7;
  border: 1px solid #c9553d;
  color: #8c2f1c;
  font-size: 0.88rem;
}
