:root {
  color-scheme: light;
  font-family: system-ui, 'Yu Gothic UI', Meiryo, sans-serif;
  color: #232d42;
  background: #fcfcf9;
  line-height: 1.65;
  --ink: #232d42;
  --muted: #505a6d;
  --blue: #3b4675;
  --gold: #f3c85b;
  --line: #dce0e8;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p, figure, dl, dd { margin: 0; }
button, input { font: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid #566cb7; outline-offset: 3px; }

.shell { width: min(1100px, calc(100% - 48px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 65px; font-weight: 750; font-size: 1.12rem; text-decoration: none; }
.brand:hover { text-decoration: underline; }
.brand-mark { inline-size: 14px; block-size: 14px; border-radius: 4px; background: var(--gold); }
.intro { padding-block: 42px 30px; }
.category { color: var(--blue); font-size: .81rem; font-weight: 750; }
h1 { margin-block: 4px 6px; line-height: 1.24; font-size: clamp(1.8rem, 4.6vw, 3.2rem); letter-spacing: -.04em; }
.intro p:last-child, .hint, .assumptions p { color: var(--muted); }
h2 { font-size: 1.15rem; line-height: 1.4; }

.workspace { display: grid; grid-template-columns: minmax(235px, .85fr) minmax(0, 1.55fr); gap: 22px; align-items: start; }
.panel { padding: clamp(18px, 3vw, 30px); border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.hint { margin-block: 4px 0; font-size: .82rem; }
form { margin-top: 19px; }
label { display: block; margin-bottom: 5px; font-weight: 650; font-size: .91rem; }
.field { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.field input { width: 100%; min-width: 0; min-height: 44px; border: 1px solid #aab3c5; border-radius: 7px; padding: 7px 10px; color: var(--ink); background: #fff; font-variant-numeric: tabular-nums; }
.field span { flex: 0 0 3.15rem; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.field-hint { margin-block: -8px 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px 12px; margin-top: 21px; }
button { min-height: 44px; border: 0; border-radius: 8px; padding: 8px 14px; font-size: .9rem; font-weight: 700; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
.primary { flex: 1 0 auto; color: #fff; background: var(--blue); }
.primary:not(:disabled):hover { background: #30395f; }
.reset { color: var(--blue); background: #f0f2f8; }
.reset:hover { background: #e4e8f3; }
.privacy { margin-top: 15px; }

.summary { margin-top: 15px; border-radius: 11px; background: #f0f2fa; padding: 18px; }
.balance-group { color: var(--blue); font-size: .89rem; font-weight: 680; }
.balance { color: var(--ink); font-size: clamp(1.3rem, 4vw, 2.5rem); line-height: 1.25; margin-top: 4px; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; border-top: 1px solid #d5dbeb; margin-top: 12px; padding-top: 11px; }
.metrics dt { color: var(--muted); font-size: .79rem; }
.metrics dd { font-weight: 720; }
.balance, .metrics dd { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
figure { margin-top: 20px; }
figcaption { font-weight: 700; font-size: .95rem; }
.legend { display: flex; flex-wrap: wrap; gap: 5px 15px; margin-top: 5px; color: var(--muted); font-size: .77rem; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend span::before { content: ''; width: 19px; border-top: 2px solid var(--blue); }
.legend .legend-principal::before { border-top: 2px dashed #886319; }
canvas { display: block; width: 100%; height: 245px; }
details { margin-top: 5px; border-top: 1px solid var(--line); }
summary { min-height: 44px; padding: 10px 0 6px; color: var(--blue); cursor: pointer; font-size: .88rem; font-weight: 700; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 8px; border-top: 1px solid var(--line); text-align: right; }
thead th { background: #f0f2fa; }
tbody th, thead th:first-child { text-align: left; }

.assumptions { max-width: 760px; margin-block: 27px 48px; }
.assumptions p { margin-top: 8px; font-size: .9rem; }

.embedded .site-header, .embedded .intro { display: none; }
.embedded body { background: #fff; }
.embedded .shell { width: 100%; }
.embedded .panel { padding: clamp(14px, 2.4vw, 20px); }
.embedded .assumptions { margin-block: 16px 0; padding-bottom: 4px; }

@media (max-width: 710px) {
  .shell { width: calc(100% - 32px); }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .intro { padding-block: 29px 22px; }
  canvas { height: 208px; }
}

@media (min-width: 580px) and (max-width: 710px) {
  .embedded .workspace { grid-template-columns: minmax(205px, .85fr) minmax(0, 1.55fr); }
}
