:root {
  --go-dam: #2a1d14;
  --giay: #f3ead8;
  --giay-dam: #e6d8bb;
  --muc: #3b2a1e;
  --muc-nhat: #7a6450;
  --chi-do: #a8432f;
  --vang: #e7b866;
  --bong: 0 18px 50px rgba(20, 12, 6, .45);
}
* { box-sizing: border-box; }
[hidden]:not(#the) { display: none !important; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--go-dam); color: var(--muc);
  font-family: "Lora", Georgia, serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#gac {
  position: fixed; inset: 0; touch-action: none; cursor: grab;
  user-select: none; -webkit-user-select: none;
}
#gac.dang-keo { cursor: grabbing; }
#tranh { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* chữ trên tấm biển gỗ */
#bien-chu {
  position: absolute; left: 0; top: 0; transform-origin: 0 0;
  font-family: "Patrick Hand", cursive; color: #3a2414; text-align: center;
  line-height: 1.05; white-space: nowrap; pointer-events: none;
  text-shadow: 0 0 1px rgba(255, 230, 190, .35); opacity: .88;
}

/* điểm chạm */
#diem { position: absolute; inset: 0; pointer-events: none; }
.dv {
  position: absolute; pointer-events: auto; border: 0; padding: 0; margin: 0;
  background: transparent; border-radius: 14px; cursor: pointer;
  transition: box-shadow .35s, background .35s;
}
.dv:hover, .dv:focus-visible {
  outline: none;
  background: radial-gradient(closest-side, rgba(255, 220, 150, .16), rgba(255, 220, 150, 0));
  box-shadow: 0 0 0 1px rgba(255, 228, 170, .35);
}
.dv .nhan {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  font: 18px/1 "Patrick Hand", cursive; color: var(--giay); white-space: nowrap;
  background: rgba(42, 29, 20, .78); padding: 4px 10px 5px; border-radius: 4px;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.dv:hover .nhan, .dv:focus-visible .nhan { opacity: 1; }
.dv .cham {
  position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px;
  border-radius: 50%; background: rgba(255, 226, 160, .85);
  box-shadow: 0 0 12px 4px rgba(255, 210, 130, .45);
  animation: tho 2.6s ease-in-out infinite; opacity: 0; transition: opacity .6s;
}
body.goi-y-cham .dv .cham { opacity: 1; }
@keyframes tho { 0%, 100% { transform: scale(.7); opacity: .55; } 50% { transform: scale(1.15); opacity: 1; } }

/* màn mở cửa */
#mo-cua {
  position: fixed; inset: 0; display: grid; place-items: center; background: var(--go-dam);
  color: var(--giay-dam); font: 22px "Patrick Hand", cursive; transition: opacity .9s; z-index: 30;
}
#mo-cua.xong { opacity: 0; pointer-events: none; }

#goi-y, #loi-nhan {
  position: fixed; left: 50%; transform: translateX(-50%); margin: 0; z-index: 10;
  font: 19px/1.2 "Patrick Hand", cursive; color: var(--giay);
  background: rgba(42, 29, 20, .72); padding: 7px 16px 8px; border-radius: 20px;
  pointer-events: none; transition: opacity .8s; max-width: calc(100vw - 32px); text-align: center;
}
#goi-y { bottom: max(28px, env(safe-area-inset-bottom)); }
#goi-y.an { opacity: 0; }
#loi-nhan { top: max(18px, env(safe-area-inset-top)); opacity: 0; }
#loi-nhan.hien { opacity: 1; }

/* máy hát nhỏ ở góc */
#may-hat-nho {
  position: fixed; left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 12;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  background: var(--giay); color: var(--muc); padding: 8px 10px 8px 12px; border-radius: 6px;
  box-shadow: var(--bong); font-size: 14px;
}
#may-hat-nho .dia {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: radial-gradient(circle, var(--chi-do) 0 22%, #1d1612 24% 100%);
  animation: quay 3s linear infinite;
}
#may-hat-nho.dung .dia { animation-play-state: paused; }
@keyframes quay { to { transform: rotate(360deg); } }
#dang-phat { font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#may-hat-nho button {
  flex: none; font: 16px "Patrick Hand", cursive; color: var(--muc); background: var(--giay-dam);
  border: 0; border-radius: 4px; padding: 4px 9px; cursor: pointer;
}
#may-hat-nho button:hover { background: #d9c7a3; }

/* thẻ giấy */
#the {
  position: fixed; z-index: 20; background: var(--giay); color: var(--muc);
  box-shadow: var(--bong); padding: 28px 26px 24px;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(122, 100, 80, .09) 31px 32px);
  right: 24px; top: 24px; bottom: 24px; width: min(420px, calc(100vw - 48px));
  overflow-y: auto; border-radius: 3px;
  transform: translateX(0); transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .45s;
}
#the[hidden] { display: block; transform: translateX(110%); opacity: 0; pointer-events: none; }
#the-dong {
  position: absolute; right: 10px; top: 6px; border: 0; background: none; cursor: pointer;
  font: 30px/1 "Lora", serif; color: var(--muc-nhat); padding: 4px 8px;
}
#the h2 { font-family: "Patrick Hand", cursive; font-weight: 400; font-size: 30px; margin: 0 0 6px; line-height: 1.1; }
#the .phu { font-style: italic; color: var(--muc-nhat); margin: 0 0 18px; }
#the p { line-height: 1.6; }
#the a { color: var(--chi-do); }
#the ul { list-style: none; padding: 0; margin: 0; }
#the li { border-bottom: 1px dashed rgba(122, 100, 80, .35); }
#the li a { display: block; padding: 12px 2px; text-decoration: none; color: var(--muc); }
#the li a:hover { color: var(--chi-do); }
#the li a::after { content: " ↗"; color: var(--muc-nhat); font-size: .85em; }
#the .the-so-do {
  background: #fffaf0; border: 1px solid var(--giay-dam); padding: 16px 18px; margin: 4px 0 16px;
  font-family: "Patrick Hand", cursive; font-size: 22px; line-height: 1.35; transform: rotate(-.6deg);
}
#the .nho { font-size: 14px; color: var(--muc-nhat); }
#the iframe { width: 100%; border: 0; height: calc(100vh - 230px); min-height: 360px; }
@media (max-width: 700px) { #the iframe { height: calc(74vh - 190px); } }
#the .nut {
  display: inline-block; font: 19px "Patrick Hand", cursive; background: var(--muc); color: var(--giay);
  padding: 8px 16px 9px; border-radius: 4px; text-decoration: none; border: 0; cursor: pointer; margin-top: 6px;
}
#the .nut:hover { background: var(--chi-do); }

@media (max-width: 700px) {
  #the {
    left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-height: 74vh;
    padding: 24px 18px calc(22px + env(safe-area-inset-bottom)); border-radius: 12px 12px 0 0;
  }
  #the[hidden] { transform: translateY(105%); }
  #may-hat-nho { bottom: max(16px, env(safe-area-inset-bottom)); }
  #goi-y { bottom: max(84px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* bản 2 */
#nhan-noi {
  position: fixed; left: 0; top: 0; z-index: 15; pointer-events: none;
  font: 18px/1 "Patrick Hand", cursive; color: var(--giay);
  background: rgba(42, 29, 20, .82); padding: 5px 10px 6px; border-radius: 4px; white-space: nowrap;
}
#the .loi-chao p { font-family: "Patrick Hand", cursive; font-size: 21px; line-height: 1.45; margin: 0 0 12px; }

/* bảng tin */
#bt-form { display: grid; gap: 6px; margin: 4px 0 18px; position: relative; }
.bt-nhan { font: 18px "Patrick Hand", cursive; margin-top: 6px; }
#bt-form textarea, #bt-form input:not([type=file]) {
  font: 16px "Lora", serif; color: var(--muc); background: #fffaf0; border: 1px solid var(--giay-dam);
  border-radius: 3px; padding: 8px 10px; width: 100%;
}
#bt-form textarea:focus, #bt-form input:focus { outline: 2px solid var(--chi-do); outline-offset: 1px; }
.bt-dem { text-align: right; font-size: 13px; color: var(--muc-nhat); margin-top: -4px; }
#bt-xem { max-width: 160px; max-height: 160px; border: 6px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); transform: rotate(-1.5deg); }
.bt-ds { display: grid; gap: 14px; }
.bt-giay { background: #fffaf0; padding: 12px 14px; box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.bt-giay:nth-child(odd) { transform: rotate(-.6deg); } .bt-giay:nth-child(even) { transform: rotate(.5deg); }
.bt-giay img { width: 100%; display: block; margin-bottom: 8px; }
.bt-giay p { margin: 0; font: 21px/1.35 "Patrick Hand", cursive; }
.bt-giay p.nho { font-size: 16px; margin-top: 4px; text-align: right; }

/* nhạc và trình phát nhúng trong thẻ */
#the .ds-bai, #the .ke-dia { list-style: none; padding: 0; margin: 0 0 14px; counter-reset: bai; }
#the .ds-bai li, #the .ke-dia li { border-bottom: 1px dashed rgba(122,100,80,.35); }
#the .ds-bai button, #the .ke-dia button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer; padding: 11px 2px;
  font: 18px "Lora", serif; color: var(--muc);
}
#the .ds-bai li { counter-increment: bai; }
#the .ds-bai button::before { content: counter(bai) ". "; color: var(--muc-nhat); }
#the .ds-bai button:hover, #the .ke-dia button:hover { color: var(--chi-do); }
#the .ds-bai button.dang { color: var(--chi-do); font-style: italic; }
#the .ds-bai button.dang::after { content: "  ♪"; }
#the .ke-dia button::after { content: "  ▸"; color: var(--muc-nhat); }
#the .nhung { margin: 6px 0 12px; }
#the .nhung iframe { width: 100%; border: 0; border-radius: 10px; display: block; min-height: 0; height: auto; }
#the .nhung-spotify iframe { height: 352px; }
#the .nhung-youtube iframe { aspect-ratio: 16 / 9; height: auto; }
#the .nhung-facebook iframe { height: 620px; background: #fff; }
