/* PIMJAI app kit — ต่อจาก home.css (ตัวแปรสี/ฟอนต์เดียวกัน) */
#view { padding: 0 calc(var(--u) * 4) calc(var(--u) * 4); outline: none; }
#view > .hero, #view > .entry, #view > .tagline, #view > .chatters, #view > .cards { margin-left: calc(var(--u) * -4); margin-right: calc(var(--u) * -4); }
.chatter-link { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.chatter-link b, .chatter-link small { overflow-wrap: break-word; }
a.cafe-btn, a.card { display: flex; }
.phead { display: flex; align-items: center; gap: 8px; padding: 10px 0 8px; }
.phead h1 { font-family: var(--font-head); font-size: max(19px, calc(var(--u) * 5.4)); font-weight: 600; flex: 1; min-width: 0; overflow-wrap: break-word; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--pink-2); color: var(--plum); display: inline-grid; place-items: center; font-size: 22px; flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 16px; border: 1.5px solid var(--lilac-2); border-radius: 999px; background: #fff; color: var(--plum); font-weight: 600; font-size: 15px; text-align: center; text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, #f06aa5, #b98be6); border-color: transparent; color: #fff; }
.btn.on { background: var(--pink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; }
.state { text-align: center; padding: 28px 12px; color: var(--ink-soft); }
.state.err { color: #a4204f; } .state.ok { color: #1f7a54; }
.banner { background: #fff3c9; border: 1px solid #ecd27a; color: #5b4300; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; margin: 8px 0; }
.banner.soft { background: var(--lilac); border-color: var(--lilac-2); color: var(--plum); }
.muted, small { color: var(--ink-soft); font-size: 13px; }
.demo { display: inline-block; background: #ffe2a8; color: #6b4300; border-radius: 6px; padding: 1px 6px; font-size: 11px; margin-left: 4px; }
.card-form, .pcard { background: rgba(255, 255, 255, .78); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; margin: 10px 0; }
.pcard { align-items: center; text-align: center; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.field input, .field select, .field textarea, .composer input, .searchrow input, select, input[type=text], input[type=number], textarea { font: inherit; color: var(--plum); border: 1.5px solid var(--lilac-2); border-radius: 12px; padding: 10px 12px; background: #fff; min-height: 42px; width: 100%; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.msg { min-height: 1.2em; font-size: 14px; } .msg.err { color: #a4204f; } .msg.ok { color: #1f7a54; }
.link { color: #8a3fb0; text-decoration: underline; font-size: 14px; }
.alt { text-align: center; margin: 14px 0; font-size: 14px; }
.list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.row-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(255, 255, 255, .82); border-radius: 16px; box-shadow: var(--shadow); min-height: 56px; }
.row-link > span { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: break-word; }
.row-link.unread { border-left: 4px solid #ee7fb0; }
.av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--lilac); }
.av.sm { width: 32px; height: 32px; } .av.xl { width: 96px; height: 96px; } .av.ph { display: inline-grid; place-items: center; font-weight: 700; }
.big { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; } .tags li { background: var(--lilac); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.badge-n { background: #ee5c9a; color: #fff; border-radius: 999px; min-width: 22px; padding: 1px 6px; text-align: center; font-size: 12px; font-style: normal; }
.seg { display: flex; gap: 4px; background: var(--lilac); border-radius: 999px; padding: 4px; margin: 8px 0; } .seg.wrap { flex-wrap: wrap; border-radius: 18px; }
.segb { flex: 1; text-align: center; padding: 8px 10px; border-radius: 999px; font-size: 14px; white-space: nowrap; } .segb[aria-selected=true] { background: #fff; font-weight: 700; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.prod { display: flex; flex-direction: column; gap: 6px; background: rgba(255, 255, 255, .85); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); align-items: center; text-align: center; overflow-wrap: break-word; }
.prod.wide { align-items: flex-start; text-align: left; } .prod form { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.pico { font-size: 40px; } .price { font-weight: 700; }
.balance { margin: 8px 0; } .balance.big { font-size: 20px; }
/* แชท */
.chatpage { display: flex; flex-direction: column; min-height: calc(100dvh - 190px); }
.cafe-people { display:flex;gap:8px;overflow-x:auto;padding:10px 2px 12px;scrollbar-width:thin;background:linear-gradient(120deg,#fff1f6,#f0eafb);border-radius:16px;flex-shrink:0; }
.cafe-person { flex:0 0 44px;display:flex;flex-direction:column;align-items:center;gap:5px;font-size:12px; }
.person-pic {position:relative;display:block;width:44px;height:44px;padding:2px;border:1px solid #d6b7da;border-radius:50%;background:#fff;}
.person-pic img {width:100%;height:100%;object-fit:cover;border-radius:50%;}
.availability {position:absolute;bottom:0;right:0;width:10px;height:10px;border:2px solid white;border-radius:50%;background:#b2a7b2;}
.availability.online {background:#22bd77;box-shadow:0 0 8px #5ae7ac;}
.rt.state {padding:4px 8px;font-size:12px;}
.msgs { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: calc(100dvh - 330px); padding: 6px 2px; }
.msg-row { display: flex; gap: 6px; align-items: flex-end; } .msg-row.mine { flex-direction: row-reverse; }
.bubble { max-width: 78%; background: #fff; border-radius: 16px 16px 16px 4px; padding: 8px 12px; box-shadow: var(--shadow); overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 2px; }
.mine .bubble { background: var(--pink); border-radius: 16px 16px 4px 16px; }
.bubble time { font-size: 11px; color: var(--ink-soft); align-self: flex-end; } .who { font-weight: 600; }
.bubble .tr em { font-size: 13px; color: #6d3b9a; } .mini { border: 0; background: none; color: #8a3fb0; font-size: 12px; align-self: flex-start; padding: 0; }
.att { max-width: 100%; border-radius: 10px; } .lovecard { border: 2px dashed #ee7fb0; border-radius: 12px; padding: 8px; background: #fff7fb; }
.composer { display: flex; gap: 6px; align-items: center; position: sticky; bottom: calc(max(var(--u) * 17, 76px)); background: rgba(253, 241, 248, .96); padding: 8px 0; }
.composer .btn { flex: none; }
.searchrow { display: flex; gap: 6px; margin: 8px 0; }
/* ไพ่ */
.cards9 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 14px auto; }
.lcard { aspect-ratio: 3/4.4; border-radius: 14px; border: 2px solid #fff; box-shadow: var(--shadow); }
.lcard.back { background: linear-gradient(160deg, #f6c4dc, #d5c0ef); color: #fff; font-size: 34px; transition: transform .5s; } .lcard.back.flip { transform: rotateY(180deg); }
.lcard.front { background: #fff; padding: 20px; margin: 14px auto; max-width: 260px; text-align: center; display: flex; flex-direction: column; justify-content: center; gap: 10px; font-size: 18px; }
.lead { text-align: center; margin: 8px 0; }
.story .body { white-space: pre-wrap; overflow-wrap: anywhere; background: rgba(255, 255, 255, .8); border-radius: 16px; padding: 14px; line-height: 1.7; margin: 10px 0; }
.cm { background: #fff; border-radius: 12px; padding: 8px 10px; }
.rank { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; } .rank li { list-style: none; }
.adminpage .card-form input, .adminpage .card-form select { max-width: 100%; }
.dot { position: absolute; top: 4px; right: 4px; width: 10px; height: 10px; background: #ee5c9a; border-radius: 50%; }
.round-btn { position: relative; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.mq { overflow: hidden; white-space: nowrap; border-radius: 12px; background: var(--lilac); } .mq:empty { display: none; } .mq-in { display: inline-block; padding: 6px 0 6px 100%; animation: mq linear infinite; } @keyframes mq { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .mq-in { animation: none !important; padding-left: 8px; white-space: normal; } }

/* Long translated labels must wrap within a narrow mobile screen. */
.adminpage .seg.wrap { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
.adminpage .segb { min-width:0; white-space:normal; overflow-wrap:anywhere; border-radius:14px; }
.adminpage input, .adminpage select, .adminpage textarea { min-width:0; max-width:100%; font:inherit; }
.adminpage small, .adminpage b { overflow-wrap:anywhere; }
@media(max-width:380px) { .adminpage .seg.wrap { grid-template-columns:repeat(2,minmax(0,1fr)); } }
