:root {
  --ink: #1a1a1a;
  --muted: #6b6158;
  --line: #ece4d8;
  --soft: #fbf6ee;
  --card: #ffffff;
  --purple: #FF6B00;
  --purple-soft: #ffeedd;
  --green: #197a54;
  --olive: #5a7118;
  --blue: #2f80ed;
  --shadow: 0 20px 48px rgba(26,26,26, .075);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #ffffff;
  color: var(--ink);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.fire-page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 36px 20px 96px;
}

.calc-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  margin: 0 auto 4px;
  padding: 6px;
  background: #f6efe4;
  border-radius: 999px;
}

.calc-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 22px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.calc-tabs a.active {
  color: #fff;
  background: var(--purple);
}

.hero {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 18px 0 56px;
  text-align: center;
}

.back-link {
  justify-self: start;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.hero h1 {
  margin: 30px 0 0;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(38px, 5vw, 52px);
  font-weight: 560;
  line-height: 1.06;
  letter-spacing: 0;
}

.hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
}

.hero .assumption-note {
  max-width: 680px;
  color: #9a8f84;
  font-size: 13px;
}

.calculator {
  position: relative;
}

.unit-pill {
  width: fit-content;
  margin: 0 12px 12px auto;
  color: var(--purple);
  font-size: 13px;
  font-weight: 850;
}

.input-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr);
  gap: 16px;
  align-items: start;
}

.input-stack {
  display: grid;
  gap: 16px;
}

.input-card {
  border: 1px solid rgba(255,107,0, .08);
  border-radius: 8px;
  padding: 32px 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}


.input-card h2 {
  margin: 8px 0 24px;
  font-size: 23px;
  line-height: 1.2;
  text-align: center;
}

.label-with-hint {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.hint {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 6px;
}

.hint summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  color: var(--purple);
  background: var(--purple-soft);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.hint summary::-webkit-details-marker {
  display: none;
}

.hint summary::marker {
  content: "";
}

.hint[open] summary {
  color: #fff;
  background: var(--purple);
}

.hint p {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  transform: none;
  z-index: 30;
  width: 200px;
  max-width: 60vw;
  margin: 0;
  padding: 11px 13px;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.55;
  text-align: left;
  white-space: normal;
  word-break: keep-all;
  box-shadow: var(--shadow);
}

.ly-field {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}

.ly-field > span {
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 800;
}

.value-box {
  position: relative;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.value-box input {
  width: 100%;
  height: 42px;
  border: 0;
  outline: 0;
  padding: 0 56px 0 14px;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
  font-weight: 760;
}

.value-box em {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #9a8f84;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  pointer-events: none;
}

.value-box:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(255,107,0, .12);
}

.slider-field {
  grid-template-columns: 112px 42px minmax(110px, 1fr) 92px;
}

.slider-field strong {
  font-size: 15.5px;
  font-weight: 900;
}

.slider-field input[type="range"] {
  width: 100%;
  accent-color: #E2570A;
}

.value-box.compact input {
  padding-right: 34px;
  text-align: right;
}

.reset-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--purple-soft);
  border-radius: 50%;
  background: #fff;
  color: var(--purple);
  font-size: 19px;
  line-height: 1;
}

.reset-icon:hover {
  background: var(--purple-soft);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 900;
}

.primary-button {
  color: #fff;
  background: var(--purple);
}

.secondary-button {
  color: var(--purple);
  border-color: var(--purple-soft);
  background: #fff;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  vertical-align: 2px;
}

.mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 16px;
}

.mode-toggle {
  display: flex;
  gap: 4px;
  width: fit-content;
  padding: 4px;
  background: #f6efe4;
  border-radius: 999px;
}

.mode-btn {
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 850;
}

.mode-btn.active {
  color: #fff;
  background: var(--purple);
}

.emode-target-only {
  display: none;
}

#planCard.is-target-mode .emode-expense-only {
  display: none;
}

#planCard.is-target-mode .emode-target-only {
  display: grid;
}

.result-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 0;
  border-radius: 12px;
  padding: 22px 28px;
  background: #faf4ea;
}

.result-strip article {
  text-align: center;
}

.result-strip span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.result-strip strong {
  display: block;
  margin-top: 8px;
  font-family: Pretendard, sans-serif;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1;
  letter-spacing: 0;
}

.result-strip p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.projection-shell {
  margin-top: 16px;
  padding: 18px;
  border-radius: 12px;
  background: #f6efe4;
}

.projection-card {
  border-radius: 8px;
  padding: 34px 38px 28px;
  background: #fff;
  box-shadow: var(--shadow);
}

.projection-card > span {
  display: block;
  color: var(--purple);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .14em;
  text-align: center;
}

.projection-card h2 {
  margin: 8px 0 20px;
  font-size: 24px;
  line-height: 1.2;
  text-align: center;
}

.chart-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.chart-tabs button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
}

.chart-tabs button.active,
.chart-tabs button[aria-selected="true"] {
  color: var(--purple);
  background: var(--purple-soft);
}

.chart-wrap {
  position: relative;
  height: 365px;
}

.chart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
}

.chart-foot p {
  margin: 0;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.7;
  word-break: keep-all;
  text-wrap: pretty;
}

.chart-foot p .hl {
  color: var(--purple);
  font-weight: 900;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.share-bottom {
  flex: 0 0 auto;
}

.table-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}

.projection-card:not(.is-table) .table-panel {
  display: none;
}

.projection-card.is-table .chart-wrap,
.projection-card.is-table .chart-foot {
  display: none;
}

.table-title span {
  display: block;
  color: var(--purple);
  font-size: 13px;
  font-weight: 950;
}

.table-title strong {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.table-toggle {
  min-height: 36px;
  border-radius: 8px;
}

.table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 13px;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #fff;
  background: var(--ink);
  font-weight: 900;
}

th:nth-child(1),
td:nth-child(1) {
  width: 48px;
}

th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4) {
  width: 84px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 206px;
}

th:nth-child(6),
td:nth-child(6),
th:nth-child(7),
td:nth-child(7) {
  width: 104px;
}

tr.is-independent td {
  background: #fdf8f1;
}

tr.is-covered td {
  background: #f2fbf6;
}

.cover-cell {
  display: grid;
  grid-template-columns: 44px minmax(92px, 1fr);
  align-items: center;
  gap: 8px;
}

.cover-cell span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.cover-bar {
  position: relative;
  height: 18px;
  overflow: hidden;
  background: #eee7dc;
}

.cover-bar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 80%;
  width: 1px;
  background: rgba(26,26,26, .35);
}

.cover-bar i {
  display: block;
  height: 100%;
  background: #c4b9ad;
}

.cover-bar.is-covered i {
  background: var(--green);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  padding: 12px 16px;
  color: #fff;
  background: rgba(26,26,26, .94);
  font-weight: 850;
  transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 720px) {
  [data-homepage-topbar] > div {
    padding: 16px 14px !important;
    align-items: flex-start !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  [data-homepage-topbar] nav {
    order: 3 !important;
    width: 100% !important;
    flex: 0 0 100% !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    overflow-x: auto !important;
    padding-bottom: 4px !important;
  }

  [data-homepage-topbar] nav a {
    border: 1px solid #e5e7eb !important;
    border-radius: 999px !important;
    padding: 8px 10px !important;
    font-size: 14px !important;
  }
}

@media (max-width: 980px) {
  .input-panel {
    grid-template-columns: 1fr;
  }

  .result-strip {
    padding-inline: 24px;
  }

  .projection-shell {
    padding-inline: 20px;
  }
}

@media (max-width: 640px) {
  .fire-page {
    padding: 20px 12px 64px;
  }

  .hero {
    padding: 18px 0 44px;
  }

  .back-link {
    justify-self: center;
  }

  .hero h1 {
    margin-top: 22px;
    font-size: 38px;
  }

  .hero p {
    font-size: 14px;
  }

  .unit-pill {
    margin-right: 0;
  }

  .input-card {
    padding: 28px 18px;
  }

  .ly-field,
  .slider-field {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .slider-field strong {
    margin-top: -4px;
  }

  .result-hero {
    padding: 32px 16px;
  }

  .result-strip {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 24px 18px;
  }

  .projection-shell {
    padding: 16px 0 28px;
  }

  .projection-card {
    padding: 30px 18px 22px;
  }

  .chart-wrap {
    height: 300px;
  }

  .chart-foot,
  .table-title {
    align-items: stretch;
    flex-direction: column;
  }

  .share-bottom,
  .table-toggle {
    width: 100%;
  }

  table {
    min-width: 680px;
  }
}
