/* ============================================================
   エコスマほけん 高額療養費シミュレーター
   テーマCSSと干渉しないよう .es-sim 内に限定し、:where() で詳細度を抑制。
   ============================================================ */

.es-sim {
  --essim-accent: #26c8b2;
  --essim-brand-dark: #0c7f71;
  --essim-ink: #16302b;
  --essim-muted: #5b6f6a;
  --essim-border: #d8efe9;
  --essim-danger: #b33a3a;
  --essim-danger-bg: #fff1f1;
  --essim-success: #087565;
  --essim-success-bg: #eaf8f4;
  margin: 26px 0;
  color: var(--essim-ink);
  font-family: inherit;
  background: linear-gradient(180deg, #f7fdfb, #edf8f4);
  border: 1px solid var(--essim-border);
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(16, 40, 36, .05);
  overflow: hidden;
}

.es-sim :where(*) {
  box-sizing: border-box;
}

.es-sim :where([hidden]) {
  display: none !important;
}

.es-sim :where(button, input, select) {
  font: inherit;
}

.es-sim :where(button) {
  margin: 0;
}

.es-sim__header {
  padding: 22px 20px 18px;
  text-align: center;
  border-bottom: 1px solid var(--essim-border);
}

.es-sim__title {
  margin: 0;
  color: var(--essim-ink);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.4;
}

.es-sim__title::after {
  display: block;
  width: 42px;
  height: 3px;
  margin: 10px auto 0;
  background: var(--essim-accent);
  border-radius: 3px;
  content: '';
}

.es-sim__subtitle {
  margin: 10px 0 0;
  color: var(--essim-muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.65;
}

.es-sim__body {
  padding: 22px 20px 24px;
}

.es-sim :where(.es-sim__field) {
  min-width: 0;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.es-sim :where(.es-sim__legend, .es-sim__label) {
  display: block;
  width: 100%;
  margin: 0 0 9px;
  padding: 0;
  color: var(--essim-ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}

.es-sim__choiceRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.es-sim :where(.es-sim__choice) {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 42px;
  margin: 0;
  padding: 8px 13px;
  color: var(--essim-ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  background: #fff;
  border: 1px solid #b9dcd4;
  border-radius: 999px;
  cursor: pointer;
}

.es-sim :where(.es-sim__choice):has(input:checked) {
  color: #075f54;
  background: #e8f8f4;
  border-color: var(--essim-accent);
  box-shadow: 0 0 0 1px var(--essim-accent);
}

.es-sim :where(.es-sim__choice input) {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--essim-brand-dark);
  flex: none;
}

.es-sim__note {
  margin: 8px 0 0;
  color: var(--essim-muted);
  font-size: 11px;
  line-height: 1.6;
}

.es-sim__bracketHint,
.es-sim__tasuHint,
.es-sim__splitHint,
.es-sim__paidGuard {
  margin: 7px 0 0;
  color: var(--essim-muted);
  font-size: 11px;
  line-height: 1.6;
}

.es-sim__tasuHint {
  margin-left: 27px;
}

.es-sim__paidGuard {
  margin: -11px 0 20px;
}

.es-sim :where(.es-sim__select, .es-sim__amount) {
  width: 100%;
  min-height: 48px;
  margin: 0;
  color: var(--essim-ink);
  font-size: 16px;
  line-height: 1.4;
  background: #fff;
  border: 1px solid #a9cfc6;
  border-radius: 10px;
  box-shadow: inset 0 1px 2px rgba(16, 40, 36, .04);
}

.es-sim :where(.es-sim__select) {
  padding: 11px 38px 11px 13px;
}

.es-sim__amountRow {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

.es-sim__splitField {
  min-width: 0;
}

.es-sim :where(.es-sim__amount) {
  min-width: 0;
  padding: 11px 13px;
  font-variant-numeric: tabular-nums;
}

.es-sim__unit {
  flex: none;
  font-size: 14px;
  font-weight: 700;
}

.es-sim__quickRow {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 9px 0 0;
}

.es-sim :where(.es-sim__quick) {
  min-height: 34px;
  padding: 6px 12px;
  color: var(--essim-brand-dark);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  background: #fff;
  border: 1px solid #9ed9ce;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}

.es-sim :where(.es-sim__quick):hover {
  background: #e8f8f4;
  border-color: var(--essim-accent);
}

.es-sim :where(.es-sim__check) {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 0;
  color: var(--essim-ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  cursor: pointer;
}

.es-sim :where(.es-sim__check input) {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--essim-brand-dark);
  flex: none;
}

.es-sim :where(.es-sim__calculate) {
  display: block;
  width: min(100%, 360px);
  min-height: 50px;
  margin: 4px auto 0;
  padding: 12px 22px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
  background: var(--essim-brand-dark);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(12, 127, 113, .18);
  cursor: pointer;
  transition: filter .2s ease, transform .2s ease;
}

.es-sim :where(.es-sim__calculate):hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.es-sim :where(button, input, select):focus-visible,
.es-sim :where(summary):focus-visible {
  outline: 3px solid var(--essim-ink);
  outline-offset: 3px;
}

.es-sim__result {
  margin: 22px 0 0;
  padding: 18px;
  color: var(--essim-ink);
  background: #fff;
  border: 1px solid #b9ddd5;
  border-radius: 14px;
}

.es-sim__result--error {
  color: var(--essim-danger);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.65;
  background: var(--essim-danger-bg);
  border-color: #efcaca;
}

.es-sim__resultRow {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  line-height: 1.6;
}

.es-sim__resultRow + .es-sim__resultRow {
  margin-top: 8px;
}

.es-sim__resultValue {
  flex: none;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.es-sim__primaryResult {
  margin: 15px 0;
  padding: 15px 12px;
  text-align: center;
  background: var(--essim-success-bg);
  border-radius: 11px;
}

.es-sim__primaryLabel {
  color: #315f57;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.es-sim__primaryValue {
  display: block;
  margin: 5px 0 0;
  color: var(--essim-brand-dark);
  font-size: 29px;
  font-weight: 800;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.es-sim__notEligible {
  margin: 15px 0 0;
  padding: 11px 12px;
  color: var(--essim-muted);
  font-size: 12px;
  line-height: 1.65;
  background: #f4f7f6;
  border-radius: 9px;
}

.es-sim__comparison {
  margin: 16px 0 0;
  padding: 13px;
  font-size: 12.5px;
  line-height: 1.6;
  background: #f7faf9;
  border: 1px solid #e0ebe8;
  border-radius: 10px;
}

.es-sim__oldValue {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.es-sim__difference {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  margin: 9px 0 0;
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.4;
  border-radius: 999px;
}

.es-sim__difference--increase {
  color: #a72f2f;
  background: #fdeaea;
}

.es-sim__difference--decrease {
  color: var(--essim-success);
  background: #e5f7f1;
}

.es-sim__difference--same {
  color: #56635f;
  background: #eaeeed;
}

.es-sim__supplement {
  margin: 13px 0 0;
  color: var(--essim-muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.es-sim__details {
  margin: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--essim-border);
}

.es-sim :where(.es-sim__details summary) {
  color: var(--essim-ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  cursor: pointer;
}

.es-sim :where(.es-sim__details ul) {
  margin: 12px 0 0;
  padding: 0 0 0 1.25em;
  color: var(--essim-muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.es-sim :where(.es-sim__details li) {
  margin: 0;
  padding: 0;
}

.es-sim :where(.es-sim__details li + li) {
  margin-top: 6px;
}

.es-sim__footer,
.es-sim__noscript {
  padding: 12px 20px;
  color: var(--essim-muted);
  font-size: 10.5px;
  line-height: 1.65;
  background: rgba(255, 255, 255, .42);
  border-top: 1px solid var(--essim-border);
}

.es-sim__noscript {
  color: var(--essim-danger);
  font-weight: 700;
}

@media (max-width: 519px) {
  .es-sim__header {
    padding: 19px 15px 16px;
  }

  .es-sim__title {
    font-size: 18px;
  }

  .es-sim__body {
    padding: 19px 15px 21px;
  }

  .es-sim__choiceRow {
    display: grid;
    grid-template-columns: 1fr;
  }

  .es-sim :where(.es-sim__choice) {
    width: 100%;
  }

  .es-sim__quickRow {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .es-sim__splitAmountGrid {
    grid-template-columns: 1fr;
  }

  .es-sim :where(.es-sim__quick) {
    width: 100%;
  }

  .es-sim__result {
    padding: 15px 13px;
  }

  .es-sim__resultRow {
    display: block;
  }

  .es-sim__resultValue {
    display: block;
    margin-top: 2px;
  }

  .es-sim__primaryValue {
    font-size: 25px;
  }

  .es-sim__details,
  .es-sim__footer,
  .es-sim__noscript {
    padding-right: 15px;
    padding-left: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .es-sim :where(.es-sim__quick, .es-sim__calculate) {
    transition: none;
  }
}
