:root {
  --bg: #f4efe4;
  --paper: rgba(255, 251, 243, 0.8);
  --paper-strong: #fff9ef;
  --ink: #1c1d1f;
  --muted: #5f625f;
  --line: rgba(28, 29, 31, 0.12);
  --accent: #1e7b5b;
  --accent-soft: rgba(30, 123, 91, 0.12);
  --accent-strong: #13513b;
  --warning: #9d4d22;
  --income: #cde7da;
  --tax-national: #ffd8b5;
  --tax-local: #f1b9b0;
  --shadow: 0 22px 60px rgba(47, 42, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "BIZ UDPGothic", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(30, 123, 91, 0.16), transparent 35%),
    radial-gradient(circle at top right, rgba(157, 77, 34, 0.16), transparent 28%),
    linear-gradient(180deg, #f6f2e8 0%, #efe8db 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.25) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.3), transparent 70%);
  pointer-events: none;
}

.page-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
  position: relative;
}

.hero,
.panel,
.footer {
  border: 1px solid var(--line);
  background: var(--paper);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
  border-radius: 32px;
}

.top-links {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-bottom: 18px;
}

.top-links a,
.back-link {
  color: var(--muted);
  text-decoration-color: rgba(30, 123, 91, 0.35);
  text-underline-offset: 0.2em;
}

.eyebrow,
.panel-kicker,
.note-label,
.callout-label,
.footer-title {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.95fr);
  align-items: start;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.4rem, 7vw, 5.1rem);
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.3rem);
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.hero-copy,
.hero-note li,
.field small,
.result-summary,
.callout-sub,
.guide-grid p,
.footer p,
.footer a {
  line-height: 1.75;
}

.hero-copy {
  max-width: 32rem;
  margin: 18px 0 22px;
  font-size: 1.02rem;
  color: var(--muted);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-tags span {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  padding: 10px 14px;
  font-size: 0.92rem;
}

.hero-note {
  padding: 18px 18px 18px 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(17, 51, 39, 0.96), rgba(20, 42, 35, 0.94));
  color: #f7f1e5;
}

.hero-note .note-label {
  color: #fff4cf;
}

.hero-note ul {
  margin: 0;
  padding-left: 18px;
}

.layout {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  margin-top: 22px;
}

.panel {
  border-radius: 28px;
  padding: 24px;
}

.panel-head {
  margin-bottom: 20px;
}

.calculator-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(28, 29, 31, 0.16);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(30, 123, 91, 0.65);
  box-shadow: 0 0 0 5px rgba(30, 123, 91, 0.12);
  transform: translateY(-1px);
}

.field small {
  color: var(--muted);
}

.primary-button {
  margin-top: 4px;
  border: 0;
  border-radius: 18px;
  padding: 15px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fffdf6;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
  box-shadow: 0 18px 30px rgba(30, 123, 91, 0.22);
}

.primary-button:hover {
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(1px);
  opacity: 0.96;
}

.result-hero {
  display: grid;
  gap: 10px;
  padding: 18px 18px 16px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(246, 242, 232, 0.86));
  border: 1px solid rgba(28, 29, 31, 0.08);
}

.metric-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-value {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1;
}

.money-rail {
  display: flex;
  gap: 8px;
  margin: 18px 0 16px;
  height: 16px;
}

.rail-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 18px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.rail-segment {
  border-radius: 999px;
  transition: width 220ms ease;
}

.rail-profit {
  background: var(--income);
}

.rail-income-tax {
  background: var(--tax-national);
}

.rail-resident-tax {
  background: var(--tax-local);
}

.result-grid,
.callout-grid,
.guide-grid,
.footer {
  display: grid;
  gap: 16px;
}

.result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.callout-grid {
  margin-top: 16px;
}

.metric-card,
.callout,
.guide-grid article {
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(28, 29, 31, 0.08);
}

.card-value,
.callout-main {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.4;
}

.callout-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.guide-panel {
  margin-top: 22px;
}

.guide-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.guide-grid p,
.footer p,
.footer a,
.result-summary {
  margin: 0;
  color: var(--muted);
}

.footer {
  margin-top: 22px;
  grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.9fr);
  align-items: start;
  padding: 22px;
  border-radius: 28px;
}

.footer-links {
  display: grid;
  gap: 10px;
}

.footer a {
  text-decoration-color: rgba(30, 123, 91, 0.35);
  text-underline-offset: 0.2em;
}

.document-shell {
  max-width: 860px;
  padding-top: 28px;
}

.document-panel {
  padding: 28px;
}

.document-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.document-lead {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.document-section {
  margin-top: 28px;
}

.document-section h2 {
  margin-bottom: 12px;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
}

.document-section p,
.document-list {
  margin: 0;
  color: var(--muted);
  line-height: 1.9;
}

.document-list {
  padding-left: 20px;
}

.inline-button {
  display: inline-block;
  margin-top: 24px;
  text-decoration: none;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .hero-grid,
  .layout,
  .guide-grid,
  .footer {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1160px);
    padding-top: 20px;
    padding-bottom: 32px;
  }

  .hero,
  .panel,
  .footer {
    border-radius: 24px;
    padding: 18px;
  }

  .result-grid,
  .callout-grid {
    grid-template-columns: 1fr;
  }

  .hero-note {
    padding: 16px;
  }

  .money-rail {
    margin-top: 14px;
  }

  .top-links {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-bottom: 14px;
  }
}
