/* quests.theme.css — Quests · ชั้นธีมใหม่ (แยกจาก theme2.css เดิม)
   ลำดับ <link> ใน index.html มีผลต่อการทับกันของกฎ — ไฟล์ชั้นเดียวกันเรียงตามเลขส่วน */
/* ===== หน้าเควสหน้าตาใหม่ (Beta 0.22.0) — เต็มจอ ธีมเดียวกับหน้ากาชา/แบทเทิลพาส =====
   ยังเป็นหน้าต่าง .q-modal เดิม (openQuests/closeQuests ไม่เปลี่ยน) แต่ขยายเต็มจอ
   ใช้คลาส .q2-* ทั้งหมด · โหมดไม่ล็อกอิน (quests-local.js) ใช้ชุดเดียวกันตั้งแต่ Beta 0.22.1 */
.sk-modal.q2-modal {
  background: none;
  display: block;
}
.q2 {
  --q2-ink: #3b4255;
  --q2-soft: #6b7285;
  --q2-pink: #e86a92;
  --q2-side: max(40vh, 240px);
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: var(--q2-ink);
  font-family: Mali, Sarabun, sans-serif;
  background:
    repeating-linear-gradient(90deg, #3b425508 0 1px, transparent 1px 12vh),
    repeating-linear-gradient(0deg, #3b425508 0 1px, transparent 1px 12vh),
    linear-gradient(160deg, #fbf6f1, #efe7ea 60%, #e9e3ea);
}
.q2 button {
  font: inherit;
  cursor: pointer;
}

/* ---------- แถบบน ---------- */
.q2-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 11vh;
  display: flex;
  align-items: center;
  gap: 1.4vh;
  padding: 0 2.4vh;
  background: linear-gradient(#fffaf2f0, #fffaf200);
  z-index: 3;
}
.q2-crumb {
  font: 800 max(14px, 2.6vh) / 1 Mali, sans-serif;
  white-space: nowrap;
}
.q2-tabs {
  display: flex;
  gap: 1.8vh; /* เว้นที่ให้ป้ายตัวเลขที่มุมแท็บ ไม่ทับคำของแท็บถัดไป */
  margin-left: 1.4vh;
}
.q2-tabs button {
  position: relative;
  padding: max(5px, 1vh) max(10px, 1.8vh);
  border: 0;
  border-radius: 99px;
  background: #ffffffd0;
  color: var(--q2-ink);
  box-shadow: 0 0.3vh 0.6vh #0001;
  font: 800 max(12px, 1.9vh) / 1 Mali, sans-serif !important;
  white-space: nowrap;
}
.q2-tabs button:has(i) {
  padding-right: max(16px, 2.8vh); /* ป้ายตัวเลขอยู่มุมขวา — เว้นที่ไม่ให้ทับคำ */
}
.q2-tabs button.on {
  background: var(--q2-ink);
  color: #fff;
}
.q2-tabs i {
  position: absolute;
  top: -0.8vh;
  right: -0.6vh;
  min-width: max(16px, 2.4vh);
  height: max(16px, 2.4vh);
  padding: 0 0.5vh;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: #e5484d;
  color: #fff;
  font: 800 max(10px, 1.4vh) / 1 Sarabun, sans-serif;
  font-style: normal;
}
.q2-cur {
  display: inline-flex;
  align-items: center;
  gap: 0.4vh;
  padding: 0.5vh 1.2vh 0.5vh 0.5vh;
  border-radius: 99px;
  background: #3b4255d8;
  color: #fff;
  font: 800 max(12px, 1.9vh) / 1 Georgia, serif;
  white-space: nowrap;
}
.q2-cur:first-of-type {
  margin-left: auto;
}
.q2-cur img {
  width: max(16px, 2.8vh);
  height: max(16px, 2.8vh);
  object-fit: contain;
}
.q2-msg {
  position: absolute;
  inset: 11vh 0 0;
  display: grid;
  place-items: center;
  margin: 0;
  font: 700 max(14px, 2.4vh) / 1.4 Sarabun, sans-serif;
  color: var(--q2-soft);
}

/* ---------- ซ้าย: เวลารีเซ็ต · ความคืบหน้า · โบนัส ---------- */
.q2-side {
  position: absolute;
  left: 2.4vh;
  top: 12vh;
  bottom: 2.4vh;
  width: var(--q2-side);
  display: flex;
  flex-direction: column;
  gap: 1.2vh;
  overflow-y: auto;
  scrollbar-width: none;
}
.q2-card {
  flex: none;
  padding: 1.4vh 1.6vh;
  border-radius: 1.4vh;
  background: #fffaf2ee;
  box-shadow: 0 0.8vh 2vh #0002;
}
.q2-card > small {
  display: block;
  font: 700 max(11px, 1.6vh) / 1.3 Sarabun, sans-serif;
  color: var(--q2-soft);
}
.q2-reset b {
  display: block;
  margin-top: 0.4vh;
  font: 900 max(16px, 3.2vh) / 1.1 Georgia, serif;
  letter-spacing: 0.05em;
}
.q2-big {
  display: flex;
  align-items: baseline;
  gap: 0.6vh;
  margin: 0.4vh 0 0.8vh;
}
.q2-big b {
  font: 900 max(20px, 4.6vh) / 1 Georgia, serif;
  color: var(--q2-pink);
}
.q2-big span {
  font: 800 max(13px, 2.2vh) / 1 Georgia, serif;
  color: var(--q2-soft);
}
.q2-bonus {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1vh 1.2vh;
}
.q2-bonus.ready {
  box-shadow: 0 0 0 0.3vh #f0b94a, 0 0.8vh 2vh #0002;
}
.q2-gift {
  width: max(42px, 9vh);
  height: max(42px, 9vh);
  object-fit: contain;
}
.q2-bonus-txt b {
  display: block;
  font: 900 max(13px, 2.3vh) / 1.2 Mali, sans-serif;
}
.q2-bonus-txt small {
  display: block;
  margin: 0.2vh 0 0.6vh;
  font: 600 max(11px, 1.6vh) / 1.3 Sarabun, sans-serif;
  color: var(--q2-soft);
}
.q2-bonus .q2-btn {
  grid-column: 1 / -1;
  justify-self: stretch;
}
.q2-note {
  font: 600 max(10px, 1.5vh) / 1.4 Sarabun, sans-serif;
  color: var(--q2-soft);
  padding: 0 0.4vh;
}

/* ---------- ขวา: รายการเควส ---------- */
.q2-list {
  position: absolute;
  left: calc(var(--q2-side) + 4.8vh);
  right: 2.4vh;
  top: 12vh;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 1vh;
  padding-bottom: 2.4vh;
  overflow-y: auto;
  scrollbar-width: thin;
}
.q2-row {
  flex: none;
  display: flex;
  align-items: center;
  gap: 1.6vh;
  padding: 1.2vh 1.6vh;
  border-radius: 1.4vh;
  background: #fffaf2ee;
  box-shadow: 0 0.5vh 1.2vh #0001;
  border-left: 0.6vh solid #d9d3dc;
}
.q2-row.done {
  border-left-color: #f0b94a;
  background: #fff6df;
}
.q2-row.got {
  opacity: 0.6;
  border-left-color: #8fc79a;
}
/* วงความคืบหน้า: conic-gradient วาดตามค่า --p (0–100) */
.q2-ring {
  flex: none;
  width: max(36px, 7.4vh);
  height: max(36px, 7.4vh);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--q2-pink) calc(var(--p) * 1%), #e7e1e8 0);
}
.q2-row.done .q2-ring,
.q2-row.got .q2-ring {
  background: conic-gradient(#e0a43a calc(var(--p) * 1%), #e7e1e8 0);
}
.q2-ring span {
  width: 74%;
  height: 74%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fffaf2;
  font: 900 max(10px, 1.6vh) / 1 Sarabun, sans-serif;
}
.q2-mid {
  flex: 1;
  min-width: 0;
}
.q2-mid b {
  display: block;
  font: 900 max(13px, 2.3vh) / 1.2 Mali, sans-serif;
}
.q2-mid small {
  display: block;
  margin-top: 0.2vh;
  font: 600 max(11px, 1.7vh) / 1.3 Sarabun, sans-serif;
  color: var(--q2-soft);
}
.q2-bar {
  height: max(5px, 0.9vh);
  margin-top: 0.7vh;
  border-radius: 99px;
  background: #e7e1e8;
  overflow: hidden;
}
.q2-bar-lg {
  height: max(8px, 1.4vh);
}
.q2-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #f29ab5, var(--q2-pink));
}
.q2-row.done .q2-bar i {
  background: linear-gradient(90deg, #f6cf72, #e0a43a);
}
.q2-rw {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5vh;
  max-width: 34%;
}
.q2-bonus .q2-rw {
  justify-content: flex-start;
  max-width: none;
}
.q2-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3vh;
  padding: 0.3vh 0.9vh 0.3vh 0.4vh;
  border-radius: 99px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #3b425518;
  font: 800 max(11px, 1.7vh) / 1.2 Sarabun, sans-serif;
  white-space: nowrap;
}
.q2-chip img {
  width: max(14px, 2.3vh);
  height: max(14px, 2.3vh);
  object-fit: contain;
}
.q2-pt,
.q2-exp {
  padding-left: 0.9vh;
}
.q2-pt {
  color: #b5476d;
}
.q2-exp {
  color: #4d63a8;
}
/* ปุ่มรับ: ขนาดพอดีมือ ไม่ใหญ่เกิน — สูงตามจอแต่ไม่ต่ำกว่า 30px (นิ้วกดได้บนมือถือแนวนอน) */
.q2-btn {
  flex: none;
  min-width: max(84px, 15vh);
  height: max(30px, 5.6vh);
  padding: 0 1.6vh;
  border: 0;
  border-radius: 99px;
  display: inline-grid;
  place-items: center;
  font: 900 max(12px, 2vh) / 1 Mali, sans-serif;
  white-space: nowrap;
}
.q2-go {
  background: linear-gradient(#f9d77e, #e7a93a);
  color: #6b3f12;
  box-shadow: 0 0.5vh 0 #b97a1f, 0 0.8vh 1.4vh #0003;
}
.q2-go:active {
  transform: translateY(0.3vh);
  box-shadow: 0 0.2vh 0 #b97a1f;
}
.q2-wait {
  background: #e9e4ea;
  color: var(--q2-soft);
  font-family: Georgia, serif;
}
.q2-got {
  background: none;
  color: #4f9a5f;
  box-shadow: inset 0 0 0 1px #4f9a5f66;
}
@media (prefers-reduced-motion: no-preference) {
  .q2-bonus.ready .q2-go {
    animation: q2-pulse 1.6s ease-in-out infinite;
  }
}
@keyframes q2-pulse {
  50% {
    filter: brightness(1.12);
  }
}
/* จอเตี้ย (มือถือแนวนอน): ซ่อนคำอธิบายรอง ให้รายการเควสเห็นได้หลายแถว */
@media (max-height: 480px) {
  .q2-note,
  .q2-bonus-txt small {
    display: none;
  }
  .q2-row {
    padding: 0.8vh 1.4vh;
  }
}
