/* 出資と会社設立の学習ノート — スマホ優先 / システムフォントのみ */
:root {
  --navy: #1f2f4a;
  --navy-2: #2e4366;
  --gray-1: #f4f5f7;
  --gray-2: #e3e6eb;
  --gray-3: #b9c0cb;
  --gray-4: #6b7482;
  --text: #1d2430;
  --accent: #c98a1b;       /* アクセント（落ち着いた金茶） */
  --accent-soft: #fbf1df;
  --ok: #2f7a4f;
  --ok-soft: #e5f3ea;
  --ng: #b23b3b;
  --ng-soft: #f9e6e6;
  --radius: 12px;
  --tabbar-h: 68px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.8;
  color: var(--text);
  background: var(--gray-1);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}

/* ヘッダー */
.app-header {
  background: var(--navy);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
}
.app-title { margin: 0; font-size: 1.15rem; letter-spacing: .02em; }
.app-sub { margin: 4px 0 0; font-size: .8rem; color: #c8d1e0; line-height: 1.5; }

.app-main { max-width: 720px; margin: 0 auto; padding: 20px 16px; }

h2 { font-size: 1.3rem; color: var(--navy); margin: 0 0 12px; line-height: 1.5; }
h3 { font-size: 1.1rem; color: var(--navy); margin: 28px 0 8px; padding-left: 10px; border-left: 4px solid var(--accent); line-height: 1.5; }
h4 { font-size: 1rem; color: var(--navy-2); margin: 20px 0 6px; }
p { margin: 0 0 14px; }

.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(20, 30, 50, .06);
}

.muted { color: var(--gray-4); font-size: .88rem; }

/* ボタン */
button { font: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px;
  border-radius: 10px; border: 1px solid var(--gray-3);
  background: #fff; color: var(--navy); font-weight: 600;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--navy-2); padding-left: 4px; }
.btn-small { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.btn-danger { color: var(--ng); border-color: #e2b4b4; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* タブバー（画面下・片手操作） */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--gray-2);
  box-shadow: 0 -2px 10px rgba(20, 30, 50, .06);
}
.tab-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: none; background: transparent; color: var(--gray-4);
  font-size: .75rem; font-weight: 600; min-height: 56px;
}
.tab-icon { font-size: 1.35rem; line-height: 1; }
.tab-btn.is-active { color: var(--navy); }
.tab-btn.is-active .tab-icon { color: var(--accent); }

/* レッスン一覧 */
.progress-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.bar { height: 10px; background: var(--gray-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }

.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: #fff; border: 1px solid var(--gray-2); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; text-align: left; color: var(--text); min-height: 72px;
}
.lesson-num {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gray-1); color: var(--navy); font-weight: 700;
}
.lesson-item.is-read .lesson-num { background: var(--navy); color: #fff; }
.lesson-meta { flex: 1; min-width: 0; }
.lesson-meta strong { display: block; font-size: 1rem; line-height: 1.5; }
.lesson-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.badge { font-size: .75rem; padding: 1px 8px; border-radius: 99px; background: var(--gray-1); color: var(--gray-4); line-height: 1.7; }
.badge-read { background: var(--ok-soft); color: var(--ok); }
.badge-score { background: var(--accent-soft); color: #8a5c0c; }
.chev { color: var(--gray-3); font-size: 1.3rem; }

/* レッスン本文 */
.lesson-intro { font-size: 1.02rem; color: var(--navy-2); background: var(--gray-1); border-radius: 10px; padding: 12px 14px; }
.lesson-body ul, .lesson-body ol { padding-left: 1.3em; margin: 0 0 14px; }
.lesson-body li { margin-bottom: 6px; }
.note { font-size: .88rem; color: var(--gray-4); background: var(--gray-1); padding: 10px 12px; border-radius: 8px; }

.table-wrap { overflow-x: auto; margin: 0 0 16px; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 420px; font-size: .9rem; line-height: 1.6; }
th, td { border: 1px solid var(--gray-2); padding: 8px 10px; text-align: left; vertical-align: top; }
thead th { background: var(--navy); color: #fff; font-weight: 600; }
tbody th { background: var(--gray-1); color: var(--navy); white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }

.points { background: var(--accent-soft); border-left: 5px solid var(--accent); border-radius: 10px; padding: 14px 16px; margin: 24px 0; }
.points h3 { margin: 0 0 6px; border: none; padding: 0; }
.points ul { margin: 0; padding-left: 1.2em; }

/* クイズ */
.quiz-q { margin-bottom: 22px; }
.quiz-q > p { font-weight: 600; margin-bottom: 8px; }
.choice {
  display: block; width: 100%; text-align: left;
  border: 1px solid var(--gray-3); background: #fff; color: var(--text);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; min-height: 52px; line-height: 1.6;
}
.choice:disabled { cursor: default; }
.choice.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.is-wrong { border-color: var(--ng); background: var(--ng-soft); }
.choice-mark { font-weight: 700; margin-right: 6px; }
.explain { border-radius: 10px; padding: 10px 14px; font-size: .93rem; }
.explain.ok { background: var(--ok-soft); }
.explain.ng { background: var(--ng-soft); }
.quiz-score { font-weight: 700; color: var(--navy); font-size: 1.05rem; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* フォーム */
label { display: block; font-size: .88rem; color: var(--gray-4); margin-bottom: 4px; }
input[type="text"], input[type="number"], input[type="search"] {
  width: 100%; font: inherit; font-size: 16px; /* iOS のズーム防止 */
  padding: 10px 12px; min-height: 48px;
  border: 1px solid var(--gray-3); border-radius: 10px; background: #fff; color: var(--text);
}
input:focus { border-color: var(--navy-2); }

.investor-row { border: 1px solid var(--gray-2); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.investor-inputs { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.investor-result { margin-top: 10px; }
.share { font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.share-bar { height: 8px; background: var(--gray-2); border-radius: 99px; overflow: hidden; margin: 4px 0 8px; position: relative; }
.share-bar > span { display: block; height: 100%; background: var(--navy-2); }
.verdicts { list-style: none; margin: 0; padding: 0; }
.verdicts li { font-size: .9rem; padding: 2px 0 2px 1.4em; position: relative; line-height: 1.6; }
.verdicts li::before { content: "●"; position: absolute; left: 0; color: var(--accent); font-size: .8em; top: .35em; }
.verdicts li.none::before { color: var(--gray-3); }

.total-line { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; color: var(--navy); }
.total-line .big { font-size: 1.4rem; }

.alert { border-radius: 10px; padding: 12px 14px; margin: 10px 0; font-size: .93rem; }
.alert-warn { background: var(--accent-soft); border-left: 5px solid var(--accent); }
.alert-info { background: var(--gray-1); border-left: 5px solid var(--gray-3); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.check-inline { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .93rem; margin: 6px 0 12px; }
.check-inline input { width: 22px; height: 22px; }

.runway-result { text-align: center; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.runway-result .big { font-size: 2rem; font-weight: 700; display: block; line-height: 1.3; }
.runway-result small { color: #c8d1e0; }

/* 用語集 */
.search-box { position: sticky; top: 0; z-index: 5; background: var(--gray-1); padding: 4px 0 12px; }
.term { background: #fff; border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid var(--gray-2); }
.term dt { font-weight: 700; color: var(--navy); }
.term dt .reading { font-weight: 400; color: var(--gray-4); font-size: .82rem; margin-left: 6px; }
.term dd { margin: 4px 0 0; font-size: .95rem; }
mark { background: #fde7b8; color: inherit; padding: 0 1px; border-radius: 3px; }

/* チェックリスト */
.check-item {
  display: flex; gap: 14px; align-items: flex-start;
  background: #fff; border: 1px solid var(--gray-2); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer; color: var(--text); font-size: 1rem;
}
.check-item input { flex: none; width: 26px; height: 26px; margin-top: 2px; accent-color: var(--navy); }
.check-item.is-done { background: var(--ok-soft); border-color: #bcdcc8; }
.check-item.is-done .check-title { text-decoration: line-through; text-decoration-color: var(--gray-3); }
.check-title { font-weight: 600; display: block; line-height: 1.6; }
.check-note { display: block; font-size: .86rem; color: var(--gray-4); margin-top: 2px; line-height: 1.6; }

@media (max-width: 420px) {
  body { font-size: 16.5px; }
  .investor-inputs { grid-template-columns: 1fr 1fr; }
  .investor-inputs .del-wrap { grid-column: 1 / -1; }
  .investor-inputs .del-wrap .btn { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (min-width: 900px) {
  .app-header { text-align: center; }
  .tabbar { max-width: 720px; margin: 0 auto; border-radius: 16px 16px 0 0; border: 1px solid var(--gray-2); }
}

/* シミュレーター集計表は画面幅に収める */
.table-wrap.compact table { min-width: 0; }
.table-wrap.compact th { white-space: normal; word-break: break-all; }
input[readonly] { background: var(--gray-1); color: var(--gray-4); }
