/**
 * 充电桩大盘 - 样式文件
 * 商业级 UI 设计
 *
 * Design Tokens: src/css/tokens.css
 * 间距/圆角/字号/z-index 请优先使用 token 变量
 */

/* ==================== 全局 Focus-Visible ==================== */

:focus-visible {
  outline: 2px solid var(--color-brand, #10b981);
  outline-offset: 2px;
  border-radius: var(--radius-sm, 6px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[role="radio"]:focus-visible {
  outline: 2px solid var(--color-brand, #10b981);
  outline-offset: 2px;
}

/* 去掉鼠标点击时的 focus ring（只保留键盘触发） */
:focus:not(:focus-visible) {
  outline: none;
}

/* ==================== 基础设置 ==================== */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--color-bg-base, #0a0c10) 0%, #0d1117 50%, var(--color-bg-base, #0a0c10) 100%);
  color: var(--color-text-primary, #e6edf3);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

/* ==================== 背景斜水印 ==================== */

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  background-image: repeating-linear-gradient(
    -30deg,
    transparent,
    transparent 100px,
    rgba(148, 163, 184, 0.03) 100px,
    rgba(148, 163, 184, 0.03) 101px
  );
}

body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 0;
  will-change: auto;
  background-image: repeating-linear-gradient(
    -30deg,
    transparent 0,
    transparent 80px,
    rgba(148, 163, 184, 0.015) 80px,
    rgba(148, 163, 184, 0.015) 82px
  );
}

/* 水印文字层 */
#app::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* 降低 z-index，避免在所有内容之上触发合成 */
  z-index: 0;
  will-change: auto;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='150'%3E%3Ctext x='50%25' y='50%25' fill='rgba(148,163,184,0.06)' font-size='14' font-family='system-ui' text-anchor='middle' dominant-baseline='middle' transform='rotate(-25 200 75)'%3E飞书@pasca 个人制作，仅供内部参考%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ==================== 动画 ==================== */

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes ping {
  75%, 100% { transform: scale(2); opacity: 0; }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-spin {
  animation: spin 0.8s linear infinite;
}

.animate-in {
  animation: fade-in-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==================== 卡片状态 - 精致区分 ==================== */

.card-free {
  border-color: rgba(16, 185, 129, 0.3);
  background:
    linear-gradient(160deg, rgba(6, 78, 59, 0.22) 0%, rgba(6, 78, 59, 0.04) 60%, rgba(10, 12, 16, 0.3) 100%);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 8px 24px rgba(16, 185, 129, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.card-free:hover {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow:
    0 0 0 1px rgba(52, 211, 153, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.25),
    0 12px 40px rgba(16, 185, 129, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

/* ===== DC 空闲卡牌 - 宝藏秘境特效 ===== */

/* 金色扫光（GPU 加速：用 translateX 替代 left） */
@keyframes gold-sweep {
  0% { transform: translateX(-150%); }
  100% { transform: translateX(250%); }
}

.card-free.card-dc {
  border-color: rgba(251, 191, 36, 0.45);
  background: linear-gradient(
    160deg,
    rgba(120, 80, 10, 0.35) 0%,
    rgba(80, 50, 10, 0.15) 40%,
    rgba(6, 78, 59, 0.2) 70%,
    rgba(10, 20, 15, 0.3) 100%
  );
  position: relative;
  overflow: hidden;
  will-change: transform, opacity;
  transform: translateZ(0);
}

/* 金色扫光条纹 */
.card-free.card-dc::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 0;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(251, 191, 36, 0.06) 40%,
    rgba(252, 211, 77, 0.12) 45%,
    rgba(251, 191, 36, 0.06) 50%,
    transparent 55%
  );
  z-index: 2;
  pointer-events: none;
  animation: gold-sweep 5s ease-in-out infinite;
  animation-delay: 0.5s;
  will-change: transform;
}

.card-free.card-dc:hover {
  border-color: rgba(251, 191, 36, 0.8);
  box-shadow:
    0 0 0 2px rgba(251, 191, 36, 0.25),
    0 0 50px rgba(245, 158, 11, 0.2),
    0 12px 40px rgba(251, 191, 36, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(-3px);
}

/* 空闲 DC 图标区域改为金色 */
.card-free.card-dc .text-emerald-400 {
  color: #fbbf24 !important;
  transition: all 0.4s ease;
}

.card-free.card-dc .bg-emerald-400\/10 {
  background: rgba(251, 191, 36, 0.15);
}

.card-free.card-dc .bg-emerald-500\/10 {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.25);
}

.card-free.card-dc .border-emerald-500\/10 {
  border-color: rgba(251, 191, 36, 0.15);
}

/* DC 空闲卡牌空闲时长文字 */
.card-free.card-dc .font-mono {
  color: #fcd34d;
}

.card-charging {
  border-color: rgba(34, 211, 238, 0.35);
  background:
    linear-gradient(160deg, rgba(8, 51, 68, 0.25) 0%, rgba(8, 51, 68, 0.06) 60%, rgba(10, 12, 16, 0.3) 100%);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 8px 24px rgba(34, 211, 238, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.card-charging:hover {
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.15),
    0 4px 16px rgba(0, 0, 0, 0.25),
    0 12px 40px rgba(34, 211, 238, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

/* ==================== ElectricBorder for charging cards ==================== */

.electric-border {
  --electric-border-color: #7df9ff;
  --electric-light-color: #d7ffff;
  position: relative;
  border-radius: 1rem;
  overflow: visible;
  isolation: isolate;
}

@supports (color: color-mix(in srgb, red, white)) {
  .electric-border {
    --electric-light-color: color-mix(in srgb, var(--electric-border-color) 76%, white);
  }
}

.card-charging.electric-border {
  border-color: rgba(125, 249, 255, 0.42);
}

.card-charging.electric-border:hover {
  border-color: rgba(125, 249, 255, 0.72);
}

.eb-canvas-container {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.eb-canvas {
  display: block;
}

.eb-layers {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
}

.eb-glow-1,
.eb-glow-2,
.eb-background-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-sizing: border-box;
}

.eb-glow-1 {
  border: 2px solid rgba(125, 249, 255, 0.82);
  border: 2px solid color-mix(in srgb, var(--electric-border-color) 82%, transparent);
  filter: blur(1px);
}

.eb-glow-2 {
  border: 3px solid rgba(215, 255, 255, 0.78);
  border: 3px solid color-mix(in srgb, var(--electric-light-color) 78%, transparent);
  filter: blur(6px);
}

.eb-background-glow {
  z-index: -1;
  transform: scale(1.07);
  background: linear-gradient(-30deg, rgba(215, 255, 255, 0.34), transparent 50%, rgba(125, 249, 255, 0.3));
  background: linear-gradient(-30deg, color-mix(in srgb, var(--electric-light-color) 44%, transparent), transparent 50%, color-mix(in srgb, var(--electric-border-color) 38%, transparent));
  filter: blur(28px);
  opacity: 0.48;
}

.card-occupied {
  border-color: rgba(251, 146, 60, 0.3);
  background:
    linear-gradient(160deg, rgba(88, 45, 20, 0.22) 0%, rgba(68, 38, 20, 0.05) 60%, rgba(10, 12, 16, 0.3) 100%);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  box-shadow:
    0 0 0 1px rgba(251, 146, 60, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 8px 24px rgba(251, 146, 60, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.card-occupied:hover {
  border-color: rgba(251, 146, 60, 0.55);
  box-shadow:
    0 0 0 1px rgba(251, 146, 60, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.25),
    0 12px 40px rgba(251, 146, 60, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

/* ==================== DC 专属卡片 ==================== */

.card-dc {
  min-height: 340px;
}

/* ==================== 5kW 功率卡片特殊样式 ==================== */

.power-5kw {
  border-color: rgba(168, 85, 247, 0.4);
  background: linear-gradient(160deg, rgba(88, 28, 135, 0.25) 0%, rgba(88, 28, 135, 0.05) 100%);
}

.power-5kw:hover {
  border-color: rgba(192, 132, 252, 0.6);
  box-shadow:
    0 0 0 1px rgba(168, 85, 247, 0.15),
    0 0 30px rgba(168, 85, 247, 0.12),
    0 8px 32px rgba(168, 85, 247, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ==================== 进度条 ==================== */

@keyframes wave-flow {
  0% {
    background-position: 0% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes wave-pulse {
  0%, 100% {
    height: 2px;
    opacity: 0.7;
  }
  50% {
    height: 3px;
    opacity: 1;
  }
}

.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(34, 211, 238, 0.2) 0%, rgba(34, 211, 238, 0.05) 100%);
  overflow: hidden;
  transition: height 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(34, 211, 238, 0.4) 15%,
    rgba(103, 232, 249, 0.9) 30%,
    rgba(34, 211, 238, 1) 50%,
    rgba(103, 232, 249, 0.9) 70%,
    rgba(34, 211, 238, 0.4) 85%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: wave-flow 2s linear infinite, wave-pulse 1.5s ease-in-out infinite;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(103, 232, 249, 0.6) 25%,
    rgba(103, 232, 249, 1) 50%,
    rgba(103, 232, 249, 0.6) 75%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: wave-flow 1.2s linear infinite;
  filter: blur(1px);
}

/* ==================== Modal ==================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              backdrop-filter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: linear-gradient(145deg, var(--color-bg-elevated, #161b22) 0%, var(--color-bg-base, #0d1117) 100%);
  border: 1px solid var(--color-border-default, rgba(48, 54, 61, 0.8));
  border-radius: var(--radius-xl, 18px);
  padding: var(--space-6, 24px);
  width: 100%;
  max-width: 420px;
  margin: var(--space-4, 16px);
  transform: scale(0.92) translateY(16px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xl, 0 24px 80px rgba(0, 0, 0, 0.5));
  will-change: transform, opacity;
}

.modal-overlay.show .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ==================== Toast ==================== */

.toast {
  position: fixed;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-3, 12px) var(--space-5, 20px);
  border-radius: var(--radius-lg, 14px);
  font-size: var(--font-size-sm, 14px);
  font-weight: 500;
  z-index: var(--z-toast, 300);
  animation: toast-in 3.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  display: flex;
  align-items: center;
  gap: var(--space-2, 10px);
  box-shadow: var(--shadow-md, 0 8px 32px rgba(0, 0, 0, 0.3));
  will-change: transform, opacity;
}

.toast-success {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.95) 0%, rgba(6, 78, 59, 0.85) 100%);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #a7f3d0;
}

.toast-error {
  background: linear-gradient(135deg, rgba(88, 28, 28, 0.95) 0%, rgba(68, 20, 20, 0.85) 100%);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

@keyframes toast-in {
  0% { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(0.92); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  85% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.95); }
}

/* ==================== 留言替换动画 ==================== */

@keyframes comment-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.comment-replace-in {
  animation: comment-fade-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ==================== 卡片入场动画 ==================== */

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  60% {
    opacity: 1;
    transform: translateY(-2px) scale(1.002);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-card {
  animation: card-enter 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* 交错延迟：每个卡片递增 40ms */
.animate-card:nth-child(1)  { animation-delay: 0ms; }
.animate-card:nth-child(2)  { animation-delay: 40ms; }
.animate-card:nth-child(3)  { animation-delay: 80ms; }
.animate-card:nth-child(4)  { animation-delay: 120ms; }
.animate-card:nth-child(5)  { animation-delay: 160ms; }
.animate-card:nth-child(6)  { animation-delay: 200ms; }
.animate-card:nth-child(7)  { animation-delay: 240ms; }
.animate-card:nth-child(8)  { animation-delay: 280ms; }
.animate-card:nth-child(9)  { animation-delay: 320ms; }
.animate-card:nth-child(10) { animation-delay: 360ms; }
.animate-card:nth-child(11) { animation-delay: 400ms; }
.animate-card:nth-child(12) { animation-delay: 440ms; }
.animate-card:nth-child(13) { animation-delay: 480ms; }
.animate-card:nth-child(14) { animation-delay: 520ms; }
.animate-card:nth-child(15) { animation-delay: 560ms; }
.animate-card:nth-child(16) { animation-delay: 600ms; }
.animate-card:nth-child(17) { animation-delay: 640ms; }
.animate-card:nth-child(18) { animation-delay: 680ms; }
.animate-card:nth-child(19) { animation-delay: 720ms; }
.animate-card:nth-child(20) { animation-delay: 760ms; }

/* Reduced motion: 关闭动画 */
@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-content {
    transition: none;
  }
  .toast {
    animation: none;
    opacity: 1;
  }
  .comment-replace-in,
  .animate-card {
    animation: none;
  }
  .card-free.card-dc::before {
    animation: none;
  }
  .eb-background-glow {
    opacity: 0.18;
  }
}

/* ==================== 输入框 ==================== */

.input-field {
  width: 100%;
  padding: var(--space-3, 12px) var(--space-4, 16px);
  background: rgba(13, 17, 23, 0.8);
  border: 1px solid var(--color-border-default, rgba(48, 54, 61, 0.8));
  border-radius: var(--radius-md, 10px);
  color: var(--color-text-primary, #e6edf3);
  font-size: var(--font-size-sm, 14px);
  outline: none;
  transition: all 0.2s ease;
}

.input-field:focus {
  border-color: var(--color-brand, #10b981);
  box-shadow: 0 0 0 3px var(--color-brand-dim, rgba(16, 185, 129, 0.15));
  background: rgba(13, 17, 23, 1);
}

.input-field::placeholder {
  color: var(--color-text-tertiary, #6e7681);
}

/* ==================== 网格布局 ==================== */

.charger-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, 1fr);
}

.charger-grid-dc {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, 1fr);
}

/* 通用卡片过渡 - 更丝滑的 hover 微交互 */
.charger-grid > div,
.charger-grid-dc > div {
  transition:
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.3s ease;
  will-change: transform;
}

.charger-grid > div:hover,
.charger-grid-dc > div:hover {
  transform: translateY(-3px) scale(1.008);
}

@media (max-width: 1200px) {
  .charger-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
  .charger-grid { grid-template-columns: repeat(3, 1fr); }
  .charger-grid-dc { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .charger-grid { grid-template-columns: repeat(2, 1fr); }
  .charger-grid-dc { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .charger-grid { grid-template-columns: 1fr; }
  .charger-grid-dc { grid-template-columns: 1fr; }
}

/* ==================== 状态指示点 ==================== */

.status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.status-dot.free { background: #10b981; }
.status-dot.free::before { display: none; }

.status-dot.charging { background: #22d3ee; }
.status-dot.charging::before { background: #22d3ee; animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }

.status-dot.occupied { background: #f97316; }
.status-dot.occupied::before { display: none; }

/* ==================== 筛选按钮增强 ==================== */

.filter-btn {
  position: relative;
  overflow: hidden;
}

.filter-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.2s;
}

.filter-btn:hover::before {
  opacity: 1;
}

/* ==================== 滚动条美化 ==================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(13, 17, 23, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(48, 54, 61, 0.8);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(88, 96, 105, 0.8);
}

/* ==================== 导航 Tab ==================== */

.nav-tab {
  position: relative;
}

.nav-tab.active {
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.15);
}

/* ==================== 热力图 ==================== */

.heatmap-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 600px;
}

.heatmap-header,
.heatmap-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.heatmap-label {
  width: 40px;
  text-align: right;
  font-size: 12px;
  color: #64748b;
  padding-right: 8px;
  flex-shrink: 0;
}

.heatmap-hour {
  flex: 1;
  text-align: center;
  font-size: 10px;
  color: #475569;
  min-width: 20px;
}

.heatmap-cell {
  flex: 1;
  aspect-ratio: 1;
  border-radius: 3px;
  min-width: 28px;
  min-height: 28px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: default;
}

.heatmap-cell-text {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.heatmap-cell:hover {
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
  z-index: 10;
  position: relative;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  margin-top: 12px;
  padding-right: 4px;
}

.heatmap-legend .heatmap-cell {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  flex: none;
}

/* ==================== 移动端适配 ==================== */

@media (max-width: 768px) {
  /* 主内容区域底部留出导航栏+订阅栏空间 */
  main {
    padding-bottom: 130px;
  }

  /* 移动端底部导航栏 */
  #mobile-nav button {
    color: #64748b;
  }

  #mobile-nav button:disabled {
    opacity: 0.5;
  }

  /* 热力图允许横向滚动 */
  .heatmap-grid {
    min-width: 600px;
  }

  /* 筛选按钮栏可横向滚动 */
  .filter-bar-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .filter-bar-scroll::-webkit-scrollbar {
    display: none;
  }

  /* Header 在移动端紧凑排列 */
  header {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  header > div:first-child {
    min-width: 0;
  }
  header h1 {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 底部栏移动端适配 */
  #bottom-bar {
    max-width: calc(100% - 2rem);
  }
}

/* ==================== 安全区域适配（iPhone X 等） ==================== */

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* 移动端订阅栏定位在底部导航上方（需要在媒体查询外） */
.bottom-nav-spacing {
  bottom: 56px;
}

@media (max-width: 768px) {
  /* iPhone X 等有安全区域的设备，订阅栏需要额外上移 */
  .bottom-nav-spacing {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }
}

/* ==================== 引导弹窗 ==================== */

.guide-modal-content {
  max-width: 420px;
  padding: 20px;
}

.guide-header {
  text-align: center;
  margin-bottom: 16px;
}

.guide-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-top: 6px;
}

.guide-header-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2) 0%, rgba(34, 211, 238, 0.2) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* 功能区块 */
.guide-section {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(71, 85, 105, 0.3);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.guide-section:last-of-type {
  margin-bottom: 12px;
}

.guide-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.guide-section-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.15) 0%, rgba(52, 211, 153, 0.05) 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-section-icon.cyan {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.15) 0%, rgba(34, 211, 238, 0.05) 100%);
}

.guide-section-header h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f1f5f9;
}

.guide-section-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 10px 0 0 0;
}

/* 时间卡片 */
.guide-time-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.guide-time-card {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 8px;
  padding: 10px;
  border: 1px solid rgba(71, 85, 105, 0.2);
}

.guide-time-card-header {
  margin-bottom: 8px;
}

.guide-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 4px;
}

.guide-time-badge.green {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

.guide-time-badge.gray {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
}

.guide-time-card-body {
  text-align: center;
}

.guide-time-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 2px;
}

.guide-time-freq {
  font-size: 0.625rem;
  color: #64748b;
}

/* 订阅流程图 */
.flow-diagram {
  padding: 12px 0;
}

/* 主流程行 */
.flow-main {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
}

/* 分支行 */
.flow-branch-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-top: 16px;
}

/* 流程节点 */
.flow-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 60px;
}

/* 分支行中的隐藏占位符 */
.flow-branch-row .flow-spacer {
  visibility: hidden;
}

/* 图标容器 */
.flow-icon {
  width: 34px;
  height: 34px;
  background: rgba(22, 29, 41, 0.95);
  border: 1.5px solid rgba(71, 85, 105, 0.5);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}

/* 图标颜色 */
.flow-icon.mail { color: #22d3ee; border-color: rgba(34, 211, 238, 0.35); }
.flow-icon.bell { color: #34d399; border-color: rgba(52, 211, 153, 0.35); }
.flow-icon.clock { color: #34d399; border-color: rgba(52, 211, 153, 0.35); }
.flow-icon.check { color: #fff; background: linear-gradient(145deg, #10b981, #059669); border: none; box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3); }
.flow-icon.alert { color: #fbbf24; border-color: rgba(251, 191, 36, 0.35); }
.flow-icon.refresh { color: #34d399; border-color: rgba(52, 211, 153, 0.35); }

/* 文字标签 */
.flow-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: #e2e8f0;
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
}

.flow-sub {
  font-size: 0.5rem;
  color: #64748b;
  text-align: center;
  line-height: 1.2;
}

/* 箭头 */
.flow-arrow {
  display: flex;
  align-items: center;
  padding-top: 12px;
  margin: 0 2px;
}

.flow-arrow-line {
  width: 14px;
  height: 2px;
  background: rgba(100,116,139,0.5);
}

.flow-arrow-head {
  width: 0;
  height: 0;
  border-left: 5px solid rgba(100,116,139,0.5);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

/* 分支连接（从空闲5分钟向下） */
.flow-branch-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

/* 让 wrap 内的 flow-col 与外部 flow-col 宽度一致 */
.flow-branch-wrap .flow-col {
  min-width: 60px;
}

.flow-branch-tag {
  font-size: 0.5rem;
  color: #fbbf24;
  font-weight: 600;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
  padding: 2px 4px;
  border-radius: 4px;
  margin-top: 4px;
  white-space: nowrap;
}

.flow-branch-line {
  width: 2px;
  height: 16px;
  background: linear-gradient(180deg, rgba(251,191,36,0.5), rgba(251,191,36,0.2));
}

/* 状态文字颜色 */
.flow-col.success .flow-label { color: #a7f3d0; }
.flow-col.warn .flow-label { color: #fcd34d; }
.flow-col.keep .flow-label { color: #a7f3d0; }

/* 底部按钮 */
.guide-footer {
  display: flex;
  gap: 8px;
}

.guide-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.guide-btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.guide-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.guide-btn-secondary {
  background: rgba(51, 65, 85, 0.8);
  color: #94a3b8;
  border: 1px solid rgba(71, 85, 105, 0.6);
}

.guide-btn-secondary:hover {
  background: rgba(71, 85, 105, 0.8);
  color: #e2e8f0;
}

/* 移动端适配 */
@media (max-width: 480px) {
  .guide-modal-content {
    padding: 16px;
    margin: 8px;
    max-width: calc(100% - 16px);
  }

  .guide-section {
    padding: 12px;
  }

  .guide-time-cards {
    gap: 6px;
  }

  .guide-time-card {
    padding: 8px;
  }

  .guide-time-value {
    font-size: 0.8125rem;
  }

  .flow-icon {
    width: 28px;
    height: 28px;
  }

  .flow-label {
    font-size: 0.5rem;
  }

  .flow-sub {
    font-size: 0.375rem;
  }

  .flow-arrow-line {
    width: 10px;
  }

  .flow-col {
    min-width: 48px;
  }

  .guide-btn {
    padding: 9px 10px;
    font-size: 0.6875rem;
  }
}

/* ==================== 访问统计悬浮标牌 ==================== */

.visit-badge {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-left: none;
  border-radius: 0 12px 12px 0;
  padding: 14px 12px;
  writing-mode: vertical-rl;
  font-size: 13px;
  color: #94a3b8;
  letter-spacing: 0.08em;
  animation: badge-slide-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  user-select: none;
  pointer-events: none;
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.08);
}

.visit-badge .visit-count {
  color: #34d399;
  font-weight: 700;
  font-size: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  writing-mode: horizontal-tb;
  display: inline-block;
  margin: 6px 0;
}

@keyframes badge-slide-in {
  from {
    transform: translateY(-50%) translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .visit-badge {
    display: none;
  }
}

/* ==================== Skeleton 骨架屏 ==================== */

@keyframes shimmer-slide {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(30, 41, 59, 0.5) 25%,
    rgba(51, 65, 85, 0.4) 50%,
    rgba(30, 41, 59, 0.5) 75%
  );
  background-size: 800px 100%;
  animation: shimmer-slide 1.8s ease-in-out infinite;
  border-radius: var(--radius-md, 10px);
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-lg, 16px);
}

.skeleton-card-dc {
  height: 280px;
  border-radius: var(--radius-lg, 16px);
}

.skeleton-line {
  height: 12px;
  border-radius: var(--radius-sm, 6px);
  margin-bottom: var(--space-2, 8px);
}

.skeleton-line-short {
  width: 60%;
}

/* ==================== Empty 空状态 ==================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12, 48px) var(--space-4, 16px);
  text-align: center;
  color: var(--color-text-tertiary, #6e7681);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-3, 12px);
  opacity: 0.4;
  color: var(--color-text-disabled, #484f58);
}

.empty-state-title {
  font-size: var(--font-size-sm, 14px);
  font-weight: 600;
  color: var(--color-text-secondary, #94a3b8);
  margin-bottom: var(--space-1, 4px);
}

.empty-state-desc {
  font-size: var(--font-size-xs, 12px);
  color: var(--color-text-tertiary, #6e7681);
}

/* ==================== 统一按钮系统 ==================== */

/* 次级按钮 */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2, 8px);
  padding: var(--space-2, 8px) var(--space-4, 16px);
  font-size: var(--font-size-sm, 14px);
  font-weight: 500;
  color: var(--color-text-secondary, #94a3b8);
  background: rgba(51, 65, 85, 0.6);
  border: 1px solid var(--color-border-subtle, rgba(48, 54, 61, 0.4));
  border-radius: var(--radius-lg, 14px);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: rgba(71, 85, 105, 0.7);
  color: var(--color-text-primary, #e6edf3);
}

.btn-secondary:active {
  transform: scale(0.97);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* 危险按钮 */
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2, 8px);
  padding: var(--space-2, 8px) var(--space-4, 16px);
  font-size: var(--font-size-xs, 12px);
  font-weight: 600;
  color: #fca5a5;
  background: rgba(88, 28, 28, 0.5);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: rgba(127, 29, 29, 0.6);
  color: #fecaca;
}

.btn-danger:active {
  transform: scale(0.97);
}

/* ==================== 统一 disabled 状态 ==================== */

button:disabled,
[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== Radio 可视化焦点（sr-only 替代 hidden） ==================== */

input[type="radio"].sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input[type="radio"].sr-only:focus-visible + div {
  outline: 2px solid var(--color-brand, #10b981);
  outline-offset: 2px;
}

/* ==================== 错误状态增强 ==================== */

#error-state .error-hints {
  margin-top: var(--space-3, 12px);
  padding: var(--space-3, 12px) var(--space-4, 16px);
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--color-border-subtle, rgba(48, 54, 61, 0.4));
  border-radius: var(--radius-md, 10px);
  max-width: 320px;
}

#error-state .error-hints p {
  font-size: var(--font-size-xs, 12px);
  color: var(--color-text-tertiary, #6e7681);
  line-height: 1.6;
  margin: 0;
}

#error-state .error-hints p::before {
  content: '• ';
  color: var(--color-text-disabled, #484f58);
}
