/* ============================================================
   SwimX — 组件样式（卡片 / 按钮 / 留言板 / 弹窗 / 更新条）
   ============================================================ */

/* ---- 更新公告条 ---- */
.update-bar {
  position: relative; z-index: 99;
  background: linear-gradient(135deg,#E8F5E9,#C8E6C9);
  border-bottom: 1px solid #A5D6A7; padding: 10px 24px;
  display: flex; align-items: center; gap: 12px; font-size: 14px;
  animation: slideDown .3s ease;
}
.update-bar-icon { font-size: 18px; flex-shrink: 0; }
.update-bar-msg {
  flex: 1; font-weight: 600; color: #2E7D32;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.update-bar-date { font-size: 11px; color: #888; flex-shrink: 0; }
.update-bar-btn {
  padding: 4px 12px; border-radius: 12px; border: 1.5px solid #A5D6A7;
  background: #fff; color: #2E7D32; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all .2s; flex-shrink: 0;
}
.update-bar-btn:hover { background: #E8F5E9; }
.update-bar-close {
  font-size: 18px; cursor: pointer; color: #999; flex-shrink: 0;
  background: none; border: none; padding: 0 4px; line-height: 1;
}
.update-bar-close:hover { color: #E74C3C; }

/* 更新铃铛 */
.update-bell {
  position: fixed; bottom: 100px; right: 20px; z-index: 200;
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; cursor: pointer; transition: all .2s;
}
.update-bell:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(0,0,0,.2); }

/* 更新历史 */
.update-history {
  display: none; position: relative; z-index: 98; background: #fff;
  border-bottom: 1px solid var(--border); padding: 12px 24px;
  animation: slideDown .2s ease;
}
.update-history.show { display: block; }
.update-history-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 6px 0;
  font-size: 13px; color: var(--ts); border-bottom: 1px solid #f5f5f5;
}
.update-history-item:last-child { border-bottom: none; }
.update-history-date { font-size: 11px; color: #aaa; flex-shrink: 0; min-width: 72px; }
.update-history-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--p);
  flex-shrink: 0; margin-top: 6px;
}

/* 返回顶部 */
.back-to-top {
  position: fixed; bottom: 40px; right: 20px; z-index: 200;
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer; transition: all .2s;
  opacity: 0; pointer-events: none; border: none;
}
.back-to-top.show { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-3px); box-shadow: 0 6px 24px rgba(0,0,0,.2); }

/* ---- 个人卡片 ---- */
.me-card {
  margin: 32px 0 24px; padding: 36px 40px;
  background: linear-gradient(105deg,#F4FDF8 0%,#FFFFFF 40%,#FFFFFF 100%);
  border-radius: var(--rl); display: flex; align-items: center; gap: 32px;
}
.me-avatar { flex-shrink: 0; animation: float 3s ease-in-out infinite; }
.me-avatar img {
  width: 100px; height: 100px; border-radius: 50%;
  object-fit: cover; box-shadow: 0 8px 30px rgba(82,183,136,.25);
}
.me-info h1 { font-size: 30px; font-weight: 900; margin-bottom: 6px; letter-spacing: 1px; }
.me-info h1 em { font-style: normal; color: var(--p); }
.me-info .role { font-size: 15px; color: var(--ts); font-weight: 500; }

/* ---- Hero 教学卡片 ---- */
.teach-hero {
  background: var(--card); border-radius: var(--rl); box-shadow: var(--shm);
  border: 1.5px solid var(--p); overflow: hidden; display: flex; flex-wrap: wrap;
}
.teach-hero .th-cover {
  flex: 0 0 260px; background: linear-gradient(135deg,var(--p),var(--pd));
  display: flex; align-items: center; justify-content: center; font-size: 60px;
  position: relative; cursor: pointer; min-height: 200px; transition: all .3s;
}
.teach-hero .th-cover:hover { filter: brightness(1.1); }
.teach-hero .th-cover::after {
  content: "点击开始"; position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,.25); color: #fff; padding: 4px 14px; border-radius: 12px;
  font-size: 12px; font-weight: 700; opacity: 0; transition: opacity .3s;
}
.teach-hero .th-cover:hover::after { opacity: 1; }
.teach-hero .th-body { flex: 1; padding: 22px 26px; min-width: 280px; }
.teach-hero .th-body h3 { font-size: 18px; margin-bottom: 8px; color: var(--pd); }
.teach-hero .th-body p { font-size: 13px; color: var(--ts); line-height: 1.7; margin-bottom: 12px; }
.teach-hero .th-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.teach-hero .th-tags span {
  font-size: 11px; padding: 3px 10px; border-radius: 14px; font-weight: 600;
  background: var(--pghost); color: var(--pd);
}
.teach-hero .th-btn {
  display: inline-block; padding: 10px 28px; background: var(--p); color: #fff;
  border-radius: 12px; font-weight: 700; font-size: 14px; transition: all .2s;
}
.teach-hero .th-btn:hover { background: var(--pd); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(82,183,136,.35); }

/* ---- 紧凑双卡片 ---- */
.compact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 0; }
.compact-card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--sh);
  border: 1.5px solid var(--border); padding: 20px 24px; cursor: pointer;
  transition: all .25s; display: flex; align-items: center; gap: 16px;
  text-decoration: none; color: inherit;
}
.compact-card:hover { transform: translateY(-3px); box-shadow: var(--shm); }
.compact-card .cc-icon { font-size: 40px; flex-shrink: 0; }
.compact-card .cc-body h4 { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.compact-card .cc-body p { font-size: 12px; color: var(--ts); line-height: 1.5; }
.compact-card.zk { border-color: #FFD5B8; }
.compact-card.zk:hover { border-color: #F97316; background: #FFFDF9; }
.compact-card.jx { border-color: #C8DFF8; }
.compact-card.jx:hover { border-color: #4EA8DE; background: #F9FBFF; }
.compact-card.tz { border-color: #B8E6D0; }
.compact-card.tz:hover { border-color: #52B788; background: #F4FDF8; }

/* ---- 小游戏网格 ---- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 14px; }
.game-card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--sh);
  border: 1.5px solid var(--border); padding: 22px 18px; cursor: pointer;
  transition: all .25s; text-align: center; position: relative; overflow: hidden;
}
.game-card:hover { transform: translateY(-4px); box-shadow: var(--shl); border-color: var(--p); }
.game-card .gc-icon { font-size: 44px; margin-bottom: 10px; transition: transform .3s; }
.game-card:hover .gc-icon { transform: scale(1.15); animation: pulse .6s ease-in-out; }
.game-card .gc-name { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.game-card .gc-desc { font-size: 12px; color: var(--ts); margin-bottom: 10px; }
.game-card .gc-tag {
  display: inline-block; font-size: 10px; padding: 2px 10px; border-radius: 10px;
  font-weight: 700; background: var(--al); color: var(--ad);
}

/* ---- 游戏浮层 ---- */
.game-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 200; background: #fff; display: none; animation: fadeIn .25s ease-out;
}
.game-overlay.active { display: block; }
.game-overlay iframe { width: 100%; height: 100%; border: none; display: block; }
.game-close-btn {
  position: fixed; top: 12px; right: 12px; z-index: 99999;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,0,0,0.5); color: #fff; border: none;
  font-size: 20px; cursor: pointer; display: none;
  align-items: center; justify-content: center;
  transition: all 0.2s; backdrop-filter: blur(4px);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.game-overlay.active .game-close-btn { display: flex; }
.game-close-btn:hover { background: rgba(255,75,75,0.8); transform: scale(1.1); }

/* ---- 下载弹窗 ---- */
.download-modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 300;
  background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease-out;
}
.download-modal {
  background: #fff; border-radius: var(--rl); padding: 32px 28px 24px;
  max-width: 400px; width: 90%; text-align: center; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.2); animation: popIn .3s ease-out;
}
.download-modal-close {
  position: absolute; top: 12px; right: 14px; background: none; border: none;
  font-size: 20px; color: #999; cursor: pointer; padding: 4px 8px; line-height: 1;
}
.download-modal-close:hover { color: #E74C3C; }
.download-modal-icon { font-size: 56px; margin-bottom: 8px; }
.download-modal-title { font-size: 20px; font-weight: 800; margin-bottom: 20px; color: var(--t); }
.download-modal-steps { text-align: left; margin-bottom: 16px; }
.dl-step { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; color: var(--ts); }
.dl-step-num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--p); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; flex-shrink: 0;
}
.dl-step code {
  background: var(--pbg); color: var(--pd); padding: 2px 8px; border-radius: 4px;
  font-size: 13px; font-weight: 700;
}
.download-modal-note { font-size: 12px; color: var(--ad); background: var(--al); padding: 8px 14px; border-radius: 10px; margin-bottom: 18px; }
.download-modal-btn {
  width: 100%; padding: 14px; background: var(--p); color: #fff; border: none;
  border-radius: 12px; font-size: 16px; font-weight: 800; cursor: pointer; transition: all .2s;
}
.download-modal-btn:hover { background: var(--pd); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(82,183,136,.35); }

/* ---- 留言板 ---- */
.msg-section { margin-top: 36px; }
.msg-form-card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--sh);
  border: 1.5px solid var(--border); padding: 20px; margin-bottom: 16px;
}
.msg-form-row { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; }
.msg-nick-input {
  flex: 0 0 160px; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px; outline: none; transition: border .2s; background: #fff;
}
.msg-nick-input:focus { border-color: var(--p); }
.msg-textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; resize: vertical; min-height: 80px; outline: none; transition: border .2s;
  font-family: inherit; background: #fff;
}
.msg-textarea:focus { border-color: var(--p); }
.msg-submit-row { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.msg-submit-btn {
  padding: 10px 28px; background: var(--p); color: #fff; border: none; border-radius: 12px;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: all .2s;
}
.msg-submit-btn:hover { background: var(--pd); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(82,183,136,.35); }
.msg-submit-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.msg-char-count { font-size: 12px; color: var(--tl); }
.msg-list { display: flex; flex-direction: column; gap: 12px; }
.msg-card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--sh);
  border: 1.5px solid var(--border); padding: 18px 20px; display: flex; gap: 14px;
}
.msg-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
}
.msg-body { flex: 1; min-width: 0; }
.msg-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.msg-nickname { font-weight: 700; font-size: 14px; }
.msg-time { font-size: 11px; color: var(--tl); }
.msg-content { font-size: 14px; line-height: 1.6; color: var(--t); word-break: break-word; }
.msg-actions { display: flex; gap: 16px; margin-top: 10px; align-items: center; }
.msg-action-btn {
  background: none; border: none; font-size: 12px; color: var(--ts); cursor: pointer;
  padding: 4px 8px; border-radius: 6px; transition: all .2s; display: flex; align-items: center; gap: 4px;
}
.msg-action-btn:hover { background: #f0f0f0; }
.msg-action-btn.liked { color: #EF4444; }
.msg-action-btn .count { font-weight: 700; }

.teacher-reply {
  margin-top: 10px; padding: 12px 14px;
  background: linear-gradient(135deg,#f0fdf4,#dcfce7);
  border-radius: 10px; border-left: 3px solid var(--p);
}
.teacher-reply .reply-badge { font-size: 11px; font-weight: 700; color: var(--pd); margin-bottom: 4px; display: block; }
.teacher-reply .reply-content { font-size: 13px; color: var(--t); line-height: 1.5; }
.teacher-reply .reply-time { font-size: 10px; color: var(--tl); margin-top: 4px; }

.admin-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.admin-toggle { font-size: 12px; padding: 6px 14px; border-radius: 8px; border: 1.5px solid var(--border); background: #fff; cursor: pointer; color: var(--ts); transition: all .2s; }
.admin-toggle:hover { border-color: var(--p); color: var(--p); }
.admin-toggle.active { background: var(--p); color: #fff; border-color: var(--p); }
.admin-reply-form { display: flex; gap: 8px; margin-top: 8px; }
.admin-reply-input { flex: 1; padding: 8px 12px; border: 1.5px solid var(--p); border-radius: 8px; font-size: 13px; outline: none; font-family: inherit; }
.admin-reply-submit { padding: 8px 16px; background: var(--p); color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; }
.msg-delete-btn { background: none; border: none; color: #EF4444; font-size: 11px; cursor: pointer; padding: 2px 6px; opacity: .6; transition: opacity .2s; }
.msg-delete-btn:hover { opacity: 1; }

.load-more-wrap { text-align: center; margin-top: 16px; }
.load-more-btn { padding: 10px 32px; background: #fff; border: 1.5px solid var(--border); border-radius: 12px; font-size: 14px; color: var(--ts); cursor: pointer; transition: all .2s; }
.load-more-btn:hover { border-color: var(--p); color: var(--p); }
.load-more-btn:disabled { opacity: .4; cursor: not-allowed; }
.msg-empty { text-align: center; padding: 40px 20px; color: var(--tl); }
.msg-empty .icon { font-size: 48px; margin-bottom: 12px; }
.msg-loading { text-align: center; padding: 30px; color: var(--tl); }
