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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 40px;
}

h1 {
  font-size: 1.4rem;
  text-align: center;
  margin-bottom: 8px;
  color: #1a1a2e;
}

.site-description {
  text-align: center;
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 16px;
  line-height: 1.4;
}

h2 {
  font-size: 1.2rem;
  color: #1a1a2e;
}

/* Views */
.view { display: none; }
.view.active { display: block; }

/* Buttons */
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.7; }

.btn-primary {
  background: #2563eb;
  color: #fff;
  width: 100%;
  font-size: 1.1rem;
  padding: 14px;
  font-weight: 600;
}

.btn-large { margin-top: 16px; }

.btn-secondary {
  background: #e2e8f0;
  color: #334155;
  flex: 1;
}

.btn-back {
  background: #e2e8f0;
  color: #334155;
  font-size: 0.85rem;
  padding: 6px 12px;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  width: 100%;
  margin-top: 24px;
}

/* Filter Buttons */
.filter-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.filter-btn {
  background: #e2e8f0;
  color: #475569;
  font-size: 0.85rem;
  padding: 10px 8px;
  text-align: center;
}
.filter-btn.active {
  background: #1a1a2e;
  color: #fff;
}

/* Progress bar */
.progress-bar-container {
  width: 100%;
  background: #e2e8f0;
  border-radius: 8px;
  height: 10px;
  margin-bottom: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: #22c55e;
  border-radius: 8px;
  width: 0%;
  transition: width 0.3s;
}
.progress-text {
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
  margin-bottom: 16px;
}

/* Home links */
.home-links {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Study view */
.study-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.study-counter {
  font-size: 0.85rem;
  color: #64748b;
}
.view-title {
  flex: 1;
}

/* Question card */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 16px;
}

.question-source {
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.question-image {
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.question-scenario {
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: #92400e;
}

.question-text {
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Answer buttons */
.answer-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-true {
  flex: 1;
  background: #2563eb;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 16px;
}

.btn-false {
  flex: 1;
  background: #64748b;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 16px;
}

/* Result panel */
.result-panel {
  margin-bottom: 16px;
}

.result-banner {
  padding: 14px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
}
.result-banner.correct {
  background: #dcfce7;
  color: #166534;
}
.result-banner.incorrect {
  background: #fee2e2;
  color: #991b1b;
}

.result-explanation {
  font-size: 0.95rem;
  color: #475569;
  margin-bottom: 16px;
  padding: 0 4px;
  line-height: 1.6;
}

/* Reference accordion */
.accordion-section {
  background: #fff;
  border-radius: 8px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  overflow: hidden;
}

.accordion-header {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.accordion-header::after {
  content: "+";
  font-size: 1.2rem;
  color: #94a3b8;
  transition: transform 0.2s;
}
.accordion-section.open .accordion-header::after {
  content: "\2212";
}

.accordion-body {
  display: none;
  padding: 0 16px 14px;
}
.accordion-section.open .accordion-body {
  display: block;
}

.accordion-body ul {
  list-style: none;
  padding: 0;
}
.accordion-body li {
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
  line-height: 1.5;
}
.accordion-body li:last-child { border-bottom: none; }

.accordion-body img,
.section-image {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 6px;
  margin: 8px 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

/* Stats */
.stats-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.stat-card h3 {
  font-size: 0.8rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.stat-card .stat-number {
  font-size: 1.5rem;
  font-weight: 700;
}
.stat-card .stat-number.mastered { color: #22c55e; }
.stat-card .stat-number.wrong { color: #ef4444; }
.stat-card .stat-number.unseen { color: #64748b; }
.stat-card .stat-number.progress { color: #f59e0b; }

.stats-category {
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  margin-bottom: 8px;
}
.stats-category h3 {
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: #1a1a2e;
}
.stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 3px 0;
  color: #64748b;
}
.stats-row span:last-child { font-weight: 600; color: #333; }
