/* =========================================================
   filmmyandmaoji payment
   หน้าเว็บออกแบบที่ความกว้าง 402px แล้วซูมตามจอ (ตั้งค่า --z ใน app.js)
   ========================================================= */
:root {
  --z: 1;
  --brown: #623719;
  --brown-2: #7a5439;
  --mint: #84c6b3;
  --mint-line: #cff4d8;
  --paper: #fefefc;
  --font: "Kanit", "Noto Sans Thai", "Sukhumvit Set", Tahoma, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { background: #e8f9ee; }
body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--brown);
  background: #e8f9ee url("../img/bg-stripes.webp") center top / calc(402px * var(--z)) auto repeat;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; -webkit-user-drag: none; user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
p { margin: 0; }
[hidden] { display: none !important; }

/* ---------------- stage ---------------- */
.stage {
  position: relative;
  z-index: 1;
  display: flow-root;
  width: 402px;
  margin: 0 auto;
  padding-bottom: 60px;
  zoom: var(--z);
}

.btn-music, .btn-admin { position: absolute; z-index: 6; transition: transform .15s ease; }
.btn-music { left: 5px; top: 12px; width: 69px; height: 69px; border-radius: 50%; }
.btn-admin { left: 305px; top: 10px; width: 80px; height: 27px; }
.btn-music:active, .btn-admin:active { transform: scale(.94); }
.btn-music.playing img { animation: musicWobble 2.6s ease-in-out infinite; }
.btn-music.playing::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  border: 2px solid rgba(132, 198, 179, .9);
  animation: musicPulse 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes musicWobble { 0%,100% { transform: rotate(0) } 25% { transform: rotate(-7deg) } 75% { transform: rotate(7deg) } }
@keyframes musicPulse { from { transform: scale(1); opacity: .9 } to { transform: scale(1.35); opacity: 0 } }

/* ---------------- avatar + decorations ---------------- */
.avatar-group { position: relative; width: 272px; height: 200px; }
.hero-avatar { position: absolute; left: 70px; top: 28px; z-index: 4; pointer-events: none; }
.avatar-group .deco { position: absolute; }
.deco-bear     { left: 9px;   top: 5px;   width: 99px; }
.deco-parfait  { left: 161px; top: 19px;  width: 101.75px; }
.deco-cake     { left: 8px;   top: 86px;  width: 100.5px; }
.deco-chocmint { left: 148px; top: 107px; width: 95px; }
.avatar {
  position: absolute; left: 59px; top: 32px;
  width: 146px; height: 146px; border-radius: 50%;
  background: #fff;
  border: 5px solid #bfefd9;
  padding: 5.5px;
  box-shadow: 0 0 6px 2px rgba(255, 255, 255, .95);
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* ---------------- cards (ใช้กรอบจากดีไซน์แบบ 9-slice) ---------------- */
.card, .card-frame { position: relative; width: 383px; isolation: isolate; }
.card { margin-left: 9.5px; }
.card::before, .card-frame::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border: 55px solid transparent;
  border-image: var(--frame, url("../img/frame-3.webp")) 220 fill / 55px stretch;
  pointer-events: none;
}

.divider { border: 0; height: 2px; background: var(--mint-line); margin: 0 14.5px; }

/* card 1 */
.card-1 { --frame: url("../img/frame-1.webp"); margin-top: 129.5px; height: 259.25px; }
.title-img { margin: 0; display: flex; justify-content: center; }
.card-1 .title-img { position: absolute; top: 86.5px; left: 0; right: 0; }
.card-1 .title-img img { width: 252.75px; }
.card-1-sub { position: absolute; top: 120px; left: 0; right: 0; text-align: center; font-weight: 600; font-size: 17px; line-height: 24px; }
.card-1-div { position: absolute; top: 151.5px; left: 49px; width: 284px; margin: 0; }
.fb-btn {
  position: absolute; top: 162.5px; left: 32.5px; width: 315px; height: 53px;
  display: flex; align-items: center; padding: 0 16px 0 20px;
  background: url("../img/pill-mint.webp") 0 0 / 100% 100% no-repeat;
  color: var(--brown); text-decoration: none;
  transition: transform .15s ease, filter .15s ease;
}
.fb-btn:active { transform: scale(.97); filter: brightness(.97); }
.fb-icon { width: 27px; height: 27px; }
.fb-btn span { margin-left: 13px; font-family: "Fredoka", var(--font); font-weight: 600; font-size: 21px; letter-spacing: .3px; }
.fb-ext { margin-left: auto; width: 17px; height: 17px; color: #bdb9a9; }

/* card 2 */
.card-2 { --frame: url("../img/frame-2.webp"); margin-top: -27.25px; padding: 44.5px 0 40.75px; }
.qr-btn { display: block; width: 306px; margin: 0 auto; border-radius: 16px; transition: transform .15s ease; }
.qr-btn:active { transform: scale(.98); }
.qr-btn img { width: 100%; height: auto; border-radius: 16px; }
.star-qr { position: absolute; left: -9.5px; top: -8.5px; width: 72.5px; z-index: 2; pointer-events: none; }
.card-2 .deco-cake-2 { position: absolute; right: -9.6px; bottom: -15.5px; width: 91px; z-index: 2; pointer-events: none; }

/* card 3 */
.card-3 { --frame: url("../img/frame-3.webp"); margin-top: -16.25px; padding: 29px 35px 36px; }
.pay-info { text-align: center; font-weight: 500; font-size: 16.5px; line-height: 22.5px; }
.pay-info .pay-head { font-weight: 600; font-size: 19px; }
.holder { color: var(--mint); }
.card-1-sub, .pay-info, .section-head, .note-head, .note-sub, .admin-sub, .admin-label, .login-title, .login-sub { text-shadow: 0 1px 3px rgba(98, 55, 25, .18); }
.card-3 > .divider { margin-top: 13px; margin-bottom: 13px; }
.section-head { display: flex; align-items: center; justify-content: center; gap: 9px; font-weight: 600; font-size: 19.5px; line-height: 28px; margin-bottom: 8px; }
.section-head img { width: 23px; height: 28px; }
.note-head { text-align: center; font-weight: 600; font-size: 19px; line-height: 25px; }
.note-sub { text-align: center; font-weight: 500; font-size: 16.5px; line-height: 23px; margin-bottom: 9px; }
.card-3 .deco-chocmint-2 { position: absolute; left: -9.5px; bottom: -9.75px; width: 72.75px; pointer-events: none; }
.card-3 .star-b1 { position: absolute; left: 334.5px; bottom: 20.75px; width: 58px; pointer-events: none; }
.card-3 .star-b2 { position: absolute; left: 329.5px; bottom: 2.75px; width: 35px; pointer-events: none; }

/* rows */
.rows { display: flex; flex-direction: column; gap: 3px; }
.row {
  position: relative; display: flex; align-items: center;
  width: 313px; height: 54px; padding: 0 6.5px 0 9.5px;
  background: url("../img/row.webp") 0 0 / 100% 100% no-repeat;
  text-align: left;
}
.row-logo { flex: none; width: 38.5px; height: 38.5px; border-radius: 50%; }
.row-logo.generic {
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 11.5px; letter-spacing: .2px;
  border: 3.5px solid #f2e6d9;
  box-shadow: 0 0 0 1px #e7d6c6;
}
.row-logo.note { display: grid; place-items: center; background: #ead9ca; border: 3.5px solid #f3e9df; }
.row-logo.note img { width: 20px; height: 20px; }
.row-text { flex: 1; min-width: 0; margin-left: 8px; line-height: 1.22; }
.row-name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-num { font-weight: 500; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-btn {
  flex: none; width: 52px; height: 40px; margin-left: 6px;
  display: grid; place-items: center;
  background: url("../img/btn-copy-bg.webp") 0 0 / 100% 100% no-repeat;
  transition: transform .12s ease, filter .12s ease;
}
.row-btn img { width: 24px; height: 24px; }
.row-btn.pencil img { width: 26px; height: 26px; }
.row-btn:active { transform: scale(.92); filter: brightness(1.1); }
.row-btn.done { filter: brightness(1.15) saturate(.8); }
.row-add {
  justify-content: center; gap: 12px; margin-top: 3px;
  background-image: url("../img/row-dashed.webp");
  font-weight: 600; font-size: 21px; color: #6d4b33;
}
.row-add img { width: 18px; height: 40px; }

/* ---------------- overlays / modals ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  overflow-y: auto; overscroll-behavior: contain;
  background: rgba(37, 58, 48, .55);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  display: flex; justify-content: center; align-items: flex-start;
  animation: fadeIn .2s ease;
}
.overlay.centered { align-items: center; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal-zoom { zoom: var(--z); width: 402px; padding: 90px 0 70px; }
.overlay.centered .modal-zoom { padding: 40px 0; }
.modal { margin: 0 auto; padding: 44px 37px 40px; animation: popIn .28s cubic-bezier(.2, 1.3, .5, 1); }
@keyframes popIn { from { transform: scale(.9); opacity: 0 } to { transform: none; opacity: 1 } }
.btn-close { position: absolute; top: -23px; right: -1px; width: 88px; height: 88px; z-index: 3; transition: transform .15s ease; }
.btn-close:active { transform: scale(.92); }

.login-title { margin: 6px 0 0; text-align: center; font-weight: 600; font-size: 35px; line-height: 1.3; }
.login-sub { text-align: center; font-weight: 500; font-size: 14.5px; margin: 2px 0 20px; }
.input-pill {
  display: block; width: 100%; height: 47px; padding: 0 20px;
  border-radius: 999px; border: 1.5px solid #cdb19c; background: #fff;
  box-shadow: 0 0 5px rgba(98, 55, 25, .28);
  font: 500 17px var(--font); color: var(--brown); outline: none;
  -webkit-appearance: none; appearance: none;
}
.input-pill:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(132, 198, 179, .35); }
select.input-pill {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23623719' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 16px center / 18px no-repeat;
  padding-right: 44px;
}
.modal-login .input-pill { width: 265px; margin: 0 auto; }
.form-error { min-height: 22px; margin: 6px 0 4px; text-align: center; font-size: 14px; color: #b4472d; }
.btn-brown {
  display: flex; align-items: center; justify-content: center;
  width: 173px; height: 50px; margin: 0 auto;
  background: url("../img/btn-brown.webp") 0 0 / 100% 100% no-repeat;
  color: #fff; font-weight: 500; font-size: 19px; cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}
.btn-brown:active { transform: scale(.96); filter: brightness(1.08); }
.btn-brown.busy { opacity: .6; pointer-events: none; }

.modal-admin { padding: 46px 35px 34px; }
.admin-title img { width: 208px; }
.admin-sub { text-align: center; font-weight: 600; font-size: 16.5px; margin: 4px 0 14px; }
.admin-label { font-weight: 600; font-size: 17.5px; margin: 14px 0 10px 2px; }
.modal-admin .divider { margin-top: 18px; }
.admin-avatar-wrap { display: flex; justify-content: center; height: 128px; margin-bottom: 8px; }
.admin-avatar-wrap .avatar-group { zoom: .63; }
.admin-qr { width: 170px; margin: 0 auto 14px; border-radius: 10px; }
.btn-save {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 285px; height: 49px; margin: 22px auto 0;
  border-radius: 999px; color: #fff; font-weight: 600; font-size: 19.5px;
  background: linear-gradient(180deg, #9a7559 0%, #7b553a 52%, #613c20 100%);
  box-shadow: 0 3px 5px rgba(80, 45, 20, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .15s ease, filter .15s ease;
}
.btn-save img { width: 26px; height: 26px; }
.btn-save:active { transform: scale(.97); filter: brightness(1.08); }
.btn-save.busy { opacity: .6; pointer-events: none; }
.link-logout, .link-delete {
  display: block; margin: 14px auto 0; font-size: 14.5px; font-weight: 500;
  color: #9c7c66; text-decoration: underline; text-underline-offset: 3px;
}
.link-delete { color: #b4472d; }

.modal-edit { padding: 42px 37px 34px; }
.edit-title { font-size: 28px; margin-bottom: 12px; }
.field-label { display: block; font-weight: 600; font-size: 15px; margin: 10px 0 6px 6px; }

/* lightbox */
.lightbox { align-items: center; background: rgba(30, 45, 38, .78); }
.lightbox-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 16px; }
.lightbox-inner img { max-width: min(94vw, 620px); max-height: 78vh; width: auto; height: auto; border-radius: 16px; box-shadow: 0 8px 30px rgba(0, 0, 0, .3); }
.lightbox-actions { display: flex; gap: 10px; }
.btn-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 120px; height: 44px; padding: 0 22px; border-radius: 999px;
  background: linear-gradient(180deg, #9a7559, #613c20); color: #fff;
  font: 500 16px var(--font); text-decoration: none;
}
.btn-pill.ghost { background: rgba(255, 255, 255, .92); color: var(--brown); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 80;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 20px; border-radius: 999px;
  background: rgba(98, 55, 25, .94); color: #fff;
  font: 500 15px var(--font); white-space: nowrap;
  box-shadow: 0 6px 18px rgba(60, 30, 10, .25);
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- เอฟเฟคหัวใจลอย ---------------- */
.hearts { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.heart { position: absolute; bottom: 0; left: 0; will-change: transform, opacity; }
.heart svg { display: block; width: 100%; height: auto; overflow: visible; }

/* ---------------- เอฟเฟคกด ---------------- */
.tap-fx { position: fixed; z-index: 90; pointer-events: none; width: 62px; height: auto; margin: -26px 0 0 -31px; will-change: transform, opacity; }
.tap-heart { position: fixed; z-index: 89; pointer-events: none; width: 14px; margin: -7px 0 0 -7px; }

@media (prefers-reduced-motion: reduce) {
  .btn-music.playing img, .btn-music.playing::after { animation: none; }
  .modal { animation: none; }
}
