/* SEO & Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

:root {
  --primary: #007bff;
  --primary-soft: #e7f1ff;
  --primary-hover: #0056b3;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  
  --bg-app: #f0f2f5;
  --bg-card: #ffffff;
  --text-main: #1c1e21;
  --text-sub: #606770;
  --border: #dddfe2;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.12);
  
  --ball-size: 38px;
  --app-gap: 24px;
  --container-max: 1200px;
}

[data-theme="dark"] {
  --bg-app: #18191a;
  --bg-card: #242526;
  --text-main: #e4e6eb;
  --text-sub: #b0b3b8;
  --border: #3e4042;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  --primary-soft: #26394a;
}

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

body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  display: flex;
  justify-content: center;
  padding: 0;
  transition: background-color 0.3s;
}

/* Layout Wrapper */
.app-container {
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: var(--app-gap);
}

header { 
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 10px;
}

.brand { flex-shrink: 0; }
.logo-img { height: 60px; width: auto; }

/* Grid Dashboard System */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 380px; /* PC: 2 Columns */
  gap: var(--app-gap);
  align-items: start;
}

.main-column {
  display: flex;
  flex-direction: column;
  gap: var(--app-gap);
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: var(--app-gap);
  position: sticky;
  top: 40px;
}

/* Common Card Style */
.card {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Top Action Buttons */
.top-actions {
  position: fixed;
  top: 25px;
  right: 25px;
  display: flex;
  gap: 12px;
  z-index: 3000;
}

.theme-btn, .more-btn {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: none;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.more-icon { width: 24px; height: 24px; }

/* Latest Win Card (Sidebar PC) */
.latest-card {
  background: linear-gradient(135deg, #007bff, #00c6ff);
  color: white;
  padding: 30px;
  border-radius: 24px;
  box-shadow: 0 10px 25px rgba(0, 123, 255, 0.2);
  text-align: center;
}

.latest-win-balls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Main Generator Area */
.generator-card {
  border: 2px solid var(--primary-soft);
}

.action-area {
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.main-btn {
  width: 100%;
  padding: 24px;
  border-radius: 20px;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 123, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.main-btn:hover { background: var(--primary-hover); transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0, 123, 255, 0.4); }

/* Results */
.lotto-row {
  background: var(--bg-card);
  padding: 25px;
  border-radius: 24px;
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  animation: revealRow 0.6s ease-out both;
}

.balls-container { display: flex; gap: 10px; align-items: center; }

.ball {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 1.1rem;
  box-shadow: inset -3px -3px 6px rgba(0,0,0,0.2);
}

.ball-yellow { background: #fbc400; }
.ball-blue { background: #69c8f2; }
.ball-red { background: #ff7272; }
.ball-gray { background: #aaa; }
.ball-green { background: #b0d840; }

/* Filter UI */
.option-group { display: flex; gap: 8px; flex-wrap: wrap; }
.option-chip {
  padding: 10px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
  min-width: 80px;
  text-align: center;
  transition: all 0.2s;
}
.option-chip.active { background: var(--primary); color: white; border-color: var(--primary); }

.number-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
  margin: 20px 0;
}

.num-chip {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; font-size: 0.9rem; font-weight: 700; cursor: pointer;
}
.num-chip.fixed { background: var(--primary); color: white; border-color: var(--primary); }
.num-chip.excluded { background: var(--danger); color: white; border-color: var(--danger); }

/* Saved List & Stats (Sidebar PC) */
.saved-list { max-height: 400px; overflow-y: auto; }
.chart-container { height: 250px; width: 100%; margin-top: 15px; }

/* Guides Grid Layout - Magazine Style (Full Width Bottom) */
.guides-container {
  width: 100%;
}

.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 30px;
}

.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 30px;
  text-decoration: none;
  color: inherit;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  height: 100%;
}

.guide-card:hover {
  transform: translateY(-12px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.guide-icon-box {
  font-size: 2.5rem;
  margin-bottom: 20px;
  width: 70px; height: 70px;
  background: var(--bg-app);
  display: flex; align-items: center; justify-content: center;
  border-radius: 20px;
}

/* Modals */
.menu-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6); z-index: 9999; display: none;
  backdrop-filter: blur(8px);
}
.menu-overlay.active { display: block; }
.menu-content {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--bg-card); width: 90%; max-width: 400px;
  border-radius: 30px; padding: 30px; box-shadow: var(--shadow-lg);
}

/* Responsive Logic */
@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 1fr; /* Mobile/Tablet: 1 Column */
  }
  .side-column {
    position: static;
    order: 2; /* Move sidebar below main on mobile */
  }
  .main-column {
    order: 1;
  }
}

@media (max-width: 600px) {
  .app-container { padding: 20px 15px; }
  .number-grid { grid-template-columns: repeat(7, 1fr); }
  .logo-img { height: 50px; }
  .card { padding: 20px; border-radius: 20px; }
  .guide-card { padding: 20px; }
  .ball { width: 36px; height: 36px; font-size: 0.9rem; }
}

/* Footer */
.site-footer {
  margin-top: 60px;
  padding: 60px 20px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer-links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 15px; }
