:root {
  --font-display: "Fraunces", "Georgia", serif;
  --font-ui: "Space Grotesk", "Trebuchet MS", sans-serif;
  --ink: #101418;
  --ink-soft: #4b5563;
  --cream: #f7f2ea;
  --accent: #2f4858;
  --sun: #f4c16a;
  --card: rgba(255, 255, 255, 0.85);
  --stroke: rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, #fbe5ca 0%, transparent 45%),
    radial-gradient(circle at 85% 10%, #cfeee6 0%, transparent 45%),
    linear-gradient(180deg, #f7f2ea 0%, #edf5f1 100%);
  min-height: 100vh;
}

button {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.screen {
  width: min(900px, 100%);
}

.start-card {
  background: var(--card);
  border-radius: 24px;
  padding: 32px;
  border: 1px solid var(--stroke);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  display: grid;
  gap: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.title {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 48px);
}

.high-score {
  color: var(--ink-soft);
}

.group {
  display: grid;
  gap: 10px;
}

.label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--ink-soft);
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option-btn {
  border: 1px solid var(--stroke);
  background: #ffffff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}

.option-btn.active {
  background: var(--accent);
  color: #fef3df;
  border-color: var(--accent);
}

.start-btn {
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  background: var(--accent);
  color: #fef3df;
  cursor: pointer;
}

.start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin-bottom: 20px;
  color: var(--ink-soft);
}

.hud > div {
  background: rgba(255, 255, 255, 0.5);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  gap: 6px;
  align-items: center;
}

#playSnippet {
  background: var(--sun);
  border-color: #dfa648;
  color: var(--ink);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.1s ease;
}

#playSnippet:active {
  transform: scale(0.96);
}

.snippet-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.snippet-title {
  font-weight: 600;
}

.secondary {
  border: 1px solid var(--stroke);
  background: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
}

.options {
  margin: 24px 0;
  display: grid;
  gap: 12px;
}

.options.columns-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.options.columns-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.options.columns-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.option {
  border: 1px solid var(--stroke);
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.option:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

@media (max-width: 900px) {
  .options.columns-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .options.columns-3,
  .options.columns-4,
  .options.columns-5 {
    grid-template-columns: 1fr;
  }

  .snippet-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

.wrong-answer {
  background-color: #ff4b4b !important; /* Red */
  color: white !important;
  border-color: #d32f2f !important;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* --- FOOTER & FEEDBACK STYLES --- */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 20px;
  background: white;
  border-top: 2px solid var(--stroke);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
  z-index: 100;
  /* Animation to slide up */
  animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.footer.hidden {
  display: none;
}

/* Green Footer (Correct) */
.footer.correct {
  background-color: #d7ffb8;
  border-color: #b8e6a0;
}

/* Red Footer (Wrong) */
.footer.wrong {
  background-color: #ffdfe0;
  border-color: #ffc1c1;
}

/* The Continue Button */
.action-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}

/* Green Button style */
.footer.correct .action-btn {
  background: #58cc02;
  box-shadow: 0 4px 0 #46a302;
}

/* Red Button style */
.footer.wrong .action-btn {
  background: #ff4b4b;
  box-shadow: 0 4px 0 #ea2b2b;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Force colors on the answer buttons */
.option.correct-answer {
  background-color: #58cc02 !important;
  color: white !important;
  border-color: #46a302 !important;
}

.option.wrong-answer {
  background-color: #ff4b4b !important;
  color: white !important;
  border-color: #ea2b2b !important;
  opacity: 0.6;
}

/* --- GAME OVER MODAL --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(16, 20, 24, 0.6); /* Dimmed background */
  backdrop-filter: blur(4px); /* Glass effect */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200; /* Above footer */
  animation: fadeIn 0.3s ease;
}

.modal-card {
  background: white;
  width: 90%;
  max-width: 380px;
  padding: 32px 24px;
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  border: 1px solid var(--stroke);
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: bounce 1s infinite;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0 0 8px 0;
  color: var(--ink);
}

.modal-subtitle {
  color: var(--ink-soft);
  margin: 0 0 24px 0;
}

.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

.stat-box {
  flex: 1;
  background: var(--cream);
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.05);
}

.stat-label {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.full-width {
  width: 100%;
  justify-content: center;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
