:root {
  --gold: #fbc02d; --blue: #1976d2; --red: #e53935;
  --gray: #757575; --green: #43a047;
  --bg-color: #f8fafc;
  --text-color: #1e293b;
  --card-bg: #ffffff;
  --btn-bg: #2563eb;
  --btn-hover: #1d4ed8;
  --btn-history-bg: #64748b;
  --btn-history-hover: #475569;
  --btn-text: #ffffff;
  --shadow: rgba(0, 0, 0, 0.05);
  --border-color: #e2e8f0;
  --accent-color: #2563eb;
}

[data-theme="dark"] {
  --bg-color: #0f172a;
  --text-color: #f1f5f9;
  --card-bg: #1e293b;
  --btn-bg: #3b82f6;
  --btn-hover: #60a5fa;
  --btn-history-bg: #475569;
  --btn-history-hover: #64748b;
  --btn-text: #ffffff;
  --shadow: rgba(0, 0, 0, 0.3);
  --border-color: #334155;
}

* { box-sizing: border-box; }

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}


.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 2rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px var(--shadow);
}

.logo { font-size: 1.5rem; font-weight: 800; color: var(--accent-color); text-decoration: none; display: flex; align-items: center; gap: 0.5rem; }

.nav-menu { display: flex; gap: 1rem; align-items: center; }

.nav-menu a { text-decoration: none; color: var(--text-color); font-weight: 600; font-size: 0.95rem; padding: 0.5rem 0.8rem; border-radius: 0.6rem; transition: all 0.2s; opacity: 0.7; }
.nav-menu a:hover { opacity: 1; background: var(--bg-color); color: var(--accent-color); }
.nav-menu a.active { opacity: 1; color: var(--accent-color); background: rgba(37,99,236,0.1); }

.top-controls { display: flex; gap: 0.75rem; align-items: center; }

.top-controls select, .action-bar select { appearance: none; background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: 0.75rem; color: var(--text-color); font-size: 0.95rem; font-weight: 600; cursor: pointer; padding: 0.6rem 2.5rem 0.6rem 1rem; outline: none; transition: all 0.2s; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1.25rem; }

.card { background: var(--card-bg); border-radius: 1rem; box-shadow: 0 4px 10px var(--shadow); border: 1px solid var(--border-color); }

/* Main Layout */
.main-content { max-width: 900px; width: 100%; margin: 3rem auto; padding: 0 1.5rem; display: flex; flex-direction: column; }

.action-bar { width: 100%; display: flex; align-items: center; padding: 1rem; gap: 0.5rem; margin-bottom: 3rem; flex-wrap: wrap; }
.select-group { flex: 1; min-width: 150px; display: flex; flex-direction: column; padding: 0.5rem 1rem; }
.select-group label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; opacity: 0.6; }

.divider { width: 1px; height: 40px; background: var(--border-color); margin: 0 0.5rem; }

.button-group { display: flex; gap: 0.75rem; flex: 2; min-width: 200px; }

.btn-generate { flex: 1; color: var(--btn-text); border: none; padding: 0.8rem 1.5rem; border-radius: 1rem; font-size: 1rem; font-weight: 700; cursor: pointer; background: var(--btn-bg); transition: all 0.2s; white-space: nowrap; }
.btn-generate:hover { background: var(--btn-hover); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }

.btn-theme { padding: 0.5rem 1rem; border-radius: 0.75rem; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-color); cursor: pointer; font-weight: 600; transition: all 0.2s; }

/* Hero */
.hero { margin-bottom: 2.5rem; }
.hero { background-size: cover; background-position: center; min-height: 260px; display: flex; align-items: center; border-radius: 1rem; overflow: hidden; width: 100%; }
.hero .hero-content { padding: 2rem; color: white; text-shadow: 0 2px 6px rgba(0,0,0,0.5); }
.hero .hero-content h1 { margin: 0; font-size: 1.75rem; }
.hero .hero-content p { margin: 0.25rem 0 0; opacity: 0.9; }

/* Images */
.content-image { width: 100%; max-height: 400px; object-fit: cover; border-radius: 1rem; margin: 30px 0; }

/* Lotto Balls */
.container { width: 100%; }
.lotto-row { background: var(--card-bg); border-radius: 1.25rem; padding: 1.5rem; margin-bottom: 1.25rem; display: flex; justify-content: center; gap: 0.75rem; box-shadow: 0 4px 6px var(--shadow); transform: translateY(15px); opacity: 0; transition: 0.4s cubic-bezier(0.4,0,0.2,1); flex-wrap: wrap; border: 1px solid var(--border-color); }
.lotto-row.show { transform: translateY(0); opacity: 1; }
.ball { width: 44px; height: 44px; border-radius: 50%; color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; text-shadow: 0 1px 2px rgba(0,0,0,0.2); box-shadow: inset 0 -3px 6px rgba(0,0,0,0.2); }
.ball.special { border: 3px solid #fbbf24; box-shadow: 0 0 15px rgba(251,191,36,0.4), inset 0 -3px 6px rgba(0,0,0,0.2); }
.ball-10 { background: linear-gradient(135deg, #fcd34d, #f59e0b); }
.ball-20 { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.ball-30 { background: linear-gradient(135deg, #f87171, #dc2626); }
.ball-40 { background: linear-gradient(135deg, #94a3b8, #475569); }
.ball-50 { background: linear-gradient(135deg, #4ade80, #16a34a); }
.ball-high { background: linear-gradient(135deg, #a78bfa, #7c3aed); }

/* Footer */
footer { background: var(--card-bg); border-top: 1px solid var(--border-color); padding: 3rem 2rem; margin-top: auto; }
.footer-content { max-width: 900px; margin: 0 auto; text-align: center; }
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.footer-links a { text-decoration: none; color: var(--text-color); font-weight: 600; opacity: 0.6; }
.footer-links a:hover { opacity: 1; color: var(--accent-color); }
.responsible-gambling { font-size: 0.9rem; color: var(--red); font-weight: 700; margin-bottom: 1rem; }
.footer-info { font-size: 0.85rem; opacity: 0.4; }

@media (max-width: 768px) {
  .nav-menu { display: none; }
  .action-bar { flex-direction: column; align-items: stretch; }
  .divider { display: none; }
  .button-group { flex-direction: column; min-width: unset; }
}

/* Layout constraints to prevent full-width stretching */
.main-content { align-items: center; }
.action-bar { max-width: 900px; width: 100%; box-sizing: border-box; }
.container { max-width: 900px; margin: 0 auto; box-sizing: border-box; }
.lotto-row { max-width: 760px; margin-left: auto; margin-right: auto; }

/* Page-specific spacing */
.main-content .query-box { margin-top: 1.75rem; }
.main-content #status-message { margin-top: 1rem; }

/* Global content spacing for readable paragraphs and headings */
.main-content p, .main-content ul, .main-content ol { margin-top: 1rem; margin-bottom: 1rem; line-height: 1.7; }
.main-content h2 { margin-top: 2rem; margin-bottom: 1rem; }
.main-content h3 { margin-top: 1.5rem; margin-bottom: 0.75rem; }
.main-content ul { padding-left: 1.25rem; }
.main-content li { margin-bottom: 0.5rem; }
@media (max-width: 768px) { .main-content p, .main-content ul, .main-content ol { margin-top: 0.75rem; margin-bottom: 0.75rem; } .hero { min-height: 200px; } }