/* 慢慢说 MVP - 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #b0556b;
  --primary-light: #F6D8D2;
  --primary-dark: #96504f;
  --warm: #8a6f5f;
  --warm-light: #F7E9C6;
  --accent: #43603c;
  --bg: #F5F1E7;
  --card-bg: #FFFFFF;
  --text: #5a4e42;
  --text-light: #a3958a;
  --border: #E5DCCE;
  --success: #27AE60;
  --danger: #C13A34;
  --shadow: 0 2px 8px rgba(120, 100, 70, 0.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #F5F1E7 url(/images/bg_paper.jpg) center top/cover no-repeat fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== 首页 ===== */
.home-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 20px;
  text-align: center;
}

.home-logo {
  font-size: 2.5em;
  margin-bottom: 10px;
}

.home-title {
  font-size: 1.8em;
  font-family: "KaiTi","STKaiti","楷体",sans-serif;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.home-subtitle {
  color: #6b4f35;
  margin-bottom: 36px;
  font-family: "KaiTi","STKaiti","楷体",sans-serif;
  letter-spacing: 2px;
  font-size: 1.05em;
}

.home-cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.home-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  border-color: var(--primary-light);
}

.home-card-icon {
  font-size: 2.5em;
  margin-bottom: 10px;
}

.home-card-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
  margin: -12px -12px 14px -12px;
  display: block;
}

.home-card {
  background: rgba(255,253,246,.94);
  border: 1.5px solid rgba(150,120,90,.42);
  border-radius: 16px;
  padding: 30px;
  padding-top: 42px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
  overflow: hidden;
  position: relative;
}

.home-card-title {
  font-size: 1.3em;
  margin-bottom: 6px;
  font-family: "KaiTi","STKaiti","楷体",sans-serif;
  color: #7a5c22;
}

.home-card-desc {
  color: var(--text-light);
  font-size: 0.95em;
}

/* ===== 通用页面 ===== */
.page-header {
  background: rgba(245,241,231,.88);
  backdrop-filter: blur(4px);
  color: #6b4f35;
  padding: 13px 20px 11px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 0.5px solid #D8D0C2;
}

.page-header h1 {
  font-family: "KaiTi","STKaiti","楷体",sans-serif;
  letter-spacing: 2px;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-header .back-btn {
  background: rgba(58, 58, 58, 0.08);
  border: none;
  color: #5a4e42;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85em;
  text-decoration: none;
}

/* ===== 老师端 ===== */
.teacher-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
}

.section-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.section-card h2 {
  font-size: 1.2em;
  margin-bottom: 16px;
  color: #5a4e42;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.95em;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1em;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  background: var(--text-light);
  cursor: not-allowed;
}

.btn-warm {
  background: #FFFFFF;
  color: #5a4e42;
  border: 1.5px solid #3A3A3A;
}

.btn-warm:hover {
  background: #F6D8D2;
}

.btn-block {
  display: block;
  width: 100%;
}

/* 任务状态 */
.task-status {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.status-item {
  flex: 1;
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg);
}

.status-item.done {
  background: #D5F5E3;
}

.status-item.waiting {
  background: #FCF3CF;
}

.status-item .status-icon {
  font-size: 1.5em;
}

.status-item .status-label {
  font-size: 0.85em;
  color: var(--text-light);
  margin-top: 4px;
}

.status-item .status-value {
  font-weight: 600;
  margin-top: 2px;
}

/* 学生链接 */
.student-links {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.link-card {
  flex: 1;
  padding: 16px;
  border-radius: 8px;
  background: var(--bg);
  text-align: center;
}

.link-card .student-name {
  font-weight: 600;
  margin-bottom: 8px;
}

.link-card .link-url {
  font-size: 0.8em;
  color: var(--primary);
  word-break: break-all;
  margin-bottom: 8px;
  padding: 8px;
  background: white;
  border-radius: 4px;
}

.copy-btn {
  background: var(--primary-light);
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
  color: #5a4e42;
}

.copy-btn:hover {
  background: var(--primary);
  color: white;
}

/* 汇总结果 */
.summary-content {
  line-height: 1.8;
  font-size: 0.95em;
}

.summary-content h2,
.summary-content h3 {
  color: #5a4e42;
  margin-top: 20px;
  margin-bottom: 10px;
}

.summary-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.9em;
}

.summary-content th,
.summary-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.summary-content th {
  background: #F6D8D2;
  color: #5a4e42;
  font-weight: 600;
}

.summary-content tr:nth-child(even) {
  background: #F8F9FA;
}

.summary-content strong {
  color: var(--text);
}

.summary-content hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 20px 0;
}

.summary-content ul,
.summary-content ol {
  padding-left: 20px;
  margin: 8px 0;
}

.summary-content li {
  margin-bottom: 4px;
}

/* ===== 学生端聊天 ===== */
.chat-container {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ===== 聊天页（微信式）===== */
.chat-header {
  background: rgba(245,241,231,.88);
  backdrop-filter: blur(4px);
  color: #4a4239;
  padding: 13px 20px 9px;
  text-align: center;
  flex-shrink: 0;
  border-bottom: 0.5px solid #DCDADB;
}

.chat-header h2 {
  font-size: 1.05em;
  font-weight: 600;
  font-family: "KaiTi","STKaiti","楷体",sans-serif;
  color: #4a4239;
}

.chat-header .stage-badge {
  display: inline-block;
  background: transparent;
  color: #a3958a;
  padding: 0;
  font-size: 0.75em;
  margin-top: 2px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 消息行：头像+气泡列（微信布局） */
.message {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 0.95em;
  line-height: 1.55;
}

.message.ai {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-avatar {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background: #D9D9D9;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
}

.user-avatar::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #B8B8B8;
}

.user-avatar::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7px;
  transform: translateX(-50%);
  width: 26px;
  height: 13px;
  border-radius: 13px 13px 0 0;
  background: #B8B8B8;
}

.msg-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 76%;
}

.message.user .msg-col {
  align-items: flex-end;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 10px;
  background: #FFFDF6;
  box-shadow: 0 1px 2px rgba(80, 70, 50, 0.08);
  position: relative;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message.ai .msg-bubble {
  border-top-left-radius: 3px;
}

.message.ai .msg-bubble::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 13px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 6px solid #FFFFFF;
}

.message.user .msg-bubble {
  background: #95EC69;
  color: #2d4a2d;
  border-top-right-radius: 3px;
}

.message.user .msg-bubble::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 13px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid #95EC69;
}

/* 阶段标签：微信时间戳式居中灰胶囊 */
.stage-tag-row {
  align-self: center;
  font-size: 0.74em;
  color: #a3958a;
  background: rgba(58, 58, 58, 0.05);
  padding: 3px 12px;
  border-radius: 10px;
  margin: 0;
}

.home-mascots {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin: 20px 0 6px;
}

.mascot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.mascot img {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.10);
}

.mascot span {
  font-size: 0.82em;
  color: var(--text-light, #888);
}

.home-logo-img {
  height: 110px;
  width: auto;
  margin: 0 auto 8px;
  display: block;
}

.mascot-choice {
  padding: 30px 18px 24px;
  text-align: center;
}

.mascot-choice h3 {
  margin-bottom: 18px;
  font-size: 1.15em;
}

.mascot-cards {
  display: flex;
  justify-content: center;
  gap: 22px;
}

.mascot-pick {
  background: rgba(255,253,246,.92);
  border: 1.5px solid rgba(150,120,90,.45);
  width: 130px;
  padding: 16px 10px;
  background: white;
  border: 2px solid var(--border, #e0e0e0);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.mascot-pick:active {
  transform: scale(0.96);
  border-color: var(--primary, #C08A8A);
}

.mascot-pick img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 8px;
}

.mascot-pick-name {
  font-weight: bold;
  font-family: "KaiTi","STKaiti","楷体",sans-serif;
  font-size: 1.05em;
  margin-bottom: 4px;
}

.mascot-pick-desc {
  font-size: 0.78em;
  color: var(--text-light, #888);
  line-height: 1.4;
}

/* 电脑端内嵌二维码（手机端隐藏，用按钮弹层） */
.inline-qr {
  display: none;
}

@media (min-width: 768px) {
  .inline-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px;
    margin: 10px 0;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
  }
  .inline-qr-box {
    background: white;
    padding: 8px;
  }
  .inline-qr-hint {
    margin-top: 8px;
    font-size: 0.85em;
    color: var(--text-light);
  }
}

/* 旧用户气泡/阶段标签样式已并入微信式消息体系 */

.chat-input-area {
  background: rgba(245,241,231,.94);
  backdrop-filter: blur(4px);
  padding: 8px 10px 10px;
  background: #F5F1E7;
  border-top: 0.5px solid #DCDADB;
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-undo-area {
  padding: 0 16px 8px;
  background: #F5F1E7;
  text-align: center;
  flex-shrink: 0;
}

.undo-btn {
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-light);
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s;
}

.undo-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.undo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 语音按钮（微信式：白底方圆角） */
.voice-btn {
  width: 42px;
  height: 42px;
  border: 1px solid #E0D6C8;
  border-radius: 8px;
  background: #FFFFFF;
  color: #5a4e42;
  font-size: 1.1em;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-btn:hover {
  background: #F6D8D2;
}

.voice-btn.recording {
  background: var(--danger);
  color: white;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* AI消息语音播放按钮 */
.voice-play-btn {
  display: inline-block;
  margin-top: 5px;
  padding: 3px 12px;
  font-size: 0.78em;
  color: #7a6a58;
  background: #FFFFFF;
  border: 1px solid #E0D6C8;
  border-radius: 12px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.voice-play-btn:hover {
  opacity: 1;
}

.voice-play-btn.playing {
  background: var(--primary);
  color: white;
  opacity: 1;
}

.chat-input {
  background: #FFFDF6;
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #E0D6C8;
  border-radius: 8px;
  font-size: 1em;
  font-family: inherit;
  resize: none;
  max-height: 100px;
  min-height: 42px;
  line-height: 1.4;
  background: #FFFFFF;
}

.chat-input:focus {
  outline: none;
  border-color: #C08A8A;
}

.send-btn {
  background: #95EC69;
  color: #2d4a2d;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.send-btn:hover {
  background: #7ED558;
}

.send-btn:disabled {
  background: #E0DCD4;
  color: #a3958a;
  cursor: not-allowed;
}

/* 成长卡展示 */
.growth-card-display {
  background: linear-gradient(135deg, #D5F5E3 0%, #A9DFBF 100%);
  border-radius: 16px;
  padding: 24px;
  margin: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.growth-card-display h3 {
  color: #5a4e42;
  margin-bottom: 16px;
}

.growth-card-display .card-content {
  text-align: left;
  white-space: pre-wrap;
  line-height: 1.8;
}

.chat-loading {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
}

.chat-loading .dots {
  display: inline-block;
  animation: dots 1.4s infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* 完成提示（微信系统条式） */
.chat-complete {
  text-align: center;
  padding: 10px 16px;
  background: rgba(58, 58, 58, 0.07);
  border-radius: 8px;
  margin: 12px;
  font-size: 0.85em;
  color: #7a6a58;
}

.chat-complete h3 {
  color: #1E8449;
  margin-bottom: 4px;
  font-size: 1em;
}

/* 任务列表 */
.task-list-item {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s;
  text-decoration: none;
  color: var(--text);
  display: block;
}

.task-list-item:hover {
  transform: translateX(4px);
}

.task-list-item .task-desc {
  font-weight: 600;
  margin-bottom: 4px;
}

.task-list-item .task-meta {
  font-size: 0.85em;
  color: var(--text-light);
  display: flex;
  justify-content: space-between;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
}

.status-waiting { background: #FCF3CF; color: #D4AC0D; }
.status-chatting { background: #F6D8D2; color: #A06058; }
.status-ready { background: #D5F5E3; color: #1E8449; }
.status-done { background: #D5F5E3; color: #1E8449; }

/* 响应式 */
@media (max-width: 500px) {
  .home-title { font-size: 1.4em; }
  .section-card { padding: 16px; }
  .student-links { flex-direction: column; }
  .message { max-width: 90%; font-size: 0.9em; }
}

/* 角落水彩装饰 */
.deco-corner { position: fixed; width: 88px; opacity: .8; pointer-events: none; z-index: 1; }
.deco-corner.dandelion { right: 6px; top: 10px; }
.deco-corner.hearts { left: 4px; bottom: 14px; }
.home-container { position: relative; z-index: 2; }
.home-logo-img { filter: drop-shadow(0 4px 10px rgba(120,90,55,.15)); }

/* ===== 首页·手改版卡（卡面图整卡） ===== */
.home-cards { display: flex; flex-direction: column; gap: 26px; }
.mini-card {
  position: relative; display: block; text-decoration: none;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 6px 18px rgba(120,90,55,.16);
}
.mini-card.coming { cursor: default; opacity: .9; }
.mini-card-bg { width: 100%; display: block; }
.mini-card-body {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 10px 16px 10px 84px; gap: 10px;
}
.mini-tag {
  background: rgba(255,253,246,.95); color: #5a4a38;
  font-family: "KaiTi","STKaiti","楷体",sans-serif; font-weight: 700;
  font-size: 17px; letter-spacing: 2px;
  padding: 5px 22px; border-radius: 999px;
  border: 1px solid rgba(150,120,90,.35);
}
.mini-chips { display: flex; gap: 10px; justify-content: center; }
.chip {
  background: rgba(255,253,246,.88); color: #6b5f52;
  font-family: "KaiTi","STKaiti","楷体",sans-serif;
  font-size: 13.5px; letter-spacing: 1px;
  padding: 4px 14px; border-radius: 999px;
}
.mini-note { font-size: 11.5px; color: #a3958a; letter-spacing: 1px; }
/* 顶部水彩晕染加重（照手改版） */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 300px 190px at 12% 6%, rgba(246,216,210,.55) 0%, rgba(246,216,210,0) 70%),
    radial-gradient(ellipse 260px 170px at 88% 4%, rgba(247,233,198,.5) 0%, rgba(247,233,198,0) 72%);
}
.home-container { position: relative; z-index: 2; }
