:root {
  --bg: #14101f;
  --card: #1e1a2e;
  --card-alt: #292342;
  --accent: #6c5ce7;
  --accent-2: #fdcb6e;
  --accent-text: #fdcb6e;
  --text: #f2f0fa;
  --muted: #9d93c2;
  --border: #3a3358;
  --error: #ff6b6b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(108, 92, 231, 0.18);
  --glow: 0 0 16px rgba(108, 92, 231, 0.55);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Pretendard", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.6;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.site-header .logo { color: var(--text); text-decoration: none; font-weight: 700; }

main { width: 100%; padding: 24px 16px; }

.card {
  max-width: 720px;
  margin: 0 auto 24px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

.hero {
  max-width: 720px;
  margin: 8px auto 28px;
  padding: 44px 24px 8px;
  text-align: center;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -30px 12% auto 12%;
  height: 200px;
  background: radial-gradient(ellipse at center, rgba(108, 92, 231, 0.4), rgba(253, 203, 110, 0.14) 45%, transparent 72%);
  filter: blur(20px);
  pointer-events: none;
}

.hero-title {
  position: relative;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  text-wrap: balance;
  background: linear-gradient(135deg, #a99bff 0%, var(--accent) 45%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  position: relative;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 46ch;
  margin: 0 auto 24px;
}

.hero-cta { position: relative; display: inline-block; text-decoration: none; }

.card h1, .card h2 { margin-top: 0; }

.next-draw-inline {
  margin-top: 20px;
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.next-draw-round { font-weight: 700; font-size: 0.95rem; margin: 0 0 4px; }
.next-draw-datetime { color: var(--muted); font-size: 0.82rem; margin: 0 0 8px; }
.next-draw-cta { display: inline-block; }

.next-draw-badge {
  background: var(--accent-2);
  color: #1a1526;
  font-weight: 700;
  font-size: 1.2rem;
  padding: 10px 18px;
  border-radius: 10px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 14px rgba(253, 203, 110, 0.45);
}

.ball-list {
  display: flex;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 20px 0;
  flex-wrap: wrap;
}

.ball {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: default;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ball:hover {
  transform: scale(1.15) rotate(-4deg);
  box-shadow: var(--glow), 0 6px 14px rgba(0, 0, 0, 0.4);
}

.ball:active {
  transform: scale(0.9);
  transition-duration: 0.05s;
}

@keyframes ballPop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.ball--pop { animation: ballPop 0.35s ease backwards; }

/* 동행복권 공식 로또 볼 색상: 1-10 노랑/11-20 파랑/21-30 빨강/31-40 회색/41-45 초록 (진하게)
   글자색은 전부 흰색으로 통일 (조화), 노란 볼은 대비 보강을 위해 텍스트에 그림자 추가 */
.ball--band1 { background: #f5b700; }
.ball--band2 { background: #1f8fe6; }
.ball--band3 { background: #e6433f; }
.ball--band4 { background: #7c7c7c; }
.ball--band5 { background: #63b02c; }

.ball--bonus { background: #4b4370; }
.ball-list--compact .ball { width: 34px; height: 34px; font-size: 0.85rem; }

table { width: 100%; border-collapse: collapse; margin-top: 16px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
td a { color: var(--accent-text); text-decoration: none; }

.draw-nav { display: flex; justify-content: space-between; margin-bottom: 16px; }
.draw-nav a { color: var(--muted); text-decoration: none; }

.game-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.game-label { width: 140px; color: var(--muted); font-size: 0.9rem; }

.disclaimer { color: var(--muted); font-size: 0.85rem; }

.ad-slot {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.8rem;
  max-width: 720px;
  margin: 0 auto;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

.chart-card {
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.chart-card h2 { margin-top: 0; font-size: 1rem; color: var(--muted); }

@media (min-width: 600px) {
  .chart-grid { grid-template-columns: 1fr 1fr; }
  .chart-card:first-child,
  .chart-card:nth-child(5) { grid-column: 1 / -1; }
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #fff;
  font-weight: 600;
}

.legend { font-size: 0.8rem; color: var(--muted); margin-top: 12px; }
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin: 0 4px 0 12px;
}
.legend-dot--hot { background: var(--accent-2); }
.legend-dot--cold { background: var(--muted); }

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 24px;
}

.btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn:hover { border-color: var(--accent); }

.btn--accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}

.btn--accent:hover { box-shadow: var(--glow); }

.btn-link {
  background: none;
  border: none;
  color: var(--accent-text);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.generator-buttons { display: flex; gap: 12px; margin: 16px 0; }

.btn--purchase {
  display: inline-block;
  margin-top: 8px;
  background: var(--card-alt);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.btn--purchase:hover { background: var(--accent); color: #fff; box-shadow: var(--glow); }

.nickname-row { margin-top: 12px; }

.input {
  width: 100%;
  max-width: 280px;
  background: var(--card-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
}

.input:focus { outline: none; border-color: var(--accent); }

.ball--table {
  display: inline-flex;
  width: 30px;
  height: 30px;
  font-size: 0.85rem;
}

.history { margin-top: 24px; }
.history-header { display: flex; justify-content: space-between; align-items: center; }
.history-header h3 { margin: 0; font-size: 1rem; color: var(--muted); }
.history-empty { color: var(--muted); font-size: 0.9rem; }

.history-list { list-style: none; padding: 0; margin: 12px 0 0; }

.history-item {
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
}

.history-item-meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.8rem; margin-bottom: 8px; }

.history-item-tags { display: flex; gap: 6px; }

.tag {
  display: inline-block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--text);
}

.history-item-date { font-size: 0.7rem; color: var(--muted); flex-shrink: 0; margin-left: 8px; }
.history-item .ball-list { margin: 0; justify-content: center; }

.field-row { margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.field-row[hidden] { display: none; }
.field-row label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.field-row .input { max-width: 420px; }

.field-row--split { flex-direction: row; gap: 16px; flex-wrap: wrap; }
.field-row--split > div { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 6px; }
.field-row--split label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }

.input--round { max-width: 140px; }

.field-error { color: var(--error); font-size: 0.85rem; margin: 8px 0; }
.field-error--inline { margin: 0; }

.check-summary { margin: 4px 0; font-size: 0.95rem; }
.check-summary--accent { color: var(--accent-text); font-weight: 700; font-size: 1.1rem; }

.check-result { margin-top: 16px; }
.check-result .ball-list { margin: 12px 0; }

.ball--matched { box-shadow: 0 0 0 3px var(--accent) inset, 0 4px 10px rgba(0, 0, 0, 0.15); }
.ball--unmatched { opacity: 0.35; }

.check-tally {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-tally li {
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.tax-result, .sim-result { margin-top: 16px; }

.archive-search-row { max-width: 420px; margin-bottom: 8px; }
.archive-search-row .input { max-width: 100%; }
.archive-search-empty { color: var(--muted); font-size: 0.9rem; }

.check-history-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.check-history-list:empty { display: none; }

.check-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.check-history-item:last-child { border-bottom: none; }
.check-history-item:hover, .check-history-item:focus { background: var(--card-alt); outline: none; }

.check-history-item-meta { color: var(--muted); flex-shrink: 0; }
.check-history-item-numbers { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }

.check-history-empty { padding: 10px 14px; color: var(--muted); font-size: 0.85rem; }

.check-selected-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; margin: 16px 0 0; }
.checker #checkNumbersDisplay { margin-top: 8px; }

.freq-pill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 16px;
}

.freq-pill-col h3 { font-size: 0.85rem; color: var(--muted); margin: 0 0 10px; }

.freq-pills { display: flex; flex-wrap: wrap; gap: 8px; }

.freq-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

.freq-pill--popular { background: #2fbf8f; }
.freq-pill--unpopular { background: #4b4370; }

.freq-pill-count { font-weight: 400; font-size: 0.75rem; opacity: 0.85; }

@media (max-width: 480px) {
  .freq-pill-grid { grid-template-columns: 1fr; }
}
