:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5b6270;
  --line: #dfe3ea;
  --accent: #1f5fd1;
  --on-accent: #ffffff;
  --accent-soft: #e9f0fd;
  --warn: #b4540a;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --surface: #1a1d24;
    --text: #eef0f4;
    --muted: #a2a9b6;
    --line: #2c313b;
    --accent: #7aa7ff;
    --on-accent: #0e1320;
    --accent-soft: #1d2a44;
    --warn: #f0a55a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
}
a { color: var(--accent); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 800; font-size: 18px; color: var(--text); text-decoration: none; }
.site-header nav a { margin-left: 16px; color: var(--muted); text-decoration: none; font-size: 14px; }
.site-header nav a:hover { color: var(--text); }

main { padding-top: 28px; padding-bottom: 48px; }
h1 { font-size: 26px; line-height: 1.35; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 36px 0 10px; }
h3 { font-size: 16px; margin: 20px 0 6px; }
p { margin: 0 0 12px; }
.lead { color: var(--muted); margin-bottom: 20px; }

.calc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 4px; }
.field input[type="text"], .field input[type="date"], .field select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; gap: 0; } }

.seg { display: flex; gap: 8px; margin-bottom: 16px; }
.seg label {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.seg input { position: absolute; opacity: 0; }
.seg input:checked + span { color: var(--accent); }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }

.result { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.result-main { background: var(--accent-soft); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.result-main span { display: block; font-size: 14px; color: var(--muted); }
.result-main strong { display: block; font-size: 30px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.result dl { margin: 0; }
.result dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px dashed var(--line); }
.result dt { color: var(--muted); }
.result dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.notice { margin-top: 12px; font-size: 14px; color: var(--warn); }
.notice:empty { display: none; }

.guide table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-size: 15px; }
.guide th, .guide td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.guide th { background: var(--surface); }
.guide ul, .guide ol { padding-left: 20px; margin: 0 0 12px; }
/* 열이 많은 표가 좁은 화면에서 페이지를 밀어내지 않게 한다 */
@media (max-width: 520px) {
  .guide table { display: block; overflow-x: auto; font-size: 13px; }
  .guide th, .guide td { padding: 6px; }
}

.byline { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.guide .btn { margin: 4px 0 8px; }

.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 10px 0 0; color: var(--muted); }

.field textarea {
  width: 100%;
  min-height: 220px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}
.field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  width: 100%;
  height: 50px;
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  color: var(--on-accent);
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.btn.secondary { color: var(--text); background: var(--bg); border: 1px solid var(--line); }
.btn-row { display: flex; gap: 8px; }
.field input[type="range"] { width: 100%; }
.field input[type="file"] { width: 100%; font: inherit; color: var(--text); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 14px; }

/* 한 페이지에 작은 계산 여러 개를 쌓을 때 */
.mini { padding: 16px 0; border-bottom: 1px dashed var(--line); }
.mini:first-child { padding-top: 0; }
.mini:last-child { border-bottom: 0; padding-bottom: 0; }
.mini h3 { margin: 0 0 10px; }
.mini .out { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini .out small { font-size: 14px; font-weight: 400; color: var(--muted); }

.grade-row { display: grid; grid-template-columns: 1fr 84px 92px 40px; gap: 8px; margin-bottom: 8px; }
.grade-row input, .grade-row select {
  width: 100%; height: 44px; padding: 0 10px;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
}
.grade-row button { height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--muted); cursor: pointer; font: inherit; }

.picks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.picks li { background: var(--accent-soft); border-radius: 10px; padding: 8px 14px; font-weight: 700; font-size: 18px; }

.ladder-names { display: grid; gap: 4px; margin-top: 16px; }
.ladder-names button {
  min-width: 0; padding: 8px 2px; font: inherit; font-size: 13px; font-weight: 700;
  color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ladder-names span { text-align: center; font-size: 13px; font-weight: 700; padding: 8px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ladder-svg { width: 100%; height: auto; display: block; }
#ladder-svg line { stroke: var(--muted); stroke-width: 2; }
.ladder-list { margin: 12px 0 0; padding-left: 20px; }

.preview { max-width: 100%; max-height: 320px; border: 1px solid var(--line); border-radius: 10px; display: block; margin: 0 auto 12px; }
#qr-canvas { display: block; margin: 0 auto 12px; max-width: 100%; height: auto; background: #fff; border-radius: 8px; }
.groups h3 { margin: 24px 0 10px; font-size: 15px; color: var(--muted); }

.games { list-style: none; margin: 0; padding: 0; }
.games li { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.ball {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.ball.c1 { background: #e0a80c; }
.ball.c2 { background: #3f7fd6; }
.ball.c3 { background: #dc4b44; }
.ball.c4 { background: #7b818c; }
.ball.c5 { background: #4a9d4e; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
}
.card:hover { border-color: var(--accent); }
.card strong { font-size: 17px; }
.card span { color: var(--muted); font-size: 14px; }
.card .card-tag { font-size: 12px; color: var(--accent); font-weight: 600; }

.hero { padding: 12px 0 8px; }
.hero h1 { font-size: 30px; }

.site-footer { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: 13px; }
.site-footer a { color: var(--muted); }
