.quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 20px 20px 0;
  margin-bottom: 20px;
}

.quiz-header {
  flex: 1;
}

.quiz-header h2 {
  white-space: nowrap;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.quiz-action-buttons {
  display: flex;
  gap: 10px;
}

.quiz-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
  color: #1d1d1f;
}

.quiz-action-btn:hover {
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(1.05);
}

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

.quiz-action-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.quiz-action-btn img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 50%;
}

.quiz-container {
  width: 100%;
  margin: 0 auto;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

.quiz-progress-bar {
  background: #e8e8ed;
  height: 6px;
  border-radius: 980px;
  margin-bottom: 40px;
  overflow: hidden;
}

.quiz-progress-fill {
  background: #0071e3;
  height: 100%;
  border-radius: 980px;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quiz-progress-text {
  text-align: center;
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 600;
  color: #86868b;
  letter-spacing: -0.01em;
}

.quiz-quiz-card {
  background: #ffffff;
  border-radius: 28px;
  padding: 45px 40px;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.08);
  margin-bottom: 32px;
  transition: box-shadow 0.3s ease;
}

.quiz-card {
  background: #ffffff;
  border-radius: 28px;
  padding: 30px 24px;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.08);
  margin-bottom: 32px;
  transition: box-shadow 0.3s ease;
}

.quiz-card-modern {
  padding: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.quiz-card-modern:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 60px rgba(0, 0, 0, 0.12);
}

.quiz-card-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.quiz-card-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.quiz-card-modern:hover .quiz-card-actions {
  opacity: 1;
}

.quiz-action-btn-delete:hover {
  background: #ff3b30 !important;
  color: white !important;
}

.quiz-action-btn-delete:hover svg {
  stroke: white;
}

.quiz-card-title {
  font-size: 20px;
  font-weight: 700;
  color: #1d1d1f;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.quiz-card-topic {
  font-size: 14px;
  color: #86868b;
  line-height: 1.4;
}

.quiz-card-body {
  padding: 20px 24px;
}

.quiz-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.quiz-card-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f5f5f7;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.quiz-card-modern:hover .quiz-card-stat {
  background: #e8e8ed;
}

.quiz-card-stat-icon {
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quiz-card-stat-content {
  flex: 1;
  min-width: 0;
}

.quiz-card-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #1d1d1f;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.quiz-card-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quiz-card-footer {
  padding: 16px 24px;
  background: #fafafa;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-card-difficulty {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quiz-card-last-attempt {
  font-size: 12px;
  color: #86868b;
  font-weight: 500;
}

#welcomeView {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.quiz-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 40px;
  color: #86868b;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.quiz-welcome-card {
  text-align: center;
}

.quiz-welcome-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: inline-block;
}

.quiz-welcome-title {
  font-size: 28px;
  font-weight: 700;
  color: #1d1d1f;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.quiz-welcome-subtitle {
  font-size: 15px;
  color: #86868b;
  margin-bottom: 24px;
  line-height: 1.5;
}

.quiz-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.quiz-stat-item {
  background: #f5f5f7;
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
}

.quiz-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #0071e3;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.quiz-stat-label {
  font-size: 13px;
  font-weight: 600;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.quiz-question-number {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 24px;
  color: #0071e3;
}

.quiz-question-text {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: #1d1d1f;
  margin-bottom: 48px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-option {
  background: #f5f5f7;
  border: 2px solid #f5f5f7;
  border-radius: 16px;
  padding: 20px 24px;
  font-size: 17px;
  font-weight: 500;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: -0.01em;
}

.quiz-option:hover:not(.quiz-selected) {
  background: #e8e8ed;
  border-color: #e8e8ed;
  transform: translateX(4px);
}

.quiz-option.quiz-selected {
  background: #ffffff;
  border-color: #0071e3;
}

.quiz-option:active {
  transform: scale(0.98);
}

.quiz-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.quiz-btn {
  padding: 14px 36px;
  font-size: 15px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border: none;
  border-radius: 980px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: -0.01em;
}

.quiz-btn-primary {
  background: #0071e3;
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(0, 113, 227, 0.3);
}

.quiz-btn-primary:hover:not(:disabled) {
  background: #0077ed;
  box-shadow: 0 4px 16px rgba(0, 113, 227, 0.4);
  transform: translateY(-1px);
}

.quiz-btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.quiz-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.quiz-btn-secondary {
  background: #ffffff;
  color: #1d1d1f;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.quiz-btn-secondary:hover {
  background: #f5f5f7;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

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

.quiz-results-card {
  text-align: center;
}

.quiz-results-score {
  font-size: 72px;
  font-weight: 700;
  color: #0071e3;
  margin-bottom: 16px;
  letter-spacing: -0.03em;
}

.quiz-results-label {
  font-size: 24px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.quiz-results-message {
  font-size: 17px;
  font-weight: 500;
  color: #86868b;
  margin-bottom: 48px;
  line-height: 1.5;
}

.quiz-review-section {
  margin-top: 48px;
}

.quiz-review-title {
  font-size: 24px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 32px;
  letter-spacing: -0.02em;
  text-align: center;
}

.quiz-review-item {
  background: #ffffff;
  border-radius: 20px;
  padding: 32px 40px;
  margin-bottom: 20px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}

.quiz-review-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.quiz-review-status {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.quiz-review-status.quiz-correct {
  background: #34c759;
  color: #ffffff;
}

.quiz-review-status.quiz-incorrect {
  background: #ff3b30;
  color: #ffffff;
}

.quiz-review-question-num {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #86868b;
}

.quiz-review-question-text {
  font-size: 20px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.quiz-review-answer {
  font-size: 16px;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.quiz-review-answer.quiz-your-answer {
  background: #ffe5e5;
  color: #d70015;
}

.quiz-review-answer.quiz-correct-answer {
  background: #d1f4e0;
  color: #1d6f42;
}

.quiz-review-answer.quiz-both-correct {
  background: #d1f4e0;
  color: #1d6f42;
}

.quiz-review-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  opacity: 0.6;
}

/* Quiz Pill in Chat */
.quiz-pill-message {
  margin: 16px 0;
  padding: 0;
}

.quiz-pill-content {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 16px 20px;
  transition: all 0.2s ease;
}

.quiz-pill-content:hover {
  background: var(--nav-active-bg);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.quiz-pill-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-radius: 12px;
  color: white;
}

.quiz-pill-text {
  flex: 1;
  min-width: 0;
}

.quiz-pill-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.quiz-pill-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.quiz-pill-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.quiz-pill-button:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(74, 116, 232, 0.3);
}

.quiz-pill-button:active {
  transform: scale(0.98);
}

.quiz-pill-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

@media (max-width: 600px) {
  .quiz-quiz-card {
    padding: 40px 30px;
  }

  .quiz-card {
    padding: 40px 30px;
  }

  .quiz-welcome-title {
    font-size: 28px;
  }

  .quiz-stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .quiz-question-text {
    font-size: 26px;
  }

  .quiz-option {
    padding: 18px 20px;
    font-size: 16px;
  }

  .quiz-results-score {
    font-size: 56px;
  }

  .quiz-review-item {
    padding: 24px 24px;
  }

  .quiz-pill-content {
    padding: 12px 16px;
    gap: 12px;
  }

  .quiz-pill-icon {
    width: 36px;
    height: 36px;
    font-size: 24px;
  }

  .quiz-pill-title {
    font-size: 15px;
  }

  .quiz-pill-subtitle {
    font-size: 12px;
  }

  .quiz-pill-button {
    padding: 8px 16px;
    font-size: 13px;
  }
}