/* Trang Sức Hà My – "Bé Ngọc Ngà" trợ lý AI: nút linh vật nổi + khung chat.
   Nhẹ cho FPS: không animation lặp vô hạn (trừ 3 chấm "đang gõ" lúc chờ), không backdrop-filter, chỉ animate transform/opacity. */
:root { --ngn-ink: #06120f; --ngn-ink2: #0b1f19; --ngn-jade: #46d6a4; --ngn-gold: #d9be86; --ngn-gold2: #f1e0b4; --ngn-gold3: #a98a4c; --ngn-text: #eef3ef; --ngn-mut: #93a99f; --ngn-line: rgba(217, 190, 134, .22); }

@keyframes ngcIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes ngcDot { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes ngnBlink { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.1); } }

/* ---------- nút linh vật: nằm ngay trên dock (dock: bottom 18px, cao 56px) ---------- */
.ngn-fab { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(max(18px, env(safe-area-inset-bottom)) + 70px); z-index: 94; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; transition: opacity .35s, transform .35s cubic-bezier(.2, .8, .2, 1); }
.ngn-fab.away, html.intro-on .ngn-fab, html.ngc-on .ngn-fab { opacity: 0; transform: translateY(16px); }
.ngn-fab.away *, html.intro-on .ngn-fab *, html.ngc-on .ngn-fab * { pointer-events: none !important; }
.ngn-btn { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ngn-ball { position: relative; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #12342a, #06120f 70%); border: 1px solid var(--ngn-gold3); box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .7), 0 0 0 5px rgba(70, 214, 164, .08); transition: transform .35s cubic-bezier(.3, 1.5, .5, 1); }
.ngn-ball svg { width: 50px; height: 50px; margin-top: -2px; }
.ngn-ball i { position: absolute; right: -5px; top: -3px; padding: 1px 6px; border-radius: 99px; background: var(--ngn-ink); color: var(--ngn-gold2); border: 1px solid var(--ngn-gold); font: 600 9px/1.5 'Be Vietnam Pro', system-ui, sans-serif; font-style: normal; letter-spacing: .08em; }
.ngn-btn:hover .ngn-ball { transform: translateY(-3px) rotate(-6deg); }
.ngn-btn:hover .ngn-eye { animation: ngnBlink .35s 1; }
.ngn-btn:active .ngn-ball { transform: scale(.92); }
.ngn-eye { transform-box: fill-box; transform-origin: center; }
.ngn-tag { display: flex; flex-direction: column; align-items: flex-end; padding: 7px 14px; border-radius: 14px; background: rgba(6, 18, 15, .92); border: 1px solid var(--ngn-line); color: var(--ngn-gold2); font: italic 600 17px/1.05 'Cormorant Garamond', Georgia, serif; box-shadow: 0 10px 26px -12px rgba(0, 0, 0, .7); opacity: 0; transform: translateX(8px); transition: opacity .3s, transform .3s; }
.ngn-tag small { font: 400 10.5px/1.4 'Be Vietnam Pro', system-ui, sans-serif; font-style: normal; color: var(--ngn-mut); letter-spacing: .04em; }
.ngn-btn:hover .ngn-tag, .ngn-btn:focus-visible .ngn-tag { opacity: 1; transform: none; }
.ngn-say { pointer-events: auto; max-width: 250px; margin: 0; padding: 11px 15px; border-radius: 16px 16px 4px 16px; background: #f6efe0; color: #13221c; font: 400 13.5px/1.5 'Be Vietnam Pro', system-ui, sans-serif; box-shadow: 0 16px 36px -14px rgba(0, 0, 0, .65); cursor: pointer; opacity: 0; transform: translateY(8px) scale(.95); transform-origin: 100% 100%; transition: opacity .35s, transform .35s cubic-bezier(.3, 1.4, .5, 1); }
.ngn-say.show { opacity: 1; transform: none; }
.ngn-say b { color: #0d6b4c; font-weight: 600; }

/* ---------- khung chat ---------- */
.ngc { position: fixed; right: 20px; bottom: 20px; z-index: 130; display: flex; flex-direction: column; width: 400px; height: min(660px, calc(100vh - 40px)); border-radius: 26px; overflow: hidden; background: linear-gradient(170deg, #0f2a22, var(--ngn-ink) 60%); color: var(--ngn-text); font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif; border: 1px solid var(--ngn-gold3); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .8); opacity: 0; transform: translateY(20px) scale(.96); transform-origin: 90% 100%; transition: opacity .3s, transform .4s cubic-bezier(.2, .8, .2, 1); }
.ngc[hidden] { display: none; }
.ngc.open { opacity: 1; transform: none; }
.ngc-h { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; background: radial-gradient(120% 160% at 0% 0%, #164a3b, #06120f 70%); }
.ngc-h::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--ngn-gold), transparent); }
.ngc-av { flex: none; width: 46px; height: 46px; }
.ngc-av svg, .ngc-mav svg { width: 100%; height: 100%; }
.ngc-who { flex: 1; min-width: 0; }
.ngc-who b { display: block; font: italic 600 24px/1.05 'Cormorant Garamond', Georgia, serif; color: var(--ngn-gold2); }
.ngc-who small { display: flex; align-items: center; gap: 7px; margin-top: 3px; font-size: 11.5px; color: var(--ngn-mut); }
.ngc-who small i { width: 7px; height: 7px; border-radius: 50%; background: var(--ngn-jade); box-shadow: 0 0 0 3px rgba(70, 214, 164, .18); }
.ngc.busy .ngc-who small i { background: var(--ngn-gold); box-shadow: 0 0 0 3px rgba(217, 190, 134, .2); }
.ngc-h button { flex: none; display: grid; place-items: center; width: 38px; height: 38px; padding: 9px; border-radius: 50%; border: 1px solid var(--ngn-line); background: none; color: var(--ngn-text); cursor: pointer; transition: border-color .25s, transform .25s; -webkit-tap-highlight-color: transparent; }
.ngc-h button:hover { border-color: var(--ngn-gold); }
.ngc-h button:active { transform: scale(.88); }
.ngc-h button svg { width: 100%; height: 100%; }
.ngc-log { flex: 1; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 10px; scrollbar-width: thin; scrollbar-color: rgba(217, 190, 134, .25) transparent; }
.ngc-m { display: flex; align-items: flex-end; gap: 8px; animation: ngcIn .35s cubic-bezier(.2, .8, .2, 1) both; }
.ngc-m.me { justify-content: flex-end; }
.ngc-mav { flex: none; width: 28px; height: 28px; }
.ngc-bw { display: grid; gap: 8px; min-width: 0; max-width: 86%; }
.ngc-b { margin: 0; padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: rgba(255, 255, 255, .055); border: 1px solid var(--ngn-line); font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.ngc-b b { color: var(--ngn-gold2); font-weight: 600; }
.ngc-m.me .ngc-b { max-width: 82%; border: 0; border-radius: 18px 18px 6px 18px; background: linear-gradient(120deg, #f2dc9f, #cfa75a); color: #1b1406; }
.ngc-m.me .ngc-b b { color: inherit; }
.ngc-typing { display: inline-flex; gap: 5px; padding: 5px 2px 1px; }
.ngc-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ngn-jade); animation: ngcDot 1.1s ease-in-out infinite; }
.ngc-typing i:nth-child(2) { animation-delay: .15s; } .ngc-typing i:nth-child(3) { animation-delay: .3s; }
.ngc-cards { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.ngc-cards::-webkit-scrollbar { display: none; }
.ngc-card { flex: 0 0 132px; display: block; padding: 0; text-align: left; border-radius: 14px; overflow: hidden; background: var(--ngn-ink2); border: 1px solid var(--ngn-line); color: var(--ngn-text); font: inherit; text-decoration: none; cursor: pointer; animation: ngcIn .4s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 80ms); transition: transform .25s, border-color .25s; }
.ngc-card:hover { transform: translateY(-3px); border-color: var(--ngn-gold); }
.ngc-card img, .ngc-ph { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: #0d1d18; }
.ngc-ph { position: relative; background: radial-gradient(circle at 50% 45%, #12342a, #0a1a15 70%); }
.ngc-ph::after { content: ''; position: absolute; inset: 24% 18%; border-radius: 50%; background: var(--c); box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(217, 190, 134, .5); }
.ngc-ci { display: block; padding: 7px 9px 9px; line-height: 1.25; }
.ngc-ci b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font: 600 15.5px/1.15 'Cormorant Garamond', Georgia, serif; color: var(--ngn-text); }
.ngc-ci em { display: block; margin-top: 4px; font-style: normal; font-size: 12px; font-weight: 600; color: var(--ngn-jade); }
.ngc-ci em.ask { color: var(--ngn-gold); font-weight: 500; }
.ngc-ci s { color: var(--ngn-mut); font-weight: 400; }
.ngc-cta { justify-self: start; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 99px; background: linear-gradient(120deg, #f2dc9f, #cfa75a); color: #1b1406; font-size: 13.5px; font-weight: 600; text-decoration: none; box-shadow: 0 10px 22px -12px rgba(217, 190, 134, .9); animation: ngcIn .4s .15s both; -webkit-tap-highlight-color: transparent; }
.ngc-cta svg { width: 18px; height: 18px; }
.ngc-cta:active { transform: scale(.95); }
.ngc-chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 14px 4px; scrollbar-width: none; }
.ngc-chips::-webkit-scrollbar { display: none; }
.ngc-chips:empty { display: none; }
.ngc-chips button { flex: none; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--ngn-gold3); background: rgba(217, 190, 134, .06); color: var(--ngn-gold2); font: 500 13px/1.2 'Be Vietnam Pro', system-ui, sans-serif; white-space: nowrap; cursor: pointer; animation: ngcIn .35s both; animation-delay: calc(var(--i) * 60ms); transition: background .2s, color .2s; -webkit-tap-highlight-color: transparent; }
.ngc-chips button:hover { background: var(--ngn-gold); color: #1b1406; }
.ngc-f { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 6px; border-top: 1px solid var(--ngn-line); }
.ngc-f textarea { flex: 1; min-width: 0; max-height: 110px; padding: 11px 16px; resize: none; border-radius: 22px; border: 1px solid var(--ngn-line); background: rgba(255, 255, 255, .05); color: var(--ngn-text); font: 400 16px/1.4 'Be Vietnam Pro', system-ui, sans-serif; outline: none; transition: border-color .2s; }
.ngc-f textarea::placeholder { color: var(--ngn-mut); }
.ngc-f textarea:focus { border-color: var(--ngn-gold); }
.ngc-send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 11px; border: 0; border-radius: 50%; background: linear-gradient(120deg, #f2dc9f, #cfa75a); color: #1b1406; cursor: pointer; transition: transform .2s; }
.ngc-send svg { width: 100%; height: 100%; }
.ngc-send:active { transform: scale(.86) rotate(-12deg); }
.ngc.busy .ngc-send { opacity: .45; }
.ngc-note { margin: 0; padding: 2px 14px 10px; font-size: 10.5px; text-align: center; color: var(--ngn-mut); }

/* ---------- điện thoại: toàn màn hình ---------- */
@media (max-width: 700px) {
  .ngn-ball { width: 56px; height: 56px; }
  .ngn-ball svg { width: 46px; height: 46px; }
  .ngn-tag { display: none; }
  .ngc { left: 0; right: 0; top: var(--vvt, 0px); bottom: auto; width: auto; height: var(--vvh, 100dvh); border-radius: 0; border: 0; transform: translateY(32px); transform-origin: 50% 100%; }
  .ngc.open { transform: none; }
  .ngc-h { padding-top: calc(10px + env(safe-area-inset-top)); }
  .ngc-note { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  html.ngc-on, html.ngc-on body { overflow: hidden; }
  html.ngc-on .dock { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .ngc, .ngc-m, .ngc-card, .ngc-chips button, .ngc-cta, .ngn-fab, .ngn-say, .ngn-ball { animation: none !important; transition: none !important; }
}
