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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 640px;
  padding: 20px;
}

/* TITLE SCREEN */
#title-screen {
  text-align: center;
  animation: fadeIn 0.5s ease;
}

#title-screen .logo {
  font-size: 4rem;
  margin-bottom: 10px;
}

#title-screen h1 {
  font-size: 2.2rem;
  color: #f5a623;
  margin-bottom: 8px;
}

#title-screen .tagline {
  color: #aaa;
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.difficulty-select {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.difficulty-select label {
  color: #888;
  font-size: 0.9rem;
}

.diff-btn {
  background: #2a2a4a;
  border: 1px solid #444;
  color: #ccc;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.diff-btn:hover {
  border-color: #f5a623;
  color: #f5a623;
}

.diff-btn.active {
  background: #f5a623;
  color: #1a1a2e;
  border-color: #f5a623;
  font-weight: 600;
}

#start-btn, #replay-btn, #next-btn {
  background: #f5a623;
  color: #1a1a2e;
  border: none;
  padding: 14px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}

#start-btn:hover, #replay-btn:hover, #next-btn:hover {
  background: #ffb84d;
  transform: scale(1.03);
}

#title-screen .credit {
  margin-top: 24px;
  color: #555;
  font-size: 0.8rem;
}

/* QUIZ SCREEN */
#quiz-screen {
  animation: fadeIn 0.4s ease;
}

#quiz-header {
  margin-bottom: 20px;
}

#progress-bar {
  height: 6px;
  background: #2a2a4a;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

#progress-fill {
  height: 100%;
  background: #f5a623;
  width: 0%;
  transition: width 0.4s ease;
}

#quiz-info {
  display: flex;
  justify-content: space-between;
  color: #888;
  font-size: 0.9rem;
}

#streak-display {
  color: #f5a623;
}

#question-card {
  background: #16213e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 28px 24px;
  margin-bottom: 16px;
}

#question-text {
  font-size: 1.15rem;
  line-height: 1.5;
  margin-bottom: 24px;
  color: #f0f0f0;
}

.question-img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  margin: 16px auto 0;
  border-radius: 8px;
  border: 1px solid #333;
  object-fit: contain;
  background: #111;
}

#answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer-btn {
  background: #1a1a2e;
  border: 2px solid #333;
  color: #ddd;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.answer-btn:hover:not(.disabled) {
  border-color: #f5a623;
  background: #222244;
}

.answer-btn.correct {
  border-color: #4caf50;
  background: #1b3d1b;
  color: #4caf50;
}

.answer-btn.incorrect {
  border-color: #e74c3c;
  background: #3d1b1b;
  color: #e74c3c;
}

.answer-btn.disabled {
  cursor: default;
  opacity: 0.7;
}

.answer-btn.reveal {
  border-color: #4caf50;
  background: #1b3d1b;
  color: #4caf50;
}

/* FEEDBACK */
#feedback {
  text-align: center;
  padding: 16px;
  animation: fadeIn 0.3s ease;
}

#feedback-text {
  margin-bottom: 14px;
  font-size: 1rem;
  color: #ccc;
}

#feedback-text.correct-text {
  color: #4caf50;
}

#feedback-text.incorrect-text {
  color: #e74c3c;
}

/* RESULTS SCREEN */
#results-screen {
  animation: fadeIn 0.5s ease;
}

.results-card {
  background: #16213e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 36px 28px;
  text-align: center;
}

#results-title {
  font-size: 1.8rem;
  color: #f5a623;
  margin-bottom: 16px;
}

#results-score {
  font-size: 3rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

#results-stats {
  color: #888;
  margin-bottom: 24px;
  font-size: 0.95rem;
  line-height: 1.8;
}

#results-breakdown {
  text-align: left;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 24px;
  padding: 12px;
  background: #1a1a2e;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.6;
}

#results-breakdown .result-item {
  padding: 4px 0;
  border-bottom: 1px solid #2a2a4a;
}

#results-breakdown .result-item:last-child {
  border-bottom: none;
}

.result-correct { color: #4caf50; }
.result-incorrect { color: #e74c3c; }

/* UTILITIES */
.hidden {
  display: none !important;
}

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

/* RESPONSIVE */
@media (max-width: 480px) {
  #app { padding: 12px; }
  #title-screen h1 { font-size: 1.6rem; }
  #question-card { padding: 20px 16px; }
  #question-text { font-size: 1rem; }
  .answer-btn { padding: 12px 14px; font-size: 0.9rem; }
  .question-img { max-height: 180px; }
}

/* HIGH SCORES */
#highscore-entry {
  margin: 0 0 24px;
  padding: 18px 16px;
  background: #1a1a2e;
  border: 1px solid #f5a623;
  border-radius: 8px;
}

.highscore-prompt {
  color: #f5a623;
  font-size: 1rem;
  margin-bottom: 12px;
}

.highscore-entry-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

#highscore-name {
  flex: 1;
  max-width: 260px;
  background: #16213e;
  border: 2px solid #333;
  color: #eee;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}

#highscore-name:focus {
  outline: none;
  border-color: #f5a623;
}

#highscore-save-btn {
  background: #f5a623;
  color: #1a1a2e;
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

#highscore-save-btn:hover {
  background: #ffb84d;
}

#highscore-save-btn:disabled {
  background: #555;
  color: #999;
  cursor: default;
}

.highscore-error {
  color: #e74c3c;
  font-size: 0.85rem;
  margin-top: 10px;
}

.highscore-board {
  margin: 0 0 24px;
  padding: 16px;
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 8px;
  text-align: left;
}

.highscore-board h3 {
  color: #f5a623;
  font-size: 1.1rem;
  margin-bottom: 12px;
  text-align: center;
}

.highscore-board ol {
  list-style: none;
  counter-reset: hs;
}

.highscore-board li {
  counter-increment: hs;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid #2a2a4a;
  font-size: 0.95rem;
}

.highscore-board li:last-child {
  border-bottom: none;
}

.highscore-board li::before {
  content: counter(hs) ".";
  color: #888;
  width: 26px;
  flex: 0 0 26px;
}

.highscore-board .hs-name {
  flex: 1;
  color: #eee;
  overflow-wrap: anywhere;
}

.highscore-board .hs-score {
  color: #f5a623;
  font-weight: 700;
  white-space: nowrap;
}

.highscore-board li.hs-current .hs-name {
  color: #f5a623;
  font-weight: 700;
}

.highscore-board .hs-empty {
  color: #666;
  text-align: center;
  font-size: 0.9rem;
  padding: 4px;
}
