/* ═══ เทมเพลตการ์ด BotV8: Notice · การ์ดสมาชิกเทมเพลต · บิล · กรอบโปรไฟล์ · สัตว์เลี้ยง · TOP ═══ */

/* ── แถบเลือกรูปแบบการตอบ ── */
.dm-modes { width: 100%; max-width: 440px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 18px; }
.dm-modes .lbl { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.dm-modes .lbl .ico { color: var(--amber); }
.dm-modes .seg { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, .3); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.dm-modes .seg button { border: 0; background: none; color: var(--muted); font-size: .76rem; padding: 6px 10px; border-radius: 9px; white-space: nowrap; transition: .2s; }
.dm-modes .seg button:hover { color: #fff; }
.dm-modes .seg button.on { color: #fff; background: linear-gradient(135deg, var(--primary), #452c03); box-shadow: 0 0 14px rgba(245, 158, 11, .5); }
.dm-modes select { display: none; flex: 1 1 140px; min-width: 0; background: #272013; color: var(--text); border: 1px solid var(--border-hi); border-radius: 10px; padding: 6px 8px; font: inherit; font-size: .78rem; }
.dm-modes.show-skin select { display: block; }
.mode-tag { background: rgba(245, 158, 11, .55); color: #fff; padding: 0 5px; border-radius: 4px; margin: 1px 0; font-size: .56rem; max-width: 120px; white-space: normal; text-align: right; line-height: 1.3; }
.mode-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.mode-chips > span { font-size: .76rem; color: var(--muted); width: 100%; }
.mchip { border: 1px solid rgba(245, 158, 11, .5); background: rgba(245, 158, 11, .14); color: #e3f3dc; border-radius: 99px; padding: 4px 11px; font-size: .74rem; transition: .2s; }
.mchip:hover { background: var(--primary); color: #fff; box-shadow: 0 0 14px rgba(245, 158, 11, .5); }
.mchip.fallback { border-style: dashed; border-color: var(--dim); background: none; color: var(--muted); }
.mode-note { font-size: .74rem; color: var(--dim); margin: 6px 0 0 !important; }

/* ── NoticeFlex (การ์ดกลาง) ── */
.flex.nf { width: 270px; }
.nf-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: linear-gradient(150deg, #1f2937, #111827); color: #fff; position: relative; }
.nf-h b { font-size: .9rem; line-height: 1.35; flex: 1; }
.nf-ico { width: 26px; height: 26px; flex: none; }
.nf-live { position: absolute; right: 10px; bottom: 3px; font-size: .56rem; color: #fca5a5; }
.nf-motion .nf-h { background: linear-gradient(150deg, #312e81, #0f172a); padding-bottom: 16px; }
.nf-motion .nf-h::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, transparent, #22d3ee, #f472b6, transparent); background-size: 200% 100%; animation: nf-line 2s linear infinite; }
@keyframes nf-line { to { background-position: -200% 0; } }
.nf-b { padding: 10px 14px 12px; background: #fff; }
.nf-b p { margin: 3px 0; font-size: .78rem; color: #111; }
.nf-kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed #eee; font-size: .78rem; }
.nf-kv span { color: #666; } .nf-kv b { color: #111; text-align: right; }
.nf-art { margin: 8px -14px -12px; height: 90px; overflow: hidden; position: relative; }
.nf-art img { width: 100%; height: 100%; object-fit: cover; }
.fx-head-motion { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fx-head-motion b { flex: 1; }
.mem-ico { position: absolute; right: 10px; top: 10px; }
.fx-mem-top { position: relative; }

/* ── การ์ดสมาชิกเทมเพลต (ProfileTemplateRenderer) ── */
.flex.tpl-card { width: 300px; background: #000; color: #fff; padding-bottom: 6px; }
.tc-head { position: relative; height: 100px; background-size: cover; background-position: center; display: flex; align-items: center; gap: 6px; padding: 6px 8px; overflow: hidden; }
.tc-deco { position: absolute; inset: 0; pointer-events: none; }
.tc-av { position: relative; flex: none; width: 76px; height: 76px; display: grid; place-items: center; z-index: 1; }
.tc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; z-index: 1; padding-top: 4px; }
.tc-info b { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.tc-info span { font-size: .72rem; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-info .tc-ab { font-size: .6rem; white-space: normal; line-height: 1.25; }
.tc-img .tc-info { padding-left: 4px; }
.tc-pet { position: absolute; right: -6px; bottom: -6px; font-size: 1.5rem; }
.tc-rank { position: absolute; right: -2px; bottom: -2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 800; background: linear-gradient(135deg, #fbbf24, #b45309); border: 2px solid #fff; color: #fff; }
.tc-lv { display: grid; grid-template-columns: 58px 1fr 38px; align-items: center; gap: 4px; padding: 3px 8px 0; font-size: .64rem; font-weight: 700; }
.tc-lv span:first-child { text-align: right; } .tc-lv img { width: 100%; height: auto; display: block; }
.cbar { display: block; height: 14px; border-radius: 9px; background: #222; border: 1.5px solid rgba(255, 255, 255, .5); overflow: hidden; }
.cbar i { display: block; height: 100%; border-radius: 9px; box-shadow: 0 0 8px currentColor; animation: grow 1.2s var(--ease); }
/* ลวดลายของสกิน */
.tc-gold .tc-deco { background: linear-gradient(105deg, transparent 35%, rgba(255, 230, 150, .35) 50%, transparent 65%); background-size: 250% 100%; animation: deco-shine 3s ease-in-out infinite; border: 2px solid #f5c542; border-radius: 4px; }
@keyframes deco-shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.tc-sakura .tc-deco { background-image: radial-gradient(circle, rgba(255, 182, 213, .9) 2px, transparent 3px), radial-gradient(circle, rgba(255, 255, 255, .6) 1.5px, transparent 2.5px); background-size: 46px 46px, 31px 31px; animation: deco-fall 6s linear infinite; border: 2px solid #ff8fc7; }
@keyframes deco-fall { to { background-position: 30px 92px, -20px 62px; } }
.tc-stars .tc-deco { background-image: radial-gradient(circle, #fff 1px, transparent 1.5px), radial-gradient(circle, #a5f3fc 1px, transparent 1.5px); background-size: 37px 29px, 53px 41px; animation: deco-twinkle 2.4s ease-in-out infinite alternate; border: 2px solid #9be38a; }
@keyframes deco-twinkle { to { opacity: .35; background-position: 4px 3px, -5px 2px; } }
.tc-matrix .tc-deco { background-image: repeating-linear-gradient(90deg, rgba(34, 197, 94, .25) 0 2px, transparent 2px 14px), linear-gradient(180deg, transparent, rgba(34, 197, 94, .25), transparent); background-size: auto, 100% 40px; animation: deco-rain 1.6s linear infinite; border: 2px solid #22c55e; }
@keyframes deco-rain { to { background-position: 0 0, 0 100px; } }
.tc-fire .tc-deco { background: radial-gradient(ellipse at 50% 120%, rgba(255, 140, 0, .55), transparent 60%); animation: deco-flick 1.2s ease-in-out infinite alternate; border: 2px solid #ff7b00; }
@keyframes deco-flick { to { opacity: .6; transform: scaleY(1.08); } }

/* ── แถบบิล (BetTemplateRenderer · ภาพ 375:61) ── */
.bill-bands { margin-top: 4px; }
.bb { background-size: 100% 100%; background-repeat: no-repeat; display: flex; align-items: center; padding: 0 20px; font-size: .74rem; }
.bb-header, .bb-footer { height: 46px; justify-content: center; }
.bb-header b { font-size: .8rem; } .bb-footer b { font-size: .78rem; }
.bb-middle { height: 22px; justify-content: space-between; gap: 6px; white-space: nowrap; }
.bb-middle em { font-style: normal; font-weight: 700; }
.bb-css .bb { border-left: 3px solid var(--edge); border-right: 3px solid var(--edge); }
.bb-css .bb-header { border-top: 3px solid var(--edge); border-radius: 12px 12px 0 0; margin: 0 6px; clip-path: polygon(4% 0, 96% 0, 100% 30%, 100% 100%, 0 100%, 0 30%); }
.bb-css .bb-middle { margin: 0 6px; }
.bb-css .bb-footer { border-bottom: 3px solid var(--edge); border-radius: 0 0 12px 12px; margin: 0 6px; clip-path: polygon(0 0, 100% 0, 100% 70%, 96% 100%, 4% 100%, 0 70%); }

/* ── อวตาร + กรอบโปรไฟล์ ── */
.pav { position: relative; display: inline-block; width: var(--s, 70px); height: var(--s, 70px); flex: none; }
.pav-face { position: absolute; inset: 11%; border-radius: 50%; overflow: hidden; z-index: 1; background: #111; }
.pav-face img { width: 100%; height: 100%; object-fit: cover; }
.pav-face i { width: 100%; height: 100%; display: grid; place-items: center; font-style: normal; font-weight: 800; color: #fff; font-size: calc(var(--s, 70px) * .34);
  background: linear-gradient(135deg, hsl(var(--h, 200), 70%, 55%), hsl(calc(var(--h, 200) + 50), 75%, 40%)); }
.pf { position: absolute; inset: 0; border-radius: 50%; z-index: 2; pointer-events: none; }
.pf-ring { background: conic-gradient(var(--c1), var(--c2), var(--c1)); -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%); mask: radial-gradient(circle, transparent 60%, #000 61%); }
.pf-double { border: 3px solid var(--c1); box-shadow: inset 0 0 0 3px #0b0d18, inset 0 0 0 6px var(--c2), 0 0 10px var(--c1); }
.pf-dash { border: 3px dashed var(--c1); box-shadow: 0 0 0 3px var(--c2) inset; }
.pf-glow { background: conic-gradient(var(--c1), var(--c2), var(--c1)); -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%); mask: radial-gradient(circle, transparent 62%, #000 63%); filter: drop-shadow(0 0 6px var(--c1)); }
.pf-gem { border: 4px solid var(--c1); box-shadow: 0 0 0 2px var(--c2), 0 0 12px var(--c2);
  background: radial-gradient(circle at 50% 3%, #fff 0 4%, transparent 5%), radial-gradient(circle at 97% 50%, var(--c2) 0 5%, transparent 6%), radial-gradient(circle at 50% 97%, #fff 0 4%, transparent 5%), radial-gradient(circle at 3% 50%, var(--c2) 0 5%, transparent 6%); }
.pf-hex { border-radius: 0; clip-path: polygon(25% 2%, 75% 2%, 100% 50%, 75% 98%, 25% 98%, 0 50%); background: linear-gradient(135deg, var(--c1), var(--c2));
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 59%); mask: radial-gradient(circle, transparent 58%, #000 59%); }
.pf-anim.pf-dash { animation: ico-spin 8s linear infinite; }
.pf-anim.pf-glow { animation: pf-pulse 1.8s ease-in-out infinite; }
@keyframes pf-pulse { 50% { filter: drop-shadow(0 0 14px var(--c1)) brightness(1.3); } }
.pf-vip { background: conic-gradient(from var(--a, 0deg), var(--c1), #fff, var(--c2), #fde68a, var(--c1)) !important; animation: spin-a 3s linear infinite !important; filter: drop-shadow(0 0 8px var(--c1)); border: 0; box-shadow: none;
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%) !important; mask: radial-gradient(circle, transparent 60%, #000 61%) !important; }
.pf-vip.pf-hex { clip-path: polygon(25% 2%, 75% 2%, 100% 50%, 75% 98%, 25% 98%, 0 50%); }

/* ── สัตว์เลี้ยง ── */
.pet { display: inline-block; line-height: 1; filter: drop-shadow(0 0 6px var(--pc, #94a3b8)) drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); z-index: 3; }
.pet-hop { animation: pet-hop 1.4s ease-in-out infinite; }
.pet-float { animation: pet-float 3s ease-in-out infinite; }
.pet-wag { animation: pet-wag 1.6s ease-in-out infinite; }
.pet-bob { animation: pet-bob 2.2s ease-in-out infinite; }
@keyframes pet-hop { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-9px) scale(1.05, .95); } 50% { transform: translateY(0) scale(.95, 1.05); } }
@keyframes pet-float { 50% { transform: translateY(-6px) rotate(-5deg); } }
@keyframes pet-wag { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@keyframes pet-bob { 50% { transform: translateY(-3px) scale(1.06); } }

/* ── TOP เทมเพลต (TopProfitFlex) ── */
.top-tpl { background: #fff; color: #111; padding: 14px 10px; text-align: center; }
.tt-1 { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 10px; }
.tt-1 small, .tt-row small { font-weight: 800; font-size: .7rem; color: #b45309; }
.tt-1 b { font-size: .9rem; } .tt-1 span, .tt-row span { color: #00b900; font-weight: 800; font-size: .76rem; }
.tt-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.tt-row > div { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.tt-row b { font-size: .66rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── ผลแบบรูป (resultannounce template) ── */
.res-img { position: relative; aspect-ratio: 1; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, hsl(var(--hue), 80%, 45%), #05060b 75%); }
.res-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35; filter: blur(1px); }
.res-in { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; background: rgba(255, 255, 255, .92); border-radius: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); animation: pop .6s var(--spring); max-width: 88%; }
.res-in b { font-size: 1.35rem; color: #e03131; text-align: center; line-height: 1.3; }

/* ═══ ขนาดตามตัววาดจริง (ProfileTemplateRenderer / BetTemplateRenderer) — ชนะกฎด้านบน ═══ */
.flex.tpl-card { width: 300px; }
.tc-head { height: 96px; padding: 0; gap: 0; align-items: flex-start; background-size: 100% 100%; }
.tc-av { position: relative; flex: none; width: 70px; height: 70px; display: block; }
.tc-info { padding-top: 0; gap: 0; line-height: 1.3; }
.tc-info b, .tc-info span { text-shadow: 0 1px 2px rgba(0, 0, 0, .9); }
.pf-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; z-index: 0; display: block; }
.pf-none { background: radial-gradient(circle, #333 60%, #666 61%); }
.pav-face { inset: 10%; }
img.pet { width: 40px; height: 40px; object-fit: contain; display: inline-block; }
.tc-pet { position: absolute; top: 48px; left: 43px; right: auto; bottom: auto; width: 40px; height: 40px; z-index: 3; }
.tc-rank { top: 52px; left: 45px; right: auto; bottom: auto; width: 35px; height: 35px; font-size: .8rem; z-index: 3; }
.tc-king { position: absolute; z-index: 4; object-fit: contain; }
.tc-lv { grid-template-columns: 55px 1fr 40px; font-size: 10px; padding: 2px 6px 0; color: #fff; }
.tc-lv img { aspect-ratio: 195 / 30; }
.bb { background-size: 100% 100%; }
.bb-header, .bb-footer { height: 48px; }
.bb-middle { height: 22px; padding: 0 15px; }
.bb-middle span, .bb-middle em { line-height: 1; }
.tp-pet { width: 110px; height: 110px; }
.tpt-pet { width: 96px; height: 96px; margin: 4px 0; }
.pet-inline { width: 22px; height: 22px; vertical-align: middle; }
.tpt-item.t-luck .tpt-tier { color: #35d48a; } .tpt-item.t-guard .tpt-tier { color: #3fe0ff; } .tpt-item.t-balance .tpt-tier { color: #b48cff; } .tpt-item.t-gift .tpt-tier { color: #ff8fb1; }
.tf-item .pav, .tf-big .pav { background: #000; border-radius: 50%; }

/* ═══ การ์ดสมาชิกเทมเพลต — โครงเดียวกับ ProfileTemplateRenderer::header() (แทนกฎ .tc-* ด้านบนทั้งหมด) ═══ */
.flex.tpl-card .tc-head { position: relative; display: block; width: 300px; height: 100px; padding: 0; overflow: hidden; background: none; }
.tc-bg { display: block; width: 300px; height: 96px; object-fit: cover; }
.tc-over { position: absolute; top: 7px; left: 7px; width: 300px; height: 120px; display: flex; }
.tc-col { position: relative; flex: none; width: 90px; height: 100px; }
.tc-prof { position: absolute; width: 70px; height: 70px; border-radius: 50%; }
.tc-ring { position: absolute; top: 0; left: 0; width: 70px; height: 70px; border-radius: 50%; object-fit: cover; }
.tc-photo { position: absolute; top: 7px; left: 7px; width: 55px; height: 55px; border-radius: 50%; overflow: hidden; background: #111; }
.tc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tc-photo i { width: 100%; height: 100%; display: grid; place-items: center; font-style: normal; font-weight: 800; color: #fff; font-size: 22px; background: linear-gradient(135deg, hsl(var(--h, 200), 70%, 55%), hsl(calc(var(--h, 200) + 50), 75%, 40%)); }
.flex.tpl-card .tc-pet { position: absolute; top: 48px; left: 43px; right: auto; bottom: auto; width: 40px; height: 40px; object-fit: contain; font-size: 0; filter: none; }
.flex.tpl-card .tc-rank { position: absolute; top: 52px; left: 45px; right: auto; bottom: auto; width: 35px; height: 35px; }
.flex.tpl-card .tc-info { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 0; padding: 0; line-height: 1.3; }
.flex.tpl-card .tc-info b, .flex.tpl-card .tc-info span { text-shadow: none; white-space: normal; overflow-wrap: anywhere; overflow: visible; }
.flex.tpl-card .tc-info .tc-nw { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flex.tpl-card .tc-lv { display: flex; align-items: center; height: 30px; padding: 0; gap: 0; }
.flex.tpl-card .tc-lv > span:first-child { width: 55px; flex: none; text-align: right; font-size: 10px; font-weight: 700; color: #fff; }
.tc-bar { flex: none; width: 195px; height: 30px; margin-left: 6px; display: flex; align-items: center; }
.tc-bar img { width: 195px; height: 30px; object-fit: contain; display: block; }
.tc-bar .cbar { width: 100%; }
.flex.tpl-card .tc-lv > span:last-child { width: 40px; flex: none; padding-left: 3px; font-size: 10px; font-weight: 700; color: #fff; }
