/* Simos Camp — Sex-Ed Quiz Show (js/minigames/sexEdQuiz.js). Prefix mgq-. Owner: quiz.
 * A bright TV quiz-show set: the canvas draws the stage (curtains, spotlights, marquee bulbs, podiums, host); the DOM
 * on top holds the question "screen", the answer buttons, the explanation sheet and the intro / hand-off / result cards.
 * The show keeps its own colours in light and dark mode (it is a stage set, like the other mini-game scenes).
 */
.mgq-root {
  position: absolute; inset: 0; overflow: hidden; font-family: var(--font); color: #fff;
  --stage-h: min(30%, 250px); --gold: #ffd24d; --gold-dark: #d9981a; --plum: #3b2352; --card: #fffaf0;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
@media (max-width: 560px), (max-height: 520px) { .mgq-root { --stage-h: min(24%, 190px); } }
.mgq-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mgq-root button { pointer-events: auto; font-family: var(--font); }

/* ------------------------------------------------------------------ layout */
.mgq-layout {
  position: absolute; inset: 0; margin: 0 auto; max-width: 980px; display: flex; flex-direction: column; gap: 8px;
  padding: calc(var(--safe-top) + 62px) 12px calc(var(--safe-bottom) + 12px); pointer-events: none;
}
.mgq-top { display: flex; align-items: center; gap: 10px; min-height: 30px; flex: none; }
.mgq-progress { display: flex; gap: 6px; flex: 1 1 auto; flex-wrap: wrap; }
.mgq-dot {
  width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, .22); border: 2px solid rgba(255, 255, 255, .5);
  transition: background .25s, transform .25s var(--ease-spring);
}
.mgq-dot.cur { background: var(--gold); border-color: #fff; transform: scale(1.25); animation: mgq-pulse 1s ease-in-out infinite; }
.mgq-dot.ok { background: #43c46b; border-color: #c9f7d6; }
.mgq-dot.no { background: #ff8a8a; border-color: #ffd6d6; }
.mgq-roundlbl { font-weight: 600; font-size: 14px; white-space: nowrap; text-shadow: 0 2px 0 rgba(40, 10, 60, .55); }
.mgq-timer {
  --p: 360deg; display: none; position: relative; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--gold) var(--p), rgba(255, 255, 255, .18) 0); box-shadow: 0 0 0 2px rgba(255, 255, 255, .6);
}
.mgq-timer b {
  position: absolute; inset: 5px; border-radius: 50%; background: var(--plum); display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: #fff;
}
.mgq-timed .mgq-timer { display: block; }
.mgq-timer.mgq-hurry { background: conic-gradient(#ff6b6b var(--p), rgba(255, 255, 255, .18) 0); animation: mgq-shake .5s ease-in-out infinite; }

/* the question "screen" */
.mgq-qcard {
  flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px 14px; border-radius: 22px;
  background: radial-gradient(ellipse at 30% 0%, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 60%), linear-gradient(180deg, #2c2a8c 0%, #241a6a 100%);
  border: 4px solid var(--gold); box-shadow: 0 0 0 3px rgba(255, 210, 77, .28), 0 0 26px rgba(255, 210, 77, .45), 0 6px 0 #16104a;
  pointer-events: auto; position: relative;
}
.mgq-qcard::before {
  content: ''; position: absolute; inset: 4px; border-radius: 16px; pointer-events: none;
  background-image: radial-gradient(circle, rgba(255, 243, 176, .9) 0 2px, transparent 2.6px); background-size: 18px 18px;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% 5px no-repeat, linear-gradient(#000 0 0) bottom / 100% 5px no-repeat;
  mask: linear-gradient(#000 0 0) top / 100% 5px no-repeat, linear-gradient(#000 0 0) bottom / 100% 5px no-repeat; opacity: .6;
}
.mgq-qcard.mgq-in { animation: mgq-drop .45s var(--ease-spring); }
.mgq-hostface { box-shadow: 0 0 0 3px var(--gold), 0 3px 0 rgba(0, 0, 0, .25); align-self: flex-start; }
.mgq-qbody { flex: 1 1 auto; min-width: 0; }
.mgq-topic {
  --tc: #ffd24d; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; font-size: 13px; font-weight: 600;
}
.mgq-topic > span:first-child { background: var(--tc); color: var(--plum); padding: 2px 10px; border-radius: 99px; box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.mgq-kind { color: #ffe9a8; opacity: .95; }
.mgq-qtext { font-size: clamp(17px, 2.6vw + 9px, 24px); line-height: 1.25; font-weight: 600; text-shadow: 0 2px 0 rgba(10, 5, 40, .6); overflow-wrap: anywhere; }

/* the podium area (drawn on the canvas) */
.mgq-stage { flex: 1 1 auto; min-height: 118px; position: relative; }
.mgq-turn {
  position: absolute; left: 50%; top: 2px; transform: translate(-50%, -6px); display: flex; align-items: center; gap: 6px;
  padding: 3px 12px 3px 4px; border-radius: 99px; background: rgba(255, 250, 240, .95); color: var(--plum); font-weight: 700; font-size: 14px;
  box-shadow: 0 3px 0 rgba(40, 10, 60, .35); opacity: 0; transition: opacity .2s, transform .25s var(--ease-spring); white-space: nowrap;
}
.mgq-turn:not(:has(.mgq-face)) { padding-left: 12px; }
.mgq-turn.on { opacity: 1; transform: translate(-50%, 0); }

/* answers */
.mgq-answrap { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mgq-answers { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mgq-ans {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px 8px 8px; border-radius: 18px;
  border: 3px solid rgba(255, 255, 255, .85); color: #fff; text-align: left; font: 600 16px/1.2 var(--font); cursor: pointer;
  text-shadow: 0 2px 0 rgba(40, 10, 60, .45); box-shadow: 0 5px 0 var(--sh, #7a2a3a), 0 8px 18px rgba(20, 5, 40, .35);
  transition: transform .12s var(--ease-spring), box-shadow .12s, filter .2s, opacity .25s;
}
.mgq-ans:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--sh, #7a2a3a); }
.mgq-ans:disabled { cursor: default; }
.mgq-c0 { background: linear-gradient(180deg, #ff8f8f, #ff5f6d); --sh: #b33047; }
.mgq-c1 { background: linear-gradient(180deg, #5fe0dd, #1fb3bf); --sh: #117488; }
.mgq-c2 { background: linear-gradient(180deg, #ffe07a, #ffbf2e); --sh: #b8820f; color: #4a2a05; text-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
.mgq-c3 { background: linear-gradient(180deg, #c7b3ff, #9270f5); --sh: #5e3fb8; }
.mgq-letter {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--plum);
  font-size: 17px; font-weight: 700; text-shadow: none; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12);
}
.mgq-atext { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.mgq-pickers { display: flex; gap: 2px; flex: none; }
.mgq-pickers .mgq-face { box-shadow: 0 0 0 2px #fff; }
.mgq-you { font-size: 20px; font-weight: 700; }
.mgq-ans.mgq-picked { transform: scale(1.03); box-shadow: 0 0 0 4px #fff, 0 0 22px rgba(255, 255, 255, .9), 0 5px 0 var(--sh, #7a2a3a); }
.mgq-ans.mgq-dim { opacity: .45; filter: saturate(.55); }
.mgq-ans.mgq-dim.mgq-wrong { opacity: .8; filter: none; border-color: #ffd6d6; }
.mgq-ans.mgq-right { border-color: #eaffef; box-shadow: 0 0 0 4px #43c46b, 0 0 26px rgba(90, 255, 140, .8), 0 5px 0 #237a3e; animation: mgq-pop .5s var(--ease-spring); }
.mgq-ans.mgq-right::after {
  content: '✓'; position: absolute; right: -8px; top: -10px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: #43c46b; color: #fff; font-weight: 700; border: 3px solid #fff; text-shadow: none; box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}
.mgq-notsure.sc-btn { min-height: 34px; font-size: 14px; }
.mgq-root:not(.mgq-ph-turn) .mgq-notsure { visibility: hidden; }

/* the phases: intro & result show a card above the podiums; hand-off covers everything */
.mgq-ph-intro .mgq-layout > :not(.mgq-stage), .mgq-ph-result .mgq-layout > :not(.mgq-stage) { display: none; }
.mgq-ph-intro .mgq-stage, .mgq-ph-result .mgq-stage { flex: 0 0 var(--stage-h); margin-top: auto; }

/* ------------------------------------------------------------------ explanation sheet */
.mgq-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; justify-content: center; pointer-events: none;
  padding: 0 10px calc(var(--safe-bottom) + 10px); transform: translateY(115%); transition: transform .38s var(--ease-spring);
}
.mgq-sheet.on { transform: none; }
.mgq-sheetin {
  pointer-events: auto; width: min(660px, 100%); max-height: 62vh; overflow-y: auto; padding: 14px 16px 12px; border-radius: 22px;
  background: var(--card); color: var(--plum); border: 4px solid var(--gold); box-shadow: 0 -4px 30px rgba(20, 5, 40, .45), 0 6px 0 var(--gold-dark);
}
.mgq-verdict { display: flex; align-items: center; gap: 8px; font-size: 21px; font-weight: 700; margin-bottom: 6px; }
.mgq-verdict b { font-size: 26px; }
.mgq-verdict.ok { color: #1f8a45; }
.mgq-verdict.no, .mgq-verdict.learn { color: #7a3fb8; }
.mgq-bonus { font-size: 13px; font-weight: 700; color: #fff; background: #ff9f43; padding: 2px 8px; border-radius: 99px; }
.mgq-answerline {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 14px; background: #e3f8e9; color: #1f5a33;
  font-weight: 600; font-size: 15px; margin-bottom: 8px;
}
.mgq-tick { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #43c46b; color: #fff; display: grid; place-items: center; font-size: 13px; }
.mgq-ex { font-size: 16px; line-height: 1.4; }
.mgq-results { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mgq-res { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px 2px 3px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.mgq-res.ok { background: #dff6e6; color: #226b3a; }
.mgq-res.no { background: #f1eafc; color: #6a4a8c; }

/* ------------------------------------------------------------------ overlay cards (intro / hand-off / result) */
.mgq-overlay {
  position: absolute; left: 0; right: 0; top: calc(var(--safe-top) + 60px); bottom: 0; z-index: 20; display: none; overflow-y: auto;
  padding: 4px 12px 12px; pointer-events: none;
}
.mgq-overlay.on { display: flex; }
.mgq-ph-intro .mgq-overlay, .mgq-ph-result .mgq-overlay { bottom: var(--stage-h); }
.mgq-ph-handoff .mgq-overlay { top: 0; padding-top: calc(var(--safe-top) + 60px); background: rgba(24, 8, 48, .78); pointer-events: auto; }
.mgq-card {
  margin: auto; pointer-events: auto; width: min(560px, 100%); padding: 16px 18px; border-radius: 26px; background: var(--card); color: var(--plum);
  border: 4px solid var(--gold); box-shadow: 0 0 0 4px rgba(255, 210, 77, .3), 0 10px 0 var(--gold-dark), 0 18px 40px rgba(10, 0, 30, .5);
  display: flex; flex-direction: column; gap: 12px; animation: mgq-drop .45s var(--ease-spring);
}
.mgq-logo { display: flex; align-items: center; gap: 12px; }
.mgq-logoicon {
  flex: none; width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; font-size: 32px;
  background: linear-gradient(180deg, #ff8db3, #a58bff); box-shadow: 0 4px 0 #6a3fb0; animation: mgq-wobble 3s ease-in-out infinite;
}
.mgq-title { font-size: 23px; font-weight: 700; line-height: 1.15; }
.mgq-sub { font-size: 15px; color: #6a4a8c; }
.mgq-sub b { color: var(--plum); }
.mgq-sect { display: flex; flex-direction: column; gap: 6px; }
.mgq-lbl { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #9a6fd0; }
.mgq-mini { font-size: 13px; color: #7a6590; }
.mgq-note { font-size: 13px; line-height: 1.35; color: #6a4a8c; background: #f6effe; padding: 8px 10px; border-radius: 12px; }
.mgq-btnrow { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.mgq-btnrow .sc-btn { min-width: 150px; }
.mgq-faces { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.mgq-who { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 13px; font-weight: 600; }
.mgq-wname { max-width: 84px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgq-x {
  position: absolute; top: -4px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; padding: 0;
  background: #ff7a7a; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}
.mgq-cands { display: flex; flex-direction: column; gap: 4px; }
.mgq-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mgq-chip.sc-chip {
  cursor: pointer; background: #f3ecff; color: var(--plum); border: 2px solid #d7c6f5; font: 600 14px/1.1 var(--font); padding: 6px 11px;
  min-height: 34px; border-radius: 99px; box-shadow: 0 2px 0 #d7c6f5;
}
.mgq-chip.sc-chip.on { background: linear-gradient(180deg, #b39cff, #8f6cf0); color: #fff; border-color: #6a4ad0; box-shadow: 0 2px 0 #5e3fb8; }
.mgq-hot.sc-btn { align-self: flex-start; }
.mgq-face {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; background: #bfeff0;
  box-shadow: 0 0 0 2px #fff, 0 2px 0 rgba(0, 0, 0, .15); vertical-align: middle;
}
.mgq-face canvas { width: 100%; height: 100%; display: block; }
.mgq-face b { color: var(--plum); font-size: 60%; }

.mgq-handoff { align-items: center; text-align: center; width: min(420px, 100%); }
.mgq-handoff .mgq-face { box-shadow: 0 0 0 4px var(--gold), 0 4px 0 rgba(0, 0, 0, .2); animation: mgq-wobble 2.4s ease-in-out infinite; }

.mgq-result { align-items: stretch; text-align: center; }
.mgq-trophy { font-size: 54px; line-height: 1; animation: mgq-bounce 1.2s var(--ease-spring) infinite alternate; }
.mgq-rank { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.mgq-row { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 8px; border-radius: 16px; background: #f6effe; }
.mgq-row.mgq-top1 { background: linear-gradient(90deg, #fff1b8, #ffe07a); box-shadow: 0 0 0 2px var(--gold); }
.mgq-row.mgq-mine .mgq-rname { text-decoration: underline; text-decoration-color: #b39cff; text-underline-offset: 3px; }
.mgq-place { width: 24px; text-align: center; font-weight: 700; font-size: 17px; }
.mgq-rname { flex: 1 1 auto; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgq-rcorrect { font-size: 13px; color: #6a4a8c; white-space: nowrap; }
.mgq-rscore { font-size: 19px; min-width: 48px; text-align: right; }
.mgq-points {
  align-self: center; font-weight: 700; color: #1f8a45; background: #dff6e6; padding: 6px 14px; border-radius: 99px;
  animation: mgq-pop .6s var(--ease-spring) .3s both;
}
.mgq-missed { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.mgq-tag { --tc: #ffd24d; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--tc); color: var(--plum); }

/* ------------------------------------------------------------------ small screens */
@media (max-width: 560px) {
  .mgq-answers { grid-template-columns: 1fr; gap: 8px; }
  .mgq-answers.mgq-tf { grid-template-columns: 1fr 1fr; }
  .mgq-ans { min-height: 50px; font-size: 15px; border-radius: 16px; }
  .mgq-letter { width: 30px; height: 30px; font-size: 15px; }
  .mgq-qcard { padding: 10px 12px 12px; gap: 10px; }
  .mgq-hostface { width: 42px !important; height: 42px !important; }
  .mgq-title { font-size: 20px; }
  .mgq-card { padding: 14px; gap: 10px; }
  .mgq-dot { width: 12px; height: 12px; }
}
@media (max-height: 640px) and (min-width: 561px) {
  .mgq-ans { min-height: 46px; }
  .mgq-qtext { font-size: 18px; }
}
.mgq-answers.mgq-tf .mgq-ans { justify-content: center; min-height: 62px; font-size: 18px; }
.mgq-answers.mgq-tf .mgq-atext { flex: 0 1 auto; }

/* ------------------------------------------------------------------ animations */
@keyframes mgq-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 77, .7); } 50% { box-shadow: 0 0 0 6px rgba(255, 210, 77, 0); } }
@keyframes mgq-drop { from { transform: translateY(-18px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes mgq-pop { 0% { transform: scale(.85); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes mgq-shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
@keyframes mgq-wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes mgq-bounce { from { transform: translateY(0) scale(1); } to { transform: translateY(-8px) scale(1.06); } }
@media (prefers-reduced-motion: reduce) {
  .mgq-root *, .mgq-root *::before, .mgq-root *::after { animation: none !important; transition: none !important; }
}
