/* ========================================================================
   金球资讯 RewardPoints · 设计系统
   移动优先，桌面自适应；深色金融科技风 + 可切换浅色
   ===================================================================== */
:root {
  --bg: #0b0f1a;
  --bg-soft: #121829;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.10);
  --text: #eef2ff;
  --text-dim: #9aa6c4;
  --text-mute: #6b7690;
  --gold: #f5c451;
  --gold-deep: #e0a32e;
  --accent: #5b8cff;
  --green: #34d399;
  --red: #fb7185;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --maxw: 980px;
  --topbar-h: 104px;
  --tabbar-h: 64px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

[data-theme="light"] {
  --bg: #eef1f8;
  --bg-soft: #ffffff;
  --surface: rgba(15, 23, 42, 0.04);
  --surface-2: rgba(15, 23, 42, 0.07);
  --border: rgba(15, 23, 42, 0.10);
  --text: #131a2b;
  --text-dim: #4a5575;
  --text-mute: #8a93ad;
  --shadow: 0 10px 30px rgba(31, 41, 84, 0.12);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(91, 140, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(245, 196, 81, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  transition: background .4s var(--ease), color .3s var(--ease);
  overflow-x: hidden;
}

.hidden { display: none !important; }

.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ============================ 顶部栏 ============================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: var(--safe-t);
  background: linear-gradient(180deg, rgba(11, 15, 26, 0.92), rgba(11, 15, 26, 0.72));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .topbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.8));
}
.topbar__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 16px;
}
.brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.brand__logo {
  font-size: 22px;
  color: var(--gold);
  filter: drop-shadow(0 0 8px rgba(245, 196, 81, 0.5));
}
.brand__name {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .5px;
  background: linear-gradient(92deg, var(--gold), #fff 60%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

/* 跑马灯快讯 */
.ticker {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 6px 6px 8px;
  overflow: hidden;
}
.ticker__tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, var(--red), #f43f5e);
  padding: 3px 7px;
  border-radius: 999px;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.ticker__viewport { flex: 1; min-width: 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.ticker__track {
  display: inline-flex;
  white-space: nowrap;
  gap: 36px;
  will-change: transform;
  animation: ticker-scroll 30s linear infinite;
}
.ticker:hover .ticker__track { animation-play-state: paused; }
.ticker__item { font-size: 13px; color: var(--text-dim); }
.ticker__item b { color: var(--gold); margin-right: 4px; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.icon-btn {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition: transform .2s var(--ease), background .2s;
}
.icon-btn:active { transform: scale(.9); }

/* 行情条 */
.market {
  display: flex;
  gap: 10px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.market::-webkit-scrollbar { display: none; }
.market__item {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 96px;
}
.market__name { font-size: 11px; color: var(--text-mute); }
.market__price { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.market__chg { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.up { color: var(--green); } .down { color: var(--red); }

/* ============================ 内容区 ============================ */
.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 20px);
}
.view { animation: fade-up .4s var(--ease); }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.view__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.view__title { font-size: clamp(20px, 5vw, 28px); font-weight: 800; }
.view__sub { font-size: 12px; color: var(--text-mute); margin-top: 2px; }

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .2s var(--ease), background .2s;
}
.refresh-btn:active { transform: scale(.95); }
.refresh-btn__icon { display: inline-block; font-size: 15px; }
.refresh-btn.loading .refresh-btn__icon { animation: spin .8s linear infinite; }
.refresh-btn.loading { opacity: .7; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ 新闻列表 ============================ */
.news-list { display: grid; gap: 14px; }
@media (min-width: 720px) { .news-list { grid-template-columns: 1fr 1fr; } }

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .25s var(--ease), border-color .25s, background .25s;
  animation: fade-up .45s var(--ease) both;
}
.card:hover { transform: translateY(-3px); border-color: rgba(245, 196, 81, 0.4); }
.card__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: .3px;
}
.chip--gold { background: rgba(245, 196, 81, 0.16); color: var(--gold); }
.chip--sport { background: rgba(91, 140, 255, 0.16); color: var(--accent); }
.chip--hot { background: rgba(251, 113, 133, 0.16); color: var(--red); }
.card__source { font-size: 11px; color: var(--text-mute); margin-left: auto; }
.card__title { font-size: 16px; font-weight: 700; line-height: 1.4; }
.card__summary {
  font-size: 13px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__foot { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.card__foot .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-mute); }
.score {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  padding: 2px 10px;
  border-radius: 8px;
}

/* 骨架屏 */
.skeleton {
  height: 132px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border: 1px solid var(--border);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============================ 个人中心 ============================ */
.auth { display: flex; justify-content: center; padding-top: 8px; }
.auth__card { width: 100%; max-width: 420px; padding: 22px; }
.auth__tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.auth__tab {
  flex: 1; padding: 9px; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--text-dim); font-weight: 700; font-size: 14px;
  transition: all .25s var(--ease);
}
.auth__tab.is-active { background: var(--gold); color: #1a1407; box-shadow: 0 4px 14px rgba(245, 196, 81, 0.35); }
.auth__form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  transition: border-color .2s;
}
.field input:focus { outline: none; border-color: var(--gold); }
.form-msg { font-size: 12px; min-height: 16px; color: var(--red); }
.form-msg.ok { color: var(--green); }
.auth__hint { font-size: 12px; color: var(--text-mute); text-align: center; }
.auth__hint b { color: var(--gold); }

.btn {
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s var(--ease), filter .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: #1a1407; }
.btn--primary:hover { filter: brightness(1.06); }
.btn--accent { background: linear-gradient(135deg, var(--accent), #7c3aed); color: #fff; }
.btn--ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn--sm { padding: 7px 12px; font-size: 13px; }

.profile { display: grid; gap: 14px; }
.profile__header { display: flex; align-items: center; gap: 14px; padding: 16px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 800; color: #1a1407;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  flex-shrink: 0;
}
.profile__id { flex: 1; min-width: 0; }
.profile__name { font-size: 18px; font-weight: 800; }
.profile__meta { font-size: 12px; color: var(--text-mute); }

.points-card { padding: 22px; text-align: center; position: relative; overflow: hidden; }
.points-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(400px 160px at 50% -30%, rgba(245, 196, 81, 0.22), transparent 70%);
  pointer-events: none;
}
.points-card__label { font-size: 13px; color: var(--text-dim); }
.points-card__value {
  font-size: clamp(40px, 12vw, 60px);
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #fff, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 4px 0;
}
.points-card__value.bump { animation: bump .5s var(--ease); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.points-card__rule { font-size: 12px; color: var(--text-mute); }
.points-card__rule b { color: var(--gold); }
.points-card__actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.points-card__actions .btn { flex: 1; min-width: 140px; }
.points-card__hint { font-size: 12px; color: var(--green); margin-top: 10px; min-height: 16px; }

/* 图表 */
.chart-card { padding: 16px; }
.chart-card__head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.chart-card__legend { font-size: 11px; color: var(--text-mute); font-weight: 500; }
.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding-top: 8px;
}
.chart__bar {
  flex: 1;
  min-width: 4px;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  border-radius: 6px 6px 2px 2px;
  position: relative;
  transition: height .6s var(--ease);
  opacity: .9;
}
.chart__bar:last-child { background: linear-gradient(180deg, var(--accent), #7c3aed); opacity: 1; }
.chart__bar:hover::after {
  content: attr(data-label);
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border);
  font-size: 11px; padding: 3px 7px; border-radius: 6px; white-space: nowrap;
  margin-bottom: 4px;
}
.chart__empty { width: 100%; text-align: center; color: var(--text-mute); font-size: 13px; align-self: center; }

.history-card { padding: 16px; }
.history-card__head { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.history { display: flex; flex-direction: column; }
.history__row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.history__row:last-child { border-bottom: 0; }
.history__icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); flex-shrink: 0; }
.history__main { flex: 1; min-width: 0; }
.history__type { font-weight: 600; }
.history__time { font-size: 11px; color: var(--text-mute); }
.history__delta { font-weight: 800; font-variant-numeric: tabular-nums; }
.history__delta.plus { color: var(--green); }
.history__empty { color: var(--text-mute); font-size: 13px; padding: 8px 0; }

/* ============================ 底部 Tab ============================ */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: flex;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: linear-gradient(180deg, rgba(11, 15, 26, 0.72), rgba(11, 15, 26, 0.96));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
[data-theme="light"] .tabbar { background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(255,255,255,0.97)); }
.tabbar__item {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-mute);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  font-size: 11px;
  transition: color .2s;
  position: relative;
}
.tabbar__icon { font-size: 20px; transition: transform .25s var(--ease); }
.tabbar__item.is-active { color: var(--gold); }
.tabbar__item.is-active .tabbar__icon { transform: translateY(-2px) scale(1.12); }
.tabbar__item.is-active::before {
  content: ""; position: absolute; top: 6px; width: 24px; height: 3px; border-radius: 3px;
  background: var(--gold); box-shadow: 0 0 10px var(--gold);
}

/* ============================ Toast ============================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
  transform: translate(-50%, 20px);
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all .3s var(--ease);
  z-index: 100;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================ 桌面端自适应 ============================
   ≥ 860px：底部 Tab 转为顶部导航，内容居中，留白更舒适 */
@media (min-width: 860px) {
  :root { --tabbar-h: 0px; }
  .tabbar {
    position: sticky;
    top: calc(var(--topbar-h));
    bottom: auto;
    height: 56px;
    max-width: var(--maxw);
    margin: 8px auto 0;
    padding: 6px;
    gap: 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
  }
  .tabbar__item { flex-direction: row; gap: 8px; border-radius: 999px; font-size: 14px; font-weight: 600; }
  .tabbar__icon { font-size: 18px; }
  .tabbar__item.is-active { background: var(--surface-2); }
  .tabbar__item.is-active::before { display: none; }
  .content { padding-bottom: 40px; }
  .toast { bottom: 30px; }
  .news-list { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) {
  .news-list { grid-template-columns: 1fr 1fr 1fr; }
}

/* 降低动态偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .ticker__track { animation: none; }
}
