.header-actions { display: flex; flex: 0 0 auto; gap: 8px; align-items: center; }
.header-actions .header-contact { margin-left: 0; }

.realviewee-sprite {
  width: 100%;
  aspect-ratio: 418 / 470.5;
  display: block;
  background-image: url('/assets/mascot/realviewee-sprite-v2.webp');
  background-repeat: no-repeat;
  background-size: 400% 200%;
  background-position: 0 0;
}
.realviewee-sprite[data-mascot-state="default"] { background-image: url('/assets/mascot/realviewee-sprite-v1.webp'); background-position: 0 0; }
.realviewee-sprite[data-mascot-state="happy"] { background-position: 0 0; }
.realviewee-sprite[data-mascot-state="curious"] { background-position: 33.333% 0; }
.realviewee-sprite[data-mascot-state="surprised"] { background-position: 66.667% 0; }
.realviewee-sprite[data-mascot-state="confident"] { background-position: 0 100%; }
.realviewee-sprite[data-mascot-state="excited"] { background-position: 33.333% 100%; }
.realviewee-sprite[data-mascot-state="concerned"] { background-position: 66.667% 100%; }
.results-page .realviewee-static .realviewee-sprite[data-mascot-state="surprised"] { left: 50%; width: 122.4%; aspect-ratio: 1302 / 1208; background-image: url('/assets/mascot/realviewee-result-surprised-cutout-v1.png'); background-position: center; background-size: contain; transform: translateX(-50%); }
.results-page .realviewee-static .realviewee-sprite[data-mascot-state="concerned"] { aspect-ratio: 1174 / 1339; background-image: url('/assets/mascot/realviewee-result-concerned-cutout-v1.png'); background-position: center; background-size: contain; }
.realviewee-sprite[data-mascot-state="running"] { position: relative; background-image: none; animation: realviewee-run-bob .65s ease-in-out infinite alternate; }
.realviewee-sprite[data-mascot-state="running"]::before,
.realviewee-sprite[data-mascot-state="running"]::after {
  position: absolute;
  inset: 0;
  content: "";
}
.realviewee-sprite[data-mascot-state="running"]::before {
  background: url('/assets/mascot/realviewee-sprite-v2.webp') 100% 100% / 400% 200% no-repeat;
  animation: realviewee-leg-cycle-a 5s steps(1, end) infinite;
}
.realviewee-sprite[data-mascot-state="running"]::after {
  opacity: 0;
  background: url('/assets/mascot/realviewee-running-default-step-b-v2.webp') center bottom / 126% 99% no-repeat;
  animation: realviewee-leg-cycle 5s steps(1, end) infinite;
}

@keyframes realviewee-leg-cycle-a {
  0%, 32.99%, 66%, 100% { opacity: 1; }
  33%, 65.99% { opacity: 0; }
}

@keyframes realviewee-leg-cycle {
  0%, 32.99%, 66%, 100% { opacity: 0; }
  33%, 65.99% { opacity: 1; }
}

@keyframes realviewee-run-bob {
  from { transform: translateY(0) rotate(-1deg); }
  to { transform: translateY(-3px) rotate(1deg); }
}

.realviewee-stage {
  --mascot-width: 142px;
  --mascot-end-gap: 174px;
  position: relative;
  width: min(100%, 820px);
  height: 184px;
  margin: 15px auto 0;
  overflow: visible;
  flex: 0 0 auto;
  isolation: isolate;
  border-radius: 26px;
}
.realviewee-stage::before {
  position: absolute;
  right: 14px;
  bottom: 16px;
  left: 14px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(22,22,22,.13) 12%, rgba(252,120,31,.28) 50%, rgba(22,22,22,.13) 88%, transparent);
}
.realviewee-stage--home {
  position: relative;
  z-index: 4;
  width: min(100%, 820px);
  height: 169px;
  margin: 30px auto 0;
  background: transparent;
}
.realviewee-stage--home.is-chat-open { z-index: 95; pointer-events: none; }
.realviewee-stage--home.is-chat-open .realviewee-character { pointer-events: auto; }
.realviewee-companion {
  position: absolute;
  z-index: 1;
  bottom: -12px;
  left: 24px;
  width: var(--mascot-width);
  will-change: left;
}
.realviewee-companion.is-patrolling { animation: realviewee-patrol 24s linear infinite; }
.realviewee-companion.is-interacting,
.realviewee-companion.is-chat-open { animation-play-state: paused; }
.realviewee-character {
  position: relative;
  z-index: 1;
  width: var(--mascot-width);
  padding: 0;
  display: block;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: pointer;
  transform: rotate(var(--mascot-lean, 0deg));
  transform-origin: center bottom;
  isolation: isolate;
  transition: transform .2s ease;
}
.realviewee-character::before,
.realviewee-static::before {
  position: absolute;
  z-index: 0;
  right: 8%;
  bottom: 7%;
  left: 8%;
  height: 68%;
  content: "";
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(252,120,31,.28) 0%, rgba(252,120,31,.13) 46%, rgba(252,120,31,0) 76%);
  filter: blur(12px);
  opacity: 0;
  transform: scale(.84);
  pointer-events: none;
  transition: opacity .2s ease, transform .24s ease;
}
.realviewee-character:hover::before,
.realviewee-character:focus-visible::before,
.realviewee-static:hover::before,
.realviewee-static:focus-visible::before { opacity: 1; transform: scale(1); }
.realviewee-character > .realviewee-sprite,
.realviewee-static > .realviewee-sprite {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 10px 12px rgba(35,25,18,.13));
  transition: filter .2s ease;
}
.realviewee-character:hover > .realviewee-sprite,
.realviewee-character:focus-visible > .realviewee-sprite,
.realviewee-static:hover > .realviewee-sprite,
.realviewee-static:focus-visible > .realviewee-sprite { filter: drop-shadow(0 12px 14px rgba(252,120,31,.18)); }
.realviewee-character:focus-visible { border-radius: 24px; box-shadow: 0 0 0 3px var(--orange); }
.realviewee-state-speech {
  --state-speech-border: rgba(65,65,62,.22);
  position: absolute;
  z-index: 9;
  bottom: calc(100% + 7px);
  left: 50%;
  width: max-content;
  max-width: 218px;
  padding: 7px 13px;
  border: 1px solid var(--state-speech-border);
  border-radius: 12px;
  background: #fff;
  color: #6b6b67;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 5px) scale(0);
  transform-origin: 50% calc(100% + 7px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.realviewee-state-speech::after {
  position: absolute;
  bottom: -6px;
  left: var(--state-speech-tail, 50%);
  width: 10px;
  height: 10px;
  content: "";
  border-right: 1px solid var(--state-speech-border);
  border-bottom: 1px solid var(--state-speech-border);
  border-radius: 0 0 2px 0;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
}
.realviewee-state-speech.is-running {
  --state-speech-tail: 53%;
  left: 70%;
}
.realviewee-state-speech.is-stopped {
  --state-speech-border: rgba(238,77,45,.72);
  color: #EE4D2D;
  font-weight: 700;
}
.realviewee-state-speech.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  transition: opacity .2s ease, transform .32s cubic-bezier(.34,1.56,.64,1);
}
.realviewee-state-speech.is-running.is-visible { animation: realviewee-state-speech-run .65s ease-in-out infinite alternate; }
.realviewee-companion.is-chat-open .realviewee-state-speech { opacity: 0; transform: translate(-50%, 5px) scale(0); }
.realviewee-speech {
  position: absolute;
  z-index: 10;
  bottom: calc(100% + 10px);
  left: -17px;
  width: max-content;
  max-width: 176px;
  padding: 6px 12px;
  border: 1px solid rgba(252,120,31,.3);
  border-radius: 12px;
  background: #fff;
  color: var(--orange-dark);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  opacity: 0;
  transform: translateY(8px) scale(.96);
  transform-origin: bottom left;
  pointer-events: none;
  transition: opacity .18s ease, transform .2s ease;
}
.realviewee-speech::after {
  position: absolute;
  bottom: -6px;
  left: 32px;
  width: 10px;
  height: 10px;
  content: "";
  border-right: 1px solid rgba(252,120,31,.3);
  border-bottom: 1px solid rgba(252,120,31,.3);
  background: #fff;
  transform: rotate(45deg);
}
.realviewee-speech.is-visible { opacity: 1; transform: translateY(0) scale(1); animation: realviewee-speech-float 2.8s ease-in-out infinite alternate; }

@keyframes realviewee-state-speech-run {
  from { margin-top: 0; }
  to { margin-top: -2px; }
}

@keyframes realviewee-patrol {
  0% { left: 24px; opacity: 0; }
  2% { left: 24px; opacity: 1; }
  20.833%, 37.5% { left: 31%; opacity: 1; }
  58.333%, 75% { left: 61%; opacity: 1; }
  95.833% { left: calc(100% - var(--mascot-end-gap)); opacity: 1; }
  100% { left: calc(100% - var(--mascot-end-gap)); opacity: 0; }
}

.realviewee-static {
  --static-mascot-width: 96px;
  position: relative;
  width: var(--static-mascot-width);
  padding: 0;
  display: block;
  flex: 0 0 var(--static-mascot-width);
  border: 0;
  border-radius: 24px;
  background: transparent;
  cursor: default;
  isolation: isolate;
  transition: transform .18s ease;
}
.realviewee-static:hover { transform: translateY(-3px); }
.realviewee-static:focus-visible { outline: 3px solid rgba(252,120,31,.42); outline-offset: 3px; }
.trust-copy { position: relative; }
.trust-copy > h2,
.trust-copy > p { max-width: calc(100% - 98px); }
.realviewee-static--trust { --static-mascot-width: 88px; position: absolute; top: 18px; right: 0; }
.realviewee-static--trust { cursor: pointer; }
#danh-gia-giu-lai > summary,
#danh-gia-da-loai > summary { grid-template-columns: 54px minmax(0, 1fr) 82px auto 42px; }
.realviewee-static--kept,
.realviewee-static--excluded { --static-mascot-width: 78px; align-self: center; }
.realviewee-static--counterpart { --static-mascot-width: 116px; align-self: center; }

.realviewee-static-speech {
  position: absolute;
  z-index: 3;
  width: max-content;
  max-width: 176px;
  padding: 6px 12px;
  border: 1px solid rgba(252,120,31,.3);
  border-radius: 12px;
  background: #fff;
  color: var(--orange-dark);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  animation: realviewee-speech-float 2.8s ease-in-out infinite alternate;
}
.realviewee-static-speech::after {
  position: absolute;
  width: 10px;
  height: 10px;
  content: "";
  border-right: 1px solid rgba(252,120,31,.3);
  border-bottom: 1px solid rgba(252,120,31,.3);
  background: #fff;
}
.realviewee-static--trust .realviewee-static-speech {
  right: 12px;
  bottom: calc(100% + 4px);
}
.realviewee-static--trust .realviewee-static-speech::after {
  right: 20px;
  bottom: -6px;
  transform: rotate(45deg);
}
.realviewee-static--kept .realviewee-static-speech,
.realviewee-static--excluded .realviewee-static-speech {
  top: 50%;
  right: calc(100% + 5px);
  transform: translateY(-50%);
  animation: none;
}
.realviewee-static--kept .realviewee-static-speech::after,
.realviewee-static--excluded .realviewee-static-speech::after {
  top: calc(50% - 5px);
  right: -6px;
  transform: rotate(-45deg);
}
.realviewee-static--counterpart .realviewee-static-speech {
  right: calc(100% - 22px);
  bottom: calc(100% - 8px);
}
.realviewee-static--counterpart .realviewee-static-speech::after {
  right: 18px;
  bottom: -6px;
  transform: rotate(45deg);
}

@keyframes realviewee-speech-float {
  from { margin-top: 0; }
  to { margin-top: -3px; }
}

.chatbot-trigger {
  position: relative;
  min-height: 46px;
  padding: 0 16px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(22, 22, 22, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .76);
  color: var(--ink);
  box-shadow: 0 9px 22px rgba(22, 22, 22, .07);
  cursor: pointer;
  font-size: 13px;
  font-weight: 820;
  white-space: nowrap;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.chatbot-trigger:hover, .chatbot-trigger[aria-expanded="true"] { transform: translateY(-2px); border-color: rgba(252, 120, 31, .62); background: white; }
.chatbot-trigger:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.chatbot-trigger-mascot { position: relative; order: 1; width: 32px; height: 31px; flex: 0 0 32px; overflow: hidden; border-radius: 50%; background: #fff7f1; }
.chatbot-trigger-mascot .realviewee-sprite { position: absolute; top: -1px; left: -4px; width: 40px; }
.chatbot-trigger i { order: 2; width: 5px; height: 5px; flex: 0 0 5px; border: 0; border-radius: 50%; background: #20865a; }
.chatbot-trigger > span:not(.chatbot-trigger-mascot) { order: 3; margin-right: 4px; }

.chatbot-panel {
  position: fixed;
  z-index: 90;
  top: 88px;
  right: max(24px, calc((100vw - var(--container)) / 2));
  width: min(400px, calc(100vw - 32px));
  height: min(620px, calc(100dvh - 108px));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(22, 22, 22, .13);
  border-radius: 28px;
  background: #f8f7f3;
  box-shadow: 0 28px 80px rgba(31, 22, 16, .22);
  opacity: 0;
  transform: translateY(-10px) scale(.975);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity .18s ease, transform .22s cubic-bezier(.22, 1, .36, 1);
}
.chatbot-panel > * { min-width: 0; }
.chatbot-panel.is-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.chatbot-panel[hidden] { display: none; }

.chatbot-header { grid-row: 1; min-height: 84px; padding: 15px 16px; display: grid; grid-template-columns: 48px minmax(0, 1fr) 38px; gap: 12px; align-items: center; background: var(--ink); color: white; }
.chatbot-avatar { width: 48px; height: 48px; padding: 2px 6px 0; display: grid; place-items: center; overflow: hidden; border-radius: 16px 18px 15px 19px; background: white; }
.chatbot-avatar img { width: 100%; height: 100%; display: block; object-fit: contain; }
.chatbot-avatar .realviewee-sprite { width: 100%; }
.chatbot-header h2 { margin: 0; font-size: 16px; letter-spacing: -.25px; }
.chatbot-header p { margin: 5px 0 0; display: flex; gap: 7px; align-items: center; color: #bdbdb6; font-size: 9px; }
.chatbot-header p i { width: 7px; height: 7px; border-radius: 50%; background: #54c18b; box-shadow: 0 0 0 3px rgba(84, 193, 139, .14); }
.chatbot-close { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .12); border-radius: 50%; background: rgba(255, 255, 255, .08); color: white; cursor: pointer; }
.chatbot-close:hover { background: var(--orange); color: var(--ink); }
.chatbot-close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.chatbot-context { grid-row: 2; max-width: calc(100% - 28px); margin: 10px 14px 0; padding: 9px 11px; display: flex; gap: 8px; align-items: center; border: 1px solid rgba(32,134,90,.24); border-radius: 14px; background: #eaf7f0; color: #176844; font-size: 10px; font-weight: 800; }
.chatbot-context[hidden] { display: none; }
.chatbot-context span { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatbot-context button { width: 24px; height: 24px; margin-left: auto; flex: 0 0 24px; border: 0; border-radius: 50%; background: white; color: inherit; cursor: pointer; font-size: 17px; }
.chatbot-context[data-state="syncing"] { border-color: rgba(210,145,22,.3); background: #fff7df; color: #8a5b00; }
.chatbot-context[data-state="syncing"]::before { width: 10px; height: 10px; flex: 0 0 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; content: ""; animation: chatbot-context-spin .75s linear infinite; }
.chatbot-context[data-state="unavailable"] { border-color: rgba(177,62,43,.25); background: #fff0ed; color: #8b382b; }
.chatbot-context button[hidden] { display: none; }
@keyframes chatbot-context-spin { to { transform: rotate(360deg); } }

.chatbot-messages { grid-row: 3; min-height: 0; padding: 20px 17px 24px; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: rgba(22, 22, 22, .2) transparent; }
.chatbot-language-notice { margin: 0 0 18px; padding: 14px 15px; border: 1px solid rgba(252,120,31,.38); border-radius: 16px; background: #fff2e8; color: #6f3008; box-shadow: 0 8px 22px rgba(168,69,4,.08); }
.chatbot-language-notice[hidden] { display: none; }
.chatbot-language-notice strong, .chatbot-language-notice span { display: block; }
.chatbot-language-notice strong { color: var(--orange-dark); font-size: 13px; line-height: 1.3; }
.chatbot-language-notice span { margin-top: 5px; font-size: 11px; line-height: 1.5; }
.chatbot-message { margin-top: 15px; display: flex; gap: 9px; align-items: flex-end; }
.chatbot-message:first-child { margin-top: 0; }
.chatbot-message--user { justify-content: flex-end; }
.chatbot-message-avatar { width: 28px; height: 28px; display: grid; flex: 0 0 28px; place-items: center; border-radius: 50%; background: var(--ink); color: var(--orange); font-size: 10px; font-weight: 950; }
.chatbot-message-avatar--realviewee { padding: 1px 4px 0; overflow: hidden; border: 1px solid rgba(252,120,31,.3); background: white; }
.chatbot-message-avatar--realviewee .realviewee-sprite { width: 100%; }
.chatbot-message > div { max-width: 82%; }
.chatbot-message p { margin: 0; padding: 11px 13px; border: 1px solid rgba(22, 22, 22, .09); border-radius: 17px 17px 17px 5px; background: white; color: #343431; font-size: 11px; line-height: 1.55; white-space: pre-wrap; box-shadow: 0 7px 20px rgba(22, 22, 22, .045); }
.chatbot-message--user p { border-color: rgba(252, 120, 31, .3); border-radius: 17px 17px 5px 17px; background: #ffe5d2; color: var(--ink); }
.chatbot-message time { margin: 5px 3px 0; display: block; color: #85857f; font-size: 7px; font-weight: 750; }
.chatbot-message .chatbot-citations { display: block; margin: 6px 4px 0; color: #277a59; font-size: 8px; font-weight: 800; }
.chatbot-message.is-loading p { min-width: 62px; display: flex; gap: 4px; align-items: center; justify-content: center; }
.chatbot-message.is-loading p i { width: 5px; height: 5px; border-radius: 50%; background: #8b8b85; animation: chatbot-dot 1s infinite ease-in-out; }
.chatbot-message.is-loading p i:nth-child(2) { animation-delay: .14s; }
.chatbot-message.is-loading p i:nth-child(3) { animation-delay: .28s; }
@keyframes chatbot-dot { 0%, 70%, 100% { transform: translateY(0); opacity: .45; } 35% { transform: translateY(-4px); opacity: 1; } }

.chatbot-suggestions { margin: 18px 0 0 37px; display: grid; gap: 7px; }
.chatbot-suggestions button { width: fit-content; max-width: 100%; padding: 8px 11px; border: 1px solid rgba(252, 120, 31, .34); border-radius: 999px; background: #fff7f1; color: #7b3508; cursor: pointer; font-size: 9px; font-weight: 750; text-align: left; }
.chatbot-suggestions button:hover { border-color: var(--orange); background: white; }
.chatbot-suggestions button:disabled { opacity: .45; cursor: not-allowed; }

.chatbot-form { grid-row: 4; padding: 13px 14px 12px; border-top: 1px solid rgba(22, 22, 22, .1); background: white; }
.chatbot-input-shell { padding: 7px 7px 7px 13px; display: flex; gap: 8px; align-items: flex-end; border: 1px solid rgba(22, 22, 22, .14); border-radius: 19px; background: #f6f5f1; transition: border-color .18s ease, box-shadow .18s ease; }
.chatbot-input-shell:focus-within { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(252, 120, 31, .12); }
.chatbot-input-shell textarea { width: 100%; min-height: 36px; max-height: 112px; padding: 8px 0 6px; overflow-y: auto; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font-size: 11px; line-height: 1.45; }
.chatbot-input-shell textarea::placeholder { color: #8a8a84; }
.chatbot-input-shell button { width: 38px; height: 38px; padding: 0; display: grid; flex: 0 0 38px; place-items: center; border: 0; border-radius: 13px; background: var(--orange); color: var(--ink); cursor: pointer; transition: transform .18s ease, opacity .18s ease; }
.chatbot-input-shell button:hover:not(:disabled) { transform: translateY(-1px); }
.chatbot-input-shell button:disabled { opacity: .45; cursor: wait; }
.chatbot-language-switch { width: 100%; min-height: 46px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid #b6500d; border-radius: 16px; background: var(--orange); color: var(--ink); font-size: 13px; font-weight: 850; cursor: pointer; box-shadow: 0 8px 20px rgba(168,69,4,.16); transition: transform .18s ease, background-color .18s ease; }
.chatbot-language-switch:hover { background: #ff8b3d; transform: translateY(-1px); }
.chatbot-language-switch[hidden] { display: none; }
.chatbot-panel.is-language-unsupported .chatbot-input-shell { display: none; }
.chatbot-input-shell button svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chatbot-form > p { margin: 8px 2px 0; color: #898983; font-size: 7px; text-align: center; }

@media (max-width: 1100px) {
  .chatbot-trigger { width: 46px; padding: 0; gap: 0; }
  .chatbot-trigger > span:not(.chatbot-trigger-mascot) { display: none; margin-right: 0; }
  .chatbot-trigger-mascot { display: block; }
  .chatbot-trigger i { position: absolute; top: 7px; right: 6px; width: 4px; height: 4px; flex-basis: 4px; box-shadow: 0 0 0 1px #ffffff; }
}

@media (max-width: 1024px) {
  .header-actions { margin-left: auto; }
  .chatbot-panel { right: 18px; }
}

@media (max-width: 760px) {
  .trust-copy > h2,
  .trust-copy > p { max-width: none; }
  .realviewee-static--trust { --static-mascot-width: 72px; position: static; margin: 14px auto 0; }
  #danh-gia-giu-lai > summary,
  #danh-gia-da-loai > summary { grid-template-columns: 48px minmax(0, 1fr) 68px 34px; }
  .realviewee-static--kept,
  .realviewee-static--excluded { --static-mascot-width: 66px; }
  .counterpart-heading { flex-direction: column; align-items: stretch; }
  .realviewee-static--counterpart { --static-mascot-width: 92px; align-self: flex-end; margin-top: -18px; }
}

@media (max-width: 520px) {
  .header-actions { gap: 6px; }
  .chatbot-trigger { width: 44px; min-height: 44px; }
  .chatbot-trigger i { top: 6px; right: 6px; }
  .chatbot-panel { top: 74px; right: 10px; left: 10px; width: auto; height: min(600px, calc(100dvh - 84px - env(safe-area-inset-bottom))); border-radius: 24px; }
  .chatbot-header { min-height: 76px; padding: 12px; grid-template-columns: 44px minmax(0, 1fr) 36px; gap: 10px; }
  .chatbot-avatar { width: 44px; height: 44px; }
  .chatbot-messages { padding: 17px 13px 20px; }
  .chatbot-message > div { max-width: 87%; }
  .chatbot-message p { font-size: 11px; }
  .chatbot-suggestions { margin-left: 37px; }
  .chatbot-input-shell textarea { font-size: 16px; }
  .chatbot-form { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .realviewee-stage {
    --mascot-width: 104px;
    --mascot-end-gap: 132px;
    height: 142px;
    margin-top: 10px;
    border-radius: 20px;
  }
  .realviewee-stage--home { height: 136px; margin-top: 16px; }
  .realviewee-companion { bottom: -5px; }
  .realviewee-state-speech { bottom: calc(100% + 5px); max-width: 196px; padding: 6px 10px; font-size: 10.5px; }
  .realviewee-speech { bottom: calc(100% + 8px); left: -14px; max-width: 168px; padding: 6px 10px; font-size: 11px; }
  .realviewee-static--trust { --static-mascot-width: 66px; }
  #danh-gia-giu-lai > summary,
  #danh-gia-da-loai > summary { grid-template-columns: 42px minmax(0, 1fr) 58px 32px; gap: 9px; }
  .realviewee-static--kept,
  .realviewee-static--excluded { --static-mascot-width: 56px; }
  .realviewee-static--counterpart { --static-mascot-width: 82px; }
}

@media (max-width: 380px) {
  .header-actions { gap: 4px; }
  .chatbot-trigger { width: 40px; min-height: 40px; }
  .chatbot-trigger-mascot { width: 29px; height: 29px; flex-basis: 29px; }
  .chatbot-trigger-mascot .realviewee-sprite { left: -4px; width: 37px; }
  .chatbot-panel { top: 72px; right: 8px; left: 8px; height: calc(100dvh - 80px - env(safe-area-inset-bottom)); border-radius: 20px; }
  .chatbot-header { min-height: 68px; padding: 10px; grid-template-columns: 40px minmax(0, 1fr) 34px; gap: 8px; }
  .chatbot-avatar { width: 40px; height: 40px; }
  .chatbot-close { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-message.is-loading p i { animation: none; opacity: .7; }
  .realviewee-companion.is-patrolling { left: 24px; animation: none; opacity: 1; }
  .realviewee-sprite[data-mascot-state="running"],
  .realviewee-sprite[data-mascot-state="running"]::before,
  .realviewee-sprite[data-mascot-state="running"]::after,
  .realviewee-state-speech,
  .realviewee-static-speech { animation: none; }
  .realviewee-character, .realviewee-speech, .realviewee-state-speech, .realviewee-static { transition: none; }
}

/* English labels are longer; keep mascot callouts inside their available viewport. */
body.is-english .realviewee-state-speech,
body.is-english .realviewee-static-speech {
  max-width: min(260px, calc(100vw - 32px));
  white-space: normal;
  overflow-wrap: break-word;
  text-align: center;
}

body.is-english .realviewee-speech {
  max-width: min(220px, calc(100vw - 32px));
  white-space: normal;
  overflow-wrap: break-word;
  text-align: center;
}

@media (max-width: 520px) {
  body.is-english .realviewee-state-speech,
  body.is-english .realviewee-static-speech { max-width: min(196px, calc(100vw - 24px)); }
  body.is-english .realviewee-speech { max-width: min(168px, calc(100vw - 24px)); }
}

/* Improve chatbot legibility while keeping its visual language unchanged. */
.chatbot-panel { width: min(440px, calc(100vw - 32px)); height: min(680px, calc(100dvh - 108px)); }
.chatbot-header { min-height: 96px; padding: 17px 18px; grid-template-columns: 56px minmax(0, 1fr) 44px; gap: 14px; }
.chatbot-avatar { width: 56px; height: 56px; }
.chatbot-header h2 { font-size: 19px; }
.chatbot-header p { font-size: 11px; }
.chatbot-close { width: 44px; height: 44px; }
.chatbot-close svg { width: 21px; height: 21px; }
.chatbot-messages { padding: 24px 21px 28px; }
.chatbot-message { gap: 11px; }
.chatbot-message-avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 12px; }
.chatbot-message p { padding: 13px 15px; font-size: 14px; }
.chatbot-message time { font-size: 9px; }
.chatbot-message .chatbot-citations { font-size: 10px; }
.chatbot-suggestions { margin: 21px 0 0 45px; gap: 9px; }
.chatbot-suggestions button { padding: 10px 14px; font-size: 12px; }
.chatbot-form { padding: 16px 16px 14px; }
.chatbot-input-shell { padding: 8px 8px 8px 15px; gap: 10px; border-radius: 21px; }
.chatbot-input-shell textarea { min-height: 42px; padding: 9px 0 7px; font-size: 16px; }
.chatbot-input-shell button { width: 46px; height: 46px; flex-basis: 46px; border-radius: 15px; }
.chatbot-input-shell button svg { width: 22px; height: 22px; }
.chatbot-form > p { font-size: 9px; }

@media (max-width: 520px) {
  .chatbot-header { min-height: 86px; padding: 14px; grid-template-columns: 50px minmax(0, 1fr) 42px; gap: 12px; }
  .chatbot-avatar { width: 50px; height: 50px; }
  .chatbot-close { width: 42px; height: 42px; }
  .chatbot-messages { padding: 20px 16px 24px; }
  .chatbot-message p { font-size: 14px; }
  .chatbot-suggestions { margin-left: 45px; }
  .chatbot-input-shell textarea { font-size: 16px; }
}

@media (max-width: 380px) {
  .chatbot-header { min-height: 78px; padding: 11px; grid-template-columns: 46px minmax(0, 1fr) 38px; gap: 9px; }
  .chatbot-avatar { width: 46px; height: 46px; }
  .chatbot-close { width: 38px; height: 38px; }
}

/* Structured answers share the same safe, readable presentation across FAQ and AI. */
.chatbot-message > div { min-width: 0; }
.chatbot-message--assistant > div { max-width: calc(100% - 45px); }
.chatbot-answer-card { padding: 16px; border: 1px solid rgba(22,22,22,.1); border-radius: 17px 17px 17px 5px; background: #fff; color: #343431; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; box-shadow: 0 7px 20px rgba(22,22,22,.045); }
.chatbot-message .chatbot-answer-card p { padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; font-size: inherit; line-height: inherit; white-space: normal; }
.chatbot-answer-summary { font-weight: 650; color: #20201e; }
.chatbot-answer-section { margin-top: 18px; }
.chatbot-answer-section h3 { margin: 0 0 8px; font-size: 14px; line-height: 1.45; font-weight: 800; color: #20201e; }
.chatbot-answer-section ul, .chatbot-answer-section ol { margin: 0; padding-left: 21px; }
.chatbot-answer-section li + li, .chatbot-answer-section > div + div { margin-top: 10px; }
.chatbot-answer-section li::marker { color: #ad490c; font-weight: 750; }
.chatbot-answer-limitations { margin-top: 18px; padding: 12px; border-radius: 10px; background: #fff6ed; color: #65432e; font-size: 12px; }
.chatbot-answer-limitations strong { display: block; margin-bottom: 5px; }
.chatbot-message .chatbot-answer-limitations p + p { margin-top: 8px; }
.chatbot-evidence { margin-top: 9px; padding: 9px 10px; border: 1px solid #d4e7db; border-radius: 9px; background: #f5faf7; font-size: 12px; }
.chatbot-evidence summary { cursor: pointer; color: #185e40; font-weight: 700; min-height: 24px; }
.chatbot-evidence-status { display: block; margin: 8px 0; color: #4a5c51; }
.chatbot-evidence blockquote { margin: 0; padding-left: 10px; border-left: 2px solid #9abdac; white-space: pre-wrap; }
.chatbot-evidence > span:last-child { display: block; margin-top: 8px; }
.chatbot-answer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chatbot-answer-actions a { padding: 8px 10px; border: 1px solid #e8c5ae; border-radius: 8px; color: #9b3c07; text-decoration: underline; font-size: 12px; font-weight: 700; }
.chatbot-evidence summary:focus-visible, .chatbot-answer-actions a:focus-visible { outline: 2px solid #ad490c; outline-offset: 3px; }
.chatbot-retry { margin-top: 10px; padding: 9px 13px; border: 1px solid #d6b39b; border-radius: 8px; background: #fff6ed; color: #853708; font-size: 12px; font-weight: 700; cursor: pointer; }
.chatbot-retry:disabled { opacity: .65; cursor: wait; }
.chatbot-retry:focus-visible { outline: 2px solid #ad490c; outline-offset: 3px; }
@media (max-width: 380px) { .chatbot-answer-card { padding: 12px; } .chatbot-message--assistant > div { max-width: calc(100% - 40px); } }

/* The mobile homepage only needs these three frames, not the full sprite atlases. */
@media (max-width: 700px) {
  .realviewee-sprite[data-mascot-state="happy"] {
    background-image: url('/assets/mascot/realviewee-happy-mobile-v1.webp');
    background-position: center;
    background-size: 100% 100%;
  }
  .realviewee-sprite[data-mascot-state="default"] {
    background-image: url('/assets/mascot/realviewee-default-mobile-v1.webp');
    background-position: center;
    background-size: 100% 100%;
  }
  .realviewee-sprite[data-mascot-state="running"]::before {
    background: url('/assets/mascot/realviewee-running-mobile-v1.webp') center / 100% 100% no-repeat;
  }
}
