/* ============================================================
   market.css · 行情动态横幅 + 公告横向展示
   （独立文件，避免污染主样式表）
   ============================================================ */

/* ---------- 置顶展示区 ---------- */

.top-showcase {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 20px;
  margin: 34px 0 8px;
  align-items: stretch;
}

/* ============================================================
   1. 动态行情横幅
   ============================================================ */

.mkt-banner {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-2);
  isolation: isolate;
  min-height: 336px;
  display: flex;
  align-items: flex-end;
  background: #0a1020;
}

.mkt-banner-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
  transform: scale(1.04);
  animation: mktDrift 22s ease-in-out infinite alternate;
}

/* 缓慢推近，制造"在呼吸"的观感 */
@keyframes mktDrift {
  0%   { transform: scale(1.04) translate3d(0, 0, 0); }
  100% { transform: scale(1.12) translate3d(-1.2%, -1%, 0); }
}

/* 暗角渐变，保证文字可读 */
.mkt-banner::after {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(180deg, rgba(8, 14, 28, .18) 0%, rgba(8, 14, 28, .52) 58%, rgba(8, 14, 28, .93) 100%),
    radial-gradient(120% 80% at 12% 100%, rgba(181, 118, 58, .30), transparent 62%);
}

/* 扫描线 */
.mkt-scan {
  position: absolute;
  top: 0; bottom: 0;
  width: 34%;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(240, 220, 194, .07) 46%,
    rgba(240, 220, 194, .16) 52%,
    transparent 100%
  );
  animation: mktScan 7.5s linear infinite;
}
@keyframes mktScan {
  0%   { left: -38%; }
  100% { left: 104%; }
}

/* 网格纹理 */
.mkt-grid {
  position: absolute; inset: 0; z-index: 2;
  pointer-events: none;
  opacity: .3;
  background-image:
    linear-gradient(rgba(240, 220, 194, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 220, 194, .07) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(120% 90% at 50% 20%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 20%, #000 30%, transparent 78%);
}

/* 内容层 */
.mkt-banner-body {
  position: relative;
  z-index: 3;
  padding: 26px 28px;
  width: 100%;
  color: #f5eee4;
}

.mkt-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 12px; border-radius: 99px;
  background: rgba(181, 118, 58, .26);
  border: 1px solid rgba(226, 154, 92, .45);
  color: #f0cfa8;
  font-size: 12px; font-weight: 600;
  letter-spacing: .04em;
  margin-bottom: 13px;
}
.mkt-eyebrow .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: #6fd3a8;
  box-shadow: 0 0 0 0 rgba(111, 211, 168, .6);
  animation: mktPulse 2.1s ease-out infinite;
}
@keyframes mktPulse {
  0%   { box-shadow: 0 0 0 0 rgba(111, 211, 168, .55); }
  70%  { box-shadow: 0 0 0 8px rgba(111, 211, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(111, 211, 168, 0); }
}

.mkt-banner h2 {
  font-family: var(--font-serif);
  font-size: clamp(21px, 2.7vw, 27px);
  line-height: 1.34;
  color: #fff8ef;
  margin-bottom: 8px;
  max-width: 20ch;
}
.mkt-banner h2 em {
  font-style: normal;
  color: #f0c08a;
}

.mkt-banner p {
  font-size: 13.5px;
  line-height: 1.72;
  color: rgba(240, 232, 222, .8);
  max-width: 46ch;
  margin-bottom: 16px;
}

/* 实时时钟 */
.mkt-clock {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px;
  border-radius: 99px;
  background: rgba(10, 16, 32, .58);
  border: 1px solid rgba(240, 220, 194, .22);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  margin-bottom: 16px;
}
.mkt-clock-time {
  font-family: var(--font-mono);
  font-size: 16px; font-weight: 600;
  color: #f5d9ae;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}
.mkt-clock-sep {
  width: 1px; height: 13px;
  background: rgba(240, 220, 194, .3);
}
.mkt-clock-zone { font-size: 11.5px; color: rgba(240, 232, 222, .72); }
.mkt-clock-date { font-size: 11.5px; color: rgba(240, 232, 222, .72); }

/* 市场状态 */
.mkt-session {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 10px; border-radius: 99px;
}
.mkt-session.open {
  background: rgba(111, 211, 168, .18);
  color: #8fdcbb;
  border: 1px solid rgba(111, 211, 168, .35);
}
.mkt-session.closed {
  background: rgba(226, 138, 128, .16);
  color: #e8a49c;
  border: 1px solid rgba(226, 138, 128, .32);
}

/* 滚动行情条 */
.mkt-ticker {
  display: flex;
  gap: 22px;
  padding: 12px 0 2px;
  border-top: 1px solid rgba(240, 220, 194, .16);
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.mkt-ticker-inner {
  display: flex;
  gap: 22px;
  flex-shrink: 0;
  animation: mktTicker 32s linear infinite;
  will-change: transform;
}
.mkt-banner:hover .mkt-ticker-inner { animation-play-state: paused; }

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

.mkt-quote {
  display: inline-flex; align-items: baseline; gap: 7px;
  font-size: 12.5px;
  white-space: nowrap;
}
.mkt-quote-sym {
  font-weight: 700;
  color: #f2e6d8;
  letter-spacing: .02em;
}
.mkt-quote-px {
  font-family: var(--font-mono);
  color: rgba(240, 232, 222, .8);
  font-variant-numeric: tabular-nums;
}
/* ---------- 涨跌配色（涨绿跌红；横幅底色偏暗，用更亮的色阶） ---------- */
:root {
  --mkt-up:   #6fd3a8;
  --mkt-down: #e89a90;
}

.mkt-quote-chg { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.mkt-quote-chg.up   { color: var(--mkt-up); }
.mkt-quote-chg.down { color: var(--mkt-down); }

/* 数字跳动 */
.tick-flash-up   { animation: flashUp .55s var(--ease); }
.tick-flash-down { animation: flashDown .55s var(--ease); }
@keyframes flashUp   { 0% { color: var(--mkt-up); text-shadow: 0 0 10px rgba(111,211,168,.7); } 100% { color: inherit; } }
@keyframes flashDown { 0% { color: var(--mkt-down); text-shadow: 0 0 10px rgba(232,154,144,.7); } 100% { color: inherit; } }

/* ============================================================
   2. 公告横向展示
   ============================================================ */

.notice-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  min-height: 336px;
}

.notice-head {
  display: flex; align-items: center; gap: 9px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, var(--brand-wash), var(--card));
  flex-shrink: 0;
}
.notice-head h3 {
  font-family: var(--font-serif);
  font-size: 16px;
  flex: 1;
  display: flex; align-items: center; gap: 8px;
}
.notice-badge {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger);
  animation: mktPulse 2.2s ease-out infinite;
}

/* 公告滚动区 */
.notice-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 20px 14px;
  scroll-behavior: smooth;
}
.notice-list::-webkit-scrollbar { width: 5px; }
.notice-list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 0; }

.notice-item {
  display: flex;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px dashed var(--line);
  text-decoration: none;
  color: inherit;
  transition: opacity .2s var(--ease);
}
.notice-item:last-child { border-bottom: 0; }
.notice-item:hover { text-decoration: none; }
.notice-item:hover .notice-title { color: var(--brand-deep); }

.notice-mark {
  flex-shrink: 0;
  width: 4px;
  border-radius: 99px;
  background: var(--brand);
  margin-top: 5px;
  height: 16px;
}
.notice-mark.hot { background: var(--danger); }
.notice-mark.new { background: var(--accent); }

.notice-main { flex: 1; min-width: 0; }
.notice-title {
  font-size: 13.8px; font-weight: 600; line-height: 1.55;
  color: var(--ink);
  transition: color .18s var(--ease);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notice-sub {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 5px;
  font-size: 11.5px; color: var(--ink-4);
}
.notice-tag {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 99px;
  background: var(--paper-2); border: 1px solid var(--line);
  font-size: 11px; font-weight: 600;
  /* 保证小徽标也有足够的行高，避免文字被压扁 */
  min-height: 22px; line-height: 1.4;
}
.notice-tag.live { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.notice-tag.a { background: var(--brand-soft); border-color: transparent; color: var(--brand-deep); }

.notice-empty {
  padding: 34px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-4);
}

/* 公告自动播放指示 */
.notice-dots {
  display: flex; gap: 5px; justify-content: center;
  padding: 0 0 11px;
  flex-shrink: 0;
}
.notice-dot {
  width: 5px; height: 5px; border-radius: 99px;
  background: var(--line-2);
  transition: all .3s var(--ease);
}
.notice-dot.active { background: var(--brand); width: 15px; }

/* ---------- 响应式 ---------- */

/* 平板（如 iPad 768px）仍有足够横向空间，保持横幅与公告并排 */
@media (max-width: 700px) {
  .top-showcase { grid-template-columns: 1fr; }
  .mkt-banner, .notice-panel { min-height: 0; }
  .mkt-banner { min-height: 290px; }
  .notice-list { max-height: 320px; }
}

/* 平板竖屏（iPad 等）：保持并排，压缩横幅内边距与字号 */
@media (min-width: 701px) and (max-width: 1000px) {
  .top-showcase { gap: 16px; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
  .mkt-banner { min-height: 300px; }
  .mkt-banner-body { padding: 20px 20px; }
  .mkt-banner h2 { font-size: 20px; max-width: 15ch; }
  .mkt-banner p { font-size: 12.5px; margin-bottom: 12px; }
  .mkt-clock { padding: 5px 11px; margin-bottom: 12px; gap: 7px; }
  .mkt-clock-time { font-size: 14px; }
  .notice-title { font-size: 13px; }
  .notice-list { padding: 4px 15px 10px; }
}

@media (max-width: 760px) {
  .top-showcase { margin: 24px 0 4px; gap: 14px; }
  .mkt-banner { border-radius: var(--radius-lg); }
  .mkt-banner-body { padding: 20px 18px; }
  .mkt-banner p { font-size: 13px; max-width: none; }
  .mkt-clock { flex-wrap: wrap; gap: 7px; padding: 5px 11px; }
  .mkt-clock-time { font-size: 14.5px; }
  .mkt-ticker { gap: 16px; }
  .notice-panel { border-radius: var(--radius-lg); }
  .notice-list { max-height: 260px; }
}

@media (max-width: 420px) {
  .mkt-banner h2 { font-size: 19px; }
  .mkt-eyebrow { font-size: 11px; padding: 3px 10px; }
}

/* 超窄屏（iPhone SE 320px）：进一步压缩，保证标题不折行过碎 */
@media (max-width: 360px) {
  .mkt-banner { min-height: 268px; }
  .mkt-banner-body { padding: 16px 14px; }
  .mkt-banner h2 { font-size: 17.5px; max-width: none; }
  .mkt-banner p { font-size: 12.5px; line-height: 1.62; margin-bottom: 12px; }
  .mkt-eyebrow { margin-bottom: 10px; }
  .mkt-clock { margin-bottom: 12px; }
  .mkt-ticker { padding-top: 10px; }
  .mkt-quote { font-size: 11.5px; gap: 5px; }
  .notice-list { padding: 4px 14px 10px; max-height: 240px; }
  .notice-head { padding: 13px 14px; }
  .notice-head h3 { font-size: 15px; }
}

/* 触摸设备：横幅动画幅度收敛，兼顾流畅与省电 */
@media (hover: none) and (pointer: coarse) {
  .mkt-scan { animation-duration: 11s; }
  .mkt-ticker-inner { animation-duration: 42s; }
  .mkt-banner-img { animation-duration: 30s; }
}

/* 尊重用户的减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  .mkt-banner-img,
  .mkt-scan,
  .mkt-ticker-inner,
  .mkt-eyebrow .pulse,
  .notice-badge {
    animation: none !important;
  }
  .mkt-ticker-inner { transform: none; }
}