.ss-ch-ask-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eee8dc;
}

.ss-ch-ask-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 5px 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #faf6ee 100%);
  border: 1px solid #dfd6c4;
  box-shadow: 0 2px 8px rgba(24, 33, 49, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  color: #182131;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.ss-ch-ask-btn:hover,
.ss-ch-ask-btn:focus-visible {
  border-color: #bfa070;
  background: linear-gradient(180deg, #ffffff 0%, #f6eedf 100%);
  box-shadow: 0 6px 16px rgba(139, 106, 62, 0.14);
  transform: translateY(-1px);
  outline: none;
}

.ss-ch-ask-btn.is-active {
  border-color: #8b6a3e;
  background: linear-gradient(180deg, #fffdf9 0%, #f4ead6 100%);
  box-shadow: 0 4px 14px rgba(139, 106, 62, 0.16);
}

.ss-ch-ask-av {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #f2ece0;
  border: 1px solid #e4dac8;
  object-fit: contain;
  padding: 2px;
  flex-shrink: 0;
  display: block;
}

.ss-ch-ask-txt {
  padding-right: 4px;
  white-space: nowrap;
}

.ss-ch-ask-arrow {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #182131;
  color: #f8f5ef;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.16s ease, transform 0.16s ease;
}

.ss-ch-ask-arrow svg {
  width: 14px;
  height: 14px;
  display: block;
}

.ss-ch-ask-btn:hover .ss-ch-ask-arrow,
.ss-ch-ask-btn.is-active .ss-ch-ask-arrow {
  background: #8b6a3e;
  transform: translateX(1px);
}

.ss-ch-ask-meta {
  font-size: 11.5px;
  font-weight: 500;
  color: #8c8273;
  white-space: nowrap;
}

.ss-chat-ctx-wrap {
  margin-bottom: 10px;
}

.ss-chat-ctx-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #f8f4ec;
  border: 1px solid #e1d7c4;
  border-left: 3px solid #8b6a3e;
  margin-bottom: 8px;
}

.ss-chat-ctx-body {
  min-width: 0;
  flex: 1;
}

.ss-chat-ctx-kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #8b6a3e;
  margin-bottom: 2px;
  line-height: 1.35;
}

.ss-chat-ctx-snippet {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  color: #364152;
  line-height: 1.45;
  word-break: keep-all;
}

.ss-chat-ctx-clear {
  flex-shrink: 0;
  border: 0;
  border-radius: 6px;
  background: #ece5d8;
  color: #5d6675;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  line-height: 1.2;
}

.ss-chat-ctx-clear:hover {
  background: #e1d7c5;
  color: #182131;
}

.ss-chat-ctx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ss-chat-qchip {
  border: 1px solid #e2d9c8;
  border-radius: 999px;
  background: #faf7f0;
  color: #2d384b;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  line-height: 1.3;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.ss-chat-qchip:hover {
  border-color: #bfa070;
  background: #f3ead9;
  color: #182131;
}

.ss-msg-chapter-ref {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.20);
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 6px;
  padding: 3px 8px;
  margin-bottom: 7px;
  line-height: 1.35;
  max-width: 100%;
}
.account-chat-layout .chat-message.user .ss-msg-chapter-ref {
  color: #182131;
  background: rgba(24, 33, 49, 0.08);
  border-color: rgba(24, 33, 49, 0.14);
}

.ss-msg-chapter-ref svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.ss-msg-user-body {
  display: block;
  white-space: pre-wrap;
  word-break: keep-all;
}

@keyframes ssChatFocusPulse {
  0% { box-shadow: 0 0 0 0 rgba(139, 106, 62, 0.28); }
  50% { box-shadow: 0 0 0 4px rgba(139, 106, 62, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(139, 106, 62, 0); }
}

.chat-panel.ss-chat-panel-flash {
  animation: ssChatFocusPulse 0.9s ease;
}

@media (max-width: 640px) {
  .ss-ch-ask-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .ss-ch-ask-btn {
    width: 100%;
    justify-content: space-between;
  }
  .ss-ch-ask-txt {
    flex: 1;
    padding-right: 6px;
    white-space: normal;
  }
  .ss-ch-ask-meta {
    align-self: flex-end;
    font-size: 11px;
  }
}
/* === LIVING SAJUSSAM OWL CHAT STAGE & SPEECH BUBBLES === */
.chat-panel {
  border-color: #e4ddd0 !important;
  background: #f8f5ef !important;
  overflow: hidden;
}

.chat-panel .chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px !important;
  background: linear-gradient(180deg, #faf6ee 0%, #f3ece0 100%) !important;
  border-bottom: 1px solid #e5ddd0 !important;
}

.ss-chat-owl-actor {
  position: relative;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ss-chat-owl-actor img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(24, 33, 49, 0.12));
  transform-origin: center bottom;
  animation: ssChatOwlBreathe 3.4s ease-in-out infinite;
}

.ss-chat-owl-actor[data-pose="thinking"] img {
  animation: ssChatOwlRead 1.5s ease-in-out infinite;
}

.ss-chat-owl-actor.is-nod img {
  animation: ssChatOwlNod 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ssChatOwlBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2.5px) scale(1.018); }
}

@keyframes ssChatOwlRead {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-2px) rotate(2.2deg); }
}

@keyframes ssChatOwlNod {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-6px) scale(1.06) rotate(-3deg); }
  70% { transform: translateY(1px) scale(0.98) rotate(2deg); }
  100% { transform: translateY(0) scale(1); }
}

.ss-chat-stage-meta {
  min-width: 0;
  flex: 1;
}

.ss-chat-stage-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.ss-chat-stage-name {
  font-family: 'Gowun Batang', 'Batang', serif;
  font-size: 14.5px !important;
  font-weight: 700;
  color: #182131;
  line-height: 1.2;
}

.ss-chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22a06b;
  box-shadow: 0 0 0 3px rgba(34, 160, 107, 0.16);
  flex-shrink: 0;
}

.ss-chat-status-dot.is-thinking {
  background: #c98a2e;
  box-shadow: 0 0 0 3px rgba(201, 138, 46, 0.22);
  animation: ssDotPulse 1.2s ease-in-out infinite;
}

@keyframes ssDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.ss-chat-stage-sub {
  font-size: 11px !important;
  color: #7d7365;
  font-weight: 500;
  line-height: 1.2 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-chat-owl-speech {
  position: relative;
  display: inline-block;
  max-width: 100%;
  padding: 6px 11px;
  border-radius: 4px 12px 12px 12px;
  background: #ffffff;
  border: 1px solid #e3dacb;
  color: #242e3f;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  word-break: keep-all;
  box-shadow: 0 1px 4px rgba(24, 33, 49, 0.04);
}

.chat-panel .chat-messages {
  background: #f8f5ef !important;
  padding: 16px 14px !important;
  display: flex;
  flex-direction: column;
  gap: 14px !important;
}

.ss-chat-turn {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 100%;
}

.ss-chat-turn.is-user {
  justify-content: flex-end;
}

.ss-chat-turn-av {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #efe9dc;
  border: 1px solid #e1d7c5;
  padding: 2px;
  flex-shrink: 0;
  margin-top: 2px;
  object-fit: contain;
  display: block;
}

.ss-chat-turn-body {
  min-width: 0;
  max-width: calc(100% - 44px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.ss-chat-turn.is-user .ss-chat-turn-body {
  max-width: 88%;
  align-items: flex-end;
}

.ss-chat-turn-name {
  font-size: 11px;
  font-weight: 700;
  color: #8b6a3e;
  margin: 0 0 4px 2px;
  line-height: 1.2;
}

.chat-panel .chat-message.assistant {
  background: #ffffff !important;
  color: #1f2937 !important;
  border: 1px solid #e5dfd4 !important;
  border-radius: 4px 15px 15px 15px !important;
  padding: 11px 14px !important;
  max-width: 100% !important;
  box-shadow: 0 2px 8px rgba(24, 33, 49, 0.04);
}

.chat-panel .chat-message.user {
  background: #182131 !important;
  color: #f8f5ef !important;
  border: 1px solid #182131 !important;
  border-radius: 15px 4px 15px 15px !important;
  padding: 11px 14px !important;
  max-width: 100% !important;
  box-shadow: 0 3px 10px rgba(24, 33, 49, 0.12);
}

.chat-panel .chat-message.user .ss-msg-chapter-ref {
  color: #f2dfb8 !important;
  background: rgba(227, 198, 146, 0.16) !important;
  border-color: rgba(227, 198, 146, 0.34) !important;
}

.ss-chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-size: 12.5px;
}

.ss-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ss-typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #8b6a3e;
  display: block;
  animation: ssTypingBounce 1.2s ease-in-out infinite;
}

.ss-typing-dots i:nth-child(2) { animation-delay: 0.18s; }
.ss-typing-dots i:nth-child(3) { animation-delay: 0.36s; }

@keyframes ssTypingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.chat-panel .chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 8px 10px;
}

.chat-panel .chat-welcome > img {
  width: 112px !important;
  height: 112px !important;
  object-fit: contain;
  margin-bottom: 0 !important;
  filter: drop-shadow(0 6px 14px rgba(24, 33, 49, 0.1));
  animation: ssChatOwlBreathe 3.4s ease-in-out infinite;
}

.chat-panel .chat-welcome .chat-message.assistant {
  border-radius: 14px !important;
  text-align: center;
  max-width: 92% !important;
}

.chat-panel .chat-compose {
  background: #ffffff !important;
  border-top: 1px solid #e6dfd1 !important;
}

.chat-panel .chat-compose textarea {
  border-color: #dfd8ca !important;
  background: #fcfbf8 !important;
  border-radius: 10px !important;
}

.chat-panel .chat-compose textarea:focus {
  border-color: #8b6a3e !important;
  background: #ffffff !important;
}

.chat-panel .chat-compose-bottom > .primary-button {
  background: #182131 !important;
  border-color: #182131 !important;
  color: #f8f5ef !important;
  border-radius: 999px !important;
}

.chat-panel .chat-compose-bottom > .primary-button:hover {
  background: #26334a !important;
}

@media (prefers-reduced-motion: reduce) {
  .ss-chat-owl-actor img,
  .chat-panel .chat-welcome > img,
  .ss-typing-dots i,
  .ss-chat-status-dot.is-thinking {
    animation: none !important;
  }
}

@media (max-width: 640px) {
  .ss-chat-owl-actor,
  .ss-chat-owl-actor img {
    width: 50px;
    height: 50px;
  }
  .ss-chat-owl-speech {
    font-size: 11.5px;
    padding: 5px 10px;
  }
}
