:root {
  --primary: #0F1419;
  --primary-soft: #1C2128;
  --accent: #FF6B35;
  --accent-dark: #D9501F;
  --accent-light: #FF9166;
  --navy: #3D5A80;
  --danger: #B91C1C;
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --text: #0F1419;
  --text-on-dark: #F5F5F5;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --tap: 52px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

/* ─────────── Loader ─────────── */
.loader {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--primary); color: var(--text-on-dark);
}
.loader-mark {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--accent); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  animation: pulse 1.4s ease-in-out infinite;
  margin-bottom: 16px;
}
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.loader p { color: var(--text-on-dark); font-size: 14px; opacity: 0.8; }

/* ─────────── Header ─────────── */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.header {
  background:
    radial-gradient(circle at 0% 0%, rgba(255,107,53,0.18) 0%, transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(61,90,128,0.28) 0%, transparent 50%),
    linear-gradient(135deg, #0F1419 0%, #1A2333 50%, #0B1118 100%);
  color: var(--text-on-dark);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
  overflow: hidden;
}
.header::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.04) 50%, transparent 100%);
  pointer-events: none;
}
.header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1.5px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,107,53,0.85) 30%,
    rgba(61,90,128,0.85) 70%,
    transparent 100%);
  filter: drop-shadow(0 0 4px rgba(255,107,53,0.5));
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  position: relative; z-index: 1;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #FF8B5C 0%, #FF6B35 45%, #D9501F 100%);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Noto Serif JP', 'Noto Sans JP', serif;
  font-weight: 900; font-size: 19px;
  letter-spacing: -0.05em;
  box-shadow:
    0 0 22px rgba(255,107,53,0.55),
    inset 0 1px 2px rgba(255,255,255,0.4),
    inset 0 -3px 6px rgba(0,0,0,0.18);
  flex-shrink: 0;
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(255,107,53,0.32);
  pointer-events: none;
}
.brand-name {
  display: flex; flex-direction: column;
  line-height: 1.15;
}
.brand-name strong {
  font-weight: 700; font-size: 14.5px;
  letter-spacing: 0.05em;
  color: var(--text-on-dark);
  font-family: 'Noto Sans JP', sans-serif;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.brand-name small {
  font-size: 9px; color: #FF9166;
  letter-spacing: 0.22em; font-weight: 700;
  margin-top: 4px;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
}

.close-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--text-on-dark);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 22px; line-height: 1; cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}
.close-btn:hover, .close-btn:active {
  background: rgba(255,107,53,0.22);
  border-color: rgba(255,107,53,0.5);
  color: #FF9166;
  transform: scale(0.96);
}

.progress {
  height: 3px; background: rgba(255,255,255,0.15);
  position: relative; overflow: hidden;
}
.progress-bar {
  height: 100%; background: var(--accent);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-label {
  display: flex; justify-content: space-between;
  padding: 8px 20px;
  font-size: 12px; opacity: 0.85;
}
.progress-label span:last-child { font-weight: 500; color: var(--accent-light); }

/* ─────────── Main / Steps ─────────── */
.main { flex: 1; padding: 24px 20px 100px; max-width: 600px; margin: 0 auto; width: 100%; }

.step { display: none; animation: fadeUp 0.35s ease; }
.step.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-h {
  font-size: 22px; font-weight: 700; margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.step-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

/* ─────────── Hero (Step 1) ─────────── */
.hero { margin-bottom: 28px; }
.hero-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 24px;
  background: var(--primary); border-radius: var(--radius);
  padding: 18px 12px;
  box-shadow: var(--shadow-md);
}
.stat { text-align: center; color: var(--text-on-dark); }
.stat-num {
  font-family: 'Inter', sans-serif;
  font-size: 22px; font-weight: 700;
  color: var(--accent); letter-spacing: -0.02em;
}
.stat-unit { font-size: 12px; opacity: 0.8; margin-left: 1px; }
.stat-label { font-size: 11px; opacity: 0.75; margin-top: 2px; }

.hero-title {
  font-size: 26px; font-weight: 700; line-height: 1.35;
  letter-spacing: -0.02em; margin-bottom: 10px;
}
.hero-sub { color: var(--text-muted); font-size: 14px; }

/* ─────────── Fields ─────────── */
.field { margin-bottom: 22px; }
.field label {
  display: block; font-size: 13px; font-weight: 500;
  margin-bottom: 8px; color: var(--text);
}
.req { background: var(--danger); color: white; font-size: 10px; padding: 2px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; }
.opt { background: var(--border); color: var(--text-muted); font-size: 10px; padding: 2px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; }

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: var(--tap);
  -webkit-appearance: none;
  appearance: none;
}
input[type="number"] {
  font-variant-numeric: tabular-nums;
}
input[type="datetime-local"], input[type="date"], input[type="time"] {
  font-family: inherit;
  letter-spacing: 0.02em;
}
input::placeholder, textarea::placeholder { color: #9CA3AF; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.18);
}
.hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ─────────── Chip selector ─────────── */
.chip-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.chip-grid input { display: none; }
.chip {
  display: flex; align-items: center; justify-content: center;
  padding: 12px 8px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  text-align: center; cursor: pointer;
  transition: all 0.18s ease;
  background: var(--surface);
  min-height: var(--tap);
}
.chip-grid input:checked + .chip {
  background: var(--primary); color: var(--accent);
  border-color: var(--primary);
  font-weight: 500;
}

/* ─────────── Upload ─────────── */
.upload-area {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 16px; border: 2px dashed var(--border);
  border-radius: var(--radius); background: #fff;
  cursor: pointer; transition: all 0.2s;
}
.upload-area:hover { border-color: var(--accent); background: #FFF7F2; }
.upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-text { font-weight: 500; color: var(--text); }
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.photo-preview {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 12px;
}
.photo-preview img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--radius-sm);
  position: relative;
  transition: opacity 0.3s;
}
.photo-preview img.uploaded {
  box-shadow: 0 0 0 2px #22C55E;
}
.photo-preview img.upload-failed {
  opacity: 0.5;
  box-shadow: 0 0 0 2px var(--danger);
}
.photo-status {
  font-size: 12px; color: var(--text-muted);
  margin-top: 8px; padding: 8px 12px;
  background: #FFF7F2; border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

/* ─────────── Plans ─────────── */
.plans { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.plan {
  border: 2px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 18px;
  cursor: pointer; transition: all 0.2s;
  position: relative;
}
.plan.selected {
  border-color: var(--accent); background: #FFF7F2;
  box-shadow: var(--shadow-md);
}
.plan.highlight::before {
  content: attr(data-badge);
  position: absolute; top: -10px; right: 16px;
  background: var(--accent); color: var(--primary);
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 999px; letter-spacing: 0.04em;
}
.plan-h {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
}
.plan-name { font-size: 16px; font-weight: 700; }
.plan-price {
  font-family: 'Inter', sans-serif; font-weight: 700;
  font-size: 20px; color: var(--primary);
}
.plan-price-unit { font-size: 13px; color: var(--text-muted); margin-left: 2px; font-weight: 500; }
.plan-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.plan-features { list-style: none; }
.plan-features li {
  font-size: 13px; padding: 4px 0;
  display: flex; gap: 8px;
}
.plan-features li::before { content: "✓"; color: var(--accent-dark); font-weight: 700; }

/* ─────────── Quote card ─────────── */
.quote-card {
  background: var(--primary); color: var(--text-on-dark);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 24px; box-shadow: var(--shadow-lg);
  border: 2px solid var(--accent);
}
.quote-label { font-size: 12px; opacity: 0.8; margin-bottom: 6px; letter-spacing: 0.06em; }
.quote-amount {
  font-family: 'Inter', sans-serif; font-size: 32px; font-weight: 700;
  color: var(--accent); letter-spacing: -0.02em;
}
.quote-detail { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.quote-roi { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.15); }
.roi-line { font-size: 13px; padding: 4px 0; opacity: 0.95; }
.roi-line strong { color: var(--accent-light); font-family: 'Inter', sans-serif; margin-left: 4px; }

/* ─────────── Buttons ─────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 16px 20px;
  border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
  min-height: 52px; text-decoration: none;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 14px rgba(255,107,53,0.35);
  letter-spacing: 0.02em;
}
.btn-primary:hover, .btn-primary:active {
  background: var(--accent-dark); transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255,107,53,0.45);
}
.btn-primary:disabled {
  background: #6B7280; box-shadow: none; cursor: not-allowed;
  color: #D1D5DB;
}
.btn-gold {
  background: var(--primary); color: var(--accent);
  box-shadow: var(--shadow-md);
}
.btn-gold:hover, .btn-gold:active {
  background: var(--primary-soft);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-row { display: flex; gap: 10px; margin-top: 24px; }
.btn-row .btn-ghost { flex: 0 0 35%; }
.btn-row .btn-primary { flex: 1; }
.arrow { font-size: 18px; }

/* ─────────── Trust signals ─────────── */
.trust {
  background: #FFF7F2; border-radius: var(--radius-sm); padding: 16px 18px;
  border-left: 3px solid var(--accent);
  margin: 24px 0;
}
.trust-item {
  font-size: 13px; padding: 4px 0; color: #6B3D1F;
  display: flex; align-items: baseline; gap: 8px;
}
.trust-item::before {
  content: ""; width: 6px; height: 6px;
  background: var(--accent); border-radius: 50%;
  display: inline-block; flex-shrink: 0;
  align-self: center;
}

/* ─────────── Consent ─────────── */
.consent {
  background: #F7F8FA;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 24px 0;
}
.consent-label {
  display: flex; gap: 10px; align-items: flex-start;
  cursor: pointer; font-size: 13px;
  line-height: 1.7;
}
.consent-label input[type="checkbox"] {
  width: 22px; height: 22px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.consent-text { color: var(--text); }
.consent-text a {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 600;
}
.consent-sub {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--text-muted);
}
.consent-sub a {
  color: var(--text-muted);
  text-decoration: underline;
}

/* ─────────── Done screen ─────────── */
.done { text-align: center; padding: 32px 0; }
.done-mark {
  width: 96px; height: 96px; margin: 0 auto 24px;
  border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: bold;
  animation: bounce 0.8s ease;
  box-shadow: 0 12px 32px rgba(255,107,53,0.35);
}
@keyframes bounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.done-h { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.done-sub { color: var(--text-muted); margin-bottom: 24px; }
.done-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 18px; text-align: left;
  margin-bottom: 24px;
}
.done-card-h {
  font-size: 12px; color: var(--text-muted);
  letter-spacing: 0.06em; margin-bottom: 8px;
}
.done-card div { font-size: 14px; padding: 4px 0; }
.done-cta-label { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.done .btn { margin-bottom: 10px; }

/* ─────────── Footer ─────────── */
.footer {
  background: var(--primary); color: rgba(255,255,255,0.7);
  text-align: center; padding: 20px;
  font-size: 11px;
}
.footer-link {
  display: inline-block; margin-top: 8px;
  color: var(--accent); text-decoration: none; font-weight: 500;
}
.footer-link:hover { text-decoration: underline; }

/* ─────────── Responsive ─────────── */
@media (max-width: 360px) {
  .chip-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-title { font-size: 22px; }
  .stat-num { font-size: 18px; }
}

/* エラー表示（diagnosis / consult） */
.error-box {
  margin-top: 18px;
  padding: 14px 18px;
  background: #FEE2E2;
  color: #B91C1C;
  border-left: 4px solid #B91C1C;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
}
.hero-title {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.3;
  margin-bottom: 12px;
  color: var(--text);
}
.hero-sub {
  color: var(--text-muted);
  font-size: 14px; line-height: 1.7;
}
.field label { font-weight: 600; }
.req { background: var(--accent); color: white; }
