/**
 * 游戏中心全局样式
 */

/* ========== 变量 ========== */
:root {
  --primary: #2C3E50;
  --primary-dark: #1a252f;
  --primary-light: #34495e;
  --accent: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;
  --info: #3498db;
  
  --bg: #0f1923;
  --bg-card: #1a2634;
  --bg-card-hover: #243447;
  
  --text: #ecf0f1;
  --text-muted: #95a5a6;
  --text-light: #bdc3c7;
  
  --border: #34495e;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  
  --transition: all 0.3s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

/* ========== 容器 ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  transition: var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-back {
  padding: 10px 16px;
  font-size: 0.95rem;
  background: transparent;
  color: var(--text-muted);
}

.btn-back:hover {
  color: var(--text);
}

.btn-share {
  padding: 10px 16px;
  font-size: 0.95rem;
  background: var(--success);
  color: white;
}

.btn-share:hover {
  background: #219a52;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

/* ========== 卡片 ========== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ========== 加载动画 ========== */
.loader {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========== 首页 ========== */
.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.home-header {
  text-align: center;
  padding: 60px 20px 40px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.logo-icon {
  font-size: 3rem;
}

.logo-text {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, #bdc3c7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 500px;
  margin: 0 auto;
}

.home-content {
  flex: 1;
  padding: 40px 20px;
}

.games-section {
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text);
}

/* ========== 游戏网格 ========== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* ========== 游戏卡片 ========== */
.game-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.game-card:hover:not(.disabled) {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  border-color: var(--primary);
}

.game-card.disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.game-thumbnail {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--bg);
}

.game-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.game-card:hover:not(.disabled) .game-thumbnail img {
  transform: scale(1.05);
}

.game-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.game-badge.hot {
  background: rgba(231, 76, 60, 0.9);
  color: white;
}

.game-badge.coming {
  background: rgba(52, 152, 219, 0.9);
  color: white;
}

.game-info {
  padding: 20px;
}

.game-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.game-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.game-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  padding: 4px 10px;
  background: var(--bg);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ========== 游戏页 ========== */
.game-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.game-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.game-container {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg);
  padding: 20px;
}

#game-frame {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 120px);
  max-width: 800px;
  border-radius: var(--radius);
  background: white;
}

.game-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.game-loader p {
  margin-top: 16px;
  color: var(--text-muted);
}

/* ========== 关于页 ========== */
.about-page {
  min-height: 100vh;
}

.about-header {
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.about-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.about-content h1 {
  font-size: 2rem;
  margin-bottom: 20px;
}

.about-content h2 {
  font-size: 1.5rem;
  margin: 30px 0 16px;
}

.about-content p {
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.7;
}

.about-content ul {
  padding-left: 20px;
}

.about-content li {
  color: var(--text-muted);
  margin-bottom: 8px;
  list-style: disc;
}

/* ========== 错误页 ========== */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
}

.error-page h1 {
  font-size: 6rem;
  color: var(--accent);
  margin-bottom: 16px;
}

.error-page p {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* ========== Footer ========== */
.home-footer {
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.home-footer p {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.footer-nav a {
  color: var(--text-light);
  transition: color 0.2s;
}

.footer-nav a:hover {
  color: var(--text);
}

/* ========== 响应式 ========== */

/* 手机 */
@media (max-width: 768px) {
  .logo-text {
    font-size: 1.8rem;
  }
  
  .logo-icon {
    font-size: 2.2rem;
  }
  
  .home-header {
    padding: 40px 20px 30px;
  }
  
  .games-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .game-info {
    padding: 16px;
  }
  
  .game-name {
    font-size: 1.1rem;
  }
  
  .game-title {
    font-size: 1rem;
  }
  
  .game-header {
    padding: 12px 16px;
  }
  
  #game-frame {
    min-height: calc(100vh - 100px);
    border-radius: 0;
  }
  
  .game-container {
    padding: 0;
  }
}

/* 平板 */
@media (min-width: 769px) and (max-width: 1024px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 大屏幕 */
@media (min-width: 1440px) {
  .games-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ========== 动画 ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeIn 0.5s ease forwards;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ========== 选中文字 ========== */
::selection {
  background: var(--primary);
  color: white;
}
