/* ===== 主小溪研学平台 - 移动端样式 ===== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* 竹子主题色 */
  --bamboo-dark: #2E7D32;
  --bamboo-main: #4CAF50;
  --bamboo-light: #81C784;
  --bamboo-pale: #C8E6C9;
  --bamboo-bg: #E8F5E9;
  --bamboo-cream: #F1F8E9;
  --bamboo-yellow: #CDDC39;
  --bamboo-warm: #F0F4C3;
  --white: #FFFFFF;
  --text-dark: #1B5E20;
  --text-body: #33691E;
  --text-light: #558B2F;
  --text-muted: #7CB342;
  --shadow-sm: 0 2px 8px rgba(46, 125, 50, 0.12);
  --shadow-md: 0 4px 16px rgba(46, 125, 50, 0.18);
  --shadow-lg: 0 8px 32px rgba(46, 125, 50, 0.22);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

body {
  position: relative;
  background: #E8F5E9;
}

/* ===== 背景层 ===== */
.bg-layer {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
}

.bg-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(
    180deg,
    rgba(200, 230, 201, 0.3) 0%,
    rgba(232, 245, 233, 0.5) 50%,
    rgba(241, 248, 233, 0.7) 100%
  );
  z-index: 1;
}

/* ===== 主容器 ===== */
.app-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== 顶部留白区域 ===== */
.status-bar {
  position: relative;
  height: 132px;
  flex-shrink: 0;
}

/* ===== 吉祥物（透明logo，放在留白区域左侧） ===== */
.mascot-float {
  position: absolute;
  bottom: -20px;
  left: 8px;
  width: 130px;
  height: 130px;
  z-index: 10;
  pointer-events: none;
}

.mascot-float img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ===== 欢迎气泡（在留白区域右侧，靠近logo） ===== */
.welcome-bubble {
  position: absolute;
  right: 16px;
  top: 40px;
  background: var(--white);
  border-radius: 18px;
  padding: 10px 18px;
  box-shadow: var(--shadow-md);
  max-width: 200px;
  z-index: 20;
}

.welcome-bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 10px solid var(--white);
}

.welcome-bubble p {
  font-size: 14px;
  color: var(--text-dark);
  font-weight: 500;
  line-height: 1.5;
}

/* ===== 主内容卡片 ===== */
.main-card {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--radius-lg)  var(--radius-lg) var(--radius-lg) var(--radius-lg);
  box-shadow: 0 -4px 24px rgba(46, 125, 50, 0.1);
  padding: 16px 16px 12px;
  overflow: hidden;
  min-height: 0;
}

/* ===== 功能网格 ===== */
.function-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 4px;
  flex-shrink: 0;
}

.func-card {
  position: relative;
  background: linear-gradient(135deg, var(--bamboo-cream) 0%, var(--bamboo-pale) 100%);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  border: 1px solid rgba(129, 199, 132, 0.3);
}

.func-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-sm);
}

.func-card:nth-child(1) {
  background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
}

.func-card:nth-child(2) {
  background: linear-gradient(135deg, #F1F8E9 0%, #DCEDC8 100%);
}

.func-card:nth-child(3) {
  background: linear-gradient(135deg, #E8F5E9 0%, #A5D6A7 100%);
}

.func-card:nth-child(4) {
  background: linear-gradient(135deg, #F1F8E9 0%, #C5E1A5 100%);
}

/* ===== 随机风景图 ===== */
.random-landscape {
  width: 100%;
  height: 80px;
  margin-top: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
}

.random-landscape img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.func-card-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 43px;
  height: 43px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(46, 125, 50, 0.15);
}

.func-card-icon svg {
  width: 23px;
  height: 23px;
}

.func-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
  padding-right: 50px;
}

.func-card-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-right: 50px;
}

.func-card-sub span {
  font-size: 11px;
  color: var(--text-light);
  background: rgba(255, 255, 255, 0.6);
  padding: 2px 8px;
  border-radius: 10px;
  line-height: 1.6;
  white-space: nowrap;
}

/* ===== 猜你想问（紧贴聊天框上方，两行错位） ===== */
.ask-section {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 20px 0;
  background: var(--white);
  overflow: hidden;
  border-top-left-radius: 25px;
  border-top-right-radius: 25px;
}

.ask-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.ask-header svg {
  width: 20px;
  height: 20px;
}

.ask-header span {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.ask-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 0;
  overflow: hidden;
  max-height: 76px;
  mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

.ask-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--text-body);
  background: var(--bamboo-bg);
  border: 1px solid var(--bamboo-pale);
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
  white-space: nowrap;
  margin-right: 8px;
}

/* 偶数项错位右移 */
.ask-tag:nth-child(even) {
  margin-left: 28px;
}

.ask-tag:active {
  background: var(--bamboo-light);
  color: var(--white);
  border-color: var(--bamboo-light);
  transform: scale(0.96);
}

/* ===== 底部聊天输入框 ===== */
.chat-input-area {
  flex-shrink: 0;
  padding: 8px 16px 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--white);
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bamboo-bg);
  border-radius: var(--radius-xl);
  padding: 6px 6px 6px 18px;
  border: 1.5px solid var(--bamboo-pale);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input-wrapper:focus-within {
  border-color: var(--bamboo-main);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-dark);
  outline: none;
  padding: 8px 0;
  min-width: 0;
}

.chat-input::placeholder {
  color: var(--text-muted);
  font-size: 14px;
}

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--bamboo-main) 0%, var(--bamboo-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

.send-btn:active {
  transform: scale(0.92);
  box-shadow: 0 1px 4px rgba(46, 125, 50, 0.3);
}

.send-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--white);
  margin-left: 2px;
}

/* ===== 动画 ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hero-section {
  animation: fadeIn 0.5s ease-out;
}

.func-card {
  animation: fadeInUp 0.5s ease-out backwards;
}

.func-card:nth-child(1) { animation-delay: 0.1s; }
.func-card:nth-child(2) { animation-delay: 0.2s; }
.func-card:nth-child(3) { animation-delay: 0.3s; }
.func-card:nth-child(4) { animation-delay: 0.4s; }

/* ===== 聊天气泡弹出 ===== */
.chat-bubble-pop {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-width: 300px;
  text-align: center;
  animation: bubblePop 0.3s ease-out;
  border: 1px solid var(--bamboo-pale);
}

.chat-bubble-pop p {
  font-size: 14px;
  color: var(--text-dark);
  line-height: 1.5;
}

@keyframes bubblePop {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

/* ===== 滚动条美化 ===== */
.ask-tags::-webkit-scrollbar {
  width: 3px;
}

.ask-tags::-webkit-scrollbar-track {
  background: transparent;
}

.ask-tags::-webkit-scrollbar-thumb {
  background: var(--bamboo-pale);
  border-radius: 3px;
}
