/* Gameficate cartridge — Pop-ups (start, how to play, report) and the error screen. */
/* Modals */
.modal-root {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: rgba(10, 25, 40, 0.6);
  backdrop-filter: blur(3px);
}
.modal-root.open {
  display: grid;
}
.modal {
  position: relative;
  width: 860px;
  max-width: calc(var(--stage-w, 1920px) - 40px);
  max-height: calc(var(--stage-h, 1080px) - 40px);
  overflow: auto;
  border-radius: calc(28px * var(--rs, 1));
  background: var(--card);
  padding: 32px 44px 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  animation: pop 0.35s cubic-bezier(0.2, 1.3, 0.4, 1);
  text-align: center;
}
.modal h2 {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.15;
}
.modal .sub {
  font-size: 19px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.45;
}
.modal-close {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--navy);
  display: grid;
  place-items: center;
}
/* ---------- Game logo and report score ---------- */
.game-logo {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.game-logo .badge {
  width: 64px;
  height: 64px;
  border-radius: calc(18px * var(--rs, 1));
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffb057, var(--orange) 55%, var(--orange-d));
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.15),
    0 6px 14px rgba(255, 122, 61, 0.35);
}
/* The Gameficate mark fills its badge. */
.game-logo .badge.brand svg {
  width: 100%;
  height: 100%;
}
.game-logo .word {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 44px;
  line-height: 1;
  color: var(--navy);
  letter-spacing: 0.5px;
}
.game-logo .word span {
  color: var(--orange);
}
.modal .bigscore {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 6px;
  padding: 10px 28px;
  border-radius: calc(22px * var(--rs, 1));
  background: var(--navy);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 800;
  line-height: 1.1;
}
.stars {
  font-size: 44px;
  letter-spacing: 6px;
  margin-top: 6px;
}
.stars .off {
  filter: grayscale(1);
  opacity: 0.3;
}
/* ---------- Per-question result rows and the review bar ---------- */
.q-rows {
  margin: 16px 0 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  text-align: start;
}
.q-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: calc(12px * var(--rs, 1));
  background: var(--soft2);
}
.q-row img {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}
.q-row .nm {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q-row .pts {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--orange-d);
}
.q-row.todo {
  opacity: 0.5;
}
button.q-row {
  width: 100%;
  text-align: start;
  cursor: pointer;
  border: 2px solid transparent;
  font: inherit;
}
button.q-row:hover {
  border-color: var(--edge);
  background: var(--soft);
}
.q-row.miss {
  background: color-mix(in srgb, var(--red) 6%, var(--card));
}
.q-row .mk {
  font-weight: 900;
  width: 22px;
  text-align: center;
  flex: 0 0 auto;
}
.q-row .mk.ok {
  color: color-mix(in srgb, var(--green) 70%, #000);
}
.q-row .mk.bad {
  color: color-mix(in srgb, var(--red) 85%, #000);
}
.q-row .mk.half {
  color: color-mix(in srgb, var(--amber) 75%, #000);
}
.reviewbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: calc(14px * var(--rs, 1));
  background: color-mix(in srgb, var(--gold) 16%, var(--card));
  border: 2px solid color-mix(in srgb, var(--gold) 55%, var(--card));
  font-size: 15px;
  font-weight: 900;
  color: color-mix(in srgb, var(--gold) 40%, #000);
  flex: 0 0 auto;
}
.reviewbar span {
  flex: 1;
}
.reviewbar button {
  height: 32px;
  padding: 0 10px;
  border-radius: calc(10px * var(--rs, 1));
  background: var(--card);
  border: 2px solid color-mix(in srgb, var(--gold) 55%, var(--card));
  font-size: 13px;
  font-weight: 900;
  color: color-mix(in srgb, var(--gold) 40%, #000);
}
/* ---------- Modal buttons ---------- */
.modal-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.modal-actions .btn-primary {
  width: auto;
  min-width: 220px;
  padding: 0 28px;
}
.btn-ghost {
  height: 64px;
  padding: 0 26px;
  border-radius: calc(18px * var(--rs, 1));
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  background: var(--soft);
  border: 2px solid var(--line);
}
.btn-ghost:hover {
  background: var(--soft3);
}
.btn-ghost.danger {
  color: var(--red);
}
.link-btn {
  font-size: 16px;
  font-weight: 800;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  margin: 0 8px;
}
/* ---------- Start screen: mode and language cards ---------- */
.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0 8px;
  text-align: start;
}
.mode-card {
  padding: 20px;
  border-radius: calc(20px * var(--rs, 1));
  border: 3px solid var(--line);
  background: var(--soft2);
  transition:
    border-color 0.15s,
    transform 0.12s,
    background 0.15s;
}
.mode-card:hover {
  border-color: color-mix(in srgb, var(--navy) 30%, var(--card));
  transform: translateY(-2px);
}
.mode-card.sel {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 9%, var(--card));
}
.mode-card .mc-ic {
  font-size: 40px;
}
.mode-card .mc-t {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  margin-top: 4px;
}
.mode-card .mc-d {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 4px;
}
.lang-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 24px 0 8px;
}
.lang-card {
  padding: 22px 18px;
  border-radius: calc(20px * var(--rs, 1));
  border: 3px solid var(--line);
  background: var(--soft2);
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  color: var(--navy);
  transition:
    border-color 0.15s,
    transform 0.12s;
}
.lang-card small {
  display: block;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
}
.lang-card:hover {
  border-color: color-mix(in srgb, var(--navy) 30%, var(--card));
  transform: translateY(-2px);
}
.lang-card.sel {
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 9%, var(--card));
}
/* ---------- How to play ---------- */
.howto {
  margin: 18px 0 22px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  text-align: start;
}
.howto div {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: calc(16px * var(--rs, 1));
  background: var(--soft2);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.45;
}
.howto .n {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: calc(12px * var(--rs, 1));
  display: grid;
  place-items: center;
  background: var(--card);
  font-size: 22px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.howto b {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--navy);
}

/* ---------- Fatal error box ---------- */
.fatal {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  background: var(--bg);
}
.fatal.open {
  display: grid;
}
.fatal .box {
  width: 900px;
  text-align: center;
}
.fatal h2 {
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--navy);
}
.fatal p {
  font-size: 22px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.5;
}
.fatal code {
  background: var(--card);
  padding: 2px 10px;
  border-radius: calc(8px * var(--rs, 1));
  color: var(--navy);
  border: 2px solid var(--line);
}
button.q-row.locked {
  opacity: 0.55;
  cursor: not-allowed;
}
button.q-row.locked:hover {
  border-color: transparent;
  background: var(--soft2);
}
/* A game logo chosen in the Theme Configurator (own image). */
.game-logo.custom img {
  display: block;
  max-height: 84px;
  max-width: 380px;
  object-fit: contain;
}
/* ---------- "Use a power-up to solve this question?" (PopupScreens.confirmPowerUpSolve) ---------- */
.pu-ask-icon {
  width: 84px;
  height: 84px;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 46px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--violet) 78%, #fff), var(--violet));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--violet) 40%, transparent);
}
.pu-ask-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 6px;
}
.pu-ask-facts span {
  padding: 8px 14px;
  border-radius: calc(999px * var(--rs, 1));
  background: var(--soft);
  font-weight: 800;
  font-size: 16px;
}
/* Report row of a question solved with a power-up. */
.q-row .mk.pu {
  background: var(--violet);
  color: #fff;
}

/* ---------- Credits (PopupScreens.showCredits) ---------- */
.credits-list {
  list-style: none;
  margin: 14px 0 4px;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: start;
  max-height: 46vh;
  overflow-y: auto;
}
.credits-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: calc(12px * var(--rs, 1));
  background: color-mix(in srgb, var(--ink, #17324d) 5%, transparent);
  font-size: 14px;
}
.credits-list li span {
  font-size: 12.5px;
  opacity: 0.8;
}
.credits-list a {
  color: inherit;
  font-weight: 800;
}

/* The question paper being played (Craft's question papers), on the start screen. */
.paper-line {
  display: inline-block;
  margin: -4px 0 8px;
  padding: 3px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold, #ffc83d) 22%, transparent);
  color: var(--navy);
  font-size: 14px;
  font-weight: 900;
}

/* ---------- Your details on the start screen (js/ui/ParticipantForm.js) ---------- */
.part-box {
  margin: 18px auto 0;
  max-width: 620px;
}
.part-form {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 18px 16px;
  text-align: left;
}
.part-form legend {
  padding: 0 8px;
  font-size: 17px;
  font-weight: 900;
  color: var(--navy);
}
.part-f {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}
.part-f i {
  color: var(--red);
  font-style: normal;
}
.part-f small {
  font-size: 13px;
  color: var(--muted);
}
.part-f input {
  height: 48px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: calc(12px * var(--rs, 1));
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}
.part-f input:focus {
  outline: none;
  border-color: var(--teal);
}
.part-f input[readonly] {
  background: var(--soft);
  color: var(--muted);
}
.part-err {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--red);
}
.part-line {
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
}
.part-line b {
  color: var(--navy);
}

/* ---------- Pop-ups that fit the screen: pages instead of scrolling (js/ui/ModalPager.js, js/ui/ColumnPager.js) ---------- */
.modal {
  overflow: hidden;
}
.modal.paged {
  display: flex;
  flex-direction: column;
}
.mp-view {
  overflow: hidden;
  min-height: 0;
}
.modal.paged .mp-flow {
  touch-action: pan-y;
}
.modal.paged .mp-flow > * {
  max-width: 100%;
}
/* Rows and cards are not cut between two pages. */
.mp-flow .q-row,
.mp-flow .howto > div,
.mp-flow .credits-list li,
.mp-flow .ff-media,
.mp-flow .part-form,
.mp-flow .bigscore,
.mp-flow .stars,
.mp-flow figure,
.mp-flow .game-logo {
  break-inside: avoid;
}
.mp-flow h2,
.mp-flow h3 {
  break-after: avoid;
}
.mp-foot .modal-actions {
  margin-top: 14px !important;
}
.cp-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}
.cp-nav[hidden] {
  display: none;
}
.cp-prev,
.cp-next {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--navy);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.cp-prev:disabled,
.cp-next:disabled {
  opacity: 0.35;
  cursor: default;
}
.cp-dots {
  display: flex;
  gap: 8px;
}
.cp-dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 999px;
  background: var(--soft3);
  cursor: pointer;
  transition:
    width 0.2s,
    background 0.2s;
}
.cp-dot.on {
  width: 30px;
  background: var(--orange);
}
.cp-count {
  min-width: 52px;
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
}
/* Lists that used to scroll inside a pop-up now flow onto the next page. */
.mp-flow .credits-list {
  max-height: none;
  overflow: visible;
}

/* ---------- How to play: slides with a little animation each (js/ui/HowToCarousel.js) ---------- */
.modal:has(.hc) {
  width: 900px;
}
.hc-h {
  margin-bottom: 10px;
}
.hc-view {
  overflow: hidden;
  height: min(340px, calc(var(--stage-h, 1080px) - 330px));
  touch-action: pan-y;
}
.hc-track {
  display: flex;
  height: 100%;
}
.hc-slide {
  flex: 0 0 100%;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 30px;
  padding: 6px 12px;
  text-align: start;
}
.hc-anim {
  height: 100%;
  max-height: 300px;
  display: grid;
  place-items: center;
  border-radius: calc(26px * var(--rs, 1));
  background: var(--soft2);
}
.hc-anim svg {
  width: 100% !important;
  height: 100% !important;
}
.lt-still {
  font-size: 96px;
  line-height: 1;
}
.hc-ic {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: calc(16px * var(--rs, 1));
  background: var(--soft);
  font-size: 28px;
}
.hc-text h3 {
  margin: 12px 0 8px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--navy);
}
.hc-text p {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
}
.hc-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
}
.hc-acts {
  margin-top: 14px !important;
}
