:root {
  --primary: #ffcc00;
  --primary-dark: #ff9900;
  --bg-start: #1e1e1e;
  --bg-end: #444;
  --container-bg: rgba(50, 50, 50, 0.9);
  --text: #fff;
  --text-muted: #aaa;
  --text-dim: #666;
  --correct: #28a745;
  --correct-light: #20c997;
  --wrong: #dc3545;
  --wrong-light: #e74c3c;
  --reveal: #6c757d;
  --reveal-dark: #495057;
  --danger: #ff5252;
  --warning: #ff9900;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0px 4px 15px rgba(0, 0, 0, 0.5);
  --transition: 0.2s ease;
}

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

body {
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  text-align: center;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

h1 {
  color: var(--primary);
  font-size: 2.5rem;
  margin: 10px 0;
  text-shadow: 2px 2px 5px black;
}

h2 {
  margin: 0 0 15px;
  color: #ddd;
}

h3 {
  margin: 0 0 10px;
  color: var(--text);
}

/* Screens */
.screen {
  display: none;
  animation: fadeSlideIn 0.35s ease forwards;
}

.screen.active {
  display: block;
}

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

.container {
  margin: 10px auto;
  padding: 20px;
  background: var(--container-bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow);
}

/* Buttons */
button {
  display: block;
  width: 100%;
  padding: 14px 12px;
  cursor: pointer;
  background: linear-gradient(to right, var(--primary), var(--primary-dark));
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: bold;
  color: black;
  margin: 10px 0;
  transition: transform var(--transition), filter var(--transition);
  font-family: inherit;
}

button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

button:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.btn-correct {
  background: linear-gradient(to right, var(--correct), var(--correct-light)) !important;
}

.btn-wrong {
  background: linear-gradient(to right, var(--wrong), var(--wrong-light)) !important;
}

.btn-reveal {
  background: linear-gradient(to right, var(--reveal), var(--reveal-dark)) !important;
  color: white;
}

.btn-secondary {
  background: linear-gradient(to right, var(--reveal), var(--reveal-dark)) !important;
  color: white;
}

.btn-success {
  background: linear-gradient(to right, var(--correct), var(--correct-light)) !important;
}

.btn-small {
  font-size: 0.95rem;
  padding: 10px 12px;
}

/* Feedback */
#feedback {
  font-size: 1.2rem;
  margin: 10px 0;
  font-weight: bold;
}

#feedback span {
  display: inline-block;
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  0% { transform: scale(0.7); opacity: 0; }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.correct {
  color: #4caf50;
}

.incorrect {
  color: var(--danger);
}

/* Logo */
.site-logo {
  position: fixed;
  top: 10px;
  left: 10px;
  width: 60px;
  height: auto;
  z-index: 9999;
  border-radius: var(--radius-sm);
}

/* Timer */
.timer-bar-track {
  width: 100%;
  height: 8px;
  background: #333;
  border-radius: 4px;
  margin: 10px 0;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s linear;
}

.timer-bar-fill.warning {
  background: var(--warning);
}

.timer-bar-fill.danger {
  background: var(--danger);
}

/* Progress & info */
.progress-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.quiz-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 4px;
}

.quiz-info span {
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 12px;
}

.score-display {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 6px;
}

.streak-display {
  font-size: 0.95rem;
  color: var(--correct-light);
  margin-bottom: 4px;
  min-height: 1.4em;
}

/* Progress dots */
.progress-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 8px 0;
}

.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #444;
  transition: background var(--transition), transform var(--transition);
}

.progress-dot.current {
  background: var(--primary);
  transform: scale(1.3);
}

.progress-dot.correct {
  background: var(--correct);
}

.progress-dot.wrong {
  background: var(--wrong);
}

.progress-dot.timedout {
  background: var(--reveal);
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  text-align: center;
  font-size: 13px;
  color: gray;
  background: rgba(255, 255, 255, 0.95);
  padding: 6px 0;
}

.footer a {
  color: #555;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* High scores */
.high-scores-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.high-scores-list li {
  display: inline-block;
  background: rgba(255, 204, 0, 0.15);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 12px;
  margin: 2px 4px;
  font-size: 0.9rem;
}

/* Review list */
.review-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
  text-align: left;
}

.review-list li {
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.05);
}

.review-list li .review-q {
  font-weight: bold;
  margin-bottom: 2px;
}

.review-list li.review-correct {
  border-left: 4px solid var(--correct);
}

.review-list li.review-wrong {
  border-left: 4px solid var(--wrong);
}

.review-icon {
  margin-right: 6px;
}

/* Share button */
.btn-share {
  background: linear-gradient(to right, #1da1f2, #0d8bd9) !important;
  color: white;
}

/* Keyboard hint */
.keyboard-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Responsive */
@media (max-width: 600px) {
  h1 { font-size: 2rem; }
  .container { padding: 15px; }
  button { font-size: 1rem; padding: 12px 10px; }
  .site-logo { width: 45px; top: 6px; left: 6px; }
}

@media (max-width: 400px) {
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.1rem; }
  button { font-size: 0.9rem; padding: 10px 8px; }
}
