:root {
  --bg: #fbfaf8;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e8e6e1;
  --accent: #f97316;
  --accent-soft: #fff1e6;
  --red: #e5484d;
  --green: #30a46c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 36, 48, 0.05), 0 8px 24px rgba(31, 36, 48, 0.06);
  --font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.65;
}

.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.85); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: baseline; gap: 12px; padding: 12px 16px; }
.logo { font-size: 1.25rem; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: 0.02em; }
.logo span { color: var(--accent); }
.tagline { color: var(--muted); font-size: 0.8rem; }

/* hero */
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: clamp(1.5rem, 5vw, 2.1rem); line-height: 1.35; margin: 0 0 12px; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { color: var(--muted); margin: 0; font-size: 0.95rem; }

/* form */
.sim-form { margin: 24px 0 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.modes { border: 0; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.modes legend { font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; padding: 0; }
.mode { position: relative; }
.mode input { position: absolute; opacity: 0; inset: 0; }
.mode { border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 0.9rem; cursor: pointer; background: #fff; transition: all .15s ease; }
.mode:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: #b4520c; font-weight: 700; }
.mode:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.fields { display: grid; gap: 16px; }
.field label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 6px; }
.range-row { display: flex; align-items: center; gap: 14px; }
input[type="range"] { flex: 1; accent-color: var(--accent); height: 28px; }
#inc-out { font-weight: 800; font-size: 1.1rem; min-width: 90px; text-align: right; color: var(--accent); }
select { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 1rem; background: #fff; color: var(--ink); font-family: inherit; }
.check-label { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; cursor: pointer; }
.check-label input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); }
.hint { font-size: 0.78rem; color: var(--muted); margin: 6px 0 0 28px; }
.btn-submit { margin-top: 12px; padding: 10px 20px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer; }

/* result */
.result { margin: 20px 0 40px; }

/* verdict */
.verdict { margin: 0 0 16px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); display: flex; gap: 10px; align-items: flex-start; }
.verdict-ok { background: #f0faf4; border-color: #c8ead6; }
.verdict-warn { background: var(--accent-soft); border-color: #f7d9bf; }
.verdict-badge { flex: none; background: var(--green); color: #fff; font-size: 0.72rem; font-weight: 800; border-radius: 999px; padding: 2px 10px; margin-top: 3px; }
.verdict-warn .verdict-badge { background: var(--red); }
.verdict p { margin: 0; font-weight: 700; }

.cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .cards { grid-template-columns: 1.2fr 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.card-primary { background: linear-gradient(135deg, #fff7f0, #ffffff 60%); border-color: #f7d9bf; }
.card-label { font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.card-label small { font-weight: 500; }
.card-value { font-size: 2rem; font-weight: 800; letter-spacing: 0.01em; }
.card-value.small { font-size: 1.05rem; }
.card-sub { font-size: 0.78rem; color: var(--muted); }
.card-hint { font-size: 0.72rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 4px; }

.advice-box { margin-top: 12px; padding: 16px 18px; background: var(--accent-soft); border: 1px solid #f7d9bf; border-radius: var(--radius); }
.advice-box h2 { margin: 0 0 6px; font-size: 0.95rem; color: #b4520c; }
.advice-box p { margin: 0; font-size: 0.92rem; }

.breakeven-box { margin-top: 12px; padding: 16px 18px; background: #f0faf4; border: 1px solid #c8ead6; border-radius: var(--radius); }
.breakeven-badge { display: inline-block; background: var(--green); color: #fff; font-size: 0.72rem; font-weight: 800; border-radius: 999px; padding: 2px 10px; margin-bottom: 6px; }
.breakeven-line { margin: 0; font-weight: 800; }
.breakeven-note { margin: 4px 0 0; font-size: 0.82rem; color: var(--muted); }

/* chart */
.chart-card { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.chart-card h2 { margin: 0 0 10px; font-size: 0.95rem; }
.chart { width: 100%; height: auto; display: block; }
.chart-label { font-size: 10px; fill: var(--muted); }
.chart-xlabel { font-size: 10px; fill: var(--muted); }
.chart-wall { font-size: 10px; fill: #9aa1ab; }
.chart-wall-over { fill: #e08d88; }
.chart-current { font-size: 11px; font-weight: 700; fill: var(--red); }
.chart-recover { font-size: 11px; font-weight: 700; fill: var(--green); }
.chart-note { font-size: 0.75rem; color: var(--muted); margin: 8px 0 0; }

/* walls */
.section-title { font-size: 1rem; margin: 20px 0 8px; }
.walls { margin-top: 4px; display: grid; gap: 10px; }
@media (min-width: 640px) { .walls { grid-template-columns: 1fr 1fr; } }
.wall { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.wall-under { border-left-color: var(--green); }
.wall-over { border-left-color: var(--red); }
.wall-off { border-left-color: #cbd2d9; opacity: 0.75; }
.wall-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wall-label { font-weight: 800; font-size: 1rem; }
.wall-status { font-size: 0.72rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: #eef1f4; color: var(--muted); white-space: nowrap; }
.wall-under .wall-status { background: #e7f7ee; color: var(--green); }
.wall-over .wall-status { background: #fdecec; color: var(--red); }
.wall-what { font-size: 0.85rem; font-weight: 600; margin-top: 2px; }
.wall-note { font-size: 0.78rem; color: var(--muted); margin: 6px 0 0; }

/* share */
.share-row { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-block; padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 0.88rem; text-decoration: none; border: 1.5px solid var(--line); color: var(--ink); cursor: pointer; background: #fff; font-family: inherit; }
.btn-x { background: #111; border-color: #111; color: #fff; }
.btn-line { background: #06c755; border-color: #06c755; color: #fff; }
.btn-copy { background: #fff; }

/* affiliate */
.affiliate-box { margin-top: 20px; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.affiliate-box h2 { margin: 0 0 8px; font-size: 0.95rem; }
.affiliate-box ul { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 8px; }
.affiliate-box li a { font-weight: 700; color: #1d4ed8; }
.affiliate-note-text { display: block; font-size: 0.8rem; color: var(--muted); }
.affiliate-note { font-size: 0.72rem; color: var(--muted); margin: 10px 0 0; }

/* share page */
.share-page .share-kicker { font-size: 1rem; font-weight: 800; margin: 24px 0 12px; color: var(--ink); }
.back-link { margin: 20px 0 40px; }
.back-link a { color: var(--accent); font-weight: 700; text-decoration: none; }

/* explainer */
.explainer { margin: 28px 0 0; padding: 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.explainer h2 { font-size: 1.05rem; margin: 0 0 10px; }
.explainer h2:not(:first-child) { margin-top: 22px; }
.explainer p { font-size: 0.9rem; margin: 0 0 10px; }
.explainer details { border-top: 1px solid var(--line); }
.explainer details:last-child { border-bottom: 1px solid var(--line); }
.explainer summary { cursor: pointer; font-weight: 700; font-size: 0.9rem; padding: 12px 0; list-style: none; }
.explainer summary::-webkit-details-marker { display: none; }
.explainer summary::before { content: "＋ "; color: var(--accent); font-weight: 800; }
.explainer details[open] summary::before { content: "− "; }
.explainer details p { color: var(--muted); margin: 0 0 12px; }

/* how-to */
.howto { font-size: 0.85rem; background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; margin: 14px 0 0; display: inline-block; }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 24px; padding: 28px 0 40px; background: #fff; }
.sources { font-size: 0.78rem; }
.sources ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); display: grid; gap: 4px; }
.sources a { color: #1d4ed8; }
.disclaimer { font-size: 0.72rem; color: var(--muted); margin-top: 16px; }
.footer-nav { font-size: 0.8rem; margin-top: 14px; }
.footer-nav a { color: var(--accent); font-weight: 700; text-decoration: none; }
.meta { font-size: 0.72rem; color: #9aa1ab; margin-top: 12px; }

/* no-js fallback: show all mode fields */
html.no-js [data-mode] { display: block !important; }
