/* ============================================================
   mile-forge / app.css
   design-forge "cool" の components.css は触らず、
   このアプリで追加が必要なものだけをここに足す。
   ============================================================ */

/* ---- 全体 ---- */
.main { padding: 26px 30px 80px; max-width: 1180px; }
.page { display: none; }
.page.is-active { display: block; }

.page-head { margin-bottom: 24px; }
.page-head h2 {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 600;
  letter-spacing: .1em; display: flex; align-items: center; gap: .5em;
}
.page-head p { color: var(--c-muted); font-size: .9rem; margin-top: 8px; max-width: 760px; }

.sec-title {
  font-family: var(--font-display); font-size: 1rem; letter-spacing: .1em;
  margin: 34px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: .5em;
}
.sec-title:first-child { margin-top: 0; }

/* ---- モバイル用のナビ（768px以下でサイドバーが消えるため） ---- */
.mobile-nav { display: none; }
@media (max-width: 768px) {
  .main { padding: 18px 16px 70px; }
  .mobile-nav {
    display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px;
    background: #0c1014; border-bottom: 1px solid var(--c-border);
    position: sticky; top: 0; z-index: 90; -webkit-overflow-scrolling: touch;
  }
  .mobile-nav button {
    flex: 0 0 auto; font: inherit; font-size: .82rem; color: var(--c-muted);
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--radius-s); padding: 7px 13px; cursor: pointer; white-space: nowrap;
  }
  .mobile-nav button.active {
    color: var(--c-accent); border-color: var(--c-accent);
    background: color-mix(in srgb, var(--c-accent) 12%, transparent);
  }
  .topbar { padding: 0 16px; font-size: .85rem; }
  .topbar .topbar-sub { display: none; }
}

/* ---- 数値の並び ---- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 980px) { .stat-row, .stat-row.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stat-row, .stat-row.cols-3, .stat-row.cols-2 { grid-template-columns: 1fr; } }

.stat .stat-value { font-variant-numeric: tabular-nums; }
.stat.is-accent { border-left-color: var(--c-accent); }
.stat.is-accent .stat-value { color: var(--c-accent); }
.stat-sub { font-size: .78rem; color: var(--c-muted); margin-top: 6px; line-height: 1.6; }

/* ---- 確度バッジ・出典 ---- */
.conf {
  display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  padding: 2px 8px; border-radius: var(--radius-s); border: 1px solid; vertical-align: middle;
}
.conf-high   { color: var(--c-ok);   border-color: color-mix(in srgb, var(--c-ok) 55%, transparent);   background: color-mix(in srgb, var(--c-ok) 10%, transparent); }
.conf-medium { color: var(--c-warn); border-color: color-mix(in srgb, var(--c-warn) 55%, transparent); background: color-mix(in srgb, var(--c-warn) 10%, transparent); }
.conf-low    { color: var(--c-ng);   border-color: color-mix(in srgb, var(--c-ng) 55%, transparent);   background: color-mix(in srgb, var(--c-ng) 10%, transparent); }

.src { font-size: .75rem; color: var(--c-muted); }
.src a { color: var(--c-primary); border-bottom: 1px dotted currentColor; word-break: break-all; }
.src a:hover { color: var(--c-accent); }

.tag-estimate {
  display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  color: var(--c-warn); border: 1px dashed color-mix(in srgb, var(--c-warn) 60%, transparent);
  padding: 2px 8px; border-radius: var(--radius-s);
}

.note-box {
  border-left: 3px solid var(--c-warn); background: color-mix(in srgb, var(--c-warn) 7%, transparent);
  padding: 12px 16px; font-size: .84rem; color: var(--c-muted); line-height: 1.8;
  border-radius: 0 var(--radius-s) var(--radius-s) 0; margin: 16px 0;
}
.note-box strong { color: var(--c-text); }
.note-box.is-fact { border-left-color: var(--c-ok); background: color-mix(in srgb, var(--c-ok) 7%, transparent); }
.note-box.is-ng { border-left-color: var(--c-ng); background: color-mix(in srgb, var(--c-ng) 7%, transparent); }

/* ---- ポイント残高の入力行 ---- */
.pt-list { display: flex; flex-direction: column; gap: 10px; }
.pt-row {
  display: grid; grid-template-columns: 1fr 150px 150px auto;
  gap: 14px; align-items: center;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-border);
  border-radius: var(--radius-m); padding: 14px 18px; transition: border-color var(--speed);
}
.pt-row:hover { border-left-color: var(--c-primary); }
.pt-row.has-value { border-left-color: var(--c-accent); }
.pt-name { font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: .5em; flex-wrap: wrap; }
.pt-group {
  font-size: .68rem; font-weight: 500; letter-spacing: .08em; color: var(--c-muted);
  border: 1px solid var(--c-border); padding: 1px 7px; border-radius: var(--radius-s);
}
.pt-note { font-size: .76rem; color: var(--c-muted); margin-top: 4px; line-height: 1.6; grid-column: 1 / -1; }
.pt-row .input { text-align: right; font-variant-numeric: tabular-nums; }
.pt-field-label { font-size: .7rem; color: var(--c-muted); letter-spacing: .06em; display: block; margin-bottom: 3px; }
.pt-result { min-width: 130px; text-align: right; }
.pt-result b { font-family: var(--font-num); font-size: 1.15rem; color: var(--c-accent); font-variant-numeric: tabular-nums; }
.pt-result span { display: block; font-size: .72rem; color: var(--c-muted); }
@media (max-width: 860px) {
  .pt-row { grid-template-columns: 1fr 1fr; }
  .pt-result { grid-column: 1 / -1; text-align: left; }
}

/* ---- 持ち物のトグル ---- */
.gear-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 860px) { .gear-grid { grid-template-columns: 1fr; } }
.gear-item {
  display: flex; gap: 13px; align-items: flex-start; cursor: pointer;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-m); padding: 15px 18px; transition: all var(--speed);
}
.gear-item:hover { border-color: color-mix(in srgb, var(--c-primary) 55%, var(--c-border)); }
.gear-item.on { border-color: var(--c-accent); background: color-mix(in srgb, var(--c-accent) 8%, var(--c-surface)); }
.gear-item input { margin-top: 5px; width: 17px; height: 17px; accent-color: var(--c-accent); cursor: pointer; flex: 0 0 auto; }
.gear-label { font-weight: 700; font-size: .92rem; }
.gear-kind {
  font-size: .68rem; letter-spacing: .08em; color: var(--c-muted);
  border: 1px solid var(--c-border); padding: 1px 7px; border-radius: var(--radius-s); margin-left: .5em;
}
.gear-hint { font-size: .78rem; color: var(--c-muted); margin-top: 5px; line-height: 1.7; }

/* ---- 交換ルートのカード ---- */
.route-list { display: flex; flex-direction: column; gap: 14px; }
.route {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-primary); border-radius: var(--radius-m);
  padding: 18px 22px; transition: border-color var(--speed);
}
.route.is-best { border-left-color: var(--c-accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c-accent) 30%, transparent); }
.route.is-locked { opacity: .5; border-left-color: var(--c-border); }
.route-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.route-name { font-weight: 700; font-size: 1rem; flex: 1 1 260px; }
.route-pct {
  font-family: var(--font-num); font-size: 1.7rem; font-weight: 600;
  color: var(--c-accent); font-variant-numeric: tabular-nums; line-height: 1;
}
.route.is-locked .route-pct { color: var(--c-muted); }
.route-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: .82rem; color: var(--c-muted); }
.route-meta b { color: var(--c-text); font-weight: 500; }
.route-steps { margin: 14px 0 0; padding-left: 20px; font-size: .85rem; color: var(--c-muted); line-height: 1.9; }
.route-steps li::marker { color: var(--c-primary); }
.route-cautions { margin: 12px 0 0; padding: 0; list-style: none; font-size: .82rem; line-height: 1.8; }
.route-cautions li { color: var(--c-warn); padding-left: 1.3em; position: relative; }
.route-cautions li::before { content: "!"; position: absolute; left: 0; font-weight: 700; }
.route-locked-why {
  margin-top: 12px; font-size: .82rem; color: var(--c-ng);
  border-top: 1px dashed var(--c-border); padding-top: 10px;
}
.route-foot { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--c-border); display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: center; }
.route-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.period-badge {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; color: var(--c-primary-text);
  background: var(--c-primary); padding: 3px 10px; border-radius: var(--radius-s);
}

/* ---- 表 ---- */
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-family: var(--font-num); font-size: 1.05rem; color: var(--c-accent); }
.table-wrap { overflow-x: auto; }
.table-wrap .table { min-width: 620px; }

/* ---- 目盛り（1ポイント何円か） ---- */
.meter { margin: 20px 0 8px; }
.meter-bar {
  position: relative; height: 14px; border-radius: var(--radius-s);
  background: linear-gradient(90deg, #2a3542 0%, #37536b 35%, #4a7fa8 62%, var(--c-accent) 100%);
  border: 1px solid var(--c-border);
}
.meter-mark {
  position: absolute; top: -7px; bottom: -7px; width: 2px; background: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,.7);
}
.meter-mark span {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-size: .72rem; font-weight: 700; white-space: nowrap; color: #fff;
}
.meter-goal { position: absolute; top: -7px; bottom: -7px; width: 2px; background: var(--c-ng); }
.meter-goal span {
  position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%);
  font-size: .72rem; white-space: nowrap; color: var(--c-ng); font-weight: 700;
}
.meter-scale { display: flex; justify-content: space-between; font-size: .7rem; color: var(--c-muted); margin-top: 30px; }

/* ---- 判定 ---- */
.verdict-card {
  border: 1px solid var(--c-border); border-radius: var(--radius-m);
  padding: 28px 30px; background: var(--c-surface); box-shadow: var(--shadow-s);
}
.verdict-answer {
  font-family: var(--font-display); font-size: clamp(1.4rem, 3.4vw, 2.1rem);
  font-weight: 700; letter-spacing: .06em; line-height: 1.5;
}
.verdict-answer.yes { color: var(--c-ok); }
.verdict-answer.maybe { color: var(--c-warn); }
.verdict-answer.no { color: var(--c-ng); }
.verdict-lead { color: var(--c-muted); font-size: .9rem; margin-top: 14px; line-height: 1.9; }
.calc-line {
  font-family: var(--font-num); font-size: 1.05rem; letter-spacing: .04em;
  background: #0d1116; border: 1px solid var(--c-border); border-radius: var(--radius-s);
  padding: 14px 18px; margin: 18px 0; overflow-x: auto; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.calc-line em { font-style: normal; color: var(--c-accent); }
.calc-line .op { color: var(--c-muted); margin: 0 .5em; }

/* ---- 使い道の選択 ---- */
.usecase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .usecase-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .usecase-grid { grid-template-columns: 1fr; } }
.usecase {
  cursor: pointer; background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-m); padding: 16px 18px; transition: all var(--speed);
}
.usecase:hover { border-color: color-mix(in srgb, var(--c-primary) 55%, var(--c-border)); }
.usecase.on { border-color: var(--c-accent); background: color-mix(in srgb, var(--c-accent) 9%, var(--c-surface)); }
.usecase-label { font-weight: 700; font-size: .9rem; }
.usecase-range {
  font-family: var(--font-num); font-size: 1.35rem; color: var(--c-accent);
  margin-top: 6px; font-variant-numeric: tabular-nums;
}
.usecase-range small { font-size: .72rem; color: var(--c-muted); margin-left: .3em; font-family: var(--font-body); }
.usecase-detail { font-size: .78rem; color: var(--c-muted); margin-top: 8px; line-height: 1.75; }

/* ---- 制約カード ---- */
.constraint {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-m); padding: 18px 22px; margin-bottom: 12px;
}
.constraint h4 { font-size: .95rem; margin-bottom: 8px; display: flex; gap: .5em; align-items: center; flex-wrap: wrap; }
.constraint p { font-size: .85rem; color: var(--c-muted); line-height: 1.9; }

/* ---- ツールバー ---- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .btn { padding: 9px 20px; font-size: .85rem; letter-spacing: .08em; }
.seg { display: inline-flex; border: 1px solid var(--c-border); border-radius: var(--radius-s); overflow: hidden; }
.seg button {
  font: inherit; font-size: .85rem; color: var(--c-muted); background: var(--c-surface);
  border: none; padding: 9px 20px; cursor: pointer; transition: all var(--speed);
}
.seg button + button { border-left: 1px solid var(--c-border); }
.seg button.on { background: var(--c-primary); color: var(--c-primary-text); font-weight: 700; }

.saved-flash {
  font-size: .78rem; color: var(--c-ok); opacity: 0; transition: opacity .3s;
}
.saved-flash.show { opacity: 1; }

.empty {
  border: 1px dashed var(--c-border); border-radius: var(--radius-m);
  padding: 34px 24px; text-align: center; color: var(--c-muted); font-size: .88rem; line-height: 1.9;
}

.foot-note {
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--c-border);
  font-size: .78rem; color: var(--c-muted); line-height: 1.9;
}
