/* ======================= NHẬT KÝ NHIỆM VỤ ======================= */
/* Cùng khuôn với bảng cửa hàng và cây kỹ năng: lớp phủ toàn màn hình, hộp ở
   giữa, bấm ra ngoài là đóng. Ba bảng khác nhau mà ba cách mở khác nhau thì
   người chơi phải học lại từ đầu mỗi lần. */

#quests {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(6, 9, 16, .72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#quests.hidden { display: none; }

.q-box {
  width: min(780px, 100%);
  max-height: min(86vh, 720px);
  display: flex;
  flex-direction: column;
  background: #0e1524;
  border: 1px solid #2b3651;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}

.q-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #1c2436;
}
.q-head h2 { margin: 0; font-size: 16px; color: #e6e9ef; flex: 1; }
.q-reset { font-size: 11px; color: #6b7791; font-variant-numeric: tabular-nums; }
.q-close {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: 1px solid #2b3651;
  background: #131b2c;
  color: #8b95ab;
  cursor: pointer;
}
.q-close:hover { background: #1b2740; color: #e6e9ef; }

/* ------------------------------------------- Người Chép Sử ----------- */
/* Khối này chỉ có mặt khi bảng được mở từ chỗ ông ta. Bấm J ở giữa Vực Băng thì
   không có gì ở đây cả — và cũng không có nút Nhận tất cả. */

.q-npc {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 14px;
  margin: 12px 16px 0;
  padding: 11px 13px;
  background: #131b2c;
  border: 1px solid #2b3651;
  border-left: 3px solid #7dd3fc;
  border-radius: 10px;
}
.q-npc.hidden { display: none; }
.q-npc-who { font-size: 13px; color: #dbe4f5; }
.q-npc-who span { font-size: 11px; color: #7dd3fc; margin-left: 8px; }
.q-npc-greet {
  grid-column: 1;
  margin: 0;
  font-size: 11.5px;
  font-style: italic;
  color: #8b95ab;
  line-height: 1.5;
}
.q-all {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid #46c46b;
  background: #1d4f33;
  color: #a8f0c0;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.q-all:hover { background: #266641; }
.q-all:disabled {
  border-color: #2b3651;
  background: #131b2c;
  color: #4d5a72;
  cursor: default;
}

.q-tabs { display: flex; gap: 6px; padding: 10px 16px 0; }
.q-tab {
  padding: 7px 14px;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  color: #6b7791;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.q-tab:hover { color: #a9b4ca; }
.q-tab.active { background: #131b2c; border-color: #2b3651; color: #e6e9ef; }

.q-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #2b3651;
}

/* ---------------------------------------------------- một dòng việc ---- */

.q-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 13px;
  background: #131b2c;
  border: 1px solid #2b3651;
  border-radius: 10px;
}
/* Việc bấm được phải nhìn ra ngay từ xa — nó là lý do người chơi mở bảng này */
.q-row.ready { border-color: #46c46b; background: #12211a; }
.q-row.done { opacity: .5; }

.q-main { flex: 1; min-width: 0; }
.q-title { font-size: 13px; font-weight: 600; color: #dbe4f5; display: flex; align-items: center; gap: 7px; }
.q-zone {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #7dd3fc;
  border: 1px solid #2b4a66;
  border-radius: 4px;
  padding: 1px 5px;
}
.q-desc { font-size: 11.5px; color: #8b95ab; line-height: 1.5; margin-top: 2px; }

.q-bar {
  height: 5px;
  border-radius: 3px;
  background: #0b1120;
  border: 1px solid #1c2436;
  overflow: hidden;
  margin: 7px 0 5px;
}
.q-bar > i { display: block; height: 100%; background: #46c46b; }

.q-reward { font-size: 11px; color: #6b7791; display: flex; gap: 8px; flex-wrap: wrap; }
.q-gold { color: #ffd166; }
.q-exp { color: #b18cff; }
.q-book { color: #d3b8f0; }

.q-action { flex: 0 0 auto; display: grid; place-items: center; min-width: 96px; }
.q-count { font-size: 12px; color: #8b95ab; font-variant-numeric: tabular-nums; }
.q-claimed { font-size: 11.5px; color: #46c46b; }
.q-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #46c46b;
  background: #1d4f33;
  color: #a8f0c0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.q-btn:hover { background: #266641; }

.q-empty {
  font-size: 12px;
  color: #6b7791;
  line-height: 1.6;
  padding: 20px 14px;
  text-align: center;
}

@media (max-width: 620px) {
  .q-row { flex-direction: column; align-items: stretch; }
  .q-action { min-width: 0; }
  .q-btn { width: 100%; }
}
