/* ===== 全局重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100vh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f5f7fa;
  color: #333;
}

/* ===== Hero 页头 ===== */
.hero {
  position: relative;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  text-align: center;
  overflow: hidden;
  flex-shrink: 0;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('/css/header-bg.jpg');
  background-size: cover;
  background-position: center 30%;
  opacity: 0.5;
  mix-blend-mode: overlay;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(30,30,60,0.3) 0%, rgba(60,30,90,0.3) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
  letter-spacing: 2px;
}

.hero .subtitle {
  margin-top: 4px;
  font-size: 16px;
  color: rgba(255,255,255,0.95);
  letter-spacing: 4px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.2);
}

/* ===== 主内容区 ===== */
.main-container {
  height: calc(100vh - 110px);
  padding: 10px 12px;
  width: 100%;
}

/* ===== 四列布局 ===== */
.four-col-row {
  display: flex;
  flex-direction: row;
  gap: 10px;
  height: 100%;
  min-height: 0;
}

.four-col-row > .rank-section {
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.four-col-row > .latest-section {
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.four-col-row > .right-panel {
  flex: 1;
  min-width: 0;
}

/* ===== 排行榜卡片 ===== */
.rank-section {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #eeeef3;
  min-height: 0;
}

.rank-section.rank-fast {
  border-top: 3px solid #0a9e7a;
  background: #f0faf7;
}

.rank-section.rank-slow {
  border-top: 3px solid #d14545;
  background: #fef5f5;
}

.rank-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #f0f0f5;
  flex-shrink: 0;
}

.rank-header .icon {
  font-size: 18px;
}

.rank-header .count-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 10px;
}

.rank-fast .rank-header { color: #0a9e7a; }
.rank-fast .rank-header .count-badge { background: #e6f7f2; color: #0a9e7a; }
.rank-slow .rank-header { color: #d14545; }
.rank-slow .rank-header .count-badge { background: #fde8e8; color: #d14545; }

/* ===== 组内上下分区（小学组上 / 中学组下） ===== */
.rank-subgroups {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.rank-subgroup {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.rank-subgroup:first-child {
  border-bottom: none;
}

.rank-sep {
  height: 2px;
  background: repeating-linear-gradient(90deg,
    rgba(0,0,0,0.10) 0px,
    rgba(0,0,0,0.10) 6px,
    transparent 6px,
    transparent 12px
  );
  flex-shrink: 0;
  margin: 0 8px;
}

.group-subheader {
  font-size: 13px;
  font-weight: 700;
  padding: 5px 14px 3px;
  color: #888;
  letter-spacing: 1px;
  flex-shrink: 0;
}

/* ===== 排行列表 ===== */
.rank-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0;
}

.rank-list::-webkit-scrollbar {
  width: 4px;
}
.rank-list::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}

.rank-empty {
  padding: 10px;
  text-align: center;
  color: #bbb;
  font-size: 12px;
}

.rank-item {
  display: flex;
  align-items: center;
  padding: 5px 12px;
  gap: 8px;
  transition: background 0.15s;
  border-bottom: 1px solid #f5f5f8;
}

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

.rank-item:hover {
  background: #fafbfc;
}

.rank-num {
  width: 26px;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  flex-shrink: 0;
  color: #999;
}

.rank-item:nth-child(1) .rank-num { color: #ffd700; font-size: 18px; }
.rank-item:nth-child(2) .rank-num { color: #b0b0b0; font-size: 16px; }
.rank-item:nth-child(3) .rank-num { color: #cd7f32; font-size: 16px; }

.rank-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #444;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-time {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.rank-fast .rank-time { color: #0a9e7a; }
.rank-slow .rank-time { color: #d14545; }

.rank-date {
  font-size: 11px;
  font-weight: 500;
  color: #999;
  flex-shrink: 0;
  background: #f0f0f5;
  padding: 2px 8px;
  border-radius: 8px;
  line-height: 1.5;
}

/* ===== 最新成绩 ===== */
.latest-section {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #eeeef3;
  border-top: 3px solid #667eea;
  min-height: 0;
}

.latest-section .rank-header { color: #667eea; }
.latest-section .rank-header .count-badge { background: #eef0ff; color: #667eea; }

.latest-grid {
  flex: 1;
  display: grid;
  /* 每行保底 36px，行距更舒适；超出 15 条可滚动查看 */
  grid-template-rows: repeat(15, minmax(36px, 1fr));
  grid-auto-rows: minmax(36px, auto);
  min-height: 0;
  overflow-y: auto;
}

.latest-grid::-webkit-scrollbar { width: 4px; }
.latest-grid::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.latest-item {
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid #f0f0f5;
}

.latest-name {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.latest-time {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 22px;
  font-weight: 800;
  color: #667eea;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.latest-created {
  font-size: 12px;
  color: #999;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ===== 右侧面板 ===== */
.right-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  border: 1px solid #eeeef3;
  background: #fff;
  min-height: 0;
}

.panel-nav-links {
  position: absolute;
  right: 12px;
  bottom: 10px;
  display: flex;
  gap: 8px;
  z-index: 5;
}
.panel-nav-links a {
  color: #aaa;
  text-decoration: none;
  font-size: 12px;
  transition: color 0.2s;
}
.panel-nav-links a:hover {
  color: #64b4ff;
  text-decoration: underline;
}

.track-bg-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 12px;
}

.track-bg-img {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg,
      transparent 0px, transparent 40px, rgba(0,0,0,0.015) 40px, rgba(0,0,0,0.015) 41px
    ),
    linear-gradient(90deg,
      transparent calc(33.33% - 0.5px), rgba(0,0,0,0.07) calc(33.33% - 0.5px),
      rgba(0,0,0,0.02) calc(33.33% + 1px), transparent calc(33.33% + 1px),
      transparent calc(66.66% - 0.5px), rgba(0,0,0,0.07) calc(66.66% - 0.5px),
      rgba(0,0,0,0.02) calc(66.66% + 1px), transparent calc(66.66% + 1px)
    ),
    linear-gradient(90deg,
      rgba(0,0,0,0.08) 0px, rgba(0,0,0,0.02) 2px, transparent 2px,
      transparent calc(100% - 2px), rgba(0,0,0,0.02) calc(100% - 2px), rgba(0,0,0,0.08) 100%
    ),
    linear-gradient(90deg,
      rgba(0,180,140,0.04) 0%, transparent 33.33%,
      rgba(102,126,234,0.04) 33.33%, transparent 66.66%,
      rgba(220,160,0,0.04) 66.66%, transparent 100%
    ),
    linear-gradient(175deg, #e2e5ec 0%, #eef0f4 30%, #f5f6f8 50%, #eef0f4 70%, #e2e5ec 100%);
}

.track-bg-img::before {
  content: '';
  position: absolute;
  top: 0; left: 3px; right: 3px;
  height: 18px;
  background: repeating-conic-gradient(#333 0% 25%, #fff 0% 50%) 0 0 / 10px 10px;
  opacity: 0.3;
  border-radius: 0 0 3px 3px;
  pointer-events: none;
  z-index: 1;
}

.track-bg-img::after {
  content: '';
  position: absolute;
  bottom: 0; left: 3px; right: 3px;
  height: 8px;
  background: repeating-conic-gradient(#666 0% 25%, transparent 0% 50%) 0 0 / 8px 8px;
  opacity: 0.12;
  pointer-events: none;
  z-index: 1;
}

.right-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
  /* 顶部留出起跑线格纹带（18px）的高度，避免标题与格纹重叠 */
  padding: 24px 10px 6px;
  min-height: 0;
}

.track-title {
  text-align: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.track-title h2 {
  font-size: 17px;
  font-weight: 700;
  color: #333;
  letter-spacing: 1px;
}

.connection-status {
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  color: #888;
  line-height: 1;
}

.ws-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transition: background 0.3s;
}
.ws-indicator.ws-connected { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.6); }
.ws-indicator.ws-disconnected { background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,0.6); }
.ws-indicator.ws-connecting { background: #fbbf24; box-shadow: 0 0 6px rgba(251,191,54,0.6); animation: ws-pulse 1s ease-in-out infinite; }

@keyframes ws-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.update-source {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  transition: all 0.3s;
  opacity: 0;
}
.update-source.ws-push { background: rgba(74,222,128,0.2); color: #4ade80; opacity: 1; }
.update-source.polling { background: rgba(251,191,54,0.2); color: #d8a000; opacity: 1; }
.update-source.flash { animation: source-flash 0.6s ease-out; }

@keyframes source-flash {
  0% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== 赛道容器 ===== */
.lanes-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.lanes-container::-webkit-scrollbar { width: 3px; }
.lanes-container::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* 仅 3 条赛道时（456 关闭），卡片适度加高并均匀分布，紧凑不空旷 */
.lanes-container.tracks-456-off .lane-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}
.lanes-container.tracks-456-off .lane-card {
  flex: 0 0 auto;
  min-height: 100px;
  align-content: center;
  padding: 10px 12px;
  margin: 0;
}
/* 仅一组赛道时，「主赛道 A」分组标签无意义，隐藏 */
.lanes-container.tracks-456-off .lane-group-label {
  display: none;
}

.lane-group-label {
  font-size: 11px;
  font-weight: 700;
  color: #999;
  text-align: center;
  padding: 3px 0;
  letter-spacing: 1px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.lane-separator {
  display: flex;
  align-items: center;
  padding: 3px 0;
  flex-shrink: 0;
}

.lane-separator-line {
  flex: 1;
  height: 2px;
  background: repeating-linear-gradient(90deg,
    rgba(0,0,0,0.10) 0px, rgba(0,0,0,0.10) 6px, transparent 6px, transparent 12px
  );
}

/* ===== 赛道卡片 ===== */
.lane-card {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  grid-template-rows: auto auto;
  gap: 0;
  padding: 6px 10px;
  margin: 2px 0;
  border-radius: 8px;
  transition: all 0.2s;
  position: relative;
  backdrop-filter: blur(4px);
}

.lane-card.lane-1 { background: rgba(255,255,255,0.92); border: 1.5px solid rgba(0,180,140,0.3); }
.lane-card.lane-2 { background: rgba(255,255,255,0.92); border: 1.5px solid rgba(102,126,234,0.3); }
.lane-card.lane-3 { background: rgba(255,255,255,0.92); border: 1.5px solid rgba(220,160,0,0.3); }
.lane-card.lane-4 { background: rgba(255,255,255,0.92); border: 1.5px solid rgba(230,126,34,0.3); }
.lane-card.lane-5 { background: rgba(255,255,255,0.92); border: 1.5px solid rgba(0,188,212,0.3); }
.lane-card.lane-6 { background: rgba(255,255,255,0.92); border: 1.5px solid rgba(233,30,99,0.3); }

.lane-left {
  grid-row: 1; grid-column: 1;
  display: flex; align-items: center; justify-content: center;
}

.lane-number {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; flex-shrink: 0;
}

.lane-1 .lane-number { background: rgba(0,180,140,0.18); color: #00b48c; border: 2px solid rgba(0,180,140,0.35); }
.lane-2 .lane-number { background: rgba(102,126,234,0.18); color: #667eea; border: 2px solid rgba(102,126,234,0.35); }
.lane-3 .lane-number { background: rgba(220,160,0,0.18); color: #d8a000; border: 2px solid rgba(220,160,0,0.35); }
.lane-4 .lane-number { background: rgba(230,126,34,0.18); color: #e67e22; border: 2px solid rgba(230,126,34,0.35); }
.lane-5 .lane-number { background: rgba(0,188,212,0.18); color: #00bcd4; border: 2px solid rgba(0,188,212,0.35); }
.lane-6 .lane-number { background: rgba(233,30,99,0.18); color: #e91e63; border: 2px solid rgba(233,30,99,0.35); }

.lane-center {
  grid-row: 1; grid-column: 2;
  display: flex; flex-direction: column; justify-content: center;
  min-width: 0; padding: 0 6px;
}

.lane-driver-name {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-self: flex-start;
}

.lane-1 .lane-driver-name { background: #00b48c; }
.lane-2 .lane-driver-name { background: #667eea; }
.lane-3 .lane-driver-name { background: #d8a000; }
.lane-4 .lane-driver-name { background: #e67e22; }
.lane-5 .lane-driver-name { background: #00bcd4; }
.lane-6 .lane-driver-name { background: #e91e63; }

.lane-driver-meta {
  display: flex; align-items: center; gap: 4px; margin-top: 1px;
}

.lane-driver-id {
  font-size: 11px; color: #999; background: rgba(0,0,0,0.04);
  padding: 1px 6px; border-radius: 3px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.lane-driver-school {
  font-size: 11px; color: #999; background: rgba(0,0,0,0.04);
  padding: 1px 6px; border-radius: 3px; font-weight: 500;
}

.lane-right {
  grid-row: 1; grid-column: 3;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
  gap: 2px; flex-shrink: 0;
}

.lane-time-display {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 20px; font-weight: 800; line-height: 1;
}
.lane-1 .lane-time-display { color: #00b48c; }
.lane-2 .lane-time-display { color: #667eea; }
.lane-3 .lane-time-display { color: #d8a000; }
.lane-4 .lane-time-display { color: #e67e22; }
.lane-5 .lane-time-display { color: #00bcd4; }
.lane-6 .lane-time-display { color: #e91e63; }

.lane-timing .lane-time-display {
  animation: timerPulse 0.8s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.4; }
}

/* 赛道结束、展示最终成绩时的高亮 */
.lane-time-display.time-highlight {
  animation: laneTimeHighlight 5s ease-out;
  border-radius: 6px;
  padding: 0 4px;
}

@keyframes laneTimeHighlight {
  0% { transform: scale(1); background: transparent; }
  10% {
    transform: scale(1.3);
    color: #ff9800;
    background: rgba(255, 193, 7, 0.38);
    text-shadow: 0 0 14px rgba(255, 152, 0, 0.95);
  }
  60% {
    transform: scale(1.08);
    color: #ff6d00;
    background: rgba(255, 193, 7, 0.24);
    text-shadow: 0 0 10px rgba(255, 109, 0, 0.85);
  }
  100% { transform: scale(1); background: transparent; text-shadow: none; }
}

/* 赛道结束、展示最终成绩时，整块卡片高亮 */
.lane-card.lane-done.finished-highlight {
  animation: laneCardFinished 5s ease-out;
  z-index: 2;
}

@keyframes laneCardFinished {
  0% {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: none;
    transform: scale(1);
  }
  12% {
    background: rgba(255, 232, 158, 0.98);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.75), 0 0 26px rgba(255, 152, 0, 0.7);
    transform: scale(1.025);
  }
  60% {
    background: rgba(255, 244, 205, 0.96);
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.45), 0 0 16px rgba(255, 152, 0, 0.4);
    transform: scale(1.01);
  }
  100% {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: none;
    transform: scale(1);
  }
}

.lane-status {
  display: flex; align-items: center; gap: 3px; flex-shrink: 0;
}

.status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.status-text { font-size: 11px; font-weight: 600; white-space: nowrap; }

.lane-waiting .status-dot { background: #adb5bd; }
.lane-waiting .status-text { color: #adb5bd; }
.lane-ready .status-dot { background: #2ecc71; box-shadow: 0 0 6px rgba(46,204,113,0.4); }
.lane-ready .status-text { color: #2ecc71; }
.lane-timing .status-dot { background: #f39c12; box-shadow: 0 0 8px rgba(243,156,18,0.6); animation: dotPulse 0.8s ease-in-out infinite; }
.lane-timing .status-text { color: #f39c12; }

@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.7; }
}

.lane-done .status-dot { background: #3498db; box-shadow: 0 0 6px rgba(52,152,219,0.4); }
.lane-done .status-text { color: #3498db; }

.lane-contestants {
  grid-row: 2; grid-column: 1 / -1;
  margin-top: 3px; padding-top: 3px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.lane-contestants-title { font-size: 11px; color: #999; margin-bottom: 2px; font-weight: 500; }
.lane-contestants-list { display: flex; flex-wrap: wrap; gap: 2px; }

.contestant-tag {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 700; color: #fff;
}
.lane-1 .contestant-tag { background: #00b48c; }
.lane-2 .contestant-tag { background: #667eea; }
.lane-3 .contestant-tag { background: #d8a000; }
.lane-4 .contestant-tag { background: #e67e22; }
.lane-5 .contestant-tag { background: #00bcd4; }
.lane-6 .contestant-tag { background: #e91e63; }

.contestant-tag small { font-weight: 500; font-size: 9px; opacity: 0.8; }

/* ===== WebSocket 闪烁提示 ===== */
@keyframes lane-ws-flash {
  0% { box-shadow: 0 0 0 0 rgba(74,222,128,0.5); }
  70% { box-shadow: 0 0 0 6px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}
.lane-card.ws-flash { animation: lane-ws-flash 0.5s ease-out; }

/* ===== 高亮闪烁 ===== */
@keyframes matchHighlight {
  0%, 100% { background-color: transparent; border-left-color: #ffc107; }
  25% { background-color: #fff3cd; border-left-color: #ff9800; }
  50% { background-color: #ffe082; border-left-color: #ff5722; }
  75% { background-color: #fff3cd; border-left-color: #ff9800; }
}
@keyframes matchGlow {
  0%, 100% { box-shadow: inset 3px 0 6px -3px rgba(255,193,7,0.3); }
  50% { box-shadow: inset 3px 0 10px -2px rgba(255,152,0,0.7); }
}
.rank-item.match-highlight,
.latest-item.match-highlight {
  animation: matchHighlight 1s ease-in-out 20, matchGlow 1s ease-in-out 20;
  border-left: 3px solid #ffc107;
  font-weight: 600;
}

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .four-col-row {
    flex-wrap: wrap;
    overflow-y: auto;
  }
  .four-col-row > .rank-section,
  .four-col-row > .latest-section {
    flex: 1 1 45%;
    min-height: 200px;
  }
  .four-col-row > .right-panel {
    flex: 1 1 100%;
    min-height: 300px;
  }
  .latest-item { padding: 4px 12px; }
  .latest-name { font-size: 15px; }
  .latest-time { font-size: 17px; }
  .latest-created { font-size: 11px; }
  .hero { height: 80px; }
  .hero h1 { font-size: 24px; }
  .main-container { height: calc(100vh - 80px); }
}

@media (max-width: 600px) {
  .four-col-row > .rank-section,
  .four-col-row > .latest-section {
    flex: 1 1 100%;
    min-height: 150px;
  }
  .rank-header { padding: 8px 12px; font-size: 14px; }
  .rank-item { padding: 4px 10px; }
  .latest-item { padding: 3px 10px; }
  .latest-name { font-size: 14px; }
  .latest-time { font-size: 15px; }
  .latest-created { font-size: 10px; }
  .lane-card { padding: 5px 8px; }
  .lane-number { width: 28px; height: 28px; font-size: 13px; }
  .lane-driver-name { font-size: 13px; padding: 2px 8px; }
  .lane-time-display { font-size: 16px; }
  .right-panel { min-height: 250px; }
}

/* ===== 右下角测试工具 ===== */
.test-tools {
  position: fixed;
  right: 16px;
  bottom: 44px;
  display: none;
  gap: 8px;
  z-index: 900;
}

.test-tool-btn {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #333;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.test-tool-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22); }
.test-tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.test-tool-run { background: linear-gradient(135deg, #00b48c, #0a84ff); color: #fff; border-color: transparent; }
.test-tool-clear { background: linear-gradient(135deg, #ff7675, #d63031); color: #fff; border-color: transparent; }

.test-dialog-mask {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.48);
  z-index: 1000;
}
.test-dialog {
  width: min(360px, calc(100vw - 32px));
  background: #fff;
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}
.test-dialog-title { font-size: 17px; font-weight: 700; color: #222; margin-bottom: 6px; }
.test-dialog-tip { font-size: 12px; color: #888; line-height: 1.5; margin-bottom: 14px; }
.test-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.test-row label { width: 68px; font-size: 13px; color: #555; }
.test-row select,
.test-row input {
  flex: 1;
  height: 34px;
  padding: 0 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  color: #333;
  background: #fafafa;
}
.test-dialog-msg { min-height: 18px; font-size: 12px; color: #d63031; margin: 6px 0 12px; }
.test-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.test-toast {
  position: fixed;
  right: 16px;
  bottom: 96px;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.94);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1100;
}
.test-toast.show { opacity: 1; transform: translateY(0); }
.test-toast.error { background: rgba(214, 48, 49, 0.96); }

@media (max-width: 600px) {
  .test-tools { right: 10px; bottom: 40px; flex-direction: column; align-items: flex-end; }
  .test-tool-btn { padding: 7px 10px; font-size: 12px; }
  .test-toast { right: 10px; bottom: 110px; }
}
