:root {
  --tab-bar-height: 0px;
  --mp-tabbar-height: calc(1.333rem + env(safe-area-inset-bottom, 0px));
  --mp-bottom-area-height: 2.4rem;
  --ink: #12211f;
  --muted: #5f736f;
  --line: rgba(18, 33, 31, 0.08);
  --surface: rgba(255, 255, 255, 0.78);
  --accent: #0f766e;
  --accent-deep: #0b3d3a;
  --accent-soft: #d9f3ef;
  --user-bubble: #0f766e;
  --page-bg: #eef6f4;
}

* {
  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: "DIN Alternate", "Avenir Next", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--page-bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.page {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--page-bg);
}

.aurora {
  position: absolute;
  inset: 0 0 auto 0;
  height: 9.2rem;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 55% at 12% 0%, rgba(45, 212, 191, 0.35), transparent 60%),
    radial-gradient(ellipse 55% 45% at 88% 8%, rgba(15, 118, 110, 0.28), transparent 55%),
    linear-gradient(180deg, #cfe8e3 0%, var(--page-bg) 88%);
  animation: aurora-drift 10s ease-in-out infinite alternate;
}

@keyframes aurora-drift {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.04) translateY(-0.12rem); }
}

.top-bar {
  position: relative;
  z-index: 10;
  padding: 0.32rem 0.427rem 0.213rem;
  animation: drop-in 0.45s ease-out;
}

@keyframes drop-in {
  from { opacity: 0; transform: translateY(-0.24rem); }
  to { opacity: 1; transform: translateY(0); }
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.267rem;
  margin-bottom: 0.32rem;
}

.brand-mark {
  width: 0.96rem;
  height: 0.96rem;
  object-fit: contain;
  filter: drop-shadow(0 0.08rem 0.16rem rgba(11, 61, 58, 0.18));
}

.brand-name {
  font-size: 0.453rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-deep);
  line-height: 1.2;
}

.brand-sub {
  margin-top: 0.053rem;
  font-size: 0.293rem;
  color: var(--muted);
}

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

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

.chip {
  display: flex;
  align-items: center;
  gap: 0.107rem;
  flex-shrink: 0;
  height: 0.747rem;
  padding: 0 0.293rem 0 0.187rem;
  background: rgba(255, 255, 255, 0.55);
  border: 0.013rem solid transparent;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.chip:active {
  transform: scale(0.96);
}

.chip.active {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.chip.active span {
  color: #fff;
}

.chip img {
  width: 0.427rem;
  height: 0.427rem;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
}

.chip span {
  font-size: 0.293rem;
  color: var(--ink);
  white-space: nowrap;
}

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

.welcome-panel {
  animation: rise-in 0.5s ease-out 0.05s both;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(0.32rem); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-kicker {
  display: inline-block;
  padding: 0.08rem 0.213rem;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  font-size: 0.267rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.welcome-title {
  margin-top: 0.267rem;
  font-size: 0.64rem;
  line-height: 1.25;
  font-weight: 700;
  color: var(--accent-deep);
}

.welcome-desc {
  margin-top: 0.16rem;
  font-size: 0.347rem;
  line-height: 1.5;
  color: var(--muted);
}

.suggest-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.48rem 0 0.267rem;
}

.suggest-toolbar .label {
  font-size: 0.347rem;
  font-weight: 600;
  color: var(--ink);
}

.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.293rem;
  color: var(--muted);
}

.suggest-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.213rem;
}

.suggest-item {
  display: flex;
  align-items: flex-start;
  gap: 0.16rem;
  min-height: 1.6rem;
  padding: 0.267rem;
  border-radius: 0.32rem;
  background: var(--surface);
  border: 0.013rem solid var(--line);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.suggest-item:active {
  transform: translateY(0.04rem) scale(0.98);
}

.suggest-item .icon {
  width: 0.4rem;
  height: 0.4rem;
  flex-shrink: 0;
  margin-top: 0.027rem;
  object-fit: contain;
}

.suggest-item .text {
  flex: 1;
  font-size: 0.32rem;
  line-height: 1.4;
  color: var(--ink);
}

.suggest-item .arrow {
  display: none;
}

.page.chatting .welcome-panel {
  display: none;
}

.chat-area {
  display: none;
  padding: 0.267rem 0 0.213rem;
}

.chat-area.visible {
  display: block;
  animation: rise-in 0.35s ease-out;
}

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

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

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

.msg-bubble {
  max-width: 82%;
  padding: 0.32rem 0.4rem;
  border-radius: 0.373rem;
  font-size: 0.373rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg.user .msg-bubble {
  background: linear-gradient(145deg, #12907f 0%, #0b5f58 100%);
  color: #fff;
  border-bottom-right-radius: 0.08rem;
  box-shadow: 0 0.08rem 0.267rem rgba(15, 118, 110, 0.25);
}

.msg.ai .msg-bubble {
  background: #fff;
  color: var(--ink);
  border: 0.013rem solid var(--line);
  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: #7a948f;
  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.16rem 0.427rem 0.267rem;
  padding-bottom: calc(0.267rem + env(safe-area-inset-bottom, 0));
  background: linear-gradient(to top, var(--page-bg) 62%, rgba(238, 246, 244, 0));
}

.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 rgba(15, 118, 110, 0.18);
  border-radius: 0.32rem;
  padding: 0 0.267rem;
  gap: 0.16rem;
  box-shadow: 0 0.107rem 0.427rem rgba(11, 61, 58, 0.08);
}

.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: var(--ink);
  min-width: 0;
}

.input-box input::placeholder {
  color: #93a8a4;
}

.send-btn {
  width: 1.173rem;
  height: 1.173rem;
  flex-shrink: 0;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  filter: hue-rotate(145deg) saturate(1.15);
  transition: transform 0.2s ease;
}

.send-btn:active {
  transform: scale(0.94);
}

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

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

.bottom-spacer {
  height: calc(2.8rem + 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: var(--page-bg);
  border-top: 0.013rem solid var(--line);
}

.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;
}
