/* ============================================================
   MOBILE GATE  — projection-first interception overlay
   Shown on viewports < 900 px when a projection-only game
   is active. Replaces game content with a polished screen
   that explains the game needs a classroom display.
   ============================================================ */

#mobile-gate {
  position: fixed;
  inset: 0;
  z-index: 2147482500;
  background-color: #fbf6e9;
  background-image:
    repeating-linear-gradient(2deg, rgba(115, 91, 59, .018) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(91deg, rgba(255,255,255,.15) 0 1px, transparent 1px 11px),
    radial-gradient(ellipse at 16% 19%, rgba(230, 174, 47, .055) 0 1px, transparent 1.7px),
    radial-gradient(ellipse at 78% 67%, rgba(91, 70, 43, .04) 0 .8px, transparent 1.5px),
    linear-gradient(105deg, rgba(255,255,255,.08), transparent 38%, rgba(126,98,62,.025));
  background-size: auto, auto, 23px 21px, 31px 29px, 100% 100%;
  background-repeat: repeat, repeat, repeat, repeat, no-repeat;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 32px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

html[data-mobile-gated],
body[data-mobile-gated] {
  overflow: hidden !important;
  height: 100%;
}

.mg-card {
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  padding: 36px 28px 32px;
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
}

.mg-logo-wrap {
  margin-bottom: 20px;
}

.mg-logo {
  width: 100px;
  height: auto;
  object-fit: contain;
  display: block;
}

.mg-logo-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  background: #e5e7eb;
}

.mg-icon-wrap {
  margin-bottom: 16px;
}

.mg-projection-icon {
  width: 48px;
  height: 48px;
  color: #94a3b8;
}

.mg-heading {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 12px;
  line-height: 1.2;
}

.mg-body {
  font-size: 15px;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 24px;
}

.mg-body strong {
  color: #0f172a;
  font-weight: 700;
}

.mg-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-bottom: 16px;
}

.mg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  width: 100%;
}

.mg-btn:active {
  transform: scale(0.97);
}

.mg-btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Media preview buttons (screenshots / video) */
.mg-media-btns {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.mg-btn--media {
  flex: 1;
  background: #f1f5f9;
  color: #334155;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 12px;
  border-radius: 12px;
}

.mg-btn--media:hover {
  background: #e2e8f0;
}

/* Coming-soon placeholder (shown when no screenshots/video yet) */
.mg-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 20px;
  color: #94a3b8;
}

.mg-coming-soon svg {
  width: 48px;
  height: 48px;
}

.mg-coming-soon p {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

/* ── Media overlay (lightbox + video modal) ── */

#mg-media-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.mg-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.mg-overlay-panel {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mg-overlay-panel--video {
  max-width: 560px;
}

.mg-overlay-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  padding: 0;
}

.mg-overlay-close svg {
  width: 16px;
  height: 16px;
}

.mg-overlay-close:hover {
  background: #e2e8f0;
}

.mg-overlay-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  padding-right: 36px;
}

/* Lightbox */
.mg-lightbox {
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mg-lightbox-img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 55vh;
  object-fit: contain;
}

.mg-lightbox-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.mg-nav-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #f1f5f9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #334155;
  padding: 0;
}

.mg-nav-btn svg {
  width: 18px;
  height: 18px;
}

.mg-nav-btn:hover:not(:disabled) {
  background: #e2e8f0;
}

.mg-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.mg-nav-count {
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  min-width: 40px;
  text-align: center;
}

/* ============================================================ */

.pill{
  border: 0;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  padding: 10px 16px;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}
.pill[aria-pressed="true"]{ background: color-mix(in srgb, var(--team-bg) 22%, white 78%); }
.pill-ghost{ background:#e5e7eb; color:#111827; box-shadow:none; }

.game-instructions{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-instructions-section{
  background: #f8fafc;
  border: 1px solid rgba(148,163,184,0.32);
  border-radius: 12px;
  padding: 13px 15px;
}

.game-instructions-section h3{
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(15,23,42,0.58);
}

.game-instructions-section ul{
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.game-instructions-section li,
.game-instructions-section p{
  font-size: 15px;
  font-weight: 700;
  line-height: 1.48;
  color: rgba(15,23,42,0.86);
}

.game-instructions-section p{
  margin: 0;
}

.btn-row{ display:flex; gap: 12px; }
.btn-row > button{ flex: 1 1 0; }

/* --------------------------------------------------
   MIXED LEVELS: per-team CEFR-range chips
   -------------------------------------------------- */
.team-levels{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

/* Squares in play: vertical A/B/C dock directly to the left of each logo.
   We overlay it inside the existing team card without changing the
   score/logo grid layout. */
#layout[data-route="play"][data-game="squares"] #teams .team .team-levels--squares-play{
  position: absolute;
  /* team cards are relatively positioned in squares.css */
  left: 18px;
  top: 68%;
  transform: translateY(-50%);

  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 0;
  z-index: 5;
}

#layout[data-route="play"][data-game="squares"] #teams .team .team-levels--squares-play .team-level-chip{
  width: 54px;
  height: 30px;
  font-size: 10px;
}

.team-level-chip{
  width: 62px;
  height: 34px;
  border-radius: 12px;
  border: 0;
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(15,23,42,0.10);

  position: relative;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease, color 120ms ease;
}

/* Selected state: solid blue pill with white letter (no check badge) */
.team-level-chip.is-active{
  background: #2563eb;
  color: #ffffff;
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 14px 26px rgba(37,99,235,0.40);
}

.team-level-chip:disabled{
  opacity: 0.25;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-white{
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: #ffffff;
  color:#111827;
  font-weight: 900;
  cursor:pointer;
}

.btn-white.is-active{
  box-shadow: inset 0 0 0 2px #111827;
}


.btn-primary{
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: #e5e7eb;
  color:#0f172a;
  font-weight: 900;
  cursor:pointer;
}
.btn-secondary{
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: #111827;
  color:#fff;
  font-weight: 900;
  cursor:pointer;
}

.btn-row{ display:flex; gap: 12px; }
.btn-row > button{ flex: 1 1 0; }

.btn-white{
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: #ffffff;
  color:#111827;
  font-weight: 900;
  cursor:pointer;
}

.btn-white.is-active{
  box-shadow: inset 0 0 0 2px #111827;
}


.panel-section{ display:flex; flex-direction:column; gap: 12px; }
.section-title{ font-size: 13px; letter-spacing: 0.12em; font-weight: 900; color: var(--muted); }

/* Sidebar: segmented game control (clean) */
#sidebar #game-picker{
  background:#f1f5f9;
  border-radius: 999px;
  padding: 6px;
  gap: 0;
}

#sidebar #game-picker .game-btn{
  border-radius: 999px;
  padding: 10px 12px;
  flex-direction: row;
  justify-content: center;
}

#sidebar #game-picker .game-icon{ display:none; }

#sidebar #game-picker .game-label{
  font-size: 13px;
  letter-spacing: 0.02em;
}

#sidebar #game-picker .game-btn[aria-selected="true"]{
  background:#111827;
}

#sidebar #game-picker .game-btn[aria-selected="true"] .game-label{
  color:#fff;
}
/* Level row: keep tight */
#sidebar #level-picker{
  flex-wrap: nowrap;
  overflow: hidden;
}

.game-picker{ display:flex; gap: 10px; align-items:center; }
.game-btn{
  flex: 1 1 0;
  border: 0;
  background: transparent;
  padding: 0;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap: 8px;
  align-items:center;
}
.game-icon{
  width: 76px;
  height: 58px;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  border: 2px solid rgba(0,0,0,0.06);
}
.game-icon[data-icon="squares"]{ background: linear-gradient(#ffd84a, var(--sq-yellow)); }
.game-icon[data-icon="columns"]{ background: linear-gradient(#6aa6ff, #2563eb); }
.game-icon[data-icon="bandit"]{ background: linear-gradient(#f3f4f6, #e5e7eb); position: relative; }
.game-icon[data-icon="bandit"]::after{
  content: "🥷";
  position:absolute; inset:0; display:grid; place-items:center; font-size: 34px;
}
.game-label{ font-weight: 900; font-size: 13px; color: #0f172a; }
.game-btn[aria-selected="true"] .game-icon{ outline: 4px solid var(--sel-outline); border-color: var(--sel-border); }

.chip-row{ display:flex; flex-wrap:wrap; gap: 10px; }
.chip{
  width: 42px; height: 42px;
  border-radius: 14px;
  border: 0;
  background: #f1f5f9;
  color: #111827;
  font-weight: 900;
  cursor:pointer;
  box-shadow: 0 8px 16px rgba(15,23,42,0.06);
}
.chip.is-active{ outline: 4px solid var(--sel-outline); }
.chip[disabled]{ cursor:not-allowed; filter: grayscale(0.25); }
.chip-dark{ width:auto; padding:0 12px; background:#111827; color:#fff; }

.toggle-row{ display:flex; align-items:center; gap: 10px; font-weight: 900; color:#111827; }
.toggle-row input{ width: 46px; height: 26px; accent-color: #22c55e; }

.selected-list, .results-list{ display:flex; flex-direction:column; gap: 10px; }
.sel-chip{
  display:flex; align-items:center; justify-content:space-between;
  gap: 10px; padding: 10px 12px;
  border-radius: 14px; background: #fff;
  border: 1px solid rgba(148,163,184,0.25);
  box-shadow: 0 10px 20px rgba(15,23,42,0.06);
}
.sel-left{ display:flex; align-items:center; gap: 10px; min-width: 0; }
.sel-x{
  width: 34px; height: 34px; border-radius: 12px; border: 0;
  background:#f1f5f9; cursor:pointer; font-weight:900;
}
.sel-title{ font-weight: 900; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.search-wrap input{
  width: 100%; border: 0; background: #f1f5f9;
  border-radius: 999px; padding: 14px 16px; outline: none;
  box-shadow: 0 8px 16px rgba(15,23,42,0.06);
}
.level-pill{
  background: var(--sq-yellow); color: #111827;
  border-radius: 999px; padding: 6px 10px;
  font-weight: 900; font-size: 12px; white-space: nowrap;
}


/* SCORE BURST + DELTA FLOAT-UP */
.score-fx {
  position: absolute;
  top: 70px; /* centered over score badge */
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  font-weight: 900;
  font-size: 48px;
  opacity: 0;
}

.score-fx.show {
  animation: fx-pop 0.8s ease-out forwards;
}

@keyframes fx-pop {
  0%   { opacity: 0; transform: translate(-50%, 20px) scale(0.6); }
  40%  { opacity: 1; transform: translate(-50%, -10px) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -40px) scale(0.8); }
}


#layout[data-route="play"][data-game="squares"] #teams .team > *,
#layout[data-route="play"][data-game="columns"] #teams .team > *{
  position: relative;
  z-index: 2;
}

/* Setup: team preview (same PNG + colors as play mode, no scores) */
.team-preview{
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.team-preview-item{
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(15,23,42,0.18);
  overflow: hidden;
}

/* PNG inside the color box */
.team-preview-item .token-img{
  width: 80%;
  height: 80%;
  object-fit: contain;
  display: block;
}

#catalog{
  flex: 1 1 auto; min-height: 0;
  background-color: var(--bg-panel);
  background-image: var(--bg-panel-img);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  border-radius: 26px;
  box-shadow: var(--shadow-card);
  padding: 18px;
}
.catalog-grid{
  display:grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.cat-card{
  border-radius: 14px; border: 1px solid rgba(148,163,184,0.28);
  box-shadow: 0 10px 20px rgba(15,23,42,0.06);
  padding: 12px 12px;
  display:flex; align-items:flex-start; justify-content:space-between;
  gap: 12px; background:#fff; cursor:pointer;
}
.cat-card.is-selected{ background:#e5e7eb; }

.modal-backdrop{ position: fixed; inset: 0; background: rgba(15,23,42,0.58); z-index: 10000; }
.modal{ position: fixed; inset: 0; display:grid; place-items:center; z-index: 10001; padding: 22px; }
.modal-card{
  width: min(980px, 96vw);
  max-height: min(90vh, 720px);
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.28);
  padding: 38px 42px 26px;
  position: relative;
  overflow-y: auto;
}

/* Extra right padding so question text never overlaps the rival vote stack
   (Squares/Columns only — Bandit never renders a vote stack, see modal.js
   renderVoteStack gating, so it should keep symmetric padding) */
#question-modal[data-game="squares"] .modal-card,
#question-modal[data-game="columns"] .modal-card{ padding-right: 220px; }

/* Rival betting stack: arrange opponents in columns up to 4 logos tall,
   then start a new column to the left (overall grid anchored to the right). */
.vote-stack{
  position: absolute;
  top: 34px;
  right: 22px;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(4, minmax(0, auto));
  column-gap: 12px;
  row-gap: 12px;
  z-index: 2;
}

.vote-team{
  width: 74px;
  height: 74px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
}

.vote-token{
  width: 74px;
  height: 74px;
  border-radius: 18px;
  /* Remove the pale square background and shadow; show only the team logo PNG. */
  background: transparent;
  box-shadow: none;
  display: grid;
  place-items: center;
  overflow: visible;
}

.vote-token .token-img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.vote-mark{
  position: absolute;
  /* Pin the thumb icon snugly to the bottom-right corner of the logo area. */
  right: 0;
  bottom: 0;
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.25));
}


/* Down-voted teams no longer get an extra square highlight; rely solely on
   the thumb-down icon to show the bet. */
.vote-team.is-down .vote-token{
  box-shadow: none;
}

.q-text{
  font-family: "Baloo 2", "Nunito", system-ui, sans-serif;
  font-weight: 900; font-size: 58px; line-height: 1.06;
  text-align:center; color: #0b1220;
}
.q-choices{
  margin-top: 8px; text-align:center;
  font-family: "Baloo 2", "Nunito", system-ui, sans-serif;
  font-weight: 900; font-size: 44px; color: #2563eb;
}
.q-answer{
  margin-top: 10px; text-align:center;
  font-family: "Baloo 2", "Nunito", system-ui, sans-serif;
  font-weight: 900; font-size: 46px; color: #108bff;
}

/* ===== Squares modal: tighter layout, smaller type, bottom-left brief category ===== */

#question-modal[data-game="squares"] .modal-card{
  padding-top: 32px;
  padding-bottom: 30px;
}

/* Question / answer slightly smaller than global defaults */
#question-modal[data-game="squares"] .q-text{
  max-width: 100%;
  margin: 10px auto 14px;
  font-size: clamp (34px, 5.6vw, 34px);
  line-height: 1.06;
  margin-top: 6px;
  margin-bottom: 34px;
  text-wrap: balance;
}

#question-modal[data-game="squares"] .q-answer{
  font-size: 34px;
}

/* Brief category bottom-left */
#question-modal[data-game="squares"] .q-meta{
  position: absolute;
  left: 24px;
  bottom: 18px;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 900;
  font-size: 30px;
  color: #23262E;
  opacity: 0.94;
  pointer-events: none;
}

/* Choices area centered, vertical stack (Squares + Columns) */
#question-modal[data-game="squares"] .q-choices,
#question-modal[data-game="columns"] .q-choices,
#question-modal[data-game="bandit"] .q-choices{
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;          /* wrap to next line */
  justify-content: center;  /* center rows */
  align-items: center;
  gap: 10px;
}


/* Option buttons: smaller text, less padding, thinner dotted line */
#question-modal[data-game="squares"] .choice-btn,
#question-modal[data-game="columns"] .choice-btn,
#question-modal[data-game="bandit"] .choice-btn{
  position: relative;
  border-radius: 999px;
  padding: 6px 16px;          /* less padding */
  min-width: 260px;
  max-width: 90%;
  background: #ffffff;
  color: #2563eb;
  font-family: "Baloo 2", "Nunito", system-ui, sans-serif;
  font-weight: 900;
  font-size: 28px;            /* a bit smaller than before */
  line-height: 1.02;
  border: 1px dashed #2563eb; /* thinner dotted border */
  box-shadow: 0 10px 22px rgba(15,23,42,0.12);
  cursor: pointer;
  text-align: center;
  transform: translateY(0);
  transition:
    transform 100ms ease,
    box-shadow 100ms ease,
    background-color 100ms ease,
    border-color 100ms ease,
    color 100ms ease;
}

/* Hover jiggle */
@keyframes squaresChoiceJiggle{
}

/* Custom content (user questions) modal */
.custom-content-modal{
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: min(70vh, 520px);
  overflow: auto;
}

.custom-content-intro{
  font-size: 18px;
  font-weight: 800;
  color: #0b1220;
}

.custom-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
}

.custom-field-name{
  flex: 1 1 220px;
}

.custom-field-name input{
  width: 100%;
  border-radius: 999px;
  border: 1px solid #cbd5f5;
  padding: 8px 12px;
  font-size: 14px;
}

.custom-level-picker{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-level-picker .level-chip{
  font-size: 13px;
  padding: 6px 10px;
}

.custom-content-list{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custom-q{
  background: #f8fafc;
  border-radius: 18px;
  padding: 12px 14px 10px;
  box-shadow: 0 8px 18px rgba(15,23,42,0.08);
}

.custom-q-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.custom-q-number{
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0b1220;
}

.custom-field-question{
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.custom-label{
  font-weight: 900;
  font-size: 14px;
  color: #0b1220;
}

.custom-field-question textarea{
  width: 100%;
  min-height: 52px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid #cbd5f5;
  padding: 8px 10px;
  font-size: 14px;
}

.custom-options{
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.custom-option-row{
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-option-label{
  width: 22px;
  text-align: center;
  font-weight: 900;
  color: #0b1220;
  cursor: pointer;
}

.custom-option-toggle{
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.custom-option-toggle img{
  width: 26px;
  height: 26px;
  display: block;
}

.custom-option-input{
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid #cbd5f5;
  padding: 6px 9px;
  font-size: 14px;
}

.custom-add-option{
  margin-top: 4px;
  padding: 6px 10px;
  font-size: 13px;
}

.custom-content-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.custom-content-count{
  font-size: 13px;
  font-weight: 800;
  color: #4b5563;
}

.custom-content-links{
  font-size: 14px;
}

.custom-content-links a{
  color: #2563eb;
  font-weight: 900;
}

.custom-content-submit[disabled]{
  opacity: 0.6;
  cursor: not-allowed;
}

@keyframes squaresChoiceJiggle{
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-2px); }
}

#question-modal[data-game="squares"] .choice-btn:hover,
#question-modal[data-game="columns"] .choice-btn:hover,
#question-modal[data-game="bandit"] .choice-btn:hover{
  animation: squaresChoiceJiggle 0.16s ease-in-out;
  box-shadow: 0 16px 32px rgba(15,23,42,0.20);
}

/* Locked state: dim others */
#question-modal[data-game="squares"] .q-choices.is-locked .choice-btn,
#question-modal[data-game="columns"] .q-choices.is-locked .choice-btn,
#question-modal[data-game="bandit"] .q-choices.is-locked .choice-btn{
  opacity: 0.55;
}

/* Selected option: same blue, solid line, stronger shadow */
#question-modal[data-game="squares"] .choice-btn.is-picked,
#question-modal[data-game="columns"] .choice-btn.is-picked,
#question-modal[data-game="bandit"] .choice-btn.is-picked{
  opacity: 1;
  border-style: solid;
  border-width: 3px;
  border-color: #2563eb;      /* same blue, now solid */
  box-shadow: 0 20px 40px rgba(15,23,42,0.26);
}

/* Revealed correct option (multiple choice "answer" button) */
#question-modal[data-game="squares"] .choice-btn.is-answer-reveal,
#question-modal[data-game="columns"] .choice-btn.is-answer-reveal,
#question-modal[data-game="bandit"] .choice-btn.is-answer-reveal{
  opacity: 1;
  background-color: #22c55e;
  border-color: #15803d;
  border-style: solid;
  color: #ffffff;
  box-shadow: 0 20px 40px rgba(15,23,42,0.26);
}

/* Stay fully visible even when the choice stack is dimmed by a locked pick */
#question-modal[data-game="squares"] .q-choices.is-locked .choice-btn.is-answer-reveal,
#question-modal[data-game="columns"] .q-choices.is-locked .choice-btn.is-answer-reveal,
#question-modal[data-game="bandit"] .q-choices.is-locked .choice-btn.is-answer-reveal{
  opacity: 1;
  background-color: #22c55e;
  border-color: #15803d;
  border-style: solid;
  color: #ffffff;
}

/* Answer toggle centered (all games) */
#question-modal [data-role="toggle-answer"]{
  display: block;
  margin: 16px auto 0;
}

.q-actions{ display:flex; justify-content:center; gap: 26px; margin-top: 14px; }
.verdict{
  width: 92px; height: 92px; border-radius: 999px;
  border: 8px solid #0b1220; cursor:pointer;
  font-size: 44px; display:grid; place-items:center;
}
.verdict-yes{ background: #22c55e; color: #0b1220; }
.verdict-no{ background: #ef4444; color:#fff; }

.verdict [data-role="verdict-emoji"]{
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.verdict [data-role="verdict-emoji"] .token-img{
  width: 92%;
  height: 92%;
  object-fit: contain;
  display: block;
}

/* Bandit: verdict thumb graphic fills the green circle cleanly */
#question-modal[data-game="bandit"] .verdict [data-role="verdict-emoji"] .token-img{
  width: 100%;
  height: 100%;
}

.modal-close{ position:absolute; right: 18px; bottom: 18px; }
.bandit-badge{
  position:absolute; left: 22px; bottom: 18px;
  display:flex;
  align-items:center;
  gap: 8px;
  height: 86px;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,0.24));
}

/* Bottom-left team logo + optional Bandit icon (all games share sizing) */
.bandit-badge-team,
.bandit-badge-bandit{
  width: 86px;
  height: 86px;
  border-radius: 18px;
  display:grid;
  place-items:center;
  overflow:hidden;
}

.bandit-badge-team .token-img,
.bandit-badge-bandit .token-img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.plan-row{ display:flex; align-items:center; gap:10px; justify-content:space-between; padding-top:6px; }
.plan-badge{
  font-weight: 900; font-size: 12px; letter-spacing: 0.14em;
  background:#111827; color:#fff; padding:7px 10px; border-radius:999px;
}
.plan-note{ font-weight: 900; color: var(--muted); font-size: 13px; }

/* ---------- Fly animation ---------- */
.fly-obj{
  position:absolute;
  will-change: transform, opacity, left, top;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,0.28));
  transform: translate3d(0,0,0);
  transition:
    transform 560ms cubic-bezier(.22, .8, .22, 1),
    opacity 560ms ease,
    left 560ms cubic-bezier(.22, .8, .22, 1),
    top 560ms cubic-bezier(.22, .8, .22, 1);
  opacity: 1;
}
@media (prefers-reduced-motion: reduce){
  .fly-obj{ transition: none; }
}

/* ---------- System modal (paywall, notices) ---------- */
.modal-sys{ z-index: 10003; }
.modal-card-sys{
  /* 100% = the .modal's padded grid area, so a phone keeps the card inside
     the screen and centred; 94vw still governs wider screens. */
  width: min(720px, 94vw, 100%);
  max-height: min(90vh, 600px);
  padding: 26px 26px 20px;
  overflow-y: auto;
}

/* Hide the legacy footer buttons when showing the rich PRO upsell; the
   body renders its own "maybe later" / "UPGRADE" controls. */
#sys-modal[data-pro-upsell="true"] .sys-actions{
  display:none;
}

/* Squares powerups (GO TO FIRST PLACE, SWAP, LOSE HALF, FIRE): use the
   system modal for art + a single Apply button only. Hide the Close
   button so the only action is Apply. */
#sys-modal[data-mode="powerup"][data-game="squares"] .sys-actions [data-action="close-sys"]{
  display:none;
}

/* PRO upsell content reused inside system modal (mirrors plans.php styling) */
.sys-pro{
  margin-top: 4px;
}
.sys-pro-logo{
  display:block;
  height:60px;      /* larger PRO logo at the very top */
  width:auto;
  margin:0 auto 12px;
  object-fit:contain;
}

.sys-pro-slogan{
  font-size:20px;           /* larger, like the previous title version */
  font-weight:900;
  letter-spacing:0.08em;
  text-transform:uppercase;
  margin:12px 0 10px;
  text-align:center;
  color:#0f172a;
}

.sys-pro-interval{
  display:inline-flex;
  border-radius:999px;
  background:#ffffff;
  border:1px solid rgba(148,163,184,0.7);
  box-shadow:0 8px 18px rgba(15,23,42,0.10);
  padding:4px;
  gap:0;
  margin:12px 0 18px; /* space above and below monthly/yearly toggle */
}
.sys-pro-interval button{
  border:none;
  background:transparent;
  padding:6px 16px;
  border-radius:999px;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  color:#4b5563;
  display:flex;
  align-items:center;
  gap:6px;
}
.sys-pro-interval button[data-active="true"]{
  background:#e5e7eb;
  color:#0f172a;
}
.sys-pro-save{
  font-size:9px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:0.18em;
  padding:2px 6px;
  border-radius:999px;
  border:1px solid rgba(14,165,233,0.8);
  background:rgba(252,239,0);
  color:#0f172a;
}

.sys-pro-intro{
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: rgba(15,23,42,0.85);
}

.sys-pro-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:18px;
  margin-bottom:16px;
}

.sys-pro-card{
  border-radius:24px;
  padding:18px 18px 20px;
  background:rgba(249,250,251,0.96);
  border:1px solid rgba(148,163,184,0.7);
  box-shadow:0 16px 34px rgba(15,23,42,0.16);
}
/* Freelance plan card - most prominent (replaces old pro) */
.sys-pro-card-freelance{
  background:linear-gradient(145deg,#e0f2fe 0%,#dbeafe 40%,#eff6ff 100%);
  border: 2px solid #0ea5e9;
  position:relative;
  box-shadow: 0 16px 40px rgba(14,165,233,0.2);
}

/* Academy plan card - secondary emphasis */
.sys-pro-card-academy{
  background:linear-gradient(145deg,#f0fdf4 0%,#dcfce7 50%,#d1fae5 100%);
  border-color:rgba(34,197,94,0.5);
  position:relative;
}

.sys-pro-badge{
  position:absolute;
  top:-12px;
  left:50%;
  transform:translateX(-50%);
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:0.18em;
  padding:3px 14px;
  border-radius:999px;
  background:linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color:#ffffff;
  box-shadow: 0 4px 12px rgba(14,165,233,0.4);
}

.sys-pro-subtitle{
  margin:0 0 10px;
  font-size:13px;
  font-weight:600;
  color:#64748b;
}

.sys-pro-label{
  margin-top:4px;
  margin-bottom:6px;
  font-size:14px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:0.18em;
  color:#1f2937;
}

.sys-pro-price{
  font-size:22px;
  font-weight:900;
  margin:0 0 8px;
  color:#0f172a;
}
.sys-pro-price small{
  display:inline-block;   /* keep VAT note on same line as price */
  font-size:12px;
  font-weight:700;
  margin-left:4px;
}
.sys-pro-total{
  display:block;
  font-size:12px;
  font-weight:700;
  margin-top:2px;
}

.sys-pro-list{
  margin: 0;
  padding-left: 0;
  list-style: none;           /* remove default bullets */
  font-size: 14px;
  font-weight: 600;
  color: rgba(15,23,42,0.9);
}
.sys-pro-list li{
  position: relative;
  padding-left: 20px;         /* space for green check */
}
.sys-pro-list li::before{
  content: "✓";
  position: absolute;
  left: 0;
  top: 0.1em;
  font-size: 13px;
  font-weight: 900;
  color: #16a34a;             /* same green as plan features */
}
.sys-pro-list li + li{
  margin-top: 3px;
}

/* Legacy school card styles removed - use academy-plan instead */
.sys-pro-note-block{
  margin:0 0 8px;
  font-size:14px;
  font-weight:600;
}
.sys-pro-note-block a{
  color:#111827; /* black text for email link */
  font-weight:700;
  text-decoration:none;
}
.sys-pro-note-block a:hover{
  text-decoration:underline;
}

.sys-pro-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:4px;
}

.sys-pro-actions .pill{
  font-size:14px;
  font-weight:900;
}
/* Specifically style the primary upgrade button inside the upsell */
.sys-pro-actions [data-role="sys-pro-upgrade"]{
  background: linear-gradient(135deg,#2563eb,#1d4ed8);
  color:#f9fafb;
  box-shadow:0 12px 26px rgba(37,99,235,0.55);
}

.sys-pro-note{
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: rgba(15,23,42,0.7);
}

/* Premium lock badge on categories (free/guest only) */
.topic-premium-badge{
  display: inline-flex;
  align-items: center;
  margin-right: 6px; /* small gap before level chip */
}

/* Fully checked categories: green check indicator rendered inline to the right */
.topic-row.is-checked-topic,
.selected-topic.is-checked-topic{
  /* no special left padding; the inline checkmark will sit after the title */
}

/* Kill any legacy pseudo-element checkmarks that might still be in cached CSS */
.topic-row.is-checked-topic::before,
.selected-topic.is-checked-topic::before{
  content: none !important;
}

.topic-checkmark{
  margin-left: 8px;
  font-size: 15px;
  font-weight: 900;
  color: #16a34a;
  text-transform: uppercase;
}

.topic-premium-badge img{
  height: 30px;          /* cap height */
  width: auto;           /* keep original aspect ratio */
  display: block;
}

/* Dim only text/level for locked topics so the badge stays fully opaque */
.topic-row.is-locked-topic .topic-title,
.topic-row.is-locked-topic .topic-level{
  opacity: 0.45;
}

/* Squares + Columns powerup popups: no inner scroll; let the card grow
   to fit its content so the full illustration and text are always
   visible without a scrollbar. */
#sys-modal[data-game="squares"] .modal-card-sys,
#sys-modal[data-game="columns"] .modal-card-sys{
  max-height: none;
  overflow-y: visible;
}
.sys-title{
  font-weight: 900;
  font-size: 22px;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.sys-body{
  font-weight: 800;
  color: #111827;
  font-size: 16px;
  line-height: 1.3;
}
.sys-actions{
  display:flex;
  gap: 12px;
  justify-content:flex-end;
  margin-top: 18px;
  align-items:center;
  flex-wrap: wrap;
}

/* ---------- Rich rules/help modal ----------
   Used by every game (js/ui/rules_modal.js, #sys-modal) and every tool
   (php/tool_instructions.php, #page-help-modal — both share the
   .sys-title/.modal-card-sys classes this is keyed on). Themed entirely
   through --game-accent, set inline (tools) or via JS (games). */
.modal-sys--rich .modal-card-sys{
  /* Wide enough for the 15-language translate grid to lay out 5 per row
     (see .rules-lang-grid) — ~110px per option, matching the per-option
     width the previous 4-column/520px layout already used comfortably. */
  width: min(640px, 94vw, 100%);
  max-height: none;
  overflow: visible;
  padding: 54px 28px 24px;
  background:
    radial-gradient(ellipse 100% 60% at 50% 0%, color-mix(in srgb, var(--game-accent) 7%, transparent), transparent 70%),
    #fff;
  animation: rules-rich-rise 0.22s ease-out;
}
.modal-sys--rich .sys-title{
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce){
  .modal-sys--rich .modal-card-sys{ animation: none; }
}
@keyframes rules-rich-rise{
  from{ opacity: 0; transform: translateY(10px); }
  to{ opacity: 1; transform: translateY(0); }
}

.rules-rich{
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rules-rich-head{
  position: relative;
  /* Badge + title as a centered flex row (rather than an absolutely-
     positioned badge pinned to a fixed offset) so the badge stays
     vertically centered against the title regardless of whether it wraps
     to one line or two — a fixed offset only looked right for one line. */
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -34px 0 0 -8px;
}
.rules-rich-badge{
  position: relative;
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--game-accent);
  box-shadow: 0 8px 20px rgba(15,23,42,0.16);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Several logo assets (e.g. img/tools/presentation.png) have zero
     internal transparent margin — their drawn content fills the source
     canvas edge to edge. This padding is sized so even a perfectly square,
     edge-to-edge logo stays well inside the circle, with real margin to
     spare. It has to live on this wrapper rather than directly on the
     <img> below: Chrome/Safari size object-fit against the element's
     border-box, not its content-box, so padding on the <img> itself is
     silently ignored by object-fit and the image still fills (and gets
     clipped by) the full circle. */
  padding: 16px;
  animation: rules-rich-badge-pop 0.25s ease-out;
}
.rules-rich-badge img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
@media (prefers-reduced-motion: reduce){
  .rules-rich-badge{ animation: none; }
}
@keyframes rules-rich-badge-pop{
  from{ transform: scale(0.9); opacity: 0; }
  to{ transform: scale(1); opacity: 1; }
}
/* .rules-rich-x (the top-right × close button) was removed from the rich
   modal — js/ui/rules_modal.js and php/tool_instructions.php no longer
   render it, closing now happens via the "Got it"/"Let's play" pill or
   clicking outside the card. Rule kept here in case it's brought back. */
.rules-rich-x{
  position: absolute;
  top: -6px;
  right: -6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: #f1f5f9;
  color: #334155;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rules-rich-x:hover{ background: #e2e8f0; }
.rules-rich-title{
  margin: 0;
  min-width: 0;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--game-accent);
  /* A long single word ("MENGGUNAKAN") must wrap rather than be cut off
     at the card edge on a narrow phone. */
  overflow-wrap: anywhere;
  hyphens: auto;
}
@media (max-width: 360px){
  .rules-rich-title{ font-size: 16px; letter-spacing: 0.01em; }
}

.rules-rich-paragraph{
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.55;
  color: rgba(15,23,42,0.86);
}
.rules-rich-paragraph strong{
  font-weight: 900;
  color: #0f172a;
}

.rules-rich-icon{
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--game-accent) 14%, white);
  color: var(--game-accent);
}
.rules-rich-icon svg{ width: 15px; height: 15px; }

.rules-rich-win{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 2px auto 0;
  padding: 9px 20px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--game-accent) 16%, white);
  color: color-mix(in srgb, var(--game-accent) 80%, #1f2937);
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}
.rules-rich-win .rules-rich-icon{
  background: transparent;
  width: 18px;
  height: 18px;
}
.rules-rich-win .rules-rich-icon svg{ width: 16px; height: 16px; }

.pill-game-cta{
  background: var(--game-accent);
  color: #fff;
}

/* ---------- Instruction-language translate control ----------
   Opt-in per game via GAME_RULES[id].translations (js/data/game_rules.js) —
   currently rendered for Bandit only, as a limited trial (js/ui/
   rules_modal.js). Sits between .rules-rich-head and .rules-rich-paragraph;
   themed with the same --game-accent as the rest of the rich modal. */
.rules-lang{
  align-self: center;
  width: 100%;
  max-width: 100%;
}
.rules-lang-toggle{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 40px;
  border: 1.5px solid color-mix(in srgb, var(--game-accent) 30%, #e2e8f0);
  border-radius: 999px;
  background: color-mix(in srgb, var(--game-accent) 8%, white);
  color: color-mix(in srgb, var(--game-accent) 78%, #1f2937);
  font-weight: 800;
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
  box-sizing: border-box;
}
.rules-lang-toggle:hover{ background: color-mix(in srgb, var(--game-accent) 16%, white); }
.rules-lang-toggle:focus-visible{ outline: 2px solid var(--game-accent); outline-offset: 2px; }
.rules-lang-toggle[aria-expanded="true"]{
  background: var(--game-accent);
  border-color: var(--game-accent);
  color: #fff;
}
.rules-lang-toggle-icon{ display: flex; flex: 0 0 auto; width: 16px; height: 16px; }
.rules-lang-toggle-icon svg{ width: 100%; height: 100%; }
.rules-lang-toggle-label{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.rules-lang-panel{
  margin-top: 10px;
  padding: 10px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  /* 15 locales in a 5-column grid is 3 full rows (44px options + 8px gaps)
     plus panel padding — about 170px; the <380px fallback below drops to 4
     columns (4 rows, ~222px). max-height keeps headroom above the taller
     of the two so the grid never needs its own scrollbar; overflow-y stays
     on only as a safety net if more locales are added later. */
  max-height: 280px;
  overflow-y: auto;
  box-sizing: border-box;
}
.rules-lang-grid{
  /* The translation picker has fifteen locales: a 5-column grid divides
     evenly into 3 full rows, reading as a compact chooser rather than a
     flex row that happens to wrap wherever the labels fit. */
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.rules-lang-option{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  box-sizing: border-box;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #fff;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 12.5px;
  color: #1f2937;
  box-shadow: 0 1px 2px rgba(15,23,42,0.06);
}
.rules-lang-option:hover{ background: #f1f5f9; }
.rules-lang-option:focus-visible{ outline: 2px solid var(--game-accent); outline-offset: 2px; }
.rules-lang-option--active{
  border-color: var(--game-accent);
  background: color-mix(in srgb, var(--game-accent) 12%, white);
}
.rules-lang-flag{
  flex: 0 0 auto;
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}
.rules-lang-name{ white-space: nowrap; }
.rules-lang-check{
  display: none;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: var(--game-accent);
}
.rules-lang-option--active .rules-lang-check{ display: flex; }
.rules-lang-check svg{ width: 100%; height: 100%; }

@media (max-width: 380px){
  .rules-lang-toggle-label{ max-width: 130px; }
  .rules-lang-option{ font-size: 12px; padding: 6px; }
  /* 5 columns is too cramped once the modal itself is capped at 94vw on a
     narrow phone — fall back to 4 (4 rows, last row of 3) and hide each
     option's language name so the flag/check still fit comfortably. */
  .rules-lang-grid{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rules-lang-name{ display: none; }
  /* Centre the three options on the final row (child 13 is also
     3rd-from-last only when there are exactly 15 total, matching this
     4-column fallback). */
  .rules-lang-option:nth-child(13):nth-last-child(3){ grid-column-start: 2; }
}

.mini-row{ display:flex; gap: 10px; }
.mini-btn{
  flex:1 1 0;
  border: 0;
  border-radius: 14px;
  padding: 12px 12px;
  font-weight: 900;
  cursor: pointer;
  background: #f1f5f9;
  color: #0f172a;
  box-shadow: 0 10px 20px rgba(15,23,42,0.06);
}
.mini-btn-danger{ background: #fee2e2; color: #7f1d1d; }

/* ---------- Question flag (1-bit report) ---------- */
.modal-card{ position: relative; }

.flag-btn{
  position:absolute;
  top: 12px;
  left: 12px;
  right: auto;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(239,68,68,0.16);
  color: #b91c1c;
  font-weight: 900;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: 0 10px 24px rgba(15,23,42,0.10);
}


.flag-btn[disabled]{
  opacity: 0.45;
  cursor: default;
}


/* ===== Modal (all games) ===== */

/* target loot icon: centered, bounded, glows + wiggles */
#question-modal [data-role="modal-icon"]{
  width: 92px;
  height: 92px;
  margin: 6px auto 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#question-modal [data-role="modal-icon"] .token-img{
  width: 88%;
  height: 88%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}


/* bigger red flag */
#question-modal .flag-btn{
  font-size: 28px;
  padding: 6px 10px;
}

/* ===== Modal target object (all games) ===== */
#question-modal [data-role="modal-icon"]{
  width: 128px;
  height: 128px;
  margin: 6px auto 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(255, 210, 0, 0.10);
}

#question-modal [data-role="modal-icon"] .token-img{
  width: 86%;
  height: 86%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

#question-modal [data-role="modal-icon"].loot-target{
  animation: lootWiggle 0.85s ease-in-out infinite, lootGlow 1.6s ease-in-out infinite;
}

@keyframes lootWiggle{
  0%,100% { transform: rotate(-2deg) translateY(0); }
  50%     { transform: rotate( 2deg) translateY(-2px); }
}

@keyframes lootGlow{
  0%,100% {
    box-shadow:
      0 0 0 2px rgba(255, 220, 0, 0.25),
      0 0 18px rgba(255, 220, 0, 0.25);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(255, 220, 0, 0.55),
      0 0 32px rgba(255, 220, 0, 0.65);
  }
}

/* bigger red flag */
#question-modal .flag-btn{
  font-size: 28px;
}

/* =========================================================
   PLAY MODE team strip (Squares + Columns only)
   Boxes flex in width only; logos fixed size
   ========================================================= */

#layout[data-route="play"][data-game="squares"] #teams .team,
#layout[data-route="play"][data-game="columns"] #teams .team{
  flex: 1 0 auto;
  min-width: calc(var(--team-logo) + 24px);
  height: 100%;

  border-radius: 22px;
  padding: 14px 12px 16px;

  display: grid;
  grid-template-rows: 92px 1fr;
  align-items: stretch;
  justify-items: center;
  gap: 12px;

  box-shadow: var(--shadow-card);
}

#layout[data-route="play"][data-game="squares"] #teams .team .score,
#layout[data-route="play"][data-game="columns"] #teams .team .score{
  position: static;
  transform: none;

  display: grid;
  place-items: center;

  width: fit-content;
  min-width: 120px;
  max-width: 90%;

  height: 92px;
  background: rgba(255,255,255,0.78); /* fallback */
  background: color-mix(in srgb, var(--team-bg) 22%, white 78%);
  color: #111827;
  border-radius: 22px;
  box-shadow:
    inset 0 0 0 3px rgba(17,24,39,0.16),
    0 10px 18px rgba(15,23,42,0.10);

  font-weight: 900;
  font-size: 64px;
  line-height: 1;
  text-align: center;
}

#layout[data-route="play"][data-game="squares"] #teams .team .emo,
#layout[data-route="play"][data-game="columns"] #teams .team .emo{
  width: 100%;
  height: 100%;

  display: grid;
  place-items: end center;

  padding-bottom: 10px;
  box-sizing: border-box;

  filter: drop-shadow(0 10px 14px rgba(0,0,0,0.20));
}

/* FIXED SIZE LOGO BOX */
#layout[data-route="play"][data-game="squares"] #teams .team .emo .token-img,
#layout[data-route="play"][data-game="columns"] #teams .team .emo .token-img{
  width: var(--team-logo) !important;
  height: var(--team-logo) !important;
  max-width: var(--team-logo) !important;
  max-height: var(--team-logo) !important;

  object-fit: contain;
  display: block;
}

/* Atma font (Squares + Columns only) */
#layout[data-game="squares"] #teams .score,
#layout[data-game="columns"] #teams .score,
#layout[data-game="squares"] #board-squares .sq-num,
#layout[data-game="squares"] #board-squares .sq-pts,
#layout[data-game="squares"] #board-squares .sq-tile,
#layout[data-game="columns"] #board-columns .col-tile{
  font-family: "Atma", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}


/* =========================================================
   Squares modal (question popup) — consolidated overrides
   Fixes:
   - more breathing room for question
   - centered content area (without collapsing into a narrow column)
   - dotted blue option borders; picked = solid blue
   - lock icon larger + slightly lower
   ========================================================= */

#question-modal[data-game="squares"] .modal-card{
  /* give the top-left meta pill its own space */
  padding-top: 72px;

  /* reserve area for the vote stack on the right */
  padding-right: 168px;
}

/* brief category / meta (top-left) */
#question-modal[data-game="squares"] .q-meta{
  position: absolute;
  top: 22px;
  left: 22px;

  font-weight: 900;
  font-size: 34px;
  color: #23262E;

  background: rgba(255, 253, 247, 0.94);
  border: 2px solid #23262E;
  border-radius: 22px;
  padding: 10px 16px;

  box-shadow: 3px 3px 0 rgba(35, 38, 46, 0.3);
  pointer-events: none;
}

/* keep the main content centered, but wide enough to breathe */
#question-modal[data-game="squares"] .q-text,
#question-modal[data-game="squares"] .q-choices,
#question-modal[data-game="squares"] .q-answer,
#question-modal[data-game="squares"] [data-role="toggle-answer"],
#question-modal[data-game="squares"] .q-actions{
  max-width: min(1100px, calc(100% - 140px));
  margin-left: auto;
  margin-right: auto;
}

/* question */


/* options grid */
#question-modal[data-game="squares"] .q-choices{
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 26px 30px;
}

/* option buttons (default: dotted) */
#question-modal[data-game="squares"] .choice-btn{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  border-radius: 999px;
  background: rgba(255, 253, 247, 0.96);

  /* text in the same family/scale as your answer */
  color: #0ea5e9;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 900;
  font-size: 46px;
  line-height: 1;

  /* thick dotted ring */
  border: 4px dashed rgba(14, 165, 233, 0.35);
  /* tighter interior (less empty air) */
  padding: 10px 32px;
  min-width: 260px;

  box-shadow: 3px 3px 0 rgba(35, 38, 46, 0.3);
  cursor: pointer;
  transform: translate(0, 0);
  transition: transform 130ms ease, box-shadow 130ms ease, border-color 130ms ease, filter 130ms ease;
}

#question-modal[data-game="squares"] .choice-btn:hover{
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 rgba(35, 38, 46, 0.3);
  border-color: #0ea5e9;
}

#question-modal[data-game="squares"] .choice-btn:active{
  transform: translate(0, 0);
  box-shadow: 1px 1px 0 rgba(35, 38, 46, 0.3);
}

/* picked option: solid blue ring + lock overlay
   (overrides the shared soft-shadow .is-picked rule above, so Squares gets
   the flat offset shadow while Columns/Bandit keep their own look) */
#question-modal[data-game="squares"] .choice-btn.is-picked{
  border-style: solid;
  border-color: #0ea5e9;
  opacity: 1;
  box-shadow: 3px 3px 0 rgba(35, 38, 46, 0.35);
}

#question-modal[data-game="squares"] .choice-btn.is-picked{
  /* Add lock icon visually without affecting layout/text positioning */
  background-image: url("/img/ui/lock.png");
  background-repeat: no-repeat;
  background-position: 22px 50%;
  background-size: 44px 44px;
}

/* lock down the rest once a pick is made */
#question-modal[data-game="squares"] .q-choices.is-locked .choice-btn{
  cursor: default;
  opacity: 0.36;
  transform: none;
}

#question-modal[data-game="squares"] .q-choices.is-locked .choice-btn.is-picked{
  opacity: 1;
  box-shadow: 3px 3px 0 rgba(35, 38, 46, 0.4);
}

/* answer + button spacing */
#question-modal[data-game="squares"] .q-answer{
  margin-top: 30px;
}

#question-modal[data-game="squares"] [data-role="toggle-answer"]{
  display: block;
  margin: 20px auto 10px;
}

/* verdict buttons: bigger team token in green circle */
#question-modal[data-game="squares"] .verdict{
  width: 118px;
  height: 118px;
  border-width: 7px;
}

#question-modal[data-game="squares"] .verdict [data-role="verdict-emoji"]{
  font-size: 72px;
  line-height: 1;
}

#question-modal[data-game="squares"] .verdict [data-role="verdict-emoji"] .token-img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* vote stack alignment (right column) */
#question-modal[data-game="squares"] .vote-stack{
  top: 22px;
  right: 22px;
  gap: 16px;
}

#question-modal[data-game="squares"] .vote-team,
#question-modal[data-game="squares"] .vote-token{
  width: 70px;
  height: 70px;
}

#question-modal[data-game="squares"] .vote-mark{
  width: 30px;
  height: 30px;
  right: 0;
  bottom: 0;
}

/* =========================================================
   Squares modal: scale down typography + smaller verdict buttons
   (icon size stays the same)
   ========================================================= */

/* 1) Make question/answers/options only slightly bigger than .q-meta (30px) */


#question-modal[data-game="squares"] .q-answer{
  font-size: 36px;     /* match */
  line-height: 1.12;
}

#question-modal[data-game="squares"] .choice-btn{
  font-size: 36px;     /* match */
  line-height: 1.05;
  padding: 6px 16px;   /* reduce bulk so the modal feels smaller */
}

/* 2) Smaller correct/incorrect buttons WITHOUT shrinking the team logo inside
      (old content area ≈ 76px; keep that by shrinking border + overall size) */
#question-modal[data-game="squares"] .verdict{
  width: 84px;
  height: 84px;
  border-width: 4px;   /* was 8px; keeps inner content ≈ same size as before */
}

/* keep the inside “logo” rendering the same size (fills the inner area) */
#question-modal[data-game="squares"] .verdict [data-role="verdict-emoji"],
#question-modal[data-game="squares"] .verdict [data-role="verdict-emoji"] .token-img{
  width: 100%;
  height: 100%;
}
/* Squares: brief category pinned bottom-left, compact pill (final authority) */
#question-modal[data-game="squares"] .q-meta{
  position: absolute !important;
  /* Shift right so it doesn't overlap the bottom-left team logo badge */
  left: 120px !important;
  bottom: 18px !important;
  top: auto !important;
  right: auto !important;

  display: inline-block !important;
  width: auto !important;
  max-width: calc(100% - 220px) !important; /* keeps clear of vote stack/right UI */

  padding: 8px 12px !important;
  margin: 0 !important;

  font-weight: 900;
  font-size: 30px;
  line-height: 1.05;

  background: rgba(255, 253, 247, 0.92);
  border: 2px solid #23262E;
  border-radius: 16px;
  box-shadow: 2px 2px 0 rgba(35, 38, 46, 0.3);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  pointer-events: none;
  z-index: 2;
}

/* Do not let the high-specificity positioning rule above override the
   badge's hidden state when a question has no category/meta label. */
#question-modal[data-game="squares"] .q-meta[hidden]{
  display: none !important;
}

.sq-tile .sq-obj {
  width: 80%;
  height: 80%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  margin: 0 auto;
}

/* Bouncing animation for active team */
@keyframes team-bounce {
  0%   { transform: translateY(0); }
  30%  { transform: translateY(-10px); }
  60%  { transform: translateY(0); }
  100% { transform: translateY(0); }
}

/* Lingo Bingo: bounce the active team card */
#layout[data-route="play"][data-game="lingobingo"] #teams .team.team-active {
  animation: team-bounce 0.7s ease-in-out infinite;
}

/* TEAM STRIP — forced single row */
#layout[data-route="play"][data-game="squares"] #teams,
#layout[data-route="play"][data-game="columns"] #teams {
  display: flex;
  flex-wrap: nowrap;        /* ← forces one single row */
  overflow-x: auto;         /* ← scrolls when too many teams */
  overflow-y: visible;
  gap: 14px;                /* match Columns tile gap */
  padding: 8px 6px 8px;     /* tighter top/bottom spacing around strip */

  /* Logo sizing variable */
  --team-logo: 120px;

  /* Height accommodates score badge + emoji */
  height: calc(var(--team-logo) + 150px);
  align-items: stretch;
}

 
#layout[data-route="play"][data-game="squares"] #teams .team,
#layout[data-route="play"][data-game="columns"] #teams .team {
  flex: 0 0 auto;                   /* ← NEVER shrink into a wrap */
  min-width: calc(var(--team-logo) + 24px);
  height: 100%;
  border-radius: 22px;
  padding: 14px 12px 16px;
  display: grid;
  grid-template-rows: 92px 1fr;
  justify-items: center;
  align-items: stretch;
  gap: 12px;
  box-shadow: var(--shadow-card);
overflow: visible;
position: relative;
isolation: isolate;

}

/* glow burst keyframes (used in some UI effects) */
@keyframes glowPulse {
  0% {
    box-shadow:
      0 0 0 2px rgba(255, 220, 0, 0.25),
      0 0 18px rgba(255, 220, 0, 0.25);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(255, 220, 0, 0.55),
      0 0 32px rgba(255, 220, 0, 0.65);
  }
  100% {
    box-shadow:
      0 0 0 2px rgba(255, 220, 0, 0.25),
      0 0 18px rgba(255, 220, 0, 0.25);
  }
}

#teams {
  flex: 1 1 auto !important;
  align-self: stretch !important;
}

/* ============================================================
   TEAM SCORE + LOGO ANIMATIONS (scoped to play mode)
   ============================================================ */
[data-route="play"] #teams .team {
  position: relative;
  overflow: visible;
}

/* ---------------------------
   SCORE ROLL (vertical reel)
--------------------------- */
.score {
  overflow: hidden;
  position: relative;
  height: 1.2em; /* fixed line height area */
}

.score-roll-container {
  display: block;
  position: relative;
  transition: transform 450ms cubic-bezier(0.25, 0.55, 0.25, 1.2);
}

.score-roll-old,
.score-roll-new {
  display: block;
  height: 1.2em;
  line-height: 1.2em;
}

.score-roll-up    { transform: translateY(-100%); }
.score-roll-down  { transform: translateY(100%);  }

/* ---------------------------
   PULSE (3 fast beats)
--------------------------- */
.logo-pulse {
  animation: logoPulse 500ms ease-in-out both;
}

@keyframes logoPulse {
  0%   { transform: scale(1);   }
  20%  { transform: scale(1.15);}
  33%  { transform: scale(1);   }
  53%  { transform: scale(1.15);}
  66%  { transform: scale(1);   }
  86%  { transform: scale(1.15);}
  100% { transform: scale(1);   }
}

/* ---------------------------
   SAG (penalty drop + recoil)
--------------------------- */
.logo-sag {
  animation: logoSag 240ms cubic-bezier(0.15, 0.3, 0.25, 1.4) both;
}

@keyframes logoSag {
  0%   { transform: translateY(0);     }
  60%  { transform: translateY(10px);  }
  100% { transform: translateY(0);     }
}

/* ---------------------------
   GLOW BURST (behind logo)
--------------------------- */
.emo {
  position: relative;
}

.emo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle,
    rgba(255, 220, 0, 0.85) 0%,
    rgba(255, 220, 0, 0.35) 40%,
    rgba(255, 220, 0, 0) 70%
  );
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.3);
  pointer-events: none;
}

/* ============================================================
   SCORE ROLL (vertical reel)
   ============================================================ */
.score {
  position: relative;
  overflow: hidden;
}

.score-roll-container {
  display: flex;
  flex-direction: column;
  transition: transform 0.45s cubic-bezier(0.25, 0.9, 0.3, 1.2);
}

.score-roll-container span {
  display: block;
  height: 1em;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1em;
}

/* move old number up, new number from below */
.score-roll-up {
  transform: translateY(-1em);
}

/* move old number down, new number from above */
.score-roll-down {
  transform: translateY(1em);
}

/* ============================================================
   LOGO PULSE (3 fast beats)
   ============================================================ */
@keyframes logoPulse {
  0%   { transform: scale(1); }
  20%  { transform: scale(1.20); }
  40%  { transform: scale(0.92); }
  60%  { transform: scale(1.15); }
  80%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
.logo-pulse {
  animation: logoPulse 0.50s ease-out;
}

/* ============================================================
   LOGO SAG (drop down then bounce up)
   ============================================================ */
@keyframes logoSag {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(10px); }
  100% { transform: translateY(0); }
}
.logo-sag {
  animation: logoSag 0.20s cubic-bezier(.3, .7, .4, 1.4);
}

/* ============================================================
   GLOW BURST BEHIND LOGO
   ============================================================ */
.emo {
  position: relative;
}

.logo-glow-burst::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(255,235,0,0.9) 0%, rgba(255,235,0,0) 70%);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: glowBurst 0.45s ease-out forwards;
}

@keyframes glowBurst {
  0%   { opacity: 0.9; width: 0; height: 0; }
  60%  { opacity: 0.6; width: 140px; height: 140px; }
  100% { opacity: 0; width: 180px; height: 180px; }
}

/* ============================================================
   DELTA FX (+5, -3) FLOATING TEXT
   ============================================================ */
.score-delta {
  position: absolute;
  top: -12px;
  right: 8px;
  font-size: 32px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.score-delta.show {
  opacity: 1;
  transform: translateY(-6px);
}

/* ============================================================
   STAR BURST (★)
   ============================================================ */
.score-burst {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) scale(0.2);
  opacity: 0;
  font-size: 48px;
  color: #ffd400;
  transition: opacity 0.30s ease, transform 0.30s ease;
}

.score-burst.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* =========================================================
   Score + logo FX (Squares + Columns only, play mode)
   ========================================================= */

#layout[data-route="play"][data-game="squares"] #teams .team .emo,
#layout[data-route="play"][data-game="columns"] #teams .team .emo,
#layout[data-route="play"][data-game="lingobingo"] #teams .team .emo{
  position: relative;
}

#layout[data-route="play"][data-game="squares"] #teams .team .score.is-rolling,
#layout[data-route="play"][data-game="columns"] #teams .team .score.is-rolling,
#layout[data-route="play"][data-game="lingobingo"] #teams .team .score.is-rolling{
  overflow: hidden;
}

#layout[data-route="play"][data-game="squares"] #teams .team .score .score-reel,
#layout[data-route="play"][data-game="columns"] #teams .team .score .score-reel,
#layout[data-route="play"][data-game="lingobingo"] #teams .team .score .score-reel{
  display: block;
  will-change: transform;
}

#layout[data-route="play"][data-game="squares"] #teams .team .score .score-line,
#layout[data-route="play"][data-game="columns"] #teams .team .score .score-line,
#layout[data-route="play"][data-game="lingobingo"] #teams .team .score .score-line{
  display: block;
  height: 1em;
  line-height: 1;
}

/* UP: old visible at start (translate 0), animate to show new (translate -50%) */
#layout[data-route="play"][data-game="squares"] #teams .team .score.is-up .score-reel,
#layout[data-route="play"][data-game="columns"] #teams .team .score.is-up .score-reel,
#layout[data-route="play"][data-game="lingobingo"] #teams .team .score.is-up .score-reel{
  transform: translateY(0);
  animation: scoreRollUp 450ms cubic-bezier(.2,.9,.2,1) forwards;
}

@keyframes scoreRollUp{
  from{ transform: translateY(0); }
  to{ transform: translateY(-50%); }
}

/* DOWN: new above old; start showing old (translate -50%), animate to new (translate 0) */
#layout[data-route="play"][data-game="squares"] #teams .team .score.is-down .score-reel,
#layout[data-route="play"][data-game="columns"] #teams .team .score.is-down .score-reel,
#layout[data-route="play"][data-game="lingobingo"] #teams .team .score.is-down .score-reel{
  transform: translateY(-50%);
  animation: scoreRollDown 420ms cubic-bezier(.4,0,.2,1) forwards;
}

@keyframes scoreRollDown{
  from{ transform: translateY(-50%); }
  to{ transform: translateY(0); }
}

/* Logo sag */
#layout[data-route="play"][data-game="squares"] #teams .team .emo.is-sag,
#layout[data-route="play"][data-game="columns"] #teams .team .emo.is-sag,
#layout[data-route="play"][data-game="lingobingo"] #teams .team .emo.is-sag{
  animation: logoSag 320ms cubic-bezier(.2,.9,.2,1);
}

@keyframes logoSag{
  0%{ transform: translateY(0); }
  35%{ transform: translateY(12px); }
  70%{ transform: translateY(-4px); }
  100%{ transform: translateY(0); }
}

/* Logo pop + glow burst */
#layout[data-route="play"][data-game="squares"] #teams .team .emo.is-pop,
#layout[data-route="play"][data-game="columns"] #teams .team .emo.is-pop,
#layout[data-route="play"][data-game="lingobingo"] #teams .team .emo.is-pop{
  animation: logoPop 520ms cubic-bezier(.2,.9,.2,1);
}

@keyframes logoPop{
  0%{ transform: scale(1); }
  12%{ transform: scale(1.12); }
  24%{ transform: scale(1.00); }
  36%{ transform: scale(1.10); }
  48%{ transform: scale(1.00); }
  60%{ transform: scale(1.08); }
  72%{ transform: scale(1.00); }
  100%{ transform: scale(1.00); }
}

#layout[data-route="play"][data-game="squares"] #teams .team .emo.is-pop::before,
#layout[data-route="play"][data-game="columns"] #teams .team .emo.is-pop::before,
#layout[data-route="play"][data-game="lingobingo"] #teams .team .emo.is-pop::before{
  content: "";
  position: absolute;
  inset: -12px;
  z-index: -1;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(253,224,71,.95) 0%, rgba(253,224,71,.45) 35%, rgba(253,224,71,0) 70%);
  animation: glowBurst 520ms cubic-bezier(.2,.9,.2,1) forwards;
  pointer-events: none;
}

@keyframes glowBurst{
  0%{ transform: scale(.35); opacity: 0; }
  15%{ transform: scale(.85); opacity: 1; }
  60%{ transform: scale(1.15); opacity: .65; }
  100%{ transform: scale(1.35); opacity: 0; }
}


/* Light-switch toggle (Objects) */
.ui-switch{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  font-weight: 900;
}

/* Keep checkbox accessible but invisible; the image is the UI */
.ui-switch > input{
  position: absolute;
  opacity: 0;
  pointer-events: auto;
}

/* Objects toggle uses an image instead of a track/thumb */
.objects-switch{
  flex-direction: column;
  gap: 3px;
}

.objects-img{
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

/* Hide the legacy track/thumb/icon if they ever exist in cached HTML */
.objects-switch .ui-switch-track,
.objects-switch .ui-switch-thumb,
.objects-switch .ui-switch-icon{
  display: none !important;
}

/* Keep top-left controls tight together (no extra left margin) */
#layout[data-route="play"][data-game="squares"] #top-controls .objects-switch{
  margin-left: 0;
}

/* Sound toggle is now an image button (see layout.css for styling) */

/* ON position */
.ui-switch > input:checked + .ui-switch-track{
  background: rgba(34,197,94,0.35);
  box-shadow: inset 0 0 0 2px rgba(34,197,94,0.30);
}
.ui-switch > input:checked + .ui-switch-track .ui-switch-thumb{
  transform: translateX(24px);
}


/* SQUARES MODE VISIBILITY CONTROL */
#layout[data-square-mode="numbers"] .sq-obj {
  display: none !important;
}

#layout[data-square-mode="numbers"] .sq-num {
  display: flex !important;
}

#layout[data-square-mode="objects"] .sq-num {
  display: none !important;
}

#layout[data-square-mode="objects"] .sq-obj {
  display: flex !important;
}

/* Full-screen winner overlay */
#winner-overlay{
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, rgba(15,23,42,0.88), rgba(15,23,42,0.98));
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease-out;
}

#winner-overlay.is-visible{
  opacity: 1;
  pointer-events: auto;
}

/* Main layout — column so headline, token, and button stack naturally */
.winner-inner{
  position: relative;
  width: min(720px, 96vw);
  height: min(720px, 96vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* Winning team's headline — color and text-shadow set inline by JS */
.winner-headline{
  position: relative;
  z-index: 3;
  font-size: clamp(40px, 7vw, 88px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
  line-height: 1;
}

/* Play Again button */
.winner-play-again{
  position: relative;
  z-index: 3;
  margin-top: 8px;
  padding: 14px 44px;
  border: 0;
  border-radius: 12px;
  background: #facc15;
  color: #111827;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 100ms, transform 80ms;
}

.winner-play-again:hover{ filter: brightness(1.12); }
.winner-play-again:active{ transform: scale(0.97); filter: brightness(0.92); }

/* row of winners (handles ties) */
[data-role="winner-main"]{
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

/* wrapper per winner, purely for layout */
.winner-main-box{
  display: grid;
  place-items: center;
}

/* BIG central PNG, no box, pulsating */
[data-role="winner-main"] .token-img{
  width: min(320px, 50vw);
  height: min(320px, 50vw);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;

  background: transparent;
  border-radius: 0;
  box-shadow: none;

  animation: winnerPulse 1.1s ease-in-out infinite;
}

@keyframes winnerPulse{
  0%   { transform: scale(1.00); }
  35%  { transform: scale(1.18); }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1.00); }
}

/* Sparks container */
[data-role="winner-sparks"]{
  position: absolute;
  inset: 0;
  overflow: visible;
}

/* mini-logo sparks */
.winner-spark{
  position: absolute;
  left: 50%;
  top: 50%;
  transform:
    translate(-50%, -50%)
    translate(0,0)
    scale(0.3)
    rotate(0deg);
  opacity: 0;
  pointer-events: none;
  animation: winnerSpark 5s ease-out forwards; /* 5 seconds */
}

.winner-spark .token-img{
  width: 72px;
  height: 72px;
  max-width: 72px;
  max-height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.45));
}

@keyframes winnerSpark{
  0%{
    opacity: 0;
    transform:
      translate(-50%, -50%)
      translate(0,0)
      scale(0.3)
      rotate(0deg);
  }
  10%{
    opacity: 1;
    transform:
      translate(-50%, -50%)
      translate(calc(var(--dx) * 0.25), calc(var(--dy) * 0.25))
      scale(0.9)
      rotate(calc(var(--rot) * 0.4));
  }
  40%{
    opacity: 1;
    transform:
      translate(-50%, -50%)
      translate(calc(var(--dx) * 0.85), calc(var(--dy) * 0.85))
      scale(1.0)
      rotate(calc(var(--rot) * 0.85));
  }
  100%{
    opacity: 0;
    transform:
      translate(-50%, -50%)
      translate(var(--dx), var(--dy))
      scale(0.3)
      rotate(var(--rot));
  }
}

.powerup-content{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:20px;
  padding:20px;
}

.powerup-img{
  width:140px;
  height:140px;
  object-fit:contain;
}

.powerup-text{
  font-weight:900;
  font-size:32px;
  text-align:center;
}

.powerup-apply{
  padding:18px 32px;
  font-size:28px;
  border-radius:999px;
  border:0;
  cursor:pointer;
}

/* ═══════════════════════════════════════════════════
   WORKSHEET CARD — shared between worksheets.php and lessons
   worksheets.php <style> overrides .ws-grid to 4-col;
   here we define the base (auto-fill) for narrower contexts.
═══════════════════════════════════════════════════ */
.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  min-width: 0;
}

.ws-card {
  background: #fff;
  border-radius: 20px;
  border: 1.5px solid #E2E8F0;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 10px rgba(15,23,42,0.05);
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.12s, border-color 0.12s;
  position: relative;
  min-width: 0;
}

.ws-card:hover {
  box-shadow: 0 8px 28px rgba(15,23,42,0.11);
  transform: translateY(-3px);
  border-color: #93C5FD;
}

.ws-card:focus-visible {
  outline: 2px solid #2563EB;
  outline-offset: 2px;
}

.ws-card--coming-soon {
  opacity: 0.52;
  cursor: default;
}

.ws-card--coming-soon:hover {
  box-shadow: 0 2px 10px rgba(15,23,42,0.05);
  transform: none;
  border-color: #E2E8F0;
}

.ws-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.ws-card-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.ws-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

/* Level badge colors — canonical values, must match LEVEL_COLORS in worksheets.php JS */
.ws-badge-A1      { background: #4DA9E6; color: #0b1220; }
.ws-badge-A2      { background: #2EC4C6; color: #0b1220; }
.ws-badge-B1      { background: #F2C94C; color: #0b1220; }
.ws-badge-B2      { background: #F2994A; color: #0b1220; }
.ws-badge-C1      { background: #7C3AED; color: #fff; }
.ws-badge-default { background: #E2E8F0; color: #475569; }

.ws-duration {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #94A3B8;
  white-space: nowrap;
  flex-shrink: 0;
}

.ws-card-title {
  font-size: 15px;
  font-weight: 900;
  color: #0F172A;
  line-height: 1.35;
  margin: 0 0 6px;
  overflow-wrap: break-word;
}

.ws-card-focus {
  font-size: 12.5px;
  font-weight: 600;
  color: #64748B;
  line-height: 1.5;
  margin: 0;
  flex-grow: 1;
  overflow-wrap: break-word;
}

.ws-card-footer {
  border-top: 1px solid #F1F5F9;
  padding-top: 10px;
  margin-top: auto;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ws-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #2563EB;
  text-decoration: none;
  transition: color 0.1s;
}

.ws-pdf-link:hover { color: #1D4ED8; }
.ws-pdf-link:focus-visible { outline: 2px solid #2563EB; outline-offset: 2px; border-radius: 3px; }

.ws-card-type-logo {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
  opacity: 0.4;
  flex-shrink: 0;
}

.ws-coming-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #94A3B8;
}

/* Exactly four quiz answers read best as a stable 2 × 2 choice board. Other
   counts keep the flexible wrapping layout above. */
#question-modal[data-game="squares"] .q-choices[data-choice-count="4"],
#question-modal[data-game="bandit"] .q-choices[data-choice-count="4"] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  width: 100%;
}

#question-modal[data-game="squares"] .q-choices[data-choice-count="4"] .choice-btn,
#question-modal[data-game="bandit"] .q-choices[data-choice-count="4"] .choice-btn {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 100%;
  white-space: normal;
}

/* ── Lingadoo dialog ──────────────────────────────────────────────────────
   The site's one modal shell, driven by js/lingadoo-dialog.js. It replaces
   window.alert()/window.confirm() everywhere a user-facing action needs to
   say something or ask for confirmation, so no page grows its own modal.
   Native <dialog> + showModal() supplies the top layer, backdrop, focus trap
   and Escape handling; only the skin lives here. ───────────────────────── */

.lg-dialog {
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  box-sizing: border-box;
  margin: auto;                 /* centred in the viewport in both axes */
  padding: 22px 22px 18px;
  border: 1px solid #d7e0ea;
  border-radius: 16px;
  background: #fff;
  color: #334155;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
}

.lg-dialog::backdrop { background: rgba(15, 23, 42, .48); }

.lg-dialog-title {
  margin: 0 0 7px;
  color: #0f172a;
  font-size: 19px;
  font-weight: 900;
  line-height: 1.25;
}

.lg-dialog-message {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.lg-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.lg-dialog-btn {
  appearance: none;
  min-height: 40px;
  box-sizing: border-box;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: 900 14px/1 "Nunito", system-ui, sans-serif;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.lg-dialog-btn:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }

.lg-dialog-btn-quiet { border-color: #cbd5e1; background: #fff; color: #334155; }
.lg-dialog-btn-quiet:hover { background: #f1f5f9; border-color: #94a3b8; }

.lg-dialog-btn-primary { border-color: #4a7dfb; background: #4a7dfb; color: #fff; }
.lg-dialog-btn-primary:hover { background: #2f63df; border-color: #2f63df; }

.lg-dialog-btn-danger { border-color: #dc2626; background: #dc2626; color: #fff; }
.lg-dialog-btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

@media (max-width: 480px) {
  .lg-dialog { padding: 18px 16px 15px; border-radius: 14px; }
  .lg-dialog-actions { flex-direction: column-reverse; align-items: stretch; }
  .lg-dialog-btn { width: 100%; min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-dialog-btn { transition: none; }
}
