/* 场景 NPC · 市集 / 广场 / 大殿共用
   2026-11-28：改为「大幅数字人立绘 + 完整对话区」双栏，不再用 21:9 横幅压小角色。 */
.npc-ui {
  --npc-accent: #d4b46c;
  --npc-deep: #170607;
  --npc-ink: #f3e3bb;
  font-family: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  color: #f2eee5;
}
.npc-ui button { font-family: inherit; }

/* 右下角常驻入口 */
.npc-dock {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px 8px 8px;
  border: 1px solid color-mix(in srgb, var(--npc-accent) 52%, transparent);
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(10, 14, 17, .94), color-mix(in srgb, var(--npc-deep) 88%, #06090b));
  box-shadow: 0 14px 38px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .04) inset, 0 0 24px color-mix(in srgb, var(--npc-accent) 8%, transparent);
  color: var(--npc-ink);
  cursor: pointer;
  text-align: left;
  backdrop-filter: blur(14px);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.npc-dock:hover {
  transform: translateY(-2px);
  border-color: var(--npc-accent);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55), 0 0 30px color-mix(in srgb, var(--npc-accent) 16%, transparent);
}
.npc-dock-orb {
  width: 64px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--npc-accent) 78%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--npc-accent) 12%, transparent);
}
.npc-dock-orb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.npc-dock-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.npc-dock-copy b { font-size: 17px; letter-spacing: .05em; line-height: 1.15; white-space: nowrap; }
.npc-dock-copy small { font-size: 12px; color: rgba(255, 255, 255, .66); white-space: nowrap; }
.npc-dock-dot {
  position: absolute;
  left: 66px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #83d6a1;
  box-shadow: 0 0 0 2px rgba(8, 11, 13, .92), 0 0 9px rgba(131, 214, 161, .65);
}

/* 聊天弹层 */
.npc-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 6, 8, .78);
  backdrop-filter: blur(12px);
}
.npc-modal[hidden] { display: none; }
.npc-sheet {
  position: relative;
  width: min(1500px, calc(100vw - 48px));
  height: min(920px, calc(100dvh - 48px));
  display: grid;
  grid-template-columns: minmax(340px, 37%) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--npc-accent) 46%, #2a3036);
  border-radius: 24px;
  background: #070a0c;
  box-shadow: 0 36px 110px rgba(0, 0, 0, .72), 0 0 0 1px rgba(255, 255, 255, .045) inset;
}

/* 左栏：数字人立绘，顶部锚定，不再占满整高 */
.npc-hero {
  position: relative;
  min-width: 0;
  height: 100%;
  padding: 20px 20px 0;
  overflow: hidden;
  background: var(--npc-deep);
  isolation: isolate;
}
.npc-hero::before {
  content: "";
  position: absolute;
  inset: -18px;
  z-index: 0;
  background: var(--npc-portrait, none) center top / cover no-repeat;
  filter: blur(26px) saturate(.8) brightness(.7);
  transform: scale(1.05);
  opacity: .6;
  pointer-events: none;
}
.npc-hero-img {
  position: absolute;
  inset: 96px 20px auto;
  width: calc(100% - 40px);
  height: calc(100% - 328px);
  object-fit: cover;
  object-position: 18% 0%;
  display: block;
  border-radius: 18px;
  filter: saturate(.96) contrast(1.04) brightness(1.02);
  transform: scale(1.001);
}
.npc-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4, 7, 9, .02) 0%, rgba(4, 7, 9, .04) 44%, rgba(4, 7, 9, .82) 100%),
    linear-gradient(90deg, rgba(4, 7, 9, .12) 0%, transparent 24%, transparent 76%, rgba(4, 7, 9, .4) 100%);
}
.npc-hero-shade {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  box-shadow: inset -40px 0 70px -40px rgba(3, 6, 8, .8);
}
.npc-ident {
  position: absolute;
  left: 28px;
  right: 24px;
  bottom: 24px;
  z-index: 5;
  max-width: 92%;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .72);
}
.npc-kicker {
  display: block;
  font-size: 10px;
  letter-spacing: .2em;
  color: color-mix(in srgb, var(--npc-accent) 86%, #fff);
  margin-bottom: 7px;
  text-transform: uppercase;
}
.npc-ident h2 {
  margin: 0;
  font-size: 52px;
  line-height: .98;
  font-weight: 600;
  color: #fff;
  letter-spacing: .06em;
  text-shadow: 0 3px 18px rgba(0, 0, 0, .8);
}
.npc-en {
  font-size: 10px;
  letter-spacing: .24em;
  color: rgba(255, 255, 255, .56);
  margin-left: 13px;
  vertical-align: 12px;
  font-weight: 400;
}
.npc-ident p {
  margin: 12px 0 0;
  font-size: 14px;
  color: rgba(255, 255, 255, .84);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.npc-ident p i { width: 1px; height: 12px; background: rgba(255, 255, 255, .34); }
.npc-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}
.npc-hero-meta span {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
  font-size: 9px;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .52);
}

/* 右栏：主题切换、身份、聊天 */
.npc-main {
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(255, 255, 255, .075);
  background:
    radial-gradient(95% 70% at 26% 0%, color-mix(in srgb, var(--npc-accent) 9%, transparent), transparent 58%),
    linear-gradient(160deg, color-mix(in srgb, var(--npc-deep) 48%, #0b1014), #070a0c 78%);
}
.npc-topbar {
  flex: 0 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 18px 11px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .065);
}
.npc-theme-switch {
  display: flex;
  gap: 5px;
  min-width: 0;
  max-width: calc(100% - 52px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .07);
}
.npc-theme-switch::-webkit-scrollbar { display: none; }
.npc-theme-switch button {
  flex: 0 0 auto;
  min-width: 44px;
  height: 31px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, .6);
  font-size: 12px;
  letter-spacing: .06em;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.npc-theme-switch button:hover { color: var(--npc-accent); }
.npc-theme-switch button.on {
  background: var(--npc-accent);
  color: #15110c;
  font-weight: 700;
  box-shadow: 0 3px 14px color-mix(in srgb, var(--npc-accent) 22%, transparent);
}
.npc-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  background: rgba(8, 11, 13, .72);
  color: #fff;
  font-size: 24px;
  line-height: 34px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.npc-close:hover { border-color: var(--npc-accent); color: var(--npc-accent); }

.npc-under {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 9px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .065);
  background: rgba(0, 0, 0, .18);
}
.npc-traits { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.npc-traits span {
  padding: 4px 9px;
  border: 1px solid color-mix(in srgb, var(--npc-accent) 30%, transparent);
  border-radius: 999px;
  color: color-mix(in srgb, var(--npc-accent) 84%, #fff);
  font-size: 11px;
  letter-spacing: .07em;
  white-space: nowrap;
}
.npc-card-toggle {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .62);
  font-size: 12px;
  cursor: pointer;
  letter-spacing: .07em;
}
.npc-card-toggle span { color: var(--npc-accent); margin-left: 3px; }
.npc-card-toggle:hover { color: var(--npc-accent); }

.npc-dossier {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 22px;
  max-height: 238px;
  overflow-y: auto;
  padding: 14px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .065);
  background: rgba(0, 0, 0, .25);
}
.npc-dossier[hidden] { display: none; }
.npc-dossier div { min-width: 0; }
.npc-dossier small { display: block; font-size: 10px; letter-spacing: .14em; color: color-mix(in srgb, var(--npc-accent) 72%, #fff); margin-bottom: 4px; }
.npc-dossier p { margin: 0; font-size: 12px; line-height: 1.6; color: rgba(255, 255, 255, .7); }

.npc-chat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 14px 24px 16px; }
.npc-chat-head { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding-bottom: 10px; }
.npc-online { display: flex; align-items: center; gap: 7px; font-size: 11px; color: rgba(255, 255, 255, .56); letter-spacing: .03em; white-space: nowrap; }
.npc-online i, .npc-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #83d6a1;
  box-shadow: 0 0 8px rgba(131, 214, 161, .7);
  flex: 0 0 6px;
}
.npc-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: rgba(255, 255, 255, .48); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.npc-loc { margin-left: auto; font-size: 11px; color: rgba(255, 255, 255, .4); white-space: nowrap; }

.npc-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 4px 12px 2px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--npc-accent) 32%, transparent) transparent;
}
.npc-msg { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 14px; }
.npc-msg.me { justify-content: flex-end; }
.npc-msg.them { justify-content: flex-start; }
.npc-mini {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--npc-accent) 10%, transparent);
}
.npc-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.npc-bubble {
  max-width: min(87%, 720px);
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 16px;
  line-height: 1.75;
  white-space: normal;
  overflow-wrap: anywhere;
  color: rgba(242, 238, 229, .94);
}
.npc-msg.them .npc-bubble {
  background: rgba(255, 255, 255, .065);
  border: 1px solid rgba(255, 255, 255, .09);
  border-bottom-left-radius: 6px;
}
.npc-msg.me .npc-bubble {
  background: var(--npc-accent);
  color: #15110c;
  border-bottom-right-radius: 6px;
  box-shadow: 0 5px 18px color-mix(in srgb, var(--npc-accent) 20%, transparent);
}
.npc-msg.fresh .npc-bubble { animation: npc-in .22s ease both; }
@keyframes npc-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.npc-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 9px 14px;
  width: max-content;
  margin: 0 0 14px 56px;
  border-radius: 15px;
  background: rgba(255, 255, 255, .065);
  border: 1px solid rgba(255, 255, 255, .09);
}
.npc-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--npc-accent); opacity: .35; animation: npc-dot 1s infinite ease-in-out; }
.npc-typing span:nth-child(2) { animation-delay: .16s; }
.npc-typing span:nth-child(3) { animation-delay: .32s; }
@keyframes npc-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.npc-quick { flex: 0 0 auto; display: flex; gap: 7px; overflow-x: auto; padding: 3px 0 12px; scrollbar-width: none; }
.npc-quick::-webkit-scrollbar { display: none; }
.npc-quick button {
  flex: 0 0 auto;
  padding: 6px 11px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.npc-quick button:hover { border-color: color-mix(in srgb, var(--npc-accent) 62%, transparent); color: var(--npc-accent); }

.npc-compose { flex: 0 0 auto; display: flex; gap: 10px; align-items: center; }
.npc-compose input {
  flex: 1 1 auto;
  min-width: 0;
  height: 50px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 14px;
  background: rgba(255, 255, 255, .055);
  color: #f2eee5;
  font-family: inherit;
  font-size: 16px;
  outline: none;
}
.npc-compose input::placeholder { color: rgba(255, 255, 255, .36); }
.npc-compose input:focus { border-color: color-mix(in srgb, var(--npc-accent) 68%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--npc-accent) 12%, transparent); }
.npc-compose button {
  flex: 0 0 auto;
  height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 14px;
  background: var(--npc-accent);
  color: #15110c;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.npc-compose button:disabled { opacity: .45; cursor: wait; }
.npc-fineprint { flex: 0 0 auto; padding-top: 8px; font-size: 10px; line-height: 1.5; color: rgba(255, 255, 255, .34); }

html.npc-open, html.npc-open body { overflow: hidden; }

/* 平板/窄桌面：改为上下结构，但仍保留大幅立绘 */
@media (max-width: 900px) {
  .npc-modal { padding: 14px; }
  .npc-sheet {
    width: min(760px, calc(100vw - 28px));
    height: min(94dvh, 940px);
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    border-radius: 20px;
  }
  .npc-hero { flex: 0 0 40dvh; height: 40dvh; min-height: 260px; padding: 0; }
  .npc-hero-img, .npc-live-canvas { inset: 0; width: 100%; height: 100%; border-radius: 0; }
  .npc-hero-img { object-position: 17% 0%; }
  .npc-hero-meta { display: none; }
  .npc-ident { left: 18px; right: 16px; bottom: 16px; max-width: 94%; }
  .npc-ident h2 { font-size: 34px; }
  .npc-en { font-size: 9px; margin-left: 8px; vertical-align: 8px; }
  .npc-ident p { font-size: 12px; margin-top: 8px; gap: 7px; }
  .npc-main { height: auto; flex: 1 1 auto; min-height: 0; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .075); }
  .npc-topbar { min-height: 52px; padding: 8px 12px; }
  .npc-theme-switch button { height: 28px; min-width: 38px; padding: 0 9px; font-size: 11px; }
  .npc-close { width: 34px; height: 34px; font-size: 21px; line-height: 30px; }
  .npc-under { min-height: 44px; padding: 7px 14px; }
  .npc-dossier { max-height: 200px; padding: 11px 14px 13px; }
  .npc-chat { padding: 9px 14px 12px; }
  .npc-log { min-height: 0; }
  .npc-mini { width: 38px; height: 38px; flex-basis: 38px; }
  .npc-bubble { font-size: 13.5px; padding: 9px 12px; max-width: 86%; }
  .npc-typing { margin-left: 48px; }
  .npc-compose input { height: 44px; }
  .npc-compose button { height: 44px; padding: 0 17px; font-size: 13px; }
  .npc-fineprint { font-size: 9px; }
}

/* 手机：贴底全宽，立绘占约 40dvh */
@media (max-width: 560px) {
  .npc-dock {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: 64px;
    height: 64px;
    padding: 4px;
    gap: 0;
    border-radius: 50%;
    justify-content: center;
  }
  .npc-dock-orb { width: 56px; height: 56px; flex-basis: 56px; }
  .npc-dock-copy { display: none; }
  .npc-dock-dot { left: 48px; top: 3px; width: 8px; height: 8px; }
  .npc-dock::after {
    content: "问";
    position: absolute;
    left: -3px;
    bottom: -3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--npc-accent);
    color: #15110c;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 7px rgba(0, 0, 0, .4);
  }
  .npc-modal { padding: 0; align-items: flex-end; }
  .npc-sheet {
    width: 100%;
    height: 94dvh;
    max-height: 96dvh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
  }
  .npc-hero { flex-basis: 40dvh; height: 40dvh; min-height: 250px; padding: 0; }
  .npc-hero-img, .npc-live-canvas { inset: 0; width: 100%; height: 100%; border-radius: 0; }
  .npc-hero-img { object-position: 16% 0%; }
  .npc-hero-meta { display: none; }
  .npc-kicker { font-size: 9px; margin-bottom: 5px; }
  .npc-ident { left: 15px; right: 13px; bottom: 14px; max-width: 94%; }
  .npc-ident h2 { font-size: 30px; }
  .npc-en { font-size: 8px; margin-left: 6px; vertical-align: 7px; }
  .npc-ident p { font-size: 11px; margin-top: 7px; gap: 6px; }
  .npc-topbar { min-height: 48px; padding: 6px 10px; gap: 8px; }
  .npc-theme-switch { max-width: calc(100% - 40px); gap: 3px; }
  .npc-theme-switch button { height: 26px; min-width: 34px; padding: 0 8px; font-size: 10px; }
  .npc-close { width: 32px; height: 32px; font-size: 20px; line-height: 28px; }
  .npc-under { min-height: 42px; padding: 6px 12px; gap: 8px; }
  .npc-traits span { padding: 3px 7px; font-size: 9px; }
  .npc-card-toggle { font-size: 10px; }
  .npc-dossier { grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 9px 12px 10px; max-height: 132px; overflow-y: auto; }
  .npc-dossier p { font-size: 11px; }
  .npc-chat { padding: 8px 12px 10px; }
  .npc-chat-head { gap: 8px; padding-bottom: 7px; }
  .npc-online, .npc-status, .npc-loc { font-size: 10px; }
  .npc-log { padding: 4px 0 8px; }
  .npc-msg { gap: 8px; margin-bottom: 10px; }
  .npc-mini { width: 40px; height: 40px; flex-basis: 40px; }
  .npc-bubble { max-width: 85%; padding: 8px 11px; font-size: 13px; line-height: 1.62; }
  .npc-typing { margin-left: 48px; }
  .npc-quick { gap: 5px; padding-bottom: 9px; }
  .npc-quick button { padding: 5px 9px; font-size: 11px; }
  .npc-compose { gap: 8px; }
  .npc-compose input { height: 44px; padding: 0 12px; }
  .npc-compose button { height: 44px; min-width: 66px; padding: 0 15px; font-size: 12px; }
  .npc-fineprint { font-size: 8px; padding-top: 6px; }
}

/* ===== 2.5D 实时数字人：head gaze / breath / blink / voice mouth ===== */
.npc-live-canvas {
  position: absolute;
  inset: 96px 20px auto;
  width: calc(100% - 40px);
  height: calc(100% - 328px);
  display: block;
  z-index: 2;
  opacity: 0;
  border-radius: 18px;
  pointer-events: none;
  transition: opacity .4s ease, transform .4s ease;
  will-change: transform;
}
.npc-live-canvas.live-on { opacity: 1; }
.npc-hero-img { z-index: 2; transition: opacity .35s ease; }
.npc-hero-img.live-hidden { opacity: 0; }
.npc-hero.is-speaking .npc-live-canvas { transform: translateY(-2px) scale(1.012); }
.npc-hero.is-speaking .npc-live-badge i { box-shadow: 0 0 0 3px rgba(131,214,161,.22), 0 0 18px rgba(131,214,161,.9); }
.npc-live-badge {
  position: absolute;
  top: 34px;
  left: 34px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px 6px 8px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(6,10,12,.62);
  color: rgba(235,245,238,.82);
  font-size: 10px;
  letter-spacing: .14em;
  line-height: 1;
  backdrop-filter: blur(10px);
  pointer-events: none;
}
.npc-live-badge i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #8fe0ad;
  box-shadow: 0 0 12px rgba(143,224,173,.8);
  animation: npc-live-pulse 2.4s ease-in-out infinite;
}
@keyframes npc-live-pulse { 0%,100% { opacity: .45; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
.npc-voice {
  flex: 0 0 auto;
  height: 30px;
  min-width: 46px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--npc-accent) 40%, transparent);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
  color: var(--npc-accent);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.npc-voice.off { color: rgba(255,255,255,.34); border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.025); }
.npc-wave { display: none; align-items: center; gap: 2px; flex: 0 0 auto; height: 14px; }
.npc-wave.on { display: inline-flex; }
.npc-wave i { display: block; width: 2px; height: 4px; border-radius: 2px; background: var(--npc-accent); animation: npc-wave .7s ease-in-out infinite; }
.npc-wave i:nth-child(2) { animation-delay: .12s; }
.npc-wave i:nth-child(3) { animation-delay: .24s; }
@keyframes npc-wave { 0%,100% { height: 4px; opacity: .45; } 50% { height: 13px; opacity: 1; } }
.npc-residents {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 24px 9px;
  border-bottom: 1px solid rgba(255,255,255,.055);
  overflow-x: auto;
  scrollbar-width: none;
}
.npc-residents::-webkit-scrollbar { display: none; }
.npc-residents-label { flex: 0 0 auto; font-size: 9px; letter-spacing: .16em; color: rgba(255,255,255,.35); margin-right: 2px; }
.npc-residents button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 3px 9px 3px 3px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  background: rgba(255,255,255,.035);
  color: rgba(255,255,255,.55);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}
.npc-residents button img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; display: block; }
.npc-residents button span { max-width: 56px; overflow: hidden; text-overflow: ellipsis; }
.npc-residents button.on { color: var(--npc-ink); border-color: color-mix(in srgb, var(--npc-accent) 55%, transparent); background: color-mix(in srgb, var(--npc-accent) 10%, transparent); }
.npc-residents button.on img { box-shadow: 0 0 0 1px var(--npc-accent); }

@media (max-width: 900px) {
  .npc-live-badge { top: 14px; left: 16px; font-size: 9px; padding: 5px 8px; }
  .npc-voice { height: 28px; min-width: 42px; padding: 0 8px; font-size: 10px; }
  .npc-residents { padding: 5px 12px 8px; gap: 5px; }
  .npc-residents button { height: 34px; padding: 2px 7px 2px 2px; }
  .npc-residents button img { width: 28px; height: 28px; }
  .npc-residents button span { max-width: 48px; }
  .npc-residents-label { display: none; }
}
@media (max-width: 560px) {
  .npc-live-badge { top: 12px; left: 12px; font-size: 8px; gap: 5px; padding: 4px 7px; }
  .npc-voice { min-width: 38px; padding: 0 6px; font-size: 9px; }
  .npc-residents { padding: 4px 12px 7px; gap: 4px; }
  .npc-residents button { height: 30px; padding: 2px 6px 2px 2px; font-size: 9px; }
  .npc-residents button img { width: 25px; height: 25px; }
  .npc-residents button span { max-width: 44px; }
  .npc-wave { height: 12px; }
}

/* Mobile fit after adding 4-resident strip + voice: keep chat readable, not clipped. */
@media (max-width: 560px) {
  .npc-sheet { height: 96dvh; max-height: 96dvh; }
  .npc-hero { flex-basis: 36dvh; height: 36dvh; min-height: 240px; padding: 0; }
  .npc-hero-img, .npc-live-canvas { inset: 0; width: 100%; height: 100%; border-radius: 0; }
  .npc-hero-meta { display: none; }
  .npc-topbar { min-height: 44px; padding: 5px 10px; }
  .npc-theme-switch button { height: 25px; font-size: 9.5px; }
  .npc-voice { height: 25px; min-width: 36px; font-size: 9px; }
  .npc-close { width: 30px; height: 30px; font-size: 19px; line-height: 27px; }
  .npc-under { min-height: 36px; padding: 4px 12px; }
  .npc-residents { padding: 2px 10px 3px; gap: 4px; }
  .npc-residents button { height: 28px; padding: 2px; border-radius: 50%; }
  .npc-residents button img { width: 24px; height: 24px; }
  .npc-residents button span { display: none; }
  .npc-chat { padding: 6px 12px 8px; }
  .npc-chat-head { padding-bottom: 5px; gap: 7px; }
  .npc-log { padding: 2px 0 6px; }
  .npc-quick { padding: 0 0 4px; }
  .npc-quick button { padding: 4px 8px; font-size: 10px; }
  .npc-compose input { height: 42px; }
  .npc-compose button { height: 42px; min-width: 60px; font-size: 12px; }
  .npc-fineprint { display: none; }
}
