* {
  box-sizing: border-box;
}

:root {
  /* Premium Dark Theme */
  --bg: #050608;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1a1d2d 0%, #050608 100%);
  --fg: #e6edf3;
  --muted: #8b949e;

  /* Neon Accents */
  --up: #00ff9d;
  /* Neon Green */
  --down: #ff0055;
  /* Neon Red */
  --neutral: #8b949e;

  /* Surface & Glass */
  --card: rgba(22, 27, 34, 0.7);
  --card-border: 1px solid rgba(48, 54, 61, 0.5);
  --glass: rgba(22, 27, 34, 0.6);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);

  /* Fonts */
  --font-main: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  background: transparent;
  border-radius: 0;
  box-sizing: border-box;
  /* Ensure padding doesn't add to width */
}

h1 {
  margin: 8px 0 12px 0;
  padding: 0 8px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 8px;
  background-color: transparent;
}

th,
td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.3);
  background-color: transparent !important;
  transition: background-color 0.2s;
}

tr {
  background-color: transparent !important;
  transition: background-color 0.2s;
}

tr:hover td {
  background-color: rgba(255, 255, 255, 0.03) !important;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.6);
}

.up {
  color: var(--up) !important;
  font-weight: 700 !important;
}

.down {
  color: var(--down) !important;
  font-weight: 700 !important;
}

.neutral {
  color: var(--neutral) !important;
  font-weight: 700 !important;
}

#score {
  margin-top: 16px;
  font-size: 18px;
}

.note {
  color: var(--muted);
}

#status {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 8px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

#status span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 旧的提示框样式已废弃 */

/* Summary grid */
#controls {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid #30363d;
  padding: 8px;
  z-index: 10;
}

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
  padding: 8px;
}

.card {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--card-border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.card h2 {
  margin: 6px 4px 2px;
  font-size: 16px;
  color: var(--fg);
}

.card table th,
.card table td {
  font-size: 13px;
}

/* Staleness highlighting */
tr.stale,
.stale {
  background-color: var(--bg) !important;
}

tr.stale td,
.stale td {
  border-bottom-color: #f85149 !important;
  background-color: var(--bg) !important;
}

/* Mini charts */
.score-cell {
  min-width: 160px;
}

.score-rail {
  position: relative;
  height: 8px;
  background: #30363d;
  border-radius: 999px;
  margin-top: 4px;
}

.score-rail .baseline {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #555;
}

.score-rail .marker {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  border-radius: 1px;
  background: var(--neutral);
}

.segbar {
  display: flex;
  width: 140px;
  height: 8px;
  background: #30363d;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.segbar .seg {
  height: 100%;
}

.segbar .up {
  background: var(--up);
}

.segbar .down {
  background: var(--down);
}

.segbar .neutral {
  background: #6e768166;
}

.spark {
  width: 140px;
  height: 28px;
  display: block;
}

/* Timeframe chips */
.chip {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid #30363d;
  border-radius: 999px;
  margin: 4px 6px 0 0;
  cursor: pointer;
  color: var(--fg);
}

.chip.active {
  background: var(--card);
  border-color: var(--up);
  color: var(--fg);
}

.chip:hover {
  border-color: #8b949e;
}

/* Detail responsive cards */
.tf-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 12px;
  padding: 8px;
}

.tf-card {
  background: var(--card);
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 12px;
}

.tf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid #30363d;
  border-radius: 999px;
  font-weight: 600;
}

.kpis {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
}

.badge {
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid transparent;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge.up {
  color: var(--up);
  border-color: rgba(0, 255, 157, 0.2);
  background: rgba(0, 255, 157, 0.1) !important;
  box-shadow: 0 0 10px rgba(0, 255, 157, 0.1);
}

.badge.down {
  color: var(--down);
  border-color: rgba(255, 0, 85, 0.2);
  background: rgba(255, 0, 85, 0.1) !important;
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.1);
}

.badge.neutral {
  color: var(--neutral);
  border-color: rgba(139, 148, 158, 0.2);
}

/* Double Cross Special Badges */
.badge-double-golden {
  background: linear-gradient(135deg, rgba(0, 255, 157, 0.2), rgba(0, 255, 157, 0.05)) !important;
  border: 1px solid rgba(0, 255, 157, 0.5);
  color: #fff;
  text-shadow: 0 0 5px rgba(0, 255, 157, 0.8);
  box-shadow: 0 0 15px rgba(0, 255, 157, 0.3);
  animation: glow-pulse 2s infinite;
}

.badge-double-death {
  background: linear-gradient(135deg, rgba(255, 0, 85, 0.2), rgba(255, 0, 85, 0.05)) !important;
  border: 1px solid rgba(255, 0, 85, 0.5);
  color: #fff;
  text-shadow: 0 0 5px rgba(255, 0, 85, 0.8);
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.3);
  animation: glow-pulse 2s infinite;
}

@keyframes glow-pulse {
  0% {
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.2);
  }

  50% {
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.5);
  }

  100% {
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.2);
  }
}

@media (max-width: 768px) {
  #table-wrapper {
    display: none !important;
  }

  #cards-wrapper {
    display: none !important;
  }

  /* 确保旧的 cards-wrapper 不干扰 */
  #card-view {
    display: block !important;
  }

  /* 强制显示新的 card-view */

  .symbol-card {
    background: var(--card);
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
  }

  .symbol-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #30363d;
  }

  .symbol-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
  }

  .symbol-card-price {
    font-size: 14px;
    color: var(--fg);
  }

  .symbol-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
  }

  .symbol-card-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .symbol-card-label {
    font-size: 11px;
    color: var(--muted);
  }

  .symbol-card-value {
    font-size: 13px;
    font-weight: 600;
  }

  .symbol-card-mtf {
    grid-column: 1 / -1;
    margin-top: 8px;
  }

  .mtf-label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
  }
}

.spark-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spark-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

/* 列表页：隐藏指标列(EMA/MACD/RSI) */
.hide-ind th.col-ind,
.hide-ind td.col-ind {
  display: none;
}

/* 手机默认隐藏指标列 */
@media (max-width: 480px) {

  body.hide-ind-mobile #list thead th.col-ind,
  body.hide-ind-mobile #list tbody td.col-ind {
    display: none;
  }
}

/* Symbol link styling - 交易对名称：固定白色粗体 */
a.symbol-link {
  color: #ffffff !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  background-color: transparent !important;
}

a.symbol-link:link,
a.symbol-link:visited {
  color: #ffffff !important;
  font-weight: 700 !important;
}

a.symbol-link:hover,
a.symbol-link:active {
  color: #ffffff !important;
  text-decoration: underline !important;
  opacity: 0.9 !important;
  font-weight: 700 !important;
}

@media (max-width: 520px) {
  .tf-cards {
    grid-template-columns: 1fr;
  }

  .sparks {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  #grid {
    grid-template-columns: 1fr;
  }

  .card table th,
  .card table td {
    font-size: 12px;
  }
}

/* 多周期共振迷你热力图 - 仅在有共振时显示 */
.mtf-mini-resonance {
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}

.mtf-mini-grid {
  display: inline-flex;
  gap: 1px;
  align-items: center;
}

.mtf-mini-cell {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 3px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  line-height: 1;
}

.mtf-mini-cell:hover {
  transform: scale(1.3);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.mtf-mini-cell.bull-strong {
  background: #10b981;
  color: #000000;
  border: 0.5px solid #059669;
}

.mtf-mini-cell.bull-light {
  background: #a7f3d0;
  color: #000000;
  border: 0.5px solid #6ee7b7;
}

.mtf-mini-cell.bear-strong {
  background: #ef4444;
  color: #000000;
  border: 0.5px solid #dc2626;
}

.mtf-mini-cell.bear-light {
  background: #fecaca;
  color: #000000;
  border: 0.5px solid #fca5a5;
}

.mtf-mini-cell.neutral {
  background: #d1d5db;
  color: #000000;
  border: 0.5px solid #9ca3af;
}

/* 连续共振脉冲动画 */
[style*="📈"],
[style*="📉"] {
  animation: pulse-streak 1s ease-in-out infinite;
}

@keyframes pulse-streak {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* 骨架屏加载动画 */
.skeleton-row {
  background: var(--card);
}

.skeleton-text,
.skeleton-box,
.skeleton-badge {
  height: 16px;
  background: linear-gradient(90deg, #1a1f2a 25%, #252b38 50%, #1a1f2a 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-text {
  width: 80%;
  margin: 2px 0;
}

.skeleton-text.short {
  width: 50%;
}

.skeleton-box {
  width: 30px;
  height: 30px;
  border-radius: 2px;
}

.skeleton-badge {
  width: 60px;
  height: 24px;
  border-radius: 12px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* 加载中状态 */
.loading-overlay {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 41, 59, 0.95);
  color: var(--fg);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 图标说明图例 */
.icon-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin: 4px 0 12px 0;
  color: var(--muted);
  font-size: 12px;
  padding: 0 8px;
}

.icon-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================
   响应式设计 - 手机优化
   ========================================== */

/* 小屏幕：表格横向滚动 */
@media (max-width: 768px) {
  .container {
    padding: 12px 8px;
  }

  h1 {
    font-size: 18px;
    margin: 4px 0 8px 0;
    padding: 0 4px;
  }

  #status {
    gap: 8px;
    margin: 4px 4px 0 4px;
    font-size: 12px;
  }

  .info-box {
    margin: 8px 4px;
    padding: 10px;
    font-size: 12px;
  }

  /* 表格横向滚动容器 */
  #table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -8px;
  }

  table {
    min-width: 640px;
    /* 保证表格完整显示 */
    font-size: 13px;
  }

  th,
  td {
    padding: 8px 6px;
    white-space: nowrap;
  }

  /* 热力图在手机上略小 */
  .mtf-mini-cell {
    width: 20px;
    height: 20px;
    font-size: 7px;
  }

  .mtf-mini-cell:hover {
    transform: scale(1.5);
  }
}

/* 超小屏幕：进一步优化 */
@media (max-width: 480px) {
  h1 {
    font-size: 16px;
  }

  table {
    font-size: 12px;
  }

  th,
  td {
    padding: 6px 4px;
  }

  /* 热力图更紧凑 */
  .mtf-mini-cell {
    width: 16px;
    height: 16px;
    font-size: 6px;
  }

  .mtf-mini-grid {
    gap: 0.5px;
  }

  /* 状态栏在小屏上换行 */
  #status {
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
  }

  #status button {
    width: 100%;
    padding: 8px 12px !important;
  }
}

/* Default hidden for desktop */
#card-view {
  display: none;
}

/* 确保在大于 768px 的屏幕上显示表格，隐藏卡片 */
@media (min-width: 769px) {
  #table-wrapper {
    display: block !important;
  }

  #card-view {
    display: none !important;
  }

  #cards-wrapper {
    display: none !important;
  }
}

/* 超超小屏幕（窄手机）：卡片布局 */
@media (max-width: 480px) {

  /* 隐藏表格，显示卡片 */
  #list {
    display: none;
  }

  #card-view {
    display: block;
  }

  .symbol-card {
    background: var(--card);
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
  }

  /* Share Button */
  .share-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--fg);
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
  }

  .share-btn:hover {
    background: var(--up);
    color: #000;
    border-color: var(--up);
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.4);
  }

  .symbol-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #30363d;
  }

  .symbol-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
  }

  .symbol-card-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--fg);
  }

  .symbol-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
  }

  .symbol-card-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .symbol-card-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
  }

  .symbol-card-value {
    font-size: 14px;
    font-weight: 600;
  }

  .symbol-card-heatmap {
    grid-column: 1 / -1;
    margin-top: 4px;
    overflow-x: auto;
  }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
  h1 {
    font-size: 16px;
    margin: 2px 0 6px 0;
  }

  #status {
    font-size: 11px;
    gap: 6px;
  }

  .info-box {
    margin: 6px 4px;
    padding: 8px;
    font-size: 11px;
  }

  th,
  td {
    padding: 6px 4px;
  }
}

/* ==========================================
   全局移动端优化 - 触摸与输入
   ========================================== */

/* 防止 iOS 输入框自动缩放 (需要 font-size >= 16px) */
@media (max-width: 768px) {

  input[type="text"],
  input[type="number"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* 确保触摸目标足够大 (最小 44px) */
  button,
  .chip,
  a.symbol-link {
    min-height: 44px;
    min-width: 44px;
  }

  button {
    padding: 12px 16px;
    font-size: 15px;
  }

  /* 搜索框移动端优化 */
  #search {
    flex-direction: column;
    gap: 10px;
  }

  #search input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: var(--card);
    color: var(--fg);
    border: 1px solid #30363d;
  }

  #search button {
    width: 100%;
  }

  /* 信息提示框移动端样式 */
  .info-box {
    margin: 8px;
    padding: 12px;
    font-size: 13px;
    background: var(--card);
    border: 1px solid #30363d;
    border-radius: 8px;
    line-height: 1.5;
  }
}

/* 超小屏幕进一步优化 */
@media (max-width: 400px) {
  .container {
    padding: 6px;
  }

  h1 {
    font-size: 15px;
  }

  #status {
    font-size: 10px;
  }

  .info-box {
    font-size: 11px;
    padding: 8px;
  }

  /* 隐藏非必要信息以节省空间 */
  .info-box br {
    display: none;
  }

  .info-box {
    display: none;
    /* 在极窄屏幕上隐藏提示信息 */
  }
}

/* ==========================================
   双金叉/双死叉告警样式 - 核心功能突出显示
   ========================================== */

/* 双金叉徽章基础样式 - 镂空风格 */
.badge-double-golden {
  background: rgba(251, 191, 36, 0.15) !important;
  color: #fbbf24 !important;
  border: 1px solid #fbbf24 !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
  animation: goldenPulse 2s ease-in-out infinite;
}

/* 双死叉徽章基础样式 - 镂空风格 */
.badge-double-death {
  background: rgba(248, 113, 113, 0.15) !important;
  color: #f87171 !important;
  border: 1px solid #f87171 !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.4);
  animation: deathPulse 2s ease-in-out infinite;
}

/* 脉冲动画 - 更柔和的呼吸效果 */
@keyframes goldenPulse {

  0%,
  100% {
    box-shadow: 0 0 5px rgba(251, 191, 36, 0.3), inset 0 0 5px rgba(251, 191, 36, 0.1);
  }

  50% {
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.6), inset 0 0 10px rgba(251, 191, 36, 0.2);
  }
}

@keyframes deathPulse {

  0%,
  100% {
    box-shadow: 0 0 5px rgba(248, 113, 113, 0.3), inset 0 0 5px rgba(248, 113, 113, 0.1);
  }

  50% {
    box-shadow: 0 0 12px rgba(248, 113, 113, 0.6), inset 0 0 10px rgba(248, 113, 113, 0.2);
  }
}

/* 有信号的表格行高亮 - 稍微调淡一点 */
tr.has-signal {
  background: rgba(252, 211, 77, 0.05) !important;
}

tr.has-signal td {
  background: rgba(252, 211, 77, 0.05) !important;
}

tr.has-death-signal {
  background: rgba(248, 113, 113, 0.05) !important;
}

tr.has-death-signal td {
  background: rgba(248, 113, 113, 0.05) !important;
}

/* 信号列专用样式 */
.col-signal {
  min-width: 100px;
  text-align: center;
}

/* 图标样式调整 */
.signal-icon {
  display: inline-block;
  margin-right: 2px;
}

.badge-double-golden .signal-icon {
  /* 恢复图标原色 (金色闪电) */
  filter: none;
}

.signal-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

/* 新信号指示点 */
.new-signal-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  margin-left: 4px;
  animation: dotBlink 1s ease-in-out infinite;
}

@keyframes dotBlink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* =========================================
   移动端优化 - 紧凑型头部
   ========================================= */

/* 头部容器 */
.header-section {
  background: var(--card);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #30363d;
}

.header-title-row h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 状态行聚合 (左侧时间+延迟，右侧计数) */
.status-row-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--fg-secondary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #30363d;
}

.status-left {
  display: flex;
  gap: 8px;
}

.latency {
  font-family: monospace;
}

.latency.good {
  color: #10b981;
}

.latency.medium {
  color: #f59e0b;
}

.latency.bad {
  color: #ef4444;
}

/* 操作按钮网格 (3 cols) */
/* 操作按钮网格 (4 items: Refresh, Lang, History, Help) */
.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.action-grid button,
.action-grid .btn-history,
.action-grid .btn-help {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  text-decoration: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.action-grid button:hover,
.action-grid .btn-history:hover,
.action-grid .btn-help:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#refreshBtn {
  background: #2563eb;
  color: white;
}

.btn-history {
  background: #c2410c;
  color: white;
}

.btn-help {
  background: #4b5563;
  color: white;
}

/* 统计条 (紧凑横条) */
.stats-bar-compact {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.stats-content {
  display: flex;
  gap: 12px;
  align-items: center;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-val.golden {
  color: #fbbf24;
  font-weight: bold;
}

.stat-val.death {
  color: #f87171;
  font-weight: bold;
}

.stat-val.total {
  color: var(--fg);
  font-weight: bold;
}

/* 声音开关微型化 */
.sound-toggle-mini {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  color: var(--fg-secondary);
  transition: all 0.2s;
}

.sound-toggle-mini.active {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

/* 搜索框紧凑化 */
.search-container.compact-search {
  margin: 0 0 12px 0;
  padding: 0;
  display: flex;
  gap: 8px;
}

.search-container.compact-search input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
  font-size: 14px;
}

.search-container.compact-search input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.search-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.search-btn:active {
  transform: translateY(0);
}

/* 移动端媒体查询调整 */
@media (max-width: 768px) {
  .container {
    padding: 8px;
  }

  .header-section {
    padding: 10px;
    margin-bottom: 8px;
  }

  /* 在超小屏幕上隐藏部分非核心文字 */
  .status-left span:first-child {
    /* 隐藏具体时间，只留延迟和倒计时，或精简显示 */
  }

  /* 调整卡片间距 */
  .symbol-card {
    margin-bottom: 8px;
  }


  /* 表格隐藏 (index-fast.js 已有逻辑，这里作为辅助) */
  .table-container {
    display: none;
  }

  #card-view {
    display: block;
    /* Fix: Flex default is row, causing horizontal stack. Block is better for vertical list */
  }

  /* 移动端卡片高亮样式 */
  .symbol-card.has-double-cross {
    border: 1px solid #fbbf24 !important;
    background: rgba(251, 191, 36, 0.05);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.2);
  }

  .symbol-card.has-double-death {
    border: 1px solid #f87171 !important;
    background: rgba(248, 113, 113, 0.05);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.2);
  }
}

/* Add missing badge styles for Double Cross */
.badge-double-golden {
  border-color: #fbbf24 !important;
  color: #fbbf24 !important;
  background: rgba(251, 191, 36, 0.1) !important;
}

.badge-double-death {
  border-color: #f87171 !important;
  color: #f87171 !important;
  background: rgba(248, 113, 113, 0.1) !important;
}

/* 桌面端兼容 (大于768px时，保持原有大致布局或适配新布局) */
@media (min-width: 769px) {
  .action-grid {
    display: flex;
    /* 桌面端恢复横排或保持Grid但限制宽度 */
    width: auto;
    justify-content: flex-start;
  }

  .action-grid button,
  .action-grid .btn-history,
  .action-grid .btn-help {
    width: auto;
    padding: 6px 16px;
  }

  .table-container {
    display: block;
    overflow-x: auto;
    width: 100%;
  }

  #card-view {
    display: none;
  }
}

/* Install App Button - Shiny and Eye-catching */
#installAppBtn {
  background: linear-gradient(135deg, #FFD700, #FFA500) !important;
  color: #000 !important;
  border: none !important;
  font-weight: 800 !important;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
  animation: shine-pulse 2s infinite;
  display: inline-block;
  margin-left: 4px;
}

#installAppBtn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

@keyframes shine-pulse {
  0% {
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.4);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    transform: scale(1.02);
  }

  100% {
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.4);
    transform: scale(1);
  }
}

/* Install Guide Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.modal-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s ease;
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid #30363d;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-btn {
  background: none;
  border: none;
  color: #8b949e;
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
}

.modal-body {
  padding: 20px 16px;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid #30363d;
  text-align: right;
}

.guide-step {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.guide-step:last-child {
  margin-bottom: 0;
}

.step-icon {
  width: 40px;
  height: 40px;
  background: #21262d;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid #30363d;
}

.step-text {
  flex: 1;
  font-size: 14px;
  color: #e6edf3;
  line-height: 1.4;
}

.ios-share-icon {
  color: #3b82f6;
}

.ios-add-icon {
  color: #e6edf3;
  background: #30363d;
}

.btn-primary {
  background: #238636;
  color: #ffffff;
  border: 1px solid rgba(27, 31, 35, 0.15);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.footer {
  margin-top: 24px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid rgba(48, 54, 61, 0.3);
}

.btn-download {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%) !important;
  color: #000 !important;
  font-weight: 700 !important;
  border: none !important;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.btn-download:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.stat-item {
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.stat-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.stat-item.active {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.1);
}

/* ==========================================
   Web Signal Alerts & Toast System
   ========================================== */

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 250px;
  max-width: 350px;
  padding: 16px;
  background: rgba(13, 17, 23, 0.95);
  border: 1px solid #30363d;
  border-left: 4px solid var(--accent-gold);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: #fff;
  backdrop-filter: blur(10px);
  animation: slideInRight 0.3s ease forwards;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.toast.golden {
  border-left-color: #fbbf24;
}

.toast.death {
  border-left-color: #f87171;
}

.toast:hover {
  transform: translateY(-2px);
}

.toast.fade-out {
  opacity: 0;
  transform: translateX(100%);
  transition: 0.3s;
}

.toast-title {
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-body {
  font-size: 0.9rem;
  opacity: 0.8;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Signal Highlight Animation */
@keyframes signalPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(243, 186, 47, 0.4);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(243, 186, 47, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(243, 186, 47, 0);
  }
}

.signal-card-new {
  animation: signalPulse 2s 3;
  /* Pulse 3 times then stop */
  border: 2px solid var(--accent-gold) !important;
}

.signal-row-new {
  animation: rowFlash 2s 3;
}

@keyframes rowFlash {
  0% {
    background: rgba(243, 186, 47, 0.1);
  }

  50% {
    background: rgba(243, 186, 47, 0.3);
  }

  100% {
    background: rgba(243, 186, 47, 0.1);
  }

  /* ==========================================
   Advanced App Features: Settings & Floating UI
   ========================================== */

  /* Settings Modal Specifics */
  .settings-group {
    margin-bottom: 24px;
  }

  .settings-group h4 {
    margin: 0 0 12px 0;
    color: var(--accent-gold);
    font-size: 14px;
  }

  .settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #30363d;
  }

  .settings-item:last-child {
    border-bottom: none;
  }

  .settings-label {
    display: flex;
    flex-direction: column;
  }

  .settings-title {
    font-size: 15px;
    font-weight: 600;
  }

  .settings-desc {
    font-size: 11px;
    color: var(--muted);
  }

  /* Toggle Switch */
  .switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
  }

  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #30363d;
    transition: .4s;
    border-radius: 24px;
  }

  .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
  }

  input:checked+.slider {
    background-color: #238636;
  }

  input:checked+.slider:before {
    transform: translateX(20px);
  }

  /* Floating Signal Widget */
  #floating-widget {
    position: fixed;
    top: 100px;
    right: 10px;
    width: 60px;
    height: 60px;
    background: var(--card);
    border: 2px solid var(--accent-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    z-index: 9995;
    cursor: move;
    animation: bounceSoft 2s infinite;
    display: none;
    /* Hidden by default */
    touch-action: none;
  }

  @keyframes bounceSoft {

    0%,
    100% {
      transform: translateY(0) scale(1);
    }

    50% {
      transform: translateY(-5px) scale(1.05);
    }
  }

  .floating-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
  }