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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --error: #dc2626;
  --error-light: #fee2e2;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #64748b;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 800px; margin: 0 auto; padding: 20px; }

.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.card-header {
  font-size: 0.875rem;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-error { background: var(--error); color: white; }
.btn-outline { background: white; color: var(--gray-800); border: 2px solid var(--gray-200); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }
.btn-sm { padding: 8px 16px; font-size: 0.875rem; }
.btn-lg { padding: 16px 32px; font-size: 1.125rem; }
.btn-block { display: flex; width: 100%; }

select, input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  background: white;
  color: var(--gray-900);
  transition: border-color 0.15s ease;
  appearance: auto;
}
select:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--gray-800); }

.form-group { margin-bottom: 16px; }

.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
}
.radio-option:hover { border-color: var(--primary); }
.radio-option.active { border-color: var(--primary); background: var(--primary-light); }
.radio-option input[type="radio"] { display: none; }

.word-display {
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 24px;
}
.word-display .label { font-size: 0.875rem; color: var(--gray-600); margin-bottom: 8px; }
.word-display .word {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}
.word-display .target-hint {
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--gray-400);
}

.timer-display {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 24px;
}
.progress-bar .fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.feedback-card {
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  text-align: center;
}
.feedback-card.correct { background: var(--success-light); color: var(--success); }
.feedback-card.incorrect { background: var(--error-light); color: var(--error); }
.feedback-card.warning { background: var(--warning-light); color: var(--warning); }
.feedback-card h3 { margin-bottom: 8px; }
.feedback-card p { font-size: 0.875rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  text-align: center;
  padding: 16px 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
}
.stat-card .number { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); }
.stat-card .label { font-size: 0.75rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.05em; }

.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

@media (max-width: 600px) {
  .container { padding: 12px; }
  .card { padding: 16px; }
  .word-display .word { font-size: 1.75rem; }
  .btn-lg { padding: 14px 24px; font-size: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
