:root {
  color-scheme: dark;
  --bg: #0f0f23;
  --bg-2: #1a1a2e;
  --panel: #1a1a2e;
  --panel-2: #16213e;
  --line: #2a2a4a;
  --text: #eaeaea;
  --muted: #667788;
  --muted-2: #555577;
  --orange: #ff6b35;
  --red: #e94560;
  --green: #27ae60;
  --purple: #8e44ad;
  --gold: #f39c12;
  --shadow: 0 18px 60px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: #090914;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.screen { min-height: 100vh; padding-bottom: 78px; }
.screen.no-tabbar { padding-bottom: 0; }
.content { padding: 0 16px 32px; }
.screen-gradient { background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%); }

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}
.boot-mark { font-size: 52px; margin-bottom: 10px; }

.page-topbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(42, 42, 74, .85);
  background: rgba(15, 15, 35, .88);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}
.page-topbar .back-btn {
  border: 0;
  color: var(--text);
  background: rgba(255,255,255,.05);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
}
.page-topbar .top-title { font-weight: 700; font-size: 16px; }
.page-topbar .top-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }

.bottom-nav {
  position: fixed;
  z-index: 50;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: rgba(26, 26, 46, .96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.nav-item {
  border: 0;
  background: transparent;
  color: var(--muted-2);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
}
.nav-item .nav-icon { font-size: 19px; filter: grayscale(.55); }
.nav-item.active { color: var(--orange); }
.nav-item.active .nav-icon { filter: none; }

.hero { text-align: center; padding: 28px 0 18px; }
.hero-icon { font-size: 44px; display: block; }
.hero-title { font-size: 25px; font-weight: 800; color: var(--orange); display: block; margin-top: 6px; text-shadow: 0 0 22px rgba(255,107,53,.32); }
.hero-sub { font-size: 13px; color: var(--muted); margin-top: 5px; display: block; }
.online-bar { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 0; margin-bottom: 12px; }
.pulse-dot { width: 7px; height: 7px; background: var(--green); border-radius: 50%; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 1; box-shadow: 0 0 0 0 rgba(39,174,96,.7); } 100% { opacity: .5; box-shadow: 0 0 0 8px rgba(39,174,96,0); } }
.online-text { font-size: 13px; color: #8899aa; }
.online-num { color: var(--green); font-weight: 700; font-size: 15px; }

.card {
  background: var(--panel);
  border-radius: 15px;
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}
.clickable { transition: transform .16s ease, border-color .16s ease; }
.clickable:active { transform: scale(.98); }
.card-badge { display: inline-block; font-size: 11px; color: #fff; background: var(--red); padding: 2px 10px; border-radius: 10px; margin-bottom: 9px; }
.card-title { font-size: 20px; font-weight: 800; color: var(--text); display: block; }
.card-desc { font-size: 13px; color: var(--muted); margin-top: 4px; display: block; line-height: 1.45; }
.match-card { background: linear-gradient(135deg,#1a1a2e 0%,#2a1a2e 100%); border-color: rgba(233,69,96,.28); }
.match-info { display: flex; align-items: center; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); }
.match-stat { flex: 1; text-align: center; }
.stat-num { font-size: 17px; font-weight: 800; color: var(--orange); display: block; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; display: block; }
.match-divider { width: 1px; height: 24px; background: var(--line); }
.training-card { background: linear-gradient(135deg,#1a1a2e 0%,#1e2a3e 100%); border-color: rgba(142,68,173,.26); }
.rank-strip { display: flex; gap: 5px; margin-top: 12px; flex-wrap: wrap; }
.rank-tag { font-size: 10px; color: #8899aa; padding: 3px 7px; border: 1px solid #555577; border-radius: 6px; }
.footer { text-align: center; padding: 24px 0 8px; font-size: 11px; color: #444466; line-height: 1.7; }
.footer span { display: block; }

.btn {
  border: 0;
  border-radius: 999px;
  min-height: 46px;
  padding: 0 22px;
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg,var(--orange),var(--red)); }
.btn.green { background: linear-gradient(135deg,#27ae60,#2ecc71); box-shadow: 0 6px 20px rgba(39,174,96,.24); }
.btn.ghost { color: var(--muted); background: transparent; border: 1px solid #555577; }
.btn.full { width: 100%; }
.btn[disabled] { background: var(--line); color: var(--muted-2); box-shadow: none; }

.input, .textarea, .select {
  width: 100%;
  color: var(--text);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 10px;
  outline: none;
  font-size: 15px;
}
.input, .select { height: 44px; padding: 0 12px; }
.textarea { min-height: 112px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus, .select:focus { border-color: rgba(255,107,53,.55); }
.form-item { margin-bottom: 16px; }
.form-label { font-size: 14px; font-weight: 600; color: var(--text); display: block; margin-bottom: 7px; }
.req { color: var(--red); }
.count { display: block; text-align: right; font-size: 11px; color: var(--muted-2); margin-top: 3px; }
.form-card { background: var(--panel); border-radius: 15px; padding: 17px; border: 1px solid var(--line); margin-top: 10px; }

.page-header { text-align: center; padding: 26px 0 16px; }
.page-header .h-icon { font-size: 34px; display: block; }
.page-header .h-title { font-size: 23px; font-weight: 800; color: var(--text); display: block; margin-top: 6px; }
.page-header .h-desc { font-size: 12px; color: var(--muted); margin-top: 4px; display: block; line-height: 1.5; }

.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 22px; }
.logo-section { text-align: center; margin-bottom: 56px; }
.logo-icon { font-size: 64px; display: block; }
.logo-title { font-size: 28px; font-weight: 800; color: var(--orange); display: block; margin-top: 10px; text-shadow: 0 0 28px rgba(255,107,53,.3); }
.logo-sub { font-size: 14px; color: var(--muted); margin-top: 6px; display: block; }
.info-section { margin-top: 44px; text-align: center; }
.info-text { display: block; font-size: 12px; color: #444466; margin-top: 5px; }
.agreement { display: block; text-align: center; font-size: 11px; color: var(--muted-2); margin-top: 13px; }

.match-screen { min-height: 100vh; display: flex; flex-direction: column; }
.match-area { display: flex; flex-direction: column; align-items: center; padding: 54px 20px 20px; text-align: center; }
.success-area { padding-top: 28px; }
.big-icon { font-size: 58px; margin-bottom: 12px; }
.match-title { font-size: 23px; font-weight: 800; color: var(--text); margin: 0 0 7px; }
.match-desc { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.5; }
.match-hint { font-size: 12px; color: var(--muted-2); margin-top: 8px; }
.match-btn { margin-top: 38px; width: min(100%, 300px); }
.scan-box { position: relative; width: 132px; height: 132px; display: grid; place-items: center; margin-bottom: 22px; }
.scan-ring { position: absolute; border-radius: 50%; border: 2px solid transparent; }
.scan-ring.r1 { width: 132px; height: 132px; border-top-color: var(--orange); animation: spin 1s linear infinite; }
.scan-ring.r2 { width: 100px; height: 100px; border-right-color: var(--red); animation: spin 1.5s linear infinite reverse; }
.scan-ring.r3 { width: 68px; height: 68px; border-bottom-color: var(--orange); animation: spin .8s linear infinite; }
.search-icon { font-size: 30px; z-index: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar { width: 220px; height: 4px; background: var(--line); border-radius: 999px; margin-top: 20px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg,var(--orange),var(--red)); animation: progress 3s ease-in-out infinite; }
@keyframes progress { 0% { width: 0; } 50% { width: 70%; } 100% { width: 100%; } }
.count-text { font-size: 12px; color: var(--muted-2); margin-top: 12px; }
.matched-card { display: flex; align-items: center; background: var(--panel-2); border-radius: 15px; padding: 15px; margin-top: 20px; width: 100%; border: 1px solid var(--line); text-align: left; }
.text-avatar, .card-text-avatar { border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex-shrink: 0; }
.card-text-avatar { width: 64px; height: 64px; background: var(--red); font-size: 25px; margin-right: 13px; }
.minfo { flex: 1; min-width: 0; }
.mname { font-size: 18px; font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mmeta { font-size: 12px; color: var(--muted); margin-top: 4px; display: block; }
.action-row { margin-top: 18px; width: 100%; display: flex; gap: 10px; }
.action-row .btn { flex: 1; min-height: 44px; padding: 0 12px; }

.chat-screen { height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.chat-header { display: flex; align-items: center; padding: 11px 16px; background: var(--bg-2); border-bottom: 1px solid var(--line); cursor: pointer; }
.ch-avatar-wrap { width: 44px; height: 44px; flex-shrink: 0; margin-right: 11px; }
.ch-text-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--red); display: grid; place-items: center; font-size: 18px; font-weight: 800; color: #fff; }
.ch-info { flex: 1; min-width: 0; }
.ch-name { font-size: 17px; font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-status { font-size: 11px; color: var(--green); margin-top: 3px; display: block; }
.msg-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.msg-inner { padding: 15px 14px 12px; }
.msg-item { display: flex; align-items: flex-start; margin-bottom: 18px; width: 100%; }
.msg-item.mine { justify-content: flex-end; }
.msg-avatar-wrap { width: 42px; height: 42px; flex-shrink: 0; }
.msg-text-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--red); display: grid; place-items: center; font-size: 15px; font-weight: 800; color: #fff; }
.msg-text-avatar.mine-avatar { background: var(--orange); margin-left: 8px; }
.msg-body { display: flex; flex-direction: column; max-width: 66%; min-width: 0; }
.msg-bubble { padding: 11px 14px; font-size: 15px; line-height: 1.55; border-radius: 15px; word-break: break-word; user-select: text; }
.msg-bubble.other { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); margin-left: 8px; border-bottom-left-radius: 4px; }
.msg-bubble.mine { background: linear-gradient(135deg,var(--orange),var(--red)); color: #fff; margin-right: 8px; border-bottom-right-radius: 4px; }
.msg-time { font-size: 10px; color: var(--muted-2); margin-top: 4px; padding: 0 4px; }
.msg-item.mine .msg-time { text-align: right; }
.chat-inputbar { display: flex; align-items: center; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--bg-2); border-top: 1px solid var(--line); }
.msg-input { flex: 1; height: 43px; background: var(--bg); border-radius: 999px; padding: 0 15px; font-size: 15px; color: var(--text); border: 0; outline: none; min-width: 0; }
.send-btn { width: 72px; height: 43px; border-radius: 999px; border: 0; color: #fff; font-weight: 700; background: linear-gradient(135deg,var(--orange),var(--red)); margin-left: 8px; flex-shrink: 0; }
.send-btn:disabled { background: var(--line); color: var(--muted-2); }

.contacts-list { padding: 6px 10px 20px; }
.contact-item { display: flex; align-items: center; width: 100%; text-align: left; padding: 13px 9px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; color: var(--text); }
.contact-item:active { background: var(--panel-2); }
.avatar-wrap { position: relative; width: 48px; height: 48px; margin-right: 10px; flex-shrink: 0; }
.c-text-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--red); display: grid; place-items: center; font-size: 18px; font-weight: 800; color: #fff; }
.unread-badge { position: absolute; top: -3px; right: -3px; background: var(--red); color: #fff; font-size: 10px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.cinfo { flex: 1; min-width: 0; }
.ctop, .cbottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cname { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctime { font-size: 10px; color: var(--muted-2); flex-shrink: 0; }
.clast { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clast.unread { color: var(--text); font-weight: 600; }
.empty { display: flex; flex-direction: column; align-items: center; padding: 90px 20px 20px; text-align: center; }
.empty-icon { font-size: 44px; margin-bottom: 9px; }
.empty-title { font-size: 17px; }
.empty-desc { font-size: 12px; color: var(--muted); margin-top: 5px; }
.empty .btn { margin-top: 24px; width: 190px; }

.training-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.training-card { background: var(--bg-2); border-radius: 15px; padding: 15px 13px; border: 1px solid var(--line); position: relative; min-height: 150px; text-align: left; color: var(--text); transition: transform .16s ease; }
.training-card:active { transform: scale(.96); }
.training-card.full { grid-column: 1 / -1; min-height: 132px; }
.training-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; margin-bottom: 9px; }
.training-label { font-size: 15px; font-weight: 700; display: block; margin-bottom: 4px; }
.training-desc { font-size: 11px; color: var(--muted); line-height: 1.45; display: block; }
.training-arrow { position: absolute; right: 11px; bottom: 8px; font-size: 15px; color: var(--muted-2); }

.form-header { text-align: center; padding: 24px 0 12px; }
.fi { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 9px; font-size: 28px; }
.fl { font-size: 20px; font-weight: 800; display: block; }
.fd { font-size: 12px; color: var(--muted); margin-top: 4px; display: block; }
.success-section { display: flex; flex-direction: column; align-items: center; padding-top: 24px; text-align: center; }
.sicon { font-size: 46px; margin-bottom: 9px; }
.stitle { font-size: 20px; font-weight: 800; }
.sdesc { font-size: 13px; color: var(--muted); margin-top: 5px; }
.contact-card { width: 100%; background: linear-gradient(135deg,var(--bg-2),var(--panel-2)); border-radius: 15px; padding: 17px; margin-top: 20px; border: 1px solid rgba(255,107,53,.25); }
.clabel { font-size: 13px; color: var(--orange); font-weight: 600; display: block; margin-bottom: 9px; text-align: center; }
.crow { display: flex; align-items: center; gap: 9px; }
.cwechat { flex: 1; font-size: 18px; color: var(--text); font-weight: 800; background: var(--bg); padding: 9px 10px; border-radius: 9px; text-align: center; letter-spacing: 2px; overflow: hidden; }
.copy-btn { width: 66px; height: 38px; border: 0; background: var(--orange); border-radius: 9px; color: #fff; font-size: 12px; flex-shrink: 0; }
.chint { font-size: 11px; color: var(--muted-2); margin-top: 7px; display: block; text-align: center; }
.info-card { width: 100%; background: var(--bg-2); border-radius: 15px; padding: 17px; margin-top: 11px; border: 1px solid var(--line); }
.ititle { font-size: 13px; font-weight: 700; display: block; margin-bottom: 9px; text-align: left; }
.irow { display: flex; justify-content: space-between; font-size: 13px; color: #8899aa; padding: 7px 0; border-bottom: 1px solid var(--line); }
.irow:last-child { border: 0; }
.irow span:last-child { color: var(--text); font-weight: 600; }
.abtns { width: 100%; margin-top: 20px; display: flex; gap: 10px; }
.abtns .btn { flex: 1; min-height: 44px; padding: 0 10px; }
.tip { font-size: 11px; color: var(--muted-2); margin-top: 13px; display: block; }

.avatar-section { display: flex; flex-direction: column; align-items: center; padding: 18px 0; }
.my-text-avatar { width: 82px; height: 82px; border-radius: 50%; background: linear-gradient(135deg,var(--orange),var(--red)); display: grid; place-items: center; font-size: 34px; font-weight: 800; color: #fff; border: 2px solid rgba(255,107,53,.6); }
.avatar-hint { font-size: 12px; color: var(--orange); margin-top: 7px; }

.profile-card { display: flex; align-items: center; padding: 20px 15px; }
.profile-card .my-text-avatar { width: 72px; height: 72px; font-size: 28px; flex-shrink: 0; }
.info { flex: 1; margin-left: 14px; min-width: 0; }
.name { font-size: 21px; font-weight: 800; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.max-rank { font-size: 13px; color: #8899aa; margin-top: 6px; display: block; }
.rank-text { color: var(--gold); font-weight: 700; }
.bio { font-size: 12px; color: var(--muted); margin-top: 6px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats { padding: 20px 0; }
.stat { display: flex; align-items: center; justify-content: center; }
.num { font-size: 22px; font-weight: 800; color: var(--orange); margin-right: 7px; }
.label { font-size: 13px; color: var(--muted); }
.menu { background: var(--bg-2); border-radius: 15px; overflow: hidden; border: 1px solid var(--line); }
.menu-item { display: flex; align-items: center; width: 100%; background: transparent; color: var(--text); padding: 15px 13px; border: 0; border-bottom: 1px solid var(--line); text-align: left; }
.menu-item:last-child { border: 0; }
.mi { font-size: 17px; margin-right: 9px; }
.ml { flex: 1; font-size: 14px; }
.ma { font-size: 17px; color: var(--muted-2); }
.logout { margin-top: 14px; background: var(--bg-2); border-radius: 15px; padding: 15px; text-align: center; color: var(--red); font-size: 14px; border: 1px solid rgba(233,69,96,.25); width: 100%; }
.not-login { display: flex; flex-direction: column; align-items: center; padding-top: 100px; text-align: center; }
.nl-icon { font-size: 50px; }
.nl-title { font-size: 16px; color: var(--muted); margin-top: 11px; }
.not-login .btn { margin-top: 24px; width: 210px; }
.actions { margin-top: 18px; }
.loading { text-align: center; padding: 110px 0; color: var(--muted); }

.toast {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: 98px;
  transform: translate(-50%, 14px);
  background: rgba(20, 20, 40, .96);
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 760px) {
  body { padding: 18px 0; }
  .app-shell { min-height: calc(100vh - 36px); border-radius: 22px; }
  .bottom-nav { bottom: 18px; border-radius: 0 0 22px 22px; }
}

@media (max-width: 380px) {
  .content { padding-left: 12px; padding-right: 12px; }
  .card { padding: 15px; }
  .training-grid { gap: 8px; }
  .training-card { padding: 13px 11px; }
}
