/* widget.css - Merquator Quiz Widget */

/* ── Full-bleed background map ──────────────────────────────────────────── */
#quiz-map {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 0;
}

.map-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 1;
  background: rgba(255,255,255,0.08);
}

/* ── Widget host ────────────────────────────────────────────────────────── */
#quiz-widget {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  pointer-events: none;
}

/* ── Glass card ─────────────────────────────────────────────────────────── */
.quiz-container {
  pointer-events: auto;
  width: min(720px, 92%);
  max-width: 720px;
  margin: 40px auto;
  background: rgba(255,255,255,0.18);
  border-radius: 16px;
  font-family: 'DM Sans', sans-serif;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  backdrop-filter: none;
}

/* ── Logo ───────────────────────────────────────────────────────────────── */
.quiz-logo {
  display: block;
  margin: 0 auto 20px;
  width: 75vw;
  max-width: 500px;
  min-width: 100px;
  height: auto;
}

/* ── Map wrapper — positioning context for score overlay ────────────────── */
.quiz-map-wrap {
  position: relative;
  margin-bottom: 1em;
}

/* ── Score overlay — absolute top-right corner of the map ──────────────── */
.qs-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: none;
}

/* Score box: translucent accent-colour glass */
.qs-score-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: color-mix(in srgb, var(--mq-accent, #1e5ac8) 55%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 8px;
  padding: 6px 10px 5px;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 3px 12px rgba(0,0,0,0.20);
  line-height: 1;
  min-width: 64px;
}

.qs-label {
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
  margin-bottom: 1px;
}

.qs-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.qs-best {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  min-height: 0.85em;
  align-self: flex-end;
}

/* Streak pill — amber glass, shown by JS at streak >= 2 */
.qs-streak {
  display: none;
  align-items: center;
  gap: 3px;
  background: rgba(200, 100, 20, 0.60);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 20px;
  padding: 3px 9px 3px 7px;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,0.22);
}

/* Popup anchor — no longer needed, kept for compat */
.qs-popup-anchor { display: none; }

/* Spawned popup elements — float beside the score box */
.qs-popup-fly {
  position: absolute;
  top: 10px;
  right: 90px;         /* sits to the left of the score box */
  white-space: nowrap;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 6px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
}

.qs-popup-fly[data-type="correct"] { color: #4ade80; }
.qs-popup-fly[data-type="wrong"]   { color: #f87171; }

.qs-popup-fly--go {
  animation: qs-fly 1.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes qs-fly {
  0%   { opacity: 0;   transform: translateY(0)    scale(0.8); }
  15%  { opacity: 1;   transform: translateY(-6px)  scale(1.1); }
  40%  { opacity: 1;   transform: translateY(-18px) scale(1.0); }
  100% { opacity: 0;   transform: translateY(-42px) scale(0.9); }
}

/* ── Question & answers ─────────────────────────────────────────────────── */
.quiz-question {
  font-size: 1.1rem;
  margin: 8px 0 16px 0;
  text-align: center;
  color: #071126;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.quiz-answers {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.quiz-answer {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.10);
  color: #071126;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
  opacity: 0;
  transform: translateY(8px);
  box-shadow: 0 6px 18px rgba(6,18,30,0.08);
}

.quiz-answer:hover {
  background: rgba(255,255,255,0.18);
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(6,18,30,0.12);
}

.quiz-answer.animate {
  opacity: 1;
  transform: translateY(0);
}

.quiz-answer.correct {
  background: rgba(38, 166, 91, 0.14) !important;
  border-color: rgba(38, 166, 91, 0.28);
  color: #063614;
}

.quiz-answer.incorrect {
  background: rgba(220, 53, 69, 0.14) !important;
  border-color: rgba(220, 53, 69, 0.28);
  color: #3b0f12;
}

/* ── Answer details ─────────────────────────────────────────────────────── */
.answer-details {
  margin-top: 8px;
  font-size: 0.85rem;
  color: rgba(6,18,30,0.75);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.answer-details span {
  display: block;
}

.detail-location { font-style: italic; }

.detail-distance {
  font-weight: 600;
  color: rgba(6,18,30,0.6);
}

.detail-property {
  font-weight: 700;
  color: rgba(6,18,30,0.75);
}

.quiz-answer.correct .detail-property  { color: rgba(6,54,20,0.9); }
.quiz-answer.incorrect .detail-property { color: rgba(59,15,18,0.9); }
.quiz-answer.correct .answer-details  { color: rgba(6,54,20,0.85); }
.quiz-answer.incorrect .answer-details { color: rgba(59,15,18,0.85); }

/* ── Loading & transitions ──────────────────────────────────────────────── */
.quiz-loading {
  margin-top: 1em;
  text-align: center;
  font-style: italic;
  color: #555;
  animation: fadePulse 1.5s infinite;
}

@keyframes fadePulse {
  0%,100% { opacity: 0.3; }
  50%      { opacity: 1;   }
}

.quiz-fade-out { opacity: 0; }

.quiz-fade-in {
  opacity: 0;
  animation: fadeIn 0.4s forwards;
}

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

/* ── Marker pulse ───────────────────────────────────────────────────────── */
.pulse-marker { animation: pulse 1s ease-out; }

@keyframes pulse {
  0%   { r: 8;  opacity: 0.8; }
  50%  { r: 14; opacity: 0.4; }
  100% { r: 8;  opacity: 0.8; }
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.quiz-footer {
  margin-top: 20px;
  padding: 10px;
  text-align: center;
  font-size: 0.9rem;
  border-top: 1px solid #ddd;
  color: #666;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.footer-link { color: #007bff; text-decoration: none; margin-bottom: 10px; }
.footer-link:hover { text-decoration: underline; }

.ad-slot img { max-width: 100%; height: auto; display: block; }
/* ── Leaflet answer popup — translucent grey glass ──────────────────────── */
.leaflet-popup-content-wrapper {
  background: rgba(240, 240, 242, 0.72) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14) !important;
  border: 1px solid rgba(255,255,255,0.45) !important;
  color: #0f1724 !important;
}

.leaflet-popup-tip {
  background: rgba(240, 240, 242, 0.72) !important;
}

.leaflet-popup {
  z-index: 1100 !important;
}

.qs-overlay {
  /* add to existing rule: */
  transition: opacity 0.3s ease;
}

.qs-overlay.dimmed {
  opacity: 0.85;
}

.qs-share-btn {
  padding: 10px 22px;
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.qs-share-wrap {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.qs-share-whatsapp { background: #25d366; }
.qs-share-whatsapp:hover { background: #1aab52; }

.qs-share-btn:hover { filter: brightness(1.15); transform: translateY(-2px); }

.mq-feedback-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 6px 0 0;
  border-radius: 12px;
  background: var(--mq-card-bg, #f7f8fa);
  border: 1.5px solid #e0e3ea;
  box-sizing: border-box;
  opacity: 0;
  animation: fadeIn 0.3s ease 0.5s forwards;
}

.mq-feedback-label {
  font-size: 0.8rem;
  color: var(--text-muted, #888);
  margin-right: 4px;
  flex: 1;
}

.mq-feedback-btn {
  background: none;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.mq-feedback-btn:hover {
  background: var(--hover-bg, #f5f5f5);
  transform: scale(1.1);
}

.mq-feedback-thanks {
  font-size: 0.85rem;
  color: var(--text-muted, #888);
  font-style: italic;
}