/* ======== CSS Variables ======== */
:root { 
  --bg: #0f172a; 
  --card-bg: #1e293b; 
  --primary: #10b981; 
  --text: #f8fafc; 
  --accent: #38bdf8; 
  --bonus: #f59e0b;
  --base-padding: 1.5rem;
  --base-gap: 0.75rem;
}

/* ======== Mobile-First Base Styles ======== */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body { 
  margin: 0; 
  padding: var(--base-padding);
  font-family: 'Segoe UI', sans-serif; 
  background: var(--bg); 
  color: var(--text); 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  min-height: 100vh; 
  line-height: 1.6;
}

/* Card Container */
.card { 
  background: var(--card-bg); 
  padding: var(--base-padding);
  border-radius: 1.5rem; 
  width: 100%;
  max-width: 500px;
  text-align: center; 
  border: 1px solid #334155;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Text Elements */
.intro-text { 
  font-size: 0.95rem; 
  color: #94a3b8; 
  line-height: 1.6; 
  margin-bottom: 1.5rem; 
}

/* Initials Input Group */
.initials-group {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.initials-group input { 
  width: 60px;
  height: 70px;
  font-size: 1.75rem;
  text-align: center; 
  background: #334155; 
  border: 2px solid #475569; 
  color: var(--text); 
  border-radius: 0.5rem; 
  text-transform: uppercase;
  flex: 0 0 auto;
  transition: border-color 0.2s, background-color 0.2s;
}

.initials-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: #3f4556;
}

/* Primary Button */
.primary-btn { 
  width: 100%; 
  padding: 1rem;
  font-size: 1rem;
  border-radius: 0.75rem; 
  border: none; 
  font-weight: bold; 
  cursor: pointer; 
  background: var(--primary); 
  color: white; 
  margin-top: 1.5rem;
  transition: background-color 0.2s, transform 0.1s;
  min-height: 48px;
}

.primary-btn:active {
  transform: scale(0.98);
}

.primary-btn:hover {
  background-color: #059669;
}

.primary-btn:disabled {
  background-color: #10b981;
  opacity: 0.6;
  cursor: not-allowed;
}

/* Focus Banner */
#focus-banner { 
  background: rgba(245, 158, 11, 0.1); 
  color: var(--bonus); 
  padding: 0.75rem;
  border-radius: 0.5rem; 
  font-size: 0.85rem; 
  margin: 1.5rem 0; 
  visibility: hidden;
  border: 1px solid var(--bonus);
}

body.offline #focus-banner { 
  visibility: visible; 
  animation: blinker 4s linear infinite;
}

/* Answer Buttons */
.answer-btn { 
  display: block; 
  width: 100%; 
  padding: 1rem; 
  margin: var(--base-gap) 0; 
  background: #334155; 
  border: 2px solid #475569; 
  color: var(--text); 
  border-radius: 0.75rem; 
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s;
  min-height: 48px;
  text-align: left;
}

.answer-btn:active {
  transform: scale(0.98);
}

.answer-btn:disabled { 
  cursor: not-allowed; 
  opacity: 0.6;
}

.answer-btn.correct { 
  background: #10b981; 
  border-color: #059669;
  color: white;
}

.answer-btn.incorrect { 
  background: #ef4444; 
  border-color: #dc2626;
  color: white;
}

/* Feedback and Continue Indicator */
#answer-feedback {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: #94a3b8;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  min-height: 1.5rem;
}

#answer-feedback.show {
  opacity: 1;
  animation: pulse 1s ease-in-out infinite;
}

.feedback-icon { 
  display: none;
}

.feedback-text { 
  margin: 0; 
  font-weight: 400; 
  color: var(--text);
  font-size: 0.9rem;
}

/* Final Score */
.final-score { 
  font-size: 3.5rem; 
  font-weight: bold; 
  color: var(--primary); 
  margin: 1.5rem 0;
  line-height: 1.2;
}

/* Quiz Header */
.quiz-header { 
  display: flex; 
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid #334155; 
  padding-bottom: 1rem; 
  margin-bottom: 1.5rem;
}

.label { 
  display: block; 
  font-size: 0.85rem; 
  color: #64748b;
  font-weight: 500;
}

.score-glow {
  animation: scoreGlow 0.6s ease-out;
}

.floating-points {
  position: absolute;
  right: -50px;
  top: -10px;
  font-weight: bold;
  color: #10b981;
  font-size: 1.1em;
  pointer-events: none;
  animation: floatUp 0.8s ease-out forwards;
}

/* Message Banner */
#msg-banner { 
  font-weight: 600;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.msg-info { 
  background: #111827; 
  color: #fff; 
  border: 1px solid #334155; 
}

.msg-success { 
  background: #062e16; 
  color: #10b981; 
  border: 1px solid rgba(16, 185, 129, 0.15); 
}

.msg-warning { 
  background: #3a2a05; 
  color: #f59e0b; 
  border: 1px solid rgba(245, 158, 11, 0.15); 
}

.msg-error { 
  background: #3a0b0b; 
  color: #f87171; 
  border: 1px solid rgba(248, 113, 113, 0.15); 
}

/* ======== Animations ======== */
@keyframes slideUp { 
  from { 
    opacity: 0; 
    transform: translateY(10px); 
  } 
  to { 
    opacity: 1; 
    transform: translateY(0); 
  } 
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@keyframes scoreGlow {
  0% {
    text-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
    color: #10b981;
  }
  100% {
    text-shadow: 0 0 0 rgba(16, 185, 129, 0);
    color: var(--text);
  }
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px);
  }
}

@keyframes scorePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes blinker {
  50% {
    opacity: 0.5;
  }
}

/* ======== Tablet Styles (640px and up) ======== */
@media (min-width: 640px) {
  html {
    font-size: 17px;
  }

  :root {
    --base-padding: 2rem;
  }

  body {
    padding: 1rem;
  }

  .card {
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  }

  .initials-group input {
    width: 70px;
    height: 80px;
    font-size: 2rem;
  }

  .final-score {
    font-size: 4rem;
  }
}

/* ======== Desktop Styles (1024px and up) ======== */
@media (min-width: 1024px) {
  html {
    font-size: 18px;
  }

  :root {
    --base-padding: 2.5rem;
  }

  .card {
    max-width: 600px;
    padding: 3rem;
  }

  .answer-btn {
    font-size: 1.1rem;
    padding: 1.25rem;
  }

  .final-score {
    font-size: 4.5rem;
  }
}