/* ==================== 基础样式 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: #FAFAFA;
  color: #1A1A1A;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==================== 页面切换 ==================== */
.page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 100vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page.active {
  opacity: 1;
  visibility: visible;
}

/* ==================== 导航栏 ==================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 1000;
}

.nav-container {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-size: 18px;
  font-weight: 600;
  color: #1A1A1A;
  letter-spacing: 0.5px;
}

.brand-tagline {
  font-size: 10px;
  font-weight: 400;
  color: #6B7280;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.nav-user {
  font-size: 14px;
  color: #6B7280;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* ==================== 首页 ==================== */
#homePage {
  padding-top: 70px;
  min-height: 100vh;
}

/* 邀请码区域 */
.invite-section {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F5F5F0 0%, #FAFAFA 100%);
}

.invite-container {
  text-align: center;
  padding: 40px;
}

.invite-title {
  font-size: 48px;
  font-weight: 400;
  color: #1A1A1A;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.invite-subtitle {
  font-size: 16px;
  color: #666;
  margin-bottom: 40px;
  letter-spacing: 1px;
  font-weight: 300;
}

.invite-form {
  display: flex;
  gap: 12px;
  max-width: 400px;
  margin: 0 auto;
}

.invite-input {
  flex: 1;
  height: 50px;
  background: #fff;
  border: 1px solid #D0D0D0;
  border-radius: 4px;
  padding: 0 20px;
  font-size: 15px;
  color: #1A1A1A;
  outline: none;
  transition: all 0.3s ease;
}

.invite-input:focus {
  border-color: #6B7280;
}

.invite-btn {
  height: 50px;
  padding: 0 32px;
  background: #1A1A1A;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.invite-btn:hover {
  background: #333;
}

.invite-btn:active {
  transform: scale(0.98);
}

/* Hero区域 - 三栏式 */
.hero-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
}

.hero-column {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-column.disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-column:hover .hero-image {
  transform: scale(1.03);
}

.hero-column.disabled:hover .hero-image {
  transform: none;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.3) 60%,
    rgba(0, 0, 0, 0.7) 100%
  );
  z-index: 1;
}

.ai-badge {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 6px 12px;
  border-radius: 2px;
  z-index: 2;
  text-transform: uppercase;
}

.hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 30px;
  z-index: 2;
}

.hero-title {
  font-size: 32px;
  font-weight: 400;
  color: #fff;
  margin-bottom: 16px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.hero-btn {
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 2px;
  color: #1A1A1A;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 1px;
}

.hero-btn:hover {
  background: #fff;
  transform: translateY(-2px);
}

.hero-status {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 1px;
}

/* 排行榜区域 */
.leaderboard-wrapper {
  max-width: 1400px;
  margin: 60px auto 80px;
  padding: 0 20px;
}

.leaderboard-container {
  width: 100%;
  margin: 0 auto;
  padding: 40px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 2px;
}

.leaderboard-title {
  font-size: 20px;
  font-weight: 400;
  color: #1A1A1A;
  margin-bottom: 30px;
  text-align: center;
  letter-spacing: 2px;
  border-bottom: 1px solid #6B7280;
  padding-bottom: 16px;
}

.leaderboard-scroll {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 10px 0;
  scrollbar-width: thin;
  scrollbar-color: #8B7355 #F5F5F5;
}

.leaderboard-scroll::-webkit-scrollbar {
  height: 6px;
}

.leaderboard-scroll::-webkit-scrollbar-track {
  background: #F5F5F5;
  border-radius: 3px;
}

.leaderboard-scroll::-webkit-scrollbar-thumb {
  background: #6B7280;
  border-radius: 3px;
}

.leaderboard-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100px;
  min-width: 100px;
  max-width: 100px;
  padding: 16px 12px;
  background: #FAFAFA;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
}

.leaderboard-item:hover {
  background: #F5F5F5;
  transform: translateY(-4px);
}

.leaderboard-item.empty {
  opacity: 0.5;
}

.leaderboard-item.empty:hover {
  transform: none;
}

.rank-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: #D0D0D0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

.leaderboard-item.rank-1 .rank-badge {
  background: #D4AF37;
}

.leaderboard-item.rank-2 .rank-badge {
  background: #C0C0C0;
}

.leaderboard-item.rank-3 .rank-badge {
  background: #CD7F32;
}

.player-avatar {
  width: 48px;
  height: 48px;
  background: #6B7280;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  color: #fff;
  font-size: 18px;
}

.leaderboard-item.rank-1 .player-avatar {
  background: #D4AF37;
}

.leaderboard-item.rank-2 .player-avatar {
  background: #C0C0C0;
}

.leaderboard-item.rank-3 .player-avatar {
  background: #CD7F32;
}

.player-name {
  font-size: 14px;
  color: #1A1A1A;
  font-weight: 400;
  text-align: center;
}

.player-score {
  font-size: 16px;
  font-weight: 600;
  color: #6B7280;
}

/* ==================== 识别页 ==================== */
#detectPage {
  background: #000;
}

.detect-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.video-wrapper {
  position: relative;
  flex: 1;
  overflow: hidden;
}

#videoElement {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  object-fit: cover;
}

#canvasElement {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  z-index: 10;
  pointer-events: none;
}

.tip-box {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(139, 115, 85, 0.2);
  border-radius: 4px;
  padding: 8px 16px;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.tip-text {
  font-size: 13px;
  font-weight: 500;
  color: #1A1A1A;
  letter-spacing: 0.5px;
}

.status-bar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 10;
}

.status-item {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 4px;
  padding: 8px 12px;
  backdrop-filter: blur(10px);
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.status-label {
  display: block;
  font-size: 11px;
  color: #666;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.status-value {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #6B7280;
}

.status-value.error {
  color: #D32F2F;
}

.control-buttons {
  display: flex;
  gap: 16px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.8);
}

.btn-control {
  flex: 1;
  height: 52px;
  border: none;
  border-radius: 2px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.btn-back {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-stop {
  background: #6B7280;
  color: #fff;
}

.btn-stop:hover {
  background: #4B5563;
}

.btn-control:active {
  transform: scale(0.98);
}

/* ==================== 结果页 ==================== */
#resultPage {
  padding-top: 70px;
  min-height: 100vh;
  background: #FAFAFA;
  overflow-y: auto;
}

.result-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 60px 20px;
}

.result-title {
  font-size: 28px;
  font-weight: 400;
  color: #1A1A1A;
  margin-bottom: 40px;
  text-align: center;
  letter-spacing: 2px;
}

.score-card {
  margin: 40px 0;
  text-align: center;
}

.score-circle {
  position: relative;
  display: inline-block;
}

.score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.score-number {
  font-size: 56px;
  font-weight: 600;
  color: #6B7280;
}

.score-unit {
  font-size: 18px;
  color: #666;
  margin-left: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 40px 0;
}

.stat-item {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  padding: 24px;
  text-align: center;
}

.stat-label {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 32px;
  font-weight: 600;
  color: #1A1A1A;
}

.stat-value.success {
  color: #6B7280;
}

.stat-value.error {
  color: #D32F2F;
}

.nickname-box,
.suggestion-box,
.rank-box {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  padding: 24px;
  margin: 24px 0;
}

.nickname-input {
  width: 100%;
  height: 48px;
  background: #FAFAFA;
  border: 1px solid #D0D0D0;
  border-radius: 2px;
  padding: 0 16px;
  font-size: 15px;
  color: #1A1A1A;
  outline: none;
  margin-bottom: 12px;
}

.nickname-input:focus {
  border-color: #8B7355;
}

.btn-save-nickname {
  width: 100%;
  height: 48px;
  background: #1A1A1A;
  border: none;
  border-radius: 2px;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-save-nickname:hover {
  background: #333;
}

.nickname-label {
  font-size: 15px;
  color: #666;
  margin-right: 8px;
}

.nickname-value {
  font-size: 16px;
  font-weight: 500;
  color: #6B7280;
}

.suggestion-title,
.rank-title {
  font-size: 16px;
  font-weight: 500;
  color: #1A1A1A;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.suggestion-content {
  font-size: 14px;
  color: #666;
  line-height: 1.8;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rank-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #FAFAFA;
  border-radius: 2px;
}

.rank-item.highlight {
  background: rgba(139, 115, 85, 0.08);
  border: 1px solid rgba(139, 115, 85, 0.2);
}

.rank-num {
  width: 28px;
  height: 28px;
  background: #8B7355;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  color: #fff;
  font-size: 13px;
  margin-right: 12px;
}

.rank-name {
  flex: 1;
  font-size: 15px;
  color: #1A1A1A;
}

.rank-score {
  font-size: 15px;
  font-weight: 500;
  color: #6B7280;
}

.result-buttons {
  display: flex;
  gap: 16px;
  margin-top: 40px;
}

.btn-result {
  flex: 1;
  height: 52px;
  border: none;
  border-radius: 2px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.btn-retry {
  background: #1A1A1A;
  color: #fff;
}

.btn-retry:hover {
  background: #333;
}

.btn-home {
  background: #fff;
  color: #1A1A1A;
  border: 1px solid #D0D0D0;
}

.btn-home:hover {
  background: #FAFAFA;
}

.btn-result:active {
  transform: scale(0.98);
}

/* ==================== 加载动画 ==================== */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 9999;
}

.loading.active {
  display: flex;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(139, 115, 85, 0.2);
  border-top-color: #8B7355;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 20px;
  font-size: 14px;
  color: #8B7355;
  letter-spacing: 1px;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
  .hero-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hero-column {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 768px) {
  .nav-container {
    padding: 0 20px;
  }

  .brand-logo {
    height: 32px;
  }

  .invite-title {
    font-size: 36px;
  }

  .hero-title {
    font-size: 24px;
  }

  .leaderboard-container {
    padding: 24px;
  }

  .result-container {
    padding: 40px 20px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}







/* 训练记录按钮 */
.btn-history {
  margin-left: 15px;
  padding: 8px 16px;
  background: #8B7355;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.3s;
}

.btn-history:hover {
  background: #6B7280;
}
