:root {
  --bg: #0e1726;
  --bg-2: #14203360;
  --panel: #16223a;
  --panel-2: #1c2c49;
  --line: #28395c;
  --ink: #eaf0fb;
  --ink-soft: #9fb0cc;
  --mint: #34d8a8;
  --mint-deep: #1fae86;
  --blue: #5b9bff;
  --neg: #ff7a85;
  --radius: 16px;
}
/* ===== 3-way theme (Light/Dark/System) — base :root above = native DARK. Opposite (light) WCAG-aware auto-generated (contrast-solving ink/accent vs worst-case surface). ===== */
:root[data-theme="light"]{
  --bg: #f4f5f6;
  --bg-2: #f5f6f7;
  --panel: #f6f6f8;
  --panel-2: #f9f9fa;
  --line: rgba(0,0,0,0.10);
  --ink: #1f4ea3;
  --ink-soft: #536e9c;
  --mint: #177a5d;
  --mint-deep: #167a5e;
  --blue: #0060f6;
  --neg: #da0012;
}










:root[data-theme="light"]{
  --bg:#f5f7fb; --bg-2:#eaeef5; --panel:#ffffff; --panel-2:#eef2f8; --line:#dde4ee;
  --ink:#0e1726; --ink-soft:#5b6b86; --mint:#0e9f6e#0a754e; --mint-deep:#0b7d56; --blue:#2563eb;
  --neg:#dc2640; --radius:16px;
}
:root[data-theme="light"] body{
  background:
    radial-gradient(1000px 600px at 85% -10%, rgba(14,159,110,.07) 0%, transparent 55%),
    radial-gradient(800px 500px at -5% 110%, rgba(37,99,235,.06) 0%, transparent 50%),
    var(--bg);
}
.theme-switch{
  --theme-switch-bg:var(--panel); --theme-switch-border:var(--line); --theme-switch-fg:var(--ink);
  --theme-switch-active-bg:var(--mint); --theme-switch-active-fg:#06231b; --theme-switch-radius:10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; } /* 명시적 display가 [hidden]을 무력화하지 않도록 */

body {
  font-family: "Inter", system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background:
    radial-gradient(1000px 600px at 85% -10%, #1a2c4a 0%, transparent 55%),
    radial-gradient(800px 500px at -5% 110%, #15314a 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
b, h1, h2, h3 { font-weight: 700; }

.topbar { max-width: 760px; margin: 0 auto; padding: 26px clamp(16px, 5vw, 32px) 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.i18n-switch {
  --i18n-switch-bg: rgba(255,255,255,.06);
  --i18n-switch-border: var(--line);
  --i18n-switch-fg: var(--ink);
  --i18n-switch-active-bg: rgba(52,216,168,.2);
  --i18n-switch-active-fg: var(--mint);
  --i18n-switch-menu-bg: var(--panel-2);
  --i18n-switch-menu-border: var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 26px; font-weight: 700; color: #06231b;
  background: linear-gradient(150deg, var(--mint), var(--mint-deep));
  box-shadow: 0 10px 26px -12px rgba(52,216,168,.7);
}
.brand h1 { font-size: 22px; letter-spacing: -.01em; }
.brand p { font-size: 13px; color: var(--ink-soft); }
.basis { color: var(--mint); }

.tabs {
  position: sticky; top: 0; z-index: 5;
  max-width: 760px; margin: 0 auto; padding: 10px clamp(16px, 5vw, 32px);
  display: flex; gap: 6px; overflow-x: auto;
  background: linear-gradient(var(--bg), var(--bg) 70%, transparent);
  /* 스크롤 힌트: 우측 페이드 — 잘린 탭이 더 있음을 알림 (design-review) */
  mask-image: linear-gradient(90deg, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.tab {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink-soft); font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 9px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  transition: all .15s ease;
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--mint); color: #06231b; border-color: var(--mint); }

.wrap { max-width: 760px; margin: 0 auto; padding: 8px clamp(16px, 5vw, 32px) 60px; }

/* Inputs */
.inputs {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr);
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 13px; color: var(--ink-soft); }
.field em { font-style: normal; color: var(--blue); font-size: 12px; margin-left: 4px; }
.money { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; }
.money:focus-within { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(52,216,168,.15); }
.money input {
  flex: 1; min-width: 0; background: transparent; border: 0; color: var(--ink);
  font-family: "IBM Plex Mono", monospace; font-size: 18px; font-weight: 600;
  padding: 12px 0; text-align: right;
}
.money input:focus { outline: none; }
.money b { color: var(--ink-soft); font-size: 14px; margin-left: 8px; font-weight: 500; }
select.money, .field select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px;
  color: var(--ink); font-family: inherit; font-size: 16px; padding: 12px;
}

.seg { grid-column: 1 / -1; display: flex; gap: 8px; }
.seg-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink-soft);
  font-family: inherit; font-size: 15px; font-weight: 600; padding: 11px; border-radius: 11px; cursor: pointer;
  transition: all .15s ease;
}
.seg-btn small { font-weight: 400; font-size: 11px; opacity: .8; }
.seg-btn.is-on { background: var(--panel-2); border-color: var(--mint); color: var(--ink); }

/* Output */
.output { margin-top: 18px; display: grid; gap: 14px; }
.hero-result {
  background: linear-gradient(150deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
}
.hero-result::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(52,216,168,.18), transparent 70%);
}
.hr-label { font-size: 13px; color: var(--ink-soft); }
.hr-value { font-family: "IBM Plex Mono", monospace; font-size: clamp(28px, 7vw, 40px); font-weight: 600; color: var(--mint); letter-spacing: -.02em; }
.hr-sub { font-size: 13px; color: var(--ink-soft); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 3px;
}
.s-label { font-size: 12px; color: var(--ink-soft); }
.s-value { font-family: "IBM Plex Mono", monospace; font-size: 18px; font-weight: 600; }
.s-sub { font-size: 11.5px; color: var(--mint); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.card-head h3 { font-size: 14px; }
.card-head span { font-size: 12px; color: var(--ink-soft); }
.bd-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.bd-row span:first-child { color: var(--ink-soft); }
.bd-row span:last-child { font-family: "IBM Plex Mono", monospace; font-weight: 600; }
.bd-row .neg { color: var(--neg); }
.bd-row.total { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 10px; }
.bd-row.total span:first-child { color: var(--ink); font-weight: 600; }
.bd-row.total span:last-child { color: var(--mint); }

.tl-row { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.tl-k { color: var(--ink-soft); }
.tl-bar { height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.tl-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint-deep), var(--mint)); border-radius: 6px; }
.tl-v { font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 12.5px; }

/* 연봉 정밀 모드 세그먼트 (KR 엔진에서만 노출) */
.salary-mode { display: flex; gap: 8px; margin-bottom: 14px; }
.salary-mode .seg-btn { flex: 1; }

/* 상환 스케줄 표 */
.sched-wrap { margin: 6px -16px -12px; overflow-x: auto; }
.sched { width: 100%; border-collapse: collapse; font-size: 13px; }
.sched th, .sched td { padding: 8px 12px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.sched thead th { color: var(--ink-soft); font-weight: 600; font-size: 12px; border-top: 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.sched th.sched-y, .sched td.sched-y { text-align: left; color: var(--ink-soft); }
.sched td.sched-i { color: var(--neg); }
.sched td.sched-b { color: var(--mint); }
.sched tbody tr:last-child td { border-bottom: 0; }

.disclaimer { margin-top: 28px; font-size: 12px; color: var(--ink-soft); line-height: 1.6; text-align: center; }
.disclaimer b { color: var(--ink); }

/* 국가 스위처 */
.switchers { display: flex; align-items: center; gap: 8px; }
.cc-switch { display: inline-flex; gap: 4px; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.cc-btn {
  border: 0; background: transparent; color: var(--ink-soft);
  font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  padding: 6px 11px; border-radius: 999px; cursor: pointer; transition: all .15s ease; white-space: nowrap;
}
.cc-btn:hover { color: var(--ink); }
.cc-btn.is-on { background: rgba(52,216,168,.2); color: var(--mint); }
.cc-btn:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }

/* 광고 슬롯 — 라이브(client 설정) 또는 로컬 프리뷰(플레이스홀더)일 때만 노출 */
.ad-slot { display: none; margin: 22px 0; }
.ad-slot.is-live, .ad-slot.is-preview { display: block; }
.ad-label { display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); opacity: .7; margin-bottom: 4px; text-align: center; }
.ad-ph { display: none; align-items: center; justify-content: center; min-height: 90px; padding: 18px; border: 1px dashed var(--line); border-radius: 12px; background: rgba(255,255,255,.02); color: var(--ink-soft); font-size: 12px; opacity: .6; text-align: center; }
.ad-slot.is-preview .ad-ph { display: flex; }
.ad-slot.is-preview .adsbygoogle { display: none !important; }
.ad-slot.is-live .ad-ph { display: none; }

/* 설명 콘텐츠 (AdSense 가치·SEO) */
.info { margin-top: 36px; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.info h2 { font-size: 15px; color: var(--ink); margin: 22px 0 8px; }
.info > h2:first-child { margin-top: 0; }
.info p { margin-bottom: 8px; }
.faq { margin: 4px 0 8px; }
.faq dt { color: var(--ink); font-weight: 600; margin-top: 12px; }
.faq dd { margin: 4px 0 0; }
.sources { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.sources a { color: var(--blue); text-decoration: none; font-size: 13px; }
.sources a:hover { text-decoration: underline; }

/* 푸터 */
.foot { max-width: 760px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 32px) 80px; text-align: center; }
.foot a { color: var(--ink-soft); font-size: 12px; text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }

@media (max-width: 540px) {
  .inputs { grid-template-columns: 1fr; }
  .hr-value { font-size: 32px; }
  .topbar { flex-wrap: wrap; }
  .cc-btn { padding: 6px 9px; }
  .sched th, .sched td { padding: 7px 8px; font-size: 12px; }
}
