@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
  --bg-gradient: radial-gradient(circle at 50% 50%, #1a1b36 0%, #0d0e1c 100%);
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
  --glass-glow: rgba(124, 77, 255, 0.15);
  
  --accent-color: #8c52ff;
  --accent-hover: #a173ff;
  --text-main: #ffffff;
  --text-muted: #a0aec0;
  
  /* Lotto Colors (Korea official scheme) */
  --lotto-yellow-start: #f1c40f;
  --lotto-yellow-end: #f39c12;
  --lotto-blue-start: #3498db;
  --lotto-blue-end: #2980b9;
  --lotto-red-start: #e74c3c;
  --lotto-red-end: #c0392b;
  --lotto-grey-start: #a2b4c6;
  --lotto-grey-end: #7f8c8d;
  --lotto-green-start: #2ecc71;
  --lotto-green-end: #27ae60;
  
  --font-english: 'Outfit', sans-serif;
  --font-korean: 'Noto Sans KR', sans-serif;
}

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

body {
  font-family: var(--font-korean);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow-x: hidden;
  position: relative;
}

/* Ambient glow elements */
body::before, body::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: var(--accent-color);
  filter: blur(150px);
  opacity: 0.15;
  z-index: 0;
  pointer-events: none;
}

body::before {
  top: 15%;
  left: 10%;
}

body::after {
  bottom: 15%;
  right: 10%;
}

/* Header styling */
header {
  width: 100%;
  max-width: 1200px;
  padding: 2.5rem 1.5rem 1.5rem;
  text-align: center;
  z-index: 1;
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  background: rgba(140, 82, 255, 0.15);
  border: 1px solid rgba(140, 82, 255, 0.3);
  border-radius: 99px;
  color: var(--accent-hover);
  font-family: var(--font-english);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  box-shadow: 0 0 15px rgba(140, 82, 255, 0.1);
}

h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 40%, #c0a9ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 300;
}

/* Main Container */
main {
  width: 100%;
  max-width: 680px;
  padding: 0 1.5rem;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex-grow: 1;
  justify-content: center;
}

/* Glassmorphism Card Style */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), 
              inset 0 1px 0 rgba(255, 255, 255, 0.1),
              0 0 40px var(--glass-glow);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Ball display area */
.display-container {
  position: relative;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 20px;
  padding: 2rem 1rem;
  margin-bottom: 2rem;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.5);
}

.placeholder-text {
  color: rgba(255, 255, 255, 0.15);
  font-size: 1.1rem;
  font-weight: 400;
  text-align: center;
  user-select: none;
  animation: pulse 2s infinite ease-in-out;
}

/* Lotto Ball design */
.ball {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-english);
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  position: relative;
  box-shadow: 0 10px 20px rgba(0,0,0,0.3),
              inset -5px -5px 15px rgba(0,0,0,0.4),
              inset 5px 5px 15px rgba(255,255,255,0.4);
  transform: scale(0);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  user-select: none;
}

/* Lotto ball shine highlight overlay */
.ball::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 12px;
  width: 20px;
  height: 10px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  transform: rotate(-10deg);
}

/* Colors categorized by official Korean Lotto standard */
.ball.y1-10 {
  background: radial-gradient(circle at 35% 35%, var(--lotto-yellow-start) 0%, var(--lotto-yellow-end) 80%);
  color: #3e2723;
  box-shadow: 0 8px 25px rgba(243, 156, 18, 0.3),
              inset -5px -5px 15px rgba(0,0,0,0.3),
              inset 5px 5px 15px rgba(255,255,255,0.4);
}
.ball.b11-20 {
  background: radial-gradient(circle at 35% 35%, var(--lotto-blue-start) 0%, var(--lotto-blue-end) 80%);
  box-shadow: 0 8px 25px rgba(41, 128, 185, 0.3),
              inset -5px -5px 15px rgba(0,0,0,0.3),
              inset 5px 5px 15px rgba(255,255,255,0.4);
}
.ball.r21-30 {
  background: radial-gradient(circle at 35% 35%, var(--lotto-red-start) 0%, var(--lotto-red-end) 80%);
  box-shadow: 0 8px 25px rgba(231, 76, 60, 0.3),
              inset -5px -5px 15px rgba(0,0,0,0.3),
              inset 5px 5px 15px rgba(255,255,255,0.4);
}
.ball.g31-40 {
  background: radial-gradient(circle at 35% 35%, var(--lotto-grey-start) 0%, var(--lotto-grey-end) 80%);
  box-shadow: 0 8px 25px rgba(127, 140, 141, 0.3),
              inset -5px -5px 15px rgba(0,0,0,0.3),
              inset 5px 5px 15px rgba(255,255,255,0.4);
}
.ball.gr41-45 {
  background: radial-gradient(circle at 35% 35%, var(--lotto-green-start) 0%, var(--lotto-green-end) 80%);
  box-shadow: 0 8px 25px rgba(46, 204, 113, 0.3),
              inset -5px -5px 15px rgba(0,0,0,0.3),
              inset 5px 5px 15px rgba(255,255,255,0.4);
}

/* Small balls in list */
.small-ball {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-english);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2),
              inset -2px -2px 5px rgba(0,0,0,0.4),
              inset 2px 2px 5px rgba(255,255,255,0.3);
  position: relative;
}
.small-ball.y1-10 { background: radial-gradient(circle at 35% 35%, var(--lotto-yellow-start) 0%, var(--lotto-yellow-end) 80%); color: #3e2723; }
.small-ball.b11-20 { background: radial-gradient(circle at 35% 35%, var(--lotto-blue-start) 0%, var(--lotto-blue-end) 80%); }
.small-ball.r21-30 { background: radial-gradient(circle at 35% 35%, var(--lotto-red-start) 0%, var(--lotto-red-end) 80%); }
.small-ball.g31-40 { background: radial-gradient(circle at 35% 35%, var(--lotto-grey-start) 0%, var(--lotto-grey-end) 80%); }
.small-ball.gr41-45 { background: radial-gradient(circle at 35% 35%, var(--lotto-green-start) 0%, var(--lotto-green-end) 80%); }

/* Button styles */
.btn-group {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

button {
  outline: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-korean);
  font-weight: 600;
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-color) 0%, #6633cc 100%);
  color: #fff;
  padding: 1.1rem 2rem;
  font-size: 1.1rem;
  box-shadow: 0 10px 25px rgba(140, 82, 255, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(140, 82, 255, 0.45);
  background: linear-gradient(135deg, var(--accent-hover) 0%, #7540f0 100%);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  padding: 1.1rem 1.5rem;
  font-size: 1rem;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-action-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 10px;
  font-weight: 500;
}

/* Options Panel (Filter rules) */
.accordion {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.15);
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.accordion-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.accordion-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.accordion-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.accordion.open .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
}

.accordion.open .accordion-content {
  max-height: 500px;
  transition: max-height 0.3s cubic-bezier(1, 0, 1, 0);
}

.accordion-body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.number-tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 0.75rem;
  min-height: 52px;
}

.number-selector-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-family: var(--font-english);
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.number-selector-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.number-selector-btn.selected-include {
  background: var(--accent-color);
  border-color: var(--accent-hover);
  color: #fff;
  box-shadow: 0 0 8px rgba(140, 82, 255, 0.5);
}

.number-selector-btn.selected-exclude {
  background: #e74c3c;
  border-color: #ff6b6b;
  color: #fff;
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.5);
}

.selector-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.35rem;
  justify-items: center;
}

/* Saved Combinations section */
.history-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 2rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

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

.history-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Scrollbar */
.history-list::-webkit-scrollbar {
  width: 6px;
}
.history-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}
.history-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
.history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  animation: slideIn 0.3s ease-out;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.history-balls {
  display: flex;
  gap: 0.4rem;
}

.history-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-icon.delete:hover {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
  color: #ff6b6b;
}

.empty-history {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 0;
  font-style: italic;
}

/* Sound configuration toggle */
.sound-toggle-container {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  max-width: 680px;
  padding: 0 1.5rem;
  margin-bottom: -0.5rem;
  z-index: 1;
}

.sound-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.sound-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sound-btn.active {
  color: var(--accent-hover);
  border-color: rgba(140, 82, 255, 0.3);
  background: rgba(140, 82, 255, 0.08);
}

/* Statistics panel */
.stats-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1rem;
}

.stat-box {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-english);
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(140, 82, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 999;
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(10px);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Footer styling */
footer {
  width: 100%;
  padding: 2rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.8rem;
  font-family: var(--font-english);
  letter-spacing: 0.05em;
  z-index: 1;
}

/* Keyframes */
@keyframes pulse {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.4; }
}

@keyframes popIn {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

@keyframes slideIn {
  0% {
    transform: translateY(-10px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.shake-animation {
  animation: shake 0.3s ease-in-out;
}

/* Responsive */
@media (max-width: 480px) {
  h1 {
    font-size: 1.8rem;
  }
  .display-container {
    min-height: 140px;
    padding: 1.5rem 0.5rem;
  }
  .ball {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }
  .ball::before {
    top: 4px;
    left: 9px;
    width: 15px;
    height: 8px;
  }
  .glass-card {
    padding: 1.5rem;
  }
  .btn-group {
    grid-template-columns: 1fr;
  }
  .selector-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}
