/* 基础样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 20px;
}

/* 头部 */
.header {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  text-align: center;
  padding: 30px 20px 20px;
}
.header h1 { font-size: 26px; font-weight: 800; letter-spacing: 2px; }
.subtitle { font-size: 14px; opacity: 0.9; margin-top: 6px; }

/* 导航 - 两行网格 */
.main-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: white;
  margin: 0 12px;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  position: relative;
  z-index: 10;
  margin-top: -10px;
}
.nav-btn {
  padding: 10px 4px;
  border: none;
  background: #f8f9ff;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}
.nav-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

/* Tab内容 */
.tab-content { display: none; padding: 12px; }
.tab-content.active { display: block; }

/* 卡片 */
.card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.card h2 {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 16px;
  padding-left: 10px;
  border-left: 3px solid #667eea;
}
.card-desc {
  font-size: 13px;
  color: #888;
  margin-bottom: 16px;
  padding-left: 13px;
}

/* 城市网格 */
.city-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.city-btn {
  padding: 14px 8px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  background: #fafafa;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.city-btn:active, .city-btn.active {
  border-color: #667eea;
  background: linear-gradient(135deg, #667eea15, #764ba215);
  color: #667eea;
}

/* 年份标签 */
.year-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.year-btn {
  padding: 6px 16px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: white;
  font-size: 13px;
  color: #666;
  cursor: pointer;
}
.year-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

/* 总分提示 */
.total-score {
  text-align: center;
  font-size: 13px;
  color: #888;
  margin-bottom: 12px;
  padding: 6px;
  background: #f8f9fa;
  border-radius: 8px;
}

/* 批次列表 */
.batch-list { list-style: none; }
.batch-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}
.batch-item:last-child { border-bottom: none; }
.batch-region {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}
.batch-name {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}
.batch-score {
  font-size: 20px;
  font-weight: 800;
  color: #667eea;
}
.batch-score span {
  font-size: 12px;
  font-weight: 400;
  color: #999;
}

/* 表单 */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}
.form-input, .form-select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  font-size: 15px;
  color: #333;
  background: #fafafa;
  transition: border-color 0.2s;
  outline: none;
}
.form-input:focus, .form-select:focus {
  border-color: #667eea;
  background: white;
}
.form-select.small { width: 48%; }
.filter-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
}
.btn-primary:active { opacity: 0.9; }

/* 推荐结果 */
.recommend-section { margin-bottom: 20px; }
.section-title冲, .section-title稳, .section-title保 {
  font-size: 15px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.section-title冲 { background: #fff3e0; color: #e65100; }
.section-title稳 { background: #e8f5e9; color: #2e7d32; }
.section-title保 { background: #e3f2fd; color: #1565c0; }

.school-list { list-style: none; }
.school-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 6px;
}
.school-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}
.school-score-tag {
  font-size: 13px;
  font-weight: 700;
  color: #667eea;
  white-space: nowrap;
}

/* 学校库结果 */
.school-result-list { max-height: 500px; overflow-y: auto; }
.school-result-item {
  padding: 14px;
  background: #f8f9fa;
  border-radius: 10px;
  margin-bottom: 8px;
}
.school-result-name {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
.school-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.meta-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #e8e8e8;
  color: #666;
}
.meta-tag.city { background: #e8f0fe; color: #1a73e8; }
.meta-tag.score { background: #fce8e6; color: #d93025; }
.meta-tag.type { background: #e6f4ea; color: #137333; }
.meta-tag.district { background: #fff3e0; color: #e65100; }
.meta-tag.noscore { background: #f1f3f4; color: #80868b; }

/* ===================== */
/* 成绩查询 Tab */
/* ===================== */
.score-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.score-entry-card {
  background: linear-gradient(135deg, #f8f9ff, #f0f1ff);
  border: 1px solid #e8e8f8;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}
.score-entry-card:active {
  transform: scale(0.97);
  border-color: #667eea;
}
.score-entry-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.score-entry-name {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 10px;
}
.score-entry-btn {
  display: inline-block;
  padding: 6px 18px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.score-entry-btn:active { opacity: 0.8; }

/* ===================== */
/* 一分一段表 Tab */
/* ===================== */
.rank-region-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.region-btn {
  padding: 8px 20px;
  border: 2px solid #667eea;
  border-radius: 20px;
  background: white;
  font-size: 14px;
  font-weight: 600;
  color: #667eea;
  cursor: pointer;
}
.region-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-color: transparent;
}
.region-btn.disabled {
  border-color: #ddd;
  color: #bbb;
  cursor: default;
}
.rank-city-info {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #667eea;
  padding: 8px;
  background: linear-gradient(135deg, #667eea10, #764ba210);
  border-radius: 8px;
  margin-bottom: 12px;
}
.rank-table-wrapper {
  overflow-x: auto;
  margin-bottom: 12px;
}
.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.rank-table thead th {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 12px 10px;
  font-weight: 600;
  text-align: center;
}
.rank-table thead th:first-child {
  border-radius: 8px 0 0 0;
}
.rank-table thead th:last-child {
  border-radius: 0 8px 0 0;
}
.rank-table tbody td {
  padding: 12px 10px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  font-weight: 500;
}
.rank-table tbody tr:nth-child(even) {
  background: #f8f9ff;
}
.rank-table tbody tr.highlight td {
  background: #fff8e1;
  font-weight: 700;
  color: #e65100;
}
.rank-table tbody tr:last-child td:first-child {
  border-radius: 0 0 0 8px;
}
.rank-table tbody tr:last-child td:last-child {
  border-radius: 0 0 8px 0;
}
.rank-chart-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: #999;
  padding: 8px;
}
.hint-icon { font-size: 16px; }

/* ===================== */
/* 高一选科 Tab */
/* ===================== */
.subject-filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.subject-filter-btn {
  padding: 6px 16px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: white;
  font-size: 13px;
  color: #666;
  cursor: pointer;
}
.subject-filter-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}
.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.subject-card {
  background: #f8f9ff;
  border: 1px solid #e8e8f8;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.subject-card:active {
  transform: scale(0.97);
  border-color: #667eea;
}
.subject-card.physics {
  border-left: 3px solid #667eea;
}
.subject-card.history {
  border-left: 3px solid #e65100;
}
.subject-card-code {
  font-size: 16px;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 4px;
}
.subject-card-subjects {
  font-size: 11px;
  color: #888;
  margin-bottom: 8px;
}
.subject-card-majors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.subject-card-major {
  font-size: 10px;
  padding: 2px 6px;
  background: #e8f0fe;
  color: #1a73e8;
  border-radius: 4px;
}
.subject-card-coverage {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #667eea;
}
.subject-card-coverage.history-cov {
  color: #e65100;
}

/* 选科详情弹窗 */
.subject-detail-content {
  padding: 0;
}
.detail-subjects-row {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.detail-subject-tag {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}
.detail-subject-tag.physics-tag {
  background: #e8f0fe;
  color: #1a73e8;
}
.detail-subject-tag.history-tag {
  background: #fff3e0;
  color: #e65100;
}
.detail-majors-list {
  margin-bottom: 16px;
}
.detail-majors-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}
.detail-major-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 6px;
}
.detail-major-icon {
  font-size: 18px;
}
.detail-major-name {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}
.detail-coverage-bar {
  margin-top: 12px;
  padding: 12px;
  background: linear-gradient(135deg, #667eea10, #764ba210);
  border-radius: 10px;
}
.detail-coverage-label {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}
.detail-coverage-value {
  font-size: 28px;
  font-weight: 800;
  color: #667eea;
}
.detail-coverage-value span {
  font-size: 14px;
  color: #999;
  font-weight: 400;
}
.detail-progress {
  height: 8px;
  background: #e8e8e8;
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
}
.detail-progress-bar {
  height: 100%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* 底部 */
.footer {
  text-align: center;
  padding: 20px;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  line-height: 1.8;
}
.copyright { margin-top: 4px; font-size: 11px; }

/* 搜索框 */
.search-box { margin-bottom: 12px; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 30px;
  color: #999;
  font-size: 14px;
}

/* ===================== */
/* 一分一段表 - 分数段查询 */
/* ===================== */
.segment-region-selector {
  margin-bottom: 16px;
}
.segment-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}
.segment-query-box {
  margin-bottom: 16px;
}
.segment-query-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.segment-query-row .form-input {
  flex: 1;
}
.btn-query {
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-query:active {
  opacity: 0.85;
  transform: scale(0.97);
}

/* 查询结果卡片 */
.segment-result {
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #f0f1ff, #f8f0ff);
  border-radius: 12px;
  border: 1px solid #e0e0f8;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.segment-result-header {
  text-align: center;
  margin-bottom: 14px;
}
.segment-result-score {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.result-label {
  font-size: 12px;
  color: #888;
}
.result-value {
  font-size: 36px;
  font-weight: 900;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.segment-result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.stat-icon {
  font-size: 24px;
}
.stat-info {
  flex: 1;
}
.stat-value {
  font-size: 18px;
  font-weight: 800;
  color: #1a1a2e;
}
.stat-label {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.segment-result-detail {
  font-size: 12px;
  color: #666;
  padding: 10px;
  background: white;
  border-radius: 8px;
  line-height: 1.8;
}
.segment-result-detail .detail-line {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}
.segment-result-detail .detail-line .line-label {
  color: #888;
}
.segment-result-detail .detail-line .line-value {
  font-weight: 600;
  color: #333;
}

/* 数据待补充提示 */
.segment-no-data {
  text-align: center;
  padding: 30px 20px;
  margin-top: 12px;
}
.no-data-icon {
  font-size: 36px;
  margin-bottom: 10px;
}
.no-data-text {
  font-size: 15px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}
.no-data-hint {
  font-size: 12px;
  color: #999;
}

/* 关键分数段统计 */
.key-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.key-stat-item {
  padding: 14px;
  background: linear-gradient(135deg, #f8f9ff, #f5f0ff);
  border-radius: 10px;
  text-align: center;
  border: 1px solid #e8e0f0;
}
.key-stat-score {
  font-size: 13px;
  color: #667eea;
  font-weight: 700;
  margin-bottom: 4px;
}
.key-stat-count {
  font-size: 22px;
  font-weight: 900;
  color: #1a1a2e;
}
.key-stat-unit {
  font-size: 11px;
  color: #999;
  font-weight: 400;
}
.key-stat-label {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

/* 分数段表格 */
.segment-table-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #999;
  margin-bottom: 10px;
}
.segment-table-wrapper {
  max-height: 400px;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid #e8e8e8;
}
.segment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.segment-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.segment-table thead th {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 10px 8px;
  font-weight: 600;
  text-align: center;
  font-size: 12px;
}
.segment-table tbody td {
  padding: 9px 8px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}
.segment-table tbody tr:nth-child(even) {
  background: #f8f9ff;
}
.segment-table tbody tr:nth-child(odd) {
  background: white;
}
.segment-table tbody tr.highlight-row td {
  background: #fff8e1 !important;
  font-weight: 700;
  color: #e65100;
}
.segment-table tbody tr:hover {
  background: #f0f0ff;
}
/* 批次线行高亮 */
.segment-table tbody tr.batch-line-row td {
  background: #e8f5e9 !important;
  font-weight: 600;
  color: #2e7d32;
}
.segment-table .batch-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 4px;
  background: #2e7d32;
  color: white;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

/* 学校详情弹窗 */
.school-detail-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.school-detail-modal.active {
  display: flex;
}
.school-detail-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
}
.school-detail-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  z-index: 1;
}
.school-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.school-detail-header h3 {
  font-size: 18px;
  color: #333;
  flex: 1;
  padding-right: 12px;
}
.school-detail-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
}
.school-detail-info {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.school-detail-scores h4 {
  font-size: 15px;
  color: #555;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}
.score-detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}
.score-detail-table th {
  background: #f5f6fa;
  padding: 10px 12px;
  font-size: 13px;
  color: #666;
  text-align: center;
  font-weight: 600;
}
.score-detail-table td {
  padding: 10px 12px;
  font-size: 14px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
}
.score-detail-table tr:hover td {
  background: #f8f9ff;
}
.score-note {
  font-size: 11px;
  color: #999;
  margin-top: 6px;
  line-height: 1.5;
}
.school-result-item {
  cursor: pointer;
}
.school-result-item:active {
  background: #f0f0f5;
}