/* ── 文学部: ナチュラルブックカフェ ── */
:root {
  --paper: #faf6ee;        /* 生成りの紙 */
  --card: #fffdf8;         /* 白めの紙 */
  --shade: #efe8d8;        /* 薄い影・非選択 */
  --line: #e3d9c6;         /* 罫線 */
  --line-dark: #d8cbb0;    /* 濃い罫線 */
  --ink: #4a3b2a;          /* 本文の焦げ茶 */
  --ink-dark: #3f3122;     /* 見出し */
  --ink-soft: #6d5e46;     /* やや薄い */
  --ink-faint: #8a7a5f;    /* 補足 */
  --ink-ghost: #a89878;    /* 最も薄い */
  --olive: #6b7a4f;        /* 差し色1 */
  --olive-bg: #eef0e5;
  --olive-dark: #4d5a35;
  --terra: #b0563a;        /* 差し色2 */
  --terra-bg: #f6ece5;
  --gold: #c98a2e;         /* 星 */
  --shelf: #efe4cf;        /* 棚の背景 */
  --shelf-board: #c9b287;  /* 棚板 */
  --serif: 'Zen Old Mincho', serif;
  --sans: 'Zen Kaku Gothic New', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--paper); }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(107,122,79,0.05), transparent 32%),
    radial-gradient(circle at 88% 90%, rgba(176,86,58,0.05), transparent 32%),
    var(--paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.8;
}

/* ── ヘッダー ── */
.site-header { text-align: center; padding: 44px 16px 26px; }
.brand { cursor: pointer; display: inline-block; }
.brand-en { font-size: 11px; letter-spacing: 4px; color: var(--ink-faint); }
.brand-ja {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  color: var(--ink-dark);
  margin-top: 6px;
  letter-spacing: 6px;
  text-indent: 6px;
}
.brand-rule { width: 40px; height: 1px; background: var(--terra); margin: 14px auto; }
.brand-copy { font-size: 12.5px; color: var(--ink-faint); }

/* ── タブ ── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
}
.tab {
  background: var(--shade);
  color: var(--ink-faint);
  font-size: 13px;
  padding: 8px 16px 10px;
  border: none;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-family: var(--sans);
  transition: background 0.15s, color 0.15s, padding 0.15s;
}
.tab:hover { background: #e9e0cc; }
.tab.active {
  background: var(--olive);
  color: #f3efe4;
  font-family: var(--serif);
  padding-top: 10px;
}
.tab.tab-activity.active { background: var(--terra); }
.tab.tab-add { color: var(--terra); }

/* ── メイン ── */
.app {
  flex: 1;
  width: 100%;
  max-width: 860px;
  margin: 0 auto 40px;
  padding: 0 16px;
}
.sheet {
  background: var(--card);
  border: 0.5px solid var(--line);
  border-top: 2px solid var(--olive);
  border-radius: 0 12px 12px 12px;
  padding: 22px 18px 26px;
  animation: rise 0.35s ease both;
}
.sheet.sheet-terra { border-top-color: var(--terra); }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (min-width: 640px) { .sheet { padding: 30px 34px 34px; } }

/* ── 見出し・共通 ── */
.section-label {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 2px;
  border-bottom: 1px dashed var(--line-dark);
  padding-bottom: 6px;
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.muted { color: var(--ink-ghost); font-size: 12px; }
.empty {
  text-align: center;
  color: var(--ink-ghost);
  font-size: 13px;
  padding: 28px 10px;
  line-height: 2;
}
.loading { text-align: center; color: var(--ink-ghost); padding: 40px 0; font-size: 13px; }

/* ── プロフィール ── */
.profile { text-align: center; }
.avatar {
  width: 68px; height: 68px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  border: 2px solid;
}
.avatar.sm { width: 30px; height: 30px; font-size: 17px; border-width: 1px; }
.avatar.md { width: 44px; height: 44px; font-size: 24px; border-width: 1.5px; }
.profile-name { font-family: var(--serif); font-size: 22px; color: var(--ink-dark); margin-top: 10px; }
.profile-intro { font-size: 13px; color: var(--ink-faint); margin-top: 6px; white-space: pre-line; }
.profile-actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ── 統計 ── */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 18px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.stat {
  background: var(--paper);
  border: 0.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}
.stat-label { font-size: 10.5px; color: var(--ink-ghost); letter-spacing: 1px; }
.stat-value { font-family: var(--serif); font-size: 22px; color: var(--ink-dark); margin-top: 2px; }
.stat-value small { font-size: 11px; color: var(--ink-faint); font-family: var(--sans); }
.stat-value.text { font-size: 14px; margin-top: 8px; }

/* ── 本棚 ── */
.shelf-wrap { background: var(--shelf); border-radius: 10px; padding: 14px 12px 0; overflow-x: auto; }
.shelf-row { display: flex; gap: 10px; align-items: flex-end; min-height: 100px; }
.spine {
  min-width: 66px;
  width: 66px;
  height: 96px;
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
  border: 0.5px solid rgba(74,59,42,0.2);
  border-bottom: none;
}
.spine:hover { transform: translateY(-5px); }
.spine img { width: 100%; height: 100%; object-fit: cover; display: block; }
.spine-title {
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  padding: 6px;
  word-break: break-all;
}
.shelf-board { height: 9px; background: var(--shelf-board); border-radius: 0 0 8px 8px; margin: 0 -12px; }

/* ── 読書カード ── */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--paper);
  border: 0.5px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-title {
  font-family: var(--serif);
  font-size: 15.5px;
  color: var(--ink-dark);
  cursor: pointer;
  line-height: 1.6;
}
.card-title:hover { color: var(--terra); }
.card-sub { font-size: 11px; color: var(--ink-ghost); margin-top: 2px; }
.stars { color: var(--gold); font-size: 13px; white-space: nowrap; letter-spacing: 1px; }
.stars .off { color: var(--line-dark); }
.encounter { margin-top: 10px; font-size: 12px; color: var(--ink-soft); }
.encounter-tag {
  background: var(--olive-bg);
  color: var(--olive-dark);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  margin-right: 6px;
  white-space: nowrap;
  display: inline-block;
}
.review {
  margin-top: 10px;
  font-size: 13px;
  line-height: 2;
  border-left: 2px solid var(--line-dark);
  padding-left: 12px;
  white-space: pre-line;
}
.card-foot {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--ink-ghost);
}
.card-ops { display: flex; gap: 10px; }
.op { color: var(--ink-ghost); cursor: pointer; background: none; border: none; font-size: 12px; font-family: var(--sans); }
.op:hover { color: var(--terra); }

/* ── 本の詳細 ── */
.backlink { font-size: 12px; color: var(--ink-ghost); cursor: pointer; background: none; border: none; font-family: var(--sans); }
.backlink:hover { color: var(--terra); }
.book-hero { display: flex; gap: 18px; margin-top: 16px; }
.book-cover {
  width: 104px; min-width: 104px; height: 148px;
  border-radius: 4px;
  border: 0.5px solid var(--line);
  overflow: hidden;
  background: var(--shade);
  display: flex;
  align-items: center;
  justify-content: center;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover .noimg { font-family: var(--serif); font-size: 13px; color: var(--ink-faint); text-align: center; padding: 8px; }
.book-title { font-family: var(--serif); font-size: 21px; color: var(--ink-dark); line-height: 1.5; }
.book-meta { width: 100%; font-size: 12px; color: var(--ink-soft); margin-top: 10px; border-collapse: collapse; }
.book-meta td { padding: 2.5px 0; vertical-align: top; }
.book-meta td:first-child { color: var(--ink-ghost); width: 58px; }
.world-rating { margin-top: 10px; font-size: 12px; }
.world-rating a { color: var(--ink-faint); }
.desc-box { margin-top: 16px; background: var(--card); border: 0.5px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.desc-box .review, .desc-text { font-size: 13px; line-height: 2; margin-top: 6px; white-space: pre-line; }

/* ── 活動報告 ── */
.activity-head-badge {
  background: var(--olive);
  color: #f3efe4;
  font-size: 11.5px;
  padding: 3px 12px;
  border-radius: 12px;
  font-family: var(--serif);
}
.activity-photo { margin-top: 10px; border-radius: 8px; overflow: hidden; }
.activity-photo img { width: 100%; max-height: 320px; object-fit: cover; display: block; }
.activity-foot { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-dark); font-size: 12px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 4px; }

/* ── ボタン ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 13px;
  padding: 9px 20px;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s, background 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--terra); color: #f6ece5; border-color: var(--terra); }
.btn-outline { background: transparent; color: var(--terra); border-color: var(--terra); }
.btn-ghost { background: transparent; color: var(--ink-faint); border-color: var(--line-dark); }
.btn-sm { font-size: 11.5px; padding: 5px 14px; }
.btn-block { width: 100%; justify-content: center; }
.center { text-align: center; margin-top: 16px; }

/* ── フォーム ── */
.field { margin-top: 16px; }
.field-label { font-size: 12px; color: var(--ink-faint); display: block; margin-bottom: 6px; }
.field-label .req { color: var(--terra); font-size: 10px; margin-left: 4px; }
input[type="text"], input[type="date"], input[type="search"], textarea, select {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--olive); }
textarea { min-height: 96px; resize: vertical; line-height: 1.9; }
.hint { font-size: 11px; color: var(--ink-ghost); margin-top: 4px; }

/* 検索候補 */
.search-box { position: relative; }
.suggest {
  border: 0.5px solid var(--line);
  border-radius: 8px;
  margin-top: 6px;
  overflow: hidden;
  background: var(--card);
}
.suggest-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  align-items: center;
  border-top: 0.5px solid var(--line);
}
.suggest-item:first-child { border-top: none; }
.suggest-item:hover { background: var(--paper); }
.suggest-item.selected { background: var(--olive-bg); }
.suggest-thumb {
  width: 30px; min-width: 30px; height: 44px;
  background: var(--shade);
  border-radius: 2px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-ghost);
  font-size: 13px;
}
.suggest-thumb img { width: 100%; height: 100%; object-fit: cover; }
.suggest-title { font-size: 13px; color: var(--ink-dark); }
.suggest-title .check { font-size: 10.5px; color: var(--olive-dark); margin-left: 6px; }
.suggest-sub { font-size: 11px; color: var(--ink-faint); }

/* 星入力 */
.star-input { font-size: 26px; color: var(--gold); display: flex; gap: 6px; }
.star-input button { background: none; border: none; cursor: pointer; color: inherit; font-size: inherit; padding: 0; }
.star-input button.off { color: var(--line-dark); }

/* 出会いタグ */
.tag-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-chip {
  border: 1px solid var(--line-dark);
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  padding: 7px 13px;
  border-radius: 16px;
  cursor: pointer;
  font-family: var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tag-chip.on { background: var(--olive); border-color: var(--olive); color: #f3efe4; }

/* アイコン・色選択 */
.icon-grid, .color-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-pick {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line-dark);
  background: var(--card);
  font-size: 23px;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.icon-pick.on { border-color: var(--olive); background: var(--olive-bg); color: var(--olive-dark); }
.color-pick { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 2.5px solid transparent; }
.color-pick.on { border-color: var(--ink-dark); }

/* ── モーダル ── */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(63,49,34,0.42);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 14px;
  z-index: 50;
  overflow-y: auto;
  animation: fade 0.2s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--paper);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  padding: 24px 20px 24px;
  animation: rise 0.25s ease both;
  margin: auto 0;
}
@media (min-width: 640px) { .modal { padding: 28px 28px; } }
.modal-title { font-family: var(--serif); font-size: 18px; color: var(--ink-dark); text-align: center; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn { flex: 1; justify-content: center; border-radius: 8px; }

/* ── トースト ── */
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-dark);
  color: #f3efe4;
  font-size: 13px;
  padding: 10px 22px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── フッター ── */
.site-footer {
  text-align: center;
  padding: 26px 16px 34px;
  font-size: 11px;
  color: var(--ink-ghost);
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
