/* Shokyaku — styles. No external fonts/CDN. Two brand PNGs only. */

:root {
  --wrap: 1200px;
  --r: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Apple SD Gothic Neo",
          "Malgun Gothic", "Noto Sans KR", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #0b0f16;
  --bg2: #0f151f;
  --panel: #141c28;
  --panel2: #1a2331;
  --text: #eef2f7;
  --muted: #a7b3c4;
  --line: #26313f;
  --line2: #36455a;
  --brand: #8fc7b0;
  --brand-ink: #06120d;
  --accent: #e8b671;
  --ok: #63d3a6;
  --warn: #ffb4a2;
  --shadow: 0 18px 40px rgba(0, 0, 0, .38);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f6f4ee;
  --bg2: #efebe1;
  --panel: #ffffff;
  --panel2: #f5f2ea;
  --text: #141a21;
  --muted: #4c5665;
  --line: #dcd6c9;
  --line2: #c4bdad;
  --brand: #135f47;
  --brand-ink: #ffffff;
  --accent: #8a5a08;
  --ok: #106a4b;
  --warn: #a2381f;
  --shadow: 0 14px 30px rgba(20, 26, 33, .10);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(27px, 4vw, 42px); }
h2 { font-size: clamp(20px, 2.4vw, 26px); }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
code { font-family: var(--mono); font-size: .92em; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; }
pre { margin: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--brand); color: var(--brand-ink);
  padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 50; }
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- header */
.site-head { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.head-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; }
.brand-sym { display: block; }
html[data-theme="dark"] .brand-sym-light, html[data-theme="light"] .brand-sym-dark { display: none; }
.brand-word { letter-spacing: .04em; font-weight: 800; text-transform: lowercase; }
.brand-prod { color: var(--muted); font-weight: 600; }
.head-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.langs { display: flex; gap: 2px; font-size: 13px; }
.langs a { color: var(--muted); text-decoration: none; padding: 6px 8px; border-radius: 7px; }
.langs a:hover { background: var(--panel2); color: var(--text); }
.langs a[aria-current="page"] { background: var(--panel2); color: var(--text); font-weight: 700; }
.head-link { font-size: 13.5px; color: var(--muted); text-decoration: none; }
.head-link:hover { color: var(--text); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border: 1px solid var(--line2); border-radius: 9px; background: var(--panel); color: var(--text); cursor: pointer; }
.icon-btn:hover { border-color: var(--brand); }
html[data-theme="dark"] .i-sun { display: none; }
html[data-theme="light"] .i-moon { display: none; }

/* ------------------------------------------------------------------ hero */
.hero { padding: 46px 0 22px; }
.eyebrow { display: inline-block; font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 10px; }
.lead { font-size: clamp(15px, 1.5vw, 18px); color: var(--muted); max-width: 76ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 8px; }
.hero-note { font-size: 13px; color: var(--muted); }
.stats { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
  padding: 0; margin: 24px 0 0; }
.stats li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stats b { display: block; font-size: 21px; color: var(--brand); }
.stats span { font-size: 12.5px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--brand); color: var(--brand-ink);
  border: 1px solid transparent; border-radius: 10px; padding: 11px 18px; font-size: 15px; font-weight: 700;
  text-decoration: none; cursor: pointer; font-family: inherit; min-height: 44px; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line2); }
.btn.small { padding: 8px 13px; font-size: 13.5px; min-height: 38px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; }

/* ----------------------------------------------------------------- panels */
main { padding-bottom: 40px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px 22px 18px; margin: 18px 0; box-shadow: var(--shadow); }
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 16px; margin-bottom: 14px; }
.panel-head > div { flex: 1 1 320px; min-width: 0; }
.sub { color: var(--muted); font-size: 14px; margin: 0; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.muted { color: var(--muted); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line2); }
.badge.b-on { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); border-color: transparent; }
.badge.b-off { background: var(--panel2); color: var(--muted); }
.badge.b-err { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); border-color: transparent; }
.tag { font-size: 11.5px; margin-left: 6px; padding: 2px 7px; border-radius: 999px; background: var(--panel2);
  color: var(--muted); border: 1px solid var(--line); }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

/* --------------------------------------------------------------- controls */
.grid-6 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.fld > span { font-weight: 600; }
input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  font-family: inherit; font-size: 15px; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line2); border-radius: 9px; padding: 9px 10px; min-height: 42px; width: 100%;
}
input:disabled { opacity: .6; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.chk input { width: 18px; height: 18px; accent-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.seg button { font: inherit; font-size: 13.5px; padding: 9px 13px; background: var(--panel2); color: var(--muted);
  border: 0; cursor: pointer; min-height: 42px; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); font-weight: 700; }

/* ----------------------------------------------------------------- tables */
.tbl-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel2); overscroll-behavior-x: contain; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { position: sticky; top: 0; background: var(--panel2); font-size: 12px; letter-spacing: .02em;
  color: var(--muted); white-space: nowrap; z-index: 1; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#ledgerTable { min-width: 1000px; }
#ledgerTable input, #ledgerTable select { min-height: 36px; padding: 6px 7px; font-size: 13.5px; }
#ledgerTable td { padding: 6px 6px; }
#ledgerTable td:nth-child(2) { min-width: 170px; }
#ledgerTable td:nth-child(3) { min-width: 152px; }
#ledgerTable td:nth-child(4) { min-width: 138px; }
#ledgerTable td:nth-child(8) { min-width: 196px; }
#ledgerTable td:nth-child(9) { min-width: 138px; }
.del { background: transparent; border: 1px solid var(--line2); color: var(--muted); border-radius: 8px;
  width: 34px; height: 34px; font-size: 18px; line-height: 1; cursor: pointer; }
.del:hover { color: var(--warn); border-color: var(--warn); }
.row-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.count { font-size: 13px; color: var(--muted); }

#valueTable, #judgeTable { min-width: 560px; }
#csvTable { min-width: 1560px; font-size: 11.5px; }
#csvTable th, #csvTable td { padding: 4px 5px; white-space: nowrap; }

.empty { padding: 22px; text-align: center; color: var(--muted); font-size: 14px; }

/* --------------------------------------------------------------- results */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; }
.card span { display: block; font-size: 12px; color: var(--muted); }
.card b { font-size: 20px; font-variant-numeric: tabular-nums; }
.card small { font-size: 11px; color: var(--muted); }

.verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 10px; }

.err-list { margin: 10px 0 0; padding: 10px 14px 10px 30px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, transparent); border-radius: 10px; font-size: 13px; }
.err-list code { background: transparent; border: 0; padding: 0; color: var(--warn); font-weight: 700; }

.csv-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 12px 0; }
.csv-tools .fld { min-width: 190px; }
.csv-preview { max-height: 220px; }

.note-box { border-left: 3px solid var(--accent); background: var(--panel2); border-radius: 0 9px 9px 0;
  padding: 12px 14px; font-size: 13.5px; color: var(--text); margin: 12px 0; }
.note-box strong { color: var(--accent); }

/* ------------------------------------------------------------------- FAQ */
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 15px; }
.faq p { margin: 8px 0 2px; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------------ guide */
.guide-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.guide-list a { display: block; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 11px; padding: 14px 16px; }
.guide-list a:hover { border-color: var(--brand); }
.guide-list b { display: block; margin-bottom: 4px; }
.guide-list small { color: var(--muted); font-size: 12.5px; }
.prose { max-width: 74ch; }
.prose h2 { margin-top: 28px; }
.prose h3 { margin-top: 20px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose table { margin: 12px 0; font-size: 13px; }
.prose .tbl-wrap { margin: 12px 0; }
.prose .callout { border-left: 3px solid var(--accent); background: var(--panel2); padding: 12px 14px;
  border-radius: 0 9px 9px 0; font-size: 14px; }
.crumb { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.meta-date { font-size: 12.5px; color: var(--muted); }

/* ----------------------------------------------------------------- footer */
.site-foot { border-top: 1px solid var(--line); padding: 26px 0 34px; color: var(--muted); font-size: 13.5px; }
.foot-grid { display: flex; flex-wrap: wrap; gap: 16px 28px; justify-content: space-between; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--text); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-list { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .wrap { padding: 0 14px; }
  .head-inner { gap: 8px; flex-wrap: wrap; padding: 6px 0; }
  .brand-prod { font-size: 13px; }
  .head-link { display: none; }
  .langs a { padding: 5px 6px; }
  .hero { padding: 28px 0 12px; }
  .panel { padding: 16px 14px 14px; }
  .grid-6 { grid-template-columns: 1fr; }
  .csv-tools { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; justify-content: center; }
  table { font-size: 13px; }
  .prose { max-width: 100%; }
  .prose .tbl-wrap table { min-width: 480px; }
}

@media print {
  .site-head, .hero-cta, .row-tools, .csv-tools, .site-foot, .icon-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { box-shadow: none; border-color: #999; break-inside: avoid; }
}

/* steps */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.step { background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; }
.step b { display: block; color: var(--accent); font-size: 12px; letter-spacing: .1em; margin-bottom: 4px; }
.step span { font-size: 13.5px; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }
