@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-card: rgba(20, 20, 50, 0.6);
  --bg-card-hover: rgba(30, 30, 70, 0.7);
  --bg-code: rgba(10, 10, 30, 0.8);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #e8e8f0;
  --text-secondary: #9d9db8;
  --text-muted: #6b6b8a;
  --accent-1: #6366f1;
  --accent-2: #a855f7;
  --accent-3: #3b82f6;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --gradient-accent: linear-gradient(135deg, #6366f1, #a855f7);
  --gradient-bg: linear-gradient(180deg, #0a0a1a 0%, #111128 50%, #0d0d24 100%);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* HEADER */
.hero {
  text-align: center;
  padding: 50px 20px 30px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(168, 85, 247, 0.06) 0%, transparent 50%);
  animation: aurora 15s ease-in-out infinite;
}

@keyframes aurora {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -1%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.hero .subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 400;
  position: relative;
  z-index: 1;
}

.hero .badge {
  display: inline-block;
  margin-top: 15px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent-1);
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

/* PROGRESS BAR */
.progress-container {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(20px);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-glass);
}

.progress-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 15px;
}

.progress-bar-bg {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-accent);
  border-radius: 4px;
  width: 0%;
  transition: width 0.5s ease;
}

.progress-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 110px;
  text-align: right;
}

.score-display {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-2);
  min-width: 60px;
}

/* CONTAINER */
.container {
  max-width: 850px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* SECTION CARDS */
.section-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-glow);
}

.section-card:hover {
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.1);
}

.section-header {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: var(--transition);
}

.section-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-header .part-badge {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--gradient-accent);
  color: white;
}

.section-header .pts-badge {
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-1);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.chevron {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
  color: var(--text-muted);
}

.section-card.collapsed .chevron {
  transform: rotate(-90deg);
}

.section-card.collapsed .section-body {
  display: none;
}

.section-body {
  padding: 0 20px 20px;
}

/* EXERCISE */
.exercise {
  margin-bottom: 16px;
}

.exercise h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-glass);
}

/* CODE BLOCKS */
.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  overflow-x: auto;
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.code-block .comment { color: #6a9955; }
.code-block .keyword { color: #c586c0; font-weight: 500; }
.code-block .string { color: #ce9178; }
.code-block .func { color: #dcdcaa; }
.code-block .decorator { color: #d7ba7d; }
.code-block .number { color: #b5cea8; }

/* INPUT FIELDS */
.q-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  position: relative;
}

.q-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent-2);
  font-family: 'Inter', sans-serif;
  vertical-align: super;
}

.q-input {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 4px;
  color: #e8e8f0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  padding: 2px 6px;
  min-width: 100px;
  max-width: 160px;
  outline: none;
  transition: var(--transition);
}

.q-input:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.12);
}

.q-input.correct {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.q-input.incorrect {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.correction-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid var(--success);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  color: var(--success);
  white-space: nowrap;
  z-index: 10;
  font-family: 'JetBrains Mono', monospace;
}

.q-input.incorrect + .correction-tooltip {
  display: block;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* VERIFY BUTTON */
.verify-section {
  text-align: center;
  padding: 30px 0;
}

.btn-verify {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 40px;
  border: none;
  border-radius: var(--radius);
  background: var(--gradient-accent);
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-verify:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-verify:active {
  transform: translateY(0);
}

.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  margin-left: 12px;
  transition: var(--transition);
}

.btn-reset:hover {
  border-color: var(--error);
  color: var(--error);
}

/* RESULTS */
.results-card {
  display: none;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin: 20px 0;
  text-align: center;
  animation: fadeInUp 0.5s ease;
}

.results-card.visible {
  display: block;
}

.results-score {
  font-size: 3.5rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.results-label {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 5px;
}

.results-breakdown {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.result-item {
  padding: 10px 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
}

.result-item .count {
  font-size: 1.4rem;
  font-weight: 700;
}

.result-item .label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.result-correct .count { color: var(--success); }
.result-incorrect .count { color: var(--error); }
.result-empty .count { color: var(--warning); }

/* FOOTER */
.footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-glass);
  margin-top: 40px;
}

.footer a {
  color: var(--accent-1);
  text-decoration: none;
}

/* CONFETTI */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall 3s ease-in forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* RESPONSIVE */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.8rem; }
  .hero .subtitle { font-size: 0.9rem; }
  .section-header h2 { font-size: 1rem; }
  .code-block { font-size: 0.75rem; padding: 10px 12px; }
  .q-input { min-width: 70px; max-width: 120px; font-size: 0.75rem; }
  .results-breakdown { flex-direction: column; align-items: center; }
}
