:root {
  --paper: #f4efe4;
  --card: #fcfaf3;
  --card-alt: #f7f3ea;
  --ink: #211d17;
  --ink2: #3a352c;
  --sub: #6c6456;
  --muted: #8a8272;
  --line: #ece3d0;
  --line-strong: #ddd3bf;
  --indigo: #223a5e;
  --indigo-tile: #e7ebf1;
  --gold: #c8a24a;
  --overdue: #9a3a2c;
  --overdue-bg: #f1e2dd;
  --overdue-border: #e7d3cc;
  --duesoon: #8f6614;
  --duesoon-bg: #f4e9d2;
  --tokiwa: #2e6b52;
  --tokiwa-bg: #e3ede7;
  --tokiwa-border: #cfe0d6;
  --serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
img, a { -webkit-user-drag: none; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

.phone {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
}

.topbar {
  height: 56px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.mark { font-family: var(--serif); font-size: 24px; font-weight: 700; color: var(--indigo); line-height: 1; }
.word { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.avatar {
  margin-left: auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--indigo-tile);
  display: grid; place-items: center;
}
.menu {
  position: absolute;
  right: 16px; top: 52px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(33, 29, 23, 0.08);
  z-index: 5;
  min-width: 200px;
}
.menu-note { margin: 0; font-size: 13px; color: var(--muted); }

.stage {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 100px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
}
.stage.is-dragging,
.stage.is-dragging * {
  cursor: grabbing;
  user-select: none;
}
.stage::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 1.4px;
  color: var(--muted);
  text-transform: uppercase;
}
.section-label .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--overdue);
}
.pad { padding: 6px 20px 0; }

.card {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
  text-align: left;
  width: 100%;
}
.card.overdue { border-color: var(--overdue-border); box-shadow: 0 6px 16px rgba(154, 58, 44, 0.18); }
.card.handled { background: var(--card-alt); }
.tile {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--indigo-tile);
  color: var(--indigo);
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.card.handled .tile { background: #eae3d3; color: var(--sub); }
.card-main { flex: 1; min-width: 0; }
.card-top { display: flex; gap: 8px; align-items: flex-start; }
.title { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.handled .title { font-weight: 500; color: var(--sub); }
.amount { font-family: var(--mono); font-size: 13.5px; margin-left: auto; }
.jp { font-family: var(--serif); font-size: 13px; color: var(--sub); margin-top: 2px; }
.status { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.chip {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}
.chip.overdue { background: var(--overdue-bg); color: var(--overdue); }
.chip.soon { background: var(--duesoon-bg); color: var(--duesoon); }
.meta { font-size: 12px; color: var(--sub); }
.stamp {
  width: 34px; height: 34px;
  border: 3px solid var(--tokiwa);
  border-radius: 50%;
  color: var(--tokiwa);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 17px;
  display: grid; place-items: center;
  transform: rotate(-9deg);
  flex-shrink: 0;
}

.guides-head { padding: 10px 24px 12px; }
.guides-head h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; margin: 0; }
.guides-sub { display: flex; align-items: center; gap: 7px; margin-top: 6px; font-size: 13px; color: var(--sub); }
.guides-sub .live { width: 6px; height: 6px; border-radius: 50%; background: var(--tokiwa); }
.guide-card {
  display: block; width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 16px;
  margin-bottom: 10px;
  text-align: left;
}
.guide-title { font-size: 15px; font-weight: 700; }
.guide-jp { font-family: var(--serif); font-size: 13px; color: var(--muted); margin-left: 8px; }
.guide-sum { font-size: 13px; color: var(--sub); line-height: 1.55; margin-top: 5px; }
.guide-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 10px; }

.detail { padding: 4px 24px 24px; }
.back {
  display: flex; align-items: center; gap: 8px;
  color: var(--indigo); font-size: 13px; font-weight: 600;
  margin: 4px 0 16px;
}
.kicker { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 1.2px; text-transform: uppercase; }
.detail h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.4; margin: 10px 0 0; }
.summary { font-size: 14px; color: var(--ink2); line-height: 1.7; margin: 16px 0 0; }
.metrics { display: flex; gap: 8px; margin-top: 18px; }
.metric {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px;
}
.metric.danger { border-color: var(--overdue-border); }
.metric label { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.8px; color: var(--muted); }
.metric b { display: block; margin-top: 5px; font-size: 14px; }
.metric.danger b { color: var(--overdue); }
.metric .amt { font-family: var(--mono); font-weight: 500; }
.steps { margin: 10px 0 0; padding: 0; list-style: none; }
.steps li { display: flex; gap: 8px; font-size: 13.5px; color: var(--ink2); line-height: 1.5; margin-bottom: 8px; }
.steps li::before { content: "・"; color: var(--indigo); }
.term { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.term:first-of-type { border-top: 0; }
.term-jp { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.reading { font-family: var(--mono); font-size: 10.5px; color: #86a6d4; }
.meaning { font-size: 13px; color: var(--sub); text-align: right; }
.paid-banner {
  background: var(--tokiwa-bg);
  border: 1px solid var(--tokiwa-border);
  border-radius: 18px;
  padding: 24px 22px;
  position: relative;
}
.paid-banner .k { font-family: var(--mono); font-size: 11.5px; color: var(--tokiwa); letter-spacing: 2px; }
.paid-banner h2 { margin-top: 8px; padding-right: 70px; }
.paid-banner .stamp { position: absolute; top: 16px; right: 16px; width: 72px; height: 72px; font-size: 36px; border-width: 3px; color: #c63f2c; border-color: #c63f2c; }
.actions {
  display: flex; gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
.btn-paid {
  flex: 1; height: 50px;
  background: var(--tokiwa); color: var(--paper);
  border-radius: 13px;
  font-weight: 700; font-size: 15px;
}
.btn-outline {
  flex: 1; height: 50px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  font-weight: 700; font-size: 14px; color: var(--sub);
}

.fab {
  position: absolute;
  left: 50%; bottom: 40px;
  transform: translateX(-50%);
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--indigo);
  box-shadow: 0 8px 20px rgba(34, 58, 94, 0.45);
  display: grid; place-items: center;
  z-index: 3;
}

.tabbar {
  height: 72px;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}
.tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10.5px; font-weight: 500;
}
.tab.on { color: var(--indigo); font-weight: 700; }
.tab-gap { width: 72px; }

.toast {
  position: fixed;
  left: 50%; bottom: 96px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  max-width: 86%;
  z-index: 10;
}

.md { font-size: 14px; color: var(--ink2); line-height: 1.7; }
.md p { margin: 0 0 12px; }
.md h2, .md h3 { font-family: var(--serif); color: var(--ink); margin: 18px 0 8px; }
.source {
  display: flex; gap: 11px; align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  margin-top: 8px;
  text-decoration: none; color: inherit;
}
.source .kan { width: 30px; height: 30px; border-radius: 8px; background: var(--tokiwa-bg); color: var(--tokiwa); font-family: var(--serif); font-weight: 600; display: grid; place-items: center; }
.source b { display: block; font-size: 13px; }
.source span { font-family: var(--mono); font-size: 11px; color: var(--indigo); }
