/* didate: tấm thiệp (trang /<id> và khung xem thử lúc soạn). Lớp nào cũng bắt đầu bằng t- cho khỏi đụng trang soạn.
   Màu theo data-mau trên .t-trang; chữ trắng trên --chinh và --chinh-dam trên --nhat đều đạt tương phản 4,5:1 trở lên. */
@font-face {
  font-family: "Baloo 2";
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/baloo2-600.woff) format("woff");
}
@font-face {
  font-family: "Baloo 2";
  font-weight: 800;
  font-display: swap;
  src: url(/fonts/baloo2-800.woff) format("woff");
}

html:has(> body > .t-trang) {
  background: #fff7fa;
}
body:has(> .t-trang) {
  margin: 0;
}
.t-trang {
  --the: #fff;
  --nen1: #ffe3ee;
  --nen2: #fff7fa;
  --chinh: #c2255c;
  --chinh-dam: #9c1c4a;
  --nhat: #ffe0ec;
  --vien: #f7c6d9;
  --chu: #3d2230;
  --chu-nhat: #6e4a5c;
  --loi: #b42318;
  color-scheme: light;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(20px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  background: linear-gradient(165deg, var(--nen1), var(--nen2) 70%);
  color: var(--chu);
  font-family: "Baloo 2", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 600;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
.t-trang *,
.t-trang *::before,
.t-trang *::after {
  box-sizing: border-box;
}
.t-trang[data-mau="do"] {
  --nen1: #ffe1e1;
  --nen2: #fff6f3;
  --chinh: #c0182f;
  --chinh-dam: #8f1023;
  --nhat: #ffe1e3;
  --vien: #f5bfc5;
  --chu: #3a1a1f;
  --chu-nhat: #6b4047;
}
.t-trang[data-mau="bac-ha"] {
  --nen1: #d8f5ea;
  --nen2: #f4fffa;
  --chinh: #0f7a62;
  --chinh-dam: #0a5a48;
  --nhat: #d9f4ea;
  --vien: #b5e6d4;
  --chu: #15372f;
  --chu-nhat: #3f6158;
}
.t-trang[data-mau="kem"] {
  --nen1: #fff0c9;
  --nen2: #fffaf0;
  --chinh: #b4530f;
  --chinh-dam: #8a3d08;
  --nhat: #fff0cc;
  --vien: #f6d999;
  --chu: #3d2a12;
  --chu-nhat: #6b5333;
}
.t-trang[data-mau="tim"] {
  --nen1: #ece4ff;
  --nen2: #faf8ff;
  --chinh: #6a3fd6;
  --chinh-dam: #4f2aa8;
  --nhat: #ece4ff;
  --vien: #d6c8fb;
  --chu: #2a1f45;
  --chu-nhat: #5a4d78;
}
.t-trang[data-mau="troi"] {
  --nen1: #dcefff;
  --nen2: #f5fbff;
  --chinh: #1867a8;
  --chinh-dam: #104b7c;
  --nhat: #dcefff;
  --vien: #bcdcf6;
  --chu: #13283b;
  --chu-nhat: #445a6e;
}

/* ----- tấm thiệp ----- */
.t-the {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 26px 20px 18px;
  border: 1px solid var(--vien);
  border-radius: 28px;
  background: var(--the);
  box-shadow: 0 20px 50px -24px var(--chinh);
}
.t-man {
  text-align: center;
}
.t-man[hidden],
.t-trang [hidden] {
  display: none !important;
}
.t-nhan-dan {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 14px;
  border-radius: 999px;
  background: var(--nhat);
  color: var(--chinh-dam);
  font-size: 0.88rem;
  font-weight: 800;
}
h1.t-nhan-dan {
  margin-top: 8px;
  padding: 6px 18px;
  font-size: 1.2rem;
}
.t-tieu-de {
  margin: 6px 0 10px;
  color: var(--chu);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.22;
  overflow-wrap: anywhere;
}
.t-man [tabindex="-1"]:focus {
  outline: none; /* tiêu đề nhận tiêu điểm khi đổi màn (cho máy đọc màn hình), không cần viền */
}
.t-loi {
  margin: 0 0 14px;
  color: var(--chu-nhat);
  font-size: 1.03rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.t-loi b {
  color: var(--chinh-dam);
  font-weight: 800;
}
.t-loi-cuoi {
  color: var(--chinh-dam);
}
.t-cau-hoi {
  margin: 8px 0 14px;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.t-polaroid {
  width: min(80%, 290px);
  margin: 6px auto 18px;
  padding: 10px 10px 32px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 12px 26px -8px rgba(40, 20, 30, 0.28);
  transform: rotate(-2.5deg);
}
.t-polaroid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 2px;
  background: var(--nhat);
  object-fit: cover;
}

/* ----- nút ----- */
.t-hai-nut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
}
.t-nut {
  min-height: 48px;
  padding: 10px 22px;
  border: 2px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.2s,
    background-color 0.2s;
}
.t-nut:focus-visible,
.t-chip:focus-visible,
.t-mon:focus-visible,
.t-ngay:focus-visible,
.t-lich-nut:focus-visible,
.t-lien-ket:focus-visible,
.t-phong-thu:focus-visible,
.t-hop:focus-visible {
  outline: 3px solid var(--chu);
  outline-offset: 2px;
}
.t-nut:disabled {
  opacity: 0.6;
  cursor: default;
}
.t-nut-co {
  background: var(--chinh);
  color: #fff;
  box-shadow: 0 8px 18px -8px var(--chinh);
}
.t-nut-co:hover {
  background: var(--chinh-dam);
}
.t-nut-co.t-nhay {
  animation: t-nhay 1.1s ease-in-out infinite;
}
.t-nut-khong {
  border-color: var(--vien);
  background: #fff;
  color: var(--chinh-dam);
}
.t-nut-khong.t-dang-ne {
  position: absolute;
  z-index: 3;
  margin: 0;
  transition:
    left 0.28s cubic-bezier(0.3, 1.4, 0.5, 1),
    top 0.28s cubic-bezier(0.3, 1.4, 0.5, 1),
    opacity 0.3s,
    transform 0.3s;
}
.t-cho-nut {
  flex: none;
}
.t-nut-khong.t-tron {
  opacity: 0;
  transform: scale(0.3) rotate(25deg);
}
.t-nut-phu {
  background: var(--nhat);
  color: var(--chinh-dam);
}
.t-nut-phu:hover {
  border-color: var(--vien);
}
.t-nut-rong {
  width: 100%;
  margin-top: 10px;
}
.t-lien-ket {
  padding: 0;
  border: 0;
  background: none;
  color: var(--chinh-dam);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.t-goi-y {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--chu-nhat);
  font-size: 0.92rem;
}

/* ----- phong thư ----- */
.t-phong-thu {
  position: relative;
  display: block;
  width: 240px;
  height: 160px;
  margin: 22px auto 10px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 700px;
  animation: t-lac 3s ease-in-out infinite;
}
.t-phong-thu > span {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  transition: transform 0.45s ease;
}
.t-thu-than {
  z-index: 1;
  background: var(--vien);
}
.t-thu-giay {
  z-index: 2;
  inset: 12px 16px 18px !important;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10px;
  border-radius: 8px !important;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-size: 1.6rem;
}
.t-phong-thu::before {
  /* túi trước của phong thư */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: 12px;
  background: var(--nhat);
  box-shadow: 0 16px 30px -16px var(--chinh);
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
}
.t-thu-nap {
  z-index: 4;
  background: var(--chinh);
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  transform-origin: top center;
}
.t-thu-tim {
  z-index: 5;
  inset: auto !important;
  top: 70px !important;
  left: 50% !important;
  font-size: 1.9rem;
  line-height: 1;
  transform: translate(-50%, -50%);
}
.t-phong-thu.t-dang-mo {
  animation: none;
}
.t-dang-mo .t-thu-nap {
  z-index: 1;
  transform: rotateX(180deg);
}
.t-dang-mo .t-thu-giay {
  transform: translateY(-62%);
  transition-delay: 0.3s;
}
.t-dang-mo .t-thu-tim {
  opacity: 0;
}

/* ----- hộp quà ----- */
.t-hop {
  position: relative;
  display: block;
  width: 180px;
  height: 170px;
  margin: 22px auto 10px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  animation: t-lac 2.6s ease-in-out infinite;
}
.t-hop > span {
  position: absolute;
  transition:
    transform 0.6s ease,
    opacity 0.6s;
}
.t-hop-than {
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 112px;
  border-radius: 8px;
  background: linear-gradient(90deg, transparent 43%, var(--nhat) 43%, var(--nhat) 57%, transparent 57%), var(--chinh);
}
.t-hop-nap {
  z-index: 2;
  left: 4px;
  right: 4px;
  top: 30px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(90deg, transparent 43%, var(--nhat) 43%, var(--nhat) 57%, transparent 57%), var(--chinh-dam);
}
.t-hop-no {
  z-index: 3;
  top: -4px;
  left: 50%;
  font-size: 2.7rem;
  line-height: 1;
  transform: translateX(-50%);
}
.t-hop.t-dang-mo {
  animation: none;
}
.t-dang-mo .t-hop-nap {
  opacity: 0;
  transform: translate(36px, -70px) rotate(28deg);
}
.t-dang-mo .t-hop-no {
  opacity: 0;
  transform: translate(-10%, -90px) rotate(-20deg);
}

/* ----- chọn ngày, giờ, món ----- */
.t-khoi {
  margin: 18px 0;
  text-align: left;
}
.t-khoi h2 {
  margin: 0 0 8px;
  font-size: 1.08rem;
  font-weight: 800;
}
.t-lich {
  padding: 10px;
  border: 1px solid var(--vien);
  border-radius: 18px;
}
.t-lich-dau {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.t-lich-thang {
  margin: 0;
  font-weight: 800;
}
.t-lich-nut {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--nhat);
  color: var(--chinh-dam);
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.t-lich-nut:disabled {
  opacity: 0.35;
  cursor: default;
}
.t-lich-luoi {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-top: 8px;
}
.t-lich-thu {
  color: var(--chu-nhat);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}
.t-ngay {
  min-height: 38px;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--chu);
  font: inherit;
  cursor: pointer;
}
.t-ngay:disabled {
  opacity: 0.32;
  cursor: default;
}
.t-ngay.t-hom-nay {
  box-shadow: inset 0 0 0 2px var(--vien);
}
.t-ngay:not(:disabled):hover {
  background: var(--nhat);
}
.t-ngay[aria-pressed="true"] {
  background: var(--chinh) !important;
  color: #fff;
  font-weight: 800;
}
.t-da-chon {
  min-height: 1.4em;
  margin: 6px 0 0;
  color: var(--chinh-dam);
  font-weight: 800;
}
.t-chip-nhom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.t-chip {
  min-height: 44px;
  padding: 6px 16px;
  border: 2px solid var(--vien);
  border-radius: 999px;
  background: #fff;
  color: var(--chu);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.t-chip[aria-pressed="true"] {
  border-color: var(--chinh);
  background: var(--chinh);
  color: #fff;
}
.t-mon-ds {
  display: grid;
  gap: 8px;
}
.t-mon {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--vien);
  border-radius: 18px;
  background: #fff;
  color: var(--chu);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.t-mon[aria-pressed="true"] {
  border-color: var(--chinh);
  background: var(--nhat);
}
.t-mon-bieu {
  flex: none;
  font-size: 1.7rem;
  line-height: 1;
}
.t-mon-chu {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}
.t-mon-chu b {
  font-weight: 800;
}
.t-mon-chu small {
  color: var(--chu-nhat);
  font-size: 0.88rem;
}
.t-o {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 14px;
  border: 2px solid var(--vien);
  border-radius: 14px;
  background: #fff;
  color: var(--chu);
  font: inherit;
  font-size: 1rem;
}
.t-o:focus {
  border-color: var(--chinh);
  outline: none;
}
textarea.t-o {
  min-height: 84px;
  resize: vertical;
}
.t-loi-chon {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: var(--loi);
  font-weight: 800;
}

/* ----- kết ----- */
.t-tom-tat {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--nhat);
  text-align: left;
}
.t-tom-tat div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.t-tom-tat dt {
  color: var(--chu-nhat);
}
.t-tom-tat dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
  overflow-wrap: anywhere;
}
.t-loi-nhan {
  margin-top: 18px;
  text-align: left;
}
.t-loi-nhan label > span {
  font-weight: 800;
}
.t-loi-nhan .t-nut {
  margin-top: 8px;
}
.t-trang-thai {
  min-height: 1.3em;
  margin: 10px 0 0;
  color: var(--chu-nhat);
  font-size: 0.92rem;
}
.t-man-tu-choi > .t-nut {
  margin-top: 14px;
}

/* ----- khung trên cùng (thiệp của bạn, thiệp mẫu) ----- */
.t-banner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--vien);
  border-radius: 16px;
  background: #fff;
  font-size: 0.92rem;
  text-align: center;
}
.t-banner a {
  color: var(--chinh-dam);
  font-weight: 800;
}

/* ----- tim bay, pháo hoa ----- */
.t-tim-bay {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.t-tim {
  position: absolute;
  bottom: -48px;
  font-size: 22px;
  opacity: 0.5;
  animation: t-bay 15s linear infinite;
}
.t-tim:nth-child(1) { left: 4%; animation-delay: 0s; font-size: 18px; }
.t-tim:nth-child(2) { left: 14%; animation-delay: -6s; animation-duration: 18s; }
.t-tim:nth-child(3) { left: 25%; animation-delay: -11s; font-size: 16px; }
.t-tim:nth-child(4) { left: 37%; animation-delay: -3s; animation-duration: 20s; font-size: 26px; }
.t-tim:nth-child(5) { left: 49%; animation-delay: -9s; }
.t-tim:nth-child(6) { left: 61%; animation-delay: -1s; animation-duration: 17s; font-size: 18px; }
.t-tim:nth-child(7) { left: 72%; animation-delay: -13s; font-size: 24px; }
.t-tim:nth-child(8) { left: 83%; animation-delay: -5s; animation-duration: 19s; }
.t-tim:nth-child(9) { left: 92%; animation-delay: -8s; font-size: 16px; }
.t-tim:nth-child(10) { left: 55%; animation-delay: -14s; animation-duration: 22s; font-size: 20px; }
.t-phao-hoa {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.t-phao-hoa span {
  position: absolute;
  top: 42%;
  left: 50%;
  font-size: 24px;
  animation: t-no 2.4s ease-out forwards;
}
.t-phao-hoa span:nth-child(1) { --x: -150px; --y: -230px; }
.t-phao-hoa span:nth-child(2) { --x: 140px; --y: -240px; }
.t-phao-hoa span:nth-child(3) { --x: -60px; --y: -300px; }
.t-phao-hoa span:nth-child(4) { --x: 70px; --y: -290px; }
.t-phao-hoa span:nth-child(5) { --x: -190px; --y: -120px; }
.t-phao-hoa span:nth-child(6) { --x: 180px; --y: -110px; }
.t-phao-hoa span:nth-child(7) { --x: -120px; --y: 40px; }
.t-phao-hoa span:nth-child(8) { --x: 130px; --y: 60px; }
.t-phao-hoa span:nth-child(9) { --x: 0px; --y: -340px; }
.t-phao-hoa span:nth-child(10) { --x: -170px; --y: -320px; }
.t-phao-hoa span:nth-child(11) { --x: 165px; --y: -330px; }
.t-phao-hoa span:nth-child(12) { --x: -40px; --y: 110px; }
.t-phao-hoa span:nth-child(13) { --x: 50px; --y: 120px; }
.t-phao-hoa span:nth-child(14) { --x: -210px; --y: -20px; }
.t-phao-hoa span:nth-child(15) { --x: 205px; --y: -10px; }
.t-phao-hoa span:nth-child(16) { --x: -95px; --y: -180px; }
.t-phao-hoa span:nth-child(17) { --x: 100px; --y: -175px; }
.t-phao-hoa span:nth-child(18) { --x: 10px; --y: -150px; }

@keyframes t-bay {
  to {
    transform: translateY(-120vh) rotate(30deg);
  }
}
@keyframes t-no {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.4);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--x) - 50%), calc(var(--y) - 50%)) scale(1.15) rotate(200deg);
  }
}
@keyframes t-lac {
  0%,
  70%,
  100% {
    rotate: 0deg;
  }
  76% {
    rotate: -4deg;
  }
  82% {
    rotate: 4deg;
  }
  88% {
    rotate: -2deg;
  }
}
@keyframes t-nhay {
  50% {
    scale: 1.07;
  }
}
@media (prefers-reduced-motion: reduce) {
  .t-tim-bay,
  .t-phao-hoa {
    display: none;
  }
  .t-phong-thu,
  .t-hop,
  .t-nut-co.t-nhay {
    animation: none;
  }
  .t-trang *,
  .t-trang *::before {
    transition-duration: 0.01s !important;
  }
}
@media (max-width: 480px) {
  /* điện thoại: ảnh nhỏ lại để câu hỏi và hai nút hiện ngay, khỏi phải cuộn */
  .t-polaroid {
    width: min(62%, 230px);
    margin-bottom: 14px;
  }
  .t-tieu-de {
    font-size: 1.45rem;
  }
}
@media (max-width: 360px) {
  .t-tieu-de {
    font-size: 1.4rem;
  }
  .t-the {
    padding: 22px 14px 16px;
  }
}
