:root {
  --primary: #1a5f2a;
  --primary-dark: #0f3d1a;
  --accent: #f0c14e;
  --bg: #f5f7f5;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #666;
  --correct: #2e7d32;
  --wrong: #c62828;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
}

.screen {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: flex;
}

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

.header {
  text-align: center;
  padding: 24px 0 8px;
}

.header h1 {
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card p {
  margin-bottom: 12px;
  color: var(--muted);
}

.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.footer-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 24px;
}

/* Progress */
.progress-bar {
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.3s ease;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}

#question-text {
  font-size: 1.15rem;
  margin-bottom: 20px;
  line-height: 1.4;
}

#options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: #fafafa;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
  text-align: left;
}

.option:active {
  transform: scale(0.99);
}

.option.selected {
  border-color: var(--primary);
  background: #e8f5e9;
}

.option.correct {
  border-color: var(--correct);
  background: #e8f5e9;
}

.option.wrong {
  border-color: var(--wrong);
  background: #ffebee;
}

.option.disabled {
  pointer-events: none;
}

/* Result */
.result-card {
  text-align: center;
}

#score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0%, #e0e0e0 0%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  position: relative;
}

#score-circle::before {
  content: '';
  position: absolute;
  width: 96px;
  height: 96px;
  background: white;
  border-radius: 50%;
}

#score-percent {
  position: relative;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

#score-text {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 4px;
}

#score-detail {
  color: var(--muted);
}

#review-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border-left: 5px solid;
}

.review-item.correct {
  border-left-color: var(--correct);
}

.review-item.wrong {
  border-left-color: var(--wrong);
}

.review-item h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  line-height: 1.35;
}

.review-item .answer {
  font-size: 0.9rem;
  margin-top: 4px;
}

.review-item .your-answer {
  color: var(--wrong);
}

.review-item .correct-answer {
  color: var(--correct);
  font-weight: 600;
}

.review-item .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 2px;
}

.image-note {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
  padding: 12px;
  font-size: 0.9rem;
  color: #5d4037;
  margin-bottom: 12px;
  line-height: 1.4;
}

.images-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
  background: #f0f0f0;
  border-radius: 12px;
  padding: 12px;
}

.images-box img {
  max-width: 100%;
  max-height: 220px;
  width: auto;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.img-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.img-label {
  font-weight: 700;
  font-size: 1.1rem;
  color: #1a5f2a;
  background: #e8f5e9;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
