/* Gameficate Craft — the Cartridge step (cartridge cards), the Pictures step (picture and spot editor) and "Tap the
   picture" in the question editor. */

/* ---------- Cartridge step ---------- */
.cart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.cart-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  text-align: start;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.cart-card:hover {
  border-color: var(--orange);
}
.cart-card.on {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--orange) 20%, transparent);
}
.cc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cc-top b {
  font-family: var(--display);
  font-size: 20px;
  color: var(--navy);
}
.cc-on {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.cc-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.cc-stages,
.cc-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cc-stages .chip {
  font-weight: 900;
}
.cc-types .chip.sm {
  padding: 2px 8px;
  font-size: 11.5px;
  opacity: 0.75;
}
.cc-types .chip.used {
  opacity: 1;
  border-color: var(--navy);
}
.cc-fit {
  font-size: 13px;
  font-weight: 800;
}
.cc-fit.ok {
  color: #137a4d;
}
.cc-fit.warn {
  color: #b4471b;
}
.warn-card {
  border-color: #f0b27a;
  background: #fffaf3;
}
.cc-bad {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* A kind of answer the chosen cartridge can't play (shown only on a question that already uses it). */
.kind-card.cant {
  opacity: 0.6;
  border-style: dashed;
}

/* ---------- Pictures step ---------- */
.pic-edit {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
}
.pic-stage {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #f6f8fb;
  min-height: 160px;
  user-select: none;
}
.pic-stage img {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}
.pic-stage.small img {
  cursor: default;
}
.pic-empty {
  display: grid;
  place-items: center;
  min-height: 200px;
  color: var(--muted);
  font-weight: 700;
}
.pic-dot {
  position: absolute;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 3px solid #fff;
  background: rgba(23, 50, 77, 0.75);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  box-shadow: 0 3px 10px rgba(10, 25, 40, 0.35);
  cursor: grab;
  touch-action: none;
}
.pic-stage.small .pic-dot {
  cursor: pointer;
}
.pic-dot.right {
  background: #22b573;
  box-shadow:
    0 0 0 5px rgba(34, 181, 115, 0.3),
    0 3px 10px rgba(10, 25, 40, 0.35);
}
.pic-spots {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pic-spot-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pic-spot-row .field {
  margin: 0;
}
.pic-spot-row select {
  width: 96px;
}
.pic-spot-row .k,
.hs-radio .k {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
}

/* ---------- Tap the picture (question editor) ---------- */
.hs-choose {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(200px, 1fr);
  gap: 14px;
  align-items: start;
}
.hs-radios {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hs-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}
.hs-radio.on {
  border-color: #22b573;
  background: #effaf4;
}
.hs-radio input {
  margin: 0;
}
.empty-card .small {
  margin: 0;
}

@media (max-width: 900px) {
  .pic-edit,
  .hs-choose {
    grid-template-columns: 1fr;
  }
}

/* ---------- Lists in the plug-in type editors (sections/ListRowsEditor.js) ---------- */
.rows-ed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.rows-ed-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.rows-ed-row .k {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
}
.rows-ed-body {
  flex: 1;
  min-width: 0;
}
.rows-ed-body .field {
  margin: 0;
}
.rows-ed-mv {
  display: flex;
  gap: 4px;
}
.rows-ed-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 8px;
  align-items: end;
}
/* Crossword: the word, then a wider clue. */
.rows-ed-pair.clue {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}

/* Cartridge cards: free / premium (shares .tpl-tier from templates.css), added by the author, locked premium. */
.cart-card .cc-top .tpl-tier {
  margin-inline-start: 6px;
}
.cc-custom {
  margin-inline-start: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3d4fb5;
  font-size: 11.5px;
  font-weight: 900;
}
.cart-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
}
.cc-add {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px dashed var(--line, #dce6ef);
}

/* Tap the picture: the question's own picture edited inside its card. */
details.hs-edit {
  margin: 4px 0 10px;
  border: 2px dashed var(--line, #dce6ef);
  border-radius: 14px;
  padding: 8px 12px;
}
details.hs-edit > summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--navy, #17324d);
}
details.hs-edit .pic-card {
  margin-top: 10px;
  border: 0;
  padding: 0;
  box-shadow: none;
}

/* ---------- Review & export → 📦 the cartridge with this assessment (js/sections/PackageCard.js) ---------- */
.pkg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  margin-top: 8px;
  background: var(--soft);
}
.pkg-ic {
  font-size: 22px;
}
.pkg-what {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.pkg-state.on {
  color: #1c8a55;
}
.pkg-progress {
  align-self: center;
}

/* ---------- Review & export → 🖼️ Media (js/sections/MediaCard.js) ---------- */
.media-facts {
  margin: 0 0 12px 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.media-facts li + li {
  margin-top: 4px;
}
