/* ==========================================================================
   Games – shared shell for the game pages (builds on landing.css: fonts, colours, .footer)
   Truth-or-lie specific parts are marked; other games add their own stylesheet
   ========================================================================== */

.tol {
  --true: #16a34a;
  --true-soft: #e5f6ea;
  --false: #e1252f;
  --false-soft: #fdecec;
  --gold: #f5b301;
  --ease-out: cubic-bezier(.2, .8, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---------- Header ---------- */

.tol-head {
  position: relative;
  color: #fff;
  background: var(--navy-800) var(--hero-img) center 40% / cover no-repeat;
  isolation: isolate;
}
.tol-head::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(7, 20, 54, .55), rgba(7, 20, 54, .92));
}
.tol-head__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  min-height: 150px;
  padding: 18px var(--gutter) 70px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.tol-head__logo img { width: clamp(78px, 9vw, 104px); height: auto; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .4)); }
.tol-head__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 7px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .25);
  backdrop-filter: blur(4px);
  transition: background .15s;
}
.tol-head__back:hover { background: rgba(255, 255, 255, .22); }
.tol-head__back svg { width: 14px; height: 14px; transform: scaleX(-1); } /* back = right in RTL */

/* ---------- Stage ---------- */

.tol-main {
  position: relative;
  flex: 1;
  width: min(100% - 2 * var(--gutter), 640px);
  margin: -56px auto 40px;
  display: grid;
  align-content: start; /* the card hugs its content; the page (flex) still pushes the footer down */
}
.tol-screen {
  grid-area: 1 / 1;
  padding: clamp(22px, 4vw, 34px);
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(11, 29, 77, .14);
  text-align: center;
  visibility: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.98);
  transition: opacity .35s var(--ease-out), transform .45s var(--ease-out), visibility 0s .45s;
}
/* only the active screen sets the stage height; the others overlay it while fading out */
.tol-screen:not(.is-active) { position: absolute; inset: 0 0 auto; }
.tol [tabindex="-1"]:focus { outline: none; }
.tol-screen.is-active {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity .35s var(--ease-out), transform .45s var(--ease-out), visibility 0s;
}

/* ---------- Start ---------- */

.tol-badge { position: relative; width: 120px; height: 84px; margin: 4px auto 10px; }
.tol-badge__chip {
  position: absolute;
  top: 8px;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 8px 20px rgba(11, 29, 77, .22);
}
.tol-badge__chip svg { width: 32px; height: 32px; }
.tol-badge__chip--true { right: 6px; background: var(--true); animation: bob 3s ease-in-out infinite; }
.tol-badge__chip--false { left: 6px; background: var(--false); border: 4px solid #fff; animation: bob 3s ease-in-out -1.5s infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-6deg); } }

.tol-start__title {
  font-family: var(--font-bold);
  font-weight: 900;
  font-size: clamp(34px, 7vw, 48px);
  line-height: 1.05;
  color: var(--navy-800);
}
.tol-start__sub { margin-top: 8px; font-size: 17px; color: var(--muted); }
.tol-rules {
  display: grid;
  gap: 8px;
  margin: 22px auto 26px;
  max-width: 340px;
  text-align: start;
}
.tol-rules li {
  position: relative;
  padding: 10px 14px;
  padding-inline-start: 30px; /* room for the bullet */
  border-radius: 12px;
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
}
.tol-rules li::before { /* bullet sits outside the text flow, so bold numbers stay inline with the words */
  content: "";
  position: absolute;
  top: 1.05em;
  inset-inline-start: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-500);
}
.tol-tag {
  padding: 1px 9px;
  border-radius: 999px;
  font-family: var(--font-bold);
  font-weight: 800;
  font-size: 13px;
  color: #fff;
}
.tol-tag--true { background: var(--true); }
.tol-tag--false { background: var(--false); }

.tol-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-bold);
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
  box-shadow: 0 8px 22px rgba(37, 99, 235, .4);
  cursor: pointer;
  transition: transform .15s var(--ease-spring), box-shadow .15s;
}
.tol-cta svg { width: 18px; height: 18px; }
.tol-cta:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 12px 28px rgba(37, 99, 235, .45); }
.tol-cta:active { transform: scale(.97); }
.tol-start .tol-cta { animation: pulse-ring 2.4s ease-out infinite; }
@keyframes pulse-ring {
  0% { box-shadow: 0 8px 22px rgba(37, 99, 235, .4), 0 0 0 0 rgba(37, 99, 235, .45); }
  70%, 100% { box-shadow: 0 8px 22px rgba(37, 99, 235, .4), 0 0 0 16px rgba(37, 99, 235, 0); }
}

/* ---------- HUD ---------- */

.tol-hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tol-hud__count { font-size: 15px; color: var(--muted); }
.tol-hud__count strong { font-family: var(--font-bold); font-weight: 800; font-size: 20px; color: var(--navy-800); }
.tol-hud__chips { display: flex; gap: 6px; }
.tol-score, .tol-streak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: var(--font-bold);
  font-weight: 800;
  font-size: 15px;
}
.tol-score { background: #fff7db; color: #a16207; }
.tol-score svg { width: 16px; height: 16px; color: var(--gold); }
.tol-score.is-bump { animation: bump .5s var(--ease-spring); }
@keyframes bump { 40% { transform: scale(1.35); } }
.tol-streak { background: #fff1e6; color: #c2410c; animation: pop-in .4s var(--ease-spring); }
.tol-streak svg { width: 15px; height: 15px; color: #f97316; animation: flicker 1s ease-in-out infinite alternate; }
@keyframes flicker { to { transform: scale(1.15) rotate(-6deg); } }
@keyframes pop-in { from { transform: scale(0); opacity: 0; } }

.tol-progress { display: flex; gap: 5px; margin: 14px 0 18px; }
.tol-progress li {
  flex: 1;
  height: 7px;
  border-radius: 99px;
  background: var(--line);
}
.tol-progress li.is-current { background: color-mix(in srgb, var(--blue-500) 35%, var(--line)); transform: scaleY(1.3); }
.tol-progress li.is-right { background: var(--true); animation: seg-fill .45s var(--ease-spring); }
.tol-progress li.is-wrong { background: var(--false); animation: seg-fill .45s var(--ease-spring); }
@keyframes seg-fill { from { transform: scaleY(2.2); filter: brightness(1.3); } }

/* ---------- Card ---------- */

.tol-card-wrap { perspective: 900px; }
.tol-card {
  position: relative;
  min-height: 210px;
  padding: 26px 22px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 18px;
  background:
    radial-gradient(circle at 15% 120%, rgba(59, 130, 246, .45), transparent 55%),
    linear-gradient(135deg, var(--navy-700), var(--navy-900));
  color: #fff;
  box-shadow: 0 14px 30px rgba(7, 20, 54, .28);
  overflow: hidden;
  transition: box-shadow .3s;
}
.tol-card__label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .6);
}
.tol-card__text {
  margin-top: 10px;
  font-family: var(--font-bold);
  font-weight: 800;
  font-size: clamp(20px, 4.4vw, 26px);
  line-height: 1.35;
  text-wrap: balance;
}
.tol-card.is-enter { animation: card-in .55s var(--ease-out) both; }
.tol-card.is-leave { animation: card-out .3s ease-in both; }
@keyframes card-in { from { opacity: 0; transform: translateX(-40px) rotateY(18deg) scale(.96); } }
@keyframes card-out { to { opacity: 0; transform: translateX(50px) rotateY(-14deg) scale(.96); } }
.tol-card.is-right { box-shadow: 0 0 0 4px var(--true), 0 14px 30px rgba(22, 163, 74, .35); }
.tol-card.is-wrong { box-shadow: 0 0 0 4px var(--false), 0 14px 30px rgba(225, 37, 47, .35); animation: shake .45s ease-in-out; }
@keyframes shake {
  20% { transform: translateX(10px) rotate(1deg); }
  40% { transform: translateX(-8px) rotate(-1deg); }
  60% { transform: translateX(6px); }
  80% { transform: translateX(-3px); }
}

/* Rubber stamp verdict – a nod to the ballot stamp */
.tol-stamp {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px 16px;
  border: 3px solid currentColor;
  border-radius: 10px;
  font-family: var(--font-bold);
  font-weight: 900;
  font-size: 22px;
  line-height: 1;
  background: rgba(255, 255, 255, .95);
  opacity: 0;
  transform: rotate(-14deg) scale(2.2);
  pointer-events: none;
}
.tol-stamp.is-on { animation: stamp .45s var(--ease-spring) forwards; }
.tol-stamp.is-right { color: var(--true); }
.tol-stamp.is-wrong { color: var(--false); }
@keyframes stamp {
  0% { opacity: 0; transform: rotate(-14deg) scale(2.2); }
  60% { opacity: 1; transform: rotate(-10deg) scale(.92); }
  100% { opacity: 1; transform: rotate(-10deg) scale(1); }
}

.tol-reveal {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  text-align: start;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  animation: rise .4s var(--ease-out) .12s both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.tol-reveal__verdict { font-family: var(--font-bold); font-weight: 800; font-size: 18px; }
.tol-reveal__answer { margin-top: 2px; font-size: 14px; color: rgba(255, 255, 255, .8); }
.tol-reveal__answer strong { font-family: var(--font-bold); font-weight: 800; }
.tol-reveal__explain { margin-top: 8px; font-size: 15px; line-height: 1.55; color: rgba(255, 255, 255, .92); }
.tol-reveal__explain:empty { display: none; }
.tol-card.is-right .tol-reveal__verdict { color: #4ade80; }
.tol-card.is-wrong .tol-reveal__verdict { color: #ff8a8f; }

/* ---------- Choices ---------- */

.tol-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.tol-choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 64px;
  border: 0;
  border-radius: 16px;
  font-family: var(--font-bold);
  font-weight: 900;
  font-size: 22px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--shade), 0 10px 18px rgba(11, 29, 77, .18);
  transition: transform .12s, box-shadow .12s, opacity .25s, filter .25s;
}
.tol-choice svg { width: 24px; height: 24px; }
.tol-choice--true { background: var(--true); --shade: #0f7a35; }
.tol-choice--false { background: var(--false); --shade: #a3141c; }
.tol-choice:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 0 var(--shade), 0 14px 22px rgba(11, 29, 77, .22); }
.tol-choice:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--shade), 0 4px 8px rgba(11, 29, 77, .18); }
.tol-choice:disabled { cursor: default; }
.tol-choices.is-answered .tol-choice:not(.is-picked) { opacity: .35; filter: saturate(.4); }
.tol-choice.is-picked { animation: picked .45s var(--ease-spring); }
@keyframes picked { 40% { transform: scale(1.06); } }

.tol-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 26px;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-bold);
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  background: var(--navy-800);
  box-shadow: 0 6px 16px rgba(11, 29, 77, .3);
  cursor: pointer;
  animation: rise .35s var(--ease-out) .25s both;
  transition: transform .15s var(--ease-spring);
}
.tol-next svg { width: 16px; height: 16px; }
.tol-next:hover { transform: translateX(-3px); }

/* ---------- Result ---------- */

.tol-ring { position: relative; width: 170px; height: 170px; margin: 4px auto 14px; }
.tol-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.tol-ring circle { fill: none; stroke-width: 11; stroke-linecap: round; }
.tol-ring__track { stroke: var(--line); }
.tol-ring__bar {
  stroke: var(--ring, var(--blue-500));
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1.4s var(--ease-out) .2s;
}
.tol-ring__value {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  line-height: 1;
}
.tol-ring__value strong { font-family: var(--font-bold); font-weight: 900; font-size: 54px; color: var(--navy-800); }
.tol-ring__value span { margin-top: 4px; font-size: 15px; color: var(--muted); }
.tol-result.is-active .tol-ring { animation: pop-in .6s var(--ease-spring); }

.tol-result__title {
  font-family: var(--font-bold);
  font-weight: 900;
  font-size: clamp(26px, 5vw, 32px);
  color: var(--navy-800);
}
.tol-result__sub { margin-top: 6px; font-size: 16px; color: var(--muted); }
.tol-result__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 18px;
  margin: 24px 0 8px;
}
.tol-ghost { font-weight: 500; color: var(--blue-600); text-decoration: underline; text-underline-offset: 3px; }

.tol-review { margin-top: 18px; text-align: start; }
.tol-review summary {
  cursor: pointer;
  width: max-content;
  margin: 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--blue-600);
  background: var(--blue-100);
}
.tol-review ol { display: grid; gap: 8px; margin-top: 14px; }
.tol-review li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}
.tol-review__mark {
  grid-row: span 2;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
}
.tol-review__mark svg { width: 14px; height: 14px; }
.tol-review li.is-right .tol-review__mark { background: var(--true); }
.tol-review li.is-wrong .tol-review__mark { background: var(--false); }
.tol-review__meta { font-size: 13px; color: var(--muted); }
.tol-review__meta strong { color: var(--ink); }

.tol-confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }

/* ---------- Mobile ---------- */

@media (max-width: 700px) {
  .tol-head__inner { min-height: 120px; padding-bottom: 62px; }
  .tol-main { margin-top: -50px; }
  .tol-card { min-height: 190px; padding: 22px 18px 20px; }
  .tol-stamp { font-size: 18px; top: 10px; left: 10px; }
  .tol-choice { min-height: 58px; font-size: 20px; }
}

/* ---------- Auto-advancing "next" button (candidates + letters games); the bar shows the countdown ---------- */

.cq-next {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 18px auto 0;
  padding: 12px 26px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-bold);
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  background: var(--navy-800);
  box-shadow: 0 6px 16px rgba(11, 29, 77, .3);
  cursor: pointer;
  animation: rise .3s var(--ease-out) both;
}
.cq-play { text-align: center; }
.cq-next svg { width: 16px; height: 16px; }
.cq-next__timer {
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: rgba(255, 255, 255, .5);
  transform-origin: right;
  animation: timer var(--advance, 2.2s) linear forwards;
}
@keyframes timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

