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

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.container {
  background: #ffffff;
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 480px;
}

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

h1 {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.stats {
  color: #64748b;
  font-size: 14px;
}

.stats span {
  font-weight: 600;
  color: #0f172a;
}

.settings {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e2e8f0;
}

.timer-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #64748b;
}

.timer-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
  cursor: pointer;
}

.settings select {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
}

.settings select:not(:disabled) {
  color: #0f172a;
  background: white;
}

.reset-btn {
  padding: 8px 12px;
  font-size: 12px;
  background: transparent;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
}

.reset-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fecaca;
}

.category {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #3b82f6;
  background: #eff6ff;
  padding: 6px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.timer {
  font-size: 48px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 20px;
  font-variant-numeric: tabular-nums;
}

.timer.warning {
  color: #f59e0b;
}

.timer.danger {
  color: #ef4444;
  animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.problem {
  font-size: 18px;
  line-height: 1.8;
  color: #334155;
  background: #f8fafc;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  border-left: 4px solid #3b82f6;
}

.problem .ask {
  margin-top: 16px;
  font-weight: 600;
  color: #0f172a;
}

.answer-input {
  display: flex;
  gap: 10px;
}

#result-screen {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
}

input[type="number"] {
  flex: 1;
  min-width: 120px;
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="number"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

input[type="number"]::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

#unit {
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  color: #0f172a;
}

button {
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

button:hover {
  background: #2563eb;
}

button:active {
  transform: scale(0.98);
}

.hidden {
  display: none !important;
}

.result {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
}

.result.correct {
  color: #10b981;
}

.result.incorrect {
  color: #ef4444;
}

.solution {
  background: #f8fafc;
  padding: 20px;
  border-radius: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 15px;
  line-height: 2;
  margin-bottom: 24px;
  color: #334155;
}

#next-btn {
  width: 100%;
}

#result-screen:not(.hidden) {
  animation: fadeIn 0.3s ease-out;
}

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

/* Mobile adjustments */
@media (max-width: 480px) {
  .container {
    padding: 24px;
  }

  .answer-input {
    flex-wrap: wrap;
  }

  input[type="number"] {
    width: 100%;
  }

  #unit {
    flex: 1;
  }

  button {
    flex: 1;
  }
}
