:root{
  --bg:#0b0b10;
  --card:#12121a;
  --muted:#9aa0a6;
  --text:#f3f4f6;
  --line:rgba(255,255,255,.10);
  --soft:rgba(255,255,255,.06);
  --soft2:rgba(255,255,255,.10);
  --good:#39d98a;
  --bad:#ff4d4d;
  --shadow: 0 10px 40px rgba(0,0,0,.35);

  --radius:16px;
  --radius2:14px;
}

[data-theme="light"]{
  --bg:#f6f7fb;
  --card:#ffffff;
  --muted:#5b6470;
  --text:#0f172a;
  --line:rgba(15,23,42,.12);
  --soft:rgba(15,23,42,.05);
  --soft2:rgba(15,23,42,.08);
  --shadow: 0 10px 30px rgba(2,6,23,.12);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg);
  color:var(--text);
}

.app{max-width:1200px;margin:0 auto;padding:18px}

.topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 14px;
  border:1px solid var(--line);
  background: var(--card);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  gap:12px;
}

.brand{display:flex;flex-direction:column;gap:2px}
.brand-title{font-weight:900;font-size:18px;letter-spacing:.2px}
.brand-sub{font-size:12px;color:var(--muted)}

.actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

.select{
  background:var(--soft);
  border:1px solid var(--line);
  color:var(--text);
  padding:10px 10px;
  border-radius:12px;
  outline:none;
}

.btn{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: var(--soft2);
  color:var(--text);
  cursor:pointer;
  transition:.12s transform ease, .12s background ease;
}
.btn:hover{transform: translateY(-1px);}
.btn:active{transform: translateY(0px);}
.btn.ghost{background:var(--soft)}
.btn.danger{background: rgba(255,77,77,.14); border-color: rgba(255,77,77,.35);}
.btn.heart{padding:8px 10px; min-width:42px; font-weight:900}

.grid{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:14px;
  margin-top:14px;
}
@media (max-width: 950px){
  .grid{grid-template-columns: 1fr;}
}

.card{
  border:1px solid var(--line);
  background: var(--card);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
}

.card-title{font-weight:900;margin-bottom:10px}

.stats{display:grid;grid-template-columns:1fr;gap:10px}
.stat{
  border:1px solid var(--line);
  border-radius:var(--radius2);
  padding:10px;
  background: var(--soft);
}
.stat-label{font-size:12px;color:var(--muted)}
.stat-value{font-size:18px;font-weight:900;margin-top:4px}

.divider{height:1px;background:var(--line);margin:12px 0}

.note{margin-top:10px;color:var(--muted);font-size:12px;line-height:1.35}

.jump{display:flex;gap:8px}

.input{
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--soft);
  color: var(--text);
  outline:none;
}

/* ✅ Progress + search row */
.progressWrap{
  margin-top:12px;
  border:1px solid var(--line);
  background: var(--card);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  padding:12px;
}
.progressTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.progressText{
  font-weight:800;
  font-size:13px;
  color:var(--muted);
}
.progressBar{
  height:10px;
  background: var(--soft);
  border:1px solid var(--line);
  border-radius:999px;
  overflow:hidden;
}
.progressFill{
  height:100%;
  width:0%;
  background: rgba(57,217,138,.55);
  transition: width .25s ease;
}

/* ✅ Search dropdown */
.searchWrap{position:relative; min-width:260px; flex:1; max-width:520px;}
.search{width:100%;}
.searchDropdown{
  position:absolute;
  top:44px;
  left:0;
  right:0;
  z-index:50;
  border:1px solid var(--line);
  background: var(--card);
  border-radius:14px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.searchItem{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  cursor:pointer;
}
.searchItem:last-child{border-bottom:none;}
.searchItem:hover{background: var(--soft);}
.searchItem .sTop{display:flex;justify-content:space-between;gap:10px}
.searchItem .code{font-weight:900}
.searchItem .txt{color:var(--muted);font-size:12px;margin-top:2px}

/* Question UI */
.qhead{
  display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;
  align-items:flex-start;
}
.qtitle{font-size:16px;font-weight:900}
.qsub{font-size:12px;color:var(--muted);margin-top:4px}
.qmeta{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.pill{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
}

.qtext{
  margin-top:10px;
  padding:12px;
  border-radius:var(--radius2);
  border:1px solid var(--line);
  background: var(--soft);
  line-height:1.35;
}

.answers{display:grid;gap:10px;margin-top:12px}

/* ✅ when answers have images → switch to grid */
.answers.grid2{grid-template-columns:repeat(2, minmax(0,1fr));}
.answers.grid3{grid-template-columns:repeat(3, minmax(0,1fr));}
@media (max-width: 700px){
  .answers.grid2,.answers.grid3{grid-template-columns:1fr;}
}

.answer{
  padding:12px;
  border-radius:var(--radius2);
  border:1px solid var(--line);
  background: var(--soft);
  cursor:pointer;
  transition:.12s transform ease, .12s background ease, .12s border-color ease;
  display:flex;
  gap:10px;
  align-items:flex-start;
}
.answer:hover{transform: translateY(-1px);}
.answer .opt{font-weight:900;min-width:26px}
.answer.correct{border-color: rgba(57,217,138,.6); background: rgba(57,217,138,.12);}
.answer.wrong{border-color: rgba(255,77,77,.6); background: rgba(255,77,77,.12);}
.answer.locked{cursor:default; opacity:.98}

.answerMedia{
  width:100%;
  max-width:240px;
  border-radius:12px;
  border:1px solid var(--line);
  display:block;
}

.controls{
  display:flex;gap:10px;justify-content:space-between;flex-wrap:wrap;
  margin-top:14px;
}
.jsonbox{
  margin-top:12px;
  background: rgba(0,0,0,.18);
  border:1px solid var(--line);
  border-radius:var(--radius2);
  padding:10px;
  overflow:auto;
  max-height:260px;
  color: rgba(255,255,255,.92);
}
[data-theme="light"] .jsonbox{background: rgba(15,23,42,.06); color: rgba(15,23,42,.92);}

.footerhint{margin-top:10px;color:var(--muted);font-size:12px}

/* ✅ Media slot + skeleton shimmer */
.mediaSlot{margin-top:12px;}
.mediaWrap{
  border-radius:var(--radius2);
  overflow:hidden;
  border:1px solid var(--line);
  background: var(--soft);
}
.qMedia{
  width:100%;
  display:block;
  max-height:420px;
  object-fit:contain;
  background: transparent;
}
.skeleton{
  position:relative;
  overflow:hidden;
  background: var(--soft);
  border:1px solid var(--line);
  border-radius:var(--radius2);
}
.skeleton::after{
  content:"";
  position:absolute;
  inset:0;
  transform: translateX(-60%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.20), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer{
  0%{transform: translateX(-60%);}
  100%{transform: translateX(60%);}
}

/* ✅ Modal */
.modalBackdrop{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.45);
  z-index:200;
}
.modal{
  position:fixed;
  top:50%;
  left:50%;
  transform: translate(-50%,-50%);
  width:min(520px, calc(100% - 24px));
  background: var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow: var(--shadow);
  z-index:210;
}
.modalHead{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 12px;
  border-bottom:1px solid var(--line);
}
.modalTitle{font-weight:900}
.modalBody{padding:12px; display:grid; gap:10px;}
.settingRow{padding:10px;border:1px solid var(--line);border-radius:14px;background:var(--soft);}
.row{display:flex;gap:10px;align-items:center}
.tinyNote{color:var(--muted);font-size:12px;margin-top:2px}
