/* 陪伴空间 */

.chat-layout {
  display: grid;
  grid-template-columns: 0.84fr 1.16fr;
  gap: 20px;
  align-items: start;
}

/* 左：角色 */
.stage-mini {
  position: sticky;
  top: 96px;
  border-radius: 30px;
  padding: 16px 16px 18px;
  background: linear-gradient(168deg, #ffffff, #fbfcff 45%, #eef3ff);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.stage-mini .stage-top { padding: 2px 4px 6px; }

.stage-mini .stage-body { min-height: 240px; }
.stage-mini .mascot-holder { width: min(220px, 76%); }

.stage-caption {
  margin: 2px 4px 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
  min-height: 62px;
}

.expr-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.expr {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.22s var(--ease);
}

.expr:hover { border-color: var(--ink-4); }

.expr.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.mood-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.mood {
  flex: 1;
  min-width: 62px;
  height: 60px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: var(--ink-3);
  cursor: pointer;
  transition: all 0.25s var(--ease);
}

.mood span:first-child { font-size: 17px; line-height: 1; }
.mood:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--line-2); }
.mood.active { border-color: var(--ink); color: var(--ink); background: #fffdf8; }

/* 右：对话 */
.panel {
  display: flex;
  flex-direction: column;
  height: min(74vh, 680px);
  min-height: 520px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.panel-head .av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(150deg, #fff, #eaf0ff);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.panel-head b { font-size: 13.5px; }

.panel-head .st {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-3);
}

.log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.log::-webkit-scrollbar { width: 6px; }
.log::-webkit-scrollbar-thumb { background: rgba(23, 22, 27, 0.14); border-radius: 99px; }

.msg { display: flex; gap: 9px; max-width: 90%; }

.msg .av {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(150deg, #fff, #e8efff);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.msg .txt {
  padding: 10px 14px;
  border-radius: 4px 16px 16px 16px;
  background: #f7f5f0;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

.msg--me { margin-left: auto; flex-direction: row-reverse; }

.msg--me .txt {
  background: var(--ink);
  color: #fff;
  border-radius: 16px 4px 16px 16px;
}

.msg .meta {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-4);
  margin-top: 5px;
  letter-spacing: 0.06em;
}

.msg--me .meta { text-align: right; }

.msg--sys {
  align-self: center;
  max-width: 100%;
  font-size: 11.5px;
  color: var(--ink-4);
  background: rgba(23, 22, 27, 0.04);
  padding: 5px 12px;
  border-radius: 999px;
}

.dots { display: inline-flex; gap: 3px; vertical-align: 0; }
.dots i {
  width: 4px; height: 4px; border-radius: 50%; background: var(--ink-4);
  animation: dotPulse 1.2s infinite;
}
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotPulse { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

.quick-chips { display: flex; gap: 6px; padding: 10px 18px 4px; flex-wrap: wrap; }

.chip {
  border: 1px dashed var(--line-2);
  background: transparent;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 11.5px;
  color: var(--ink-3);
  cursor: pointer;
  transition: all 0.22s;
}

.chip:hover { border-style: solid; color: var(--ink); background: #fff; }

.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px 14px; }

.chat-form textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 18px;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.6;
  outline: 0;
  max-height: 120px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-form textarea:focus { border-color: rgba(107, 135, 255, 0.6); box-shadow: 0 0 0 4px rgba(107, 135, 255, 0.1); }

.send-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.22s var(--ease), background 0.22s;
}

.send-btn:hover { transform: scale(1.05); }
.send-btn:disabled { opacity: 0.4; cursor: wait; transform: none; }

.tips {
  margin-top: 18px;
  font-size: 11.5px;
  color: var(--ink-4);
  line-height: 1.8;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--mono);
  letter-spacing: 0.03em;
}

@media (max-width: 1000px) {
  .chat-layout { display: flex; flex-direction: column; }
  .panel { order: -1; height: 66vh; min-height: 460px; }
  .stage-mini { position: static; }
  .page-head { margin-bottom: 18px; }
}

@media (max-width: 640px) {
  .stage-mini .stage-body { min-height: 190px; }
  .stage-mini .mascot-holder { width: min(170px, 60%); }
  .mood { min-width: 54px; height: 54px; }
  .panel { border-radius: 24px; }
}

/* 移动端：把角色区压缩，让人一进来就能开始聊 */
@media (max-width: 640px) {
  .stage-mini { padding: 12px 12px 14px; border-radius: 24px; }
  .stage-mini .stage-body { min-height: 132px; padding: 0; }
  .stage-mini .mascot-holder { width: 132px; }
  .stage-caption {
    min-height: 0;
    padding: 9px 12px;
    font-size: 12.5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .expr-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin-top: 10px; }
  .expr-row::-webkit-scrollbar { display: none; }
  .expr { flex: 0 0 auto; padding: 6px 11px; }
  .mood-row { margin-top: 8px; padding-top: 10px; }
  .panel { height: auto; min-height: 62vh; }
  .log { padding: 14px 14px 6px; gap: 12px; }
  .msg .txt { font-size: 13.5px; }
  .quick-chips { padding: 8px 14px 2px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .quick-chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
  .chat-form { padding: 10px 12px 12px; }
}

@media (max-width: 640px) {
  .stage-caption { display: none; }
  .stage-mini .stage-body { min-height: 118px; }
  .stage-mini .mascot-holder { width: 118px; }
  .stage-mini .stage-top { padding-bottom: 2px; }
}

@media (max-width: 640px) {
  .page-head h1 { font-size: 30px; }
  .page-head p { font-size: 13px; }
  .panel { height: 64vh; min-height: 420px; border-radius: 24px; }
}
