* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #1a2332;
  --muted: #5c6b7a;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --error: #dc2626;
  --error-bg: #fee2e2;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, #e8f0fe 0%, var(--bg) 50%, #f8fafc 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.header {
  text-align: center;
  margin-bottom: 28px;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.95rem;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 16px;
}

.info {
  color: var(--muted);
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}

select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  cursor: pointer;
  user-select: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
  width: 100%;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-text {
  background: transparent;
  color: var(--muted);
  margin-top: 16px;
  width: 100%;
}

.btn-text:hover {
  color: var(--text);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 56px;
  text-align: right;
}

.question-number {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 10px;
}

.question-text {
  font-size: 1.05rem;
  margin-bottom: 20px;
}

.question-images {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: -8px 0 20px;
}

.question-images img,
.option-image {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.question-images img {
  max-height: 320px;
  object-fit: contain;
}

.option-image {
  max-height: 120px;
  margin-top: 8px;
}

.option.has-image {
  flex-direction: column;
  align-items: stretch;
}

.option.has-image .option-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.multi-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: -12px 0 16px;
  font-style: italic;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  background: #fff;
  width: 100%;
  font-size: 0.95rem;
  color: var(--text);
}

.option:hover:not(.disabled) {
  border-color: #93c5fd;
  background: #f8fbff;
}

.option.selected {
  border-color: var(--primary);
  background: #eff6ff;
}

.option.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.option.wrong {
  border-color: var(--error);
  background: var(--error-bg);
}

.option.disabled {
  cursor: default;
}

.option-marker {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 50%;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.option.multi .option-marker {
  border-radius: 6px;
}

.option.selected .option-marker {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.option.correct .option-marker {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.option.wrong .option-marker {
  border-color: var(--error);
  background: var(--error);
  color: #fff;
}

.quiz-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feedback {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.95rem;
}

.feedback.success {
  background: var(--success-bg);
  color: #166534;
}

.feedback.error {
  background: var(--error-bg);
  color: #991b1b;
}

.hidden {
  display: none !important;
}

.result-card {
  text-align: center;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 2rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}

.score-text {
  color: var(--muted);
  margin-bottom: 24px;
}

.wrong-list {
  text-align: left;
  margin-bottom: 24px;
}

.wrong-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fafbfc;
}

.wrong-item p {
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.wrong-item .answer {
  font-size: 0.85rem;
  color: var(--success);
  font-weight: 600;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 480px) {
  .header h1 {
    font-size: 2rem;
  }

  .quiz-actions,
  .result-actions {
    flex-direction: row;
  }

  .btn-primary,
  .btn-secondary {
    width: auto;
    flex: 1;
  }
}
