/* 계산기를 중앙에 배치하고 화면 크기에 맞춰 입력 열과 여백을 조정한다. */
:root {
  color-scheme:light;
  --ink:#17263c;
  --muted:#58677c;
  --line:#dce3ed;
  --blue:#245bd5;
  --surface:#fff;
  font-family:system-ui,-apple-system,"Apple SD Gothic Neo","Malgun Gothic",sans-serif;
  font-size:16px;
  background:#f4f7fc;
  color:var(--ink)
}
* {
  box-sizing:border-box
}
body {
  margin:0
}
button,input,select {
  font:inherit
}
button,a,input,select {
  -webkit-tap-highlight-color:transparent
}
button {
  cursor:pointer
}
button:disabled {
  cursor:wait;
  opacity:.65
}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible {
  outline:3px solid #86aaff;
  outline-offset:3px
}
header {
  background:#fff;
  border-bottom:1px solid var(--line);
  padding:24px max(24px,calc((100% - 1200px)/2));
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px
}
.brand {
  color:var(--ink);
  text-decoration:none;
  font-size:1.15rem;
  font-weight:750;
  display:flex;
  align-items:center;
  gap:12px
}
.brand-mark {
  background:var(--blue);
  color:#fff;
  border-radius:10px;
  padding:5px 11px;
  font-size:1.25rem
}
.header-tools,.languages {
  display:flex;
  align-items:center;
  gap:10px
}
.header-note {
  font-size:.875rem;
  color:var(--muted)
}
.languages {
  gap:6px
}
.languages a {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  width:36px;
  height:36px;
  padding:0;
  border:2px solid transparent;
  border-radius:50%;
  background:#f0f3f8;
  font-size:1.2rem;
  line-height:1
}
.languages a:hover {
  background:#e3e9f3
}
.languages a[aria-current=page] {
  border-color:var(--blue);
  background:#eaf1ff
}
.layout {
  max-width:1280px;
  margin:auto;
  display:grid;
  grid-template-columns:minmax(0,800px);
  justify-content:center;
  padding:44px 24px
}
main {
  min-width:0
}
.intro {
  margin-bottom:28px
}
.eyebrow {
  font-weight:700;
  letter-spacing:.13em;
  font-size:.75rem;
  color:var(--blue);
  margin:0 0 12px
}
h1 {
  font-size:clamp(1.45rem,3vw,1.9rem);
  letter-spacing:-.045em;
  margin:0 0 10px
}
p {
  line-height:1.65
}
.intro>p:last-child {
  color:var(--muted);
  margin:0
}
h2 {
  font-size:1.15rem;
  margin:0;
  letter-spacing:-.03em
}
.tabs {
  display:flex;
  gap:6px;
  background:#e7edf7;
  padding:5px;
  border-radius:12px;
  margin-bottom:20px
}
.tabs button {
  flex:1;
  border:0;
  background:transparent;
  color:var(--muted);
  padding:14px 6px;
  border-radius:8px;
  font-weight:650
}
.tabs [aria-selected=true] {
  color:var(--blue);
  background:#fff;
  box-shadow:0 2px 5px #17263c10
}
.card {
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:16px;
  padding:28px
}
.section-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap
}
.section-heading>span {
  font-size:.875rem;
  color:var(--muted)
}
.explanation {
  font-size:.875rem;
  color:var(--muted);
  padding:16px;
  background:#f5f8fd;
  border-radius:8px;
  margin:18px 0 24px
}
.fields {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:22px 20px
}
label,.sell-field {
  display:flex;
  flex-direction:column;
  gap:9px;
  font-size:.875rem;
  font-weight:600;
  min-width:0
}
.input-wrap {
  display:flex;
  align-items:center;
  position:relative
}
.input-wrap>span {
  position:absolute;
  right:14px;
  color:var(--muted);
  font-weight:400
}
input,select {
  background:#fff;
  border:1px solid #c8d2e0;
  border-radius:8px;
  width:100%;
  min-width:0;
  padding:13px 40px 13px 14px;
  color:var(--ink);
  min-height:48px
}
select {
  padding-right:10px
}
input::placeholder {
  color:#738096;
  font-size:.875rem
}
small {
  font-weight:400;
  color:var(--muted);
  font-size:.75rem
}
fieldset {
  border:0;
  border-top:1px solid var(--line);
  padding:24px 0 0;
  margin:26px 0 0
}
legend {
  padding:0 12px 0 0;
  font-weight:650;
  font-size:.95rem
}
.actions {
  display:flex;
  gap:12px;
  margin-top:28px
}
.actions button {
  border-radius:9px;
  border:0;
  padding:15px 18px;
  font-weight:650
}
.primary {
  flex:1;
  background:var(--blue);
  color:white;
  display:flex;
  justify-content:space-between;
  gap:8px
}
.primary:hover {
  background:#1749b6
}
.secondary {
  background:#edf1f7;
  color:var(--muted)
}
.results {
  padding:26px 0 0
}
.result-empty {
  margin-top:16px;
  padding:32px 20px;
  text-align:center;
  border:1px dashed #c8d2e0;
  border-radius:12px;
  color:var(--muted);
  font-size:.875rem
}
.result-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-top:16px
}
.metric {
  border:1px solid var(--line);
  background:white;
  border-radius:12px;
  padding:20px;
  min-width:0
}
.metric dt {
  color:var(--muted);
  font-size:.875rem;
  margin-bottom:10px
}
.metric dd {
  margin:0;
  font-size:1.25rem;
  font-weight:750;
  overflow-wrap:anywhere;
  font-variant-numeric:tabular-nums
}
.metric.featured {
  background:#eaf1ff;
  border-color:#cbdcff
}
.metric.featured dd {
  font-size:1.5rem
}
.positive {
  color:#b22b36
}
.negative {
  color:#245bd5
}
.error {
  background:#fff0f0;
  color:#a5232e;
  padding:12px;
  border-radius:8px;
  font-size:.875rem
}
.session-note {
  font-size:.75rem;
  color:var(--muted);
  margin-top:20px
}
/* 문의 안내는 작은 화면에서도 줄바꿈하고 링크를 명확히 표시한다. */
.footer-contact {
  max-width:800px;
  margin:12px auto 0;
  line-height:1.7;
  overflow-wrap:anywhere
}
.footer-contact a {
  color:var(--blue);
  text-decoration:underline;
  text-underline-offset:3px
}
footer {
  text-align:center;
  color:var(--muted);
  font-size:.75rem;
  padding:20px 24px 32px
}
[hidden] {
  display:none!important
}
.buy-heading {
  display:flex;
  align-items:center;
  min-height:26px
}
.buy-field>.input-wrap {
  margin-top:auto
}
.sell-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap
}
.sell-presets {
  display:flex;
  gap:4px
}
.sell-presets button {
  min-height:26px;
  padding:3px 8px;
  border:1px solid #cbdcff;
  border-radius:6px;
  background:#eaf1ff;
  color:var(--blue);
  font-size:.75rem;
  font-weight:600
}
.sell-presets button:hover {
  background:#dce8ff
}
.currency-picker {
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:8px;
  color:var(--muted);
  font-weight:500
}
.currency-picker select {
  width:auto;
  min-height:38px;
  padding:7px 28px 7px 10px
}
.layout {
  grid-template-columns:minmax(0,800px) 360px;
  align-items:start;
  gap:28px
}
.market-card {
  position:sticky;
  top:24px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  padding:20px;
  min-width:0
}
.market-heading {
  display:flex;
  align-items:center;
  justify-content:space-between
}
.market-heading button {
  border:0;
  border-radius:50%;
  background:#edf1f7;
  color:var(--blue);
  width:34px;
  height:34px;
  font-size:1.25rem
}
.market-base {
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:space-between;
  color:var(--muted);
  font-size:.75rem;
  margin:8px 0 14px
}
.market-base select {
  width:auto;
  min-height:36px;
  padding:6px 28px 6px 8px;
  font-size:.75rem
}
.market-card table {
  width:100%;
  border-collapse:collapse;
  font-size:.8rem
}
.market-card th,.market-card td {
  padding:9px 4px;
  border-bottom:1px solid var(--line);
  text-align:left
}
.market-card th {
  overflow-wrap:anywhere
}
.market-card td {
  text-align:right;
  font-variant-numeric:tabular-nums;
  white-space:nowrap
}
.market-card thead th {
  color:var(--muted);
  font-weight:500
}
.market-card thead th:last-child {
  text-align:right
}
.market-times,.market-error,.market-sources {
  font-size:.68rem;
  color:var(--muted);
  margin:12px 0 0
}
.market-times p {
  margin:3px 0;
  line-height:1.4
}
.market-error {
  color:#a5232e
}
.market-sources a {
  color:var(--blue)
}
@media(max-width:1100px) {
  .layout {
    grid-template-columns:minmax(0,800px);
    justify-content:center
  }
  .market-card {
    position:static
  }
  .market-card table {
    font-size:.85rem
  }
}
@media(max-width:700px) {
  header {
    align-items:flex-start;
    padding:18px 16px
  }
  .brand {
    font-size:1rem;
    gap:8px
  }
  .brand span:last-child {
    max-width:180px
  }
  .header-tools {
    flex-direction:column;
    align-items:flex-end
  }
  .header-note {
    display:none
  }
}
@media(max-width:540px) {
  .languages {
    gap:3px
  }
  .languages a {
    width:32px;
    height:32px;
    font-size:1rem
  }
  .layout {
    padding:28px 16px
  }
  .card {
    padding:20px
  }
  .fields {
    grid-template-columns:1fr;
    gap:18px
  }
  .section-heading>span {
    font-size:.75rem
  }
  .actions {
    flex-direction:column
  }
  .result-grid {
    grid-template-columns:1fr
  }
  .tabs button {
    font-size:.875rem
  }
  .intro>p:last-child {
    font-size:.875rem
  }
}
@media(max-width:540px) {
  .brand span:last-child {
    display:none
  }
}

/* 세금 폼은 조건부 2열 배치와 터치 가능한 도움말을 제공한다. */
.tax-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px 18px
}
.tax-field {
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:.8rem
}
.tax-field input,.tax-field select {
  width:100%;
  min-width:0;
  min-height:42px;
  box-sizing:border-box
}
.tax-check {
  flex-direction:row-reverse;
  justify-content:flex-end;
  align-items:center
}
.tax-check input {
  width:18px;
  padding:0;
  min-height:18px;
  flex-shrink:0
}
.tax-warning,.tax-warnings {
  padding:12px 16px;
  border-left:3px solid #c68c28;
  background:#fff8e8;
  color:#674c19;
  font-size:.8rem;
  line-height:1.65
}
.tax-warnings {
  padding-left:28px
}
.tax-warnings li+li {
  margin-top:8px
}
.tax-muted,.tax-sources,.tax-help {
  font-size:.78rem;
  line-height:1.7;
  overflow-wrap:anywhere
}
.tax-muted {
  color:var(--muted)
}
.tax-help {
  margin:18px 0;
  padding:10px 14px;
  background:#f4f7fc;
  border:1px solid var(--line);
  border-radius:8px
}
.tax-help summary {
  cursor:pointer;
  padding:5px 0;
  font-weight:600
}
#tax-form fieldset {
  min-width:0;
  margin:20px 0;
  padding:16px;
  border:1px solid var(--line);
  border-radius:10px
}
#tax-form legend {
  font-size:.85rem;
  font-weight:600;
  padding:0 6px
}
#tax-form .tax-lot {
  margin-top:8px
}
.tax-remove {
  margin-top:12px
}
.tax-results {
  margin-top:28px;
  border-top:1px solid var(--line);
  padding-top:12px
}
.tax-status {
  color:var(--blue);
  font-weight:700
}
.tax-sources a {
  color:var(--blue)
}
@media(max-width:600px) {
  .tax-grid {
    grid-template-columns:minmax(0,1fr)
  }
  #tax-form fieldset {
    padding:12px
  }
  .tabs button {
    padding:12px 10px;
    min-width:0;
    overflow-wrap:anywhere
  }
}

/* 세금 입력의 필수 표시·총액 보조 체크·내역 버튼을 공통 사이트 스타일에 맞춘다. */
.tax-input-label {
  display:flex;
  flex-direction:column;
  gap:6px
}
.tax-input-label:has(> :required) > span::before {
  content:"* ";
  color:var(--blue)
}
.tax-check > .tax-input-label {
  flex-direction:row-reverse;
  justify-content:flex-end;
  align-items:center
}
.tax-inline-check {
  display:flex;
  flex-direction:row;
  gap:6px;
  font-size:.72rem;
  color:var(--muted);
  line-height:1.5
}
.tax-inline-check input {
  width:14px;
  min-height:14px;
  height:14px;
  margin:0
}
#tax-add-lot,.tax-remove {
  border:0;
  border-radius:9px;
  padding:10px 16px;
  font-size:.8rem;
  font-weight:650
}
#tax-add-lot:hover:not(:disabled),.tax-remove:hover:not(:disabled) {
  background:#e1e8f2;
  color:var(--blue)
}

/* 변경된 세법 안내는 붉은 배경을 유지하고 변경 순간에만 짧게 강조한다. */
#tax-rule-note[data-changed] {
  background:#fff0f0;
  border-left:4px solid #c43b3b;
  color:#8f2424;
  font-weight:600
}
#tax-rule-note[data-changed="odd"] {
  animation:tax-note-odd .65s ease-out
}
#tax-rule-note[data-changed="even"] {
  animation:tax-note-even .65s ease-out
}
@keyframes tax-note-odd {
  from {box-shadow:0 0 0 3px #c43b3b55}
  to {box-shadow:0 0 0 0 transparent}
}
@keyframes tax-note-even {
  from {box-shadow:0 0 0 3px #c43b3b55}
  to {box-shadow:0 0 0 0 transparent}
}
@media(prefers-reduced-motion:reduce) {
  #tax-rule-note[data-changed] {animation:none}
}

/* 총액에 포함된 직접 수수료는 수정 불가한 텍스트 상태를 명확히 표시한다. */
.tax-field input[readonly] {
  background:#edf1f7;
  color:var(--muted);
  border-color:transparent;
  box-shadow:none;
  cursor:default
}

/* 세금 제목·검증 정보를 정렬하고 입력 폼과의 간격을 8px 넓힌다. */
#tax-panel > .section-heading {
  justify-content:flex-start;
  margin-bottom:8px
}
#tax-verified {
  margin:0 0 0 auto;
  text-align:right
}
