/* MM-Play Quiz — Host Panel layout */
.quiz-pick { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin: 18px 0 22px; }
.pick {
  text-align: left; padding: 18px; border-radius: 16px; cursor: pointer;
  background: var(--surface-2); border: 2px solid var(--line); transition: .18s;
}
.pick:hover { border-color: var(--lavender); transform: translateY(-2px); }
.pick.selected { border-color: var(--lavender-deep); background: linear-gradient(135deg, rgba(167,139,250,.10), rgba(247,168,196,.10)); }
.pick .pe { font-size: 26px; }
.pick .pt { font-weight: 800; font-size: 15px; margin: 6px 0 2px; }
.pick .pd { font-size: 12px; color: var(--muted); font-weight: 600; }

.resume {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(135deg, #fff7e6, #fff); border: 1px dashed #f0b429;
  border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; font-size: 13.5px;
}
.resume b { color: #b8862a; }
.resume .btn { padding: 8px 14px; font-size: 13px; }

.foot-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.foot-actions .btn-block { flex: 1; }
.empty-hint { text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; padding: 18px 0; }

@media (max-width: 760px) {
  .quiz-pick { grid-template-columns: 1fr; }
  .foot-actions { flex-direction: column; }
  .foot-actions .btn-block { width: 100%; }
  .builder-meta { grid-template-columns: 1fr !important; }
  .q-edit { padding: 14px !important; }
  .q-edit-grid { grid-template-columns: 1fr !important; }
}

/* ---------- setup tabs ---------- */
.setup-tabs { display: flex; gap: 6px; margin-bottom: 18px; background: var(--surface-2); border-radius: 12px; padding: 5px; }
.stab {
  flex: 1; padding: 10px; border-radius: 9px; font-weight: 700; font-size: 13.5px;
  color: var(--text-soft); transition: .18s;
}
.stab.active { background: #fff; color: var(--lavender-deep); box-shadow: var(--shadow-sm); }
.stab:hover:not(.active) { color: var(--text); }
.stab-pane { display: none; }
.stab-pane.active { display: block; }

/* ---------- custom list ---------- */
.cquiz-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line-soft); margin-bottom: 10px; transition: .18s;
}
.cquiz-item:hover { border-color: var(--lavender); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.cq-emoji { font-size: 24px; width: 40px; height: 40px; border-radius: 11px; background: #fff; display: grid; place-items: center; flex-shrink: 0; }
.cq-body { flex: 1; min-width: 0; }
.cq-title { font-weight: 700; font-size: 14.5px; }
.cq-meta { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.cq-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cq-actions .btn { padding: 7px 12px; font-size: 12px; }

/* ---------- builder ---------- */
.builder-card { max-width: 720px; margin: 0 auto; }
.builder-meta { display: grid; grid-template-columns: 1fr 80px; gap: 12px; margin-bottom: 18px; }
.field-emoji input { text-align: center; font-size: 22px; }
.builder-list { display: flex; flex-direction: column; gap: 14px; max-height: 460px; overflow-y: auto; padding-right: 4px; }
.q-edit {
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 16px; padding: 18px;
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.q-edit-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.q-num { width: 28px; height: 28px; border-radius: 8px; background: var(--lavender-deep); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; flex-shrink: 0; }
.q-edit-head .field { flex: 1; margin: 0; }
.q-del { padding: 6px 10px; font-size: 12px; }
.q-edit textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 13px;
  font-size: 14px; font-weight: 600; background: #fff; outline: none; transition: .18s; resize: vertical; min-height: 56px; font-family: inherit;
}
.q-edit textarea:focus { border-color: var(--lavender); box-shadow: 0 0 0 4px rgba(167,139,250,.14); }

/* image upload */
.q-img-area { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.q-img-preview {
  width: 80px; height: 80px; border-radius: 10px; border: 2px dashed var(--line); overflow: hidden;
  display: grid; place-items: center; background: #fff; flex-shrink: 0;
}
.q-img-preview img { width: 100%; height: 100%; object-fit: cover; }
.q-img-preview .ph { font-size: 22px; color: var(--muted); }
.q-img-btns { display: flex; flex-direction: column; gap: 6px; }
.q-img-btn { padding: 7px 12px; font-size: 12px; border-radius: 9px; background: #fff; border: 1.5px solid var(--line); color: var(--text-soft); font-weight: 700; transition: .15s; cursor: pointer; }
.q-img-btn:hover { border-color: var(--lavender); color: var(--lavender-deep); }

/* options */
.q-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.q-opt-edit {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 11px;
  border: 2px solid var(--line); background: #fff; transition: .15s; cursor: pointer;
}
.q-opt-edit.correct { border-color: #4cb782; background: #f0fbf4; }
.q-opt-edit input { border: none; outline: none; background: none; flex: 1; font-size: 13.5px; font-weight: 600; color: var(--text); }
.q-opt-radio {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0;
  display: grid; place-items: center; transition: .15s; font-size: 12px; color: transparent;
}
.q-opt-edit.correct .q-opt-radio { background: #4cb782; border-color: #4cb782; color: #fff; }
.q-opt-shape { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0; }
.s-red { background: #e8685a; } .s-blue { background: #4d9de0; } .s-yellow { background: #f0b429; } .s-green { background: #4cb782; }

/* scrollbar builder */
.builder-list::-webkit-scrollbar { width: 6px; }
.builder-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }

/* ---------- login ---------- */
.login-card { max-width: 440px; margin: 0 auto; }
.login-emoji { font-size: 50px; margin-bottom: 10px; }
.join-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 700; color: var(--text-soft); }
.field input {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 16px;
  font-size: 15px; font-weight: 600; background: var(--surface); outline: none; transition: .18s;
}
.field input:focus { border-color: var(--lavender); box-shadow: 0 0 0 4px rgba(167,139,250,.14); }
.field input::placeholder { color: var(--muted); font-weight: 500; }
.err { color: #c64a3a; font-size: 13px; font-weight: 700; background: #fff0ef; border: 1px solid #f6c9c2; padding: 8px 12px; border-radius: 10px; }
.login-hint { text-align: center; margin-top: 16px; font-size: 12px; color: var(--muted); font-weight: 600; }
.logout-btn { padding: 8px 14px; font-size: 13px; }

/* ---------- history leaderboard ---------- */
.history-card { max-width: 760px; margin: 0 auto; }
.history-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.history-head h1 { margin-bottom: 2px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.history-list { display: flex; flex-direction: column; gap: 18px; margin: 20px 0; }
.history-entry { border: 1.5px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.history-entry-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: linear-gradient(135deg, rgba(167,139,250,.10), rgba(247,168,196,.08));
  border-bottom: 1px solid var(--line);
}
.history-entry-head .h-title { font-weight: 800; font-size: 15px; color: var(--text); }
.history-entry-head .h-meta { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.history-entry-head .h-quiz { font-size: 13px; font-weight: 700; color: var(--lavender-deep); background: rgba(167,139,250,.14); padding: 4px 10px; border-radius: 20px; }
.history-brow {
  display: grid; grid-template-columns: 36px 40px 1fr auto;
  align-items: center; gap: 10px; padding: 10px 18px;
  border-bottom: 1px solid var(--line); transition: background .14s;
}
.history-brow:last-child { border-bottom: none; }
.history-brow:hover { background: var(--surface-2); }
.history-brow .rk { font-size: 13px; font-weight: 800; color: var(--muted); text-align: center; }
.history-brow.top-1 .rk { color: #f59e0b; font-size: 16px; }
.history-brow.top-2 .rk { color: #94a3b8; font-size: 15px; }
.history-brow.top-3 .rk { color: #cd7c2f; font-size: 15px; }
.history-brow .av {
  width: 34px; height: 34px; border-radius: 50%; font-size: 12px; font-weight: 800;
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.history-brow .nm { font-weight: 700; font-size: 14px; }
.history-brow .sc { font-weight: 800; font-size: 14px; color: var(--lavender-deep); white-space: nowrap; }
.history-empty { text-align: center; padding: 48px 24px; color: var(--muted); font-weight: 700; font-size: 15px; }
.podium-card .foot-actions { display: flex; gap: 10px; }
.podium-card .foot-actions .btn { flex: 1; }

/* ---------- QR code lobby ---------- */
.qr-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin: 14px 0 10px; padding: 14px; background: #fff;
  border-radius: 16px; border: 1.5px solid var(--line);
}
.qr-wrap canvas { border-radius: 8px; display: block; }
.qr-url { font-size: 10px; color: var(--muted); font-weight: 600; word-break: break-all; text-align: center; max-width: 180px; }
