:root {
  --ink: #111316;
  --muted: #6c6861;
  --orange: #d94308;
  --brass: #a97634;
  --paper: #f5f1e9;
  --line: rgba(17, 19, 22, .14);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  font-family: Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
}

button,
input { font: inherit; }

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

.page-art {
  position: fixed;
  inset: 0;
  z-index: 0;
  filter: blur(1.2px) saturate(.9) contrast(1.02);
  transform: scale(1.008);
  transform-origin: center;
  background:
    linear-gradient(90deg, rgba(247, 245, 241, .84) 0%, rgba(247, 245, 241, .58) 34%, rgba(247, 245, 241, .18) 64%, rgba(247, 245, 241, .02) 100%),
    linear-gradient(0deg, rgba(247, 245, 241, .38), transparent 44%),
    url("assets/fee-symbolic-v1.webp") center / cover no-repeat;
}

.tool-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 74px;
  padding: 0 4vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: rgba(248, 246, 241, .82);
  backdrop-filter: blur(18px);
}

.brand {
  width: max-content;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -1.2px;
}

.brand span { color: var(--orange); }

.tool-label {
  margin: 0;
  color: #6b6862;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .16em;
}

.tool-label i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 7px rgba(217, 67, 8, .08);
}

.office-link {
  justify-self: end;
  font-size: 14px;
  font-weight: 700;
}

.office-link span {
  margin-left: 7px;
  color: var(--orange);
}

.calculator {
  position: relative;
  z-index: 1;
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 48px 4vw 96px;
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  gap: clamp(42px, 6vw, 96px);
  align-items: start;
}

.calculator-intro {
  position: sticky;
  top: 126px;
}

.calculator-intro > p {
  margin: 0 0 14px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.65;
}

.calculator-intro h1 {
  margin: 0 0 18px;
  font-size: clamp(30px, 2.45vw, 42px);
  line-height: 1.12;
  letter-spacing: -.05em;
  word-break: keep-all;
}

.calculator-intro > span {
  display: block;
  max-width: 290px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.72;
}

.calculator-workspace { min-width: 0; }

.calculator-workspace,
.calculator-intro {
  text-shadow: 0 1px 12px rgba(247, 245, 241, .9);
}

.flow-status {
  display: grid;
  grid-template-columns: auto minmax(180px, 340px);
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
}

.flow-status p {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 0;
}

.flow-status p span {
  color: var(--orange);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
}

.flow-status p strong {
  font-size: 13px;
  font-weight: 760;
}

.flow-rail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.flow-rail i {
  height: 3px;
  background: rgba(17, 19, 22, .14);
  transition: background .25s ease, transform .25s ease;
}

.flow-rail[data-stage="1"] i:nth-child(1),
.flow-rail[data-stage="2"] i:nth-child(-n+2),
.flow-rail[data-stage="3"] i { background: var(--orange); }

.tabs {
  display: flex;
  gap: 30px;
  margin-bottom: 36px;
}

.tab {
  position: relative;
  padding: 0 0 13px;
  border: 0;
  background: none;
  color: #8b867f;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease;
}

.tab.is-active { color: var(--ink); }
.tab.is-active::after { transform: scaleX(1); }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(285px, 350px);
  gap: clamp(32px, 5vw, 74px);
  align-items: start;
}

.input-column {
  min-width: 0;
  display: grid;
  gap: 44px;
}

.step-card {
  padding: 0;
  background: transparent;
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.step-heading span {
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
}

.step-heading h2 {
  margin: 0;
  font-size: 18px;
}

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

.type-button {
  position: relative;
  min-height: 58px;
  padding: 11px 50px 11px 14px;
  border: 0;
  background: rgba(247, 245, 241, .18);
  color: #4d4944;
  text-align: left;
  font-size: 14px;
  font-weight: 760;
  cursor: pointer;
  transition: color .18s ease, padding-left .18s ease, background .18s ease, transform .18s ease;
}

.type-button::after {
  content: "→";
  position: absolute;
  right: 26px;
  top: 50%;
  color: var(--orange);
  font-size: 18px;
  font-weight: 900;
  transform: translateY(-50%);
  transition: color .18s ease, transform .18s ease;
}

.type-button small {
  display: block;
  margin-top: 3px;
  color: #918b84;
  font-size: 12px;
  font-weight: 500;
}

.type-button:hover,
.type-button:focus-visible {
  padding-left: 20px;
  color: var(--orange);
  background: rgba(247, 245, 241, .52);
  outline: none;
  transform: translateY(-2px);
}

.type-button:hover::after,
.type-button:focus-visible::after {
  color: var(--orange);
  transform: translate(2px, -50%);
}

.type-button.is-active {
  padding-left: 20px;
  color: var(--orange);
  background: rgba(247, 245, 241, .58);
}

.type-button.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--orange);
}

.type-button.is-active::after { color: var(--orange); }

.type-grid.is-locked {
  grid-template-columns: minmax(0, 1fr);
}

.type-grid.is-locked .type-button:not(.is-active) { display: none; }

.type-grid.is-locked .type-button.is-active {
  min-height: 52px;
  padding-top: 10px;
  padding-bottom: 10px;
  transform: none;
}

.type-grid.is-locked .type-button.is-active::after {
  content: "선택됨";
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
}

.change-type {
  margin-top: 10px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: #5f5a54;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.change-type span {
  display: inline-block;
  margin-left: 7px;
  color: var(--orange);
  transition: transform .18s ease;
}

.change-type:hover span,
.change-type:focus-visible span { transform: translateX(5px); }

.calculator-workspace[data-stage="1"] .workspace-grid,
.calculator-workspace[data-stage="2"] .workspace-grid {
  grid-template-columns: minmax(0, 780px);
}

.field-help,
.field-note {
  margin: 0 0 9px;
  color: #504d48;
  font-size: 13px;
  font-weight: 560;
}

.field-note { margin: 10px 0 0; }

.money-input {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0 8px 0 0;
  border-bottom: 2px solid var(--ink);
}

.money-input:focus-within { border-color: var(--orange); }

.money-input input {
  width: 100%;
  min-width: 0;
  padding: 12px 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  text-align: right;
  font-size: 28px;
  font-weight: 800;
}

.money-input span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.quick-buttons button,
.option-row button {
  padding: 7px 11px;
  border: 0;
  background: rgba(17, 19, 22, .055);
  color: #5d5953;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}

.quick-buttons button:hover,
.quick-buttons button:focus-visible,
.option-row button:hover,
.option-row button:focus-visible {
  color: var(--orange);
  background: rgba(217, 67, 8, .1);
  outline: none;
  transform: translateY(-1px);
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.extras-card {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.extras-card:not([hidden]) { display: grid; }

.extras-card .step-heading { grid-column: 1 / -1; }

.extras-card .option-row {
  min-height: 88px;
  padding: 12px;
  align-items: flex-start;
  flex-direction: column;
  background: rgba(247, 245, 241, .18);
  border: 0;
}

.extras-card .option-row > button,
.extras-card .option-row > .choice-group,
.extras-card .option-row > .always {
  margin-top: auto;
}

.option-row > div:first-child { min-width: 0; }

.option-row strong {
  display: block;
  font-size: 14px;
  line-height: 1.5;
}

.option-row small {
  display: block;
  margin-top: 3px;
  color: #504d48;
  font-size: 12px;
  font-weight: 560;
  line-height: 1.55;
}

.option-row button.is-active {
  color: #fff;
  background: var(--orange);
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.always {
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.result-panel {
  position: sticky;
  top: 132px;
  min-height: 360px;
  padding: 6px 0 0 28px;
  border-left: 2px solid rgba(217, 67, 8, .7);
  color: var(--ink);
}

.result-panel::after {
  content: "";
  position: absolute;
  right: -8px;
  top: -22px;
  width: 126px;
  height: 126px;
  border: 1px solid rgba(169, 118, 52, .35);
  border-radius: 50%;
  pointer-events: none;
}

.result-kicker {
  margin: 0 0 30px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .12em;
}

.result-empty {
  display: grid;
  gap: 9px;
}

.result-empty strong { font-size: 22px; }

.result-empty span {
  max-width: 280px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.result-panel #result-name {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.result-total {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 13px 0 5px;
}

.result-total strong {
  color: var(--orange);
  font-size: clamp(42px, 4.5vw, 64px);
  letter-spacing: -.055em;
}

.result-total span {
  font-size: 17px;
  font-weight: 800;
}

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

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

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  color: #3f3c37;
  font-size: 12px;
  font-weight: 600;
}

.detail-row strong {
  color: var(--ink);
  white-space: nowrap;
}

.formula {
  margin: 14px 0 0;
  color: #4d4943;
  font-size: 12px;
  font-weight: 560;
  line-height: 1.65;
}

.result-actions {
  display: grid;
  gap: 4px;
  margin-top: 27px;
}

.result-actions a,
.result-actions button {
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.result-actions a {
  display: flex;
  justify-content: space-between;
  color: var(--orange);
}

.notice {
  margin-top: 54px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.notice h2 {
  margin: 0 0 12px;
  font-size: 14px;
}

.notice ul {
  margin: 0;
  padding-left: 18px;
  color: #302e2a;
  font-size: 13px;
  font-weight: 560;
  line-height: 1.85;
}

.notice strong { color: var(--ink); }

@media (max-width: 1100px) {
  .calculator {
    grid-template-columns: 1fr;
    gap: 46px;
  }

  .calculator-intro {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 50px;
    align-items: end;
  }

  .calculator-intro h1 {
    grid-row: 1 / 3;
    margin: 0;
  }

  .calculator-intro > p { margin: 0; }
  .calculator-intro > span { max-width: none; }
}

@media (max-width: 780px) {
  .page-art {
    background:
      linear-gradient(180deg, rgba(247, 245, 241, .67) 0%, rgba(247, 245, 241, .34) 58%, rgba(247, 245, 241, .5) 100%),
      url("assets/fee-symbolic-v1.webp") 70% center / cover no-repeat;
  }

  .tool-header {
    height: 66px;
    grid-template-columns: 1fr auto;
  }

  .tool-label { display: none; }
  .office-link { font-size: 12px; }

  .calculator {
    padding: 30px 20px 68px;
    gap: 36px;
  }

  .calculator-intro { display: block; }
  .calculator-intro > p { margin-bottom: 12px; }

  .calculator-intro h1 {
    margin-bottom: 14px;
    font-size: 30px;
  }

  .flow-status {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 24px;
  }

  .flow-status p { justify-content: space-between; }

  .tabs {
    position: sticky;
    top: 66px;
    z-index: 10;
    padding-top: 12px;
    background: linear-gradient(90deg, rgba(247, 245, 241, .84), rgba(247, 245, 241, .38));
    backdrop-filter: blur(12px);
  }

  .workspace-grid { grid-template-columns: 1fr; }
  .input-column { gap: 38px; }

  .result-panel {
    position: static;
    min-height: 0;
    padding: 0 0 0 20px;
  }

  .type-grid { grid-template-columns: 1fr 1fr; }

  .option-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .option-row > button,
  .choice-group { align-self: stretch; }

  .option-row > button { width: 100%; }
  .choice-group { justify-content: flex-start; }
}

@media (max-width: 430px) {
  .tool-header {
    display: flex;
    justify-content: space-between;
  }

  .office-link { display: none; }
  .type-grid { grid-template-columns: 1fr; }
  .extras-card { grid-template-columns: 1fr; }
  .calculator-intro h1 { font-size: 28px; }
  .result-total strong { font-size: 42px; }
}
