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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --success-dark: #15803d;
  --error: #dc2626;
  --warning: #f59e0b;
  --background: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --gold: #fbbf24;
  --silver: #94a3b8;
  --bronze: #fb923c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 40px;
  max-width: 500px;
  width: 100%;
}

.header {
  text-align: center;
  margin-bottom: 32px;
}

.icon-wrapper {
  display: inline-flex;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%;
  margin-bottom: 16px;
}

.icon {
  width: 32px;
  height: 32px;
  color: white;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

input {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.help-text {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-primary,
.btn-secondary,
.btn-success {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #cbd5e1;
}

.btn-success {
  background: linear-gradient(135deg, var(--success), var(--success-dark));
  color: white;
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.4);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon {
  width: 20px;
  height: 20px;
}

.footer {
  margin-top: 24px;
  text-align: center;
}

.link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.link:hover {
  text-decoration: underline;
}

/* Quiz Styles */
.quiz-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 20px;
}

.quiz-header {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.user-info h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.user-info p {
  color: var(--text-muted);
  font-size: 14px;
}

.timer-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--background);
  padding: 12px 20px;
  border-radius: 8px;
}

.timer-icon {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

#timer {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.progress-wrapper {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

.progress-bar {
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width 0.3s ease;
  width: 0%;
}

.quiz-content {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.question-text {
  font-size: 22px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.option {
  display: flex;
  align-items: center;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.option:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.option input[type="radio"] {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  cursor: pointer;
}

.option label {
  flex: 1;
  cursor: pointer;
  font-weight: 500;
}

.option input[type="radio"]:checked + label {
  color: var(--primary);
  font-weight: 600;
}

.quiz-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

/* Result Styles */
.result-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 48px;
  max-width: 700px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.result-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}

.result-icon.excellent {
  background: linear-gradient(135deg, var(--success), var(--success-dark));
}

.result-icon.good {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.result-icon.medium {
  background: linear-gradient(135deg, var(--warning), #d97706);
}

.result-icon.low {
  background: linear-gradient(135deg, var(--error), #b91c1c);
}

.result-title {
  font-size: 32px;
  margin-bottom: 12px;
}

.result-message {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 32px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--background);
  padding: 20px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
}

.stat-icon svg {
  width: 24px;
  height: 24px;
  color: var(--text);
}

.stat-icon.success {
  background: var(--success);
}

.stat-icon.success svg {
  color: white;
}

.stat-icon.error {
  background: var(--error);
}

.stat-icon.error svg {
  color: white;
}

.stat-icon.warning {
  background: var(--warning);
}

.stat-icon.warning svg {
  color: white;
}

.stat-content {
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Ranking Styles */
.ranking-container {
  max-width: 1200px;
  margin: 40px auto;
  padding: 20px;
}

.ranking-header {
  text-align: center;
  margin-bottom: 32px;
  color: white;
}

.ranking-header h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 36px;
  color: white;
  margin-bottom: 8px;
}

.header-icon {
  width: 40px;
  height: 40px;
}

.ranking-header .subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  background: var(--card-bg);
  padding: 6px;
  border-radius: 12px;
  margin-bottom: 32px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tab {
  flex: 1;
  padding: 12px 24px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
}

.tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.podium-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 48px;
  padding: 0 20px;
}

.podium-place {
  flex: 1;
  max-width: 250px;
  text-align: center;
}

.podium-rank {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.podium-place.first .podium-rank {
  background: linear-gradient(135deg, var(--gold), #f59e0b);
  width: 80px;
  height: 80px;
  font-size: 40px;
}

.podium-place.second .podium-rank {
  background: linear-gradient(135deg, var(--silver), #64748b);
}

.podium-place.third .podium-rank {
  background: linear-gradient(135deg, var(--bronze), #ea580c);
}

.podium-content {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.podium-place.first .podium-content {
  padding: 32px 24px;
}

.podium-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.podium-place.first .podium-name {
  font-size: 20px;
}

.podium-company {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.podium-score {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
}

.podium-place.first .podium-score {
  font-size: 40px;
  color: var(--gold);
}

.podium-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.ranking-table-container {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 32px;
  overflow-x: auto;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
}

.ranking-table th {
  text-align: left;
  padding: 16px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 12px;
  border-bottom: 2px solid var(--border);
}

.ranking-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.ranking-table tr:last-child td {
  border-bottom: none;
}

.ranking-table tr:hover {
  background: var(--background);
}

.rank-cell {
  font-weight: 700;
  font-size: 18px;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
  color: white;
}

.rank-badge.gold {
  background: linear-gradient(135deg, var(--gold), #f59e0b);
}

.rank-badge.silver {
  background: linear-gradient(135deg, var(--silver), #64748b);
}

.rank-badge.bronze {
  background: linear-gradient(135deg, var(--bronze), #ea580c);
}

.rank-number {
  color: var(--text-muted);
}

.ranking-actions {
  text-align: center;
}

@media (max-width: 768px) {
  .podium-container {
    flex-direction: column;
    align-items: center;
  }

  .podium-place {
    max-width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .quiz-actions {
    flex-direction: column;
  }

  .ranking-table {
    font-size: 14px;
  }

  .ranking-table th,
  .ranking-table td {
    padding: 12px 8px;
  }
}
