/* ================= LỚP HOÀN THIỆN GIAO DIỆN (nạp sau cùng) ================= */

/* ---- Thông báo: đưa ra giữa phía trên, không đè lên ô tiền/Xu ---- */
#toast-container {
  top: 92px;
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
  max-width: min(460px, 92vw);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  text-align: center;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  line-height: 1.35;
  box-shadow: 0 3px 0 var(--outline), 0 10px 24px rgba(0,0,0,0.3);
  animation: toast-drop 0.32s cubic-bezier(.2,1.4,.4,1);
}
@keyframes toast-drop {
  from { transform: translateY(-16px) scale(.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.toast.fade-out { opacity: 0; transform: translateY(-10px) scale(.96); }
.toast-success { background: linear-gradient(180deg, #51cf66, #2b8a3e); }
.toast-info { background: linear-gradient(180deg, #4dabf7, #1864ab); }
.toast-error { background: linear-gradient(180deg, #ff6b6b, #c92a2a); }

/* ---- Modal: nền tối mờ, khung có viền ánh kim, tiêu đề nổi ---- */
.modal-backdrop {
  background: radial-gradient(circle at 50% 40%, rgba(20, 40, 80, 0.55), rgba(8, 14, 30, 0.8));
  backdrop-filter: blur(3px) saturate(0.9);
}
.modal-card {
  background: var(--panel);
  box-shadow:
    0 0 0 3px #ffe8a3 inset,
    0 10px 0 var(--outline),
    0 28px 60px rgba(0,0,0,0.45);
}
.modal-header {
  position: relative;
  padding: 12px 16px 12px 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.28) 0, rgba(255,255,255,0) 52%),
    linear-gradient(90deg, #1c7ed6, #4263eb 55%, #7048e8);
  overflow: hidden;
}
.modal-header::after { /* vệt sáng chạy ngang */
  content: '';
  position: absolute; top: 0; bottom: 0; left: -40%;
  width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: skewX(-20deg);
  animation: header-shine 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes header-shine { 0%, 70% { left: -40%; } 100% { left: 130%; } }
.modal-header h2 { font-size: 18px; letter-spacing: .2px; }
.modal-close { position: relative; z-index: 1; }

.modal-body {
  scrollbar-width: thin;
  scrollbar-color: #f08c00 transparent;
}
.modal-body::-webkit-scrollbar { width: 10px; }
.modal-body::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #ffc078, #f08c00); border-radius: 99px; border: 2px solid var(--panel); }
.modal-body::-webkit-scrollbar-track { background: transparent; }

/* ---- Tab: dạng viên thuốc có bóng, tab đang chọn nổi lên ---- */
.tab-bar {
  gap: 6px;
  padding: 5px;
  background: rgba(43, 43, 58, 0.07);
  border-radius: 14px;
  width: fit-content;
  max-width: 100%;
}
.tab-btn {
  border-radius: 10px;
  background: #fff;
  border-width: 2px;
  box-shadow: 0 2px 0 var(--outline);
  transition: transform .1s, background .15s, color .15s;
}
.tab-btn:hover:not(.active) { transform: translateY(-1px); background: #fff4e6; }
.tab-btn.active {
  background: linear-gradient(180deg, #ffa94d, #e8590c);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,0.3);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.4), 0 2px 0 var(--outline);
}

/* ---- Nút: khối 3D đồng bộ ---- */
.btn {
  border-width: 2.5px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.42), 0 3px 0 var(--outline);
  text-shadow: 0 1px 0 rgba(0,0,0,0.25);
}
.btn-accent, .btn-secondary { text-shadow: none; }
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,0.42), 0 1px 0 var(--outline); }
.btn-lg { border-radius: 13px; }

/* ---- HUD góc phải: viên tiền tệ rõ hơn, hàng chỉ số gọn ---- */
.curr-pill {
  background: linear-gradient(180deg, rgba(52, 58, 64, 0.92), rgba(24, 26, 30, 0.92));
  border-color: #ffe8a3;
  padding: 3px 12px 3px 4px;
  font-size: 13.5px;
}
.curr-pill i { box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12); }
.stat-row {
  background: rgba(255, 253, 246, 0.96);
  box-shadow: 0 2px 0 rgba(0,0,0,0.25);
}
.icon-btn { box-shadow: 0 2px 0 var(--outline); }

/* ---- Thanh công cụ dưới: nền kính tối, nút dock có “bong bóng” biểu tượng ---- */
.toolbar {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0) 40%),
    linear-gradient(180deg, #1b3a6b 0%, #0f2547 100%);
  border-top: 3px solid var(--outline);
  box-shadow: 0 -4px 14px rgba(0,0,0,0.25);
}
.dock-btn {
  border-radius: 15px;
  gap: 2px;
  overflow: visible;
}
.dock-btn::before { /* vệt bóng phía trên */
  content: '';
  position: absolute; left: 6px; right: 6px; top: 3px; height: 38%;
  border-radius: 10px 10px 16px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0));
  pointer-events: none;
}
.dock-icon { position: relative; }
.dock-label { font-size: 11.5px; letter-spacing: .1px; }
.dock-btn:focus-visible { outline: 3px solid #ffe066; outline-offset: 2px; }
.dock-btn:hover { transform: translateY(-4px); box-shadow: inset 0 2px 0 rgba(255,255,255,0.45), 0 5px 0 var(--outline), 0 8px 16px rgba(0,0,0,0.3); }

/* Huy hiệu số trên nút dock nảy nhẹ để gây chú ý */
.dock-btn .badge-count {
  animation: badge-bounce 1.8s ease-in-out infinite;
}
@keyframes badge-bounce { 0%, 80%, 100% { transform: scale(1); } 88% { transform: scale(1.25); } }

/* ---- Thẻ nội dung trong modal: bo tròn, nhấc lên khi rê chuột ---- */
.quest-row, .item-card, .map-card, .daily-card, .ach-row {
  transition: transform .12s, box-shadow .15s;
}
.quest-row:hover, .item-card:hover, .map-card:hover, .daily-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 0 var(--outline), 0 8px 16px rgba(0,0,0,0.1);
}

/* ---- Lựa chọn input/select đẹp hơn ---- */
.modal-body select, .modal-body input[type="text"], .modal-body input[type="number"] {
  font-family: inherit;
  font-weight: 700;
  border: 2px solid var(--outline);
  border-radius: 10px;
  padding: 6px 10px;
  background: #fff;
  box-shadow: inset 0 2px 0 rgba(0,0,0,0.06);
}
.modal-body select:focus, .modal-body input:focus { outline: 3px solid #ffd8a8; outline-offset: 1px; }

/* ---- Kết quả đấu oẳn tù tì: che hẳn nền phía sau ---- */
.rps-final { background: rgba(20, 12, 40, 0.9); backdrop-filter: blur(4px); }

/* ---- Tôn trọng người dùng giảm chuyển động ---- */
@media (prefers-reduced-motion: reduce) {
  .modal-header::after, .dock-btn .badge-count, .rps-stage::before, .rps-launch-hands { animation: none !important; }
}

/* Khi đang mở modal/đấu trường, thông báo chuyển xuống mép dưới để không che tiêu đề */
body:has(#modal-backdrop:not(.hidden)) #toast-container,
body:has(#rps-overlay:not(.hidden)) #toast-container {
  top: auto;
  bottom: 22px;
  flex-direction: column-reverse;
}
