:root {
      font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color-scheme: light;
      color: var(--ink);
      background: var(--page);
      font-synthesis: none;
      --ink: #281b1e;
      --muted: #655457;
      --border: #e6d9da;
      --field-border: #927b80;
      --crimson: #a71936;
      --deep-crimson: #87152c;
      --page: #fcf8f6;
      --paper: #fff;
      --field: var(--paper);
      --accent-ink: var(--deep-crimson);
      --result-surface: var(--deep-crimson);
      --control-accent: var(--crimson);
    }

    :root[data-theme="dark"] {
      color-scheme: dark;
      --page: #1b1417;
      --paper: #241b1f;
      --field: #2b2125;
      --ink: #f7edf0;
      --muted: #d1bfc5;
      --border: #503e45;
      --field-border: #9b7f89;
      --accent-ink: #ffb3c0;
      --result-surface: #451a29;
      --control-accent: #ff9aad;
    }

    *, *::before, *::after { box-sizing: border-box; }
    body { min-block-size: 100vh; margin: 0; background: var(--page); color: var(--ink); }
    button, input, select { font: inherit; }
    button, select, summary { cursor: pointer; }
    :focus-visible { outline: 3px solid var(--control-accent); outline-offset: 3px; }
    [hidden] { display: none !important; }
    .wrap { width: min(100% - 3rem, 69rem); margin-inline: auto; }
    .topline { padding-block: 1.15rem; border-bottom: 1px solid var(--border); background: var(--paper); }
    .topline-inner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
    .wordmark { display: flex; align-items: center; min-width: 0; gap: .65rem; font-weight: 750; overflow-wrap: anywhere; }
    .header-actions { display: flex; align-items: center; flex: none; gap: .45rem; }
    .header-action {
      display: grid;
      flex: none;
      place-items: center;
      inline-size: 2.75rem;
      block-size: 2.75rem;
      padding: 0;
      border: 0;
      border-radius: .55rem;
      background: transparent;
      color: var(--accent-ink);
    }
    @media (hover: hover) {
      .header-action:hover { background: color-mix(in srgb, var(--control-accent) 10%, transparent); }
    }
    .theme-icon { display: none; }
    [data-mode="system"] .theme-icon-system,
    [data-mode="light"] .theme-icon-light,
    [data-mode="dark"] .theme-icon-dark { display: block; }
    .theme-icon-system {
      position: relative;
      inline-size: 1.2rem;
      block-size: .8rem;
      margin-block-end: .2rem;
      border: 2px solid currentColor;
      border-radius: .15rem;
    }
    .theme-icon-system::before, .theme-icon-system::after {
      content: "";
      position: absolute;
      inset-inline-start: 50%;
      transform: translateX(-50%);
      background: currentColor;
    }
    .theme-icon-system::before { inline-size: 2px; block-size: .23rem; inset-block-end: -.24rem; }
    .theme-icon-system::after { inline-size: .6rem; block-size: 2px; inset-block-end: -.3rem; }
    .theme-icon-light, .theme-icon-dark { font-size: 1.55rem; line-height: 1; }
    .mark { display: grid; flex: none; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--crimson); color: #fff; font-size: 1.12rem; }

    main { padding-block: clamp(2.2rem, 6vw, 4.4rem) 2.5rem; }
    .intro { margin-bottom: clamp(1.5rem, 4vw, 2.65rem); }
    h1, h2, p { margin: 0; }
    h1 { font-size: clamp(2.6rem, 6vw, 5.25rem); line-height: .98; letter-spacing: -.066em; }
    .intro p { margin-top: 1rem; color: var(--muted); font-size: 1.04rem; line-height: 1.55; }
    .calculator { display: grid; grid-template-columns: minmax(0, .93fr) minmax(0, 1.07fr); gap: 1rem; align-items: start; }
    .panel { min-width: 0; border: 1px solid var(--border); border-radius: 1.35rem; background: var(--paper); overflow-wrap: anywhere; }
    .inputs { padding: clamp(1.15rem, 3vw, 2rem); }
    .section-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.35rem; }
    h2 { font-size: 1.25rem; letter-spacing: -.035em; }
    .reset { background: transparent; color: var(--accent-ink); border: 0; padding: .4rem .15rem; font-size: .85rem; text-decoration: underline; text-underline-offset: .19em; }
    .preset-field { margin-bottom: 1rem; }
    .preset-field .field-note { margin: 0 0 .6rem; }
    .form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .85rem; }
    .field-label, legend { display: block; font-size: .84rem; font-weight: 720; }
    .field-label { margin-bottom: .42rem; }
    .input-shell { display: flex; align-items: center; min-height: 3rem; border: 1px solid var(--field-border); border-radius: .55rem; background: var(--field); }
    .input-shell:focus-within { outline: 3px solid var(--control-accent); outline-offset: 2px; }
    .prefix { flex: none; color: var(--muted); padding-left: .73rem; font-size: .83rem; font-weight: 650; }
    input[type="text"] { width: 100%; min-width: 0; padding: .72rem; background: transparent; border: 0; color: var(--ink); font-weight: 680; font-variant-numeric: tabular-nums; }
    input[type="text"]:focus { outline: none; }
    .input-shell:has([aria-invalid="true"]) { border-color: var(--control-accent); }
    select { width: 100%; min-height: 3rem; border: 1px solid var(--field-border); border-radius: .55rem; padding: .55rem .4rem .55rem .65rem; background: var(--field); color: var(--ink); }
    .pay-fields { min-width: 0; padding: 0; margin: 1.45rem 0 0; border: 0; }
    .pay-fields legend { padding: 0; font-size: .95rem; }
    .japan-income { margin-top: .85rem; }
    .comparison-fields { min-width: 0; margin: 1.25rem 0 0; padding: 0; border: 0; }
    .comparison-fields legend { font-size: .84rem; }
    .pay-fields .form-row { margin-top: .85rem; }
    .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .help, .field-note, .error { font-size: .875rem; line-height: 1.4; }
    .help, .field-note { color: var(--muted); }
    .help, .field-note, .error { margin-top: .42rem; }
    .error { color: var(--accent-ink); }

    .result { overflow: hidden; }
    .result-main { padding: clamp(1.2rem, 4vw, 2.1rem); background: var(--result-surface); color: #fff; }
    .result-main h2 { color: #ffe7eb; font-size: 1.02rem; letter-spacing: 0; }
    .hero-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; margin-block: .75rem .6rem; }
    .equivalent-yen { min-width: 0; overflow-wrap: anywhere; color: #ffe7eb; font-size: 1.05rem; line-height: 1.2; font-weight: 600; font-variant-numeric: tabular-nums; }
    .hero-amount { margin: 0; color: #fff; font-size: clamp(1.55rem, 4vw, 2.65rem); line-height: 1; font-weight: 760; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
    .result-main .metric-note { max-width: 46ch; color: #ffe7eb; font-size: .94rem; line-height: 1.52; }
    .share-section { border-top: 1px solid var(--border); }
    .pay-shares { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin: 0; }
    .metric { min-width: 0; padding: 1.1rem clamp(.85rem, 2.5vw, 1.55rem) 1.2rem; }
    .pay-shares .metric { padding-top: .65rem; }
    .pay-shares .metric + .metric { border-left: 1px solid var(--border); }
    .metric h3, .metric dt, .share-section h3 { margin: 0; font-size: .79rem; line-height: 1.35; color: var(--muted); }
    .metric dt { font-weight: 650; }
    .metric dd { margin: 0; }
    .share-section h3 { padding: .85rem clamp(.85rem, 2.5vw, 1.55rem) 0; color: var(--ink); }
    .metric-value { margin-block: .38rem; font-size: clamp(1.35rem, 3vw, 2.1rem); line-height: 1.05; letter-spacing: -.035em; font-weight: 750; font-variant-numeric: tabular-nums; }
    .metric-note { color: var(--muted); font-size: .875rem; line-height: 1.4; }
    .metric-note a { color: var(--accent-ink); text-underline-offset: .18em; }
    details { border-top: 1px solid var(--border); }
    summary { padding: .95rem clamp(.85rem, 2.5vw, 1.55rem); color: var(--accent-ink); font-weight: 700; font-size: .85rem; }
    summary:focus-visible { outline-offset: -4px; }
    .method { padding: 0 clamp(.85rem, 2.5vw, 1.55rem) 1rem; color: var(--muted); font-size: .85rem; line-height: 1.5; }
    .method ul { margin: 0; padding-inline-start: 1.2em; }
    .method li + li { margin-top: .55rem; }
    .method li p { margin-top: .35rem; }
    #rate-pair {
      margin-block: .4rem .5rem;
      padding: .35rem .55rem;
      border-radius: .35rem;
      inline-size: fit-content;
      background: color-mix(in srgb, var(--control-accent) 8%, var(--paper));
      color: var(--accent-ink);
      font-weight: 650;
    }

    @media (max-width: 730px) {
      .calculator { grid-template-columns: minmax(0, 1fr); }
    }

    @media (width > 380px) {
      @supports (grid-template-rows: subgrid) {
        .form-row { grid-template-rows: repeat(3, auto); row-gap: 0; }
        .form-row > div { display: grid; grid-template-rows: subgrid; grid-row: span 3; }
      }
    }

    @media (max-width: 380px) {
      .wrap { width: calc(100% - 1.5rem); }
      .form-row { grid-template-columns: minmax(0, 1fr); }
    }

.site-footer { padding-block-end: 2rem; color: var(--muted); font-size: .875rem; line-height: 1.5; }

.site-footer p + p { margin-block-start: .75rem; }
.site-footer a { color: var(--accent-ink); text-underline-offset: .18em; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--accent-ink); font-size: inherit; text-decoration: underline; text-underline-offset: .18em; }

.consent { border-bottom: 1px solid var(--border); background: var(--paper); font-size: .875rem; line-height: 1.5; }
.consent:focus-visible { outline-offset: -3px; }
.consent-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; padding-block: 1rem; }
.consent-text { flex: 1 1 28rem; min-width: 0; color: var(--muted); }
.consent-text p + p { margin-block-start: .35rem; }
.consent-title { color: var(--ink); font-weight: 720; }
.consent-status { color: var(--ink); }
.consent-text a { color: var(--accent-ink); text-underline-offset: .18em; }
.consent-actions { display: flex; flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; }
.consent-button {
  flex: 0 1 auto;
  min-block-size: 2.75rem;
  padding: .5rem 1.1rem;
  border: 1px solid var(--control-accent);
  border-radius: .55rem;
  background: var(--paper);
  color: var(--accent-ink);
  font-weight: 700;
}
@media (hover: hover) {
  .consent-button:hover { background: color-mix(in srgb, var(--control-accent) 10%, var(--paper)); }
}
@media (max-width: 380px) {
  .consent-actions { justify-content: stretch; }
  .consent-button { flex: 1 1 auto; }
}

.wordmark-link { color: inherit; text-decoration: none; }
.prose { max-inline-size: 46rem; padding-block: clamp(2rem, 5vw, 3.5rem) 2.5rem; line-height: 1.6; }
.prose h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-block: 1rem .5rem; }
.prose h2 { margin-block: 2rem .6rem; }
.prose p + p, .prose ul + p, .prose p + ul, .prose p + .table-wrap { margin-block-start: .8rem; }
.prose ul { margin: 0; padding-inline-start: 1.2em; }
.prose li + li { margin-block-start: .35rem; }
.prose a { color: var(--accent-ink); text-underline-offset: .18em; }
.prose code { font-size: .9em; overflow-wrap: anywhere; }
.updated { color: var(--muted); font-size: .875rem; }
.table-wrap { overflow-x: auto; }
.prose table { inline-size: 100%; border-collapse: collapse; font-size: .875rem; }
.prose th, .prose td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.prose th { color: var(--muted); font-weight: 650; }
