:root {
  --bg: #fff8f0;
  --bg-glow: radial-gradient(1200px 600px at 10% -10%, #ffedd5 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #fed7aa 0%, transparent 50%),
    #fff8f0;
  --ink: #1c1917;
  --muted: #57534e;
  --accent: #ea580c;
  --accent2: #fb923c;
  --card: #fff;
  --line: #fed7aa;
  --radius: 16px;
  --focus: #c2410c;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Yu Gothic UI", sans-serif;
  background: var(--bg-glow);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #fff;
  padding: 8px 12px;
  z-index: 100;
}
.skip:focus {
  left: 8px;
  top: 8px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.page-shell {
  width: 100%;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* Secondary monetization — Desktop L/R rails; Mobile slim only */
.monetization {
  max-width: 100%;
  min-width: 0;
}
.ad-slot {
  max-width: 100%;
}
.ad-slot--lead {
  margin-bottom: 28px;
}
.ad-slot--follow {
  margin-top: 8px;
}
.ad-slot--book + .ad-slot--book {
  margin-top: 28px;
}
.ad-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #78716c;
  background: #fafaf9;
  border: 1px solid #e7e5e4;
  border-radius: 4px;
  padding: 2px 6px;
  margin-bottom: 8px;
}
.ad-frame {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  max-width: 100%;
  overflow: hidden;
  position: relative;
  line-height: 0;
}
/*
 * Image-banner link reset (A8). Must NOT apply to Rakuten pict+text titles —
 * line-height:0 + inline-block collapsed multi-line product names.
 */
.ad-frame--rect a,
.ad-frame--sky a,
.monetization-mobile .ad-frame a,
.monetization-inline .ad-frame a {
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}
.ad-frame img[width="160"],
.ad-frame img[width="300"],
.ad-frame img[width="320"] {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
}
.ad-frame img[width="1"] {
  position: absolute;
  width: 1px;
  height: 1px;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.ad-frame--rect,
.ad-frame--sky {
  justify-content: center;
}

/*
 * Issued Rakuten markup kept intact — native ~504px, no transform:scale.
 * Isolate from site banner styles so title links wrap naturally (word-wrap in HTML).
 */
.ad-slot--book .ad-frame {
  display: block;
  overflow: visible;
  width: 504px;
  max-width: 100%;
  line-height: normal;
}
.ad-slot--book .ad-frame a {
  display: inline;
  max-width: none;
  line-height: inherit;
  white-space: normal;
  word-wrap: break-word;
}
.ad-slot--book .ad-frame p {
  line-height: 1.4em;
  white-space: normal;
  overflow: visible;
  height: auto;
  max-height: none;
}
.ad-slot--book .ad-frame table {
  border-collapse: separate;
  max-width: 100%;
}
.ad-slot--book .ad-frame td {
  white-space: normal;
  vertical-align: top;
}

.monetization-left,
.monetization-right,
.monetization-inline {
  display: none;
}
/* Empty-asset safety: never paint a placement that mounted zero creatives */
.monetization[hidden] {
  display: none !important;
}
.monetization-mobile {
  display: none;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px 8px;
}
.monetization-inline {
  margin: 28px auto 8px;
  max-width: 300px;
  text-align: center;
}
.monetization-inline .ad-frame {
  justify-content: center;
}

.site-footer {
  padding: 24px 16px 40px;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.site-footer-inner {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.site-footer a {
  color: #9a3412;
}

/*
 * Responsive Monetization
 * Full Side Rails when 300+48+680+48+504 (=1580) fits without horizontal overflow → ≥1600.
 * Below that (and above mobile): hide rails, show Inline Onsuku 300×250 after diagnosis.
 * Mobile (<768): 320×50 only.
 */
@media (min-width: 1600px) {
  .page-shell {
    display: grid;
    grid-template-columns: 300px 680px 504px;
    column-gap: 48px;
    align-items: start;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 12px 10px 0;
    box-sizing: border-box;
  }
  .page-shell > .monetization-left {
    grid-column: 1;
    display: block;
    position: sticky;
    top: 12px;
    padding-top: 72px;
    justify-self: stretch;
  }
  .page-shell > .wrap {
    grid-column: 2;
    margin: 0;
    max-width: 680px;
    width: 680px;
    padding-left: 0;
    padding-right: 0;
  }
  .page-shell > .monetization-right {
    grid-column: 3;
    display: block;
    position: sticky;
    top: 12px;
    padding-top: 72px;
    justify-self: stretch;
  }
  .monetization-inline,
  .monetization-mobile {
    display: none !important;
  }
  .ad-frame--sky {
    justify-content: center;
  }

  .site-footer {
    display: grid;
    grid-template-columns: 300px 680px 504px;
    column-gap: 48px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 10px 40px;
    box-sizing: border-box;
  }
  .site-footer-inner {
    grid-column: 2;
    max-width: 680px;
    width: 680px;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }
}

/* Side rails do not fit: diagnosis-centered + Inline Onsuku after content */
@media (min-width: 768px) and (max-width: 1599px) {
  .monetization-left,
  .monetization-right {
    display: none !important;
  }
  .monetization-inline {
    display: block;
  }
  .monetization-mobile {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .monetization-left,
  .monetization-right,
  .monetization-inline {
    display: none !important;
  }
  .monetization-mobile {
    display: block;
  }
  .monetization-mobile .ad-frame {
    min-height: 50px;
    align-items: center;
  }
}

.hero {
  text-align: center;
  padding: 28px 12px 8px;
}
.hero svg {
  width: 120px;
  height: 80px;
  margin-bottom: 12px;
}
.hero h1 {
  font-size: clamp(1.35rem, 4vw, 1.7rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #9a3412;
}
.hero p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 480px;
  margin-inline: auto;
}
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}
.trust-row span {
  font-size: 0.75rem;
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
}

.progress {
  display: flex;
  gap: 6px;
  margin: 20px 0 8px;
  padding: 0 4px;
}
.progress span {
  flex: 1;
  height: 6px;
  min-height: 6px;
  border-radius: 99px;
  background: #fde68a;
  transition: 0.3s background;
}
.progress span.on {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.progress span.current {
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.25);
}

.view[hidden] {
  display: none !important;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 4px 20px rgba(234, 88, 12, 0.08);
}
.panel h2 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}
.panel .hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

.card-opt {
  border: 2px solid #fde68a;
  border-radius: 12px;
  padding: 14px 12px;
  min-height: 64px;
  cursor: pointer;
  background: #fffbeb;
  transition: 0.15s border-color, 0.15s background, 0.15s box-shadow,
    0.15s transform;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}
.card-opt:hover {
  border-color: var(--accent2);
  transform: translateY(-1px);
}
.card-opt.selected {
  border-color: var(--accent);
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
  position: relative;
}
.card-opt.selected::after {
  content: "選択中";
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.68rem;
  font-weight: 800;
  color: #9a3412;
  background: #ffedd5;
  padding: 2px 6px;
  border-radius: 6px;
}
.card-opt .ico {
  font-size: 1.4rem;
  margin-bottom: 4px;
  display: block;
}
.card-opt .lbl {
  font-weight: 800;
  font-size: 0.9rem;
}
.card-opt .sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

select {
  width: 100%;
  padding: 11px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  margin-top: 6px;
  background: #fff;
  min-height: 44px;
}
.field {
  margin-bottom: 14px;
}
.field label,
.field .field-label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.nav {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.btn {
  flex: 1;
  padding: 12px;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
}
.btn-ghost {
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--muted);
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #c2410c);
  color: #fff;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.3);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.err {
  color: #b91c1c;
  font-size: 0.85rem;
  margin-top: 8px;
  font-weight: 600;
  min-height: 1.2em;
}

#factsBanner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}
#factsBanner[hidden] {
  display: none !important;
}

.result-hero {
  background: linear-gradient(135deg, #ea580c, #9a3412);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
  padding-top: 52px;
  margin-bottom: 14px;
  position: relative;
}
.result-hero h2 {
  font-size: 1.2rem;
  font-weight: 900;
}
.result-hero p {
  margin-top: 8px;
  opacity: 0.92;
  font-size: 0.92rem;
}
.result-hero .budget-note {
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.15);
  padding: 8px;
  border-radius: 8px;
}
.result-hero .input-summary {
  margin-top: 10px;
  font-size: 0.78rem;
  opacity: 0.85;
}
.back-link {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  padding: 8px 12px;
  min-height: 40px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.back-link:hover {
  background: rgba(255, 255, 255, 0.3);
}

.sec {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.sec h3 {
  font-size: 0.92rem;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 8px;
}
.sec ol,
.sec ul {
  margin-left: 1.2rem;
}
.sec li {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 4px 0;
}

.svc {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-top: 10px;
}
.svc.pick {
  border-color: var(--accent);
  background: #fffbf5;
}
.svc h4 {
  font-weight: 900;
  font-size: 1rem;
}
.svc .tag {
  display: inline-block;
  background: #ffedd5;
  color: #9a3412;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 99px;
  margin-bottom: 6px;
}
.svc-meta {
  font-size: 0.85rem;
  color: var(--muted);
}
.candidate-reason {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #7c2d12;
  background: #fff7ed;
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.85rem;
}
@media (max-width: 480px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}
.grid2 div {
  background: #fafaf9;
  border-radius: 8px;
  padding: 8px;
  word-break: break-word;
}
.grid2 strong {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.price {
  font-size: 0.88rem;
  font-weight: 700;
  color: #9a3412;
  margin-top: 8px;
}
.svc-note {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #78716c;
  background: #fafaf9;
  padding: 8px;
  border-radius: 8px;
}
.ext-cta,
.svc a.ext-cta {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  min-height: 44px;
  padding: 8px 0;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.compare-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 8px;
}
.compare-table th,
.compare-table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}
.compare-table th {
  background: #fff7ed;
  font-weight: 800;
}
.pick-note {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
  font-size: 0.88rem;
  color: #166534;
}
.disclaimer {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 14px;
}

.fallback {
  text-align: left;
}
.fallback h2 {
  margin-bottom: 8px;
}

.legal-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 16px 48px;
}
.legal-page h1 {
  font-size: 1.4rem;
  margin: 12px 0;
  color: #9a3412;
}
.legal-page h2 {
  font-size: 1.05rem;
  margin: 20px 0 8px;
}
.legal-page ul {
  margin-left: 1.2rem;
}
.legal-page li {
  margin: 4px 0;
}
