* {
  box-sizing: border-box;
}

:root {
  --bg: linear-gradient(135deg, #f8fafc, #e2e8f0);
  --card-bg: #ffffff;
  --text: #111827;
  --muted: #4b5563;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --shadow: rgba(15, 23, 42, 0.12);
  --ball-bg: linear-gradient(135deg, #f59e0b, #ef4444);
  --ball-border: rgba(255, 255, 255, 0.85);
}

body.dark {
  --bg: linear-gradient(135deg, #111827, #1f2937);
  --card-bg: #1f2937;
  --text: #f9fafb;
  --muted: #d1d5db;
  --primary: #60a5fa;
  --primary-hover: #3b82f6;
  --shadow: rgba(0, 0, 0, 0.35);
  --ball-bg: linear-gradient(135deg, #fb923c, #f43f5e);
  --ball-border: rgba(255, 255, 255, 0.9);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: background 0.2s ease, color 0.2s ease;
}

.app-shell {
  width: min(100%, 500px);
}

.card {
  background: var(--card-bg);
  border-radius: 24px;
  box-shadow: 0 16px 40px var(--shadow);
  padding: 28px 24px;
  text-align: center;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.card-header {
  text-align: left;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: bold;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
}

.lang-btn,
.theme-toggle {
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.lang-btn {
  padding: 6px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.lang-btn.active {
  background: var(--primary);
  color: white;
}

.theme-toggle {
  background: rgba(37, 99, 235, 0.1);
  color: var(--text);
  width: 44px;
  height: 44px;
  font-size: 18px;
}

.actions {
  margin-bottom: 20px;
}

.primary-btn {
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  padding: 12px 22px;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2);
}

.primary-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.primary-btn:active {
  transform: scale(0.97);
}

.results {
  margin-top: 12px;
}

.lotto-set {
  margin-bottom: 16px;
}

.lotto-set strong {
  display: inline-block;
  margin-bottom: 8px;
}

.numbers {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ball {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  background: var(--ball-bg);
  border: 2px solid var(--ball-border);
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.35),
    inset 0 -6px 12px rgba(0, 0, 0, 0.2),
    0 8px 16px rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: hidden;
  animation: popIn 0.25s ease;
}

.ball::before {
  content: '';
  position: absolute;
  inset: 6px 10px auto auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  filter: blur(1px);
}

.ball::after {
  content: '';
  position: absolute;
  inset: auto auto -8px -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.ball-red {
  background: linear-gradient(135deg, #fda4af, #dc2626 65%, #991b1b);
}

.ball-blue {
  background: linear-gradient(135deg, #93c5fd, #2563eb 65%, #1d4ed8);
}

.ball-green {
  background: linear-gradient(135deg, #86efac, #10b981 65%, #047857);
}

.ball-yellow {
  background: linear-gradient(135deg, #fde68a, #f59e0b 65%, #b45309);
}

.ball-gray {
  background: linear-gradient(135deg, #e2e8f0, #64748b 65%, #334155);
}

@keyframes popIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 24px 18px;
  }

  .card-top {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar {
    justify-content: flex-end;
  }

  .ball {
    width: 40px;
    height: 40px;
  }
}
