/* ── 변수 & 리셋 ──────────────────────────────────────────────────────────── */
:root {
  --bg:        #f5f6fa;
  --surface:   #ffffff;
  --surface2:  #f0f2f8;
  --border:    #e4e7ef;
  --text:      #1a1d2e;
  --text-sub:  #6b7280;
  --primary:   #4f46e5;
  --primary-h: #4338ca;
  --primary-l: #ede9fe;
  --success:   #10b981;
  --warn:      #f59e0b;
  --danger:    #ef4444;

  /* 로또볼 색상 */
  --ball-1-10:  #f5a623;
  --ball-11-20: #3b82f6;
  --ball-21-30: #ef4444;
  --ball-31-40: #9ca3af;
  --ball-41-45: #10b981;

  --radius:    12px;
  --shadow:    0 2px 12px rgba(0,0,0,.06);
  --shadow-md: 0 4px 24px rgba(0,0,0,.10);

  /* 하단 탭바 높이 + Safe Area */
  --bottom-nav-h: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  /* 하단 탭바 공간 확보는 .main에서 처리 */
}

/* ── 헤더 ────────────────────────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 200;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex; align-items: center; gap: 24px;
}

.logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo-icon { font-size: 24px; line-height: 1; }
.logo-text { font-size: 18px; font-weight: 700; color: var(--text); }
.logo-sub  { font-size: 12px; color: var(--text-sub); background: var(--surface2);
             padding: 2px 8px; border-radius: 20px; }

/* 데스크탑 네비 */
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav-btn {
  background: none; border: none; cursor: pointer;
  padding: 8px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--text-sub);
  transition: all .15s;
  white-space: nowrap;
}
.nav-btn:hover  { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: var(--primary-l); color: var(--primary); }

.header-meta { flex-shrink: 0; display: flex; align-items: center; gap: 6px; }
.status-badge {
  font-size: 12px; padding: 4px 10px; border-radius: 20px;
  background: var(--surface2); color: var(--text-sub);
  white-space: nowrap;
}
.status-badge.ok { background: #d1fae5; color: #065f46; }
.visit-badge {
  font-size: 12px; padding: 4px 10px; border-radius: 20px;
  background: #eef2ff; color: #4338ca;
  white-space: nowrap; align-items: center;
}

/* ── 하단 탭바 (모바일 전용, 기본 숨김) ───────────────────────────────────── */
.bottom-nav {
  display: none;
}

/* ── 메인 ────────────────────────────────────────────────────────────────── */
.main {
  max-width: 1200px; margin: 0 auto;
  padding: 32px 24px 80px;
}

.page { display: none; }
.page.active { display: block; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── 번호 추천 페이지 ──────────────────────────────────────────────────────── */
.page-hero {
  text-align: center; padding: 48px 0 40px;
}
.page-title { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.page-desc  { font-size: 15px; color: var(--text-sub); margin-bottom: 28px; line-height: 1.6; }
.page-desc strong { color: var(--primary); }

.btn-generate {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary); color: #fff;
  border: none; cursor: pointer;
  padding: 14px 32px; border-radius: 50px;
  font-size: 16px; font-weight: 700;
  box-shadow: 0 4px 20px rgba(79,70,229,.35);
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-generate:hover  { background: var(--primary-h); transform: translateY(-2px); box-shadow: 0 8px 28px rgba(79,70,229,.4); }
.btn-generate:active { transform: scale(.97); }
.btn-generate.loading { opacity: .7; pointer-events: none; }
.btn-icon { font-size: 20px; }

/* 추천 카드 그리드 */
.recommend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
.rec-placeholder {
  grid-column: 1 / -1;
  text-align: center; padding: 80px 0;
  color: var(--text-sub); font-size: 15px;
  border: 2px dashed var(--border); border-radius: var(--radius);
}

.rec-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow .2s, transform .2s;
}
.rec-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.rec-card.featured {
  border-color: var(--primary);
  background: linear-gradient(135deg, #fafafe 0%, #f0eeff 100%);
}

.rec-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  background: var(--surface2); color: var(--text-sub);
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: .5px;
}
.rec-card.featured .rec-badge { background: var(--primary-l); color: var(--primary); }

.rec-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.rec-desc { font-size: 13px; color: var(--text-sub); margin-bottom: 18px; min-height: 36px; }

.balls-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px;
}

/* ── 로또볼 ──────────────────────────────────────────────────────────────── */
.ball {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.22);
  flex-shrink: 0;
  transition: transform .15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.ball:hover { transform: scale(1.12); }
.ball.sm { width: 32px; height: 32px; font-size: 12px; }
.ball.lg { width: 48px; height: 48px; font-size: 16px; }

.ball[data-n~="y"]  { background: var(--ball-1-10); }
.ball[data-n~="b"]  { background: var(--ball-11-20); }
.ball[data-n~="r"]  { background: var(--ball-21-30); }
.ball[data-n~="g"]  { background: var(--ball-31-40); }
.ball[data-n~="gr"] { background: var(--ball-41-45); }

.rec-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.rec-meta-item {
  font-size: 12px; color: var(--text-sub);
  background: var(--surface2); padding: 3px 10px; border-radius: 20px;
}
.rec-meta-item span { font-weight: 600; color: var(--text); }

/* 정보 카드 */
.info-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px;
}
.info-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); text-align: center;
  border: 1px solid var(--border);
}
.info-icon  { font-size: 28px; margin-bottom: 8px; }
.info-label { font-size: 12px; color: var(--text-sub); margin-bottom: 4px; }
.info-value { font-size: 16px; font-weight: 700; }

/* ── 통계 페이지 ───────────────────────────────────────────────────────────── */
.stats-header { margin-bottom: 28px; }

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 24px;
}
.summary-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px 12px; box-shadow: var(--shadow); text-align: center;
  border: 1px solid var(--border);
}
.sc-label { font-size: 11px; color: var(--text-sub); margin-bottom: 6px; }
.sc-value { font-size: 24px; font-weight: 800; color: var(--primary); }

.hot-cold-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.hc-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.hc-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.hc-card.hot     h3 { color: #dc2626; }
.hc-card.cold    h3 { color: #2563eb; }
.hc-card.overdue h3 { color: #d97706; }

.ball-row { display: flex; gap: 6px; flex-wrap: wrap; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px; margin-bottom: 28px;
}
.chart-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.chart-card.wide { grid-column: 1 / -1; }
.chart-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.chart-wrap  { position: relative; height: 260px; }
.chart-card.wide .chart-wrap { height: 200px; }

/* 빈도 테이블 */
.table-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.table-scroll { overflow-x: auto; margin-top: 16px; -webkit-overflow-scrolling: touch; }
.freq-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
  min-width: 520px;
}
.freq-table th {
  text-align: left; padding: 10px 12px;
  background: var(--surface2); color: var(--text-sub);
  font-weight: 600; font-size: 12px; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.freq-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.freq-table tr:last-child td { border-bottom: none; }
.freq-table tr:hover td { background: var(--surface2); }

.bar-bg   { background: var(--border); border-radius: 4px; height: 6px; width: 100%; }
.bar-fill { background: var(--primary); border-radius: 4px; height: 6px; transition: width .4s; }

.tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.tag.hot     { background: #fee2e2; color: #dc2626; }
.tag.cold    { background: #dbeafe; color: #1d4ed8; }
.tag.normal  { background: var(--surface2); color: var(--text-sub); }
.tag.overdue { background: #fef3c7; color: #d97706; }

/* ── 최근 당첨 페이지 ──────────────────────────────────────────────────────── */
.recent-controls {
  margin-top: 12px; font-size: 14px; color: var(--text-sub);
  display: flex; align-items: center; gap: 8px;
}
.select {
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; cursor: pointer;
}

.recent-list { display: flex; flex-direction: column; gap: 10px; }
.recent-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.recent-card-top {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.recent-no   { font-size: 20px; font-weight: 800; color: var(--primary); }
.recent-date { font-size: 13px; color: var(--text-sub); }
.recent-numbers { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.bonus-sep { font-size: 16px; color: var(--text-sub); margin: 0 2px; }
.ball.bonus { outline: 3px solid var(--warn); outline-offset: 2px; }

/* ── 토스트 ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  left: 50%; transform: translateX(-50%) translateY(40px);
  background: var(--text); color: #fff;
  padding: 12px 24px; border-radius: 50px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-md);
  transition: transform .3s, opacity .3s;
  opacity: 0; pointer-events: none; z-index: 999;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── 번호 추천 — 다음 회차 표시 ──────────────────────────────────────────── */
.hero-next-draw {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary-l); border-radius: 20px;
  padding: 6px 16px; margin-bottom: 20px; font-size: 13px;
}
.next-draw-label { color: var(--primary); font-weight: 600; }
.next-draw-value { color: var(--text); font-weight: 700; }

/* ── 추천 카드 — 저장 버튼 ───────────────────────────────────────────────── */
.rec-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.btn-save-ticket {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: 1.5px solid var(--primary);
  color: var(--primary); border-radius: 20px;
  padding: 5px 14px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap; flex-shrink: 0;
}
.btn-save-ticket:hover  { background: var(--primary-l); }
.btn-save-ticket:active { transform: scale(.96); }
.btn-save-ticket.saved  { background: #d1fae5; border-color: var(--success); color: #065f46; }

/* 상단 nav 카운트 배지 */
.nav-count {
  background: var(--danger); color: #fff;
  border-radius: 10px; font-size: 10px; font-weight: 700;
  padding: 1px 5px; margin-left: 3px;
}

/* ── 내 번호함 페이지 ─────────────────────────────────────────────────────── */
.mytickets-header-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.btn-check-all {
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: all .15s; flex-shrink: 0;
}
.btn-check-all:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-l); }

/* 통계 요약 바 */
.ticket-stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 24px;
}
.ts-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px 12px; text-align: center;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.ts-card.highlight { border-color: var(--warn); background: #fffbeb; }
.ts-label { font-size: 11px; color: var(--text-sub); margin-bottom: 4px; }
.ts-value { font-size: 22px; font-weight: 800; color: var(--primary); }
.ts-card.highlight .ts-value { color: var(--warn); }

/* 회차 그룹 */
.ticket-groups { display: flex; flex-direction: column; gap: 20px; }

.draw-group {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  overflow: hidden;
}
.draw-group-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.dg-draw-no  { font-size: 18px; font-weight: 800; color: var(--primary); }
.dg-date     { font-size: 12px; color: var(--text-sub); }
.dg-status   { margin-left: auto; font-size: 12px; font-weight: 600; }
.dg-status.drawn   { color: var(--success); }
.dg-status.pending { color: var(--warn); }

/* 실제 당첨번호 행 */
.dg-win-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; background: #f0fdf4;
  border-bottom: 1px solid #d1fae5;
  flex-wrap: wrap;
}
.dg-win-label { font-size: 12px; color: #065f46; font-weight: 600; white-space: nowrap; }
.dg-win-numbers { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* 개별 티켓 */
.ticket-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.ticket-item:last-child { border-bottom: none; }

.ticket-strategy { font-size: 12px; color: var(--text-sub); min-width: 80px; }
.ticket-numbers  { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ticket-result   { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.rank-badge {
  font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 20px;
  white-space: nowrap;
}
.rank-badge.rank-1 { background: #fef3c7; color: #92400e; border: 1px solid #fbbf24; }
.rank-badge.rank-2 { background: #f1f5f9; color: #475569; border: 1px solid #94a3b8; }
.rank-badge.rank-3 { background: #fff7ed; color: #92400e; border: 1px solid #fb923c; }
.rank-badge.rank-4 { background: var(--primary-l); color: var(--primary); border: 1px solid #a5b4fc; }
.rank-badge.rank-5 { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.rank-badge.rank-0 { background: var(--surface2); color: var(--text-sub); }
.rank-badge.pending { background: #fef3c7; color: #92400e; border: 1px dashed #fbbf24; }

.match-info { font-size: 11px; color: var(--text-sub); white-space: nowrap; }

.btn-delete-ticket {
  background: none; border: none; cursor: pointer;
  color: var(--text-sub); font-size: 16px; padding: 4px;
  border-radius: 4px; line-height: 1;
  transition: color .15s;
}
.btn-delete-ticket:hover { color: var(--danger); }

/* 빈 상태 */
.empty-state {
  text-align: center; padding: 64px 24px;
  background: var(--surface); border-radius: var(--radius);
  border: 2px dashed var(--border);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.empty-sub  { font-size: 13px; color: var(--text-sub); margin-bottom: 20px; }
.btn-go-recommend {
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  padding: 10px 24px; border-radius: 20px; font-size: 14px; font-weight: 600;
  transition: background .15s;
}
.btn-go-recommend:hover { background: var(--primary-h); }

/* ── 저장 모달 ────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadein .15s ease;
}
.modal {
  background: var(--surface); border-radius: 16px;
  padding: 28px 24px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-title   { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.modal-desc    { font-size: 13px; color: var(--text-sub); margin-bottom: 16px; }
.modal-balls   { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.modal-target  {
  background: var(--surface2); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-target-label { font-size: 12px; color: var(--text-sub); }
.modal-target-value { font-size: 15px; font-weight: 800; color: var(--primary); }
.modal-actions { display: flex; gap: 10px; }
.btn-modal-cancel {
  flex: 1; padding: 11px; border-radius: 8px;
  background: var(--surface2); border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--text-sub);
}
.btn-modal-save {
  flex: 2; padding: 11px; border-radius: 8px;
  background: var(--primary); border: none; cursor: pointer;
  font-size: 14px; font-weight: 700; color: #fff;
  transition: background .15s;
}
.btn-modal-save:hover { background: var(--primary-h); }

/* 하단 탭바 배지 */
.bn-badge {
  position: absolute; top: 6px; right: calc(50% - 18px);
  background: var(--danger); color: #fff;
  border-radius: 8px; font-size: 9px; font-weight: 700;
  padding: 1px 4px; line-height: 1.4; min-width: 14px; text-align: center;
}
.bn-btn { position: relative; }

/* ── 스켈레톤 ────────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, #e8eaf0 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ════════════════════════════════════════════════════════════════════════════
   모바일 반응형  (≤ 768px)
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* 헤더 슬림화 */
  .header-inner {
    padding: 0 16px;
    height: 52px;
    gap: 0;
  }
  .logo-sub  { display: none; }
  .logo-text { font-size: 16px; }
  .logo-icon { font-size: 20px; }

  /* 상단 nav 숨기고 하단 탭바 표시 */
  .nav        { display: none; }
  .header-meta { margin-left: auto; gap: 4px; }
  .header-meta .status-badge,
  .header-meta .visit-badge { font-size: 11px; padding: 3px 8px; }

  /* ── 하단 탭바 ── */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(0,0,0,.08);
    z-index: 300;
  }
  .bn-btn {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    background: none; border: none; cursor: pointer;
    padding: 6px 4px;
    color: var(--text-sub);
    font-size: 10px; font-weight: 600;
    transition: color .15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .bn-btn .bn-icon {
    font-size: 22px;
    line-height: 1;
    transition: transform .2s;
  }
  .bn-btn.active        { color: var(--primary); }
  .bn-btn.active .bn-icon { transform: scale(1.15); }

  /* 메인 패딩 — 하단 탭바 + safe area */
  .main {
    padding: 16px 14px calc(var(--bottom-nav-h) + var(--safe-bottom) + 20px);
  }

  /* 번호 추천 */
  .page-hero   { padding: 24px 0 20px; }
  .page-title  { font-size: 22px; }
  .page-desc   { font-size: 14px; margin-bottom: 20px; }
  .btn-generate { padding: 13px 28px; font-size: 15px; }

  .recommend-grid { grid-template-columns: 1fr; gap: 14px; margin-bottom: 24px; }
  .rec-card { padding: 18px; }
  .rec-desc { min-height: unset; margin-bottom: 14px; }

  /* 볼 사이즈 — 터치 타겟 최소 44px 확보 */
  .ball    { width: 44px; height: 44px; font-size: 15px; }
  .ball.sm { width: 36px; height: 36px; font-size: 13px; }
  .ball.lg { width: 44px; height: 44px; font-size: 15px; }

  /* 정보 카드 2×2 */
  .info-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .info-card  { padding: 16px 12px; }
  .info-icon  { font-size: 22px; }
  .info-value { font-size: 14px; }

  /* 통계 요약 카드 2×2 */
  .summary-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .sc-value { font-size: 22px; }

  /* 핫/콜드 한 열 */
  .hot-cold-row { grid-template-columns: 1fr; gap: 12px; }
  .hc-card { padding: 16px; }
  .hc-card h3 { font-size: 14px; margin-bottom: 10px; }

  /* 차트 */
  .charts-grid { grid-template-columns: 1fr; gap: 14px; margin-bottom: 20px; }
  .chart-card.wide { grid-column: unset; }
  .chart-card { padding: 16px; }
  .chart-wrap           { height: 180px; }
  .chart-card.wide .chart-wrap { height: 160px; }

  /* 테이블 */
  .table-card { padding: 16px; }

  /* 최근 당첨 */
  .stats-header { margin-bottom: 16px; }
  .recent-card  { padding: 14px 16px; }
  .recent-no    { font-size: 17px; }
  .recent-numbers { gap: 5px; }
  .ball-row { gap: 5px; }

  /* 내 번호함 */
  .ticket-stats-row   { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .ts-value           { font-size: 20px; }
  .mytickets-header-row { flex-wrap: wrap; gap: 10px; }
  .draw-group-header  { padding: 12px 14px; flex-wrap: wrap; gap: 6px; }
  .dg-draw-no         { font-size: 15px; }
  .dg-win-row         { padding: 10px 14px; gap: 8px; }
  .ticket-item        { padding: 12px 14px; gap: 8px; }
  .ticket-result      { margin-left: 0; width: 100%; justify-content: flex-start; margin-top: 6px; }
  .ticket-strategy    { min-width: unset; width: 100%; margin-bottom: 4px; }

  /* 모달 */
  .modal-backdrop { padding: 16px; }
  .modal { padding: 22px 18px; }

  /* 토스트 위치 조정 */
  .toast {
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
    font-size: 13px; padding: 10px 20px;
  }
}

/* ── 동기화 카드 / 모달 ─────────────────────────────────────────────────── */
.sync-card {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 18px 22px;
    margin-bottom: 18px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    border-radius: 16px;
    color: #fff;
    box-shadow: 0 8px 24px -8px rgba(99, 102, 241, .45);
    overflow: hidden;
}
.sync-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 90% 10%, rgba(255,255,255,.18), transparent 40%),
        radial-gradient(circle at 10% 90%, rgba(255,255,255,.10), transparent 40%);
    pointer-events: none;
}
.sync-info { flex: 1; min-width: 0; position: relative; z-index: 1; }
.sync-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}
.sync-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, .85);
    line-height: 1.5;
}
.sync-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.btn-sync {
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    border: 1px solid rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .15);
    color: #fff;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.btn-sync:hover {
    background: rgba(255, 255, 255, .28);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}
.btn-sync:active { transform: translateY(0); }
.btn-sync-issue {
    background: #fff;
    color: #4f46e5;
    border-color: #fff;
}
.btn-sync-issue:hover {
    background: #fafbff;
    color: #3730a3;
}
.btn-sync:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sync-code-box {
    position: relative;
    margin: 18px 0 10px;
    padding: 22px 12px;
    background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
    border: 2px dashed #a5b4fc;
    border-radius: 14px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 8px;
    text-align: center;
    color: #312e81;
    user-select: all;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}
.sync-expires {
    font-size: 12.5px;
    color: #64748b;
    text-align: center;
    margin-bottom: 14px;
}
.sync-code-input {
    width: 100%;
    margin: 14px 0;
    padding: 16px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 6px;
    text-align: center;
    text-transform: uppercase;
    color: #312e81;
    background: #fafbff;
    border: 2px solid #c7d2fe;
    border-radius: 12px;
    outline: none;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}
.sync-code-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .15);
}

@media (max-width: 600px) {
    .sync-card { flex-direction: column; align-items: stretch; padding: 16px 18px; }
    .sync-actions { justify-content: stretch; }
    .btn-sync { flex: 1; padding: 12px 14px; }
    .sync-code-box { font-size: 28px; letter-spacing: 5px; padding: 18px 8px; }
    .sync-code-input { font-size: 20px; letter-spacing: 4px; }
}

/* ── 아주 작은 화면 (≤ 380px) ───────────────────────────────────────────── */
@media (max-width: 380px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .ball    { width: 40px; height: 40px; font-size: 14px; }
  .ball.sm { width: 32px; height: 32px; font-size: 12px; }
  .recent-numbers { gap: 4px; }
}

/* ── 면책 배너 (추천 페이지) ─────────────────────────────────────────────── */
.disclaimer-banner {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 20px 0 8px; padding: 12px 16px;
  background: #fff8e1; border: 1px solid #ffe082; border-left: 4px solid #ffb300;
  border-radius: 8px; font-size: 13px; line-height: 1.55; color: #5d4037;
}
.disclaimer-banner .disclaimer-icon { font-size: 16px; flex-shrink: 0; }
.disclaimer-banner strong { color: #3e2723; }

/* ── 통계 검정 카드 (통계 페이지) ────────────────────────────────────────── */
.sig-tests-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px; margin: 20px 0;
}
.sig-card {
  background: var(--surface); border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.sig-card .sig-head { display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 10px; }
.sig-card h3 { margin: 0; font-size: 14px; font-weight: 700; color: #374151; }
.sig-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: #e5e7eb; color: #4b5563;
  white-space: nowrap;
}
.sig-badge.ok   { background: #d1fae5; color: #065f46; }
.sig-badge.warn { background: #fee2e2; color: #991b1b; }
.sig-stat { font-size: 13px; color: #1f2937; line-height: 1.7; }
.sig-stat b { color: #111827; font-weight: 700; }
.sig-note { margin-top: 8px; font-size: 12px; color: #6b7280; line-height: 1.5; }
.sig-num {
  display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px;
  background: #f3f4f6; border-radius: 6px; font-weight: 700;
}
.sig-num small { color: #6b7280; font-weight: 400; margin-left: 2px; }
.sig-empty { color: #9ca3af; }

/* z-sum / AC 메타 칩 */
.rec-meta-item[title] { cursor: help; }
