
:root {
  --bg: #0a0e1a;
  --panel: #1a1f2e;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --accent: #8b5cf6;
  --wrong: #ef4444;
  --correct: #10b981;
  --card: #1e293b;
  --border: #334155;
  --gradient-1: #667eea;
  --gradient-2: #764ba2;
  --gradient-3: #f093fb;
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: 
    radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(240, 147, 251, 0.05) 0%, transparent 50%),
    linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px;
  position: relative;
}

.topbar {
  text-align: center;
  margin-bottom: 32px;
  animation: fadeInDown 0.8s ease-out;
}

.topbar h1 {
  margin: 0 0 8px;
  font-weight: 800;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2), var(--gradient-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(102, 126, 234, 0.3);
}

.subtitle {
  color: var(--muted);
  margin: 0;
  font-size: 1.1rem;
  font-weight: 500;
}

.screen {
  display: none;
  animation: fadeIn 0.6s ease-out;
}

.screen.active {
  display: block;
}

.rules {
  line-height: 1.8;
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 32px;
}

.rules .badge {
  padding: 4px 8px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  font-size: 0.85em;
  margin: 0 2px;
}

.badge.wrong {
  background: linear-gradient(135deg, var(--wrong), #dc2626);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.badge.correct {
  background: linear-gradient(135deg, var(--correct), #059669);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.hud {
  margin: 24px 0 32px;
}

.progress {
  height: 12px;
  background: rgba(51, 65, 85, 0.3);
  border-radius: 999px;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(10px);
}

.progress .bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2), var(--gradient-3));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

.progress .bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.stats {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  color: var(--muted);
  margin-top: 12px;
  font-size: 1.1rem;
}

.card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(51, 65, 85, 0.4));
  padding: 32px;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.3),
    0 10px 10px -5px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.prompt {
  margin: 0 0 16px;
  color: #cbd5e1;
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.infinitive {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 16px 0 24px;
  font-weight: 800;
  color: #f1f5f9;
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border-radius: 16px;
  border: 1px solid rgba(102, 126, 234, 0.2);
  position: relative;
  overflow: hidden;
}

.infinitive::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: rotate 3s linear infinite;
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.choices {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.choice {
  background: linear-gradient(145deg, rgba(26, 31, 46, 0.8), rgba(51, 65, 85, 0.4));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  font-size: 1.05rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

.choice::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.choice:hover:not([aria-disabled="true"]) {
  transform: translateY(-2px) scale(1.02);
  border-color: var(--primary);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.choice:hover:not([aria-disabled="true"])::before {
  opacity: 1;
}

.choice:focus:not([aria-disabled="true"]) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.choice:active:not([aria-disabled="true"]) {
  transform: translateY(0) scale(0.98);
}

.choice.correct {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.4), rgba(5, 150, 105, 0.3)) !important;
  border-color: var(--correct) !important;
  border-width: 2px !important;
  animation: correctPulse 0.6s ease-out;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  transform: scale(1.02) !important;
}

.choice.wrong {
  background: linear-gradient(145deg, rgba(239, 68, 68, 0.4), rgba(220, 38, 38, 0.3)) !important;
  border-color: var(--wrong) !important;
  border-width: 2px !important;
  animation: wrongShake 0.5s ease-out;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.5) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  transform: scale(1.02) !important;
}

@keyframes correctPulse {
  0% { 
    transform: scale(1); 
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.1));
  }
  50% { 
    transform: scale(1.08); 
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.6), rgba(5, 150, 105, 0.4));
  }
  100% { 
    transform: scale(1.02); 
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.4), rgba(5, 150, 105, 0.3));
  }
}

@keyframes wrongShake {
  0%, 100% { 
    transform: translateX(0) scale(1.02); 
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.1));
  }
  25% { 
    transform: translateX(-8px) scale(1.02); 
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.5), rgba(220, 38, 38, 0.3));
  }
  75% { 
    transform: translateX(8px) scale(1.02); 
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.5), rgba(220, 38, 38, 0.3));
  }
}

.choice[aria-disabled="true"] {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.controls {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.btn {
  background: linear-gradient(145deg, var(--panel), var(--card));
  color: var(--text);
  border: 1px solid var(--border);
  padding: 14px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn:hover::before {
  opacity: 1;
}

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

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  border: none;
  color: white;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn.primary:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin: 32px 0;
  animation: fadeIn 0.8s ease-out;
}

.quiz-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(51, 65, 85, 0.4));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 24px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.quiz-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.quiz-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--primary);
  box-shadow: 0 20px 40px rgba(59, 130, 246, 0.3);
}

.quiz-card:active {
  transform: translateY(-2px) scale(1.01);
}

.quiz-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
  animation: bounce 2s infinite;
}

.quiz-card h3 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  color: #f1f5f9;
}

.quiz-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.quiz-badge {
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.controls .btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
}

.footer {
  margin-top: 48px;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 20px;
  background: rgba(26, 31, 46, 0.3);
  border-radius: 12px;
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.footer-links {
  margin-top: 8px;
  font-size: 0.85rem;
}

.small {
  color: var(--muted);
}

#used-list {
  columns: 2;
  column-gap: 24px;
  margin-top: 16px;
}

#used-list li {
  padding: 8px 12px;
  margin-bottom: 8px;
  background: rgba(26, 31, 46, 0.5);
  border-radius: 8px;
  border: 1px solid var(--border);
  break-inside: avoid;
  transition: all 0.2s ease;
}

#used-list li:hover {
  background: rgba(51, 65, 85, 0.3);
  transform: translateX(4px);
}

.final-text {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 32px;
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

details {
  margin-top: 24px;
  background: rgba(26, 31, 46, 0.3);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 16px;
  backdrop-filter: blur(10px);
}

summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

summary:hover {
  background: rgba(51, 65, 85, 0.2);
}

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

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

@media (max-width: 768px) {
  .app {
    padding: 20px 16px;
  }
  
  .card {
    padding: 24px 20px;
  }
  
  .topbar h1 {
    font-size: 2rem;
  }
  
  .infinitive {
    font-size: 2rem;
    padding: 12px;
  }
  
  .quiz-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .quiz-card {
    padding: 24px 20px;
  }
  
  .quiz-icon {
    font-size: 2.5rem;
  }
  
  #used-list {
    columns: 1;
  }
}

@media (max-width: 480px) {
  .choice {
    padding: 14px 16px;
    font-size: 1rem;
  }
  
  .btn {
    padding: 12px 20px;
    font-size: 0.9rem;
  }
}
