/* Lotto 6/45 Generator & Statistics Stylesheet */
/* Compatible with Haruism Dark Slate Design System */

.lotto-app {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* =========================================================
   1. 동행복권 5색 공식 3D 볼 (Spherical Shading Design System)
   ========================================================= */
.lotto-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-family: 'Pretendard', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1;
  user-select: none;
  position: relative;
  flex-shrink: 0;
  /* 3D Sphere Inset Glare & Outer Shadow */
  box-shadow: 
    inset 2px 2px 4px rgba(255, 255, 255, 0.65),
    inset -2px -2px 5px rgba(0, 0, 0, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.28);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.lotto-ball.ball-sm {
  width: 34px;
  height: 34px;
  font-size: 0.88rem;
  box-shadow: 
    inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.6),
    inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.3),
    0 3px 6px rgba(0, 0, 0, 0.2);
}

.lotto-ball.ball-lg {
  width: 48px;
  height: 48px;
  font-size: 1.22rem;
}

/* 1 ~ 10: 노랑 (Yellow) */
.lotto-ball.ball-yellow {
  background: radial-gradient(circle at 35% 30%, #FFF4A3 0%, #FBC400 45%, #DF8E00 100%);
  color: #2D2300;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 11 ~ 20: 파랑 (Blue) */
.lotto-ball.ball-blue {
  background: radial-gradient(circle at 35% 30%, #A6E3FF 0%, #3498DB 50%, #155799 100%);
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 21 ~ 30: 빨강 (Red) */
.lotto-ball.ball-red {
  background: radial-gradient(circle at 35% 30%, #FFA8A8 0%, #FF5A5A 50%, #C0292B 100%);
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 31 ~ 40: 회색 (Gray) */
.lotto-ball.ball-gray {
  background: radial-gradient(circle at 35% 30%, #EEEEEE 0%, #9E9E9E 50%, #5E5E5E 100%);
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* 41 ~ 45: 초록 (Green) */
.lotto-ball.ball-green {
  background: radial-gradient(circle at 35% 30%, #D4FC79 0%, #2ECC71 50%, #1E824C 100%);
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.ball-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   2. 최신 추첨 번호 요약 헤더 (Latest Draw Card)
   ========================================================================== */
.lotto-header-card {
  background: linear-gradient(135deg, #1E293B 0%, #162032 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.45), 0 0 25px rgba(99, 102, 241, 0.08);
}

.draw-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-color);
}

.draw-badge-group {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: #10B981;
  border-radius: 50%;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

.round-indicator {
  font-size: 1.15rem;
  font-weight: 800;
  color: #F8FAFC;
}

.draw-date-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.header-refresh-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.6);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.latest-balls-wrapper {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.latest-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.balls-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.bonus-separator {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-muted);
}

.bonus-block {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.bonus-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #F87171;
  background: rgba(239, 68, 68, 0.12);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* =========================================================
   3. 1~45번 볼 출현 빈도수 분석 패널 (Statistics Card)
   ========================================================= */
.stats-card, .generator-card, .results-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 10px 25px -8px rgba(0, 0, 0, 0.4);
}

.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: #F8FAFC;
  margin-bottom: 0.35rem;
  letter-spacing: -0.015em;
}

.section-desc {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.stats-legend {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  background: rgba(15, 23, 42, 0.5);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.color-chip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.chip-yellow { background: #FBC400; }
.chip-blue { background: #3498DB; }
.chip-red { background: #FF5A5A; }
.chip-gray { background: #9E9E9E; }
.chip-green { background: #2ECC71; }

/* HOT / COLD Top 5 Badges */
.top-rank-badges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 680px) {
  .top-rank-badges {
    grid-template-columns: 1fr;
  }
}

.rank-badge-box {
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rank-badge-box.hot-box {
  border-color: rgba(239, 68, 68, 0.3);
  background: linear-gradient(145deg, rgba(239, 68, 68, 0.08) 0%, rgba(15, 23, 42, 0.7) 100%);
}

.rank-badge-box.cold-box {
  border-color: rgba(6, 182, 212, 0.3);
  background: linear-gradient(145deg, rgba(6, 182, 212, 0.08) 0%, rgba(15, 23, 42, 0.7) 100%);
}

.rank-badge-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  color: var(--text-primary);
}

.badge-ball-list {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.rank-ball-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.rank-ball-item:hover {
  transform: translateY(-2px);
}

.rank-subtext {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.hot-box .rank-subtext {
  color: #F87171;
}

.cold-box .rank-subtext {
  color: #38BDF8;
}

/* 1~45 Frequency Grid */
.freq-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding: 0 0.2rem;
}

.freq-view-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.freq-hint {
  font-size: 0.78rem;
  color: var(--secondary-accent);
}

.number-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.65rem;
  max-height: 380px;
  overflow-y: auto;
  padding: 0.4rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.number-cell {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.number-cell:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary-accent);
  transform: translateY(-2px);
}

.number-cell.cell-fixed {
  border-color: #10B981;
  background: rgba(16, 185, 129, 0.15);
}

.number-cell.cell-excluded {
  border-color: #EF4444;
  background: rgba(239, 68, 68, 0.15);
  opacity: 0.6;
}

.number-cell .cell-status-tag {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 4px;
  padding: 0 3px;
}

.cell-fixed .cell-status-tag {
  color: #10B981;
}

.cell-excluded .cell-status-tag {
  color: #EF4444;
}

.freq-bar-wrapper {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.freq-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.freq-count-text {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ==========================================================================
   4. 번호 생성 모드 탭 및 필터 패널 (Generator Settings)
   ========================================================================== */
.algo-tabs-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 1.5rem;
}

.algo-tab {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.algo-tab:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.algo-tab.active {
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.18) 0%, rgba(15, 23, 42, 0.8) 100%);
  border-color: var(--primary-accent);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
}

.algo-tab-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.algo-icon {
  font-size: 1.1rem;
}

.algo-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.algo-badge-recommended {
  font-size: 0.65rem;
  font-weight: 800;
  background: rgba(99, 102, 241, 0.3);
  color: #A5B4FC;
  padding: 0.15rem 0.4rem;
  border-radius: 9999px;
  margin-left: auto;
}

.algo-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Custom Filters Grid (Fixed & Excluded) */
.custom-filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  background: rgba(15, 23, 42, 0.5);
  padding: 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

@media (max-width: 680px) {
  .custom-filters-grid {
    grid-template-columns: 1fr;
  }
}

.filter-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.filter-col-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.filter-count {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.selected-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 48px;
  align-items: center;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.75rem;
}

.tags-empty-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.number-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.45rem 0.2rem 0.3rem;
  border-radius: var(--radius-full);
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid var(--border-color);
}

.tag-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 0.2rem;
  transition: color var(--transition-fast);
}

.tag-remove-btn:hover {
  color: #EF4444;
}

.btn-picker-open {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--border-color);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-picker-open:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
  border-color: var(--primary-accent);
}

/* Action Bar: Slider + Large CTA */
.action-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
}

.game-count-control {
  flex: 1;
  min-width: 220px;
}

.control-label {
  display: block;
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.control-label strong {
  color: var(--secondary-accent);
}

.slider-wrapper {
  position: relative;
  width: 100%;
}

.slider-wrapper input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  background: rgba(15, 23, 42, 0.8);
  height: 8px;
  border-radius: 4px;
  outline: none;
  border: 1px solid var(--border-color);
}

.slider-wrapper input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-accent);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.slider-wrapper input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 0.35rem;
  padding: 0 4px;
}

.btn-generate-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
  color: #FFFFFF;
  border: none;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 0.95rem 1.8rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.5), 0 0 20px rgba(99, 102, 241, 0.25);
  transition: all var(--transition-fast);
}

.btn-generate-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -5px rgba(99, 102, 241, 0.65), 0 0 25px rgba(99, 102, 241, 0.35);
}

.btn-generate-cta:active {
  transform: translateY(1px);
}

.cta-icon {
  font-size: 1.25rem;
  transition: transform 0.3s ease;
}

.btn-generate-cta:hover .cta-icon {
  transform: rotate(15deg) scale(1.1);
}

/* =========================================================
   5. 번호 생성 결과 카드 영역 (Results Cards)
   ========================================================= */
.results-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-color);
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.btn-action-outline {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-action-outline:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: var(--secondary-accent);
}

.btn-action-primary {
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #A5B4FC;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-action-primary:hover {
  background: rgba(99, 102, 241, 0.3);
  color: #FFFFFF;
}

.games-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.game-card-item {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  transition: all var(--transition-fast);
}

.game-card-item:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(99, 102, 241, 0.3);
}

.game-card-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.game-badge-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.15);
  color: #818CF8;
  font-size: 1.15rem;
  font-weight: 800;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.game-balls-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.game-card-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.game-stats-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stat-chip {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.8);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.stat-chip.stat-pass {
  color: #34D399;
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.12);
}

.btn-card-copy {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-card-copy:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

/* =========================================================
   6. 팝업 모달 & 퀵 메뉴 (Picker Modal & Quick Popover)
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transform: scale(1);
  transition: transform 0.2s ease;
}

.modal-backdrop.hidden .modal-dialog {
  transform: scale(0.95);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.5rem;
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.modal-balls-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 500px) {
  .modal-balls-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.modal-ball-btn {
  background: transparent;
  border: 2px solid transparent;
  border-radius: 50%;
  padding: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform var(--transition-fast);
}

.modal-ball-btn:hover {
  transform: scale(1.1);
}

.modal-ball-btn.selected {
  border-color: #10B981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.modal-ball-btn.disabled-ball {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.modal-btn-reset {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.modal-btn-confirm {
  background: var(--primary-accent);
  border: none;
  color: #FFFFFF;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Quick Ball Menu Popover */
.quick-ball-menu {
  position: fixed;
  z-index: 2000;
  background: #1E293B;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
  min-width: 170px;
}

.quick-ball-menu.hidden {
  display: none;
}

.quick-ball-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.35rem;
}

.quick-ball-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.quick-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.quick-btn:hover {
  background: rgba(30, 41, 59, 0.9);
}

.quick-btn.btn-pin:hover {
  border-color: #10B981;
  color: #34D399;
}

.quick-btn.btn-ban:hover {
  border-color: #EF4444;
  color: #F87171;
}

.quick-btn.btn-cancel {
  color: var(--text-muted);
  text-align: center;
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0F172A;
  border: 1px solid #10B981;
  color: #F8FAFC;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  z-index: 3000;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-notification.hidden {
  opacity: 0;
  transform: translate(-50%, 15px);
  pointer-events: none;
}

/* =========================================================
   7. 모바일 화면 최적화 (360px ~ 480px)
   ========================================================= */
@media (max-width: 640px) {
  .lotto-app {
    padding: 0.85rem 0.6rem 3rem;
    gap: 1.25rem;
  }

  .lotto-header-card {
    padding: 1rem 0.85rem;
  }

  .draw-header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
  }

  .draw-badge-group {
    width: 100%;
    justify-content: space-between;
  }

  .round-indicator {
    font-size: 1.05rem;
  }

  /* 360px에서도 볼 6개 + 보너스볼 1개 줄바꿈 없이 한 줄 배치 */
  .latest-balls-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    width: 100%;
  }

  .latest-label {
    font-size: 0.8rem;
  }

  .latest-balls-container-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .latest-balls-wrapper .balls-row {
    gap: 0.35rem;
    flex-wrap: nowrap;
  }

  .latest-balls-wrapper .lotto-ball {
    width: 36px;
    height: 36px;
    font-size: 0.92rem;
  }

  .latest-balls-wrapper .bonus-separator {
    font-size: 1.1rem;
    margin: 0 0.15rem;
  }

  .latest-balls-wrapper .bonus-block {
    gap: 0.35rem;
    flex-wrap: nowrap;
  }

  .latest-balls-wrapper .bonus-label {
    display: none; /* 보너스 글자는 공간 확보를 위해 separator로 충분 */
  }

  /* 통계 카드 및 빈도 그리드 최적화 */
  .stats-card, .generator-card, .results-card {
    padding: 1.1rem 0.85rem;
  }

  .number-grid-container {
    grid-template-columns: repeat(7, 1fr);
    gap: 0.35rem;
    padding: 0.35rem;
    max-height: 320px;
  }

  .number-cell {
    padding: 0.4rem 0.2rem;
    min-height: 44px;
  }

  .number-cell .lotto-ball.ball-sm {
    width: 30px;
    height: 30px;
    font-size: 0.78rem;
  }

  .freq-count-text {
    font-size: 0.65rem;
  }

  /* 5대 모드 탭 모바일 가로 스크롤 처리 */
  .algo-tabs-list {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.5rem;
    gap: 0.65rem;
  }

  .algo-tabs-list::-webkit-scrollbar {
    display: none;
  }

  .algo-tab {
    flex: 0 0 220px;
    scroll-snap-align: start;
    min-height: 44px;
    padding: 0.8rem;
  }

  /* 고정수 / 제외수 커스텀 필터 박스 */
  .custom-filters-grid {
    padding: 0.85rem;
    gap: 1rem;
  }

  .btn-picker-open {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .btn-generate-cta {
    width: 100%;
    min-height: 48px;
    padding: 0.85rem 1rem;
    font-size: 0.98rem;
  }

  /* 모달 1~45번 7열 그리드 터치 최적화 */
  .modal-dialog {
    padding: 1.1rem 0.85rem;
    max-width: 95vw;
  }

  .modal-balls-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 0.4rem;
  }

  .modal-ball-btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .modal-ball-btn .lotto-ball {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }

  .modal-btn-reset, .modal-btn-confirm {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* 결과 카드 최적화 */
  .results-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .results-actions {
    width: 100%;
    justify-content: space-between;
  }

  .btn-action-outline, .btn-action-primary {
    min-height: 44px;
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .game-card-item {
    padding: 0.85rem 0.75rem;
    gap: 0.75rem;
  }

  .game-card-left {
    gap: 0.5rem;
    width: 100%;
    justify-content: flex-start;
  }

  .game-badge-letter {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    flex-shrink: 0;
  }

  .game-balls-group {
    gap: 0.35rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .game-balls-group::-webkit-scrollbar {
    display: none;
  }

  .game-balls-group .lotto-ball {
    width: 36px;
    height: 36px;
    font-size: 0.92rem;
  }

  .game-card-right {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
  }

  .btn-card-copy {
    min-height: 44px;
    min-width: 68px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
  }
}

@media (max-width: 375px) {
  .latest-balls-wrapper .lotto-ball {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
  }
  .latest-balls-wrapper .balls-row {
    gap: 0.25rem;
  }
  .game-balls-group .lotto-ball {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
  }
  .number-grid-container {
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
  }
  .number-cell .lotto-ball.ball-sm {
    width: 26px;
    height: 26px;
    font-size: 0.72rem;
  }
}

