:root {
  --bg: #f8fafc;
  --text: #111827;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #d1d5db;
  --primary: #2563eb;
  --primary-contrast: #ffffff;
  --success: #059669;
  --error: #dc2626;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
}

.app-header, .app-footer {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.app-footer { border-top: 1px solid var(--border); border-bottom: none; }

.app-title { margin: 0; font-size: 1.5rem; }

.user-panel {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.current-user { color: var(--muted); font-size: 0.9rem; }

.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.app-main { padding: 1rem; min-height: calc(100vh - 140px); }

.grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.card:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  border-color: var(--primary);
}

.card img { width: 100%; height: auto; border-radius: 8px; object-fit: cover; }

.card h3 { margin: 0.5rem 0 0.25rem; font-size: 1.125rem; }
.card p { margin: 0.25rem 0; color: var(--muted); }

.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.stats { font-size: 0.875rem; color: var(--muted); }

button, a.button {
  appearance: none;
  border: 1px solid var(--border);
  background: #f9fafb;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

button:hover:not(:disabled), a.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.12);
  border-color: var(--primary);
}

button:active:not(:disabled), a.button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

button.primary, a.button.primary {
  background: var(--primary);
  color: var(--primary-contrast);
  border-color: var(--primary);
}

button.primary:hover:not(:disabled), a.button.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

button.primary:active:not(:disabled), a.button.primary:active {
  background: #1e40af;
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

button:disabled { 
  opacity: 0.6; 
  cursor: not-allowed; 
  transform: none !important;
  box-shadow: none !important;
}

.progress { margin: 0.5rem 0 1rem; font-weight: 600; }

.answers { display: grid; gap: 0.75rem; }
.answers button { text-align: left; }

.feedback { margin-top: 0.75rem; padding: 0.75rem; border-radius: 8px; }
.feedback.success { background: #ecfdf5; border: 1px solid #a7f3d0; color: var(--success); }
.feedback.error { background: #fef2f2; border: 1px solid #fecaca; color: var(--error); }
.feedback.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

.toast {
  position: fixed;
  inset-inline: 0;
  top: 0;
  margin: 1rem auto;
  max-width: 720px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }

.img-cover { width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; }

.sr-progress { position: absolute; left: -9999px; }

/* Quiz Stats Visual Indicators */
.quiz-stats {
  margin: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.progress-bar-container {
  margin: 0.25rem 0;
}

.progress-bar-bg {
  position: relative;
  overflow: hidden;
}

.progress-bar-fill {
  transition: width 0.3s ease-in-out;
}

.score-circle-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.score-circle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.score-circle::before {
  content: '';
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
  z-index: 1;
}

.score-circle span {
  position: relative;
  z-index: 2;
}

/* Special button styles */
.logout-btn {
  background: #dc2626 !important;
  color: white !important;
  border: none !important;
  padding: 0.25rem 0.5rem !important;
  font-size: 0.875rem !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.logout-btn:hover {
  background: #b91c1c !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3) !important;
}

.logout-btn:active {
  background: #991b1b !important;
  transform: translateY(0) !important;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2) !important;
}

/* Answer buttons in quiz */
.answers button:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.answers button:active:not(:disabled) {
  background: #e5e7eb;
  transform: translateY(0);
}

/* Card hover effects for clickable cards */
.card[tabindex="0"]:hover {
  cursor: pointer;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

.card[tabindex="0"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Responsive adjustments for quiz stats */
@media (max-width: 640px) {
  .quiz-stats {
    gap: 0.25rem;
  }
  
  .score-circle {
    width: 32px;
    height: 32px;
    font-size: 0.625rem;
  }
  
  .score-circle::before {
    width: 24px;
    height: 24px;
  }
}

/* Landing page styles */
.landing-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.landing-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 0.5rem;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: var(--bg);
  color: var(--primary);
}

.hero-section {
  text-align: center;
  margin-bottom: 3rem;
}

.hero-section h2 {
  font-size: 2.5rem;
  margin: 0 0 1rem;
  color: var(--text);
}

.hero-description {
  font-size: 1.125rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.start-app-btn {
  padding: 0.75rem 2rem;
  font-size: 1.125rem;
  margin-top: 1rem;
}

.subscription-section {
  margin-top: 2rem;
}

.subscription-box {
  text-align: center;
  padding: 2rem;
}

.subscription-box h3 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  color: var(--text);
}

.subscription-info {
  margin: 0 0 1.5rem;
  color: var(--muted);
  line-height: 1.6;
}

.subscription-box button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* About page styles */
.about-section {
  max-width: 700px;
  margin: 0 auto;
}

.about-section h2 {
  font-size: 2.5rem;
  margin: 0 0 1.5rem;
  color: var(--text);
  text-align: center;
}

.about-content {
  line-height: 1.7;
}

.about-content h3 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
  color: var(--text);
}

.about-content p {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.about-list {
  margin: 1rem 0 2rem;
  padding-left: 1.5rem;
  color: var(--muted);
}

.about-list li {
  margin: 0.75rem 0;
  line-height: 1.6;
}

.about-list strong {
  color: var(--text);
}

.about-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.about-cta .button {
  padding: 0.75rem 1.5rem;
}

@media (max-width: 640px) {
  .hero-section h2 {
    font-size: 2rem;
  }
  
  .hero-description {
    font-size: 1rem;
  }
  
  .subscription-box {
    padding: 1.5rem;
  }
  
  .about-section h2 {
    font-size: 2rem;
  }
  
  .about-cta {
    flex-direction: column;
  }
  
  .about-cta .button {
    width: 100%;
    text-align: center;
  }
}

