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

/* Theme Variables */
:root {
  --bg-gradient-start: #1a1a2e;
  --bg-gradient-end: #16213e;
  --text-primary: #fff;
  --text-secondary: #a0aec0;
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-shadow: rgba(0, 0, 0, 0.3);
  --info-text: #666;
  --toggle-bg: #374151;
  --toolbar-bg: rgba(0, 0, 0, 0.3);
  --nav-active: rgba(255, 255, 255, 0.2);
  --nav-hover: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] {
  --bg-gradient-start: #e0e7ff;
  --bg-gradient-end: #c7d2fe;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --card-bg: rgba(255, 255, 255, 0.98);
  --card-shadow: rgba(0, 0, 0, 0.15);
  --info-text: #64748b;
  --toggle-bg: #cbd5e1;
  --toolbar-bg: rgba(255, 255, 255, 0.5);
  --nav-active: rgba(99, 102, 241, 0.2);
  --nav-hover: rgba(99, 102, 241, 0.1);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
  padding: 20px;
  padding-top: 70px;
  transition: background 0.3s ease;
}

/* Top Toolbar */
.toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 55px;
  background: var(--toolbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  z-index: 1000;
  transition: background 0.3s ease;
}

/* Navigation Menu */
.nav-menu {
  display: flex;
  gap: 5px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.nav-btn:hover {
  background: var(--nav-hover);
}

.nav-btn.active {
  background: var(--nav-active);
}

.nav-icon {
  font-size: 18px;
}

.nav-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.toolbar-right {
  display: flex;
  gap: 10px;
}

.toolbar-btn {
  height: 34px;
  background: var(--toggle-bg);
  border: none;
  border-radius: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, transform 0.2s ease;
}

.toolbar-btn:hover {
  transform: scale(1.05);
}

.toolbar-btn:active {
  transform: scale(0.95);
}

/* Language Toggle */
.lang-toggle {
  width: 50px;
  padding: 0 12px;
}

.lang-text {
  font-size: 13px;
  font-weight: bold;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

/* Theme Toggle Button */
.theme-toggle {
  width: 60px;
  padding: 4px 8px;
  justify-content: space-between;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  font-size: 16px;
  transition: opacity 0.3s ease;
}

.theme-toggle .icon-sun {
  opacity: 0.4;
  color: #fbbf24;
}

.theme-toggle .icon-moon {
  opacity: 1;
  color: #f1f5f9;
}

[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 1;
}

[data-theme="light"] .theme-toggle .icon-moon {
  opacity: 0.4;
}

/* Pages */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Container */
.container {
  max-width: 500px;
  margin: 0 auto;
  padding: 0 10px;
}

h1 {
  text-align: center;
  color: var(--text-primary);
  font-size: 1.6rem;
  margin-bottom: 25px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  transition: color 0.3s ease;
  word-break: keep-all;
}

/* ==================== Lottery Styles ==================== */
.lottery-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 10px 30px var(--card-shadow);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.lottery-header {
  text-align: center;
  margin-bottom: 15px;
}

.lottery-header h2 {
  font-size: 1.4rem;
  margin-bottom: 5px;
}

.lotto645 .lottery-header h2 { color: #00a651; }
.mega-millions .lottery-header h2 { color: #c9a227; }
.powerball .lottery-header h2 { color: #e31837; }

.lottery-info {
  font-size: 0.85rem;
  color: var(--info-text);
  transition: color 0.3s ease;
}

.numbers-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.ball {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: bold;
  color: #333;
  box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.ball:hover { transform: scale(1.1); }
.ball.white { background: linear-gradient(145deg, #ffffff, #e6e6e6); border: 2px solid #ccc; }
.ball.lotto-yellow { background: linear-gradient(145deg, #ffd700, #e6c200); color: #333; }
.ball.lotto-blue { background: linear-gradient(145deg, #4da6ff, #0080ff); color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.ball.lotto-red { background: linear-gradient(145deg, #ff6b6b, #e63946); color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.ball.lotto-gray { background: linear-gradient(145deg, #9e9e9e, #757575); color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.ball.lotto-green { background: linear-gradient(145deg, #4caf50, #388e3c); color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.ball.mega { background: linear-gradient(145deg, #ffd700, #c9a227); color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.ball.power { background: linear-gradient(145deg, #ff4d4d, #e31837); color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }

/* ==================== Dinner Styles ==================== */
.dinner-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 10px 30px var(--card-shadow);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.dinner-card h3 {
  text-align: center;
  color: var(--info-text);
  font-size: 0.9rem;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.result-card {
  padding: 30px 20px;
}

.dinner-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.result-icon {
  font-size: 4rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.result-text {
  font-size: 1.8rem;
  font-weight: bold;
  color: #333;
  text-align: center;
  word-break: keep-all;
}

.result-text.picked {
  color: #e63946;
}

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 8px;
  background: #f1f5f9;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  color: #333;
}

.category-btn:hover {
  background: #e2e8f0;
}

.category-btn.active {
  background: #e0e7ff;
  border-color: #6366f1;
  color: #4f46e5;
}

.cat-icon {
  font-size: 1.5rem;
}

/* History */
.history-card {
  padding-bottom: 15px;
}

.history-list {
  max-height: 150px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.history-item .menu-name {
  font-weight: 600;
  color: #333;
}

.history-item .menu-category {
  font-size: 0.75rem;
  color: #64748b;
}

.history-empty {
  text-align: center;
  color: #94a3b8;
  padding: 20px;
  font-size: 0.9rem;
}

.clear-btn {
  width: 100%;
  padding: 10px;
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  color: #64748b;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.clear-btn:hover {
  background: #e2e8f0;
}

/* ==================== Buttons ==================== */
.generate-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

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

.mega-btn { background: linear-gradient(135deg, #c9a227, #a88419); }
.power-btn { background: linear-gradient(135deg, #e31837, #b8142c); }
.lotto-btn { background: linear-gradient(135deg, #00a651, #008c44); }
.all-btn { background: linear-gradient(135deg, #6366f1, #4f46e5); margin-top: 10px; }
.dinner-btn { background: linear-gradient(135deg, #f97316, #ea580c); }
.contact-btn { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

/* Animation */
@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.ball.animate {
  animation: bounce 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

.result-icon.shake {
  animation: shake 0.5s ease;
}

/* ==================== Responsive ==================== */
@media (max-width: 600px) {
  body {
    padding: 15px;
    padding-top: 65px;
  }

  .toolbar {
    height: 50px;
    padding: 0 10px;
  }

  .nav-btn {
    padding: 6px 10px;
  }

  .nav-text {
    font-size: 13px;
  }

  h1 {
    font-size: 1.4rem;
    margin-bottom: 20px;
  }

  .lottery-card, .dinner-card {
    padding: 18px;
    border-radius: 16px;
  }

  .result-text {
    font-size: 1.5rem;
  }

  .category-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

@media (max-width: 400px) {
  body {
    padding: 10px;
    padding-top: 60px;
  }

  .toolbar {
    height: 48px;
    padding: 0 8px;
  }

  .nav-btn {
    padding: 5px 8px;
    gap: 4px;
  }

  .nav-icon {
    font-size: 16px;
  }

  .nav-text {
    font-size: 12px;
  }

  .toolbar-right {
    gap: 6px;
  }

  .toolbar-btn {
    height: 30px;
  }

  .lang-toggle {
    width: 40px;
    padding: 0 8px;
  }

  .lang-text {
    font-size: 11px;
  }

  .theme-toggle {
    width: 50px;
    padding: 3px 6px;
  }

  .theme-toggle .icon-sun,
  .theme-toggle .icon-moon {
    font-size: 13px;
  }

  h1 {
    font-size: 1.2rem;
    margin-bottom: 15px;
  }

  .lottery-card, .dinner-card {
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 14px;
  }

  .ball {
    width: 40px;
    height: 40px;
    font-size: 0.95rem;
  }

  .numbers-container {
    gap: 6px;
  }

  .generate-btn {
    padding: 12px;
    font-size: 0.9rem;
  }

  .result-icon {
    font-size: 3rem;
  }

  .result-text {
    font-size: 1.3rem;
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .category-btn {
    padding: 10px 6px;
    font-size: 0.8rem;
  }

  .cat-icon {
    font-size: 1.3rem;
  }
}

@media (max-width: 340px) {
  .ball {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }

  .nav-text {
    display: none;
  }

  .nav-icon {
    font-size: 20px;
  }
}

/* ==================== Contact Form ==================== */
.contact-card {
  margin-top: 20px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.form-group input,
.form-group textarea {
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
  color: #333;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #94a3b8;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-notice {
  text-align: center;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 10px;
}

/* Form responsive */
@media (max-width: 400px) {
  .form-group input,
  .form-group textarea {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .form-group label {
    font-size: 0.8rem;
  }
}

/* ==================== Disqus Comments ==================== */
.comments-card {
  margin-top: 20px;
  padding-bottom: 20px;
}

#disqus_thread {
  margin-top: 10px;
}

/* ==================== Animal Face Test ==================== */
.animal-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 10px 30px var(--card-shadow);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.animal-card h3 {
  text-align: center;
  color: var(--info-text);
  font-size: 0.9rem;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.animal-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding: 20px 0;
}

.animal-icon-container {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.animal-icon {
  font-size: 4rem;
}

.animal-result-text {
  font-size: 1.6rem;
  font-weight: bold;
  color: #333;
  text-align: center;
}

.animal-result-text.dog {
  color: #f97316;
}

.animal-result-text.cat {
  color: #8b5cf6;
}

.animal-probability {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.prob-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.prob-label {
  font-size: 0.85rem;
  color: #64748b;
}

.prob-bar {
  width: 100px;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.prob-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.prob-fill.dog {
  background: linear-gradient(90deg, #f97316, #ea580c);
}

.prob-fill.cat {
  background: linear-gradient(90deg, #8b5cf6, #7c3aed);
}

.prob-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
}

/* Upload Area */
.upload-card {
  padding: 20px;
}

.upload-area {
  border: 3px dashed #cbd5e1;
  border-radius: 16px;
  padding: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f8fafc;
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-area:hover {
  border-color: #6366f1;
  background: #f1f5f9;
}

.upload-area.has-image {
  border-style: solid;
  border-color: #6366f1;
  padding: 10px;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.upload-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.upload-text {
  color: #64748b;
  font-size: 0.95rem;
}

.preview-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
  display: none;
}

.preview-image.visible {
  display: block;
}

/* Analyze Button */
.animal-btn {
  background: linear-gradient(135deg, #10b981, #059669);
}

.animal-btn:disabled {
  background: linear-gradient(135deg, #9ca3af, #6b7280);
  cursor: not-allowed;
  transform: none;
}

.animal-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Loading */
.loading-container {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding: 30px;
  color: var(--text-primary);
}

.loading-container.visible {
  display: flex;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Description */
.description-card p {
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: center;
}

/* Animal page responsive */
@media (max-width: 400px) {
  .animal-icon-container {
    width: 100px;
    height: 100px;
  }

  .animal-icon {
    font-size: 3rem;
  }

  .animal-result-text {
    font-size: 1.3rem;
  }

  .upload-area {
    padding: 20px;
    min-height: 150px;
  }

  .upload-icon {
    font-size: 2.5rem;
  }

  .prob-bar {
    width: 80px;
  }
}
