/* Расчёт в Корее — визуальная система «линия маршрута».
   Удержания показаны как станции на линии от начисленной суммы до суммы на руки. */

:root {
  color-scheme: light;
  --paper: #EDF1EE;
  --surface: #FFFFFF;
  --ink: #10233F;
  --muted: #5B6878;
  --line: #00A650;
  --line-soft: #CFE9DA;
  --signal: #F5A300;
  --rule: #D5DDD8;
  --radius-panel: 22px;
  --radius-field: 12px;
  --font: "Onest", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system, "Segoe UI", sans-serif;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.2rem;
  --step-4: clamp(2.4rem, 6vw, 3.6rem);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3 { word-break: keep-all; overflow-wrap: break-word; }
h1, h2 { text-wrap: balance; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  font-feature-settings: "tnum" 1;
}
a { color: var(--ink); text-decoration-color: var(--line); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: #00843F; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 6px; }
img, svg { display: block; }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }

/* Шапка */
.site-head { padding: 1.1rem 0; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.05rem; text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.site-nav { display: flex; gap: .25rem 1.1rem; flex-wrap: wrap; font-size: var(--step--1); }
.site-nav a { text-decoration: none; color: var(--muted); font-weight: 500; padding: .2rem 0; }
.site-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--line); }

/* Заголовок страницы */
.intro { padding: 1.5rem 0 1.75rem; max-width: 46rem; }
.intro h1 {
  font-size: var(--step-4);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 800;
  margin: 0 0 .9rem;
}
.intro p { margin: 0; color: var(--muted); font-size: var(--step-1); line-height: 1.45; max-width: 38rem; }

/* Калькулятор */
.calc { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 900px) {
  .calc { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2.5rem; }
  .calc .route-panel { position: sticky; top: 1rem; }
}

.panel { background: var(--surface); border-radius: var(--radius-panel); padding: 1.4rem; }
@media (min-width: 600px) { .panel { padding: 1.9rem; } }

.field { display: grid; gap: .4rem; margin-bottom: 1.15rem; }
.field > label, .field > .label { font-weight: 600; font-size: var(--step--1); }
.hint { color: var(--muted); font-size: var(--step--1); line-height: 1.45; margin: 0; }
.hint b { color: var(--ink); font-weight: 600; }

.money { position: relative; }
.money input { padding-right: 2.6rem; }
.money::after { content: "₩"; position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }

input[type="text"], input[type="number"], input[type="date"], select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid transparent;
  border-radius: var(--radius-field);
  padding: .8rem 1rem;
  min-height: 3.1rem;
  appearance: none;
  -webkit-appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2310233F' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem; }
input:hover, select:hover { border-color: var(--rule); }
input:focus, select:focus { outline: none; border-color: var(--line); background-color: #fff; }
.big input { font-size: var(--step-2); font-weight: 700; letter-spacing: -0.02em; min-height: 3.8rem; }

.row2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: .75rem; align-items: end; }
input[type="date"] { min-width: 0; }
@media (max-width: 480px) { .row2.dates, .row2.stack-m { grid-template-columns: minmax(0,1fr); gap: 0; } }
@media (max-width: 420px) { select { padding-left: .8rem; padding-right: 2rem; background-position: right .7rem center; } }

/* Переключатель режима */
.seg { display: inline-flex; background: var(--paper); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: .45rem .95rem; border-radius: 999px; cursor: pointer; font-size: var(--step--1); font-weight: 600; color: var(--muted); }
.seg input:checked + label { background: var(--ink); color: #fff; }
.seg input:focus-visible + label { outline: 3px solid var(--signal); outline-offset: 1px; }

/* Флажки как тумблеры */
.toggle { display: flex; gap: .8rem; align-items: flex-start; cursor: pointer; margin-bottom: .9rem; }
.toggle input { position: absolute; opacity: 0; }
.toggle .sw { flex: none; width: 2.6rem; height: 1.5rem; border-radius: 999px; background: var(--rule); position: relative; margin-top: .1rem; transition: background .15s; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 1.125rem; height: 1.125rem; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + .sw { background: var(--line); }
.toggle input:checked + .sw::after { transform: translateX(1.1rem); }
.toggle input:focus-visible + .sw { outline: 3px solid var(--signal); outline-offset: 2px; }
.toggle .txt { font-size: var(--step--1); line-height: 1.4; }
.toggle .txt strong { display: block; font-size: var(--step-0); font-weight: 600; }

details.more { border-top: 1px solid var(--rule); padding-top: .9rem; margin-top: .4rem; }
details.more > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--muted); }
details.more[open] > summary::after { content: "–"; }
details.more .inner { padding-top: 1rem; }

/* Линия маршрута */
.route-panel { padding-top: .25rem; }
.route { list-style: none; margin: 0; padding: 0; position: relative; }
.route::before {
  content: ""; position: absolute; left: 13px; top: 14px; bottom: 30px; width: 6px;
  background: var(--line); border-radius: 3px; transform-origin: top;
}
.route li { position: relative; display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; padding: .55rem 0 .55rem 3rem; align-items: baseline; }
.route li::before {
  content: ""; position: absolute; left: 5px; top: .85rem; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 5px solid var(--line); box-sizing: border-box;
}
.route .name { font-weight: 600; }
.route .ko { color: var(--muted); font-weight: 400; font-size: var(--step--1); margin-left: .35rem; }
.route .note { grid-column: 1 / -1; color: var(--muted); font-size: var(--step--1); line-height: 1.4; }
.route .amt { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.route li.off { opacity: .45; }
.route li.off .amt { text-decoration: line-through; }

.route li.origin::before { width: 28px; height: 28px; left: 2px; top: .7rem; border-width: 7px; border-color: var(--ink); }
.route li.origin .amt { font-size: var(--step-1); font-weight: 700; }
.route li.origin .name { font-size: var(--step-1); }

.route li.terminal { padding-top: 1.1rem; }
.route li.terminal::before { width: 32px; height: 32px; left: 0; top: 1.35rem; background: var(--line); border: 7px solid var(--ink); }
.route li.terminal .name { font-size: var(--step-1); font-weight: 700; align-self: center; }
.net {
  grid-column: 1 / -1; font-size: clamp(2.6rem, 9vw, 4.2rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1;
  margin-top: .15rem;
}
.net small { font-size: .42em; letter-spacing: 0; font-weight: 700; margin-left: .2em; }
.after-net { grid-column: 1 / -1; color: var(--muted); font-size: var(--step--1); margin-top: .35rem; }

@media (prefers-reduced-motion: no-preference) {
  .route.draw::before { animation: draw .9s cubic-bezier(.3,.7,.2,1) both; }
  @keyframes draw { from { transform: scaleY(0); } to { transform: scaleY(1); } }
}

/* Валюта и предупреждения */
.fx { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: 1rem 0 0 3rem; font-size: var(--step--1); color: var(--muted); }
.fx b { color: var(--ink); font-weight: 600; }
.warn { background: #FFF4D6; border-left: 5px solid var(--signal); border-radius: 0 12px 12px 0; padding: .8rem 1rem; font-size: var(--step--1); margin: 1rem 0 0; }
.warn:empty { display: none; }

/* Поделиться */
.share { display: flex; gap: .6rem; flex-wrap: wrap; margin: 1.4rem 0 0 3rem; }
.btn {
  font: inherit; font-weight: 600; font-size: var(--step--1); border: 0; cursor: pointer; border-radius: 999px;
  padding: .75rem 1.2rem; background: var(--ink); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: .5rem;
}
.btn:hover { background: #1C3961; color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.ghost:hover { background: var(--ink); color: #fff; }
.btn.go { background: var(--line); color: #fff; }

/* Пересадки на другие калькуляторы */
.transfers { margin: 3.5rem 0 0; }
.transfers h2, .content h2 { font-size: var(--step-2); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 1rem; }
.transfer-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .25rem 2rem; }
@media (min-width: 700px) { .transfer-list { grid-template-columns: 1fr 1fr; } }
.transfer-list a { display: grid; grid-template-columns: auto 1fr; gap: .1rem .9rem; padding: .8rem 0; text-decoration: none; border-bottom: 1px solid var(--rule); }
.transfer-list a::before {
  content: ""; grid-row: span 2; width: 20px; height: 20px; border-radius: 50%; margin-top: .2rem;
  border: 4px solid var(--ink); box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--line);
}
.transfer-list strong { font-weight: 700; }
.transfer-list span { color: var(--muted); font-size: var(--step--1); }
.transfer-list a:hover strong { color: #00843F; }

/* Текстовая часть */
.content { margin: 3.5rem 0 0; max-width: 44rem; }
.content p, .content li { line-height: 1.65; }
.content h3 { font-size: var(--step-1); margin: 1.8rem 0 .5rem; letter-spacing: -0.01em; }
.faq details { border-bottom: 1px solid var(--rule); padding: .95rem 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: .6rem 0 0; color: #2B3B52; }

table.plain { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; margin: .5rem 0 1rem; }
table.plain th, table.plain td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--rule); }
table.plain td:last-child, table.plain th:last-child { text-align: right; }
table.plain td:last-child { white-space: nowrap; padding-left: 1rem; }
table.plain th { font-size: var(--step--1); color: var(--muted); font-weight: 600; }

/* Партнёрский блок и реклама: скрыты, пока не настроены в config.js */
.partners { margin: 2.5rem 0 0; display: none; }
.partners.on { display: block; }
.partners ul { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.ad-slot { display: none; margin: 2rem 0; min-height: 100px; }
.ad-slot.on { display: block; }

.site-foot { margin-top: 4rem; padding: 2rem 0 3rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: var(--step--1); }
.site-foot p { margin: 0 0 .5rem; max-width: 46rem; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
