/* 基础重置，让所有元素按边框计算尺寸 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Book Antiqua", "Palatino Linotype",  Palatino, serif;
  --default-bg: linear-gradient(135deg, #c5deff 0%, #b8d9ff 100%);
  background: var(--default-bg);
  min-height: 100vh;
  color: #333;
  padding: 0;
  padding-bottom: 20px;
}

/* 顶栏：整行深蓝色背景（50% 透明），滚动时收起/展开 */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background-color: rgba(14, 88, 161, 0.8);
  padding: 18px 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.top-bar.collapsed {
  transform: translateY(-100%);
}

.project-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  background: transparent;
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.2s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.lang-switch {
  background: #fff;
  color: #333;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lang-switch:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 页面切换 */
.page-hidden {
  display: none;
}

/* 黑屏淡出过渡层 */
.page-transition {
  position: fixed;
  inset: 0;
  background: #000;
  pointer-events: none;
  opacity: 0;
  z-index: 200;
  transition: opacity 0.5s ease;
}

.page-transition.active {
  opacity: 1;
}

#home-page {
  min-height: calc(100vh - 56px);
}

/* 首页：与看板一致的卡片化风格 */
.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 108px 20px 20px;
}

.home-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 40px;
}

.home-textbox {
  font-size: 42px;
  font-family: "Palatino Linotype", "STZhongsong", "华文中宋", "SimSun", serif;
  line-height: 1.6;
  color: #ffffff;
}

.home-textbox .highlight-blue {
  color: rgb(1, 43, 85);
}

.cta-btn {
  border: none;
  padding: 12px 24px;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: #0e58a1;
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 88, 161, 0.4);
}

.home-features {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.feature-card {
  flex: 1 1 260px;
  max-width: 340px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.feature-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0e58a1;
  margin-bottom: 8px;
}

.feature-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #444;
}

/* 选中指定国家/首页时使用背景图片，铺满并固定 */
body.has-bg-image {
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* 首页与空白页使用世界背景图，覆盖 body 默认渐变 */
body.page-home,
body.page-blank {
  background-image: url('resource/World.jpg') !important;
  background-size: cover !important;
  background-position: center !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
}

/* 空白页：撑满一屏，不放任何内容 */
#blank-page {
  min-height: 100vh;
}

/* 右下角返回顶部 */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background-color: #0e58a1;
  color: #ffffff;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 99;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.back-to-top:hover {
  transform: translateY(-3px);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 108px 20px 20px;
}

/* 控制区 */
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  border-radius: 16px;
}

/* SAT 范围双滑块 */
.sat-filter-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.sat-range-wrap {
  position: relative;
  width: 200px;
  height: 28px;
}

.sat-range-wrap input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  z-index: 2;
}

.sat-range-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0e58a1;
  border: 2px solid #fff;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  margin-top: -7px;
}

.sat-range-wrap input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0e58a1;
  border: 2px solid #fff;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.sat-range-wrap input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  background: transparent;
  border-radius: 2px;
}

.sat-range-wrap input[type="range"]::-moz-range-track {
  width: 100%;
  height: 4px;
  background: transparent;
  border-radius: 2px;
}

.sat-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  z-index: 1;
}

.sat-range-values {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 500;
  text-align: center;
  margin-top: 4px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.control-label {
  color: #fff;
  font-weight: 500;
}

.country-filter {
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  background: #fff;
  color: #555;
  font-weight: 500;
  min-width: 140px;
}

.country-filter:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.highlight-btn {
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fff;
  color: #e07a5f;
  font-weight: 500;
}

.highlight-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.highlight-btn.active {
  background: #e07a5f;
  color: #fff;
}

/* 卡片容器：默认横向排列 */
.cards-container {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
}

/* 单个学校卡片 */
.school-card {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  width: 260px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  animation: fadeInUp 0.6s ease;
}

.school-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

/* 卡片入场动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 冠军卡片：金色边框 + 皇冠 */
.school-card.champion {
  border: 3px solid #ffd166;
  background: linear-gradient(to bottom, #fff 0%, #fff9e6 100%);
}

.crown {
  position: absolute;
  top: -12px;
  right: -12px;
  background: #ffd166;
  color: #333;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 卡片头部信息 */
.card-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.school-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 4px;
}

.school-region {
  font-size: 0.85rem;
  color: #718096;
}

/* 指标行：录取率、标化等 */
.metric-row {
  margin-bottom: 16px;
  padding: 8px;
  border-radius: 10px;
  transition: background-color 0.3s ease;
}

.metric-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #4a5568;
  margin-bottom: 6px;
}

.metric-value {
  font-weight: 600;
  color: #2d3748;
}

/* 柱状条轨道 */
.bar-track {
  height: 10px;
  background: #edf2f7;
  border-radius: 5px;
  overflow: hidden;
}

/* 柱状条：默认 0 宽，由 JS 触发“长出来”动画 */
.bar {
  height: 100%;
  border-radius: 5px;
  width: 0;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: linear-gradient(90deg, #06b6d4 0%, #10b981 100%);
}

/* 高亮差异状态：暖色背景 + 暖色柱状条 */
.metric-row.highlight {
  background-color: rgba(255, 237, 213, 0.7);
}

.metric-row.highlight .bar {
  background: linear-gradient(90deg, #fb923c 0%, #ef4444 100%);
}

/* “差异大”小标签 */
.diff-tag {
  display: inline-block;
  background: #e07a5f;
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 600;
}

/* 热门专业标签 */
.majors {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.majors-label {
  font-size: 0.8rem;
  color: #718096;
  margin-bottom: 8px;
}

.majors-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.major-tag {
  background: #e0e7ff;
  color: #4338ca;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 8px;
}

/* 加载提示 */
.loading {
  color: #fff;
  font-size: 1.1rem;
  text-align: center;
  padding: 40px;
}

/* 手机端适配 */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .sort-group {
    justify-content: center;
  }

  .cards-container {
    flex-direction: column;
    align-items: center;
  }

  .school-card {
    width: 100%;
    max-width: 360px;
  }
}
