/* おつきあい帳 ── 和モダン（白・薄鼠・墨・金） */
:root {
  --washi: #faf8f5;
  --paper: #ffffff;
  --ink: #2b2a28;
  --ink-soft: #5c5a55;
  --ink-faint: #92908a;
  --line: #e8e4dd;
  --gold: #b8963e;
  --gold-soft: #f4ecd9;
  --gold-deep: #96782e;
  --festive: #c25e5e;
  --festive-soft: #faf0ef;
  --sober: #5a6a7a;
  --sober-soft: #eef1f4;
  --ok: #4a7c59;
  --ok-soft: #edf4ef;
  --warn: #b05a2a;
  --warn-soft: #faf1ea;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(43, 42, 40, .06), 0 6px 20px rgba(43, 42, 40, .05);
  --serif: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --sans: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--washi);
  color: var(--ink);
  line-height: 1.75;
  font-size: 15.5px;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* ===== ヒーロー ===== */
.hero {
  background:
    radial-gradient(ellipse 90% 120% at 50% -30%, #fff 30%, transparent 70%),
    linear-gradient(175deg, #fdfcfa 0%, var(--washi) 60%, #f5f1ea 100%);
  border-bottom: 1px solid var(--line);
  text-align: center;
  padding: 34px 20px 26px;
  position: relative;
  overflow: hidden;
}
.hero-kanji {
  position: absolute;
  right: -8px; top: -34px;
  font-family: var(--serif);
  font-size: 150px;
  color: var(--gold);
  opacity: .09;
  user-select: none;
  pointer-events: none;
  line-height: 1;
}
.hero h1 {
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: .14em;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.hero h1:hover { opacity: .7; }
.hero h1::after {
  content: '';
  display: block;
  width: 46px; height: 2px;
  background: var(--gold);
  margin: 10px auto 0;
}
.hero-sub { color: var(--ink-soft); font-size: 13px; margin-top: 10px; letter-spacing: .04em; }

/* ===== タブ ===== */
.tabs {
  display: flex;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  min-width: 72px;
  background: none; border: none;
  padding: 10px 10px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11.5px;
  color: var(--ink-faint);
  border-bottom: 2.5px solid transparent;
  transition: color .15s, border-color .15s;
  letter-spacing: .02em;
  white-space: nowrap;
}
.tab-ico { font-size: 19px; }
.tab.active { color: var(--gold-deep); border-bottom-color: var(--gold); font-weight: 700; }

/* ===== レイアウト ===== */
main { max-width: 640px; margin: 0 auto; padding: 20px 16px 48px; }
.pane { display: none; animation: fade .25s ease; }
.pane.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
h2.sec {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: .08em;
  margin-bottom: 4px;
}
.sec-sub { color: var(--ink-faint); font-size: 12.5px; margin-bottom: 14px; }

.step-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink-soft);
  margin: 18px 0 8px;
  letter-spacing: .05em;
}
.step-label .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: var(--ink); color: #fff;
  border-radius: 50%;
  font-size: 11px; font-family: var(--serif);
}

/* 選択チップ群 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--washi);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 13.5px;
  color: var(--ink-soft);
  transition: all .15s;
  line-height: 1.4;
}
.chip:hover { border-color: var(--gold); }
.chip.on {
  background: var(--ink); color: #fff;
  border-color: var(--ink);
  font-weight: 700;
}
.chip .ci { margin-right: 4px; }

/* ===== 結果カード ===== */
.result-card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin: 20px 0 16px;
  background: var(--paper);
  animation: fade .3s ease;
}
.result-head {
  padding: 14px 20px 12px;
  font-size: 13px;
  letter-spacing: .06em;
  display: flex; justify-content: space-between; align-items: center;
  color: #fff;
}
.result-head.festive { background: linear-gradient(135deg, #b3524f, #c9756f); }
.result-head.sober { background: linear-gradient(135deg, #4c5a68, #63788c); }
.result-amount {
  text-align: center;
  padding: 26px 20px 8px;
}
.result-amount .range { font-size: 15px; color: var(--ink-soft); letter-spacing: .04em; }
.result-amount .best {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
  margin: 2px 0;
}
.result-amount .best small { font-size: 20px; margin-left: 2px; }
.result-amount .best-label {
  display: inline-block;
  background: var(--gold-soft); color: var(--gold-deep);
  font-size: 11.5px; font-weight: 700;
  border-radius: 999px;
  padding: 2px 12px;
  letter-spacing: .08em;
}
.result-reason {
  padding: 14px 20px;
  font-size: 13.5px;
  color: var(--ink-soft);
  border-top: 1px dashed var(--line);
  margin-top: 14px;
}
.manner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}
.manner-cell { background: var(--paper); padding: 13px 16px; }
.manner-cell.wide { grid-column: 1 / -1; }
.manner-cell .k {
  font-size: 11px; font-weight: 700; color: var(--gold-deep);
  letter-spacing: .1em; margin-bottom: 3px;
}
.manner-cell .v { font-size: 13px; color: var(--ink-soft); line-height: 1.65; }
.manner-cell .v b { color: var(--ink); font-size: 14.5px; font-family: var(--serif); }
.omote-item { margin-bottom: 6px; }
.omote-item:last-child { margin-bottom: 0; }

/* 金額チェック */
.amount-check { margin-top: 6px; }
.amount-check-row { display: flex; gap: 8px; }
.amount-check input {
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--washi);
  min-width: 0;
}
.amount-check input:focus { outline: none; border-color: var(--gold); background: #fff; }
.btn {
  background: var(--ink); color: #fff;
  border: none; border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px; font-weight: 700;
  letter-spacing: .05em;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .85; }
.btn.gold { background: var(--gold); }
.btn.ghost { background: none; color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn.sm { padding: 7px 14px; font-size: 12.5px; }
.verdict {
  margin-top: 10px;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.7;
}
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }

/* 履歴ヒント */
.history-hint {
  background: var(--gold-soft);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--gold-deep);
  margin-top: 12px;
}

/* ===== おつきあい帳 ===== */
.ledger-toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.person-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
.person-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}
.person-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-deep);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-weight: 700; font-size: 17px;
  flex-shrink: 0;
}
.person-info { flex: 1; min-width: 0; }
.person-name { font-weight: 700; font-size: 15px; }
.person-meta { font-size: 12px; color: var(--ink-faint); }
.person-balance { text-align: right; font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; }
.person-balance b { font-size: 13.5px; color: var(--ink); font-family: var(--serif); }
.person-body { border-top: 1px solid var(--line); padding: 12px 16px 16px; display: none; }
.person-card.open .person-body { display: block; }
.rec-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.rec-row .d { color: var(--ink-faint); font-size: 12px; white-space: nowrap; }
.rec-row .e { flex: 1; min-width: 0; }
.rec-row .a { font-family: var(--serif); font-weight: 700; white-space: nowrap; }
.rec-row .a.gave { color: var(--festive); }
.rec-row .a.recv { color: var(--ok); }
.rec-row .del { background: none; border: none; color: var(--ink-faint); font-size: 15px; padding: 0 2px; }
.rec-note { font-size: 11.5px; color: var(--ink-faint); }
.dir-badge {
  font-size: 10.5px; font-weight: 700;
  border-radius: 4px; padding: 1px 6px;
  margin-right: 4px; vertical-align: 1px;
}
.dir-badge.gave { background: var(--festive-soft); color: var(--festive); }
.dir-badge.recv { background: var(--ok-soft); color: var(--ok); }

/* フォーム */
.form-grid { display: grid; gap: 10px; margin-top: 10px; }
.form-grid label { font-size: 12px; font-weight: 700; color: var(--ink-soft); display: block; margin-bottom: 3px; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--washi);
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: none; border-color: var(--gold); background: #fff;
}
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button {
  flex: 1; background: var(--washi); border: none;
  padding: 9px; font-size: 13.5px; color: var(--ink-faint); font-weight: 700;
}
.seg button.on.gave { background: var(--festive); color: #fff; }
.seg button.on.recv { background: var(--ok); color: #fff; }
.empty-state {
  text-align: center;
  color: var(--ink-faint);
  padding: 40px 20px;
  font-size: 13.5px;
  line-height: 2;
}
.empty-state .big { font-size: 40px; }

/* ===== チップ計算機 ===== */
.tip-country-note {
  background: var(--sober-soft);
  border-left: 3px solid var(--sober);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--sober);
  margin: 12px 0 4px;
  line-height: 1.65;
}
.tip-result {
  text-align: center;
  padding: 22px 16px 18px;
  background: linear-gradient(175deg, #fdfcfa, var(--gold-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 16px;
  animation: fade .3s ease;
}
.tip-result .tip-main {
  font-family: var(--serif);
  font-size: 40px; font-weight: 700;
  line-height: 1.25;
}
.tip-result .tip-sub { font-size: 13px; color: var(--ink-soft); }
.tip-result .tip-total { margin-top: 8px; font-size: 14.5px; color: var(--ink); }
.tip-result .tip-total b { font-family: var(--serif); font-size: 18px; }
.tip-none {
  font-family: var(--serif);
  font-size: 24px;
  color: var(--ok);
  line-height: 1.4;
}
.tip-note { font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; text-align: left; background: rgba(255,255,255,.6); border-radius: 8px; padding: 10px 12px; }
.split-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; font-size: 13px; }
.split-row button {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid var(--line); background: #fff;
  font-size: 16px; line-height: 1;
}
.country-select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--washi);
  font-size: 15px;
}

/* ===== 豆知識 ===== */
.trivia-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.trivia-tag {
  display: inline-block;
  font-size: 10.5px; font-weight: 700;
  color: var(--gold-deep); background: var(--gold-soft);
  border-radius: 999px; padding: 2px 10px;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.trivia-title {
  font-family: var(--serif);
  font-size: 16.5px;
  margin-bottom: 8px;
  line-height: 1.5;
}
.trivia-title .ti { margin-right: 6px; }
.trivia-body { font-size: 13.5px; color: var(--ink-soft); }
.trivia-filter { margin-bottom: 16px; }

/* ===== AI相談 ===== */
.chat-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  height: 62vh; min-height: 380px;
}
.chat-log { flex: 1; overflow-y: auto; padding: 16px; }
.msg { margin-bottom: 14px; display: flex; gap: 8px; }
.msg .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gold-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.msg .bubble {
  background: var(--washi);
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  padding: 10px 14px;
  font-size: 14px;
  max-width: 85%;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.msg.user { flex-direction: row-reverse; }
.msg.user .bubble {
  background: var(--ink); color: #fff;
  border-radius: 14px 4px 14px 14px;
  border-color: var(--ink);
}
.msg.user .avatar { background: var(--line); }
.chat-input {
  display: flex; gap: 8px;
  border-top: 1px solid var(--line);
  padding: 10px;
}
.chat-input textarea {
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  resize: none;
  height: 44px;
  background: var(--washi);
}
.chat-input textarea:focus { outline: none; border-color: var(--gold); }
.quick-qs { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 12px 12px; }
.quick-q {
  background: var(--washi);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ink-soft);
}
.quick-q:hover { border-color: var(--gold); color: var(--gold-deep); }
.typing { color: var(--ink-faint); font-size: 12.5px; }
.typing::after { content: '…'; animation: dots 1.2s infinite; }
@keyframes dots { 0% { content: '·'; } 33% { content: '··'; } 66% { content: '···'; } }

/* ===== SEO本文・フッター ===== */
.seo-body {
  max-width: 640px;
  margin: 30px auto 0;
  padding: 28px 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13.5px;
}
.seo-body h2 {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  margin: 22px 0 8px;
  letter-spacing: .05em;
}
.seo-body h2:first-child { margin-top: 0; }
.seo-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 18px;
  font-size: 12.5px;
  background: var(--paper);
}
.seo-body caption { text-align: left; font-size: 11.5px; color: var(--ink-faint); padding-bottom: 4px; }
.seo-body th, .seo-body td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
}
.seo-body th { background: var(--washi); font-weight: 700; white-space: nowrap; }
.seo-disclaimer { font-size: 11.5px; color: var(--ink-faint); margin-top: 14px; }
.site-footer {
  text-align: center;
  padding: 30px 16px 44px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  font-size: 12.5px;
  color: var(--ink-faint);
}
.footer-brand-lead {
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: .3em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.footer-brand {
  display: inline-block;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #fff;
  background: linear-gradient(135deg, var(--gold-deep), var(--gold));
  text-decoration: none;
  padding: 12px 34px;
  border-radius: 999px;
  box-shadow: 0 3px 12px rgba(184, 150, 62, .35);
  transition: transform .15s, box-shadow .15s;
}
.footer-brand .arrow { font-family: var(--sans); font-size: 15px; margin-left: 8px; letter-spacing: 0; }
.footer-brand:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(184, 150, 62, .45); }
.footer-brand-sub { font-size: 12px; color: var(--ink-soft); margin-top: 10px; }
.site-footer .fine { font-size: 11px; margin-top: 16px; }

@media (min-width: 520px) {
  .hero h1 { font-size: 34px; }
  .tab { font-size: 12.5px; }
}
