/* キボキャンプ 繁栄値計算機（このツール専用。素の CSS、外部依存無し）
   型（A4）: STEP1 条件を入れる / STEP2 結果 / STEP3 内訳 の3段。
   色はサイト共通の CSS 変数だけを使う（static/style.css の :root）。 */

.tool-kicker {
  display: inline-block;
  margin: 0 0 0.4rem;
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 999px;
}

.tool-lead {
  max-width: 40rem;
  color: var(--muted);
}

.kibo-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "input result"
    "breakdown breakdown";
  gap: 1.25rem;
  margin: 1.5rem 0;
}

@media (max-width: 700px) {
  .kibo-tool {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "input"
      "result"
      "breakdown";
  }
}

.kibo-step {
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px var(--shadow);
  padding: 1rem 1.1rem 1.25rem;
}

.kibo-step-input { grid-area: input; }
.kibo-step-result { grid-area: result; }
.kibo-step-breakdown { grid-area: breakdown; }

.kibo-step-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 0.9rem;
}

.kibo-step-num {
  flex: 0 0 auto;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.kibo-step-title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 1rem;
}

.kibo-step-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 0.5rem;
}

.kibo-btn {
  flex: 0 0 auto;
  font-size: 0.82rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  cursor: pointer;
  touch-action: manipulation;
}

.kibo-btn:hover {
  background: var(--border);
}

.kibo-share-fallback {
  margin-top: 0.75rem;
}

.kibo-share-fallback label {
  display: block;
  margin: 0 0 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.kibo-share-fallback input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--bg-alt);
  color: var(--fg);
}

.kibo-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.kibo-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.kibo-form label {
  font-weight: 700;
  font-size: 0.92rem;
}

.stepper {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.stepper-btn {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.5rem;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--accent-soft);
  color: var(--fg);
  cursor: pointer;
  touch-action: manipulation;
}

.stepper-btn:active {
  background: var(--border);
}

.stepper-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 2.75rem;
  font-size: 1.25rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card-bg);
  color: var(--fg);
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
}

.kibo-result-main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.kibo-result-tile {
  min-width: 0;
  padding: 0.8rem 0.9rem;
  background: var(--accent-soft);
  border-radius: 0.75rem;
}

.kibo-result-label {
  margin: 0 0 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.kibo-result-num {
  margin: 0;
  font-size: clamp(1.2rem, 6vw, 1.6rem);
  font-weight: 700;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.kibo-goal {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.kibo-goal-line {
  margin: 0 0 0.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kibo-goal-bar {
  height: 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}

.kibo-goal-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.kibo-goal-pct {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.kibo-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.kibo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.kibo-table th,
.kibo-table td {
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.kibo-table th:first-child,
.kibo-table td:first-child {
  text-align: left;
  white-space: normal;
}

.kibo-table td {
  font-variant-numeric: tabular-nums;
}

.kibo-table tfoot th,
.kibo-table tfoot td {
  border-top: 2px solid var(--border);
  border-bottom: none;
  font-weight: 700;
}

.kibo-table-note {
  margin: 0.7rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.tool-scope {
  max-width: 42rem;
  margin: 2rem 0 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  font-size: 0.9rem;
}

.tool-scope h2 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.tool-scope-sub {
  margin: 0.9rem 0 0.3rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.tool-scope ul {
  margin: 0;
  padding-left: 1.1rem;
}

.tool-scope li {
  margin: 0.2rem 0;
}

.tool-error {
  max-width: 34rem;
  padding: 0.85rem 1rem;
  color: var(--fg);
  background: var(--yellow-soft);
  border: 1px solid var(--yellow);
  border-radius: var(--radius);
}

@media (max-width: 480px) {
  .stepper-btn,
  .stepper-input {
    height: 3rem;
  }
  .stepper-btn {
    width: 3rem;
    font-size: 1.75rem;
  }
  .kibo-step {
    padding: 0.9rem 0.85rem 1.1rem;
  }
  .kibo-table {
    font-size: 0.78rem;
  }
  .kibo-table th,
  .kibo-table td {
    padding: 0.4rem 0.32rem;
  }
}
