:root {
  --ink: #1a1a1a;
  --muted: #6b6158;
  --line: #ece4d8;
  --soft: #fbf6ee;
  --card: #ffffff;
  --purple: #FF6B00;
  --purple-soft: #ffeedd;
  --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;
}

.ci-page {
  max-width: 880px;
  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 44px;
  text-align: center;
}

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

.hero h1 {
  margin: 30px 0 0;
  font-size: clamp(38px, 5vw, 52px);
  font-weight: 560;
  line-height: 1.06;
  letter-spacing: 0;
}

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

.hero .assumption-note {
  max-width: 560px;
  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;
}

.result-hero {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 16px 0 0;
  padding: 40px 24px;
  border-radius: 16px;
  background: linear-gradient(160deg, #f6efe4 0%, #ffeedd 100%);
  text-align: center;
}

.result-kicker {
  color: var(--purple);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .02em;
}

.result-hero strong {
  font-family: Pretendard, sans-serif;
  font-size: clamp(44px, 8vw, 72px);
  line-height: 1.02;
  letter-spacing: -.01em;
}

.result-hero p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.input-panel {
  display: block;
}

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

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

.rate-name {
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 800;
}

.slider-field.rate-row {
  grid-template-columns: 112px auto minmax(60px, 1fr) 92px;
}

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

.mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

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

.mode-toggle {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: #f6efe4;
  border-radius: 999px;
}

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

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

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

label.ly-field:first-of-type {
  margin-top: 0;
}

.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 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;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

.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;
}

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

.projection-card {
  border-radius: 12px;
  padding: 32px 30px 26px;
  background: #fff;
  box-shadow: var(--shadow);
}

.projection-card h2 {
  margin: 0 0 18px;
  font-size: 22px;
  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: 340px;
}

.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: 440px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 9px 10px;
  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: 64px;
}

.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: 640px) {
  .ci-page {
    padding: 20px 12px 64px;
  }

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

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

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

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

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

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

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

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

  .slider-field.rate-row,
  .slider-field.years-row {
    grid-template-columns: 1fr;
  }

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

  .button-row {
    grid-template-columns: 1fr;
  }

  .projection-shell {
    padding: 14px 10px;
  }

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

  .chart-wrap {
    height: 300px;
  }

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

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