* { box-sizing: border-box; }

body {
  margin: 0; background: #0f172a; color: #fff; font-family: sans-serif;
  height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
}

.hidden { display: none !important; }

/* ==================== 比赛选择页 ==================== */
.picker-view {
  flex: 1; overflow-y: auto; display: flex; justify-content: center;
  padding: 60px 20px 40px;
}
.picker-box { width: 100%; max-width: 860px; }
.picker-title { font-size: 34px; margin: 0 0 8px; color: #fbbf24; }

.picker-search-wrap { margin-bottom: 14px; }
.picker-search {
  width: 100%; height: 52px; padding: 0 22px; border-radius: 12px;
  border: 2px solid #3b82f6; background: #0b1120; color: #fbbf24;
  font-size: 20px; font-weight: bold; outline: none;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.25);
}
.picker-search::placeholder { color: #475569; font-size: 16px; font-weight: normal; }

.picker-list {
  border: 2px solid #334155; border-radius: 14px; background: #1e293b; overflow: hidden;
}
.picker-loading, .picker-empty {
  padding: 40px 20px; text-align: center; color: #94a3b8; font-size: 16px;
}
.picker-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  cursor: pointer; border-bottom: 1px solid #293548; transition: background 0.12s;
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover { background: #334155; }
.picker-item-main { flex: 1; min-width: 0; }
.picker-item-name {
  font-size: 17px; font-weight: bold; color: #f8fafc;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-item-alias { font-size: 13px; color: #64748b; font-family: monospace; margin-top: 3px; }
.picker-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.picker-item-date { font-size: 13px; color: #94a3b8; }
.status-tag {
  padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: bold;
  white-space: nowrap;
}
.tag-announced { background: #3b82f6; color: #eff6ff; }   /* 已公示 */
.tag-regopen   { background: #10b981; color: #064e3b; }   /* 报名中 */
.tag-paused    { background: #f59e0b; color: #451a03; }   /* 报名暂停 */
.tag-ongoing   { background: #ef4444; color: #fff1f2; animation: tag-pulse 1.5s infinite; } /* 进行中 */
.tag-ended     { background: #475569; color: #e2e8f0; }   /* 已结束 */
@keyframes tag-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.picker-footer { display: flex; justify-content: center; padding: 18px 0 0; }
.picker-more {
  padding: 10px 30px; border-radius: 10px; border: 1px solid #334155;
  background: transparent; color: #94a3b8; font-size: 14px; cursor: pointer;
}
.picker-more:hover { background: #1e293b; color: #fff; }

/* ==================== 核对看板页 ==================== */
.board-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* 顶部进度条 */
.progress-bg { width: 100%; height: 6px; background: #334155; position: fixed; top: 0; left: 0; z-index: 100; }
.progress-fill { height: 100%; background: #10b981; width: 0%; transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

.top-bar {
  height: 80px; background: #1e293b; display: flex; align-items: center; justify-content: space-between;
  padding: 0 30px; border-bottom: 2px solid #334155; margin-top: 6px; flex-shrink: 0;
}

.left-status { display: flex; gap: 16px; color: #94a3b8; font-size: 14px; align-items: center; flex: 1; min-width: 0; }
.left-status .group-select, .left-status .sync-label { flex-shrink: 0; }

.back-btn {
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid #475569;
  background: transparent; color: #94a3b8; font-size: 18px; cursor: pointer;
  flex-shrink: 0; transition: all 0.15s;
}
.back-btn:hover { background: #334155; color: #fff; }

.comp-name {
  font-size: 17px; font-weight: bold;
  max-width: 280px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; flex-shrink: 1;
}

.sync-label { display: flex; align-items: center; gap: 6px; color: #94a3b8; cursor: pointer; user-select: none; flex-shrink: 0; }
.sync-label input { accent-color: #10b981; width: 15px; height: 15px; cursor: pointer; }

/* 分组下拉框 */
.group-select {
  background: #1e293b; color: #fbbf24; border: 1px solid #3b82f6; padding: 4px 12px;
  border-radius: 6px; font-size: 16px; font-weight: bold; outline: none; max-width: 250px; cursor: pointer;
}
.group-select optgroup { color: #94a3b8; font-style: normal; font-weight: bold; background: #0f172a; }
.group-select option { color: #f8fafc; font-weight: normal; background: #1e293b; }

/* 搜索区居中 */
.search-wrap { position: relative; display: flex; align-items: center; }
.search {
  width: 300px; height: 50px; padding: 0 20px; border-radius: 25px; border: 2px solid #3b82f6;
  background: #0b1120; color: #fbbf24; font-size: 24px; font-weight: bold; text-align: center;
  outline: none; box-shadow: 0 0 15px rgba(59, 130, 246, 0.3); transition: all 0.2s;
}
.search::placeholder { color: #475569; font-size: 18px; font-weight: normal; }
.search:focus { box-shadow: 0 0 25px rgba(59, 130, 246, 0.6); border-color: #60a5fa; }

/* 建议列表 */
.suggest {
  position: absolute; top: 60px; left: 0; right: 0; background: #1e293b; border: 1px solid #334155;
  border-radius: 12px; box-shadow: 0 10px 24px rgba(0,0,0,0.5); overflow: hidden; z-index: 10;
}
.suggest.hidden { display: none; }
.suggest-item { padding: 12px 20px; font-size: 18px; color: #e5e7eb; cursor: pointer; border-bottom: 1px solid #334155; display: flex; justify-content: space-between; }
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover, .suggest-item.active { background: #3b82f6; color: #fff; font-weight: bold; }
.chk-mark { color: #10b981; font-weight: bold; }

/* 看板区 */
.dashboard { display: flex; gap: 20px; width: 400px; justify-content: flex-end; align-items: center; }
.dash-item { display: flex; flex-direction: column; align-items: center; padding: 4px 10px; border-radius: 8px; }
.dash-label { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; }
.dash-val { font-size: 26px; font-weight: 900; line-height: 1.2; }
.val-total { color: #3b82f6; }
.val-checked { color: #10b981; }
.val-remain { color: #f59e0b; }
.reset-btn { background: transparent; border: 1px solid #475569; color: #94a3b8; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; transition: all 0.2s; margin-left: 10px; }
.reset-btn:hover { background: #ef4444; border-color: #ef4444; color: #fff; }

/* 错误提示条 */
.error-banner {
  background: #7f1d1d; border-bottom: 2px solid #ef4444; color: #fecaca;
  padding: 10px 30px; font-size: 14px; flex-shrink: 0;
}

.main-content { flex: 1; padding: 30px; display: flex; gap: 24px; align-items: stretch; position: relative; overflow: hidden; }

/* 左侧未核对列表 */
.left-panel {
  width: 360px; flex-shrink: 0; display: flex; flex-direction: column;
  background: #1e293b; border-radius: 16px; border: 2px solid #334155;
  overflow: hidden;
}
.panel-header {
  padding: 16px 20px; background: #0f172a; border-bottom: 2px solid #334155;
  display: flex; justify-content: space-between; align-items: center;
}
.panel-title { font-size: 18px; font-weight: bold; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-count {
  background: #f59e0b; color: #0f172a; padding: 4px 12px; border-radius: 20px;
  font-size: 14px; font-weight: bold; flex-shrink: 0;
}
.unchecked-list {
  flex: 1; overflow-y: auto; padding: 8px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
.unchecked-list::-webkit-scrollbar { display: none; }
.unchecked-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: 8px; cursor: pointer; transition: all 0.15s ease;
  margin-bottom: 4px;
}
.unchecked-item:hover { background: #334155; transform: translateX(4px); }
.unchecked-item.active { background: #3b82f6; border-left: 4px solid #fbbf24; }
.unchecked-item.checked { opacity: 0.7; background: #102332; }
.unchecked-item.checked:hover { opacity: 1; background: #334155; }
.unchecked-no { font-weight: bold; font-size: 18px; min-width: 36px; font-family: monospace; }
.unchecked-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; flex-direction: column; gap: 2px;
}
.unchecked-name-main { color: #f8fafc; font-size: 16px; }
.unchecked-name-sub { color: #94a3b8; font-size: 13px; }
.unchecked-status { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.unchecked-tag { padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: bold; white-space: nowrap; }
.tag-checked { background: #10b981; color: #064e3b; }
.tag-unchecked { background: #f59e0b; color: #0f172a; }
.unchecked-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: #10b981; font-size: 16px; padding: 20px; text-align: center;
}

/* 右侧核对卡片 */
.right-panel { flex: 1; display: flex; justify-content: center; align-items: stretch; }

.empty-state {
  display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;
  font-size: 28px; color: #475569; font-weight: bold; border: 4px dashed #334155;
  border-radius: 24px; text-align: center; line-height: 1.5;
}

.card {
  display: flex; width: 100%; background: #1e293b; border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6); overflow: hidden; border: 2px solid #334155; position: relative;
}

.info-panel {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: #0f172a; border-right: 4px solid #334155; padding: 40px; text-align: center; position: relative;
}
.info-no-label { font-size: 24px; color: #94a3b8; margin-bottom: 10px; }
.info-no-val { font-size: 120px; font-weight: 900; color: #fbbf24; line-height: 1; text-shadow: 0 4px 10px rgba(251, 191, 36, 0.2); margin-bottom: 20px; }
.divider { width: 60%; height: 2px; background: #334155; margin: 30px 0; }

.info-name-main { font-size: 50px; font-weight: 900; color: #f8fafc; overflow-wrap: break-word; line-height: 1.2; }
.info-name-sub { font-size: 34px; font-weight: bold; color: #94a3b8; margin-top: 10px; letter-spacing: 1px; }

.info-rank { margin-top: 30px; font-size: 24px; color: #10b981; font-weight: bold; background: rgba(16, 185, 129, 0.1); padding: 8px 24px; border-radius: 99px; }

/* 状态徽章 (左上角) */
.status-badge {
  position: absolute; top: 20px; left: 20px; padding: 8px 16px; border-radius: 10px;
  font-size: 20px; font-weight: bold; text-transform: uppercase; letter-spacing: 2px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3); z-index: 10;
}
.badge-checked { background: #10b981; color: #064e3b; border: 2px solid #34d399; }
.badge-warn { background: #ef4444; color: #450a0a; border: 2px solid #f87171; animation: pulse 1s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

.times-panel { flex: 1.5; display: flex; flex-direction: column; }
.time-row {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-family: monospace; font-size: 90px; font-weight: 900; letter-spacing: 2px; border-bottom: 2px solid #334155;
}
.time-row:last-child { border-bottom: none; }
.time-idx { color: #64748b; font-size: 30px; margin-right: 40px; width: 40px; text-align: right; }
.bg-even { background: #1e293b; }
.bg-odd { background: #182132; }

/* 返回列表按钮（仅移动端单栏模式显示） */
.card-back {
  display: none; position: absolute; top: 12px; right: 12px; z-index: 20;
  padding: 8px 14px; border-radius: 10px; border: 1px solid #475569;
  background: rgba(15, 23, 42, 0.85); color: #e2e8f0; font-size: 14px;
  align-items: center; cursor: pointer;
}
.card-back:active { background: #334155; }

/* ==================== 中等屏幕（平板） ==================== */
@media (max-width: 1100px) {
  .left-status { width: auto; }
  .dashboard { width: auto; }
  .search { width: 220px; font-size: 20px; }
  .main-content { padding: 20px; gap: 16px; }
  .left-panel { width: 300px; }
  .info-no-val { font-size: 90px; }
  .info-name-main { font-size: 36px; }
  .info-name-sub { font-size: 24px; }
  .time-row { font-size: 60px; }
  .time-idx { font-size: 22px; margin-right: 24px; }
}

/* ==================== 移动端（手机） ==================== */
@media (max-width: 820px) {
  /* 顶栏改为三行布局：
     第一行：返回 + 比赛名 + 自动同步
     第二行：轮次下拉 + 搜索框
     第三行：统计数字 */
  .top-bar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; margin-top: 4px; }
  .left-status { display: contents; }
  .back-btn { order: 1; width: 34px; height: 34px; font-size: 16px; }
  .comp-name { order: 2; flex: 1; font-size: 15px; min-width: 140px; } /* min-width 保证轮次下拉被挤到第二行 */
  .sync-label { order: 3; font-size: 13px; }
  .group-select { order: 4; flex: 0 1 42%; min-width: 0; max-width: none; height: 40px; font-size: 16px; }
  .search-wrap { order: 5; flex: 1 1 48%; min-width: 0; }
  /* 字号 >=16px，避免 iOS 聚焦时页面自动放大 */
  .search { width: 100%; height: 42px; font-size: 17px; border-radius: 10px; padding: 0 14px; }
  .search::placeholder { font-size: 14px; }
  .suggest { top: 48px; }
  .suggest-item { padding: 12px 14px; font-size: 16px; }
  .dashboard { order: 6; width: 100%; justify-content: space-around; gap: 0; }
  .dash-item { padding: 2px 8px; }
  .dash-val { font-size: 20px; }
  .dash-label { font-size: 11px; }
  .reset-btn { margin-left: 4px; padding: 6px 12px; font-size: 13px; } /* 加大触控面积 */

  /* 主区改为单栏：默认显示选手列表；出现成绩卡片时隐藏列表，靠卡片右上角按钮返回 */
  .main-content { flex-direction: column; padding: 12px; gap: 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .main-content:has(.card) .left-panel { display: none; }
  .left-panel { width: 100%; flex: 1; min-height: 0; }
  /* 右栏默认整体隐藏（含占位空态和 flex gap）；出现成绩卡片或加载/错误提示时才显示 */
  .right-panel { display: none; }
  .main-content:has(.card) .right-panel,
  .right-panel:has(.notice) { display: flex; flex: 1; }
  .panel-header { padding: 12px 14px; }
  .unchecked-item { padding: 12px; }
  .unchecked-item:hover { transform: none; }
  .unchecked-no { font-size: 16px; min-width: 30px; }
  .unchecked-name-main { font-size: 15px; }

  /* 成绩卡片改为上下结构：上半部分压成单行，把空间尽量留给成绩区 */
  .card { flex-direction: column; border-radius: 16px; }
  .card-back { display: inline-flex; top: 8px; right: 8px; padding: 6px 10px; font-size: 13px; }
  .info-panel {
    flex-direction: row; align-items: center; justify-content: flex-start;
    gap: 12px; text-align: left; flex: 0 0 auto;
    border-right: none; border-bottom: 2px solid #334155;
    padding: 44px 14px 10px; /* 顶部避开右上角返回按钮 */
  }
  .info-no-label { display: none; }              /* "No." 标签藏掉 */
  .info-no-val { font-size: 34px; margin: 0; text-shadow: none; }
  .divider { display: none; }
  .info-name-main { font-size: 18px; flex: 1 1 auto; min-width: 0; line-height: 1.25; }
  .info-name-sub { font-size: 13px; margin: 0; flex-shrink: 0; letter-spacing: 0; }
  .info-rank { margin: 0; font-size: 15px; padding: 4px 10px; flex-shrink: 0; }
  .info-rank::before { content: '#'; font-weight: 900; } /* 移动端只显示 #排名 */
  .rank-text { display: none; }                  /* "当前排名: " 文字藏掉 */
  .time-row { font-size: 40px; min-height: 64px; padding: 6px; }
  .status-badge { top: 10px; left: 10px; font-size: 13px; padding: 6px 10px; letter-spacing: 1px; }
  .time-idx { font-size: 16px; margin-right: 14px; width: 26px; }
  .empty-state { font-size: 16px; border-width: 2px; border-radius: 14px; padding: 16px; }
  .error-banner { padding: 8px 14px; font-size: 13px; }

  /* 比赛选择页 */
  .picker-view { padding: 24px 12px 32px; }
  .picker-title { font-size: 24px; }
  .picker-search { height: 46px; font-size: 17px; padding: 0 16px; }
  .picker-item { padding: 12px 14px; gap: 10px; }
  .picker-item-name { font-size: 15px; white-space: normal; }
  .picker-item-date { font-size: 12px; }
}
