/* =========================================================
   Nora Kingdom — หน้าชำระเงิน / ใบแจ้งยอด / ใบเสร็จ แบบร้านค้าในเกมพิกเซล
   ป้ายร้านแขวน · QR ในหีบสมบัติ · ช่องทางโอน = ช่องเก็บของ · NPC กล่องข้อความ
   ========================================================= */
.gp-page { max-width: 920px; margin: 0 auto; }

/* ป้ายร้านแขวน */
.gp-sign { position: relative; display: grid; justify-items: center; padding-top: 26px; margin-bottom: 18px; }
.gp-chain { position: absolute; top: 0; width: 6px; height: 30px; background: repeating-linear-gradient(180deg, var(--ink) 0 6px, transparent 6px 10px); }
.gp-chain.l { left: calc(50% - 90px); } .gp-chain.r { right: calc(50% - 90px); }
.gp-board { position: relative; display: flex; align-items: center; gap: 12px; min-width: 240px; max-width: 100%; padding: 12px 20px 12px 12px; border: var(--bw) solid var(--ink); border-radius: 14px;
  background: repeating-linear-gradient(0deg, #f6e1c6 0 10px, #efd2ae 10px 12px); box-shadow: 0 6px 0 var(--ink), inset 0 0 0 4px #fff3e3; animation: gp-swing 4s ease-in-out infinite; transform-origin: 50% -30px; }
@keyframes gp-swing { 0%, 100% { transform: rotate(-1.2deg); } 50% { transform: rotate(1.2deg); } }
.no-anim .gp-board { animation: none; }
.gp-logo { width: 64px; height: 64px; flex: none; display: grid; place-items: center; overflow: hidden; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--white); font-size: 1.6rem; }
.gp-logo img { width: 100%; height: 100%; object-fit: cover; }
.gp-board-txt { display: grid; min-width: 0; }
.gp-board-txt small { font-family: var(--font-th); color: var(--pink-d); }
.gp-board-txt b { font-family: var(--font-th); font-weight: 500; font-size: 1.25rem; overflow-wrap: anywhere; }

/* หน้าต่างหลัก */
.gp-grid { display: grid; gap: 18px; margin-top: 6px; }
.gp-h { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 10px; font-family: var(--font-th); font-weight: 500; font-size: 1rem; }
.gp-vault { display: grid; justify-items: center; gap: 10px; padding: 14px; border: var(--bw) solid var(--ink); border-radius: 16px; background: linear-gradient(180deg, #fff7e0, #ffeec2); box-shadow: inset 0 -6px 0 #f3d999; }
.gp-inv { padding: 14px; border: var(--bw) solid var(--ink); border-radius: 16px; background: var(--lav-xl); box-shadow: inset 0 -6px 0 var(--lav-l); }

/* QR ในกรอบหีบสมบัติ */
.gp-qr { position: relative; width: min(260px, 100%); aspect-ratio: 1; display: grid; place-items: center; padding: 14px; border: var(--bw) solid var(--ink); border-radius: 6px; background: var(--white); box-shadow: 0 5px 0 var(--ink); }
.gp-qr img, .gp-qr svg { width: 100%; height: 100%; object-fit: contain; }
.gp-qr .cn { position: absolute; width: 18px; height: 18px; background: var(--gold); border: 3px solid var(--ink); }
.gp-qr .tl { top: -9px; left: -9px; } .gp-qr .tr { top: -9px; right: -9px; } .gp-qr .bl { bottom: -9px; left: -9px; } .gp-qr .br { bottom: -9px; right: -9px; }
.gp-qr-cap { font-size: .82rem; color: var(--ink-soft); text-align: center; }
.gp-qr-empty { display: grid; justify-items: center; gap: 6px; color: var(--ink-soft); text-align: center; }
.gp-qr-empty svg { width: 46px !important; height: 46px !important; opacity: .55; }

/* ป้ายชื่อบัญชี */
.gp-plate { display: flex; align-items: center; gap: 10px; width: min(300px, 100%); padding: 8px 12px; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--white); box-shadow: 0 4px 0 var(--ink); }
.gp-plate-ico { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 10px; background: var(--gold); }
.gp-plate-ico svg { width: 26px; height: 26px; }
.gp-plate > span:last-child { display: grid; min-width: 0; }
.gp-plate small { font-size: .76rem; color: var(--ink-soft); }
.gp-plate b { font-family: var(--font-th); font-weight: 500; overflow-wrap: anywhere; }

/* ช่องทางโอน = ช่องเก็บของ */
.inv-slots { display: grid; gap: 10px; }
.inv-slot { display: grid; grid-template-columns: 52px 1fr; gap: 6px 10px; align-items: center; padding: 8px; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--white); box-shadow: 0 4px 0 var(--ink); }
.inv-ico { width: 52px; height: 52px; grid-row: span 2; display: grid; place-items: center; overflow: hidden; border: var(--bw) solid var(--ink); border-radius: 10px; background: var(--pink-l); box-shadow: inset 0 0 0 3px var(--white); }
.inv-slot.k-promptpay .inv-ico { background: var(--lav-l); } .inv-slot.k-truemoney .inv-ico { background: var(--sky-l); } .inv-slot.k-other .inv-ico { background: #fff3c4; }
.inv-ico svg { width: 30px; height: 30px; }
.inv-ico img { width: 100%; height: 100%; object-fit: contain; }
.inv-txt { display: grid; min-width: 0; }
.inv-txt small { font-size: .78rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-txt b { font-size: clamp(.98rem, 4vw, 1.15rem); letter-spacing: .04em; user-select: all; overflow-wrap: anywhere; }
.inv-copy { justify-self: start; background: var(--pink); }
.inv-copy.done { background: #b7ecc9; }

/* NPC กล่องข้อความ */
.gp-npc { display: flex; align-items: flex-end; gap: 10px; margin-top: 18px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.gp-portrait { width: 76px; height: 76px; flex: none; display: grid; place-items: center; overflow: hidden; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--sky-l); box-shadow: 0 4px 0 var(--ink); }
.gp-portrait img, .gp-portrait svg { width: 88%; height: 88%; object-fit: contain; }
.gp-dialog { position: relative; flex: 1; min-height: 76px; padding: 10px 14px 12px; border: var(--bw) solid var(--ink); border-radius: 12px; background: #2f2153; color: #fff; box-shadow: inset 0 0 0 3px #8b74c8, 0 4px 0 var(--ink); }
.gp-name { display: inline-block; margin-bottom: 4px; padding: 0 8px; border-radius: 6px; background: var(--pink); color: var(--ink); font-family: var(--font-th); font-weight: 500; font-size: .82rem; }
.gp-dialog p { margin: 0; min-height: 1.5em; font-family: var(--font-th); line-height: 1.5; }
.gp-next { position: absolute; right: 12px; bottom: 6px; font-size: .8rem; color: var(--gold); animation: gp-blink 1s steps(2) infinite; }
@keyframes gp-blink { 50% { opacity: 0; } }

/* ยอดรวมแบบแถบ HUD */
.gp-total { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; padding: 8px 12px; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--gold); box-shadow: 0 4px 0 var(--ink); }
.gp-total svg { width: 28px; height: 28px; flex: none; }
.gp-total span { font-family: var(--font-th); font-weight: 500; }
.gp-total b { margin-left: auto; font-size: 1.35rem; white-space: nowrap; }
.gp-billpay .gp-total { margin-bottom: 14px; }
.gp-exact { margin: 6px 0 0; text-align: center; font-size: .82rem; color: var(--pink-d); font-family: var(--font-th); }

/* ใบแจ้งยอด / ใบเสร็จ */
.gp-bill { position: relative; margin: 6px 0 16px; padding: 12px; border: var(--bw) solid var(--ink); border-radius: 16px; background: var(--white); box-shadow: inset 0 0 0 4px var(--lav-xl), 0 5px 0 var(--ink); }
.gp-bill-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 3px dashed var(--lav-l); flex-wrap: wrap; }
.gp-bill-ico { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 10px; background: var(--pink-l); }
.gp-bill-ico svg { width: 28px; height: 28px; }
.gp-bill-head > span:nth-child(2) { display: grid; min-width: 0; flex: 1; }
.gp-bill-head b { font-family: var(--font-th); font-weight: 500; font-size: 1.1rem; }
.gp-bill-head small { font-size: .76rem; color: var(--ink-soft); }
.gp-stamp { padding: 2px 10px; border: 2px solid currentColor; border-radius: 8px; font-family: var(--font-th); font-size: .82rem; background: var(--white); transform: rotate(-4deg); }
.gp-stamp.ok { color: #2e8a58; } .gp-stamp.wait { color: #a5741c; } .gp-stamp.bad { color: #c4314e; }
.inv-list { display: grid; gap: 6px; }
.inv-row { display: flex; align-items: center; gap: 10px; padding: 6px; border: 2px solid var(--lav-l); border-radius: 10px; background: var(--lav-xl); }
.inv-row .inv-ico { width: 40px; height: 40px; grid-row: auto; border-width: 2px; }
.inv-row .inv-ico svg { width: 24px; height: 24px; }
.inv-row .grow { flex: 1; min-width: 0; display: grid; }
.inv-row b { font-weight: 400; overflow-wrap: anywhere; }
.inv-row small { font-size: .74rem; color: var(--ink-soft); }
.inv-price { padding: 0 8px; border: 2px solid var(--ink); border-radius: 8px; background: var(--gold); white-space: nowrap; }
.gp-stats { display: grid; gap: 2px; margin-top: 10px; }
.gp-stat { display: flex; align-items: baseline; gap: 6px; font-size: .88rem; }
.gp-stat span { color: var(--ink-soft); flex: none; }
.gp-stat i { flex: 1; min-width: 10px; border-bottom: 2px dotted var(--lav-l); }
.gp-stat b { font-weight: 500; text-align: right; overflow-wrap: anywhere; max-width: 60%; }
.gp-foot { margin: 10px 0 0; text-align: center; font-size: .76rem; color: var(--ink-soft); }

/* เช็กราคาลิงก์อัตโนมัติ */
.cl-ok { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border: 2px solid var(--ink); border-radius: 12px; background: var(--white); }
.cl-ok img, .cl-ok svg { width: 44px; height: 44px; flex: none; object-fit: contain; border-radius: 8px; background: var(--lav-xl); }
.cl-ok span { display: grid; min-width: 0; }
.cl-ok b { font-weight: 500; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-ok small { font-size: .8rem; color: var(--pink-d); }
.cl-wait { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-soft); }
.cl-wait i { width: 14px; height: 14px; border: 3px solid var(--lav-l); border-top-color: var(--pink-d); animation: gp-spin .8s steps(8) infinite; }
@keyframes gp-spin { to { transform: rotate(360deg); } }
.shot.sk { background: linear-gradient(100deg, var(--lav-xl) 30%, var(--pink-l) 50%, var(--lav-xl) 70%); background-size: 300% 100%; animation: gp-sk 1.2s ease-in-out infinite; }
@keyframes gp-sk { from { background-position: 100% 0; } to { background-position: 0 0; } }

@media (min-width: 720px) {
  .gp-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .gp-board-txt b { font-size: 1.5rem; }
  .gp-logo { width: 76px; height: 76px; }
}
/* การ์ดพลิก: แคปไปกรอกยอดเอง ⇄ ล็อกยอด */
.gp-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 0 0 10px; border: 2px solid var(--ink); border-radius: 12px; background: var(--lav-xl); }
.gp-mode button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px; padding: 4px 6px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-family: var(--font-th); font-size: .82rem; color: var(--ink); cursor: pointer; }
.gp-mode button.on { background: var(--gold); box-shadow: 0 2px 0 var(--ink); }
.gp-flip { perspective: 1200px; }
.gp-flip-in { display: grid; transition: transform .6s cubic-bezier(.3, 1.4, .5, 1); transform-style: preserve-3d; }
.gp-flip.flipped .gp-flip-in { transform: rotateY(180deg); }
.gp-face { grid-area: 1 / 1; display: grid; justify-items: center; align-content: start; gap: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.gp-back { transform: rotateY(180deg); }
.gp-face[aria-hidden="true"] { pointer-events: none; }
.gp-flipbtn { justify-self: center; }
.gp-lock { display: grid; gap: 8px; width: 100%; max-width: 300px; padding: 12px; border: var(--bw) solid var(--ink); border-radius: 14px; background: linear-gradient(#fffbea, #fff3c4); box-shadow: 0 4px 0 var(--ink); }
.gp-lock .label { margin: 0; }
.gp-lock-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; }
.gp-lock-row .px { font-size: 1.1rem; }
.gp-lock-row .input { min-width: 0; font-size: 1.1rem; }
.gp-lock-qr { display: grid; place-items: center; aspect-ratio: 1; padding: 10px; border: 2px dashed var(--ink); border-radius: 10px; background: var(--white); }
.gp-lock-qr svg { width: 100%; height: auto; }
.gp-lock-amt { display: grid; justify-items: center; gap: 2px; font-family: var(--font-th); }
.gp-lock-amt:empty { display: none; }
.gp-lock-amt b { font-size: 1.4rem; color: var(--pink-d, #c2457a); }
.gp-lock-amt small { opacity: .75; }
@media (prefers-reduced-motion: reduce) { .gp-flip-in { transition: none; } }
.no-anim .gp-flip-in { transition: none; }
