/* 全局变量 */
:root {
  --color-main: #00ffc3;
  --color-bg-light: #f5f7fa;
  --color-bg-dark: #0f0f0f;
  --color-text-light: #222;
  --color-text-dark: #fff;
  --color-sub-light: #555;
  --color-sub-dark: #ccc;
  --color-highlight: #00d9ff;
  --max-width: 1100px;
}

/* 重置及基础 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  font-size: 16px; /* 默认字体大小，适合手机端 */
}
body {
  font-family: "Roboto", sans-serif;
  background: linear-gradient(145deg, #0a0a0a, #1a1a1a);
  color: var(--color-text-dark);
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  transition: background 0.5s, color 0.5s;
  line-height: 1.6;
  font-size: 1rem; /* 继承html字体大小 */
  min-height: 100vh;
}
body.light {
  background: var(--color-bg-light);
  color: var(--color-text-light);
  font-size: 1.06rem;
  line-height: 1.7;
}

/* 链接 */
a {
  color: var(--color-main);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* 头部 */
header {
  background: rgba(0, 0, 0, 0.85);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(12px);
  transition: background 0.5s, color 0.5s;
  max-width: var(--max-width);
  margin: 0 auto;
  flex-wrap: nowrap;
}
body.light header {
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-text-light);
}
header h1 {
  font-family: "Orbitron", sans-serif;
  color: var(--color-main);
  font-size: 2.8rem;
  letter-spacing: 3px;
  flex-shrink: 0;
  white-space: nowrap;
}
nav {
  display: flex;
  gap: 2rem;
  margin-left: auto;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* 火狐不显示滚动条 */
}
nav::-webkit-scrollbar {
  display: none; /* webkit浏览器隐藏滚动条 */
}
nav a {
  color: var(--color-sub-dark);
  font-weight: 600;
  font-size: 1.2rem;
  white-space: nowrap;
  transition: color 0.3s;
  flex-shrink: 0;
  padding: 0 0.5rem;
}
body.light nav a {
  color: var(--color-sub-light);
}
nav a:hover {
  color: var(--color-main);
}
.btn-toggle-theme {
  background: var(--color-main);
  border: none;
  border-radius: 50px;
  padding: 0.45rem 1.3rem;
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  color: #000;
  box-shadow: 0 4px 15px var(--color-main);
  transition: background 0.3s ease;
  user-select: none;
  margin-left: 2rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-toggle-theme:hover {
  background: #00bfa6;
  box-shadow: 0 6px 25px #00bfa6cc;
}

/* 电脑端字体调小，优化密度 */
@media (min-width: 768px) {
  html {
    font-size: 14px; /* 电脑端字体调小 */
  }
  header {
    padding: 1rem 2rem;
  }
  nav a {
    font-size: 1.1rem;
    padding: 0 0.7rem;
  }
  .btn-toggle-theme {
    font-size: 0.95rem;
    padding: 0.4rem 1.1rem;
  }
  header h1 {
    font-size: 2.8rem;
  }
  main {
    max-width: var(--max-width);
    margin: 3rem auto 5rem;
    padding: 0 2rem;
  }
}

/* 手机端调整，保持一行且不换行，缩小字体和间距 */
@media (max-width: 480px) {
  header {
    flex-wrap: nowrap !important;
    align-items: center !important;
    padding: 0.8rem 1rem !important;
    gap: 0.5rem;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  header h1 {
    font-size: 1.8rem !important;
    white-space: nowrap;
    flex-shrink: 0;
  }
  nav {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    gap: 0.7rem !important;
    margin-left: 0;
    flex-shrink: 1;
    width: auto !important;
    max-width: 100vw !important;
  }
  nav a {
    font-size: 0.85rem !important;
    padding: 0 0.4rem !important;
    white-space: nowrap !important;
    flex-shrink: 0;
    max-width: 100% !important;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  .btn-toggle-theme {
    margin-left: 0.6rem !important;
    padding: 0.25rem 0.7rem !important;
    font-size: 0.85rem !important;
    flex-shrink: 0;
  }
  main {
    padding: 1rem 1rem !important;
    margin: 2rem auto 4rem !important;
    max-width: 100% !important;
  }
  .hero h2 {
    font-size: 2.6rem !important;
    line-height: 1.15 !important;
  }
  .hero p {
    font-size: 1.1rem !important;
    max-width: 100% !important;
    margin: 0 auto !important;
  }
  .cards {
    grid-template-columns: 1fr !important;
    gap: 1.2rem !important;
    padding: 0 !important;
  }
  .card {
    min-height: auto !important;
    padding: 1.2rem 1rem !important;
    font-size: 1rem !important;
    box-shadow: 0 4px 12px #00ffc344 !important;
    border-radius: 1rem !important;
  }
  #announcements {
    max-height: 140px !important;
    font-size: 1rem !important;
    padding: 1rem 1.5rem !important;
    margin-bottom: 3rem !important;
  }
  footer {
    padding: 2rem 1rem !important;
    font-size: 1rem !important;
    max-width: 100% !important;
  }
}

/* 主页主体 */
main {
  max-width: var(--max-width);
  margin: 3rem auto 5rem;
  padding: 0 2rem;
}
.hero {
  padding: 3rem 1rem 4rem;
  text-align: center;
  max-width: 700px;
  margin: 0 auto 3rem;
}
.hero h2 {
  font-size: 3.8rem;
  color: var(--color-main);
  margin-bottom: 1.4rem;
  line-height: 1.1;
  font-weight: 700;
}
body.light .hero h2 {
  color: #009e75;
}
.hero p {
  font-size: 1.3rem;
  color: var(--color-sub-dark);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
}
body.light .hero p {
  color: #444;
}
.cta-button {
  display: inline-block;
  margin-top: 3rem;
  padding: 1.1rem 3rem;
  background: var(--color-main);
  color: #000;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1.3rem;
  box-shadow: 0 4px 20px var(--color-main);
  transition: background 0.3s ease;
  user-select: none;
}
.cta-button:hover {
  background: #00bfa6;
  box-shadow: 0 6px 25px #00bfa6cc;
}
body.light .cta-button {
  color: #000;
  background: #00cfa2;
  box-shadow: 0 4px 20px #00cfa2aa;
}
body.light .cta-button:hover {
  background: #009e75;
  box-shadow: 0 6px 25px #009e7555;
}

/* 各版块标题 */
.section {
  margin-bottom: 3rem;
  padding: 0 1rem;
}
.section h2,
#announcements h3 {
  font-size: 2.6rem;
  margin-bottom: 1.8rem;
  color: var(--color-main);
  text-align: center;
  font-weight: 700;
  user-select: none;
}
body.light .section h2,
body.light #announcements h3 {
  color: #009e75;
}

/* 卡片容器 */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}
.card {
  background: #1f1f1f;
  border-radius: 1.2rem;
  padding: 2rem;
  box-shadow: 0 0 15px #00ffc322;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  cursor: default;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  will-change: transform;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  word-wrap: break-word;
  font-size: 1.1rem;
  color: var(--color-sub-dark);
  line-height: 1.5;
}
body.light .card {
  background: #e8f0f7;
  box-shadow: 0 0 25px #00d9ff66;
  color: #222;
}
.card:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 30px #00ffc388;
}
body.light .card:hover {
  box-shadow: 0 12px 45px #00bfa6cc;
}
.card h3 {
  color: var(--color-highlight);
  margin-bottom: 1rem;
  font-size: 1.6rem;
  font-weight: 700;
}
body.light .card h3 {
  color: #007a6c;
}

/* 公告区 */
.announcements {
  display: grid;
  gap: 15px;
  padding: 20px 0;
}

.announcement-item {
  background-color: #1d1d1d;
  border-left: 5px solid #00ffc3;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.announcement-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
}

.announcement-item h4 {
  font-size: 1.1rem;
  margin-bottom: 5px;
  color: #00ffc3;
}

.announcement-item p {
  font-size: 0.95rem;
  color: #ccc;
}

/* 页脚 */
footer {
  background: #0a0a0a;
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-size: 1.1rem;
  color: #888;
  user-select: none;
  transition: background 0.5s, color 0.5s;
  max-width: var(--max-width);
  margin: 0 auto;
}
body.light footer {
  background: #ddd;
  color: #666;
}

/* 防止水平滚动，避免左右结构异常 */
body,
html {
  overflow-x: hidden !important;
}