:root {
  color-scheme: light;
  --ink: #16201d;
  --muted: #63706c;
  --paper: #fcfcf9;
  --panel: #ffffff;
  --line: #d9dfdc;
  --green: #1f7a5f;
  --green-soft: #dff3ec;
  --blue: #245f9d;
  --blue-soft: #e6f0fb;
  --coral: #c85f4f;
  --yellow: #f5c451;
  --shadow: 0 18px 48px rgb(24 38 34 / 10%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #f4faf7 0%, var(--paper) 34%), var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  line-height: 1.65;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.tool-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.text-page {
  width: min(820px, calc(100% - 32px));
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  align-items: end;
  gap: 24px;
  padding: 18px 0 28px;
}

.compact-intro {
  grid-template-columns: 1fr;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-block-start: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 7vw, 68px);
  line-height: 1.04;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
}

.esim-note {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--ink);
  font-size: 15px;
}

.intro-details {
  max-width: 720px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.intro-details summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 700;
}

.intro-details p {
  margin: 8px 0 0;
}

.signal-visual {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 10px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, var(--blue-soft), #fff);
  box-shadow: var(--shadow);
}

.signal-visual span {
  width: 22px;
  border-radius: 7px 7px 2px 2px;
  background: var(--green);
}

.signal-visual span:nth-child(1) {
  height: 34px;
  background: var(--coral);
}

.signal-visual span:nth-child(2) {
  height: 58px;
  background: var(--yellow);
}

.signal-visual span:nth-child(3) {
  height: 86px;
  background: var(--blue);
}

.signal-visual span:nth-child(4) {
  height: 112px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.calculator-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.calculator-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.mini-result {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.mini-result strong {
  font-size: 24px;
  line-height: 1;
}

.mini-result span:last-child {
  min-width: 0;
  color: var(--ink);
  font-weight: 600;
}

.mini-result-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.mini-result-action:hover {
  background: #17644e;
}

.field-section {
  margin: 0;
  padding: 0;
  border: 0;
}

.field-section h2,
.field-section summary,
.result-block h2 {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.35;
}

.field-section summary {
  cursor: pointer;
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-grid.compact {
  padding-top: 14px;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-hint,
.field-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.field-help {
  margin: 0 0 4px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 9px 10px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgb(36 95 157 / 22%);
  outline-offset: 2px;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf9;
  color: var(--ink);
  font-weight: 600;
}

.toggle input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}

.form-actions {
  display: grid;
  gap: 10px;
}

.auto-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.primary-action {
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.primary-action:hover {
  background: #17644e;
}

.result-panel {
  position: sticky;
  top: 18px;
  padding: 24px;
}

.text-panel {
  position: static;
}

.result-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.result-band {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 60px;
  line-height: 1;
  letter-spacing: 0;
}

.result-range {
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.result-scope {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.gauge {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece9;
}

.gauge span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue), var(--coral));
  transition: width 160ms ease;
}

.result-summary {
  margin: 16px 0 18px;
  font-weight: 700;
}

.affiliate-quick {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid #b7d6c9;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: linear-gradient(180deg, #f7fcfa 0%, #fff 82%);
}

.affiliate-quick[hidden] {
  display: none;
}

.affiliate-quick-label {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.affiliate-quick p:last-child {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.affiliate-quick-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.affiliate-quick a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.affiliate-quick a:hover {
  background: #17644e;
}

.affiliate-quick .affiliate-quick-detail {
  border-color: var(--line);
  background: #fff;
  color: var(--green);
}

.affiliate-quick .affiliate-quick-detail:hover {
  background: var(--green-soft);
}

.plan-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.plan-row span {
  display: grid;
  min-height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.plan-row span[aria-current] {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.result-block {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.result-block ul {
  margin: 0 0 18px;
  padding-left: 1.2em;
}

.setup-list,
.comparison-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 12px;
}

.setup-card,
.comparison-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf9;
}

.setup-card h3,
.comparison-card h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.setup-card p,
.comparison-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.comparison-disclosure {
  color: var(--muted);
  font-size: 13px;
}

.breakdown-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 18px;
}

.breakdown-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.breakdown-card h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.breakdown-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.provider-step-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.provider-step-list li {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #fff;
}

.provider-step-list strong {
  font-size: 14px;
  line-height: 1.4;
}

.provider-step-list span {
  color: var(--muted);
  font-size: 13px;
}

.affiliate-disclosure {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.affiliate-list {
  display: grid;
  gap: 10px;
}

.affiliate-card {
  padding: 14px;
  border: 1px solid #b7d6c9;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: linear-gradient(180deg, #f7fcfa 0%, #fff 76%);
}

.affiliate-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.affiliate-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.affiliate-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

.affiliate-summary {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
}

.affiliate-card ul {
  margin-top: 0;
  margin-bottom: 10px;
  padding-left: 20px;
}

.affiliate-caution {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.affiliate-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.affiliate-card a:hover {
  background: #17644e;
}

.affiliate-external-label {
  padding: 2px 6px;
  border: 1px solid rgb(255 255 255 / 58%);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.result-note {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 14px;
}

.result-note-emphasis {
  margin: -6px 0 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf9;
  font-weight: 700;
}

.fineprint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.guide-links {
  display: grid;
  gap: 16px;
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.guide-links h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
}

.guide-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.guide-card {
  display: grid;
  gap: 7px;
  min-height: 148px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.guide-card:hover {
  border-color: var(--green);
}

.guide-card span {
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.guide-card strong {
  font-size: 18px;
  line-height: 1.35;
}

.guide-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.article-panel {
  display: grid;
  gap: 18px;
}

.article-panel .result-block:first-child {
  padding-top: 0;
  border-top: 0;
}

.article-panel h2 {
  font-size: 20px;
}

.article-panel p,
.article-panel li {
  font-size: 16px;
}

.guide-table {
  display: grid;
  overflow: hidden;
  margin: 16px 0 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.guide-table > div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.guide-table > div:first-child {
  border-top: 0;
}

.guide-table strong {
  color: var(--green);
}

.guide-table span {
  color: var(--ink);
}

.cta-block {
  padding: 16px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green-soft);
}

.cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 4px;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.cta-link:hover {
  background: #17644e;
}

@media (max-width: 860px) {
  .intro,
  .workspace {
    grid-template-columns: 1fr;
  }

  .guide-card-grid {
    grid-template-columns: 1fr;
  }

  .signal-visual {
    display: none;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 13px;
    white-space: normal;
  }

  .field-grid,
  .toggle-grid {
    grid-template-columns: 1fr;
  }

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

  .mini-result {
    grid-template-columns: auto auto;
  }

  .affiliate-card a {
    width: 100%;
  }

  .affiliate-quick {
    grid-template-columns: 1fr;
  }

  .affiliate-quick-actions {
    grid-template-columns: 1fr;
  }

  .mini-result span:last-child {
    grid-column: 1 / -1;
  }

  .mini-result-action {
    grid-column: 1 / -1;
    width: 100%;
  }

  .calculator-panel,
  .result-panel {
    padding: 18px;
  }

  .guide-table > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .result-band {
    font-size: 48px;
  }
}
