/* Gameficate Craft — Questions step: list, editor, map, options and hints. */
/* questions */
.qlayout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}
.qlist {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  position: sticky;
  top: 0;
}
.qitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid transparent;
}
.qitem:hover {
  background: var(--soft);
}
.qitem.on {
  border-color: var(--orange);
  background: #fff4ee;
}
.qitem .grip {
  cursor: grab;
  color: #9fb3c6;
  font-weight: 900;
  letter-spacing: -2px;
}
.qitem .n {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  flex: 0 0 auto;
}
.qitem img {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}
.qitem .nm {
  font-weight: 800;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qitem .st {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  flex: 0 0 auto;
}
.qitem .st.warn {
  background: var(--amber);
}
.qitem .st.err {
  background: var(--red);
}
.sortable-ghost {
  opacity: 0.4;
}
/* ---------- Question map, search results and markers ---------- */
#qmap {
  height: 420px;
  border-radius: 14px;
  border: 2px solid var(--line);
  z-index: 1;
}
.mapbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.mapbar input {
  flex: 1;
}
.results {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.results button {
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--soft);
  font-size: 14px;
  font-weight: 700;
}
.results button:hover {
  background: #e7eff6;
}
.num-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--navy);
  color: var(--navy);
  font-weight: 900;
  font-size: 13px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  font-family: var(--font);
}
.num-marker.cur {
  background: var(--orange);
  border-color: #fff;
  color: #fff;
  width: 34px;
  height: 34px;
  font-size: 15px;
}
/* ---------- Hint rows, linked-setting locks and list extras ---------- */
.hint-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.lockbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f3f0ff;
  border: 2px solid #dcd5ff;
  margin-bottom: 10px;
}
.lockbar .switch {
  font-weight: 800;
}
.locked-note {
  font-size: 13px;
  font-weight: 800;
  color: #5b4bd6;
}
table.layers.locked {
  opacity: 0.55;
  pointer-events: none;
}
.qitem .dup {
  margin-left: 4px;
  opacity: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 15px;
  padding: 2px 4px;
  border-radius: 6px;
}
.qitem:hover .dup,
.qitem.on .dup {
  opacity: 0.7;
}
.qitem .dup:hover {
  opacity: 1;
  background: #eef4f9;
}
.kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  background: #fff;
}

.hint-row.qopt {
  padding: 6px 8px;
  border-radius: 12px;
  border: 2px solid transparent;
}
.hint-row.qopt.right {
  background: #e6f8ef;
  border-color: #9ee0bf;
}
.hint-row.qopt .k {
  height: auto;
  padding-top: 18px;
}
.hint-row .k {
  width: 28px;
  height: 40px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: var(--muted);
  flex: 0 0 auto;
}

/* 🧩 Map puzzle card: pick pieces on a board drawn in the game's projection. */
.pz-board svg {
  display: block;
  margin-top: 10px;
  background: #bfe6f5;
  border-radius: 12px;
}
.pz-board path {
  stroke: #fff;
  stroke-width: 0.7;
  cursor: pointer;
  transition:
    fill 0.12s,
    fill-opacity 0.12s;
}
.pz-board path.piece {
  fill: #ff9f68;
}
.pz-board path.given {
  fill: #2a9d8f;
}
.pz-board path.off {
  fill: #ece6d8;
  stroke: #bcae90;
}
.pz-board path:hover {
  fill-opacity: 0.7;
}
.pz-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.pz-legend .k {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  margin-left: 6px;
}
.pz-legend .k.piece {
  background: #ff9f68;
}
.pz-legend .k.given {
  background: #2a9d8f;
}
.pz-legend .k.off {
  background: #ece6d8;
  border: 1px solid #bcae90;
}
.pz-summary {
  margin-top: 8px;
  font-size: 14px;
}
.pz-summary .warn {
  color: #b4471b;
  font-weight: 700;
}
.puzzle-card label.radio {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
  font-weight: 700;
}
.puzzle-card .row input[type='text'] {
  flex: 1;
  min-width: 0;
}

/* 🎭 Extra wrong choices (Classic decoys) — map + one tidy row per decoy (js/sections/DecoysEditor.js). */
.decoy-map {
  height: 380px;
  border-radius: 14px;
  border: 2px solid var(--line);
  overflow: hidden;
}
.decoy-map.placing {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 122, 61, 0.25);
}
.decoy-map.placing .leaflet-container,
.decoy-map.placing {
  cursor: crosshair;
}
.decoy-hint {
  margin: 6px 0 12px;
}
.decoy-marker {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #e5484d;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.decoy-marker img {
  width: 20px;
  height: 20px;
}
.decoy-marker b {
  position: absolute;
  right: -8px;
  top: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #e5484d;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
}
.decoy-marker.on {
  border-color: var(--orange);
  transform: scale(1.15);
}
.decoy-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.decoy-head,
.decoy-row {
  display: grid;
  grid-template-columns: 30px 52px minmax(180px, 2fr) minmax(110px, 1fr) minmax(110px, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.decoy-head {
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}
.decoy-row {
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.decoy-row.placing {
  border-color: var(--orange);
  background: #fff7f2;
}
.decoy-row.flash {
  background: #fff4d6;
}
.decoy-row .field {
  margin: 0;
}
.decoy-row .decoy-name label {
  display: none;
}
.decoy-row input[type='number'],
.decoy-row .decoy-name input {
  padding: 8px 10px;
  font-size: 14px;
}
.decoy-n {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e5484d;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  display: grid;
  place-items: center;
}
.decoy-act {
  display: flex;
  gap: 6px;
}
.decoy-act .btn {
  min-width: 36px;
  padding: 0 8px;
}
.decoy-fact {
  grid-column: 3 / -1;
}
.decoy-icon {
  position: relative;
}
.decoy-icon > summary {
  list-style: none;
  width: 44px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  cursor: pointer;
  background: #fbfdff;
}
.decoy-icon > summary::-webkit-details-marker {
  display: none;
}
.decoy-icon > summary img {
  width: 26px;
  height: 26px;
}
.decoy-icon[open] > summary {
  border-color: var(--orange);
}
.decoy-icon-pop {
  position: absolute;
  z-index: 30;
  top: 46px;
  left: 0;
  width: 460px;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--line);
  box-shadow: 0 14px 34px rgba(10, 25, 40, 0.2);
}
.decoy-empty {
  padding: 14px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  text-align: center;
}
@media (max-width: 1100px) {
  .decoy-head {
    display: none;
  }
  .decoy-row {
    grid-template-columns: 30px 52px 1fr 1fr auto;
  }
  .decoy-row .decoy-name {
    grid-column: 3 / -1;
    order: -1;
  }
}
/* 🔍 Place search (js/ui/PlaceSearch.js) — in 🎭 Extra wrong choices and the "choose a location" map dialog */
.place-search {
  position: relative;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.place-search .ic {
  position: absolute;
  left: 12px;
  font-size: 16px;
  pointer-events: none;
}
.place-search input[type='search'] {
  flex: 1;
  padding: 10px 12px 10px 38px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  font-size: 15px;
  font-weight: 700;
}
.place-search input[type='search']:focus {
  outline: none;
  border-color: var(--orange);
}
.place-results {
  position: absolute;
  z-index: 1000;
  top: 48px;
  left: 0;
  right: 90px;
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--line);
  box-shadow: 0 16px 36px rgba(10, 25, 40, 0.22);
}
.place-results .grp {
  padding: 6px 10px 2px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}
.place-results .note {
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.place-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'nm go' 'sub go';
  gap: 0 12px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  background: none;
  border: 0;
  cursor: pointer;
}
.place-result:hover,
.place-result:focus-visible {
  background: #fff4ec;
  outline: none;
}
.place-result .nm {
  grid-area: nm;
  font-weight: 900;
  color: var(--navy);
}
.place-result .sub {
  grid-area: sub;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.place-result .go {
  grid-area: go;
  align-self: center;
  font-size: 13px;
  font-weight: 900;
  color: var(--orange-d, #e35f1e);
  white-space: nowrap;
}

/* ---------- 👁️ Show or hide while this question is on screen (layer rules, js/sections/QuestionsSection.js) ---------- */
.layer-rules {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.layer-rules summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--navy);
}
.layer-rules table {
  margin-top: 8px;
}
.layer-rules select {
  width: auto;
  min-width: 230px;
  height: 34px;
  font-size: 13px;
}

/* ---------- Fun fact: text (plain or HTML) and media (js/sections/FunFactEditor.js) ---------- */
.ff-edit .ff-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.ff-edit .ff-tool {
  min-width: 34px;
  font-weight: 900;
}
.ff-edit .ff-kind {
  display: block;
  margin-top: 4px;
}
.ff-preview {
  width: 100%;
  height: 120px;
  margin-top: 8px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: #fff;
}
.ff-media-list {
  margin-top: 12px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--soft, #f6f9fc);
}
.ff-media-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.ff-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.ff-thumb {
  flex: 0 0 96px;
  height: 64px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: var(--soft, #f2f6fa);
  font-size: 26px;
}
.ff-thumb img,
.ff-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ff-thumb audio {
  width: 96px;
}
.ff-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ff-line {
  display: flex;
  gap: 6px;
}
.ff-line > * {
  flex: 1;
  min-width: 0;
}
.ff-line select {
  flex: 0 0 180px;
}
.ff-file {
  align-self: center;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ff-acts {
  display: flex;
  gap: 4px;
}
.ff-add {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.ff-add .logo-drop {
  flex: 1;
}
