/* lottery.css — 복권 화면 전용. style.css(본체 앱 공통 구획)의 토큰 위에만 얹는다.
   여기서 새로 만드는 색은 둘뿐이다:
     ① 발산형 9단계(--hm-*) — 본체 토큰 --c-a(파랑) · --surface-3(중립) · --bad(빨강)을 OKLab 으로
        보간해 라이트/다크 각각 계산했다 (손으로 고른 값이 아니다).
     ② 로또 공 색 — 번호대별(1~10 노랑 · 11~20 파랑 · 21~30 빨강 · 31~40 회색 · 41~45 초록) 관례.
        공은 실물이라 두 테마에서 같은 색이고, 글자는 어두운 색 하나로 둔다 (모든 공에서 4.5:1 이상). */
:root {
  --hm-0: #edece7; --hm-n1: #b8c7d1; --hm-n2: #85a3bb; --hm-n3: #5280a4; --hm-n4: #175d8d;
  --hm-p1: #e1c0b7; --hm-p2: #d29589; --hm-p3: #c0695c; --hm-p4: #ab392f;
  --ball-1: #fbc400; --ball-2: #69c8f2; --ball-3: #ff7272; --ball-4: #b4b4b4; --ball-5: #b0d840;
  --ball-ink: #14161a;
}
:root[data-theme="dark"] {
  --hm-0: #242931; --hm-n1: #364859; --hm-n2: #486a84; --hm-n3: #5a8db2; --hm-n4: #6cb2e2;
  --hm-p1: #534144; --hm-p2: #845958; --hm-p3: #b8716c; --hm-p4: #ef8a80;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hm-0: #242931; --hm-n1: #364859; --hm-n2: #486a84; --hm-n3: #5a8db2; --hm-n4: #6cb2e2;
    --hm-p1: #534144; --hm-p2: #845958; --hm-p3: #b8716c; --hm-p4: #ef8a80;
  }
}

/* ── 화면 묶음 ─────────────────────────────────────────────────────── */
.lsec { scroll-margin-top: 16px; }
.lsec + .lsec { margin-top: 56px; padding-top: 36px; border-top: 1px solid var(--line); }
.lgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 470px), 1fr)); gap: 18px; align-items: start; }
.lgrid > .panel { margin-bottom: 0; min-width: 0; }
.panel { min-width: 0; }
.pnote { margin: 10px 0 0; max-width: 76ch; font-size: var(--fs-xs); line-height: 1.68; color: var(--ink-2); word-break: keep-all; }
.verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 16px 0 0; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.verdict .chip { font-size: var(--fs-2xs); line-height: 1.9; padding: 0 10px; }
.chip.v-same { color: var(--ink-2); }
.chip.v-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: var(--ok-soft); }
.chip.v-diff { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: var(--warn-soft); }
.ctags { display: flex; flex-wrap: wrap; gap: 5px; margin: -4px 0 12px; }
.ctag { font-size: var(--fs-3xs); color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 7px; }
code.wrap { word-break: break-all; }
pre.cmd { margin: 0; padding: 10px 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-family: var(--mono); font-size: var(--fs-3xs); line-height: 1.7; color: var(--ink-2); }
.tablewrap.full { max-height: none; }  /* 결과표는 잘리지 않게 — 본체의 460px 제한은 긴 CSV 용 */
details.tv { margin-top: 10px; }
details.tv summary { cursor: pointer; font-size: var(--fs-2xs); color: var(--accent); }
details.tv .tablewrap { margin-top: 8px; }

/* ── 범례 ─────────────────────────────────────────────────────────── */
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 6px; font-size: var(--fs-2xs); color: var(--ink-2); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 12px; height: 10px; border-radius: 2px; }
.key-line { height: 2px; width: 14px; border-radius: 1px; }
.key-dot { width: 10px; height: 10px; border-radius: 50%; }
.key-ring { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink-3); background: transparent; }
.key-box { border: 1px solid var(--line); }
.k-accent { background: var(--c-a); }
.k-ref { background: var(--c-b); }
.k-band { background: color-mix(in srgb, var(--c-a) 22%, transparent); }
.k-band2 { background: color-mix(in srgb, var(--c-a) 9%, transparent); }
.k-err { background: var(--ink-2); }

/* ── 차트 마크 (style.css 의 .chart · .c-grid · .c-tick 위에 얹는다) ─────── */
.chart { max-width: 100%; }
.c-hit { fill: transparent; }
.c-bar path { fill: var(--c-a); }
.c-bar:hover path { opacity: .72; }
.c-band { fill: color-mix(in srgb, var(--c-a) 16%, transparent); }
.c-band2 { fill: color-mix(in srgb, var(--c-a) 7%, transparent); }
.c-ref { stroke: var(--c-b); stroke-width: 2; }
.c-refline { fill: none; stroke: var(--c-b); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-refdot { fill: var(--c-b); stroke: var(--surface); stroke-width: 2; }
.c-err { stroke: var(--ink-2); stroke-width: 1.4; }
.c-reflabel { fill: var(--ink-2); font-family: var(--sans); font-size: 12px; text-anchor: middle; }
.dw-label { fill: var(--ink-2); font-family: var(--sans); font-size: 12.5px; text-anchor: end; dominant-baseline: middle; }
.dw-ci { stroke: var(--c-a); stroke-width: 2; stroke-linecap: round; opacity: .55; }
.dw-dot { fill: var(--c-a); stroke: var(--surface); stroke-width: 2; }
.dw-null { fill: var(--surface); stroke: var(--ink-3); stroke-width: 2; }
.dw-row:hover .dw-label { fill: var(--ink); }
.ln-area { fill: color-mix(in srgb, var(--c-a) 10%, transparent); }
.ln-line { fill: none; stroke: var(--c-a); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ln-mark { fill: var(--c-a); stroke: var(--surface); stroke-width: 2; }
.ln-marklabel { fill: var(--ink); font-family: var(--sans); font-size: 12.5px; font-weight: 700; }
.ln-hit { fill: transparent; }
.hm rect:hover { stroke: var(--ink); stroke-width: 1.5; }
/* 발산형 — 칸(fill)과 범례 열쇠(background)가 같은 토큰을 쓴다 */
.hm-n4 { fill: var(--hm-n4); background: var(--hm-n4); } .hm-n3 { fill: var(--hm-n3); background: var(--hm-n3); }
.hm-n2 { fill: var(--hm-n2); background: var(--hm-n2); } .hm-n1 { fill: var(--hm-n1); background: var(--hm-n1); }
.hm-0  { fill: var(--hm-0);  background: var(--hm-0); }
.hm-p1 { fill: var(--hm-p1); background: var(--hm-p1); } .hm-p2 { fill: var(--hm-p2); background: var(--hm-p2); }
.hm-p3 { fill: var(--hm-p3); background: var(--hm-p3); } .hm-p4 { fill: var(--hm-p4); background: var(--hm-p4); }
.c-bar.pos1 path { fill: var(--hm-p1); } .c-bar.pos2 path { fill: var(--hm-p2); } .c-bar.pos3 path { fill: var(--hm-p3); } .c-bar.pos4 path { fill: var(--hm-p4); }
.c-bar.neg1 path { fill: var(--hm-n1); } .c-bar.neg2 path { fill: var(--hm-n2); } .c-bar.neg3 path { fill: var(--hm-n3); } .c-bar.neg4 path { fill: var(--hm-n4); }
.key.pos4 { background: var(--hm-p4); } .key.neg4 { background: var(--hm-n4); }

/* ── 로또 공 ──────────────────────────────────────────────────────── */
.balls { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.ball { width: 2.15em; height: 2.15em; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-family: var(--mono); font-weight: 700; font-size: .95rem; color: var(--ball-ink);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14); }
.ball.sm { width: 1.85em; height: 1.85em; font-size: .78rem; }
.b1 { background: var(--ball-1); } .b2 { background: var(--ball-2); } .b3 { background: var(--ball-3); }
.b4 { background: var(--ball-4); } .b5 { background: var(--ball-5); }
.plus { color: var(--ink-3); margin: 0 1px; }

/* ── 번호 생성기 ──────────────────────────────────────────────────── */
.maker { display: grid; gap: 18px; }
.maker .seg { margin-top: 0; }
.mk-panel { display: grid; gap: 16px; }
.mk-panel[hidden] { display: none; }
.mk-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 18px; }
.mk-ctl { display: grid; gap: 6px; min-width: 0; }
.mk-l { font-size: var(--fs-3xs); font-weight: 700; letter-spacing: .04em; color: var(--ink-3); }
.mk-help { margin: 0; }
.maker select, .maker input[type="text"] {
  font: inherit; font-size: var(--fs-xs); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 9px; }
.maker input[type="text"] { width: min(100%, 300px); font-family: var(--mono); }
.numgrid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; max-width: 430px; }
.numgrid button { aspect-ratio: 1; padding: 0; border-radius: 50%; cursor: pointer;
  font: inherit; font-family: var(--mono); font-size: var(--fs-2xs); color: var(--ink-2);
  border: 1px solid var(--line); background: var(--surface); }
.numgrid button:hover { border-color: var(--accent); }
.numgrid button[data-s="in"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.numgrid button[data-s="out"] { background: var(--surface-3); color: var(--ink-3); text-decoration: line-through; border-style: dashed; }
.mk-msg { margin: 0; font-size: var(--fs-xs); color: var(--warn); min-height: 0; }
.mk-msg:empty { display: none; }
.mk-out { display: grid; }
.ticket { display: grid; grid-template-columns: 1.6em minmax(0, 1fr); gap: 6px 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line-2); }
.ticket:first-child { border-top: 0; }
.ticket .tk-l { font-family: var(--mono); font-size: var(--fs-3xs); color: var(--ink-3); }
.ticket .tk-info { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-2xs); color: var(--ink-2); }
.tk-chip { white-space: nowrap; }
.tk-low { color: var(--ok); font-weight: 650; }
.tk-high { color: var(--bad); font-weight: 650; }
.tk-flag { color: var(--bad); }
.pdigits { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pgroup { margin-right: 6px; font-weight: 700; font-size: var(--fs-sm); }
.pd { width: 1.9em; height: 2.3em; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 5px;
  background: var(--surface-2); font-family: var(--mono); font-weight: 700; }

/* 860px 이하에서 메뉴 버튼(style.css: fixed, left 12px, 38px)이 서랍의 브랜드 글자를 가린다 — 비켜 준다. */
@media (max-width: 860px) { .sidebar-header { padding-left: 52px; } }
/* 좁은 화면에서는 떠 있는 'PDF 로 저장' 버튼이 생성기 칸을 가린다 — 숨긴다 (인쇄는 넓은 화면에서). */
@media (max-width: 720px) { .pdfbtn { display: none; } }
@media print { .maker { display: none; } }

/* 긴 설명이 든 표는 칸 안에서 줄을 바꾼다 (본체 table.data 는 nowrap) */
table.data.wrapcells td { white-space: normal; word-break: keep-all; min-width: 9em; }
.stale-note { border-left-color: var(--warn); background: var(--warn-soft); }
