/* ════════════════════════════════════════════════════════════
   TIBS 로또 분석 시스템 — 모던 UI
   ════════════════════════════════════════════════════════════ */

:root {
  --bg:        #0f1220;
  --bg-soft:   #161a2c;
  --card:      #1c2138;
  --card-2:    #232944;
  --line:      #2c3354;
  --text:      #eef1fb;
  --text-dim:  #9aa3c7;
  --text-mute: #6b7399;
  --brand:     #6c8cff;
  --brand-2:   #8a6cff;
  --accent:    #ffd24a;
  --good:      #34d399;
  --radius:    18px;
  --radius-sm: 12px;
  --shadow:    0 10px 30px rgba(0,0,0,.35);
  --shadow-sm: 0 4px 14px rgba(0,0,0,.25);
  --ball-yellow: #ffc024;
  --ball-blue:   #4aa3ff;
  --ball-red:    #ff6b6b;
  --ball-gray:   #8b93b5;
  --ball-green:  #5fd17a;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui,
               'Segoe UI', Roboto, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  margin: 0;
  padding: 28px 16px 64px;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 50% -200px, #2a2f55 0%, transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

/* ── 컨테이너 ───────────────────────────────────────────── */
.container {
  max-width: 640px;
  margin: 0 auto;
  text-align: left;
}

/* ── 헤더 타이틀 ────────────────────────────────────────── */
h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 4px 0 22px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  color: var(--text);
}

h3 { font-size: 14px; font-weight: 600; color: var(--text-dim); margin: 18px 0 8px; }

/* ── 카드 (info, candidates, results, analysis-method) ──── */
.info,
.candidates,
.results,
.analysis-method {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* ── 상단 정보 카드 ─────────────────────────────────────── */
.info {
  text-align: center;
  background: linear-gradient(160deg, var(--card-2), var(--card));
  color: var(--text-dim);
  font-size: 14px;
}
.info strong { color: var(--text); font-weight: 700; }
.info .round-big {
  display: block;
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin: 2px 0 6px;
}
.info .pill {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(108,140,255,.15);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  margin: 2px;
}

/* ── 섹션 타이틀 ────────────────────────────────────────── */
.title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.title small { font-weight: 500; color: var(--text-mute); font-size: 12px; }

.candidates > .title:first-child {
  font-size: 16px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

/* ── 번호 줄 ────────────────────────────────────────────── */
.number-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 4px 0 4px;
}

/* ── 추천 세트 행 ───────────────────────────────────────── */
.recommend-set {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 9px 0;
}
.set-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
}
.set-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
}

/* ── 로또 볼 (공식 구간 색) ─────────────────────────────── */
.lotto-ball {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 800;
  color: #1a1d2b;
  flex: 0 0 auto;
  box-shadow: inset 0 -3px 6px rgba(0,0,0,.18), 0 2px 5px rgba(0,0,0,.25);
}
.lotto-ball.r0 { background: linear-gradient(160deg, #ffd866, var(--ball-yellow)); }
.lotto-ball.r1 { background: linear-gradient(160deg, #7bc0ff, var(--ball-blue)); color:#0c1730; }
.lotto-ball.r2 { background: linear-gradient(160deg, #ff9090, var(--ball-red)); color:#3a0b0b; }
.lotto-ball.r3 { background: linear-gradient(160deg, #a8aecb, var(--ball-gray)); color:#1c2030; }
.lotto-ball.r4 { background: linear-gradient(160deg, #84e09a, var(--ball-green)); color:#0c2415; }
.lotto-ball.bonus { background: linear-gradient(160deg, #4a5070, #2c3150); color:#fff; }
.lotto-ball.sm { width: 30px; height: 30px; font-size: 13px; }

/* 방법별 번호 (종합/빈도 등) — 볼과 통일감 있게 */
.machine-number,
.normal-number,
.ml-match {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.machine-number { background: linear-gradient(160deg, var(--brand), var(--brand-2)); }
.normal-number  { background: var(--card-2); color: var(--text-dim); border: 1px solid var(--line); }
.ml-match       { background: linear-gradient(160deg, #ff7a7a, var(--ball-red)); }

/* 적중 강조 (지난 추천이 최신 당첨과 일치) */
.highlight {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── 점수 테이블 ────────────────────────────────────────── */
.score-table { width: 100%; border-collapse: collapse; }
.score-table td { padding: 5px 4px; border: none; vertical-align: middle; }
.score-rank { width: 26px; color: var(--text-mute); font-size: 12px; }
.score-bar-wrap { background: var(--bg-soft); border-radius: 6px; overflow: hidden; height: 16px; }
.score-bar { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.score-val { width: 46px; text-align: right; color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ── 최신 결과 ──────────────────────────────────────────── */
.results { text-align: center; }
.results h2 { text-align: center; }
.results .plus { margin: 0 4px; color: var(--text-mute); font-weight: 700; }

/* ── 버튼 ───────────────────────────────────────────────── */
.buttons { display: flex; gap: 10px; margin: 18px 0; }
button {
  flex: 1;
  padding: 14px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .2s ease, opacity .2s;
  color: #fff;
  background: var(--card-2);
  border: 1px solid var(--line);
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
button#recommendation-button {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(108,140,255,.35);
}
button:disabled { opacity: .5; cursor: not-allowed; }

/* 갱신 배너 버튼 / 링크 */
.update-link {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff8a4c, #ff6b35);
  color: #fff !important;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(255,107,53,.3);
}

/* ── 분석법 설명 ────────────────────────────────────────── */
.analysis-method { background: var(--bg-soft); }
.analysis-method h2 { color: var(--text); }
.analysis-method ul { margin: 0; padding-left: 18px; }
.analysis-method li { font-size: 13.5px; color: var(--text-dim); margin-bottom: 9px; }
.analysis-method li strong { color: var(--text); font-weight: 700; }
.analysis-method em { color: var(--brand); font-style: normal; font-weight: 600; }

/* ── 푸터 / 면책 ────────────────────────────────────────── */
.disclaimer {
  text-align: center;
  color: var(--text-mute);
  font-size: 12px;
  line-height: 1.7;
  margin-top: 22px;
}

/* ── 차트/팝업 페이지 공용 ──────────────────────────────── */
.inline-numbers {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin: 10px auto; padding: 12px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.lotto-num, .ml-hit {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 15px; font-weight: 800; color: #fff;
}
.lotto-num { background: linear-gradient(160deg, var(--brand), var(--brand-2)); }
.ml-hit { background: linear-gradient(160deg, #ff7a7a, var(--ball-red)); }

canvas { margin: 12px 0; max-width: 100%; }

table { width: 100%; border-collapse: collapse; }
.analysis-method table th, .results table th { color: var(--text-dim); }

/* ── 반응형 ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  body { padding: 18px 12px 48px; }
  .info, .candidates, .results, .analysis-method { padding: 16px; }
  h1 { font-size: 21px; }
  .lotto-ball, .machine-number, .normal-number, .ml-match { width: 34px; height: 34px; font-size: 14px; }
  .buttons { flex-direction: column; }
}
