:root {
  --model-offset-bottom: -155px;
  --chat-offset-bottom: -200px;
  --costume-btn-offset: -20px;
  --scale-factor: 1.1;
  --global-offset-x: 33px;
  --icon-offset-x: -6px;
  --costume-icon-offset-x: -6px;
  --toggle-chat-icon-offset-x: -2.5px;
  --right-offset: 15px;
  --chat-box-offset-x: 30px;
  --summary-icon-offset-x: -3.5px;
  --close-icon-offset-x: -1.6px;
}

.live2d-wrapper {
  position: fixed;
  right: var(--right-offset);
  bottom: var(--model-offset-bottom);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  gap: 15px;
  width: calc(270px * var(--live2d-wrapper-width) / 100);
  height: calc(600px * var(--live2d-wrapper-height) / 100);
  transform: none;
}

.live2d-wrapper::before {
  content: "";
  position: absolute;
  top: -300px;
  left: -50px;
  right: -50px;
  bottom: 0;
  z-index: -1;
}

.live2d-wrapper .costume-btn,
.live2d-wrapper .toggle-chat-btn,
.live2d-wrapper .summary-btn,
.live2d-wrapper .close-btn {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.live2d-wrapper:hover .costume-btn,
.live2d-wrapper:hover .toggle-chat-btn,
.live2d-wrapper:hover .summary-btn,
.live2d-wrapper:hover .close-btn,
.live2d-wrapper.show-buttons .costume-btn,
.live2d-wrapper.show-buttons .toggle-chat-btn,
.live2d-wrapper.show-buttons .summary-btn,
.live2d-wrapper.show-buttons .close-btn {
  opacity: 1;
  visibility: visible;
}

.model-container {
  position: relative;
  width: 300px;
  height: 650px;
  right: var(--right-offset);
  transform: none;
}

.chat-box {
  position: absolute;
  bottom: calc(100% + var(--chat-offset-bottom));
  right: var(--right-offset);
  width: 380px;
  height: 330px;
  background: rgba(255, 246, 191, 0.85);
  border-radius: 12px 12px 0 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;
  opacity: 0.9;
  padding: 12px;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  transform: translateX(var(--chat-box-offset-x)) scaleY(1);
  overflow: hidden;
}

.chat-box.hidden {
  transform: scaleY(0);
  opacity: 0;
  pointer-events: none;
}

.chat-box:hover {
  opacity: 1;
  transform: translateX(var(--chat-box-offset-x)) scaleY(1) translateY(-2px);
}

.chat-title-bar {
    flex-shrink: 0;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 200, 100, 0.4);
    margin: -12px -12px 8px -12px;
    padding: 0 12px;
    background: rgba(255, 235, 160, 0.5);
    border-radius: 10px 10px 0 0;
    position: relative;
}


/* ===== 模型切换 ===== */
.model-switcher {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.model-switcher-btn {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    color: #8a7a5a;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.04);
    transition: background 0.2s ease;
    white-space: nowrap;
}

.model-switcher-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.model-switcher-btn .chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 16px;
    line-height: 1;
    transition: transform 0.2s ease;
    transform-origin: center center;
    transform: rotate(-90deg);
}

.model-switcher-btn .chevron.open {
    transform: rotate(-90deg) scaleX(-1);
}

.model-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    padding: 4px;
    z-index: 100;
    animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.model-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.model-option:hover {
    background: rgba(0, 0, 0, 0.04);
}

.model-option-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.model-option-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.model-option-desc {
    font-size: 11px;
    color: #999;
}

.model-check {
    position: relative;
    width: 14px;
    height: 14px;
    margin-left: 12px;
    flex-shrink: 0;
}

.model-check::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0;
    width: 5px;
    height: 10px;
    border-right: 2px solid #333;
    border-bottom: 2px solid #333;
    transform: rotate(45deg);
}

.model-option.disabled {
    opacity: 0.55;
    cursor: default;
}

.model-option.disabled:hover {
    background: transparent;
}

.model-badge-training {
    font-size: 10px;
    font-weight: 600;
    color: #b37a00;
    background: rgba(255, 200, 100, 0.35);
    padding: 2px 0;
    width: 52px;
    text-align: center;
    border-radius: 4px;
    margin-left: 12px;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.model-badge-training.is-test {
    color: #ffffff;
    background: rgba(138, 92, 246, 0.9);
}

.messages {
  flex: 1;
  overflow-y: auto;
  max-height: 100%;
  margin-bottom: 12px;
}

.message {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  margin: 6px 0;
  font-size: 13px;
  line-height: 1.4;
  animation: fadeIn 0.25s ease;
  word-wrap: break-word;
  white-space: pre-wrap;
  max-width: 85%;
}

.message img {
  max-width: 100%;
  max-height: 160px;
  width: auto;
  height: auto;
  border-radius: 8px;
  margin: 4px 0;
  display: block;
  object-fit: contain;
}

/* ===== 极致简约 思考过程面板 ===== */
.reasoning-panel {
  margin: 6px 0;
  border: 1px solid rgba(138, 122, 90, 0.15); /* 微弱的淡褐色上下右边框 */
  border-left: 3px solid #ffe08a; /* 左侧保留融入背景的温暖淡黄核心线 */
  background: rgba(0, 0, 0, 0.015); /* 极淡的暗影沉降 */
  border-radius: 6px;
  overflow: hidden;
}

.reasoning-toggle {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: #666666; /* 优雅的浅灰褐标题 */
  transition: background 0.2s ease;
}

.reasoning-toggle:hover {
  background: rgba(138, 122, 90, 0.05);
}

.reasoning-toggle-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.reasoning-toggle-icon {
  margin-left: auto;
  font-size: 10px;
  color: #a09278;
  transition: transform 0.2s ease;
}

.reasoning-toggle-icon.open {
  transform: rotate(90deg);
}

.reasoning-body {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #666666; /* 彻底净化！换成纯粹、干净、高级的经典淡灰 */
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px dashed rgba(138, 122, 90, 0.12); /* 极其克制的虚线分隔 */
  background: rgba(255, 255, 255, 0.3); /* 微微提亮思考内容区 */
}

.message--user {
  margin-left: auto;
  margin-right: 2%;
  max-width: 78%;
  text-align: left;
}

.message--user img {
  max-width: 190px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.input-area {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-shrink: 0;
}

.message-input {
  flex: 1;
  border: none;
  background: rgba(255, 253, 237, 0.9);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  min-width: 160px;
}

.send-btn {
  all: unset;
  background: rgba(255, 186, 73, 0.9);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.send-btn:hover {
  background: #ff9f1a;
}

.costume-btn {
  position: absolute;
  right: calc(var(--right-offset) + var(--costume-btn-offset));
  top: 38%;
  background: #fff3cd;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #ffe08a;
  transform: scale(var(--scale-factor));
}

.costume-btn:hover {
  transform: scale(var(--scale-factor));
  filter: drop-shadow(0 0 8px rgba(255, 159, 26, 0.3));
}

.fa-tshirt {
  color: #ff9f1a;
  font-size: 20px;
}

.costume-btn i {
  transform: translateX(var(--costume-icon-offset-x));
}

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 200, 100, 0.6);
  border-radius: 3px;
}

.typing-indicator {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  margin: 6px 0;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.dot {
  width: 6px;
  height: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-6px);
  }
}

.loading-dots:after {
  content: "...";
  animation: dots 1s steps(5, end) infinite;
  display: inline-block;
  width: 20px;
}

@keyframes dots {
  0%,
  20% {
    content: ".";
  }
  40% {
    content: "..";
  }
  60% {
    content: "...";
  }
  80%,
  100% {
    content: "";
  }
}

.toggle-chat-btn {
  position: absolute;
  right: calc(var(--right-offset) + var(--costume-btn-offset));
  top: calc(38% + 100px);
  background: #fff3cd;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #ffe08a;
  transform: scale(var(--scale-factor));
}

.toggle-chat-btn:hover {
  transform: scale(var(--scale-factor));
  filter: drop-shadow(0 0 8px rgba(255, 159, 26, 0.3));
}

.toggle-chat-btn i {
  transform: translateX(var(--toggle-chat-icon-offset-x));
}

.toggle-chat-btn i {
  color: #ff9f1a;
  font-size: 20px;
  transition: all 0.3s ease;
}

.summary-btn {
  position: absolute;
  right: calc(var(--right-offset) + var(--costume-btn-offset));
  top: calc(38% + 50px);
  background: #fff3cd;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #ffe08a;
  transform: scale(var(--scale-factor));
}

.summary-btn:hover {
  transform: scale(var(--scale-factor));
  filter: drop-shadow(0 0 8px rgba(255, 159, 26, 0.3));
}

.summary-btn i {
  transform: translateX(var(--summary-icon-offset-x));
  color: #ff9f1a;
  font-size: 20px;
  transition: color 0.3s ease;
}

.close-btn {
  position: absolute;
  right: calc(var(--right-offset) + var(--costume-btn-offset));
  top: calc(38% + 150px);
  background: #fff3cd;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #ffe08a;
  transform: scale(var(--scale-factor));
}

.close-btn:hover {
  transform: scale(var(--scale-factor));
  filter: drop-shadow(0 0 8px rgba(255, 159, 26, 0.3));
}

.close-btn i {
  color: #ff9f1a;
  font-size: 20px;
  transition: color 0.3s ease;
  transform: translateX(var(--close-icon-offset-x));
}

.chat-box,
.message,
.message-input,
.send-btn,
.costume-btn,
.toggle-chat-btn,
.close-btn,
.typing-indicator,
.loading-dots,
.chat-title-bar,
.chat-disclaimer {
  font-family: "Roboto", sans-serif;
}

.chat-disclaimer {
    text-align: center;
    font-size: 10.5px;
    color: #bbb;
    padding: 4px 16px 2px 10px;
    margin: 4px -11px -8px -12px;
    line-height: 1.4;
    flex-shrink: 0;
    border-radius: 0 0 12px 12px;
}

.chat-disclaimer i {
    margin-left: 3px;
    font-size: 10px;
    color: #d5d5d5;
    cursor: pointer;
}

.chat-disclaimer {
    position: relative;
}

.disclaimer-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 20px;
    width: 200px;
    background: #fff;
    color: #444;
    font-size: 11px;
    line-height: 1.6;
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    text-align: left;
    animation: tooltipIn 0.15s ease;
    z-index: 200;
    pointer-events: none;
}

@keyframes tooltipIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.turnstile-challenge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.turnstile-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.turnstile-container {
  display: flex;
  justify-content: center;
  min-height: 55px;
  transform: scale(0.85);
  transform-origin: center center;
}

.turnstile-container iframe {
  max-width: 100% !important;
}

.message.action-msg {
  background: transparent;
  padding: 2px 0;
  box-shadow: none;
}

.action-process {
  background: #f4f5f7;
  border: 1px solid #e2e4e8;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  overflow: hidden;
}

.action-process:hover {
  border-color: #d0d3d8;
  background: #eef0f3;
}

.action-process-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: #666;
}

.action-process-icon {
  font-size: 11px;
  color: #888;
}

.action-process-label {
  font-weight: 500;
  color: #555;
  letter-spacing: 0.2px;
}

.action-process-chevron {
  font-size: 9px;
  color: #aaa;
  margin-left: auto;
  transition: transform 0.2s ease;
}

.action-process.expanded .action-process-chevron {
  transform: rotate(90deg);
}

.action-process-body {
  padding: 0 12px 8px 12px;
  animation: actionBodyIn 0.15s ease;
}

.action-process-body pre {
  margin: 0;
  font-size: 11.5px;
  font-family: 'Consolas', 'Monaco', monospace;
  color: #555;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  background: rgba(255, 255, 255, 0.6);
  padding: 8px 10px;
  border-radius: 6px;
}

@keyframes actionBodyIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== ClawProcess 智能操作进度 ===== */
.claw-process {
  background: linear-gradient(135deg, #f0f4ff 0%, #f5f0ff 100%);
  border: 1px solid #d8d0f0;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.claw-process-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.claw-process-header:hover {
  background: rgba(120, 80, 200, 0.05);
}

.claw-icon {
  font-size: 12px;
  color: #7c6bc4;
}

.claw-title {
  font-size: 12px;
  font-weight: 500;
  color: #555;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.claw-status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.claw-status-badge.running {
  color: #7c6bc4;
  background: rgba(124, 107, 196, 0.15);
}

.claw-status-badge.done {
  color: #2d8a4e;
  background: rgba(45, 138, 78, 0.12);
}

.claw-status-badge.fail {
  color: #d1242f;
  background: rgba(209, 36, 47, 0.1);
}

.claw-chevron {
  font-size: 9px;
  color: #aaa;
  transition: transform 0.2s ease;
}

.claw-chevron.open {
  transform: rotate(90deg);
}

.claw-process-body {
  padding: 0 12px 8px 12px;
  animation: actionBodyIn 0.15s ease;
}

.claw-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.4;
  color: #666;
}

.claw-step-icon {
  flex-shrink: 0;
  width: 16px;
  text-align: center;
  font-weight: 700;
}

.claw-step.pending .claw-step-icon {
  color: #bbb;
}

.claw-step.running .claw-step-icon {
  color: #7c6bc4;
  animation: clawPulse 1s ease-in-out infinite;
}

.claw-step.done .claw-step-icon {
  color: #2d8a4e;
}

.claw-step.fail .claw-step-icon {
  color: #d1242f;
}

.claw-step.done .claw-step-desc {
  color: #2d8a4e;
}

.claw-step.fail .claw-step-desc {
  color: #d1242f;
}

.claw-step.running .claw-step-desc {
  color: #7c6bc4;
  font-weight: 500;
}

.claw-step-desc {
  word-break: break-word;
}

@keyframes clawPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}