:root {
  color-scheme: light;
  --ink: #211b33;
  --muted: #625c73;
  --accent: #663cce;
  --accent-dark: #4d27a8;
  --surface: #fff;
  --background: #f8f7fc;
  --line: #e6e1ef;
  font-family: 'DM Sans', 'Noto Sans KR', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  background: var(--background);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 22px; }
body { margin: 0; }
main { min-height: 65vh; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button, input, select { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #7445db; outline-offset: 4px; }
.shell { width: min(1180px, calc(100% - 80px)); margin-inline: auto; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 5; top: 12px; left: 12px; background: var(--surface); padding: 12px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 850; letter-spacing: -.07em; white-space: nowrap; }
.brand-icon { display: grid; place-items: center; width: 35px; height: 35px; background: var(--accent); color: white; border-radius: 11px; }
.brand-dot { color: var(--accent); }
.site-header nav, .site-footer nav { display: flex; flex-wrap: wrap; gap: 26px; color: var(--muted); font-weight: 630; font-size: 14px; }
.site-header nav a:hover, .site-footer nav a:hover { color: var(--accent); }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: 389px;
  margin-top: 34px;
  padding: 48px 6%;
  border: 1px solid #e9dfff;
  border-radius: 30px;
  background: linear-gradient(105deg, #f3eeff 6%, #eee5ff 52%, #e0ccff 100%);
}
.hero-copy { position: relative; z-index: 1; width: 53%; }
.hero h1 { font-size: clamp(35px, 4.8vw, 63px); font-weight: 850; letter-spacing: -.095em; line-height: 1.15; word-break: keep-all; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero-copy p { color: #554764; font-size: 16px; line-height: 1.8; margin: 23px 0 25px; word-break: keep-all; }
.hero-break { display: none; }
.search-box { display: flex; align-items: center; gap: 10px; width: min(100%, 420px); padding: 6px 12px 6px 15px; min-height: 54px; background: #fff; border: 1px solid #e2d8f5; border-radius: 13px; color: var(--accent); box-shadow: 0 8px 18px #4b2a9610; }
.search-box:focus-within { outline: 2px solid var(--accent); }
.search-box input { min-width: 0; flex: 1; padding: 8px 0; border: 0; outline: none; color: var(--ink); font-size: 14px; background: transparent; }
.search-box input::placeholder { color: #6e657d; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box kbd, .search-box button { display: grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; border: 0; border-radius: 5px; background: #f1ebfb; color: #624b80; }
.search-box button { font-size: 20px; }

.hero-art { position: absolute; z-index: 0; inset: 0 0 0 51%; }
.hero-art::before { content: ''; position: absolute; inset: 10px 4% 10px 0; background: radial-gradient(circle, #a881ff78, transparent 68%); }
.orbit { position: absolute; left: 51%; top: 53%; border: 1px solid #9c6ce94d; border-radius: 50%; transform: translate(-50%, -50%) rotate(-22deg); }
.orbit-large { width: 88%; height: 67%; }
.orbit-small { width: 72%; height: 55%; }
.illustration-calc { position: absolute; left: 51%; top: 49%; width: 172px; padding: 12px; border: 1px solid #dbc4ff; border-radius: 22px; transform: translate(-50%, -50%) rotate(-13deg); background: linear-gradient(155deg, #9c76f1 4%, #7244d8 62%, #592abc); box-shadow: 8px 12px 0 #4d279d, 22px 28px 44px #52309565, inset 0 1px 1px #fff6; }
.calc-display { height: 68px; padding: 9px 11px; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; border-radius: 12px; background: #2d174e; color: #fff; font-family: 'IBM Plex Mono', Consolas, monospace; }
.calc-display span { color: #dbbeff; font-size: 12px; }
.calc-display strong { font-size: 36px; line-height: .98; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 9px; }
.calc-keys i { display: grid; place-items: center; height: 25px; font: 600 12px/1 Consolas, monospace; border-radius: 6px; color: #40227a; background: #f1e8ff; box-shadow: 0 2px #5930aa; }
.calc-keys i:nth-child(4n) { background: #d9c5ff; }
.calc-keys .zero { grid-column: span 2; }
.calc-keys .equals { background: #f9dc85; }
.math-token { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #ffffffae; border-radius: 13px; box-shadow: 2px 6px 18px #5d299b35; font: 700 25px/1 Consolas, monospace; }
.token-percent { left: 18%; top: 21%; transform: rotate(-17deg); color: #7444c2; background: #faf1ff; }
.token-plus { right: 18%; top: 16%; transform: rotate(15deg); color: #7f53d3; background: #f2e3ff; }
.token-divide { right: 15%; bottom: 20%; transform: rotate(11deg); color: #7152aa; background: #f8eefa; }
.spark { position: absolute; color: #8555dc; }
.spark-one { right: 12%; top: 39%; font-size: 21px; }
.spark-two { left: 24%; bottom: 21%; font-size: 18px; }
.spark-three { right: 34%; bottom: 12%; font-size: 18px; }

.catalog { margin: 43px 0 63px; }
.catalog-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.catalog-heading h2, .related h2 { font-size: 29px; font-weight: 820; letter-spacing: -.07em; }
.catalog-heading span { color: var(--muted); font-size: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 23px; }
.filter { display: inline-flex; align-items: center; gap: 6px; min-height: 39px; padding: 6px 16px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: #524763; font-size: 14px; font-weight: 700; }
.filter:hover { border-color: var(--accent); color: var(--accent-dark); }
.filter[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: white; }
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.tool-card { position: relative; display: block; min-height: 153px; padding: 19px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 4px 10px #28134a04; transition: transform .16s, border-color .16s, box-shadow .16s; }
.tool-card:hover { transform: translateY(-3px); border-color: #c2acef; box-shadow: 0 10px 20px #38175a10; }
.tile-icon { display: inline-grid; place-items: center; width: 43px; height: 43px; border-radius: 12px; flex: none; }
.tile-icon.money { color: #6341ad; background: #eee5ff; }
.tile-icon.daily { color: #9c4f27; background: #fff0e4; }
.tile-icon.date { color: #3463ad; background: #e9f1ff; }
.tile-icon.convert { color: #236a54; background: #e1f6ee; }
.tile-arrow { position: absolute; top: 20px; right: 19px; color: #888095; }
.tool-card:hover .tile-arrow { color: var(--accent-dark); }
.tool-card h3 { margin: 12px 0 5px; font-size: 18px; letter-spacing: -.055em; }
.tool-card p { color: var(--muted); font-size: 13px; line-height: 1.55; word-break: keep-all; }
.empty { padding: 40px 20px; text-align: center; border: 1px dashed #cfc1e6; border-radius: 15px; }
.empty p { color: var(--muted); margin-top: 8px; }

.site-footer { background: #f2eff8; border-top: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; gap: 19px; padding-block: 25px; }
.footer-inner p { color: var(--muted); font-size: 13px; }
.footer-inner nav { margin-left: auto; }

.detail { padding: 30px 0 60px; max-width: 940px; }
.back { display: inline-flex; align-items: center; gap: 7px; color: var(--accent-dark); font-size: 14px; font-weight: 700; }
.back:hover { text-decoration: underline; }
.detail-heading { display: flex; align-items: center; gap: 15px; margin: 24px 0; }
.detail-heading .tile-icon { width: 54px; height: 54px; }
.detail h1 { font-size: clamp(28px, 4.6vw, 47px); font-weight: 850; letter-spacing: -.08em; line-height: 1.21; }
.detail-heading p { margin-top: 8px; color: var(--muted); line-height: 1.6; word-break: keep-all; }
.workbench { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 18px; }
.calculator, .results, .explanation { background: var(--surface); border: 1px solid var(--line); border-radius: 19px; padding: clamp(18px, 3.2vw, 34px); }
.calculator h2, .results h2, .explanation h2, .prose h2 { font-size: 23px; letter-spacing: -.06em; }
.field { margin-top: 16px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.input-wrap { position: relative; }
.input-wrap input, .input-wrap select { min-height: 46px; width: 100%; background: #fbfaff; border: 1px solid #dcd4e9; border-radius: 9px; padding: 8px 12px; }
.input-wrap input:has(+ span) { padding-right: 57px; }
.input-wrap span { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); pointer-events: none; color: var(--muted); font-size: 13px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 21px; }
.form-actions button { min-height: 45px; padding: 8px 16px; display: inline-flex; align-items: center; gap: 8px; border-radius: 9px; font-weight: 700; }
.primary { background: var(--accent); color: white; border: 1px solid var(--accent); }
.primary:hover { background: var(--accent-dark); }
.primary:disabled { opacity: .55; cursor: not-allowed; }
.primary:disabled:hover { background: var(--accent); }
.secondary { background: #fff; color: var(--accent-dark); border: 1px solid var(--line); }
.secondary:hover { border-color: var(--accent); }
.error, .field-error { color: #a2243e; font-size: 14px; line-height: 1.5; }
.error:not(:empty) { margin-top: 13px; }
.field-error:not(:empty) { margin-top: 6px; }
.input-wrap [aria-invalid=true] { border-color: #a2243e; }
.results { background: linear-gradient(135deg, #f0eaff, #f9f5ff); border-color: #e4d7f8; }
.results dl { margin: 17px 0 0; }
.results dl div { padding: 12px 0; border-bottom: 1px solid #dfd2f0; }
.results dl div:last-child { border-bottom: 0; }
.results dt { color: #57476b; font-size: 14px; font-weight: 700; }
.results dd { margin: 5px 0 0; color: var(--accent-dark); font-size: clamp(18px, 3vw, 30px); font-weight: 800; word-break: keep-all; overflow-wrap: anywhere; }
.results dl div:first-child dd { font-size: clamp(25px, 4vw, 42px); }
.results .waiting { display: none; color: var(--muted); }
.results dl:empty + .waiting { display: block; }
.results .unready { color: var(--muted); }
.results .unready ~ p.waiting { display: none; }
.results .result-note { margin-top: 14px; color: #57476b; font-size: 14px; line-height: 1.7; word-break: keep-all; }
/* 결과 아래에 덧붙이는 표와 안내(연차의 첫 1년 발생표). 비어 있으면 자리를 차지하지 않는다. */
.results .result-extra:empty { display: none; }
.results .result-extra { margin-top: 16px; }
.results .result-extra .table-scroll { overflow-x: auto; }
.results .result-extra .table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.results .result-extra table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.results .result-extra caption { padding-bottom: 6px; color: #57476b; font-size: 14px; font-weight: 700; text-align: left; }
.results .result-extra th, .results .result-extra td { padding: 7px 8px; border-bottom: 1px solid #dfd2f0; text-align: left; white-space: nowrap; }
.results .result-extra th { color: #57476b; font-size: 13px; }
.results .result-extra p { margin-top: 10px; color: #57476b; font-size: 14px; line-height: 1.7; word-break: keep-all; }
.explanation { margin-top: 18px; }
.explanation p, .prose p { color: var(--muted); line-height: 1.8; word-break: keep-all; }
.explanation .formula { margin: 11px 0; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.explanation .formula + .formula { margin-top: -5px; }
.explanation p + p { margin-top: 6px; }
.explanation ul { margin: 11px 0 0; padding-left: 20px; color: var(--muted); line-height: 1.8; word-break: keep-all; }
.explanation li + li { margin-top: 5px; }
.explanation .table-caption { margin: 13px 0 8px; font-size: 14px; line-height: 1.6; }
.explanation .table-scroll { overflow-x: auto; margin: 0 0 12px; }
.explanation .table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.explanation table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.explanation caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.explanation th, .explanation td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.explanation th { color: #57476b; font-size: 14px; background: #faf8fe; }
/* 문장이 긴 표(연차): 칸 안에서 줄을 바꾸고 왼쪽으로 맞춘다. 낱말 중간에서는 끊지 않는다. */
.explanation table.wrap th, .explanation table.wrap td { text-align: left; }
.explanation table.wrap td { white-space: normal; word-break: keep-all; min-width: 7.5em; vertical-align: top; }
.explanation .sources-title { margin-top: 11px; color: #57476b; font-size: 14px; font-weight: 700; }
.explanation .sources { margin-top: 2px; font-size: 14px; }
.explanation .sources a { color: var(--accent-dark); text-decoration: underline; overflow-wrap: anywhere; }
.explanation .reviewed { margin-top: 11px; font-size: 14px; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 14px; font-weight: 700; }
.breadcrumb li + li::before { content: '›'; margin-right: 7px; color: #9a92a8; }
.breadcrumb a { color: var(--accent-dark); }
.breadcrumb a:hover { text-decoration: underline; }
.standards { margin: 0 0 63px; padding: clamp(18px, 3.2vw, 34px); background: var(--surface); border: 1px solid var(--line); border-radius: 19px; }
.standards h2 { font-size: 23px; letter-spacing: -.06em; }
.standards p { margin: 9px 0 14px; color: var(--muted); line-height: 1.8; word-break: keep-all; }
.related { margin-top: 32px; }
.related h2 { margin-bottom: 13px; }
.related .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.prose { max-width: 760px; }
.prose h1 { margin: 19px 0; }
.prose h2 { margin: 25px 0 6px; }
.prose p a { color: var(--accent-dark); text-decoration: underline; }
.prose p + .back { margin-top: 18px; }

@media (max-width: 920px) {
  .shell { width: calc(100% - 52px); }
  .hero-break { display: initial; }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .illustration-calc { width: 151px; }
  .token-percent { left: 10%; }
  .token-plus, .token-divide { right: 10%; }
}

@media (max-width: 640px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 60px; }
  .brand { font-size: 18px; gap: 7px; }
  .brand-icon { width: 31px; height: 31px; border-radius: 9px; }
  .site-header nav, .site-footer nav { gap: 14px; font-size: 12px; }
  .hero { min-height: 0; margin-top: 17px; padding: 26px 20px; border-radius: 20px; }
  .hero-copy { width: 100%; }
  .hero h1 { font-size: clamp(29px, 7.9vw, 43px); }
  .hero-copy p { margin: 14px 0 19px; font-size: 14px; }
  .hero-art { display: none; }
  .search-box kbd { display: none; }
  .catalog { margin: 27px 0 39px; }
  .catalog-heading h2, .related h2 { font-size: 24px; }
  .filters { gap: 6px; margin-bottom: 15px; }
  .filter { padding-inline: 11px; font-size: 12px; min-height: 36px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .tool-card { padding: 13px; min-height: 143px; border-radius: 13px; }
  .tile-arrow { top: 15px; right: 13px; }
  .tool-card h3 { font-size: 15px; margin-top: 9px; word-break: keep-all; }
  .tool-card p { font-size: 12px; }
  .tile-icon { width: 36px; height: 36px; border-radius: 9px; }
  .tile-icon svg { width: 20px; height: 20px; }
  .footer-inner { flex-wrap: wrap; gap: 10px; }
  .footer-inner nav { width: 100%; margin: 0; }
  .detail { padding-top: 21px; }
  .detail-heading { margin-block: 18px; }
  .detail-heading .tile-icon { width: 43px; height: 43px; }
  /* minmax(0, 1fr): 칸 안의 넓은 내용(결과 아래의 표)이 칸을 화면 밖으로 밀어내지 않게 한다. 넓은 표는 그 안에서 가로로 넘긴다. */
  .workbench { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .explanation th, .explanation td { padding: 8px 5px; font-size: 13px; }
  .standards { margin-bottom: 39px; }
}

@media (prefers-reduced-motion: reduce) { .tool-card { transition: none; } }
