/* Trợ lý AI: dải phim chạy qua máy chiếu. Màu lấy từ theme, lớp đều có tiền tố hcma- để không đụng theme. */
.hcma {
	--hcma-ink: #050a14;
	--hcma-surface: #0d1628;
	--hcma-raise: #13203a;
	--hcma-gold: #ffc322;
	--hcma-gold-2: #ffd65c;
	--hcma-gold-3: #e5a90f;
	--hcma-text: #dfe5f1;
	--hcma-muted: #93a0b8;
	--hcma-line: rgba(255, 255, 255, .11);
	--hcma-glow: rgba(255, 195, 34, .22);
	--hcma-sans: var(--font, "Be Vietnam Pro"), system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	--hcma-serif: var(--serif, "Playfair Display"), Georgia, "Times New Roman", serif;
	--hcma-cond: var(--display, "Oswald"), "Arial Narrow", sans-serif;
	font-family: var(--hcma-sans);
	font-size: 14px;
	line-height: 1.6;
	color: var(--hcma-text);
}
.hcma *, .hcma *::before, .hcma *::after { box-sizing: border-box; }
.hcma button { font: inherit; margin: 0; }
.hcma [hidden] { display: none !important; }
/* Nút Lên đầu trang của theme nằm đúng góc này, đẩy lên trên nút chat. */
.to-top { bottom: 92px !important; }

/* Nút tròn */
.hcma-fab {
	position: fixed; right: 20px; bottom: 20px; z-index: 95;
	width: 60px; height: 60px; padding: 0; border: 0; border-radius: 50%;
	background: var(--hcma-ink); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
	box-shadow: 0 0 26px var(--hcma-glow), 0 12px 28px rgba(0, 0, 0, .45);
	transition: transform .15s ease, box-shadow .15s ease;
	animation: hcmaFabIn .35s cubic-bezier(.34, 1.4, .5, 1) both;
}
.hcma-fab img { display: block; width: 100%; height: 100%; border-radius: 50%; pointer-events: none; }
.hcma-fab:hover { transform: translateY(-2px); box-shadow: 0 0 38px rgba(255, 195, 34, .5), 0 14px 32px rgba(0, 0, 0, .5); }
.hcma-fab:active { transform: scale(.96); }
.hcma-fab.is-dragged { transition: none; transform: none; }
.hcma-fab.is-live::after {
	content: ""; position: absolute; inset: -3px; border: 2px solid var(--hcma-gold); border-radius: 50%; opacity: 0; pointer-events: none;
	animation: hcmaRing 3.2s ease-out .8s infinite;
}
@keyframes hcmaFabIn { from { opacity: 0; transform: scale(.5); } }
@keyframes hcmaRing { 0% { transform: scale(.86); opacity: .55; } 55%, 100% { transform: scale(1.22); opacity: 0; } }

/* Bong bóng mời chat: cùng tông vàng với chữ ĐIỆN ẢNH ở hero */
.hcma-cta {
	position: fixed; right: 92px; bottom: 26px; z-index: 95;
	max-width: 264px; padding: 12px 34px 12px 18px; border-radius: 20px; border-bottom-right-radius: 5px;
	font-size: 14px; font-weight: 600; line-height: 1.45; color: #0a1222; cursor: pointer; user-select: none; -webkit-user-select: none;
	background: linear-gradient(135deg, var(--hcma-gold-2) 0%, var(--hcma-gold-3) 100%);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 0 30px var(--hcma-glow), 0 12px 30px rgba(0, 0, 0, .4);
	animation: hcmaCtaIn .55s cubic-bezier(.34, 1.56, .64, 1) both;
}
.hcma-cta:hover { filter: brightness(1.06); }
.hcma-cta::after {
	content: ""; position: absolute; right: -5px; bottom: 12px; width: 11px; height: 11px;
	background: var(--hcma-gold-3); border-radius: 2px; transform: rotate(-45deg);
}
.hcma-cta-txt { display: block; animation: hcmaSwap .45s cubic-bezier(.22, .9, .35, 1) both; }
.hcma-cta-x {
	position: absolute; top: 6px; right: 7px; display: flex; align-items: center; justify-content: center;
	width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #0a1222; opacity: .7; cursor: pointer;
}
.hcma-cta-x:hover { background: rgba(10, 18, 34, .14); opacity: 1; }
@keyframes hcmaCtaIn { from { opacity: 0; transform: translateY(14px) scale(.86); } }
@keyframes hcmaSwap { from { opacity: 0; transform: translateY(9px); } }

/* Khung chat */
.hcma-panel {
	position: fixed; right: 16px; bottom: 16px; z-index: 110;
	display: flex; flex-direction: column; overflow: hidden;
	width: 430px; height: min(680px, calc(100vh - 32px));
	background: var(--hcma-ink); border-radius: 16px;
	box-shadow: 0 0 0 1px rgba(255, 195, 34, .28), 0 0 60px rgba(255, 195, 34, .1), 0 30px 70px rgba(0, 0, 0, .65);
	transform-origin: 92% 100%;
	animation: hcmaProjector .55s ease-out both;
}
.hcma-panel.is-full { width: min(920px, calc(100vw - 32px)); height: calc(100vh - 32px); }
/* Né thanh quản trị của WordPress khi đang đăng nhập. */
.admin-bar .hcma-panel { max-height: calc(100vh - 48px); }
/* Mở khung như máy chiếu bật đèn: chớp nhẹ rồi sáng hẳn. */
@keyframes hcmaProjector {
	0% { opacity: 0; transform: translateY(12px) scale(.97); filter: brightness(2); }
	35% { opacity: .75; filter: brightness(.7); }
	55% { opacity: .95; filter: brightness(1.35); }
	100% { opacity: 1; transform: none; filter: none; }
}

.hcma-head {
	position: relative; flex: none; display: flex; align-items: center; gap: 12px; padding: 13px 10px 13px 16px; color: #fff;
	background: radial-gradient(90% 240% at 0% 0%, rgba(255, 195, 34, .24) 0%, rgba(255, 195, 34, .05) 45%, transparent 70%), #03060d;
	border-bottom: 1px solid rgba(255, 195, 34, .26);
}
.hcma-ava { position: relative; flex: none; display: block; width: 42px; height: 42px; border-radius: 50%; box-shadow: 0 0 18px var(--hcma-glow); }
.hcma-ava img { display: block; width: 100%; height: 100%; border-radius: 50%; }
.hcma-dot {
	position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%;
	background: #2fc48a; border: 2px solid #03060d;
}
.hcma-dot.is-busy { background: var(--hcma-gold); animation: hcmaPulse 1.1s ease-in-out infinite; }
@keyframes hcmaPulse { 50% { opacity: .35; } }
.hcma-head-txt { flex: 1; min-width: 0; }
.hcma-title { margin: 0; display: flex; align-items: baseline; gap: 6px; line-height: 1.2; white-space: nowrap; overflow: hidden; }
.hcma-title em { font-family: var(--hcma-serif); font-size: 18px; font-style: italic; font-weight: 500; color: #fff; }
.hcma-title b {
	font-family: var(--hcma-cond); font-size: 19px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
	background: linear-gradient(180deg, #ffe08a, var(--hcma-gold-3)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hcma-sub { margin-top: 2px; font-size: 11.5px; color: var(--hcma-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hcma-actions { flex: none; display: flex; gap: 1px; }
.hcma-btn {
	flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0;
	border: 0; border-radius: 9px; background: transparent; color: #aab5ca; cursor: pointer; transition: background .15s, color .15s;
}
.hcma-btn:hover { background: rgba(255, 195, 34, .14); color: var(--hcma-gold-2); }

/* Vùng tin nhắn: lỗ phim ở hai mép cuộn cùng nội dung (background-attachment: local) */
.hcma-msgs {
	flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
	display: flex; flex-direction: column; gap: 16px;
	padding: 20px max(34px, calc((100% - 760px) / 2)) 16px;
	background-color: var(--hcma-surface);
	background-image:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='24'%3E%3Crect y='3' width='8' height='12' rx='2.2' fill='%23ffffff' fill-opacity='.2'/%3E%3C/svg%3E"),
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='24'%3E%3Crect y='3' width='8' height='12' rx='2.2' fill='%23ffffff' fill-opacity='.2'/%3E%3C/svg%3E"),
		linear-gradient(90deg, #03060d 0 22px, rgba(255, 195, 34, .16) 22px 23px, transparent 23px calc(100% - 23px), rgba(255, 195, 34, .16) calc(100% - 23px) calc(100% - 22px), #03060d calc(100% - 22px)),
		radial-gradient(70% 45% at 50% 0%, rgba(255, 195, 34, .07), transparent 100%);
	background-position: 7px 0, right 7px top 0, 0 0, 0 0;
	background-size: 8px 24px, 8px 24px, 100% 100%, 100% 100%;
	background-repeat: repeat-y, repeat-y, no-repeat, no-repeat;
	background-attachment: local, local, scroll, scroll;
}
/* Thanh cuộn: mảnh, vàng, nằm trên mép dải phim */
.hcma-msgs::-webkit-scrollbar, .hcma-strip::-webkit-scrollbar, .hcma-input::-webkit-scrollbar { width: 5px; height: 4px; }
.hcma-msgs::-webkit-scrollbar-track, .hcma-strip::-webkit-scrollbar-track, .hcma-input::-webkit-scrollbar-track { background: transparent; }
.hcma-msgs::-webkit-scrollbar-thumb, .hcma-strip::-webkit-scrollbar-thumb, .hcma-input::-webkit-scrollbar-thumb {
	background: linear-gradient(180deg, var(--hcma-gold-2), var(--hcma-gold-3)); border-radius: 6px;
}
.hcma-msgs::-webkit-scrollbar-thumb:hover, .hcma-strip::-webkit-scrollbar-thumb:hover { background: var(--hcma-gold-2); }
@supports not selector(::-webkit-scrollbar) {
	.hcma-msgs, .hcma-strip, .hcma-input { scrollbar-width: thin; scrollbar-color: var(--hcma-gold-3) transparent; }
}

.hcma-msg { min-width: 0; overflow-wrap: anywhere; }
.hcma-msg--user {
	align-self: flex-end; max-width: 86%; padding: 9px 14px; color: #0a1222; font-weight: 500; white-space: pre-wrap;
	background: linear-gradient(135deg, var(--hcma-gold-2), var(--hcma-gold-3)); border-radius: 14px 14px 4px 14px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
	animation: hcmaMsgIn .22s ease-out both;
}
@keyframes hcmaMsgIn { from { opacity: 0; transform: translateY(5px); } }
.hcma-msg--bot { align-self: stretch; }
.hcma-msg--err { padding: 10px 14px; color: #ffd9d6; background: rgba(200, 32, 47, .18); border: 1px solid rgba(255, 120, 110, .4); border-radius: 10px; }
.hcma-retry { display: block; margin-top: 6px; padding: 0; border: 0; background: none; color: var(--hcma-gold-2); font-weight: 600; text-decoration: underline; cursor: pointer; }

/* Màn chào như title card: chữ lớn giữa khung, vé gợi ý neo phía dưới. Khi đã có hội thoại thì thu gọn. */
.hcma-hello { margin: 0; }
.hcma-hello-big { display: block; font-family: var(--hcma-serif); font-size: 20px; font-style: italic; font-weight: 500; line-height: 1.3; color: #fff; }
.hcma-hello-sub { display: block; margin-top: 3px; font-size: 14px; line-height: 1.55; color: var(--hcma-muted); }
.hcma-msgs.is-empty .hcma-hello { margin: auto 0; padding: 12px 6px; text-align: center; }
.hcma-msgs.is-empty .hcma-hello-big {
	font-size: 46px; line-height: 1.12; padding-bottom: .08em;
	background: linear-gradient(180deg, #fff3c4 10%, var(--hcma-gold) 58%, var(--hcma-gold-3));
	-webkit-background-clip: text; background-clip: text; color: transparent;
	filter: drop-shadow(0 0 22px rgba(255, 195, 34, .28));
}
.hcma-msgs.is-empty .hcma-hello-sub { margin-top: 10px; font-size: 16px; line-height: 1.5; color: var(--hcma-text); text-wrap: balance; }

.hcma-text { font-size: 14.5px; line-height: 1.65; }
.hcma-text p { margin: 0 0 9px; }
.hcma-text ul, .hcma-text ol { margin: 0 0 9px; padding: 0 0 0 19px; }
.hcma-text ul { list-style: none; padding-left: 15px; }
.hcma-text ol { list-style: decimal; }
.hcma-text ol li::marker { color: var(--hcma-gold); font-weight: 600; }
.hcma-text li { position: relative; margin: 5px 0; }
.hcma-text ul li::before { content: ""; position: absolute; left: -15px; top: .62em; width: 6px; height: 6px; border-radius: 1.5px; background: var(--hcma-gold); }
.hcma-text > :last-child { margin-bottom: 0; }
.hcma-text strong { font-weight: 600; color: #fff; }
.hcma-text.is-streaming > p:last-child::after,
.hcma-text.is-streaming > ul:last-child > li:last-child::after,
.hcma-text.is-streaming > ol:last-child > li:last-child::after {
	content: ""; display: inline-block; width: 8px; height: 1em; margin-left: 3px; vertical-align: -2px; background: var(--hcma-gold); animation: hcmaCaret .9s steps(2) infinite;
}
@keyframes hcmaCaret { 50% { opacity: 0; } }
.hcma-cite {
	display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 17px; margin-left: 3px; padding: 0 4px;
	vertical-align: 1.5px; border-radius: 4px; border: 1px solid rgba(255, 195, 34, .5); font-size: 10.5px; font-weight: 600; line-height: 1; text-decoration: none !important;
	color: var(--hcma-gold-2) !important; background: rgba(255, 195, 34, .08);
}
a.hcma-cite:hover { background: var(--hcma-gold); color: #0a1222 !important; }

/* Nguồn: các khung hình trên một dải phim ngang */
.hcma-srcs { margin-top: 14px; }
.hcma-srcs-h { margin-bottom: 7px; font-size: 12px; font-weight: 500; color: var(--hcma-muted); }
.hcma-strip {
	display: flex; gap: 7px; width: fit-content; max-width: 100%; overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain;
	padding: 17px 9px; border-radius: 6px;
	background:
		repeating-linear-gradient(90deg, rgba(255, 255, 255, .55) 0 8px, transparent 8px 20px) 6px 5px / 200% 7px no-repeat local,
		repeating-linear-gradient(90deg, rgba(255, 255, 255, .55) 0 8px, transparent 8px 20px) 6px calc(100% - 5px) / 200% 7px no-repeat local,
		#03060d;
}
.hcma-frame {
	position: relative; flex: none; display: flex; flex-direction: column; width: 132px; overflow: hidden; scroll-snap-align: start;
	border-radius: 3px; background: var(--hcma-raise); color: var(--hcma-text) !important; text-decoration: none !important; transition: box-shadow .15s, transform .15s;
}
a.hcma-frame:hover { box-shadow: 0 0 18px var(--hcma-glow); }
.hcma-frame-pic { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; color: rgba(255, 195, 34, .75); background: radial-gradient(circle at 50% 40%, #1d2d4f, #0a1222); }
.hcma-frame-n {
	position: absolute; top: 4px; left: 4px; min-width: 18px; padding: 1px 4px; border-radius: 3px; text-align: center;
	font-size: 10.5px; font-weight: 700; line-height: 1.35; color: #0a1222; background: var(--hcma-gold);
}
.hcma-frame-pic svg { width: 30px; height: 30px; }
.hcma-frame-t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 6px 7px 7px; font-size: 11.5px; line-height: 1.35; }

/* Đang tìm: cuộn phim quay */
.hcma-typing { display: inline-flex; align-items: center; gap: 9px; color: var(--hcma-muted); font-size: 13.5px; }
.hcma-typing svg { color: var(--hcma-gold); animation: hcmaSpin 1.6s linear infinite; }
@keyframes hcmaSpin { to { transform: rotate(360deg); } }

/* Câu gợi ý là những tấm vé xem phim: cuống bên trái, khía tròn ở đường xé */
.hcma-chips { display: flex; flex-direction: column; gap: 9px; }
.hcma-chip {
	--hcma-tear: 44px;
	display: flex; align-items: stretch; width: 100%; min-height: 52px; padding: 0; border: 0; border-radius: 9px; color: var(--hcma-text);
	font-size: 13.5px; line-height: 1.4; text-align: left; cursor: pointer;
	background: linear-gradient(100deg, #1c2c4e 0%, var(--hcma-raise) 60%);
	box-shadow: inset 0 0 0 1px rgba(255, 195, 34, .22);
	-webkit-mask: radial-gradient(circle 6px at var(--hcma-tear) 0, transparent 97%, #000) top / 100% 51% no-repeat, radial-gradient(circle 6px at var(--hcma-tear) 100%, transparent 97%, #000) bottom / 100% 51% no-repeat;
	mask: radial-gradient(circle 6px at var(--hcma-tear) 0, transparent 97%, #000) top / 100% 51% no-repeat, radial-gradient(circle 6px at var(--hcma-tear) 100%, transparent 97%, #000) bottom / 100% 51% no-repeat;
	transition: transform .16s var(--ease-out, ease);
}
.hcma-chip-i {
	flex: none; display: flex; align-items: center; justify-content: center; width: var(--hcma-tear); color: var(--hcma-gold);
	border-right: 1.5px dashed rgba(255, 195, 34, .38); margin: 7px 0;
}
.hcma-chip-t { flex: 1; min-width: 0; align-self: center; padding: 8px 14px; }
/* Mask cắt mất outline nên nút đang focus đổi nền vàng như khi rê chuột. */
.hcma-chip:hover, .hcma .hcma-chip:focus-visible { outline: 0; transform: translateX(3px); color: #0a1222; font-weight: 500; background: linear-gradient(100deg, var(--hcma-gold-2), var(--hcma-gold-3)); box-shadow: none; }
.hcma-chip:hover .hcma-chip-i, .hcma-chip:focus-visible .hcma-chip-i { color: #0a1222; border-color: rgba(10, 18, 34, .45); }
.hcma-chip:hover .hcma-chip-t, .hcma-chip:focus-visible .hcma-chip-t { color: #0a1222; opacity: 1; }

.hcma-foot { flex: none; padding: 11px 12px 9px; background: #03060d; border-top: 1px solid rgba(255, 195, 34, .26); }
.hcma-form { display: flex; align-items: flex-end; gap: 8px; padding: 5px 5px 5px 14px; background: var(--hcma-surface); border: 1px solid var(--hcma-line); border-radius: 12px; transition: border-color .15s, box-shadow .15s; }
.hcma-form:focus-within { border-color: rgba(255, 195, 34, .7); box-shadow: 0 0 0 3px rgba(255, 195, 34, .14); }
.hcma .hcma-input {
	flex: 1; min-width: 0; min-height: 0; max-height: 110px; padding: 7px 0; margin: 0; border: 0; outline: 0; resize: none; background: transparent; box-shadow: none; border-radius: 0;
	font: inherit; font-size: 14.5px; line-height: 1.45; color: #fff; caret-color: var(--hcma-gold);
}
.hcma .hcma-input:focus, .hcma .hcma-input:focus-visible { outline: 0; border: 0; box-shadow: none; background: transparent; }
.hcma-input::placeholder { color: var(--hcma-muted); opacity: 1; }
.hcma-send {
	flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 9px;
	background: linear-gradient(135deg, var(--hcma-gold-2), var(--hcma-gold-3)); color: #0a1222; cursor: pointer; transition: filter .15s, background .15s;
}
.hcma-send:hover { filter: brightness(1.1); }
.hcma-send:disabled { background: var(--hcma-raise); color: var(--hcma-muted); cursor: default; filter: none; }
.hcma-note { margin-top: 7px; text-align: center; font-size: 11px; line-height: 1.35; color: var(--hcma-muted); }
.hcma-note span { white-space: nowrap; }
.hcma-note b { font-weight: 600; color: var(--hcma-gold-2); }

.hcma a:focus-visible, .hcma button:focus-visible, .hcma-cta:focus-visible { outline: 2px solid var(--hcma-gold-2); outline-offset: 2px; }

@media (max-width: 560px) {
	.hcma-panel, .hcma-panel.is-full { right: 0; bottom: 0; width: 100%; height: 100dvh; border-radius: 0; }
	.admin-bar .hcma-panel, .admin-bar .hcma-panel.is-full { height: calc(100dvh - 46px); max-height: none; }
	.hcma-expand { display: none; }
	.hcma .hcma-input { font-size: 16px; } /* iOS tự phóng trang nếu chữ nhỏ hơn 16px. */
	.hcma-cta { max-width: min(240px, calc(100vw - 110px)); }
}
@media (max-height: 600px) {
	.hcma-msgs.is-empty .hcma-hello-big { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
	.hcma *, .hcma *::before, .hcma *::after { animation: none !important; transition: none !important; }
}
@media print { .hcma { display: none !important; } }
