/* ==========================================================================
   LQ ANSWER POPUP — Premium Daylight / Floating Card Design
   Matches reference image pixel-for-pixel.
   Memory response system: Knew It / Partly Remembered / Forgot It
   ========================================================================== */

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
  --lq-font:        'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --lq-surface:     #ffffff;
  --lq-text:        #1e293b;
  --lq-text-head:   #0f172a;
  --lq-muted:       #64748b;
  --lq-border:      rgba(226, 232, 240, 0.85);
  --lq-primary:     #5b5cf6;
  --lq-accent:      #6366f1;
  --lq-radius:      28px;
  --lq-shadow:      0 24px 80px rgba(71, 64, 196, 0.20), 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* ── Overlay ────────────────────────────────────────────────────── */
.lq-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.50);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lq-overlay.lq-active {
  opacity: 1;
  visibility: visible;
}

/* ── Modal Card ─────────────────────────────────────────────────── */
.lq-card {
  background: var(--lq-surface);
  border-radius: var(--lq-radius);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--lq-shadow);
  position: relative;
  font-family: var(--lq-font);
  border: 1px solid rgba(255, 255, 255, 0.95);
  transform: scale(0.88) translateY(24px);
  opacity: 0;
  transition: transform 0.38s cubic-bezier(0.34, 1.44, 0.64, 1),
              opacity 0.32s ease;
  -webkit-overflow-scrolling: touch;
}

.lq-overlay.lq-active .lq-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.lq-overlay.lq-closing .lq-card {
  transform: scale(0.92) translateY(16px);
  opacity: 0;
  transition: transform 0.24s ease, opacity 0.22s ease;
}

/* Scrollbar */
.lq-card::-webkit-scrollbar { width: 3px; }
.lq-card::-webkit-scrollbar-track { background: transparent; }
.lq-card::-webkit-scrollbar-thumb { background: #dde3f0; border-radius: 4px; }

/* ── Decorative Floating Elements ───────────────────────────────── */
/* These sit OUTSIDE the card, relative to the overlay center */
.lq-deco-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.lq-deco {
  position: absolute;
  pointer-events: none;
  animation: lqDecoFloat 3.6s ease-in-out infinite alternate;
}

/* Stars */
.lq-deco-star {
  font-size: 16px;
  line-height: 1;
}
/* Plus signs */
.lq-deco-plus {
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
}
/* Sparkles */
.lq-deco-sparkle {
  font-size: 14px;
  line-height: 1;
}
/* Dots */
.lq-deco-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

@keyframes lqDecoFloat {
  0%   { transform: translateY(0px) rotate(0deg) scale(1); }
  100% { transform: translateY(-8px) rotate(12deg) scale(1.12); }
}

/* Individual deco positions */
.lq-d1  { top: 12%; left: 4%;  color: #f472b6; animation-delay: 0s;    animation-duration: 3.2s; }
.lq-d2  { top: 20%; left: 3%;  color: #a78bfa; animation-delay: 0.6s;  animation-duration: 4.1s; }
.lq-d3  { top: 35%; left: 2%;  color: #22d3ee; background: #22d3ee; width: 6px; height: 6px; border-radius: 50%; animation-delay: 1.1s;  animation-duration: 3.7s; }
.lq-d4  { top: 50%; left: 3%;  color: #fbbf24; animation-delay: 0.3s;  animation-duration: 4.4s; }
.lq-d5  { top: 65%; left: 2%;  color: #f472b6; animation-delay: 0.9s;  animation-duration: 3.5s; }
.lq-d6  { top: 78%; left: 4%;  color: #818cf8; animation-delay: 1.5s;  animation-duration: 4.0s; }
.lq-d7  { top: 10%; right: 4%; color: #fbbf24; animation-delay: 0.2s;  animation-duration: 3.9s; }
.lq-d8  { top: 22%; right: 3%; background: #10b981; width: 6px; height: 6px; border-radius: 50%; animation-delay: 0.8s;  animation-duration: 4.2s; }
.lq-d9  { top: 38%; right: 2%; color: #818cf8; animation-delay: 0.4s;  animation-duration: 3.6s; }
.lq-d10 { top: 52%; right: 3%; color: #f472b6; animation-delay: 1.2s;  animation-duration: 4.3s; }
.lq-d11 { top: 65%; right: 2%; color: #22d3ee; animation-delay: 0.7s;  animation-duration: 3.8s; }
.lq-d12 { top: 80%; right: 4%; color: #a3e635; animation-delay: 1.4s;  animation-duration: 4.1s; }
.lq-d13 { top: 8%;  left: 48%; color: #818cf8; animation-delay: 0.5s;  animation-duration: 3.4s; }
.lq-d14 { top: 88%; left: 6%;  color: #fbbf24; animation-delay: 1.0s;  animation-duration: 4.5s; }
.lq-d15 { top: 88%; right: 6%; color: #f472b6; animation-delay: 0.3s;  animation-duration: 3.3s; }

/* ── Inner Padding Container ────────────────────────────────────── */
.lq-inner {
  padding: 26px 24px 28px;
  position: relative;
}

/* ── Header Row ─────────────────────────────────────────────────── */
.lq-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 42px; /* space for close btn */
  margin-bottom: 0;
}

/* Book Icon Container */
.lq-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(145deg, #eef0ff, #dde0fb);
  box-shadow:
    4px 4px 10px rgba(91, 92, 246, 0.14),
    -3px -3px 8px rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #6366f1;
}

.lq-icon-wrap svg {
  width: 26px;
  height: 26px;
}

/* Question Title */
.lq-question-title {
  flex: 1;
  font-size: 17px;
  font-weight: 800;
  color: var(--lq-text-head);
  line-height: 1.35;
  letter-spacing: -0.2px;
}

/* Close Button */
.lq-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
  transition: background 0.18s, transform 0.15s;
  flex-shrink: 0;
  z-index: 10;
}

.lq-close-btn:hover { background: #e2e8f0; }
.lq-close-btn:active { transform: scale(0.9); }

/* ── Decorative Divider ─────────────────────────────────────────── */
.lq-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 18px;
}

.lq-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, #c7d2fe, transparent);
}

.lq-divider-star {
  color: #818cf8;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Answer Intro Text ──────────────────────────────────────────── */
.lq-answer-intro {
  font-size: 15.5px;
  color: #334155;
  line-height: 1.72;
  margin-bottom: 18px;
  font-weight: 500;
}

.lq-answer-intro p {
  margin: 0 0 12px;
}

.lq-answer-intro ul,
.lq-answer-intro ol {
  margin: 8px 0 14px;
  padding-left: 22px;
}

.lq-answer-intro li {
  margin-bottom: 7px;
}

.lq-answer-intro strong {
  color: #5b5cf6;
  font-weight: 800;
}

.lq-answer-intro table {
  width: 100%;
  margin: 10px 0 14px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.45;
}

.lq-answer-intro th,
.lq-answer-intro td {
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

.lq-answer-intro th {
  background: #f8fafc;
  color: #312e81;
  font-weight: 800;
}

.lq-keyword {
  color: #5b5cf6;
  font-weight: 700;
}

/* ── Answer Point Cards ─────────────────────────────────────────── */
.lq-points-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 6px;
}

.lq-point-card {
  display: flex;
  align-items: center;
  gap: 13px;
  background: #ffffff;
  border: 1.5px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow:
    0 2px 10px rgba(91, 92, 246, 0.07),
    0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s;
}

.lq-point-card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(91, 92, 246, 0.08);
}

/* Bullet dot */
.lq-point-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #818cf8;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.18);
}

.lq-point-text {
  font-size: 14.5px;
  color: #1e293b;
  font-weight: 500;
  line-height: 1.5;
  flex: 1;
}

/* ── Bottom Divider (above buttons) ─────────────────────────────── */
.lq-divider-bottom {
  margin: 22px 0 20px;
}

/* ── Memory Buttons Container ───────────────────────────────────── */
.lq-memory-btns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 380px) {
  .lq-memory-btns {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* ── Base Memory Button ─────────────────────────────────────────── */
.lq-mem-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 10px 13px;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  font-family: var(--lq-font);
  transition:
    transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.18s ease,
    filter 0.18s ease;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.lq-mem-btn:active {
  transform: scale(0.97) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
}

/* Icon circle inside button */
.lq-mem-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.lq-mem-btn:active .lq-mem-icon {
  transform: scale(0.92);
}

.lq-mem-label {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
}

/* ── Knew It — Green ─────────────────────────────────────────────── */
.lq-btn-knew {
  background: #f0fdf4;
  border: 2px solid #bbf7d0;
  box-shadow: 0 3px 14px rgba(34, 197, 94, 0.15);
}

.lq-btn-knew .lq-mem-icon {
  background: #dcfce7;
  color: #16a34a;
}

.lq-btn-knew .lq-mem-label {
  color: #16a34a;
}

.lq-btn-knew:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.22);
  border-color: #86efac;
}

/* ── Partly Remembered — Amber ──────────────────────────────────── */
.lq-btn-partly {
  background: #fffbeb;
  border: 2px solid #fde68a;
  box-shadow: 0 3px 14px rgba(245, 158, 11, 0.15);
}

.lq-btn-partly .lq-mem-icon {
  background: #fef3c7;
  color: #d97706;
}

.lq-btn-partly .lq-mem-label {
  color: #b45309;
}

.lq-btn-partly:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.22);
  border-color: #fcd34d;
}

/* ── Forgot It — Red ─────────────────────────────────────────────── */
.lq-btn-forgot {
  background: #fff5f5;
  border: 2px solid #fecaca;
  box-shadow: 0 3px 14px rgba(239, 68, 68, 0.14);
}

.lq-btn-forgot .lq-mem-icon {
  background: #fee2e2;
  color: #dc2626;
}

.lq-btn-forgot .lq-mem-label {
  color: #dc2626;
}

.lq-btn-forgot:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.20);
  border-color: #fca5a5;
}

/* ── App blur when popup open ───────────────────────────────────── */
.lq-app-blurred {
  filter: blur(3px) brightness(0.96);
  transition: filter 0.3s ease;
  pointer-events: none;
  user-select: none;
}

/* ── Prevent body scroll ────────────────────────────────────────── */
body.lq-no-scroll { overflow: hidden; }

/* ── Mobile Adjustments ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .lq-card { border-radius: 24px; }
  .lq-inner { padding: 22px 18px 22px; }
  .lq-question-title { font-size: 15px; }
  .lq-mem-label { font-size: 11.5px; }
}
