/* The question editor. Builds on the colors in style.css. */

body.ed {
  min-height: 100vh;
  font-size: 14px;
  background: #050827;
}

.ed-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(7, 11, 51, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.ed-top .brand {
  font-family: Anton, Impact, sans-serif;
  font-size: 22px;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.search {
  flex: 0 1 360px;
  min-width: 0;
}

.search input {
  width: 100%;
  border-radius: 999px;
  padding: 8px 14px;
}

.saved {
  font-size: 12px;
  color: var(--green);
  opacity: 0;
  transition: opacity 0.3s;
}

.saved.show {
  opacity: 1;
}

.icon-btn {
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 22px;
  padding: 2px 6px;
}

.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  min-width: 230px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--ink);
  padding: 9px 10px;
  border-radius: 6px;
}

.menu button:hover {
  background: #1f2a80;
}

.menu button.danger {
  color: #ff8a96;
}

.ed-body {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: calc(100vh - 56px);
}

/* ----- Sidebar ----- */

.side {
  border-right: 1px solid var(--line);
  padding: 14px 10px 40px;
  background: #070b33;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.side-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 8px 8px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: 0;
  color: var(--ink);
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  position: relative;
}

.nav:hover {
  background: #121a55;
}

.nav.active {
  background: var(--blue);
  box-shadow: inset 3px 0 0 var(--gold);
}

.nav .nm {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav .ct {
  font-size: 12px;
  color: var(--muted);
}

.nav .ct.warn {
  color: #ffb35c;
}

.nav .ico {
  width: 20px;
  text-align: center;
}

.nav .order {
  display: none;
  gap: 2px;
}

.nav:hover .order {
  display: flex;
}

.nav .order span {
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
  color: var(--muted);
}

.nav .order span:hover {
  background: #26307a;
  color: var(--ink);
}

/* On/off switch */

.switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  background: #2a3170;
  transition: background 0.15s;
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #c7cbf0;
  transition: transform 0.15s;
}

.switch.on {
  background: var(--gold);
}

.switch.on::after {
  transform: translateX(14px);
  background: #000;
}

.add-cat {
  width: 100%;
  margin-top: 8px;
  border-style: dashed;
  background: transparent;
}

/* ----- Main ----- */

.ed-main {
  padding: 22px 28px 80px;
  max-width: 980px;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.page-head h1,
.page-head input.title {
  font-family: Anton, Impact, sans-serif;
  font-weight: 400;
  font-size: 34px;
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.page-head input.title {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 2px 8px;
  margin-left: -9px;
  flex: 1;
  min-width: 200px;
}

.page-head input.title:hover {
  border-color: var(--line);
}

.page-head input.title:focus {
  border-color: var(--gold);
  outline: none;
  background: #0a0f38;
}

.sub {
  color: var(--muted);
  margin: 0 0 20px;
  line-height: 1.5;
}

.onboard-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 600;
}

/* Question cards */

.qcard {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: border-color 0.15s, opacity 0.15s;
}

.qcard:hover {
  border-color: #3b4699;
}

.qcard.off {
  opacity: 0.55;
}

.qcard.off:hover {
  opacity: 0.85;
}

.qcard.editing {
  border-color: var(--gold);
  opacity: 1;
  grid-template-columns: minmax(0, 1fr);
}

.pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
}

.check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid #4a55b0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: 900;
  font-size: 14px;
  padding: 0;
}

.check.on {
  background: var(--gold);
  border-color: var(--gold);
}

.pill {
  font-family: Anton, Impact, sans-serif;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.pill.extra {
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.qbody {
  cursor: pointer;
  min-width: 0;
}

.qbody .qt {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-line;
}

.qbody .at {
  color: var(--green);
  font-weight: 700;
  margin-top: 4px;
  white-space: pre-line;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #1a2266;
  color: var(--muted);
  border: 1px solid #28307a;
}

.tag-chip.kind {
  background: #3a3000;
  color: #ffe98a;
  border-color: #6b5800;
}

.tag-chip.twist {
  background: #3d0a14;
  color: #ffb3bc;
  border-color: #6b1424;
}

.tag-chip.pic {
  background: #0c3b22;
  color: #9ff0bf;
  border-color: #1b6b3c;
}

.pic-field {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed #3b4699;
  border-radius: 12px;
}

.pic-lbl {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.pic-lbl small,
.pic-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}

.pic-preview {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  justify-self: start;
  border-radius: 8px;
  background: #fff;
}

.form label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form label.inline select {
  width: auto;
}

.tag-chip.cat {
  background: var(--blue);
  color: var(--ink);
  border-color: #2a3cd0;
}

.qacts {
  display: flex;
  gap: 2px;
  opacity: 0.6;
}

.qcard:hover .qacts {
  opacity: 1;
}

.qacts button {
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 14px;
  padding: 6px 7px;
  border-radius: 6px;
}

.qacts button:hover {
  background: #1f2a80;
}

.qacts button:disabled {
  opacity: 0.25;
  background: none;
}

/* Edit form */

.form {
  display: grid;
  gap: 12px;
}

.form label {
  display: grid;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.form label small {
  display: block;
  margin-top: -3px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.form textarea,
.form input,
.form select {
  width: 100%;
  font-size: 15px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.form textarea {
  background: #0a0f38;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 15px;
  resize: vertical;
  min-height: 44px;
}

.form textarea:focus,
.form input:focus,
.form select:focus {
  outline: none;
  border-color: var(--gold);
}

.form .ans textarea {
  color: var(--green);
  font-weight: 700;
}

.form .two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.add-q {
  width: 100%;
  padding: 14px;
  border: 1px dashed #3b4699;
  background: transparent;
  color: var(--muted);
  border-radius: 14px;
  font-weight: 700;
}

.add-q:hover {
  color: var(--ink);
  border-color: var(--gold);
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 18px 0 10px;
}

.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Board overview */

.mini-board {
  overflow-x: auto;
  display: grid;
  gap: 4px;
  background: #000;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 18px;
}

.mb-cat,
.mb-cell {
  background: var(--blue);
  border-radius: 4px;
  padding: 8px 6px;
  text-align: center;
  min-width: 0;
}

.mb-cat {
  font-family: Oswald, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mb-cell {
  cursor: pointer;
  text-align: left;
  font-size: 11px;
  line-height: 1.3;
  color: #cfd5ff;
  min-height: 74px;
  border: 0;
}

.mb-cell b {
  display: block;
  font-family: Anton, Impact, sans-serif;
  font-weight: 400;
  color: var(--gold);
  font-size: 15px;
  margin-bottom: 2px;
}

.mb-cell .snip {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mb-cell:hover,
.mb-cat:hover {
  outline: 2px solid var(--gold);
}

.mb-cell.missing {
  background: #1a1f45;
  color: #ffb35c;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stat-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 130px;
}

.stat b {
  display: block;
  font-family: Anton, Impact, sans-serif;
  font-weight: 400;
  font-size: 26px;
  color: var(--gold);
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.warnbox {
  background: #3a2600;
  border: 1px solid #8a5a00;
  color: #ffd79a;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #4a55b0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radio.on {
  border-color: var(--gold);
}

.radio.on::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 10px;
}

/* Toast + modal */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1b2570;
  border: 1px solid #3b4699;
  color: var(--ink);
  padding: 10px 12px 10px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 60;
}

.toast[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
  padding: 16px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  width: min(460px, 100%);
}

.modal h2 {
  margin: 0 0 6px;
  font-family: Anton, Impact, sans-serif;
  font-weight: 400;
  color: var(--gold);
}

.qr {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.qr canvas,
.qr img {
  background: #fff;
  padding: 10px;
  border-radius: 10px;
  max-width: 100%;
}

.only-phone {
  display: none;
}

.side-backdrop {
  display: none;
}

.nav .ct {
  max-width: 45%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

* {
  scrollbar-color: #2a3170 transparent;
}

/* ----- Phone ----- */

@media (max-width: 899px) {
  .only-phone {
    display: inline-block;
  }

  .ed-top {
    flex-wrap: wrap;
    padding: 8px 12px;
  }

  .search {
    order: 10;
    flex: 1 1 100%;
  }

  .saved {
    display: none;
  }

  .ed-body {
    grid-template-columns: 1fr;
  }

  .side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 86vw);
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.6);
  }

  .side.open {
    transform: none;
  }

  .side-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
  }

  .nav .order {
    display: flex;
  }

  .ed-main {
    padding: 16px 12px 80px;
  }

  .page-head h1,
  .page-head input.title {
    font-size: 26px;
  }

  .qcard {
    padding: 10px;
    gap: 10px;
  }

  .qacts {
    opacity: 1;
    flex-direction: column;
  }

  .form .two {
    grid-template-columns: 1fr;
  }

  .mini-board {
    overflow-x: auto;
  }

  .mb-cell {
    min-height: 60px;
    font-size: 10px;
  }
}

/* One picture in a question's picture list */

.pic-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.pic-item .pic-preview {
  max-width: 180px;
  max-height: 140px;
}

.pic-item-ctl {
  display: grid;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}
