:root {
  --tab-bar-height: 0px;
  --mp-tabbar-height: calc(1.333rem + env(safe-area-inset-bottom, 0px));
  --mp-bottom-area-height: 4.2rem;
  --accent: #4B7BFF;
  --accent-soft: #E8F0FF;
  --user-bubble: #4B7BFF;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: #f5f7fb;
  -webkit-font-smoothing: antialiased;
}

.page {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: #f5f7fb;
  display: flex;
  flex-direction: column;
}

.bg-gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 8rem;
  background: linear-gradient(180deg, #dce8ff 0%, #eef3ff 45%, #f5f7fb 100%);
  pointer-events: none;
  z-index: 0;
}

.main-content {
  position: relative;
  z-index: 5;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.32rem 0.427rem 0.213rem;
}

.hero-card {
  background: linear-gradient(160deg, #eef4ff 0%, #f7f9ff 55%, #ffffff 100%);
  border-radius: 0.533rem;
  box-shadow: 0 0.08rem 0.427rem rgba(75, 123, 255, 0.08);
  padding: 0.427rem 0.373rem 0.213rem;
  overflow: hidden;
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 0.267rem;
  padding: 0.107rem 0.16rem 0.373rem;
}

.hero-logo {
  width: 1.067rem;
  height: 1.067rem;
  flex-shrink: 0;
  object-fit: contain;
}

.hero-hi {
  font-size: 0.4rem;
  font-weight: 600;
  color: #1f2a44;
  line-height: 1.45;
}

.suggest-card {
  background: #fff;
  border-radius: 0.427rem;
  padding: 0.32rem 0.267rem 0.053rem;
  box-shadow: 0 0.027rem 0.213rem rgba(0, 0, 0, 0.03);
}

.suggest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.16rem;
  padding: 0 0.053rem;
}

.suggest-header .label {
  font-size: 0.373rem;
  font-weight: 600;
  color: #222;
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: 0.107rem;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

.refresh-btn img {
  width: 0.32rem;
  height: 0.32rem;
}

.refresh-btn img.spin {
  animation: spin 0.6s linear;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.refresh-btn span {
  font-size: 0.32rem;
  color: #999;
}

.suggest-list {
  list-style: none;
}

.suggest-item {
  display: flex;
  align-items: center;
  padding: 0.347rem 0.053rem;
  cursor: pointer;
}

.suggest-item + .suggest-item {
  border-top: 0.013rem solid #f2f3f7;
}

.suggest-item .icon {
  width: 0.48rem;
  height: 0.48rem;
  flex-shrink: 0;
  object-fit: contain;
}

.suggest-item .text {
  flex: 1;
  margin-left: 0.267rem;
  font-size: 0.373rem;
  color: #333;
  line-height: 1.4;
}

.suggest-item .arrow {
  width: 0.347rem;
  height: 0.347rem;
  flex-shrink: 0;
  opacity: 0.35;
}

.chat-area {
  display: none;
  padding: 0.427rem 0.053rem 0.213rem;
}

.chat-area.visible {
  display: block;
}

.msg {
  display: flex;
  margin-bottom: 0.373rem;
}

.msg.user {
  justify-content: flex-end;
}

.msg.ai {
  justify-content: flex-start;
}

.msg-bubble {
  max-width: 78%;
  padding: 0.293rem 0.373rem;
  border-radius: 0.427rem;
  font-size: 0.373rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 0.027rem 0.107rem rgba(0, 0, 0, 0.04);
}

.msg.user .msg-bubble {
  background: var(--user-bubble);
  color: #fff;
  border-bottom-right-radius: 0.08rem;
}

.msg.ai .msg-bubble {
  background: #fff;
  color: #333;
  border-bottom-left-radius: 0.08rem;
}

.msg.ai.loading .msg-bubble {
  padding: 0.373rem 0.48rem;
}

.typing-dots {
  display: inline-flex;
  gap: 0.133rem;
  align-items: center;
}

.typing-dots span {
  width: 0.187rem;
  height: 0.187rem;
  border-radius: 50%;
  background: #999;
  animation: bounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-0.133rem); opacity: 1; }
}

.bottom-area {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 20;
  padding: 0 0.427rem 0.213rem;
  padding-bottom: calc(0.213rem + env(safe-area-inset-bottom, 0));
  background: linear-gradient(to top, #f5f7fb 70%, rgba(245, 247, 251, 0));
}

.model-chips {
  display: flex;
  gap: 0.213rem;
  overflow-x: auto;
  padding: 0.213rem 0 0.267rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.model-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: flex;
  align-items: center;
  gap: 0.133rem;
  flex-shrink: 0;
  height: 0.8rem;
  padding: 0 0.267rem 0 0.213rem;
  background: #fff;
  border: 0.013rem solid #e6e8ef;
  border-radius: 0.4rem;
  cursor: pointer;
  box-shadow: 0 0.027rem 0.107rem rgba(0, 0, 0, 0.03);
}

.chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  border-style: dashed;
}

.chip img {
  width: 0.48rem;
  height: 0.48rem;
  object-fit: contain;
  border-radius: 50%;
}

.chip span {
  font-size: 0.32rem;
  color: #333;
  white-space: nowrap;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.213rem;
}

.input-box {
  flex: 1;
  display: flex;
  align-items: center;
  height: 1.173rem;
  background: #fff;
  border: 0.013rem solid #e6e8ef;
  border-radius: 0.587rem;
  padding: 0 0.267rem;
  gap: 0.16rem;
  box-shadow: 0 0.027rem 0.107rem rgba(0, 0, 0, 0.03);
}

.mic-btn,
.plus-btn {
  width: 0.64rem;
  height: 0.64rem;
  flex-shrink: 0;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mic-btn img,
.plus-btn img {
  width: 0.533rem;
  height: 0.533rem;
  object-fit: contain;
}

.input-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.373rem;
  color: #333;
  min-width: 0;
}

.input-box input::placeholder {
  color: #b0b4c0;
}

.send-btn {
  width: 1.173rem;
  height: 1.173rem;
  flex-shrink: 0;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.send-btn img {
  width: 1.173rem;
  height: 1.173rem;
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.bottom-spacer {
  height: calc(4.267rem + var(--tab-bar-height));
}

/* 小程序 / App 嵌入 */
html.mp-tabbar-visible,
html.mp-tabbar-visible body {
  height: 100%;
  overflow: hidden;
}

html.mp-tabbar-visible .page {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding-bottom: calc(var(--mp-bottom-area-height) + var(--mp-tabbar-height));
  box-sizing: border-box;
}

html.mp-tabbar-visible .main-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

html.mp-tabbar-visible .bottom-spacer {
  display: none;
}

html.mp-tabbar-visible .bottom-area {
  position: fixed !important;
  bottom: var(--mp-tabbar-height) !important;
  left: 0 !important;
  right: 0;
  width: 100%;
  z-index: 20;
  padding: 0.16rem 0.427rem 0.16rem;
  background: #f5f7fb;
  border-top: 0.013rem solid #eef0f5;
}

html.mp-tabbar-visible .model-chips {
  padding: 0.16rem 0 0.24rem;
}

.mp-tabbar {
  display: none;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  align-items: stretch;
}

html.mp-tabbar-visible .mp-tabbar {
  display: flex !important;
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0;
  z-index: 30;
  min-height: var(--mp-tabbar-height);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -0.013rem 0 rgba(0, 0, 0, 0.06);
}

.mp-tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 1.333rem;
  min-width: 0;
  padding: 0;
  cursor: pointer;
}

.mp-tabbar-item.active {
  cursor: default;
}

.mp-tabbar-icon-wrap {
  width: 0.6rem;
  height: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mp-tabbar-icon {
  display: block;
  width: 0.587rem !important;
  height: 0.587rem !important;
  max-width: 0.587rem !important;
  max-height: 0.587rem !important;
  object-fit: contain;
  flex-shrink: 0;
}

.mp-tabbar-label {
  margin-top: 0.16rem;
  font-size: 0.32rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  color: #0D160E;
}
