/* ── リセット・変数 ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #f5f5f3;
  --surface:    #ffffff;
  --surface2:   #f9f9f8;
  --border:     #e8e8e5;
  --border2:    #d4d4ce;
  --accent:     #1a6b3c;
  --accent-lt:  #e8f5ee;
  --accent2:    #c84b2f;
  --text:       #1a1a18;
  --text-sub:   #5a5a55;
  --text-muted: #9a9a94;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --radius:     14px;
  --radius-sm:  8px;
  --mono:       'DM Mono', 'Courier New', monospace;
  --sans:       'Noto Sans JP', 'Hiragino Sans', sans-serif;
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── ベース ──────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  padding: 32px 16px 80px;
}

/* ── レイアウト ───────────────────────────────── */
.container {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

/* PCで横幅を活かす */
@media (min-width: 720px) {
  body { padding: 48px 32px 80px; }
  .container { max-width: 580px; }
}

/* ── ヘッダー ─────────────────────────────────── */
.header {
  margin-bottom: 28px;
  animation: fadeDown 0.45s ease both;
}

.header-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-lt);
  border-radius: 20px;
  padding: 4px 10px;
  margin-bottom: 12px;
  font-family: var(--mono);
}

h1 {
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text);
}

.header-desc {
  font-size: 14px;
  color: var(--text-sub);
  margin-top: 8px;
  line-height: 1.7;
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  font-family: var(--mono);
}

/* ── カード ───────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.45s ease both;
}

.card + .card { animation-delay: 0.06s; }

.card-heading {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ── 入力フィールド ────────────────────────────── */
.field { margin-bottom: 18px; }
.field:last-of-type { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  margin-bottom: 7px;
}

.input-wrap { position: relative; }

.input-wrap input,
.select-wrap select {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 52px 13px 14px;
  font-size: 17px;
  font-family: var(--mono);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.input-wrap input:focus,
.select-wrap select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(26,107,60,0.1);
}

.input-unit, .select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
  font-family: var(--mono);
}

.select-wrap { position: relative; }
.select-wrap select { cursor: pointer; }

/* ── 任意セクション ────────────────────────────── */
.optional-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 0;
  border: none;
  background: none;
  width: 100%;
  font-family: var(--sans);
  margin-top: 8px;
}

.optional-label {
  font-size: 13px;
  color: var(--text-muted);
}

.optional-chevron {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-sub);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.optional-chevron.open { transform: rotate(180deg); }

.optional-body {
  display: none;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}

.optional-body.open { display: block; }

/* ── 計算ボタン ────────────────────────────────── */
.calc-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--sans);
  cursor: pointer;
  letter-spacing: 0.03em;
  margin-top: 20px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(26,107,60,0.25);
}

.calc-btn:hover {
  background: #155a32;
  box-shadow: 0 4px 14px rgba(26,107,60,0.3);
}

.calc-btn:active {
  transform: scale(0.985);
  box-shadow: none;
}

/* ── 結果カード ────────────────────────────────── */
.result-card {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 12px;
  animation: fadeUp 0.4s ease both;
}

.result-card.show { display: block; }

/* メイン結果エリア */
.result-hero {
  background: linear-gradient(135deg, #1a6b3c 0%, #0f4a27 100%);
  padding: 28px 24px 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.result-hero::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  pointer-events: none;
}

.result-hero-label {
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 10px;
}

.result-amount-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 6px;
}

.result-amount {
  font-family: var(--mono);
  font-size: clamp(36px, 10vw, 52px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
}

.result-amount-unit {
  font-size: 18px;
  opacity: 0.8;
  font-family: var(--mono);
}

.result-desc {
  font-size: 12px;
  opacity: 0.75;
  line-height: 1.6;
  margin-top: 6px;
}

.result-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-family: var(--mono);
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,0.2);
}

/* 内訳 */
.result-breakdown {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.breakdown-title {
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.breakdown-row:last-child { border-bottom: none; }

.breakdown-label { color: var(--text-sub); }

.breakdown-value {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.breakdown-value.accent2 { color: var(--accent2); font-size: 16px; }
.breakdown-value.positive { color: var(--accent); }

/* プログレス */
.result-progress {
  padding: 20px 24px;
}

.progress-title {
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.progress-track {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #2d9c60);
  border-radius: 99px;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 3px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* ── 免責 ─────────────────────────────────────── */
.disclaimer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 8px;
  animation: fadeUp 0.45s 0.2s ease both;
}

.disclaimer-title {
  font-weight: 600;
  color: var(--text-sub);
  font-size: 11.5px;
  margin-bottom: 4px;
  display: block;
}

.storage-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  padding: 6px 0 0;
  animation: fadeUp 0.45s 0.25s ease both;
}

/* ── アニメーション ────────────────────────────── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ── 桁数上限注記 ─────────────────────────────── */
.field-limit {
  float: right;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-top: 1px;
}
/* ── 税率テーブル ─────────────────────────────── */
.tax-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 4px;
}

.tax-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.tax-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-sub);
  vertical-align: middle;
}

.tax-table tbody tr:last-child td { border-bottom: none; }

.tax-table tbody tr:nth-child(odd) td {
  background: var(--surface2);
}

.tax-ref-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  font-family: var(--mono);
}

/* number input スピナー非表示 */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type=number] { -moz-appearance: textfield; }
