/* Floating mascot + compact chat dock on ordinary pages. */
.pn-ai-twin-launcher {
  position: fixed;
  z-index: 99990;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Source Han Sans SC", "WenQuanYi Micro Hei", "Segoe UI", sans-serif;
}
.pn-ai-twin-launcher.pn-ai-twin-pos-left {
  right: auto;
  left: max(16px, env(safe-area-inset-left));
  align-items: flex-start;
}
.pn-ai-twin-launcher .pn-ai-twin-mascot,
.pn-ai-twin-launcher .pn-ai-twin-dock,
.pn-ai-twin-launcher .pn-ai-twin-mascot-bubble {
  pointer-events: auto;
}

.pn-ai-twin-mascot-bubble {
  position: relative;
  max-width: 11.5em;
  margin-bottom: 2px;
  padding: 0.45rem 0.8rem;
  border-radius: 14px 14px 4px 14px;
  background: #fffcf7;
  color: #1c1a17;
  border: 1px solid #e4ddd3;
  box-shadow: 0 8px 20px rgba(28, 26, 23, 0.16);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  cursor: pointer;
  animation: pn-ai-twin-bubble-in 0.35s ease;
}
.pn-ai-twin-launcher.pn-ai-twin-pos-left .pn-ai-twin-mascot-bubble {
  border-radius: 14px 14px 14px 4px;
}
.pn-ai-twin-mascot-bubble::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: #fffcf7;
  border-right: 1px solid #e4ddd3;
  border-bottom: 1px solid #e4ddd3;
  transform: rotate(45deg);
}
.pn-ai-twin-launcher.pn-ai-twin-pos-left .pn-ai-twin-mascot-bubble::after {
  right: auto;
  left: 22px;
}
.pn-ai-twin-launcher.is-open .pn-ai-twin-mascot-bubble {
  display: none;
}
@keyframes pn-ai-twin-bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pn-ai-twin-mascot {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  width: 128px;
  height: 150px;
  cursor: pointer;
  line-height: 0;
  filter: drop-shadow(0 10px 16px rgba(28, 26, 23, 0.28));
  transition: transform 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
#pn-ai-twin-launcher .pn-ai-twin-mascot:hover,
#pn-ai-twin-launcher .pn-ai-twin-mascot:active,
#pn-ai-twin-launcher .pn-ai-twin-mascot:focus,
#pn-ai-twin-launcher .pn-ai-twin-mascot:focus-visible,
#pn-ai-twin-launcher .pn-ai-twin-mascot:focus-within {
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  border: 0 !important;
}
#pn-ai-twin-launcher .pn-ai-twin-mascot::-moz-focus-inner {
  border: 0;
  outline: none;
}
.pn-ai-twin-mascot svg,
.pn-ai-twin-mascot img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
}
.pn-ai-twin-mascot.is-photo img {
  border-radius: 0;
  background: transparent;
  animation: pn-ai-twin-photo-bob 2.8s ease-in-out infinite;
}
.pn-ai-twin-mascot.is-photo.is-animated img {
  animation: none;
}
@keyframes pn-ai-twin-photo-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.pn-ai-twin-launcher.is-open .pn-ai-twin-mascot {
  width: 88px;
  height: 104px;
}
.pn-ai-twin-launcher.is-greet .pn-ai-twin-mascot,
.pn-ai-twin-mascot:hover {
  transform: translateY(-4px) scale(1.05);
}

.pn-ai-twin-dock {
  width: min(400px, calc(100vw - 24px));
  height: min(640px, calc(100vh - 190px));
  background: #f3f0ea;
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(28, 26, 23, 0.24);
  border: 1px solid #e4ddd3;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #1c1a17;
}
.pn-ai-twin-dock[hidden] {
  display: none !important;
}
.pn-ai-twin-dock-head {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 12px;
  background: #17181b;
  color: #ece8e1;
  flex: 0 0 auto;
}
.pn-ai-twin-dock-head strong {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}
.pn-ai-twin-dock-head .pn-ai-twin-app-version {
  color: #9a948a;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-right: 4px;
  flex: 0 0 auto;
}
.pn-ai-twin-dock-body #pn-ai-twin-app .pn-ai-twin-chat-top .pn-ai-twin-app-version {
  display: none;
}
.pn-ai-twin-char-wrap {
  position: relative;
  flex: 0 0 auto;
}
.pn-ai-twin-dock-avatar {
  appearance: none;
  border: 0;
  padding: 0;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  overflow: hidden;
  border-radius: 50%;
  background: #2a2c30;
  cursor: pointer;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}
.pn-ai-twin-dock-avatar:focus,
.pn-ai-twin-dock-avatar:focus-visible,
.pn-ai-twin-dock-avatar:active {
  outline: none;
  box-shadow: none;
}
.pn-ai-twin-dock-avatar svg,
.pn-ai-twin-dock-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.pn-ai-twin-char-picker {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(248px, calc(100vw - 48px));
  background: #f3f0ea;
  color: #1c1a17;
  border: 1px solid #e4ddd3;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(28, 26, 23, 0.2);
  padding: 10px;
}
.pn-ai-twin-char-picker[hidden] {
  display: none !important;
}
.pn-ai-twin-char-picker-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
}
.pn-ai-twin-char-picker-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}
.pn-ai-twin-char-option {
  appearance: none;
  border: 1px solid transparent;
  background: #fff;
  border-radius: 10px;
  padding: 6px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #1c1a17;
  -webkit-tap-highlight-color: transparent;
}
.pn-ai-twin-char-option:hover,
.pn-ai-twin-char-option:focus-visible {
  border-color: #c8b8a6;
  background: #f8f4ee;
  outline: none;
}
.pn-ai-twin-char-option.is-selected {
  border-color: #8b5e3c;
  background: #f0e6db;
}
.pn-ai-twin-char-option img {
  width: 56px;
  height: 64px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.pn-ai-twin-char-option span {
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}
.pn-ai-twin-dock-expand {
  flex: 0 0 auto;
  color: #ece8e1;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 8px;
  white-space: nowrap;
}
.pn-ai-twin-dock-expand:hover,
.pn-ai-twin-dock-expand:focus-visible {
  background: #2a2c30;
  color: #fff;
  text-decoration: none;
  outline: none;
}
.pn-ai-twin-dock-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #ece8e1;
  font-size: 22px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}
.pn-ai-twin-dock-close:hover,
.pn-ai-twin-dock-close:focus-visible {
  background: #2a2c30;
}
.pn-ai-twin-dock-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.pn-ai-twin-dock-gate {
  padding: 1.4rem 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.9rem;
}
.pn-ai-twin-dock-gate h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  color: #1c1a17;
}
.pn-ai-twin-dock-gate p {
  margin: 0;
  color: #6b6560;
  line-height: 1.6;
}
.pn-ai-twin-dock-gate .pn-ai-twin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  background: #8b5e3c;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.pn-ai-twin-dock-gate .pn-ai-twin-btn:hover {
  background: #734c30;
  text-decoration: none;
}

/* Compact the shared chat shell when it lives inside the dock. */
.pn-ai-twin-dock-body #pn-ai-twin-app {
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  grid-template-columns: 1fr;
  border-radius: 0;
}
.pn-ai-twin-dock-body #pn-ai-twin-app .pn-ai-twin-sidebar {
  position: absolute;
  inset: 0 auto 0 0;
  width: min(86%, 260px);
  z-index: 6;
  transform: translateX(-105%);
  transition: transform 0.2s ease;
}
body.pn-ai-twin-sidebar-open .pn-ai-twin-dock-body #pn-ai-twin-app .pn-ai-twin-sidebar {
  transform: none;
}
.pn-ai-twin-dock-body #pn-ai-twin-app .pn-ai-twin-only-mobile {
  display: inline-flex;
}
.pn-ai-twin-dock-body .pn-ai-twin-sidebar-backdrop {
  position: absolute;
  z-index: 5;
}
body.pn-ai-twin-sidebar-open .pn-ai-twin-dock-body .pn-ai-twin-sidebar-backdrop {
  display: block;
}
.pn-ai-twin-dock-body #pn-ai-twin-app .pn-ai-twin-composer {
  padding: 0.7rem 0.9rem 0.9rem;
}
.pn-ai-twin-dock-body #pn-ai-twin-app .pn-ai-twin-model-bar select {
  max-width: 10rem;
  min-width: 5.5rem;
}
.pn-ai-twin-dock-body #pn-ai-twin-app .pn-ai-twin-thinking-toggle {
  font-size: 0.8rem;
  padding: 0 0.55rem;
}
.pn-ai-twin-dock-body #pn-ai-twin-app .pn-ai-twin-chat-top {
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

@media (max-width: 600px) {
  .pn-ai-twin-mascot {
    width: 104px;
    height: 122px;
  }
  .pn-ai-twin-dock {
    width: calc(100vw - 16px);
    height: min(78vh, calc(100vh - 140px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .pn-ai-twin-mascot.is-photo img {
    animation: none !important;
  }
}
