/* ============================================================
   丹鉴 DANJIAN — Modern Vibrant Portal
   时尚 · 潮流 · 前沿 · 多彩
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Noto+Sans+SC:wght@300;400;500;700;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Palette */
  --bg: #f7f8fc;
  --bg-card: #ffffff;
  --bg-card-hover: #fefefe;
  --text: #1a1d26;
  --text-2: #4b5068;
  --text-3: #8b90a0;
  --border: #e8eaf0;
  --border-light: #f0f1f5;

  /* Accents */
  --blue: #3b82f6;
  --indigo: #6366f1;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --rose: #f43f5e;
  --amber: #f59e0b;
  --gold: #d4a017;
  --emerald: #10b981;
  --red: #ef4444;
  --sky: #0ea5e9;

  /* Gradients */
  --grad-brand: linear-gradient(135deg, #6366f1, #ec4899);
  --grad-fx: linear-gradient(135deg, #3b82f6, #06b6d4);
  --grad-gold: linear-gradient(135deg, #f59e0b, #d97706);
  --grad-hot: linear-gradient(135deg, #f43f5e, #fb923c);
  --grad-dark: linear-gradient(135deg, #1e1b4b, #312e81);

  /* Typography */
  --sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;

  /* Layout */
  --container: 1240px;
  --nav-h: 56px;
  --marquee-h: 40px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.08);
  --ease: cubic-bezier(.22,.61,.36,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + var(--marquee-h) + 20px); }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* ============================================================
   MARQUEE TICKER — 顶部流动行情条
   ============================================================ */
.marquee-bar {
  background: var(--grad-dark);
  height: var(--marquee-h);
  overflow: hidden;
  position: relative;
  z-index: 200;
}

.marquee-track {
  display: flex;
  height: 100%;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}

.marquee-content {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  white-space: nowrap;
  animation: marquee-scroll 45s linear infinite;
  will-change: transform;
}

.marquee-content:hover { animation-play-state: paused; }

@keyframes marquee-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Marquee items */
.mq-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  flex-shrink: 0;
}
.mq-badge.live { background: var(--rose); color: #fff; }
.mq-badge.stats { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); }
.mq-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #fff;
  animation: blink 1.2s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

.mq-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: rgba(255,255,255,.85);
  flex-shrink: 0;
}
.mq-tag { font-size: 14px; }
.mq-code { font-weight: 600; color: rgba(255,255,255,.6); font-size: 11px; letter-spacing: .03em; }
.mq-val { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.mq-arrow { font-size: 12px; }
.mq-arrow.up { color: var(--emerald); }
.mq-arrow.down { color: var(--rose); }

.mq-item.fx .mq-val { color: var(--sky); }
.mq-item.gold .mq-val { color: var(--amber); }
.mq-item.gold-brand .mq-val { color: #fbbf24; }
.mq-item.gold-rec .mq-val { color: #a3e635; }

.mq-divider { color: rgba(255,255,255,.2); font-size: 10px; flex-shrink: 0; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(247,248,252,.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  height: var(--nav-h);
  transition: box-shadow .3s var(--ease);
}
.topnav.scrolled { box-shadow: var(--shadow-sm); }
.topnav-inner { display: flex; align-items: center; height: var(--nav-h); gap: 24px; }

.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; flex-shrink: 0; }
.logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--grad-brand); color: #fff;
  font-family: serif; font-size: 18px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}
.logo-text {
  font-size: 18px; font-weight: 800; letter-spacing: -.01em;
  background: var(--grad-brand); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topnav-links { display: flex; gap: 8px; margin-left: auto; }
.topnav-links a {
  font-size: 13px; font-weight: 500; color: var(--text-2);
  text-decoration: none; padding: 6px 12px; border-radius: 8px;
  transition: all .2s;
}
.topnav-links a:hover { color: var(--indigo); background: rgba(99,102,241,.06); }

.topnav-right { display: flex; align-items: center; gap: 12px; margin-left: 16px; }
.search-field {
  width: 180px; height: 34px;
  border: 1px solid var(--border); border-radius: 20px;
  padding: 0 14px; font-size: 13px;
  background: var(--bg); color: var(--text);
  transition: all .3s var(--ease);
}
.search-field:focus { outline: none; border-color: var(--indigo); width: 240px; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.search-field::placeholder { color: var(--text-3); }

.live-clock {
  font-family: var(--mono); font-size: 12px; color: var(--text-3);
  letter-spacing: .05em; flex-shrink: 0;
}

/* ============================================================
   MAIN CONTENT SECTIONS
   ============================================================ */
.content { padding: 28px 0 60px; }

.block { margin-bottom: 48px; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.block-title-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.block-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.title-accent {
  background: var(--grad-brand); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.block-count { font-family: var(--mono); font-size: 13px; color: var(--text-3); }
.block-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--emerald); animation: blink 1.5s infinite;
}
.block-meta { font-size: 13px; color: var(--text-3); }
.block-actions { display: flex; gap: 6px; }

/* Pill buttons */
.pill-btn {
  border: 1px solid var(--border); border-radius: 20px;
  padding: 5px 14px; font-size: 12px; font-weight: 500;
  color: var(--text-2); background: var(--bg-card);
  cursor: pointer; transition: all .2s;
}
.pill-btn.active { background: var(--text); color: #fff; border-color: var(--text); }
.pill-btn:hover:not(.active) { border-color: var(--indigo); color: var(--indigo); }

/* Category chips */
.chip-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 12px; font-size: 12px; color: var(--text-2);
  background: var(--bg-card); cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.chip.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.chip:hover:not(.active) { border-color: var(--indigo); color: var(--indigo); }
.chip-count { font-family: var(--mono); font-size: 10px; opacity: .6; }

/* ============================================================
   NEWS CARDS
   ============================================================ */
.news-feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }

.news-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 18px 20px;
  cursor: pointer; transition: all .25s var(--ease);
  position: relative; overflow: hidden;
}
.news-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
  border-radius: 4px 0 0 4px; transition: opacity .2s;
}
.news-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.news-card[data-sentiment="positive"]::before { background: var(--emerald); }
.news-card[data-sentiment="negative"]::before { background: var(--rose); }
.news-card[data-sentiment="neutral"]::before { background: var(--blue); }

.nc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.nc-cat {
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px;
  background: rgba(99,102,241,.08); color: var(--indigo);
}
.nc-sentiment {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 2px 8px; border-radius: 4px;
}
.nc-sentiment.positive { background: rgba(16,185,129,.08); color: var(--emerald); }
.nc-sentiment.negative { background: rgba(244,63,94,.08); color: var(--rose); }
.nc-sentiment.neutral { background: rgba(139,144,160,.08); color: var(--text-3); }
.nc-imp { display: flex; gap: 2px; margin-left: auto; }
.nc-imp i { display: block; width: 3px; height: 14px; border-radius: 1px; background: var(--border); }
.nc-imp i.on { background: var(--amber); }

.nc-title {
  font-size: 15px; font-weight: 700; line-height: 1.45; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.nc-summary {
  font-size: 13px; color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.nc-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; font-size: 11px; color: var(--text-3);
}
.nc-time { font-family: var(--mono); }

/* ============================================================
   RATES — FX & Gold Cards
   ============================================================ */
.sub-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; margin-bottom: 14px; margin-top: 8px;
}
.sub-icon { font-size: 18px; }
.sub-note { font-size: 12px; font-weight: 400; color: var(--text-3); }

.rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.rcard {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 14px;
  transition: all .2s var(--ease);
}
.rcard:hover { box-shadow: var(--shadow-sm); border-color: var(--border); }

.rcard-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rcard-flag { font-size: 20px; }
.rcard-info { display: flex; flex-direction: column; }
.rcard-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.rcard-pair { font-size: 10px; color: var(--text-3); font-family: var(--mono); }

.rcard-num {
  font-family: var(--mono); font-size: 22px; font-weight: 700;
  color: var(--blue); line-height: 1.1; margin-bottom: 2px;
}
.gold-num { color: var(--gold) !important; }

.rcard-sub { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.rcard-sub b { font-weight: 600; color: var(--text-2); }

.rcard-delta {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
}
.rcard-delta.up { color: var(--emerald); }
.rcard-delta.down { color: var(--rose); }
.rcard-delta.neutral { color: var(--text-3); }

.gold-card { border-left: 3px solid var(--amber); }

.rate-disclaimer { font-size: 11px; color: var(--text-3); text-align: center; margin-top: 8px; }

/* ============================================================
   EVENTS / ANALYSIS FEEDS
   ============================================================ */
.events-feed, .analysis-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* ============================================================
   SENTIMENT STRIP
   ============================================================ */
.sentiment-strip {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; background: var(--bg-card);
  border: 1px solid var(--border-light); border-radius: var(--radius);
  margin-top: 24px;
}
.ss-label { font-size: 13px; font-weight: 600; color: var(--text-2); flex-shrink: 0; }
.ss-track {
  flex: 1; height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden;
}
.ss-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--emerald), var(--amber), var(--rose));
  transition: width .6s var(--ease);
}
.ss-bull { font-size: 11px; font-weight: 600; color: var(--emerald); flex-shrink: 0; }
.ss-bear { font-size: 11px; font-weight: 600; color: var(--rose); flex-shrink: 0; }

/* ============================================================
   PLACEHOLDER / EMPTY STATE
   ============================================================ */
.placeholder-box {
  text-align: center; padding: 48px 20px;
  background: var(--bg-card); border: 1px dashed var(--border);
  border-radius: var(--radius); grid-column: 1 / -1;
}
.ph-icon { font-size: 32px; margin-bottom: 8px; }
.ph-text { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.ph-sub { font-size: 13px; color: var(--text-3); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.page-btn {
  min-width: 34px; height: 34px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg-card); font-size: 13px;
  color: var(--text-2); cursor: pointer; transition: all .2s;
}
.page-btn.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.page-btn:hover:not(.active) { border-color: var(--indigo); color: var(--indigo); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: 24px 0; border-top: 1px solid var(--border-light);
}
.footer-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-3); flex-wrap: wrap; gap: 8px;
}
.f-brand { font-weight: 700; letter-spacing: .04em; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-bg {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(26,29,38,.5); backdrop-filter: blur(6px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 64px 24px; overflow-y: auto;
}
.modal-bg.active { display: flex; }

.modal-card {
  background: var(--bg-card); border-radius: var(--radius);
  max-width: 640px; width: 100%; padding: 32px;
  box-shadow: var(--shadow-lg); position: relative;
}
.modal-x {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; font-size: 24px;
  color: var(--text-3); cursor: pointer; transition: color .2s;
}
.modal-x:hover { color: var(--text); }
.modal-title { font-size: 22px; font-weight: 800; line-height: 1.35; margin-bottom: 8px; }
.modal-meta { font-size: 12px; color: var(--text-3); margin-bottom: 20px; display: flex; gap: 12px; flex-wrap: wrap; }
.modal-body-text { font-size: 15px; line-height: 1.8; color: var(--text-2); }
.modal-body-text p { margin-bottom: 12px; }
.modal-analysis {
  margin-top: 24px; padding: 16px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(99,102,241,.04), rgba(236,72,153,.04));
  border-left: 3px solid var(--indigo);
}
.modal-analysis-title { font-size: 13px; font-weight: 700; color: var(--indigo); margin-bottom: 8px; }
.modal-analysis-text { font-size: 14px; line-height: 1.7; color: var(--text-2); }

/* ============================================================
   CHAT WIDGET
   ============================================================ */
.chat-widget { position: fixed; bottom: 24px; right: 24px; z-index: 250; }

.chat-fab {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--grad-brand); color: #fff; border: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 20px rgba(99,102,241,.35);
  transition: all .25s var(--ease);
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(99,102,241,.4); }
.chat-fab.hidden { display: none; }
.fab-glyph { font-family: serif; font-size: 20px; font-weight: 900; line-height: 1; }
.fab-tag { font-size: 9px; font-weight: 700; letter-spacing: .1em; opacity: .8; }

.chat-panel {
  position: fixed; bottom: 24px; right: 24px;
  width: 380px; height: 540px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden;
}
.chat-panel.open { display: flex; }

.cp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border-light);
}
.cp-who { display: flex; align-items: center; gap: 10px; }
.cp-ava {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad-brand); color: #fff;
  font-family: serif; font-size: 18px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.cp-who b { font-size: 15px; display: block; }
.cp-who small { font-size: 11px; color: var(--text-3); }
.cp-x { background: none; border: none; font-size: 22px; color: var(--text-3); cursor: pointer; }
.cp-x:hover { color: var(--text); }

.cp-msgs {
  flex: 1; overflow-y: auto; padding: 14px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.message { max-width: 85%; }
.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }
.msg-bubble {
  padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.55;
}
.message.user .msg-bubble {
  background: var(--grad-brand); color: #fff;
  border-bottom-right-radius: 4px;
}
.message.assistant .msg-bubble {
  background: var(--bg); border: 1px solid var(--border-light);
  border-bottom-left-radius: 4px; color: var(--text);
}
.msg-time { font-size: 10px; color: var(--text-3); margin-top: 3px; }
.message.user .msg-time { text-align: right; }

.typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-3);
  animation: bounce .6s infinite alternate;
}
.typing-dots span:nth-child(2) { animation-delay: .1s; }
.typing-dots span:nth-child(3) { animation-delay: .2s; }
@keyframes bounce { to { transform: translateY(-4px); opacity: .4; } }

.cp-quick {
  display: flex; gap: 6px; padding: 8px 18px; flex-wrap: wrap;
  border-top: 1px solid var(--border-light);
}
.qk {
  border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 12px; font-size: 11px; color: var(--text-2);
  background: var(--bg-card); cursor: pointer; transition: all .2s;
}
.qk:hover { border-color: var(--indigo); color: var(--indigo); }

.cp-bar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border-light);
}
#chat-input {
  flex: 1; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; font-size: 14px; resize: none;
  background: var(--bg); color: var(--text); max-height: 80px;
  transition: border-color .2s;
}
#chat-input:focus { outline: none; border-color: var(--indigo); }
.cp-send {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--grad-brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: transform .2s;
}
.cp-send:hover { transform: scale(1.05); }
.cp-send:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .topnav-links { display: none; }
  .search-field { width: 140px; }
  .search-field:focus { width: 180px; }
  .news-feed { grid-template-columns: 1fr; }
  .rate-grid { grid-template-columns: repeat(2, 1fr); }
  .block-title { font-size: 20px; }
  .chat-panel { width: calc(100vw - 32px); right: 16px; bottom: 16px; height: 70vh; }
}

@media (max-width: 480px) {
  .rate-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rcard { padding: 10px; }
  .rcard-num { font-size: 18px; }
  .marquee-content { gap: 14px; font-size: 12px; }
  .footer-row { flex-direction: column; text-align: center; }
}
