:root { --bg: #f7f8fb; --surface: #fff; --text: #171a23; --text-2: #4b5363; --text-3: #8a92a3; --line: #e6e8ef; --brand: #5b4cf0; --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff); --brand-line: color-mix(in srgb, var(--brand) 35%, #fff); --r: 14px; --danger: #e5484d; --ok: #0e9f6e; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Pretendard Variable', Pretendard, system-ui, -apple-system, 'Malgun Gothic', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.wrap { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* 머리말 */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-row { height: 58px; display: flex; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; font-size: 1.05rem; }

/* 기능 바꾸기 줄 */
.tabs { background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs-row { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-top: 8px; padding-bottom: 8px; }
.tabs-row::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 7px 13px; border-radius: 99px; color: var(--text-2); font-size: 0.9rem; font-weight: 600; white-space: nowrap; }
.tabs a:hover { background: var(--bg); color: var(--text); }
.tabs a.on { background: var(--brand-soft); color: var(--brand); }

/* 첫 화면 */
.hero { padding: 52px 0 30px; background: radial-gradient(700px 300px at 85% 0, var(--brand-soft) 0, transparent 70%), var(--bg); }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); line-height: 1.22; letter-spacing: -0.04em; margin: 0 0 12px; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p { color: var(--text-2); margin: 0; max-width: 620px; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tcard { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); transition: border-color 0.15s, box-shadow 0.15s; }
.tcard:hover { border-color: var(--brand-line); box-shadow: 0 10px 26px -16px rgba(20, 24, 40, 0.3); }
.tcard:hover strong { color: var(--brand); }
.tcard strong { font-size: 1.02rem; letter-spacing: -0.01em; }
.tcard span { color: var(--text-2); font-size: 0.88rem; line-height: 1.5; }
.tgrid-sm .tcard { padding: 14px 16px; }

/* 기능 페이지 */
.thead { padding: 30px 0 18px; }
.thead h1 { font-size: 1.75rem; letter-spacing: -0.03em; margin: 0 0 4px; }
.thead p { margin: 0; color: var(--text-2); }
.ui { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lbl { font-size: 0.86rem; font-weight: 700; color: var(--text-2); }
.hint { font-size: 0.84rem; color: var(--text-3); margin: 0; }

.ta, .inp { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; padding: 12px 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.ta { min-height: 190px; resize: vertical; line-height: 1.65; display: block; }
.ta.sm { min-height: 110px; }
.ta[readonly] { background: var(--bg); }
.inp { height: 46px; }
.ta:focus, .inp:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: var(--surface); }
.inp[type='date'] { font-variant-numeric: tabular-nums; }
.unit { position: relative; display: block; }
.unit .inp { padding-right: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.unit i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--text-3); font-size: 0.9rem; pointer-events: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 20px; border: 0; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 700; transition: filter 0.15s; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface); color: var(--text-2); border: 1px solid var(--line); }
.btn.ghost:hover { filter: none; border-color: var(--brand-line); color: var(--brand); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 0.88rem; border-radius: 10px; }
.btn:disabled { opacity: 0.45; cursor: default; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.seg > button { height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 0.9rem; }
.seg > button:hover { color: var(--text); }
.seg > button.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(20, 24, 40, 0.14); }
.chk { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 0.9rem; }
.chk::before { content: ''; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid #c9cedb; background: #fff center/12px no-repeat; }
.chk[aria-pressed='true'] { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand); }
.chk[aria-pressed='true']::before { border-color: var(--brand); background-color: var(--brand); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E"); }

/* 결과 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { padding: 14px 16px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat span { font-size: 0.82rem; color: var(--text-3); font-weight: 600; }
.stat b { font-size: 1.35rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat.main { background: var(--brand-soft); border-color: var(--brand-line); }
.stat.main b { color: var(--brand); font-size: 1.6rem; }
.res { border-radius: 14px; background: var(--bg); border: 1px solid var(--line); padding: 4px 16px; }
.res > div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.res > div:last-child { border-bottom: 0; }
.res span { color: var(--text-2); font-size: 0.92rem; }
.res b { font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.res .sum b { color: var(--brand); font-size: 1.2rem; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.tbl { border-collapse: collapse; width: 100%; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { background: var(--bg); color: var(--text-2); font-weight: 700; position: sticky; top: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }

/* 설명 글 */
.about { padding: 34px 0 8px; max-width: 760px; }
.about h2 { font-size: 1.15rem; letter-spacing: -0.02em; margin: 30px 0 8px; }
.about h2:first-child { margin-top: 0; }
.about p, .about li, .about dd { color: var(--text-2); }
.about ol { padding-left: 1.3em; margin: 0; }
.about li { margin: 4px 0; }
.about dt { font-weight: 700; margin-top: 14px; }
.about dd { margin: 4px 0 0; }
.about .tgrid { margin-top: 12px; }
.hub-link { margin-top: 22px; }
.hub-link a { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 700; font-size: 0.92rem; }
.hub-link a:hover { text-decoration: underline; }
.home-about { padding-top: 40px; }

.page { padding-top: 34px; padding-bottom: 40px; }
.prose { max-width: 760px; }
.prose h1 { font-size: 1.8rem; letter-spacing: -0.03em; margin: 0 0 14px; }
.prose h2 { font-size: 1.15rem; margin-top: 28px; }
.prose p, .prose li { color: var(--text-2); }
.prose a { color: var(--brand); font-weight: 600; }
.prose .mail { font-size: 1.15rem; }

.foot { margin-top: 56px; background: #12141c; color: #a3a9b8; padding: 40px 0 24px; font-size: 0.9rem; }
.foot-cols { display: flex; flex-wrap: wrap; gap: 32px 56px; }
.foot-cols > div { display: flex; flex-direction: column; gap: 6px; }
.foot-cols p { color: #fff; font-weight: 700; margin: 0 0 4px; }
.foot-cols a:hover { color: #fff; }
.foot-tools { flex: 1 1 320px; }
.foot-tools > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 20px; }
.copy { margin: 28px 0 0; padding-top: 16px; border-top: 1px solid #262a36; color: #6b7182; font-size: 0.82rem; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #171a23; color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 0.9rem; font-weight: 600; z-index: 50; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5); }
[hidden] { display: none !important; }
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 34px 0 22px; }
  .ui { padding: 16px; border-radius: 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .thead { padding: 22px 0 14px; }
  .thead h1 { font-size: 1.5rem; }
}

/* 두 글 비교 */
.diff { border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 560px; font-family: ui-monospace, 'D2Coding', Consolas, monospace; font-size: 0.86rem; line-height: 1.6; background: var(--surface); }
.d-row { display: grid; grid-template-columns: 44px 44px 1fr; min-width: max-content; }
.d-row i { font-style: normal; color: var(--text-3); text-align: right; padding: 1px 8px; background: var(--bg); border-right: 1px solid var(--line); user-select: none; }
.d-row span { padding: 1px 12px; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.d-row.del span { background: #ffecec; }
.d-row.add span { background: #e7f8ee; }
.d-row.del i { background: #ffdcdc; }
.d-row.add i { background: #d3f1de; }
.d-row mark { background: #ffb8b8; color: inherit; border-radius: 3px; }
.d-row.add mark { background: #9be3b5; }
.d-none { margin: 0; padding: 16px; color: var(--text-3); font-family: inherit; }
.d-sum { font-variant-numeric: tabular-nums; }
.d-m { color: var(--danger); }
.d-p { color: var(--ok); }

/* 로마자 변환 */
.name-in { font-size: 1.3rem; height: 56px; max-width: 320px; }
.rom { display: flex; flex-direction: column; gap: 8px; }
.rom > div { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.rom span { flex: none; width: 108px; color: var(--text-3); font-size: 0.84rem; font-weight: 600; }
.rom b { flex: 1; font-size: 1.15rem; letter-spacing: 0.01em; overflow-wrap: anywhere; min-width: 0; }

/* CSV */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 44px 20px; border: 2px dashed #cfd4e2; border-radius: 16px; background: var(--bg); text-align: center; color: var(--text-2); transition: border-color 0.15s, background 0.15s; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop strong { font-size: 1.05rem; color: var(--text); }
.file-name { font-weight: 700; overflow-wrap: anywhere; }
