/* ===== CSS Variables & Design Tokens ===== */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.1);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-gold: #fbbf24;
  --accent-purple: #a78bfa;
  --accent-blue: #60a5fa;
  --accent-pink: #f472b6;
  --glow-gold: rgba(251, 191, 36, 0.3);
  --glow-purple: rgba(167, 139, 250, 0.2);

  /* Lotto Ball Colors (Korean Lotto standard) */
  --ball-1-10: #fbbf24;    /* Yellow: 1-10 */
  --ball-11-20: #60a5fa;   /* Blue: 11-20 */
  --ball-21-30: #f87171;   /* Red: 21-30 */
  --ball-31-40: #a3a3a3;   /* Gray: 31-40 */
  --ball-41-45: #34d399;   /* Green: 41-45 */

  --font-main: 'Inter', 'Noto Sans KR', sans-serif;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 50%;
  --shadow-glow: 0 0 30px rgba(251, 191, 36, 0.15);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(0, 0, 0, 0.04);
  --bg-glass: rgba(255, 255, 255, 0.7);
  --border-glass: rgba(0, 0, 0, 0.1);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --shadow-glow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* ===== Theme Toggle Button ===== */
.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: var(--transition);
  color: var(--text-primary);
  z-index: 10;
}

.theme-toggle:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.15);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ===== Background Particles ===== */
.bg-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: var(--radius-full);
  opacity: 0;
  animation: floatParticle linear infinite;
}

@keyframes floatParticle {
  0% {
    opacity: 0;
    transform: translateY(100vh) scale(0);
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-10vh) scale(1);
  }
}

/* ===== Container ===== */
.container {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* ===== Header ===== */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo-icon {
  font-size: 40px;
  animation: swing 2s ease-in-out infinite;
}

@keyframes swing {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.logo h1 {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-pink), var(--accent-purple));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.logo .accent {
  font-weight: 900;
}

.subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Ball Display ===== */
.ball-display {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  margin-bottom: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-glow);
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.ball-display:hover {
  border-color: rgba(251, 191, 36, 0.2);
  box-shadow: 0 0 50px rgba(251, 191, 36, 0.1);
}

.balls-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.placeholder-text {
  text-align: center;
  color: var(--text-muted);
}

.placeholder-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 1; }
}

.placeholder-text p {
  font-size: 15px;
  font-weight: 500;
}

/* ===== Lotto Ball ===== */
.lotto-ball {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  position: relative;
  cursor: default;
  animation: ballAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.25), 0 4px 15px rgba(0,0,0,0.3);
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.3s ease;
}

.lotto-ball::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 14px;
  width: 24px;
  height: 12px;
  background: rgba(255,255,255,0.35);
  border-radius: 50%;
  transform: rotate(-20deg);
}

.lotto-ball:hover {
  transform: scale(1.15) rotate(5deg);
}

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

/* Ball color classes */
.ball-yellow {
  background: linear-gradient(145deg, #fcd34d, #f59e0b);
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.2), 0 4px 20px rgba(251, 191, 36, 0.4);
}

.ball-blue {
  background: linear-gradient(145deg, #93c5fd, #2563eb);
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.2), 0 4px 20px rgba(96, 165, 250, 0.4);
}

.ball-red {
  background: linear-gradient(145deg, #fca5a5, #dc2626);
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.2), 0 4px 20px rgba(248, 113, 113, 0.4);
}

.ball-gray {
  background: linear-gradient(145deg, #d4d4d4, #737373);
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.2), 0 4px 20px rgba(163, 163, 163, 0.3);
}

.ball-green {
  background: linear-gradient(145deg, #6ee7b7, #059669);
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.2), 0 4px 20px rgba(52, 211, 153, 0.4);
}

/* ===== Bonus Section ===== */
.bonus-section {
  text-align: center;
  margin-bottom: 24px;
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.8s;
}

.bonus-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-purple);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
  padding: 4px 16px;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 20px;
}

.bonus-ball {
  display: inline-flex;
}

.bonus-ball .lotto-ball {
  width: 56px;
  height: 56px;
  font-size: 22px;
  animation-delay: 0.9s;
  box-shadow: inset 0 -3px 6px rgba(0,0,0,0.2), 0 0 25px rgba(167, 139, 250, 0.3);
}

/* ===== Button Group ===== */
.button-group {
  display: flex;
  gap: 12px;
  margin-bottom: 40px;
}

.btn-generate, .btn-multi {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-generate {
  background: linear-gradient(135deg, #f59e0b, #ef4444, #a855f7);
  background-size: 200% 200%;
  color: white;
  animation: gradientShift 3s ease infinite;
  box-shadow: 0 4px 25px rgba(239, 68, 68, 0.3);
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 35px rgba(239, 68, 68, 0.4);
}

.btn-generate:active {
  transform: translateY(0px) scale(0.98);
}

.btn-multi {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
}

.btn-multi:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent-purple);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--glow-purple);
}

.btn-multi:active {
  transform: translateY(0px) scale(0.98);
}

.btn-icon {
  font-size: 22px;
}

/* Ripple effect */
.btn-generate::after, .btn-multi::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  transform: translate(-50%, -50%);
  transition: width 0.5s, height 0.5s;
}

.btn-generate:active::after, .btn-multi:active::after {
  width: 300px;
  height: 300px;
}

/* ===== Spinning Animation for Button ===== */
.btn-generate.spinning .btn-icon {
  animation: spin 0.5s ease;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== Multi Games Section ===== */
.multi-games {
  margin-bottom: 40px;
  animation: fadeInUp 0.6s ease both;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.games-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  backdrop-filter: blur(10px);
  animation: fadeInUp 0.4s ease both;
  transition: var(--transition);
}

.game-row:hover {
  border-color: rgba(251, 191, 36, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.game-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-gold);
  min-width: 28px;
  text-align: center;
}

.game-balls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.game-balls .lotto-ball {
  width: 40px;
  height: 40px;
  font-size: 15px;
  font-weight: 700;
}

.game-balls .lotto-ball::before {
  top: 5px;
  left: 8px;
  width: 14px;
  height: 7px;
}

.game-bonus-sep {
  color: var(--text-muted);
  font-size: 18px;
  font-weight: 300;
  margin: 0 2px;
}

/* ===== Stats Section ===== */
.stats-section {
  margin-bottom: 40px;
  animation: fadeInUp 0.6s ease both;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

/* ===== History Section ===== */
.history-section {
  margin-bottom: 40px;
  animation: fadeInUp 0.6s ease both;
}

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

.history-header .section-title {
  margin-bottom: 0;
}

.btn-clear {
  padding: 6px 16px;
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  border-radius: 20px;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.5);
}

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

.history-list::-webkit-scrollbar {
  width: 4px;
}

.history-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: var(--transition);
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.history-time {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 55px;
  font-weight: 500;
}

.history-balls {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.history-balls .lotto-ball {
  width: 30px;
  height: 30px;
  font-size: 12px;
  font-weight: 700;
  animation: none;
}

.history-balls .lotto-ball::before {
  display: none;
}

/* ===== Partnership Form ===== */
.contact-section {
  margin-bottom: 40px;
  animation: fadeInUp 0.6s ease both;
}

.contact-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(17, 24, 39, 0.7));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-glow);
}

[data-theme="light"] .contact-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 250, 252, 0.92));
}

.contact-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.22);
  background: rgba(251, 191, 36, 0.1);
  color: var(--accent-gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.contact-copy {
  margin-bottom: 20px;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
}

.partner-form {
  display: grid;
  gap: 14px;
}

.form-field {
  display: grid;
  gap: 8px;
}

.form-field span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-field input,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.35);
  color: var(--text-primary);
  padding: 14px 16px;
  font: inherit;
  transition: var(--transition);
}

[data-theme="light"] .form-field input,
[data-theme="light"] .form-field textarea {
  background: rgba(255, 255, 255, 0.84);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-muted);
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.12);
}

.form-field textarea {
  min-height: 132px;
  resize: vertical;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.btn-submit {
  border: none;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  color: #09111f;
  cursor: pointer;
  background: linear-gradient(135deg, #fbbf24, #fb7185);
  box-shadow: 0 10px 30px rgba(251, 191, 36, 0.2);
  transition: var(--transition);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(251, 191, 36, 0.28);
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.form-status {
  min-height: 20px;
  font-size: 13px;
  font-weight: 600;
}

.form-status.is-pending {
  color: var(--accent-gold);
}

.form-status.is-success {
  color: #34d399;
}

.form-status.is-error {
  color: #f87171;
}

/* ===== Comments ===== */
.comments-section {
  margin-bottom: 40px;
  animation: fadeInUp 0.6s ease both;
}

.comments-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(17, 24, 39, 0.7));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-glow);
}

[data-theme="light"] .comments-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 250, 252, 0.92));
}

#disqus_thread {
  margin-top: 18px;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-glass);
}

.footer p {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-sub {
  margin-top: 4px;
  font-size: 12px !important;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes confetti {
  0% {
    transform: translateY(0) rotateZ(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-400px) rotateZ(720deg);
    opacity: 0;
  }
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  z-index: 100;
  pointer-events: none;
  animation: confettiFall 2s ease-out forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .container {
    padding: 24px 16px 40px;
  }

  .logo h1 {
    font-size: 32px;
  }

  .lotto-ball {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }

  .lotto-ball::before {
    top: 6px;
    left: 10px;
    width: 18px;
    height: 9px;
  }

  .ball-display {
    padding: 30px 16px;
  }

  .balls-container {
    gap: 8px;
  }

  .button-group {
    flex-direction: column;
  }

  .btn-generate, .btn-multi {
    padding: 16px 20px;
  }

  .game-balls .lotto-ball {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .contact-card {
    padding: 24px 18px;
  }

  .comments-card {
    padding: 24px 18px;
  }
}
