#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8); /* nền mờ trắng */
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #e91e63;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}





/* Hiệu ứng đơn giản cho màn hình thắp hương */
.incense-game {
    max-width: 600px;
    margin: 2rem auto;
    text-align: center;
    font-family: inherit;
}

.blessing-counter {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

.incense-area .screen {
    position: relative;
    width: 100%;
    height: 200px;
    background: #f6f2eb;
    border: 2px dashed #d4af37;
    overflow: hidden;
    margin-bottom: 1rem;
}

.incense-area button {
    font-size: 1.2rem;
    padding: 10px 20px;
    background-color: #d4af37;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s;
}


.incense-area button:active {
    transform: scale(0.95);
}

.incense-image {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 80px;
    animation: moveRight 2.5s linear forwards;
}

@keyframes moveRight {
    from {
        left: -100px;
    }
    to {
        left: 100%;
    }
}


  

  #incense-screen {
    position: relative;
    height: 200px; /* hoặc chiều cao bạn muốn */
    overflow: hidden;
    background-color: #111; /* ✅ nền tối */
    border-radius: 12px;
    margin-top: 16px;
    box-shadow: 0 0 8px #000;
  }
  

#incenseButton {
    background: linear-gradient(145deg, #f188af, #eb4ca1);
    border: none;
    border-radius: 999px;
    color: #4a004a;
    padding: 15px 30px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(255, 150, 200, 0.3);
    transition: all 0.2s ease-in-out;
      position: relative;  /* cần nếu chưa có */
  z-index: 10;         /* cao hơn ảnh rơi ra */
}

#incenseButton:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 20px rgba(255, 100, 180, 0.4);
}

#incenseButton:disabled {
    background: #ddd;
    color: #aaa;
    cursor: not-allowed;
}

.incense-fly {
    position: absolute;
    top: 10%; /* ✅ Cách viền trên một khoảng */
    left: -50px; /* ✅ Lùi ra khỏi viền trái một chút để bay vào mượt hơn */
    transform: translateY(0) translateX(0);
    transition: transform 2s linear, opacity 1s ease-in;
    height: 40px; /* ✅ Kích thước nhỏ, giữ tỉ lệ */
    width: auto;
    opacity: 1;
    pointer-events: none;
    z-index: 10;
}


#loginButton, #logoutButton {
    background: #fca3cc;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    margin-top: 10px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#loginButton:hover, #logoutButton:hover {
    background: #f36aa0;
}

/* MENU */
/* Navbar cơ bản */
.navbar {
    background: linear-gradient(145deg, #ffe0f0, #ffcde8);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.nav-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.nav-center {
    flex: 3; /* Tăng rộng vùng giữa để menu không bị xuống dòng */
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.nav-left { justify-content: flex-start; }
.nav-right { justify-content: flex-end; }

.nav-menu {
    display: flex;
    gap: 25px; /* Khoảng cách rộng giữa các mục menu */
    flex-wrap: nowrap; /* Không xuống dòng */
    white-space: nowrap; /* Không xuống dòng */
}


/* Style link menu với icon */
.nav-menu a {
    text-decoration: none;
    color: #d63384;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 8px; /* Khoảng cách icon và text */
}

/* Icon trước menu */
.nav-menu a .menu-icon {
    width: 20px;
    height: 20px;
    stroke: #d63384;
    stroke-width: 2;
    flex-shrink: 0;
}

.nav-menu a:hover {
    background: #fce3ec;
}

.menu-btn {
    font-size: 24px;
    background: none;
    border: none;
    color: #d63384;
    cursor: pointer;
    display: none;
}

.profile-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
}

/* Mobile responsive menu */
@media (max-width: 1193px) {
    .nav-center {
      position: static;
      transform: none;
      width: 100%;
      order: 3;
      margin-top: 10px;
    }
    

/* Ẩn menu trên màn hình nhỏ */
@media (max-width: 1193px) {
  .nav-menu {
    display: none !important; /* Ẩn menu mặc định, dùng !important để tránh ghi đè */
    flex-direction: column;
    background: white;
    padding: 10px;
    border-radius: 8px;
    position: absolute;
    top: 50px;
    right: 10px;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }
  .nav-menu.active {
    display: flex !important; /* Hiện menu khi có class active */
  }

}

    .menu-btn {
      display: block;
      margin-right: 0;
      padding-right: 0;
      position: fixed; /* Cố định */
      top: 19px;
      right: 15px; /* Sát mép phải */
      z-index: 1100;
      background: none;
      border: none;
    }

  .nav-right {
  padding-right: 0;
  margin-right: 0;
  gap: 10px;
  position: fixed; /* Cố định */
  top: 10px;
  right: 42px; /* 👈 Đã chỉnh từ 60px → 42px */
  z-index: 1100;
}


    .profile-icon {
      margin-right: 0;
      width: 40px;
      height: 40px;
      border-radius: 50%;
      object-fit: cover;
      border: 2px solid #fff;
    }
}


@media (max-width: 1235px) and (min-width: 1193px) {
  .resource-bar-fixed {
    width: 190px !important;
    max-width: 190px !important;
    right: 80px !important;
    left: auto !important;
    margin: 0 !important;

    overflow: hidden;
    white-space: nowrap;
    padding: 4px 10px;
  }
  .resource-bar-fixed {
  display: flex;
  justify-content: center; /* ✅ Căn giữa theo chiều ngang */
  align-items: center;     /* ✅ Căn giữa theo chiều dọc (nếu cần) */

  width: 190px;            /* ✅ Chiều rộng cố định */
  max-width: 190px;
  padding: 4px 10px;

  overflow: hidden;
  white-space: nowrap;

  left: auto;
  right: 80px;

  background: #fff;        /* Nếu bạn dùng màu nền, kiểm tra không gian hiển thị */
  border-radius: 8px;
}


}


/* avatar */

.profile-container {
    position: relative;
    display: inline-block;
  }
  
#profileIcon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;

  margin-top: 6px; /* 👈 Dịch xuống dưới một chút */
}

  
  .profile-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 15px;
    width: 200px;
    z-index: 999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    text-align: center;
  }
  
  .profile-name {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 18px;
    animation: float 2.5s ease-in-out infinite;
  }
  
  @keyframes float {
    0%, 100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-4px);
    }
  }
  
  .profile-options {
    list-style: none;
    padding: 0;
    margin: 10px 0;
  }
  
  .profile-options li {
    margin: 6px 0;
  }
  
  .profile-options a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.2s;
  }
  
  .profile-options a:hover {
    color: #e91e63;
  }
  
  #loginButton, #logoutButton {
    margin-top: 10px;
    padding: 6px 12px;
    background-color: #e91e63;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
  }
  
  #loginButton:hover, #logoutButton:hover {
    background-color: #d81b60;
  }
  
  .profile-menu {
    position: absolute;
    top: 60px;
    right: 10px;
    background-color: white;
    border: 2px solid #e91e63;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    width: 220px;
    display: none;
    z-index: 1000;
    padding: 10px;
    font-family: 'Arial', sans-serif;
    animation: slideDown 0.3s ease;
  }
  
  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .profile-user {
    text-align: center;
    font-weight: bold;
    color: #e91e63;
    margin-bottom: 10px;
    animation: floatUpDown 2s ease-in-out infinite;
  }
  
  @keyframes floatUpDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
  }
  
  .profile-menu-list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
  }
  
  .profile-menu-list li {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    color: #333;
    border-radius: 8px;
    transition: background 0.2s;
  }
  
  .profile-menu-list li:hover {
    background-color: #fce4ec;
  }
  
  .profile-menu-list i.icon {
    margin-right: 8px;
    font-size: 18px;
    width: 22px;
    text-align: center;
  }
  
  .auth-button {
    width: 100%;
    padding: 8px 0;
    background-color: #e91e63;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 5px;
    transition: background 0.2s;
  }
  
  .auth-button:hover {
    background-color: #d81b60;
  }

  
  .profile-menu-list li {
    position: relative;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    color: #333;
    border-radius: 8px;
    transition: background 0.2s;
  }
  
  .profile-menu-list li:hover {
    background-color: #fce4ec;
  }
  
  .profile-menu-list li:hover::after {
    content: "◀";
    position: absolute;
    right: 10px;
    color: #e91e63;
    font-size: 16px;
    animation: blinkArrow 0.8s infinite;
  }
  
  @keyframes blinkArrow {
    0%, 100% { opacity: 1; transform: translateX(0); }
    50% { opacity: 0.2; transform: translateX(-4px); }
  }


  #logoutButton {
    padding: 8px 16px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    background-color: #e91e63;
    color: white;
    cursor: pointer;
    font-weight: bold;
    animation: pulseColor 2s infinite;
    transition: transform 0.2s;
  }
  
  #logoutButton:hover {
    transform: scale(1.05);
  }
  
  @keyframes pulseColor {
    0%   { background-color: #e91e63; }
    25%  { background-color: #ff4081; }
    50%  { background-color: #f06292; }
    75%  { background-color: #ff80ab; }
    100% { background-color: #e91e63; }
  }
  
  #loginButton {
    padding: 8px 16px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    background-color: #e91e63;
    color: white;
    cursor: pointer;
    font-weight: bold;
    animation: pulseColor 2s infinite;
    transition: transform 0.2s;
  }
  
  #loginButton:hover {
    transform: scale(1.05);
  }
  
  @keyframes pulseColor {
    0%   { background-color: #e91e63; }
    25%  { background-color: #ff4081; }
    50%  { background-color: #f06292; }
    75%  { background-color: #ff80ab; }
    100% { background-color: #e91e63; }
  }
  

 .toast {
  visibility: hidden;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #ff4d6d;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 9999;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
}

.toast.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}




/* thanh vé và điểm*/
#exchangeModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 2px solid #e91e63;
  border-radius: 12px;
  padding: 20px;
  z-index: 9999;
  width: 280px;
  box-shadow: 0 0 20px rgba(0,0,0,0.2);
  display: none;
}

#closeExchange {
  cursor: pointer;
  font-size: 22px;
  float: right;
  font-weight: bold;
  color: #e91e63;
}


/* thanh vé và điểm*/
.resource-bar-fixed {
  position: fixed;
  top: 18px;
  right: 100px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 14px;
  border-radius: 999px;
  z-index: 1000;
}



.resource-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-weight: bold;
  font-size: 15px;
}

.resource-item img {
  width: 30px;
  height: 30px;
}

.resource-plus {
  background-color: #ffca28;
  border: none;
  color: white;
  font-size: 16px;
  font-weight: bold;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  text-align: center;
  line-height: 22px;
  cursor: pointer;
  transition: transform 0.2s;
  margin-left: 4px;
}

.resource-plus:hover {
  transform: scale(1.1);
  background-color: #ffc107;
}

/* Modal Đổi vé */
#exchangeModal {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px 25px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  max-width: 300px;
  width: 90%;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, -60%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

#exchangeModal h3 {
  color: #e91e63;
  margin-bottom: 8px;
}

#exchangeModal p {
  color: #555;
  font-size: 15px;
  margin-bottom: 12px;
}

#exchangeModal button {
  padding: 8px 16px;
  background-color: #ff69b4;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

#exchangeModal button:hover {
  background-color: #e91e63;
}

#exchangeMessage {
  margin-top: 10px;
  font-size: 15px;
}

#closeExchange {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 20px;
  cursor: pointer;
  color: #e91e63;
}


/*bo tròn nhánh*/
.nav-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.nav-menu a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background-color: #ffb6d9; /* hồng nhạt */
  color: #4a004a;
  font-weight: bold;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 2px 6px rgba(255, 150, 200, 0.2);
}

.nav-menu a:hover {
  background-color: #ffa8d1;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(255, 100, 180, 0.3);
}

.menu-icon {
  width: 18px;
  height: 18px;
  color: inherit;
}

.scatter-item {
  position: fixed;
  width: 60px;
  height: 60px;
  pointer-events: none;
  z-index: 6;
  animation: scatter 1s ease-out forwards;
}

@keyframes scatter {
  0% {
    opacity: 1;
    transform: scale(1) translate(0, 0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.5) translate(var(--dx), var(--dy)) rotate(360deg);
  }
}





/*rung lắc thu thập*/
@keyframes bounce-shake {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.2) rotate(5deg); }
  50% { transform: scale(1.15) rotate(-5deg); }
  75% { transform: scale(1.2) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.shake-grow {
  animation: bounce-shake 0.4s ease-in-out;
}


@keyframes button-pop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.25) rotate(3deg); }
  50%  { transform: scale(0.95) rotate(-3deg); }
  70%  { transform: scale(1.1) rotate(2deg); }
  100% { transform: scale(1); }
}

.button-pop {
  animation: button-pop 0.4s ease-in-out;
}


.resource-item img {
  width: 24px;         /* giữ kích thước layout nhỏ */
  height: 24px;
  transform: scale(1.2);   /* phóng to thực tế */
  transform-origin: center center;
}



/* pháo hoa*/
/* Container chứa pháo hoa */
#fireworksContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* Mỗi pháo hoa là 1 emoji bung nổ */
.fireworks-burst {
  position: fixed;
  font-size: 48px;
  animation: fireworks-pop 1s ease-out forwards;
  pointer-events: none;
  z-index: 9999;
}

/* Animation bung tròn, quay và mờ dần */
@keyframes fireworks-pop {
  0% {
    opacity: 1;
    transform: scale(0.3);
  }
  100% {
    opacity: 0;
    transform: scale(2.5);
  }
}

.firework-drop {
  position: fixed;
  font-size: 64px;
  pointer-events: none;
  z-index: 9999;
  animation: fallRotateFade 2s ease-in forwards;
  opacity: 1;
}

@keyframes fallRotateFade {
  0% {
    transform: translateY(-80px) rotate(0deg);
    opacity: 1;
  }
  85% {
    transform: translateY(90vh) rotate(180deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(270deg);
    opacity: 0;
  }
}



/*chuc mung*/
#congratsMessage {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  color: #e91e63;
  font-size: 32px;
  font-weight: bold;
  padding: 20px 40px;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.2);
  z-index: 99999;
  display: none;
  animation: popScale 0.4s ease-out;
  text-align: center;
}

@keyframes popScale {
  0% {
    transform: translateX(-50%) scale(0.5);
    opacity: 0;
  }
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}


#congratsMessage {
  position: fixed;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ffebf0, #fffde7);
  color: #ff4081;
  font-size: 28px;
  font-weight: bold;
  padding: 24px 40px;
  border: 4px dashed #f48fb1;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 99999;
  display: none;
  text-align: center;
  animation: popBounce 0.4s ease-out;
   font-family: 'Baloo 2', cursive;
}

@keyframes popBounce {
  0% {
    transform: translateX(-50%) scale(0.3) rotate(-15deg);
    opacity: 0;
  }
  60% {
    transform: translateX(-50%) scale(1.1) rotate(5deg);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) scale(1) rotate(0deg);
  }
}

.incense-wrapper {
  margin-top: -60px; /* 👈 nhỏ hơn nếu bạn muốn đẩy lên cao */
}


/* ==== Các panel cố định ==== */

.side-panel,
.left-panel,
.mini-panel,
.bottom-mini-panel {
  background-color: pink;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  font-family: 'Baloo 2', cursive;
  font-size: 16px;
  text-align: center;
  z-index: 100;
  transition: all 0.3s ease;
}

.side-panel {
  position: fixed;
  top: 120px;
  right: 10px;
  width: 280px;
  height: 400px;
  max-width: 50%;
  flex: 0 1 280px;
  margin-left: 10px;
  margin-right: 50px;
}

.left-panel {
  position: fixed;
  top: 120px;
  left: 10px;
  width: 280px;
  height: 400px;
  max-width: 50%;
  flex: 0 1 280px;
  margin-left: 50px;
  margin-right: 10px;
}

.mini-panel {
  position: absolute;
  bottom: calc(100% + 20px); /* Nằm trên incense-screen */
  left: 0;
  width: 100%;
  height: 80px;
  margin: 0 auto;
  z-index: 5;
}

.bottom-mini-panel {
  width: 300px;
  height: 100px;
  margin: 30px auto 0 auto;
}

/* ==== Bố cục Flex chính ==== */
.layout-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  padding: 1rem;
  flex-wrap: nowrap;
  position: relative;

  margin-top: -60px; /* dịch lên 20px */


}

.center-panel {
  max-width: 600px;
  flex: 1;
  z-index: 2;
}

/* ==== Responsive: Thiết bị nhỏ hoặc bị che bởi panel ==== */
@media (max-width: 1400px) {
  .side-panel,
  .left-panel {
    max-width: 50%;
    flex: 0 1 280px;
  }
}

@media (max-width: 1262px) {
  .side-panel,
  .left-panel {
    width: 200px;
  }
}

@media (max-width: 1200px) {
  .layout-container.panel-collide .side-panel,
  .layout-container.panel-collide .left-panel {
    position: relative;
    width: 90%;
    height: auto;
    margin: 10px auto;
    top: unset;
    left: unset;
    right: unset;
  }

  .layout-container.panel-collide {
    flex-direction: column;
    align-items: center;
  }

  .layout-container.panel-collide > .center-panel {
    order: 1;
  }
  .layout-container.panel-collide > .side-panel {
    order: 2;
  }
  .layout-container.panel-collide > .left-panel {
    order: 3;
  }
}

@media (max-width: 1138px) {
  .side-panel {
    right: -20px;
  }
  .left-panel {
    left: -20px;
  }
}

@media (max-width: 1042px) {
  .side-panel {
    margin-left: 20px;
  }
  .left-panel {
    margin-right: 20px;
  }
}

@media (max-width: 1000px) {
  .layout-container {
    flex-direction: column;
    align-items: center;
      margin-top: -170px; /* dịch lên 20px */
  }

  .side-panel,
  .left-panel,
  .mini-panel,
  .bottom-mini-panel,
  .incense-area {
    position: relative;
    width: 100%;
    max-width: 100%;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
    margin: 10px auto;
    top: unset;
    left: unset;
    right: unset;
  }

  .layout-container > .center-panel {
    order: 1;
  }
  .layout-container > .side-panel {
    order: 2;
  }
  .layout-container > .left-panel {
    order: 3;
  }
}

@media (max-width: 768px) {
  .incense-area {
    margin-top: 10px;
  }

  #incenseButton {
    width: 100%;
    font-size: 18px;
  }

  .resource-bar-fixed {
    flex-wrap: wrap;
    justify-content: center;
    top: 20px;
    left: 0;
    right: 0;
        /* 👇 Thêm các dòng sau để hẹp lại và canh giữa */
    max-width: 190px;       /* Chiều rộng tối đa bạn muốn */
    margin: 0 auto;         /* Canh giữa */
     transform: translateX(5px); /* 👈 Nhích sang phải 10px */

  }

  #congratsMessage {
    font-size: 20px;
    padding: 16px 24px;
  }

  .profile-menu {
    right: 0;
    width: 90%;
    left: 5%;
  }

}

/* ==== Kích thước động theo độ rộng màn hình lớn hơn 1400px ==== */
@media (min-width: 1400px) {
  :root {
    --scale-multiplier: calc((100vw - 1400px) / 100 * 0.5); /* 50px mỗi 100px */
  }

  .side-panel,
  .left-panel,
  .mini-panel,
  .bottom-mini-panel,
  .incense-area {
    width: calc(280px + var(--scale-multiplier));
    max-width: none;
    padding: calc(20px + var(--scale-multiplier) * 0.2);
    font-size: calc(16px + var(--scale-multiplier) * 0.05);
  }

  .mini-panel,
  .bottom-mini-panel {
    width: calc(300px + var(--scale-multiplier));
  }

  .center-panel {
    max-width: calc(600px + var(--scale-multiplier));
  }

  #incenseButton {
    font-size: calc(20px + var(--scale-multiplier) * 0.05);
    padding: calc(12px + var(--scale-multiplier) * 0.05) calc(24px + var(--scale-multiplier) * 0.1);
  }
}

/* ==== Ngăn mở rộng sau 1388px, chỉ tạo khoảng trống ==== */
@media (min-width: 1388px) {
  :root {
    --scale-multiplier: 0;
  }

  .layout-container {
    padding-left: calc((100vw - 1388px) / 2);
    padding-right: calc((100vw - 1388px) / 2);




  }

  .side-panel,
  .left-panel,
  .mini-panel,
  .bottom-mini-panel,
  .incense-area {
    max-width: initial;
    width: 280px;
    font-size: 16px;
    padding: 20px;
  }

  .center-panel {
    max-width: 600px;
  }

  #incenseButton {
    font-size: 20px;
    padding: 12px 24px;
  }
}


#loading-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background-color:  #ec7eb3;
  animation: blinkBackground 1s infinite alternate;
  z-index: 9999;
  overflow: hidden;
}

@keyframes blinkBackground {
  0% { background-color: #ec7eb3; }
  100% { background-color: #e94da0; }
}

.floating {
  position: absolute;
  transition: top 0.2s, left 0.2s;
  animation: waveY 100s infinite ease-in-out; /* ⏳ Chậm hơn */
  pointer-events: none;
}

@keyframes waveY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.ttrung {
  width: 70px;
  opacity: 0.9;
}

.heart {
  font-size: 24px;
  opacity: 0.8;
}


#loading-text {
  font-family: 'Baloo 2', cursive;
  font-size: 36px;
  font-weight: 700;
  color: white;
  text-shadow: 2px 2px 4px #ff69b4;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10001;
  user-select: none;
  pointer-events: none;
  display: flex;
  gap: 2px;
}

#loading-text span {
  display: inline-block;
  animation: bounce 1s infinite ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}


@keyframes shake {
  0%   { transform: translate(-50%, -50%) rotate(0deg); }
  25%  { transform: translate(-50%, -50%) rotate(3deg); }
  50%  { transform: translate(-50%, -50%) rotate(0deg); }
  75%  { transform: translate(-50%, -50%) rotate(-3deg); }
  100% { transform: translate(-50%, -50%) rotate(0deg); }
}

#loading-text span:nth-child(1) { animation-delay: 0s; }
#loading-text span:nth-child(2) { animation-delay: 0.1s; }
#loading-text span:nth-child(3) { animation-delay: 0.2s; }
#loading-text span:nth-child(4) { animation-delay: 0.3s; }
#loading-text span:nth-child(5) { animation-delay: 0.4s; }
#loading-text span:nth-child(6) { animation-delay: 0.5s; }
#loading-text span:nth-child(7) { animation-delay: 0.6s; }
#loading-text span:nth-child(8) { animation-delay: 0.7s; }
#loading-text span:nth-child(9) { animation-delay: 0.8s; }
#loading-text span:nth-child(10){ animation-delay: 0.9s; }
#loading-text span:nth-child(11){ animation-delay: 1s; }




.friend-dropdown {
  position: relative;
  display: inline-block;
}

.friend-dropdown-btn {
  padding: 6px 12px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px 0 0 4px;
  cursor: pointer;
}

.friend-dropdown-arrow {
  padding: 6px 10px;
  background-color: #388e3c;
  color: white;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}

.friend-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: white;
  border: 1px solid #ccc;
  padding: 8px 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  display: none;
  z-index: 10;
}

.friend-dropdown-menu.show {
  display: block;
}

.friend-dropdown-menu button {
  background: none;
  border: none;
  color: red;
  font-weight: bold;
  cursor: pointer;
}


.friend-dropdown {
  position: relative;
  display: inline-flex;
  font-family: inherit;
}

.friend-dropdown-btn,
.friend-dropdown-arrow {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.friend-dropdown-btn {
  border-radius: 6px 0 0 6px;
}

.friend-dropdown-arrow {
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0 6px 6px 0;
  padding: 8px 10px;
}

.friend-dropdown-btn:hover,
.friend-dropdown-arrow:hover {
  background: #45a049;
}

.friend-dropdown-menu {
  position: absolute;
  top: 110%;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  min-width: 140px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  z-index: 100;
  display: none;
  border-radius: 6px;
}

.friend-dropdown-menu.show {
  display: block;
}

.friend-dropdown-menu button {
  width: 100%;
  background: none;
  border: none;
  padding: 10px 16px;
  text-align: left;
  font-size: 14px;
  color: #e53935;
  cursor: pointer;
  transition: background 0.2s ease;
}

.friend-dropdown-menu button:hover {
  background: #f5f5f5;
}





/* rankkkkkkkkkkkkkkkkkkkkkk*/


.rank-list-scrollable {
  max-height: 300px;
  overflow-y: auto;
  text-align: left;
  padding-right: 6px;
}

.rank-list-scrollable::-webkit-scrollbar {
  width: 8px;
}

.rank-list-scrollable::-webkit-scrollbar-thumb {
  background-color: #e91e63;
  border-radius: 4px;
}

.rank-entry {
  padding: 8px;
  border-bottom: 1px dashed #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rank-entry a {
  color: #e91e63;
  font-weight: bold;
  text-decoration: none;
}

.rank-entry a:hover {
  text-decoration: underline;
}


.rank-entry:hover {
  background-color: #fce4ec;
  cursor: pointer;
}



.ranking-box {
  margin-top: 16px;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 0 8px rgba(0,0,0,0.1);
  max-height: 300px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.rank-list-scrollable {
  overflow-y: auto;
  flex: 1;
  max-height: 250px;
}

.rank-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.rank-entry:last-child {
  border-bottom: none;
}


.rank-entry.current-user {
  background-color: #fce4ec;
  font-weight: bold;

}

.icon.bell-shake {
  animation: bellShake 0.6s ease-in-out infinite;
}

@keyframes bellShake {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(15deg); }
  30%  { transform: rotate(-15deg); }
  45%  { transform: rotate(10deg); }
  60%  { transform: rotate(-10deg); }
  75%  { transform: rotate(5deg); }
  100% { transform: rotate(0deg); }
}



/* Logo cơ bản */
.site-logo {
  height: 50px;
  width: auto;
  display: block;
  transform: scale(1.5);
  transform-origin: left center;
  transition: transform 0.4s ease, filter 0.4s ease;
  pointer-events: auto;
  animation: logoEffect 3s ease-in-out infinite; /* Hiệu ứng xoay + nhịp nhẹ */
  cursor: pointer; /* Hiển thị con trỏ khi bấm được */
}

/* Khi rê chuột vào logo */
.site-logo:hover {
  animation: logoSwing 1s ease-in-out infinite; /* Khi hover sẽ lắc lư đung đưa */
  filter: drop-shadow(0 0 8px rgba(255, 127, 191, 0.6)); /* ánh sáng hồng */
}

/* Khi bấm vào logo */
.site-logo:active {
  animation: logoBounceClick 0.4s ease; /* Hiệu ứng tinh nghịch khi bấm */
}

/* Hiệu ứng mặc định */
@keyframes logoEffect {
  0% { transform: scale(1.5) rotate(0deg); }
  25% { transform: scale(1.55) rotate(2deg); }
  50% { transform: scale(1.5) rotate(0deg); }
  75% { transform: scale(1.55) rotate(-2deg); }
  100% { transform: scale(1.5) rotate(0deg); }
}

/* Hiệu ứng lắc lư khi hover */
@keyframes logoSwing {
  0% { transform: scale(1.5) rotate(0deg); }
  20% { transform: scale(1.5) rotate(5deg); }
  40% { transform: scale(1.5) rotate(-5deg); }
  60% { transform: scale(1.5) rotate(3deg); }
  80% { transform: scale(1.5) rotate(-3deg); }
  100% { transform: scale(1.5) rotate(0deg); }
}




@media (max-width: 1193px) and (min-width: 769px) {
  .resource-bar-fixed {
    flex-wrap: wrap;
    justify-content: center;
    top: 20px;
    left: 0;
    right: 0;
    margin: 0 auto;

    width: clamp(300px, 55vw, 650px); /* 👈 Co dần từ 650px → 300px */
  }
}




.mini-panel {
  position: relative;
  width: 100%;
    background: #ff9ad0; /* Hồng đậm (Deep Pink) */
  overflow: hidden;
  height: 40px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ccc;
}

.mini-message {
  position: absolute;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: scroll-right-to-left 10s linear forwards;
  font-weight: bold;
  color: #a80601;
}

.mini-message img {
  transform: scaleX(-1); /* Lật ngang */
  height: 15px;          /* hoặc giữ kích thước gốc */
  width: auto;
  object-fit: contain;
}


@keyframes scroll-right-to-left {
  from {
    right: -100%; /* Bắt đầu ngoài bên phải */
  }
  to {
    right: 100%;  /* Ra ngoài bên trái */
  }
}


/* FIX PROFILE MENU CHO MOBILE */
@media (max-width: 768px) {

  /* Giữ avatar + menu trong layout thay vì cố định */
  .nav-right {
    position: static !important;
  }

  /* Menu dạng dropdown đứng ngay dưới avatar */
  .profile-container {
    position: relative;
  }

  .profile-menu {
    top: 50px !important;   /* nằm ngay dưới avatar */
    right: 0 !important;
    width: 180px !important;
  }

  /* Avatar không bị lệch */
  #profileIcon {
    margin-right: 0 !important;
  }

  /* Giảm kích thước cho đẹp */
  .profile-menu-list li {
    padding: 6px 10px !important;
  }

  /* Nút menu 3 sọc không đè avatar */
  .menu-btn {
    top: 15px !important;
    right: 15px !important;
  }
}

/* FIX PROFILE MENU CHO MOBILE — giữ nguyên vị trí avatar */
@media (max-width: 768px) {

  /* Menu sẽ tự canh vào avatar đang fixed */
  .profile-menu {
    position: fixed !important;
    top: 65px !important;   /* chỉnh để nằm ngay dưới avatar */
    right: 15px !important; /* trùng với vị trí avatar */
    width: 200px !important;
  }

  /* Giảm góc chiếm chỗ khi menu mở ra */
  .profile-menu-list li {
    padding: 8px 12px;
  }

  /* Badge thông báo khỏi bị lệch */
  #notifBadge {
    right: -35px !important;
  }
}
/* FIX CHO MOBILE: profile-menu nằm ngay dưới avatar & nút 3 sọc */
@media (max-width: 768px) {

  .profile-menu {
    position: fixed !important;
    top: 60px !important;     /* nằm ngay dưới avatar */
    right: 15px !important;   /* trùng vị trí với nút 3 sọc */
    width: 210px !important;
    z-index: 9999 !important;
  }
}

/* AUTO CANH PROFILE MENU NGAY DƯỚI AVATAR */
.profile-container {
  position: fixed !important;   /* avatar đứng fixed giống bạn đang dùng */
  top: 10px !important;
  right: 42px !important;
  z-index: 1100;
}

.profile-menu {
  position: absolute !important;
  top: 50px !important;         /* đúng dưới avatar */
  right: 0 !important;
  width: 210px !important;
  z-index: 1101 !important;
}
/* Ngăn profile-menu bị tràn và bị cắt khi màn hình hẹp */
@media (max-width: 768px) {

  .profile-menu {
    position: fixed !important;
    top: 60px !important;
    
    right: 10px !important;  /* ★ đảm bảo nằm bên phải */
    left: auto !important;   /* ★ khử thuộc tính left trong CSS gốc */

    max-width: calc(100vw - 20px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
  }
}

.rank-avatar-wrapper {
  position: relative;
  width: 28px;
  height: 28px;
}

.rank-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.rank-entry.top1 .rank-avatar-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 31px;
  height: 31px;
  background-image: url("../img/top1-frame.png");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 20;

  /* dịch PNG sang trái và xuống dưới 1 tí */
  transform: translate(-1.3px, 1.5px);
}
