/* ============================================================
   星核 · 玩家端基础样式（白底 + 粉色）
   ============================================================ */

:root {
  /* 主色：粉 */
  --pink: #ff4d94;
  --pink-strong: #f0307f;
  --pink-soft: #ffe4ef;
  --pink-softer: #fff2f7;
  --pink-line: #ffd0e2;
  --on-pink: #ffffff;

  /* 中性 */
  --bg: #ffffff;
  --bg-page: #fff8fb;
  --surface: #ffffff;
  --surface-2: #fbf7f9;
  --surface-3: #f4eef1;
  --line: #f0e6ea;
  --line-strong: #e6d9df;

  --text: #1b1418;
  --text-2: #6c5c64;
  --text-3: #9c8c94;

  --blue: #3b82f6;
  --blue-soft: #e8f0ff;
  --green: #22b573;
  --red: #e5484d;
  --red-soft: #ffecec;
  --amber: #f59e0b;

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-full: 999px;

  --shadow-1: 0 1px 2px rgba(27, 20, 24, .05);
  --shadow-2: 0 4px 16px rgba(27, 20, 24, .08);
  --shadow-3: 0 12px 40px rgba(27, 20, 24, .14);
  --shadow-pink: 0 6px 18px rgba(255, 77, 148, .28);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --tabbar-h: 62px;

  /* 这两个以前只在 chat.css 里当兜底，提到这里才能被夜间模式覆盖 */
  --bg-2: #f1f1f4;
  --line-2: #d8d8e0;
  /* 底部导航背景（夜间不能还是白的） */
  --tabbar-bg: rgba(255, 255, 255, .96);
  /* 「我的」页图标：浅底 + 深灰描边（参考图那种克制的圆底线性图标） */
  --icon-bg: #f5f1f3;
  --icon-fg: #4c4550;
  --icon-bg-hover: #efe8ec;
  /* 连续圆角（超椭圆/squircle）：不是正圆，也不是直角，四角平滑过渡 */
  --squircle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M50 0C88 0 100 12 100 50C100 88 88 100 50 100C12 100 0 88 0 50C0 12 12 0 50 0Z' fill='%23000'/%3E%3C/svg%3E");
}

/* ============ 夜间模式：黑底 + 粉色强调 ============ */
html[data-theme="dark"] {
  --pink: #ff4d94;
  --pink-strong: #ff6ba6;
  --pink-soft: rgba(255, 77, 148, .18);
  --pink-softer: rgba(255, 77, 148, .1);
  --pink-line: rgba(255, 77, 148, .34);

  --bg: #0e0c10;
  --bg-page: #0a090c;
  --surface: #18151c;
  --surface-2: #1e1a23;
  --surface-3: #26212c;
  --line: #2b2632;
  --line-strong: #3b3543;
  --bg-2: #26212c;
  --line-2: #3b3543;
  --tabbar-bg: rgba(22, 19, 26, .96);
  --icon-bg: rgba(255, 255, 255, .07);
  --icon-fg: #ded6e2;
  --icon-bg-hover: rgba(255, 255, 255, .12);

  --text: #f4f0f6;
  --text-2: #b3a8ba;
  --text-3: #80768a;

  --blue: #6ba3ff;
  --blue-soft: rgba(59, 130, 246, .2);
  --green: #3ecf8e;
  --red: #ff6b70;
  --red-soft: rgba(229, 72, 77, .18);
  --amber: #f5b544;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .5);
  --shadow-3: 0 12px 40px rgba(0, 0, 0, .6);
  --shadow-pink: 0 6px 18px rgba(255, 77, 148, .32);

  color-scheme: dark;
}


* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--pink); text-decoration: none; }
.link-pink { color: var(--pink); font-weight: 600; cursor: pointer; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  border: none; border-radius: var(--radius-full);
  background: var(--surface-3); color: var(--text);
  cursor: pointer; font-weight: 600;
  transition: background .18s var(--ease), transform .12s var(--ease), box-shadow .18s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--line-strong); }
.btn:active { transform: scale(.97); }
.btn.filled { background: var(--pink); color: var(--on-pink); }
.btn.filled:hover { box-shadow: var(--shadow-pink); background: var(--pink-strong); }
.btn.tonal { background: var(--pink-soft); color: var(--pink-strong); }
.btn.tonal:hover { background: var(--pink-line); }
.btn.ghost { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--pink-softer); color: var(--pink-strong); border-color: var(--pink-line); }
.btn.text { background: transparent; color: var(--pink); padding: 0 12px; }
.btn.text:hover { background: var(--pink-softer); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.small { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.input, .textarea, .select {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  outline: none;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--pink); background: var(--bg); }
.textarea { resize: vertical; line-height: 1.6; min-height: 92px; }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 38px;
}
.code-row { display: flex; gap: 10px; }
.code-row .input { flex: 1; }
.code-row .btn { flex: none; height: 50px; }

/* 勾选行（协议） */
.check-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; user-select: none; }
.check-row input {
  appearance: none; width: 20px; height: 20px; flex: none; margin: 0;
  border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--bg);
  cursor: pointer; position: relative; transition: all .16s var(--ease);
}
.check-row input:checked { background: var(--pink); border-color: var(--pink); }
.check-row input:checked::after {
  content: ''; position: absolute; left: 6px; top: 2px;
  width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.check-row span { font-size: 13px; color: var(--text-2); line-height: 1.5; }

/* 分段（性别 / 登录方式） */
.seg-group { display: flex; gap: 10px; }
.seg-btn {
  flex: 1; height: 46px; border: 1.5px solid var(--line); background: var(--bg);
  border-radius: var(--radius-md); color: var(--text-2); font-weight: 600; cursor: pointer;
  transition: all .16s var(--ease);
}
.seg-btn.active { border-color: var(--pink); background: var(--pink-softer); color: var(--pink-strong); }
.seg-btn:hover { border-color: var(--pink-line); }

/* ---------- 卡片 / 标签 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.chip {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px;
  border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-2); font-size: 12px;
}
.chip.pink { background: var(--pink-soft); color: var(--pink-strong); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.muted { color: var(--text-2); }
.tiny { font-size: 12px; }
.hidden { display: none !important; }

/* 性别徽标 */
.gender-badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px;
  border-radius: var(--radius-full); font-size: 12px; font-weight: 600; color: #fff;
}
.gender-badge.male { background: var(--blue); }
.gender-badge.female { background: var(--pink); }

/* ---------- 头像 ---------- */
.avatar-circle {
  width: 44px; height: 44px; border-radius: var(--radius-full); flex: none;
  background: linear-gradient(135deg, #ff8ab8, var(--pink));
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 18px;
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Toast ---------- */
#toast-wrap {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 9999; pointer-events: none;
}
.toast {
  background: rgba(27, 20, 24, .9); color: #fff; padding: 11px 18px;
  border-radius: var(--radius-full); box-shadow: var(--shadow-3);
  animation: toast-in .22s var(--ease); max-width: 80vw; font-size: 14px;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--pink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- 居中弹窗（管理端与玩家端共用） ---------- */
.dialog-mask {
  position: fixed;
  inset: 0;
  background: rgba(27, 20, 24, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9000;
  animation: fade .18s var(--ease);
}
.dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  box-shadow: var(--shadow-3);
  animation: dialog-in .24s var(--ease);
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(20px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog h3 { margin: 0 0 6px; font-size: 19px; font-weight: 700; }
.dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- 邀请好友 ---------- */
.invite-card { background: var(--surface-2); border-radius: var(--radius-lg); padding: 16px; }
.invite-label { font-size: 12.5px; color: var(--text-3); }
.invite-code-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.invite-code {
  flex: 1; font-size: 26px; font-weight: 800; letter-spacing: 3px;
  font-variant-numeric: tabular-nums; word-break: break-all;
}
.invite-code-row .btn { flex: none; height: 40px; padding: 0 18px; }
.invite-rules { font-size: 12.5px; color: var(--text-2); line-height: 1.8; }
.invite-rules b { color: var(--pink-strong); }
.invite-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.invite-stat {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.invite-stat b { font-size: 22px; font-weight: 800; }
.invite-stat span { font-size: 12.5px; color: var(--text-3); }

/* ---------- 居中提示弹窗（星核不足 / 账号被封） ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(27, 20, 24, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 9500;
  animation: fade .2s var(--ease);
}
.modal-card {
  background: var(--bg); border-radius: var(--radius-xl); padding: 26px 24px 20px;
  width: min(340px, 100%); text-align: center;
  box-shadow: var(--shadow-3); animation: dialog-in .24s var(--ease);
}
.modal-emoji { font-size: 30px; line-height: 1; display: flex; justify-content: center; color: var(--pink); }
.modal-emoji svg { width: 38px; height: 38px; }
.modal-title { font-size: 21px; font-weight: 800; margin: 10px 0 12px; }
.modal-text { color: var(--text-2); line-height: 1.7; margin: 0 0 22px; font-size: 14px; }
.modal-actions { display: flex; gap: 12px; }
.modal-actions .btn { flex: 1; height: 46px; }

/* ---------- 底部弹窗（协议 / 详情） ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(27, 20, 24, .38);
  display: flex; align-items: flex-end; justify-content: center; z-index: 9000;
  animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }.sheet {
  width: min(560px, 100%); max-height: 88vh; background: var(--bg);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex; flex-direction: column;
  animation: sheet-up .26s var(--ease);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px 12px; border-bottom: 1px solid var(--line);
}
.sheet-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.sheet-body { padding: 18px 20px 26px; overflow-y: auto; line-height: 1.8; color: var(--text-2); font-size: 14px; }
.sheet-body h4 { color: var(--text); margin: 18px 0 6px; font-size: 15px; }
.sheet-body h4:first-child { margin-top: 0; }
.sheet-body p { margin: 0 0 10px; }
.sheet-foot { padding: 12px 20px 20px; border-top: 1px solid var(--line); }

.icon-btn {
  width: 38px; height: 38px; flex: none; border: none; background: var(--surface-3);
  border-radius: var(--radius-full); cursor: pointer; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.icon-btn:hover { background: var(--pink-soft); color: var(--pink-strong); }
.icon-btn.plain { background: transparent; }

/* ---------- 骨架屏 ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ---------- 空状态 ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 60px 24px; text-align: center; color: var(--text-2);
}
.empty-state .empty-emoji { font-size: 34px; color: var(--text-3); display: flex; justify-content: center; }
.empty-state .empty-emoji svg { width: 40px; height: 40px; opacity: .8; }
.empty-state .empty-title { font-weight: 700; color: var(--text); font-size: 15px; }
.empty-state .empty-desc { font-size: 13px; line-height: 1.6; }
.empty-state.small { padding: 40px 20px; }
