/* ─────────────────────────────────────────────────────────────────────────────
   EduAnim Styles v1.0
   Covers: animation container, canvas, captions, speech bubbles, controls.
   Works inside Gutenberg "wide" and "full" align modes.
───────────────────────────────────────────────────────────────────────────── */

/* ── Wrapper figure ──────────────────────────────────────────────────────── */
.edu-anim-wrap {
  margin: 2em auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.12);
  background: #f0f4ff;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ── Root container ──────────────────────────────────────────────────────── */
.edu-anim-root {
  position: relative;
  width: 100%;
  background: #f0f4ff;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}

/* ── Canvas ──────────────────────────────────────────────────────────────── */
.edu-anim-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px 16px 0 0;
}

/* ── Caption bar ─────────────────────────────────────────────────────────── */
.edu-caption {
  min-height: 2.6em;
  padding: 0.55em 1.2em;
  background: #1a1f36;
  color: #f0f4ff;
  font-size: clamp(13px, 2vw, 17px);
  line-height: 1.45;
  text-align: center;
  letter-spacing: 0.01em;
  transition: opacity 0.3s ease;
  opacity: 0;
}

.edu-caption--visible {
  opacity: 1;
}

/* ── Speech bubbles overlay ──────────────────────────────────────────────── */
.edu-bubbles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 3em - 48px); /* exclude caption + controls */
  pointer-events: none;
}

.edu-bubble {
  position: absolute;
  max-width: 38%;
  min-width: 120px;
  background: #fff;
  color: #1a1f36;
  border: 2.5px solid #1a1f36;
  border-radius: 16px 16px 16px 4px;
  padding: 0.5em 0.85em;
  font-size: clamp(11px, 1.6vw, 14px);
  line-height: 1.4;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.12);
  animation: bubble-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  pointer-events: none;
  z-index: 10;
}

@keyframes bubble-pop {
  from { transform: translateX(-50%) scale(0.5); opacity: 0; }
  to   { transform: translateX(-50%) scale(1);   opacity: 1; }
}

/* ── Controls bar ────────────────────────────────────────────────────────── */
.edu-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #1a1f36;
  border-radius: 0 0 16px 16px;
}

.edu-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #f0f4ff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, transform 0.12s;
  line-height: 1;
}

.edu-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: scale(1.1);
}

.edu-btn:active {
  transform: scale(0.95);
}

/* ── Progress bar ────────────────────────────────────────────────────────── */
.edu-progress {
  flex: 1;
  height: 14px;           /* tall enough to be easy to click / drag */
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 4px 0;         /* extra invisible hit area above + below */
  box-sizing: content-box;
  position: relative;
}

/* The actual track sits inside the flex container */
.edu-progress::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 50%; transform: translateY(-50%);
  height: 6px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  transition: height 0.15s;
}
.edu-progress:hover::before { height: 8px; }

.edu-progress-bar {
  height: 6px;
  width: 0%;
  background: linear-gradient(90deg, #4fc3f7, #7c4dff);
  border-radius: 3px;
  transition: width 0.1s linear, height 0.15s;
  position: relative;
  z-index: 1;
  pointer-events: none;
}
.edu-progress:hover .edu-progress-bar { height: 8px; }

/* Thumb dot at the playhead */
.edu-progress-bar::after {
  content: '';
  position: absolute;
  right: -6px; top: 50%;
  transform: translateY(-50%) scale(0);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px #7c4dff;
  transition: transform 0.15s;
}
.edu-progress:hover .edu-progress-bar::after { transform: translateY(-50%) scale(1); }

/* ── Game overlay ────────────────────────────────────────────────────────── */
.edu-game {
  position: absolute;
  inset: 0 0 48px 0; /* leave the 48px controls bar visible */
  background: rgba(135, 206, 235, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: 16px 16px 0 0;
}

.edu-game-inner {
  background: #fff;
  border-radius: 20px;
  padding: 1.6em 2em;
  text-align: center;
  max-width: 420px;
  width: 92%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.edu-game-title {
  font-size: clamp(16px,3vw,22px);
  font-weight: 700;
  color: #1a3a6e;
  margin-bottom: 0.4em;
}

.edu-game-score {
  font-size: clamp(11px,1.8vw,14px);
  color: #378ADD;
  background: #e8f4fd;
  border-radius: 20px;
  padding: 0.25em 0.9em;
  display: inline-block;
  margin-bottom: 0.8em;
}

.edu-game-prompt {
  font-size: clamp(13px,2.2vw,16px);
  color: #333;
  margin-bottom: 1.1em;
  line-height: 1.4;
}

.edu-game-btns {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 1em;
}

.edu-game-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid;
  font-size: 32px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.edu-game-btn:hover:not(:disabled) { transform: scale(1.12); }
.edu-game-btn:active:not(:disabled) { transform: scale(0.96); }
.edu-game-btn:disabled { opacity: 0.45; cursor: default; }

.edu-game-btn0 { background: #e3f2fd; color: #0C447C; border-color: #378ADD; }
.edu-game-btn1 { background: #fbe9e7; color: #712B13; border-color: #D85A30; }

/* Quiz-type buttons — text labels, full-width, stacked */
.edu-game-btns:has(.edu-game-btn-quiz) { flex-direction: column; gap: 10px; }
.edu-game-btn-quiz {
  width: 100%; max-width: 320px; height: auto; min-height: 48px;
  border-radius: 12px; border: 2px solid #7F77DD;
  background: #f3f2fd; color: #3C3489;
  font-size: 15px; font-weight: 600; padding: 0.5em 1em;
  cursor: pointer; transition: background 0.15s, transform 0.12s;
}
.edu-game-btn-quiz:hover:not(:disabled) { background: #e2e0f9; }
.edu-game-reveal--quiz { background: #7F77DD; border-color: #3C3489; color: #fff; }

.edu-game-reveal {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #ccc;
  font-size: 30px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.7em;
  animation: reveal-pop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}

.edu-game-reveal--zero { background: #378ADD; border-color: #0C447C; color: #fff; }
.edu-game-reveal--one  { background: #D85A30; border-color: #712B13; color: #fff; }

@keyframes reveal-pop {
  from { transform: scale(0.2); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.edu-game-result {
  font-size: clamp(14px,2.4vw,17px);
  font-weight: 700;
  margin-bottom: 0.7em;
}
.edu-game-result--correct { color: #3B6D11; }
.edu-game-result--wrong   { color: #712B13; }

.edu-game-next {
  background: #7F77DD;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0.5em 1.4em;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
.edu-game-next:hover { background: #5c54b8; transform: scale(1.05); }

/* End card */
.edu-game-end {
  background: #fff;
  border-radius: 20px;
  padding: 1.8em 2em;
  text-align: center;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.edu-game-trophy    { font-size: 48px; margin-bottom: 0.2em; }
.edu-game-end-title { font-size: clamp(16px,3vw,22px); font-weight:700; color:#1a3a6e; margin-bottom:0.2em; }
.edu-game-end-score { font-size: 48px; font-weight:800; color:#378ADD; line-height:1; margin-bottom:0.1em; }
.edu-game-end-stars { font-size: 22px; letter-spacing:2px; margin-bottom:0.4em; }
.edu-game-end-msg   { font-size: clamp(12px,2vw,15px); color:#555; margin-bottom:1em; }

.edu-game-again,
.edu-game-watch-again {
  border: none;
  border-radius: 20px;
  padding: 0.55em 1.6em;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
  display: inline-block;
  margin: 0.3em 0.3em 0;
}

.edu-game-again       { background: #27AE60; color: #fff; }
.edu-game-again:hover { background: #1e8449; transform: scale(1.05); }

.edu-game-watch-again       { background: #378ADD; color: #fff; }
.edu-game-watch-again:hover { background: #1a5fa0; transform: scale(1.05); }

/* ── Editor preview (Gutenberg) ──────────────────────────────────────────── */
.edu-anim-editor-preview {
  background: #f0f4ff;
  border-radius: 12px;
  padding: 1.5em;
  text-align: center;
  color: #4a5568;
  font-size: 14px;
}

.edu-anim-editor-preview svg {
  margin-bottom: 0.5em;
  opacity: 0.5;
}

/* ── Responsive tweaks ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .edu-bubble {
    max-width: 55%;
    font-size: 11px;
  }

  .edu-btn {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
}

