/* Cho dem cuoi tuan 夜市 (public/js/nong-trai-chodem.js) */
.cd-canh {
  position: relative; height: 320px; margin: 0 0 10px; overflow: hidden;
  border: 3px solid var(--vien); border-radius: 18px; box-shadow: 0 4px 0 var(--vien);
  background: #2a1d3d url('/images/farm/chodem-pho.svg') center bottom / cover no-repeat;
}
.cd-canh [lang="zh"], .cd-chon [lang="zh"], .cd-ket [lang="zh"], .cd-gt [lang="zh"], .cd-chip [lang="zh"] { font-family: 'Noto Serif SC', serif; }
.cd-mai { position: absolute; left: -2px; right: -2px; top: -2px; width: calc(100% + 4px); height: 30px; z-index: 3; }
.cd-day-den { position: absolute; left: 0; right: 0; top: 14px; z-index: 1; display: flex; justify-content: space-around; pointer-events: none; }
.cd-den { width: 30px; height: 45px; transform-origin: 50% 0; filter: drop-shadow(0 0 8px rgba(255, 196, 77, 0.75)); }
.cd-den-1, .cd-den-3 { margin-top: 10px; }
.cd-canh.dong { filter: saturate(0.6); }
.cd-canh.dong .cd-den { filter: brightness(0.55) saturate(0.5); }
.cd-giua { position: absolute; left: 0; right: 0; top: 48px; bottom: 0; z-index: 2; display: flex; justify-content: center; }
.cd-quay { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 74px; z-index: 4; }
.cd-hang-quay { position: absolute; left: 0; right: 0; bottom: 64px; z-index: 5; display: flex; justify-content: space-between; padding: 0 8%; pointer-events: none; }
.cd-hang-quay img { width: 34px; height: 34px; filter: drop-shadow(0 2px 0 rgba(43, 29, 58, 0.35)); }
.cd-hang-quay img:nth-child(2) { margin-right: auto; margin-left: 6px; }
.cd-hang-quay img:nth-child(3) { margin-right: 6px; }

/* khach + bong noi */
.cd-khach { position: relative; display: flex; flex-direction: column; align-items: center; width: min(100%, 340px); height: 100%; }
.cd-av { display: block; flex: 0 1 157px; min-height: 112px; aspect-ratio: 100 / 140; margin-top: auto; margin-bottom: 4px; order: 3; }
.cd-av svg, .cd-av .cd-av-svg { display: block; width: 100%; height: 100%; }
.cd-av-thay { font-size: 4rem; }
.cd-ten { order: 2; flex-shrink: 0; margin: 3px 0 0; padding: 1px 9px; border-radius: 999px; background: rgba(43, 29, 58, 0.72); color: #ffe9b0; font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.cd-ten b { color: #fff; }
.cd-bong {
  order: 1; flex-shrink: 0; position: relative; max-width: calc(100% - 20px); min-height: 40px; padding: 7px 14px; border: 3px solid var(--vien); border-radius: 16px;
  background: #fff8ec; color: var(--chu); box-shadow: 0 3px 0 var(--vien); text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.cd-bong::after { content: ''; position: absolute; left: 50%; bottom: -11px; width: 14px; height: 14px; margin-left: -7px; background: #fff8ec; border-right: 3px solid var(--vien); border-bottom: 3px solid var(--vien); transform: rotate(45deg); }
.cd-bong small { font-size: 0.74rem; color: var(--mo); font-weight: 600; line-height: 1.3; }
.cd-bong.vui { background: #fff3c4; }
.cd-bong.vui::after { background: #fff3c4; }
.cd-loi-zh { font-size: 1.25rem; line-height: 1.35; cursor: pointer; }
.cd-loi-an { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; }
.cd-loi-an i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #e5533d; }
.cd-loi-an small { margin-left: 4px; }
.cd-bong [data-cd-doc] { cursor: pointer; }

.cd-cho { align-self: center; margin-bottom: 70px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.cd-cho p { margin: 0; padding: 6px 12px; border-radius: 12px; background: rgba(28, 20, 48, 0.72); color: #ffe9b0; font-weight: 700; font-size: 0.9rem; }
.cd-nut-to { min-height: 48px; font-size: 1.02rem; }
.cd-bien-dong {
  align-self: center; margin-bottom: 76px; padding: 10px 16px; border: 3px solid var(--vien); border-radius: 12px; background: #c98a5a; box-shadow: 0 4px 0 var(--vien);
  display: flex; flex-direction: column; align-items: center; text-align: center; transform: rotate(-3deg);
}
.cd-bien-dong b { font-size: 1.4rem; color: #fff8ec; text-shadow: 0 2px 0 var(--vien); cursor: pointer; }
.cd-bien-dong small { font-size: 0.75rem; font-weight: 700; color: #3e2414; }

/* dem nguoc ngoai gio */
.cd-dem { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0 0 10px; padding: 10px; border: 2.5px solid var(--vien); border-radius: 14px; background: linear-gradient(135deg, #2e2147, #4a2a5e); color: #ffe9b0; text-align: center; }
.cd-dem span { font-weight: 700; }
.cd-dem b { font-size: 1.6rem; font-variant-numeric: tabular-nums; color: #ffd54f; letter-spacing: 0.02em; }
.cd-dem small { font-size: 0.76rem; opacity: 0.9; }

/* thong tin + gioi thieu */
.cd-tin { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.cd-tin span { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border: 2px solid var(--vien); border-radius: 999px; background: #fff8ec; font-size: 0.78rem; font-weight: 600; color: var(--chu); }
.cd-tin img { width: 15px; height: 15px; }
.cd-gt { margin: 8px 0; padding: 10px 12px; border: 2.5px solid var(--vien); border-radius: 14px; background: #fff3e0; line-height: 1.5; font-size: 0.88rem; color: var(--chu); }
.cd-gt p { margin: 0 0 6px; }
.cd-gt p:last-child { margin: 0; }
.cd-gt [data-cd-doc] { cursor: pointer; font-size: 1.05rem; }
.cd-gt small { color: var(--mo); }
.cd-luat { color: var(--mo); font-size: 0.8rem; }
.cd-h { display: flex; align-items: center; gap: 6px; margin: 12px 0 6px; font-size: 0.98rem; color: var(--chu); }
.cd-h span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--vien); background: #ffd54f; font-size: 0.8rem; }
.cd-h small { color: var(--mo); font-weight: 700; }
.cd-gia-ds { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.cd-gia { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 6px; border: 2.5px solid var(--vien); border-radius: 14px; background: #fff8ec; text-align: center; color: var(--chu); }
.cd-gia img { width: 44px; height: 44px; }
.cd-gia b { font-size: 1.05rem; cursor: pointer; }
.cd-gia small { font-size: 0.72rem; color: var(--mo); font-weight: 600; }
.cd-gia em { font-style: normal; font-size: 0.76rem; font-weight: 700; }
.cd-gia strong { color: #c62828; }

/* nut nghe lai / xem chu */
.cd-nghe-nut { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.cd-nghe-nut .nt-nut { min-height: 44px; }
.cd-tb { margin: 6px 0 0; text-align: center; font-size: 0.82rem; font-weight: 700; color: #c62828; }

/* chon hang / so / luong tu */
.cd-chon { color: var(--chu); }
.cd-o-hang { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.cd-o, .cd-so, .cd-lg, .cd-gia-o {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 48px; padding: 6px 4px;
  border: 2.5px solid var(--vien); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--vien); font: inherit; color: var(--chu); cursor: pointer; text-align: center;
}
.cd-o:active, .cd-so:active, .cd-lg:active, .cd-gia-o:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--vien); }
.cd-o img { width: 44px; height: 44px; }
.cd-o b { font-size: 1.02rem; line-height: 1.2; }
.cd-o small, .cd-lg small, .cd-gia-o small { font-size: 0.7rem; color: var(--mo); font-weight: 600; line-height: 1.2; }
.cd-vn { font-weight: 700 !important; }
.cd-o.chon, .cd-so.chon, .cd-lg.chon { background: #ffe082; box-shadow: 0 0 0 3px #e5533d inset, 0 3px 0 var(--vien); }
.cd-o-so { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.cd-so b { font-size: 1.15rem; line-height: 1; }
.cd-so small { font-size: 0.85rem; color: var(--mo); }
.cd-o-lg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.cd-lg b { font-size: 1.35rem; line-height: 1.1; }
.cd-chon .nt-hang-nut { margin-top: 12px; }
.cd-chon [data-cd-dua] small { margin-left: 4px; }
.cd-bo { margin: 8px 0 0; text-align: center; }
.cd-lk { min-height: 44px; padding: 6px 10px; border: 0; background: none; color: var(--mo); font-size: 0.82rem; font-weight: 700; text-decoration: underline; cursor: pointer; }
.cd-gia-dau { margin: 0 0 6px; padding: 8px 10px; border-radius: 12px; background: #e8f5e9; font-weight: 700; text-align: center; }
.cd-gia-dau b { font-size: 1.15rem; cursor: pointer; }
.cd-gia-dau small { color: var(--mo); }
.cd-gia-tinh { margin: 0 0 8px; font-size: 0.88rem; text-align: center; line-height: 1.5; }
.cd-o-gia { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cd-gia-o b { font-size: 1.12rem; }
.cd-chat-dau { margin: 8px 0 4px; font-weight: 700; text-align: center; }

/* ket qua */
.cd-khach.vui .cd-av { animation: cd-nhay 0.7s ease-in-out 2; }
.cd-khach.di .cd-av { animation: cd-di 1.8s ease-in 1.2s forwards; }
.cd-khach.vao .cd-av { animation: cd-vao 0.6s cubic-bezier(0.2, 1.1, 0.4, 1); }
.cd-ket { margin: 4px 0 8px; padding: 10px 12px; border: 2.5px solid var(--vien); border-radius: 14px; background: #fff8ec; color: var(--chu); }
.cd-ket.dung { background: #f1f8e9; }
.cd-ket.sai { background: #fff3e0; }
.cd-ket h3 { margin: 0 0 6px; font-size: 1.02rem; text-align: center; }
.cd-tien { margin: 0 0 6px; text-align: center; font-size: 1.05rem; }
.cd-tien img { width: 20px; height: 20px; vertical-align: -4px; }
.cd-tien small { display: block; font-size: 0.78rem; color: var(--mo); }
.cd-nho { margin: 4px 0; font-size: 0.84rem; line-height: 1.45; }
.cd-nho [data-cd-doc] { cursor: pointer; }
.cd-dap { display: flex; gap: 10px; align-items: center; margin-top: 8px; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.75); border: 2px dashed #c9a27e; }
.cd-dap > img { width: 52px; height: 52px; flex: 0 0 auto; }
.cd-dap p { margin: 0; line-height: 1.4; }
.cd-dap-cau b { font-size: 1.15rem; cursor: pointer; }
.cd-dap-py { font-size: 0.84rem; color: #6a1b9a; font-weight: 600; }
.cd-dap-vn { font-size: 0.84rem; color: var(--mo); }
.cd-dap-tach { margin-top: 4px !important; font-size: 0.8rem; font-weight: 600; }
.cd-giai { display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; }
.cd-ls { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-ls-o { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 3px; border: 2px solid var(--vien); border-radius: 999px; background: #fff; font-size: 0.76rem; font-weight: 800; color: var(--chu); }
.cd-ls-o img { width: 22px; height: 22px; }
.cd-ls-o.dung { background: #e8f5e9; }
.cd-ls-o.sai { background: #ffebee; }

/* banner tren man hinh */
.cd-chip {
  position: fixed; right: 10px; top: calc(112px + env(safe-area-inset-top, 0px)); z-index: 46;
  display: inline-flex; align-items: stretch; max-width: calc(100vw - 150px); border: 3px solid var(--vien); border-radius: 999px; overflow: hidden;
  background: linear-gradient(135deg, #3a2550, #6a2c3e); box-shadow: 0 4px 0 var(--vien); animation: cd-chip-vao 0.45s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.cd-chip.thap { top: calc(156px + env(safe-area-inset-top, 0px)); }
.cd-chip-mo { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 2px 6px 2px 8px; border: 0; background: none; color: #ffe9b0; font: 700 0.86rem 'Be Vietnam Pro', sans-serif; text-align: left; cursor: pointer; min-width: 0; }
.cd-chip-mo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-chip-mo b { color: #ffd54f; }
.cd-chip-mo img { width: 20px; height: 30px; flex: 0 0 auto; }
.cd-chip-x { flex: 0 0 auto; min-width: 40px; border: 0; border-left: 2px solid rgba(255, 233, 176, 0.35); background: none; color: #ffe9b0; font-weight: 900; cursor: pointer; }

@keyframes cd-lac { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes cd-nhay { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } }
@keyframes cd-di { to { transform: translateX(150%); opacity: 0; } }
@keyframes cd-vao { from { transform: translateX(120%); opacity: 0; } }
@keyframes cd-cham { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes cd-chip-vao { from { opacity: 0; transform: translateX(24px) scale(0.9); } }
@media (prefers-reduced-motion: no-preference) {
  .cd-den { animation: cd-lac 3.2s ease-in-out infinite; }
  .cd-den-1 { animation-delay: -0.8s; } .cd-den-2 { animation-delay: -1.6s; } .cd-den-3 { animation-delay: -2.2s; } .cd-den-4 { animation-delay: -0.4s; }
  .cd-loi-an i { animation: cd-cham 1.1s ease-in-out infinite; }
  .cd-loi-an i:nth-child(2) { animation-delay: 0.18s; } .cd-loi-an i:nth-child(3) { animation-delay: 0.36s; }
}
@media (prefers-reduced-motion: reduce) {
  .cd-khach .cd-av, .cd-chip { animation: none !important; }
}
/* Che do nhe: tat hoat anh trang tri */
body.nt-nhe .cd-den, body.nt-nhe .cd-loi-an i, body.nt-nhe .cd-khach .cd-av, body.nt-nhe .cd-chip { animation: none !important; }
body.nt-nhe .cd-den { filter: none; }
@media (max-width: 380px) {
  .cd-o-hang { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cd-o-lg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cd-canh { height: 306px; }
}
