/* Quiz, editorial luxury */

.quiz-take, .quiz-dashboard {
  max-width: 720px;
  margin: 0 auto;
  padding: 140px 24px 80px;
}
.editor-hero + .quiz-dashboard { padding-top: 32px; }

/* Split-pane quiz builder, fills the screen */
.quiz-builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: calc(100vh - 76px);
  gap: 0;
}
.qb-controls {
  padding: 36px 32px 80px;
  border-right: 1px solid var(--bd);
  background: var(--bg2);
  overflow-y: auto;
  max-height: calc(100vh - 76px);
}
.qb-preview-pane {
  background: var(--bg);
  position: sticky; top: 76px;
  max-height: calc(100vh - 76px);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.qb-preview-toolbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--bd);
  background: var(--bg2);
}
.qb-preview-tabs {
  display: flex; gap: 4px; flex: 1;
}
.qb-preview-tab {
  padding: 7px 14px; border-radius: 100px;
  background: transparent;
  border: 1px solid var(--bd);
  font-family: var(--font); font-size: 0.78rem; font-weight: 500;
  color: var(--t3);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.qb-preview-tab:hover { color: var(--t1); border-color: var(--t3); }
.qb-preview-tab.is-active {
  background: var(--t1); color: var(--bg2);
  border-color: var(--t1);
}
.dark .qb-preview-tab.is-active { background: var(--bg2); color: var(--t1); border-color: var(--bg2); }
.qb-preview-close {
  display: none;
  background: transparent; border: 1px solid var(--bd);
  width: 36px; height: 36px; border-radius: 100px;
  cursor: pointer; color: var(--t2);
  align-items: center; justify-content: center;
}
.qb-preview-close svg { width: 14px; height: 14px; }
.qb-preview-frame {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px 60px;
  display: flex; align-items: flex-start; justify-content: center;
}
.qb-preview-card {
  width: 100%; max-width: 460px;
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: 24px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.qb-head { text-align: left; margin-bottom: 24px; }

/* Your quizzes, recovery list */
.qb-history {
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
}
.qb-history-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
}
.qb-history-list { display: flex; flex-direction: column; gap: 4px; }
.qb-history-row {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 12px;
  background: var(--bg2);
  border: 1px solid var(--bd2);
  text-decoration: none; color: var(--t1);
  transition: all 0.18s var(--ease);
}
.qb-history-row:hover { border-color: var(--accent); transform: translateY(-1px); }
.qb-history-title {
  font-family: var(--display);  font-weight: 600;
  font-size: 0.94rem; color: var(--t1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qb-history-meta {
  font-family: var(--mono); font-size: 0.66rem;
  letter-spacing: 0.08em; color: var(--t3); text-transform: uppercase;
}
.qb-history-arrow {
  width: 24px; height: 24px; border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--t3);
}
.qb-history-arrow svg { width: 11px; height: 11px; }
.qb-history-row:hover .qb-history-arrow { background: var(--accent); color: white; }
.qb-eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--t3); margin-bottom: 18px;
}
.qb-title {
  font-family: var(--display);
  font-weight: 600; font-style: normal;
  font-size: clamp(2rem, 3.6vw, 2.8rem);
  line-height: 1.04; letter-spacing: -0.025em;
  color: var(--t1); margin-bottom: 12px;
}
.qb-title em {  color: var(--accent); }
.qb-sub {
  font-size: 1.05rem; line-height: 1.55;
  color: var(--t3); max-width: 520px;
}

.qb-card {
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 22px;
  padding: 22px;
  margin-bottom: 14px;
}

.qb-field { display: block; margin-bottom: 18px; }
.qb-field:last-child { margin-bottom: 0; }
.qb-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--t3); margin-bottom: 8px;
}
.qb-hint {
  text-transform: none; letter-spacing: 0;
  font-family: var(--font); font-size: 0.78rem;
  color: var(--t4); font-weight: 400;
}
.qb-field input,
.qb-field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 13px 16px;
  font-family: var(--font); font-size: 0.95rem;
  color: var(--t1);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.qb-field input:focus,
.qb-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.qb-field textarea { resize: vertical; min-height: 60px; }

.qb-accent-row { display: flex; gap: 10px; flex-wrap: wrap; }
.qb-accent {
  width: 36px; height: 36px; border-radius: 100px;
  background: transparent; border: 2px solid transparent;
  cursor: pointer; padding: 3px;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.qb-accent span {
  display: block; width: 100%; height: 100%;
  border-radius: 100px; background: var(--c);
}
.qb-accent.is-active { border-color: var(--c); transform: scale(1.08); }
.qb-accent:hover:not(.is-active) { transform: scale(1.05); }

.qb-section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px;
}
.qb-counter {
  font-family: var(--mono); font-size: 0.72rem;
  letter-spacing: 0.08em; color: var(--t3);
}

/* Question card */
.q-card {
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 14px;
  position: relative;
}
.q-card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.q-num {
  font-family: var(--mono);
  font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.18em; color: var(--t3);
}
.q-num::before { content: ""; margin-right: 8px; color: var(--t4); }
.q-remove {
  background: transparent; border: none; cursor: pointer;
  width: 30px; height: 30px; border-radius: 100px;
  color: var(--t4); display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.q-remove:hover { background: rgba(225, 29, 72, 0.1); color: #e11d48; }
.q-remove svg { width: 14px; height: 14px; }

.q-text {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--bd);
  padding: 8px 2px 14px;
  font-family: var(--display);  font-weight: 600;
  font-size: 1.2rem; color: var(--t1);
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.q-text:focus { outline: none; border-bottom-color: var(--accent); }

.q-options { display: flex; flex-direction: column; gap: 8px; }
.q-option {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2);
  border: 1.5px solid var(--bd);
  border-radius: 14px;
  padding: 12px 14px;
  transition: all 0.18s var(--ease);
  position: relative;
}
.q-option.is-correct {
  border-color: var(--accent);
  background: var(--accent-light);
}
.q-option-radio {
  width: 22px; height: 22px; border-radius: 100px;
  border: 1.5px solid var(--bd);
  flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s var(--ease);
  background: var(--bg);
}
.q-option.is-correct .q-option-radio {
  border-color: var(--accent); background: var(--accent);
}
.q-option.is-correct .q-option-radio::after {
  content: ""; width: 8px; height: 8px; border-radius: 100px;
  background: white;
}
.q-option-input {
  flex: 1;
  background: transparent;
  border: none;
  font-family: var(--font); font-size: 0.92rem;
  color: var(--t1);
}
.q-option-input:focus { outline: none; }
.q-option-input::placeholder { color: var(--t4); }
.q-option-remove {
  background: transparent; border: none; cursor: pointer;
  color: var(--t4);
  width: 26px; height: 26px; border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.q-option-remove:hover { color: var(--t1); background: var(--bg3); }
.q-option-remove svg { width: 14px; height: 14px; }

.q-add-option {
  background: transparent; border: 1px dashed var(--bd);
  color: var(--t3); cursor: pointer;
  padding: 10px 14px; border-radius: 14px;
  font-family: var(--mono); font-size: 0.7rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  transition: all 0.18s var(--ease);
  margin-top: 4px;
}
.q-add-option:hover { color: var(--accent); border-color: var(--accent); }

.qb-add {
  width: 100%;
  background: transparent;
  border: 1.5px dashed var(--bd);
  color: var(--t2);
  cursor: pointer;
  padding: 18px 16px;
  border-radius: 18px;
  font-family: var(--font); font-size: 0.92rem; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s var(--ease);
}
.qb-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.qb-add svg { width: 16px; height: 16px; }

.qb-actions { margin-top: 30px; text-align: center; }
.qb-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 14px 14px 24px; border-radius: 100px;
  background: var(--t1); color: var(--bg2);
  font-family: var(--font); font-size: 0.95rem; font-weight: 500;
  letter-spacing: -0.005em;
  border: none; cursor: pointer;
  transition: all 0.36s var(--ease);
}
.dark .qb-cta { background: var(--bg2); color: var(--t1); }
.qb-cta:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -10px rgba(26, 22, 20, 0.4); }
.qb-cta:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Modal */
.qb-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(26, 22, 20, 0.45);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: modalIn 0.32s var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.qb-modal[hidden] { display: none; }
.qb-modal-card {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: 28px;
  padding: 36px;
  max-width: 500px; width: 100%;
  box-shadow: var(--shadow-deep);
  animation: cardIn 0.4s var(--ease);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.qb-modal-title {
  font-family: var(--display); font-weight: 600;
  font-size: 2rem; line-height: 1.05; letter-spacing: -0.02em;
  color: var(--t1); margin: 12px 0 8px;
}
.qb-modal-title em {  color: var(--accent); }
.qb-modal-sub { font-size: 0.96rem; color: var(--t3); margin-bottom: 22px; line-height: 1.5; }

.qb-link-box {
  display: flex; gap: 10px; margin-bottom: 22px;
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 6px;
}
.qb-link-box input {
  flex: 1; background: transparent; border: none;
  padding: 8px 10px;
  font-family: var(--mono); font-size: 0.86rem; color: var(--t1);
}
.qb-link-box input:focus { outline: none; }
.qb-copy {
  padding: 8px 18px; border-radius: 100px;
  background: var(--accent); color: white;
  border: none; cursor: pointer;
  font-family: var(--font); font-size: 0.84rem; font-weight: 500;
  transition: all 0.2s;
}
.qb-copy:hover { background: var(--accent-hover, var(--accent)); transform: translateY(-1px); }
.qb-copy.is-copied { background: var(--green, #059669); }

.qb-modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.qb-modal-btn {
  flex: 1; padding: 13px 18px; border-radius: 100px;
  font-family: var(--font); font-size: 0.88rem; font-weight: 500;
  text-align: center; transition: all 0.24s var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.qb-modal-btn-primary { background: var(--t1); color: var(--bg2); }
.qb-modal-btn-secondary { background: var(--bg3); color: var(--t1); }
.qb-modal-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -8px rgba(26, 22, 20, 0.3); }

/* === Take quiz === */
.qt-wrap { max-width: 640px; margin: 0 auto; padding: 100px 24px 80px; }
.qt-progress {
  height: 4px; background: var(--bd);
  border-radius: 100px; overflow: hidden;
  margin-bottom: 32px;
}
.qt-progress-bar {
  height: 100%; background: var(--accent);
  width: 0%; transition: width 0.45s var(--ease);
}
.qt-creator-card {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: 24px;
  padding: 36px 28px;
  text-align: center;
  margin-bottom: 28px;
}
.qt-eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--t3);
}
.qt-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.05; letter-spacing: -0.025em;
  color: var(--t1); margin: 14px 0 10px;
}
.qt-title em {  color: var(--accent); }
.qt-intro { font-size: 1rem; color: var(--t3); margin-bottom: 22px; line-height: 1.55; }

.qt-name-input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--bd);
  border-radius: 14px;
  padding: 14px 18px;
  font-family: var(--font); font-size: 0.96rem;
  color: var(--t1);
  text-align: center;
  margin-bottom: 14px;
}
.qt-name-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.qt-start-btn {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border-radius: 100px;
  background: var(--t1); color: var(--bg2);
  font-family: var(--font); font-size: 0.95rem; font-weight: 500;
  border: none; cursor: pointer;
  transition: all 0.24s var(--ease);
}
.qt-start-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -10px rgba(26,22,20,0.35); }

/* Question card */
.qt-question-card {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: 24px;
  padding: 36px 28px;
  animation: qIn 0.45s var(--ease);
}
@keyframes qIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.qt-q-num {
  font-family: var(--mono);
  font-size: 0.7rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--t3);
}
.qt-q-num::before { content: ""; margin-right: 8px; color: var(--t4); }

.qt-q-text {
  font-family: var(--display);  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1.2;
  color: var(--t1); margin: 14px 0 24px; letter-spacing: -0.015em;
}

.qt-options { display: flex; flex-direction: column; gap: 10px; }
.qt-option {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg);
  border: 1.5px solid var(--bd);
  border-radius: 16px;
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font); font-size: 0.96rem; font-weight: 500;
  color: var(--t1);
  transition: all 0.2s var(--ease);
}
.qt-option:hover { border-color: var(--accent); background: var(--accent-light); }
.qt-option-letter {
  width: 28px; height: 28px; border-radius: 100px;
  background: var(--bg3); color: var(--t2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 0.78rem; font-weight: 500;
  flex-shrink: 0;
  transition: all 0.2s var(--ease);
}
.qt-option:hover .qt-option-letter { background: var(--accent); color: white; }

.qt-results-card {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: 24px;
  padding: 40px 28px;
  text-align: center;
  margin-bottom: 24px;
}
.qt-score-ring {
  width: 160px; height: 160px;
  margin: 0 auto 20px;
  position: relative;
}
.qt-score-ring svg { transform: rotate(-90deg); }
.qt-score-ring-track { fill: none; stroke: var(--bd); stroke-width: 8; }
.qt-score-ring-fill { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray 0.8s var(--ease); }
.qt-score-ring-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
}
.qt-score-num {
  font-family: var(--display);  font-weight: 600;
  font-size: 2.6rem; line-height: 1; color: var(--t1);
}
.qt-score-label { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--t3); margin-top: 4px; }

.qt-verdict {
  font-family: var(--display);  font-weight: 600;
  font-size: 1.6rem; color: var(--t1); margin-bottom: 8px;
}
.qt-verdict-sub { color: var(--t3); }

/* Leaderboard */
.qt-leaderboard {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: 24px;
  padding: 24px;
}
.qt-lb-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 6px 12px;
  border-bottom: 1px solid var(--bd);
  margin-bottom: 6px;
}
.qt-lb-title { font-family: var(--display);  font-weight: 600; font-size: 1.2rem; }
.qt-lb-row {
  display: grid; grid-template-columns: 32px 1fr auto;
  gap: 12px; align-items: center;
  padding: 12px 6px;
  border-bottom: 1px solid var(--bd2);
}
.qt-lb-row:last-child { border-bottom: none; }
.qt-lb-rank {
  font-family: var(--mono); font-size: 0.78rem; color: var(--t3);
}
.qt-lb-row.is-you { background: var(--accent-light); border-radius: 12px; padding: 12px; margin: 0 -6px; }
.qt-lb-row.is-you .qt-lb-rank { color: var(--accent); font-weight: 600; }
.qt-lb-name { font-weight: 500; color: var(--t1); }
.qt-lb-score { font-family: var(--mono); color: var(--t2); font-size: 0.84rem; }
.qt-lb-medal { font-size: 1rem; }

/* Dashboard */
.qd-header {
  margin-bottom: 32px;
}
.qd-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
.qd-stat {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: 18px;
  padding: 18px;
  text-align: center;
}
.qd-stat-num {
  font-family: var(--display);  font-weight: 600;
  font-size: 2.2rem; line-height: 1; color: var(--t1);
}
.qd-stat-label {
  font-family: var(--mono); font-size: 0.66rem;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--t3); margin-top: 6px;
}

@media (max-width: 1024px) {
  .quiz-builder-grid {
    grid-template-columns: 1fr;
  }
  .qb-controls {
    border-right: none;
    border-bottom: 1px solid var(--bd);
    max-height: none;
    padding: 28px 20px 100px;
  }
  .qb-preview-pane {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: var(--bg);
    transform: translateX(100%);
    transition: transform 0.32s var(--ease);
    max-height: none;
  }
  .qb-preview-pane.is-open { transform: translateX(0); }
  .qb-preview-close { display: inline-flex; }
  #mobile-preview-btn { display: inline-flex; }
  /* Floating preview FAB always visible on mobile */
  .qb-preview-fab {
    position: fixed;
    bottom: 20px; right: 20px;
    z-index: 800;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 12px 18px; border-radius: 100px;
    background: var(--t1); color: var(--bg2);
    font-family: var(--font); font-size: 0.86rem; font-weight: 500;
    border: none; cursor: pointer;
    box-shadow: 0 16px 32px -10px rgba(26, 22, 20, 0.3);
  }
  .qb-preview-fab svg { width: 14px; height: 14px; }
}
@media (min-width: 1025px) {
  .qb-preview-fab { display: none !important; }
}
@media (min-width: 1025px) {
  #mobile-preview-btn { display: none !important; }
  .qb-preview-close { display: none !important; }
}

@media (max-width: 720px) {
  .quiz-take, .quiz-dashboard { padding: 100px 16px 40px; }
  .qb-controls { padding: 22px 16px 60px; }
  .qb-card { padding: 18px 16px; border-radius: 18px; }
  .qb-preview-frame { padding: 20px 16px 60px; }
  .qb-preview-card { padding: 26px 20px; border-radius: 20px; }
  .qd-stats { grid-template-columns: 1fr; }
  .qb-title { font-size: clamp(1.7rem, 7vw, 2.2rem); }
}

/* Quiz dashboard analytics, question insight rows */
.qd-insight {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--bd);
}
.qd-insight:last-child { border-bottom: none; padding-bottom: 0; }
.qd-insight:first-child { padding-top: 0; }
.qd-insight-icon {
  width: 36px; height: 36px; border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.qd-insight-icon svg { width: 16px; height: 16px; }
.qd-insight-text { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.qd-insight-label {
  font-family: var(--mono); font-size: 0.62rem;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--t3);
}
.qd-insight-q {
  font-family: var(--display);  font-weight: 600;
  font-size: 1.05rem; color: var(--t1); line-height: 1.3;
  letter-spacing: -0.01em;
}
.qd-insight-meta {
  font-size: 0.78rem; color: var(--t3);
}
