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

:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --primary-light: #e8f0fe;
  --accent: #0e9f6e;
  --accent-light: #def7ec;
  --warn: #e3a008;
  --warn-light: #fdf6b2;
  --danger: #e02424;
  --danger-light: #fde8e8;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  padding: 28px 24px 24px;
  text-align: center;
}
header h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: .03em;
}
header p {
  margin-top: 6px;
  font-size: .9rem;
  opacity: .85;
}

/* ── Step indicator ── */
.steps {
  display: flex;
  justify-content: center;
  gap: 0;
  background: var(--primary-dark);
  padding-bottom: 20px;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: rgba(255,255,255,.55);
  padding: 6px 20px;
}
.step.active { color: #fff; }
.step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem;
}
.step.active .step-num { background: #fff; color: var(--primary); }
.step-arrow { color: rgba(255,255,255,.3); font-size: .75rem; }

/* ── Main layout ── */
main { max-width: 760px; margin: 0 auto; padding: 28px 16px 60px; }

/* ── Section card ── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  border-left: 4px solid var(--primary);
  padding-left: 10px;
  margin-bottom: 20px;
}

/* ── Form elements ── */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
label.field-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
}
select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .95rem;
  background: #fff;
  color: var(--gray-800);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color .2s;
}
select:focus { outline: none; border-color: var(--primary); }

/* ── Radio group ── */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.radio-group input[type="radio"] { display: none; }
.radio-group label {
  padding: 8px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  font-size: .875rem;
  cursor: pointer;
  transition: all .2s;
  user-select: none;
}
.radio-group input[type="radio"]:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ── Checkbox grid ── */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
  user-select: none;
}
.checkbox-item:hover { border-color: var(--primary); background: var(--primary-light); }
.checkbox-item input[type="checkbox"] { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; }
.checkbox-item span { font-size: .9rem; line-height: 1.4; }
.checkbox-item.checked { border-color: var(--primary); background: var(--primary-light); }

/* ── Submit button ── */
.btn-submit {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  letter-spacing: .05em;
}
.btn-submit:hover { opacity: .9; }
.btn-submit:active { transform: scale(.99); }

/* ── Results ── */
#results { display: none; }
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.result-header h2 { font-size: 1.1rem; font-weight: 700; }
.result-count {
  font-size: .85rem;
  color: var(--gray-600);
  background: var(--gray-100);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ── Result card ── */
.result-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1.5px solid var(--gray-200);
  padding: 20px;
  margin-bottom: 16px;
  transition: transform .15s, box-shadow .15s;
}
.result-card:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(0,0,0,.1); }

.result-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.result-name {
  font-size: 1rem;
  font-weight: 700;
  flex: 1;
  min-width: 200px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-national { background: var(--primary-light); color: var(--primary); }
.badge-prefecture { background: var(--accent-light); color: var(--accent); }
.badge-municipal { background: var(--warn-light); color: var(--warn); }
.badge-urgent { background: var(--danger-light); color: var(--danger); }

.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat-box {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 10px 12px;
}
.stat-label { font-size: .72rem; color: var(--gray-400); font-weight: 600; letter-spacing: .05em; margin-bottom: 2px; }
.stat-value { font-size: 1rem; font-weight: 700; color: var(--gray-800); }

.result-notes {
  font-size: .82rem;
  color: var(--gray-600);
  background: var(--gray-50);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.matched-conditions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.cond-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 600;
}
.cond-tag-need { background: #ede9fe; color: #5b21b6; }
.cond-tag-bonus { background: var(--accent-light); color: #065f46; }

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .2s;
}
.btn-link:hover { opacity: .85; }

.no-match {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-600);
}
.no-match .icon { font-size: 2.5rem; margin-bottom: 12px; }
.no-match p { font-size: .95rem; }

.btn-reset {
  display: block;
  margin: 24px auto 0;
  padding: 10px 28px;
  background: transparent;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: all .2s;
}
.btn-reset:hover { border-color: var(--primary); color: var(--primary); }

.notice {
  font-size: .78rem;
  color: var(--gray-400);
  text-align: center;
  margin-top: 28px;
  line-height: 1.7;
}

@media (max-width: 480px) {
  header { padding: 20px 16px 16px; }
  .card { padding: 18px 16px; }
  .result-stats { grid-template-columns: 1fr 1fr; }
}
