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

:root {
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --primary-dark: #3730a3;
  --success: #22c55e;
  --error: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-600: #4b5563;
  --gray-900: #111827;
  --shadow:  0 10px 25px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', system-ui;
  background:  linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
  color: var(--gray-900);
  min-height: 100vh;
}

/* HEADER */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.8rem;
  font-weight:  700;
  letter-spacing: -0.5px;
}

header p {
  font-size:  0.9rem;
  opacity: 0.9;
  margin-top: 4px;
}

/* MAIN LAYOUT */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: calc(100vh - 100px);
}

/* CARD COMPONENT */
.card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  margin-bottom:  20px;
  box-shadow:  var(--shadow);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* GRID LAYOUT */
.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns:  repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-2 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* HEADINGS */
h2 {
  font-size: 1.5rem;
  margin-bottom:  16px;
  color:  var(--gray-900);
}

h3 {
  font-size: 1.25rem;
  margin-bottom:  12px;
  color: var(--gray-900);
}

/* FORM ELEMENTS */
textarea,
input[type="text"],
input[type="email"],
input[type="file"],
select {
  width:  100%;
  padding: 12px;
  margin-bottom: 12px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: 'Courier New', monospace;
}

input[type="file"] {
  padding: 8px;
  cursor: pointer;
}

/* BUTTONS */
button,
.btn {
  width: 100%;
  padding:  14px 20px;
  margin-top: 12px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  display: inline-block;
  text-decoration: none;
}

button:hover,
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

button:active,
.btn:active {
  transform: translateY(0);
}

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

.btn-primary:hover,
button:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

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

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

.btn-success:hover {
  background: #16a34a;
}

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

.btn-error:hover {
  background: #dc2626;
}

.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-group > button,
.btn-group > .btn {
  flex: 1;
  min-width: 150px;
  margin:  0;
}

/* OPTIONS/QUESTIONS */
.option {
  padding: 16px;
  margin:  10px 0;
  border-radius: 12px;
  background: var(--gray-50);
  border: 2px solid transparent;
  cursor: pointer;
  font-weight: 500;
  transition:  all 0.3s ease;
}

.option:hover {
  background: var(--gray-100);
  border-color: var(--primary);
}

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

.option.correct {
  background: #dcfce7;
  border-color: var(--success);
  color: #166534;
}

.option.wrong {
  background: #fee2e2;
  border-color: var(--error);
  color: #991b1b;
}

.option:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* EXPLANATION */
.explanation {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: var(--gray-50);
  border-left: 4px solid var(--primary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.explanation strong {
  color: var(--primary);
  display: block;
  margin-bottom: 8px;
}

/* LIST ITEMS */
.list {
  list-style: none;
}

.list-item {
  padding: 16px;
  margin-bottom:  8px;
  border-radius: 12px;
  background: var(--gray-50);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}

.list-item:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateX(4px);
}

.list-item.active {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* BADGES */
.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size:  0.85rem;
  font-weight:  600;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background: #dcfce7;
  color:  var(--success);
}

.badge-error {
  background:  #fee2e2;
  color: var(--error);
}

/* STATS */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin:  20px 0;
}

.stat {
  background: var(--gray-50);
  padding: 16px;
  border-radius: 12px;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color:  var(--primary);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-top: 8px;
}

/* HIDDEN */
.hidden {
  display: none ! important;
}

/* PROGRESS */
.progress {
  width: 100%;
  height:  8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0;
}

.progress-bar {
  height:  100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: 4px;
  transition:  width 0.3s ease;
}

/* LOADING */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--primary-light);
  border-top-color:  var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading {
  text-align:  center;
  padding: 40px 20px;
}

.loading p {
  margin-top: 16px;
  color: var(--gray-600);
}

/* ALERT */
.alert {
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  border-left: 4px solid;
}

.alert-success {
  background: #dcfce7;
  border-color: var(--success);
  color: #166534;
}

.alert-error {
  background: #fee2e2;
  border-color:  var(--error);
  color: #991b1b;
}

.alert-info {
  background:  var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* MODAL/OVERLAY */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom:  0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

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

/* RESPONSIVE */
@media (max-width: 768px) {
  header h1 {
    font-size: 1.4rem;
  }

  main {
    padding: 12px;
  }

  .card {
    padding: 16px;
    margin-bottom: 12px;
  }

  h2 {
    font-size: 1.2rem;
  }

  button,
  .btn {
    padding: 12px 16px;
    font-size:  0.95rem;
  }

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

  .btn-group > button,
  .btn-group > .btn {
    min-width: 100px;
  }
}

@media (max-width: 480px) {
  header {
    padding: 16px 12px;
  }

  header h1 {
    font-size:  1.2rem;
  }

  main {
    padding: 8px;
  }

  .card {
    padding: 12px;
    margin-bottom: 10px;
  }

  h2 {
    font-size: 1.1rem;
  }

  h3 {
    font-size: 1rem;
  }

  .option {
    padding: 12px;
    margin: 8px 0;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .modal {
    max-width: 90vw;
  }
}