/* Thẻ thiệp Live Wall dùng chung cho màn LED và bản mobile: ảnh phía trên, lời nhắn viết như một lá thư phía dưới.
   Kích thước theo em; phần tử cha đặt font-size. */
:root {
  --lw-green: #0b7a3b;
  --lw-green-strong: #0a8f3d;
  --lw-ink-soft: #2f4a3c;
}

.card {
  position: relative;
  background: #fff;
  color: var(--lw-green);
  border-radius: 1.3em;
  overflow: hidden;
  box-shadow: 0 0.7em 1.6em rgba(51, 54, 28, 0.18), 0 0.12em 0.4em rgba(29, 58, 39, 0.12);
}
/* Độ sâu của thiệp lớp giữa/sau: phủ một lớp tối nhẹ (rẻ hơn filter, vì filter trên thiệp đang chuyển động phải vẽ lại mỗi khung hình). */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(18, 32, 22, var(--dim, 0));
  pointer-events: none;
}
/* Ảnh món gốc 1000×667 (3:2): khung cùng tỉ lệ để không cắt phần đầu có logo (16:9 từng cắt ~16% chiều cao). */
.card img.photo { width: 100%; aspect-ratio: 1000 / 667; object-fit: cover; display: block; }
.card .letter {
  padding: 0.7em 0.85em 0.85em;
  font-family: 'Momo Signature', 'Segoe Script', 'Brush Script MT', cursive;
  font-size: 0.62em; /* chữ viết tay to hơn khi thiệp lớn nhờ font-size của phần tử cha */
  line-height: 1.38;
}
.card .letter p { margin: 0; }
.card .letter .greet { margin-bottom: 0.6em; }
.card .letter .body {
  margin-bottom: 0.7em;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .letter .sign { font-size: 0.95em; }

/* ---------- Popup đọc thiệp (dùng chung màn LED và mobile) ---------- */
.lw-popup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 30, 22, 0.6);
  animation: lw-popup-fade 260ms ease-out;
}
.lw-popup-box {
  position: relative;
  max-width: 100%;
  animation: lw-popup-rise 380ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.lw-popup-box .card {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 1.2em 3em rgba(0, 0, 0, 0.4);
}
.lw-popup-box .card .letter .body { -webkit-line-clamp: unset; display: block; }
.lw-popup-close {
  position: absolute;
  top: -12px;
  right: -12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(44px, 2.4vw, 64px); /* cỡ theo màn hình, không theo font-size của khung thiệp; ≥44px để chạm dễ */
  height: clamp(44px, 2.4vw, 64px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--lw-green-strong);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.lw-popup-close svg { width: 50%; height: 50%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.lw-popup-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@keyframes lw-popup-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lw-popup-rise { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
