/* ===========================================================================
   魔仙堡学院 · 全站样式（第 8 课 / M2）
   配色取自立项材料：蓝 #5BC8F5 / 粉 #FF9ED2 / 深蓝 #2C5F8A
                     浅蓝 #E6F7FF / 浅粉 #FFF0F7
   全部为本地 CSS，无任何外链资源。
   第 8 课在 M1 基础上追加：好友页 / 私聊页 / 打卡 / 时间轴的样式（见文件末尾）。
   =========================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #2C5F8A;
  min-height: 100vh;
}

/* ---------- 登录/注册页（page-gate） ---------- */

/* 浅蓝 → 浅粉渐变背景（按立项材料首屏要求） */
.page-gate {
  background: linear-gradient(180deg, #E6F7FF 0%, #FFF0F7 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 首屏天空区：漂浮的星星和爱心 + emoji 城堡占位 */
.sky {
  position: relative;
  width: 100%;
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 星星/爱心上下漂浮动画（每个元素延迟不同，营造错落感） */
.float-item {
  position: absolute;
  font-size: 22px;
  animation: floaty 3s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-14px); }
}

.castle { font-size: 72px; line-height: 1; filter: drop-shadow(0 4px 0 rgba(44,95,138,.18)); }

.site-title { font-size: 40px; font-weight: 800; margin-top: 8px; }
.site-slogan { color: #6b7f95; margin-top: 6px; }

/* 登录/注册卡片：白底 + 白描边卡片圆角风格 */
.gate-card {
  background: #fff;
  border: 3px solid #fff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(91, 200, 245, .25);
  width: min(360px, 92vw);
  padding: 20px;
  margin: 8px 0 24px;
}

/* 两个页签（登录 / 注册） */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  flex: 1;
  padding: 10px 0;
  border: 2px solid #E6F7FF;
  background: #fff;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #9db4c8;
  cursor: pointer;
}
.tab.active { background: #E6F7FF; color: #2C5F8A; border-color: #5BC8F5; }

/* 表单 */
.panel label { display: block; font-size: 14px; color: #6b7f95; margin-bottom: 12px; }
.panel input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 2px solid #E6F7FF;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
}
.panel input:focus { border-color: #5BC8F5; }

/* 主按钮：粉色圆角（按立项材料） */
.btn-primary {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-radius: 999px;
  background: #FF9ED2;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(255, 158, 210, .5); }

/* 服务器提示语 */
.message { min-height: 22px; margin-top: 12px; text-align: center; font-size: 14px; }
.message.ok  { color: #2fa36b; }
.message.err { color: #f26d9d; }

/* ---------- 主页占位页（page-home） ---------- */

.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, .9);
  border-bottom: 2px solid #FF9ED2;   /* 顶部粉色细线（按立项材料） */
}
.logo { font-weight: 800; font-size: 18px; }
.whoami { margin-left: auto; color: #6b7f95; font-size: 14px; }

.btn-ghost {
  border: 2px solid #E6F7FF;
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  color: #6b7f95;
  cursor: pointer;
}
.btn-ghost:hover { border-color: #5BC8F5; color: #2C5F8A; }

.page-home { background: linear-gradient(180deg, #E6F7FF 0%, #FFF0F7 100%); }

.welcome { text-align: center; padding: 48px 16px 24px; }
.welcome h1 { font-size: 30px; }
.welcome p { color: #6b7f95; margin-top: 8px; }

/* 三张占位卡片：桌面横排，窄屏自动换行 */
.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  max-width: 960px;
  margin: 16px auto 40px;
  padding: 0 16px;
}
.card {
  background: #fff;
  border: 3px solid #fff;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(91, 200, 245, .2);
  padding: 20px;
  text-align: center;
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-5px) scale(1.03); box-shadow: 0 12px 26px rgba(255, 158, 210, .35); }
/* 点亮的卡片（第 8 课起）：整张卡是链接，配色更亮眼一点 */
a.card { text-decoration: none; color: inherit; display: block; }
.card.unlocked { border-color: #5BC8F5; cursor: pointer; }
.card.unlocked .lock-tag { color: #2C5F8A; background: #E6F7FF; }
.card-icon { font-size: 40px; }
.card h2 { font-size: 18px; margin: 8px 0; }
.card p { font-size: 13px; color: #6b7f95; min-height: 40px; }
.lock-tag {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  color: #9db4c8;
  background: #F3F8FC;
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------- 页脚 ---------- */
.footer {
  margin-top: auto;
  padding: 16px;
  text-align: center;
  color: #fff;
  background: #2C5F8A;   /* 深蓝页脚（按立项材料） */
  font-size: 13px;
}

/* ---------- 好友模块（第 8 课 / M2 追加） ---------- */

/* 内容容器：好友页和私聊页共用的窄栏卡片堆 */
.friend-wrap {
  max-width: 640px;
  margin: 16px auto 40px;
  padding: 0 16px;
  display: grid;
  gap: 16px;
}
.panel-card {
  background: #fff;
  border: 3px solid #fff;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(91, 200, 245, .2);
  padding: 16px 20px;
}
.panel-card h2 { font-size: 16px; margin-bottom: 12px; }

/* 灰色小字提示 */
.muted { color: #9db4c8; font-size: 13px; }

/* 一行里的按钮（打卡/搜索/发送）：不占满整行 */
.btn-inline { width: auto; padding: 8px 18px; font-size: 14px; }
.btn-inline:disabled { background: #c9dde9; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-done { background: #9fd8b4; }   /* 打过卡后的绿色 */

/* 输入框 + 按钮的横排 */
.checkin-row, .search-row, .chat-row { display: flex; gap: 8px; align-items: center; }
.search-row input, .chat-row input {
  flex: 1;
  padding: 9px 12px;
  border: 2px solid #E6F7FF;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
.search-row input:focus, .chat-row input:focus { border-color: #5BC8F5; }

/* 好友/申请/搜索结果共用的"一行" */
.friend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px dashed #E6F7FF;
}
.friend-row:last-child { border-bottom: none; }
.friend-row.clickable { text-decoration: none; color: inherit; border-radius: 10px; }
.friend-row.clickable:hover { background: #F3F8FC; }
.row-avatar { font-size: 26px; line-height: 1; }
.row-name { color: #2C5F8A; font-size: 14px; font-weight: 600; }
.row-mid { flex: 1; min-width: 0; display: grid; gap: 5px; }

/* 熟悉度进度条：浅蓝底 + 粉色填充 */
.bar {
  height: 8px;
  background: #E6F7FF;
  border-radius: 999px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5BC8F5, #FF9ED2);
  border-radius: 999px;
  transition: width .4s;
}

/* 等级头衔小徽章 */
.badge {
  font-size: 12px;
  color: #2C5F8A;
  background: #FFF0F7;
  border: 1px solid #FF9ED2;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* 好友详情页资料条 */
.friend-head { display: flex; align-items: center; gap: 14px; }
.friend-head-info { flex: 1; display: grid; gap: 6px; }
.big-avatar { font-size: 44px; line-height: 1; }

/* 聊天区：固定高度小窗，消息多了自己滚 */
.chat-box {
  height: 260px;
  overflow-y: auto;
  background: #F3F8FC;
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
  margin-bottom: 10px;
}
.chat-tip { text-align: center; }
.msg { display: flex; align-items: flex-end; gap: 6px; }
.msg.mine   { justify-content: flex-end; }          /* 我说的话靠右 */
.msg.theirs { justify-content: flex-start; }        /* 对方的话靠左 */
.bubble {
  max-width: 70%;
  padding: 7px 12px;
  border-radius: 14px;
  font-size: 14px;
  word-break: break-word;   /* 长句子折行，不撑破气泡 */
}
.msg.mine .bubble   { background: #FF9ED2; color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs .bubble { background: #fff; color: #2C5F8A; border: 1px solid #E6F7FF; border-bottom-left-radius: 4px; }
.msg-time { font-size: 11px; color: #9db4c8; white-space: nowrap; }

/* 礼物按钮：三个一排 */
.gift-row { display: flex; gap: 10px; flex-wrap: wrap; }
.gift-btn {
  flex: 1;
  min-width: 120px;
  padding: 12px 0;
  border: 2px solid #FF9ED2;
  background: #FFF0F7;
  border-radius: 12px;
  font-size: 15px;
  color: #2C5F8A;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.gift-btn:hover { transform: translateY(-2px); background: #FFE3F1; }

/* 共同回忆时间轴 */
.memory-list { display: grid; gap: 8px; }
.memory-item {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: #2C5F8A;
  background: #F3F8FC;
  border-radius: 10px;
  padding: 8px 12px;
  align-items: baseline;
}
.memory-date { color: #9db4c8; font-size: 12px; white-space: nowrap; }

/* 提示横幅：固定在屏幕下方中间，飘一下 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  background: rgba(44, 95, 138, .92);
  color: #fff;
  font-size: 14px;
  padding: 10px 22px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(44, 95, 138, .4);
  z-index: 99;
}
.toast.levelup { background: #FF9ED2; font-weight: 700; }   /* 升级提示用粉色 */

/* 小工具类 */
.hidden { display: none; }

/* ---------- 对战模块（第 9 课 / M3 追加） ---------- */

/* 大厅"选好友 + 开房"横排：下拉框样式和搜索框同款 */
.create-row { display: flex; gap: 8px; align-items: center; }
.create-row select {
  flex: 1;
  padding: 9px 12px;
  border: 2px solid #E6F7FF;
  border-radius: 10px;
  font-size: 14px;
  color: #2C5F8A;
  background: #fff;
  outline: none;
}
.create-row select:focus { border-color: #5BC8F5; }

/* 题目卡：题干加粗，四个选项竖排大按钮 */
.q-text { font-size: 16px; font-weight: 600; margin: 4px 0 6px; }
.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  margin-top: 8px;
  border: 2px solid #E6F7FF;
  background: #F3F8FC;
  border-radius: 12px;
  font-size: 14px;
  color: #2C5F8A;
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.option-btn:hover { border-color: #5BC8F5; background: #E6F7FF; transform: translateY(-1px); }
.option-btn:disabled { cursor: default; opacity: .7; transform: none; }

/* 双方进度区：我在上、对方在下，各一行（头像 + 五个小格 + 得分） */
.vs-row { margin-top: 14px; display: grid; gap: 10px; }
.vs-player { display: flex; align-items: center; gap: 10px; }
.slots { display: flex; gap: 5px; margin-top: 4px; }
.slot {
  width: 24px;
  height: 9px;
  border-radius: 999px;
  background: #E6F7FF;                      /* 还没答：浅蓝 */
}
.slot.ok { background: #FF9ED2; }           /* 答对：粉色（和熟悉度进度条同款） */
.slot.no { background: #c9dde9; }           /* 答错：灰蓝 */
.score { font-size: 20px; font-weight: 800; color: #2C5F8A; min-width: 26px; text-align: right; }
.vs-tip { margin-left: 46px; }              /* 和头像缩进对齐 */

/* 结算区：比分大字居中 + 两行说明 */
.result-grid { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 12px 0 8px; }
.result-side { font-size: 42px; font-weight: 800; color: #2C5F8A; }
.result-vs { font-size: 24px; color: #9db4c8; }
.result-line { text-align: center; font-size: 14px; color: #2C5F8A; margin-top: 6px; }
