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

:root {
  --bg-primary: #0f0f12;
  --bg-secondary: #1a1a1f;
  --bg-card: #232329;
  --bg-card-hover: #2a2a32;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a8;
  --text-muted: #6b6b73;
  --accent-purple: #00d4aa;
  --accent-purple-light: #4ade80;
  --accent-blue: #3b82f6;
  --accent-orange: #f97316;
  --border-color: #2d2d35;
  --gradient-purple: linear-gradient(135deg, #00d4aa 0%, #3b82f6 100%);
  --gradient-orange: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100vw;
  overflow-x: hidden;
}

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

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

input {
  font-family: inherit;
  border: none;
  outline: none;
  background: none;
}

/* ==================== 顶部导航栏 ==================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(15, 15, 18, 0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  width: 40px;
  height: 40px;
  background: var(--gradient-purple);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: white;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-domain {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

.try-btn {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.try-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-purple);
}

/* ==================== 主体布局 ==================== */
.main-wrapper {
  display: flex;
  flex: 1;
}

/* ==================== 桌面端侧边栏 ==================== */
.sidebar {
  display: none;
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  padding: 16px 0;
  height: calc(100vh - 80px);
  position: sticky;
  top: 80px;
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
  width: 0;
  background: transparent;
}

.sidebar-nav {
  padding: 0 12px;
  margin-bottom: 24px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  position: relative;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--accent-blue);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
}

.sidebar-platforms {
  padding: 0 12px;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 14px;
  margin-bottom: 12px;
}

.sidebar-platforms-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.platform-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  transition: all 0.2s ease;
}

.platform-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.platform-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.platform-icon-1 { background: #00d4aa; }
.platform-icon-2 { background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%); }
.platform-icon-3 { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.platform-icon-4 { background: linear-gradient(135deg, #374151 0%, #111827 100%); }
.platform-icon-5 { background: linear-gradient(135deg, #ec4899 0%, #be185d 100%); }
.platform-icon-6 { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.platform-icon-7 { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); }
.platform-icon-8 { background: linear-gradient(135deg, #1f2937 0%, #111827 100%); }
.platform-icon-9 { background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); }

/* ==================== 主内容区域 ==================== */
.main-content {
  flex: 1;
  padding: 16px;
  padding-top: 65px;
  padding-bottom: 70px;
}

/* ==================== 合作平台区域 ==================== */
.platforms-section {
  margin-bottom: 20px;
  margin-top: 20px;
  overflow-x: auto;
  margin-left: -16px;
  margin-right: -16px;
  padding: 0 16px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.platforms-grid {
  display: grid;
  grid-template-columns: repeat(5, calc((100vw - 64px) / 5));
  gap: 8px;
  min-width: min-content;
}

.platform-card {
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.platform-card:hover {
  transform: translateY(-2px);
}

.platform-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  overflow: hidden;
}

.platform-card-1 .platform-card-icon { background: #00d4aa; }
.platform-card-2 .platform-card-icon { background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%); }
.platform-card-3 .platform-card-icon { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.platform-card-4 .platform-card-icon { background: linear-gradient(135deg, #374151 0%, #111827 100%); }
.platform-card-5 .platform-card-icon { background: linear-gradient(135deg, #ec4899 0%, #be185d 100%); }
.platform-card-6 .platform-card-icon { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.platform-card-7 .platform-card-icon { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); }
.platform-card-8 .platform-card-icon { background: linear-gradient(135deg, #1f2937 0%, #111827 100%); }
.platform-card-9 .platform-card-icon { background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); }

.platform-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.platform-card-name {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
}

/* ==================== 模拟器切换区域 ==================== */
.emulator-section {
  margin-bottom: 16px;
  overflow-x: auto;
  margin-left: -16px;
  margin-right: -16px;
  padding: 0 16px;
}

.emulator-tabs {
  display: inline-flex;
  gap: 8px;
  padding-bottom: 8px;
  min-width: min-content;
}

.emulator-tabs::-webkit-scrollbar {
  display: none;
}

.emulator-tab {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.emulator-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.emulator-tab.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: white;
}

/* ==================== 搜索区域 ==================== */
.search-section {
  margin-bottom: 20px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: all 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--accent-purple);
  background: var(--bg-card-hover);
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* ==================== 游戏列表区域 ==================== */
.games-section {
  margin-bottom: 20px;
  overflow-x: auto;
  margin-left: -16px;
  margin-right: -16px;
  padding: 0 16px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(4, calc((100vw - 48px) / 4));
  gap: 6px;
  min-width: min-content;
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.2s ease;
  width: 100%;
}

.game-card:hover {
  transform: translateY(-2px);
}

.game-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.2;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
}

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

.game-card:hover .game-image {
  transform: scale(1.03);
}

.hot-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  padding: 2px 5px;
  background: var(--gradient-orange);
  border-radius: 3px;
  font-size: 8px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
}

.game-name {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 无游戏提示 */
.no-games {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ==================== 游戏iframe弹窗 ==================== */
.game-frame-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.95);
  flex-direction: column;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.game-frame-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.game-frame-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.game-frame-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.game-frame-close svg {
  width: 20px;
  height: 20px;
}

.game-frame-wrapper {
  flex: 1;
  padding: 0;
}

.game-frame-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

/* ==================== 联系客服弹窗 ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 70vh;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: 50%;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 16px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.contact-item:last-child {
  margin-bottom: 0;
}

.contact-item:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.contact-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.contact-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-icon-qq {
  background: #1296db;
}

.contact-icon-wechat {
  background: #07c160;
}

.contact-icon-telegram {
  background: #0088cc;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.contact-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* PC端联系客服按钮 */
.sidebar .nav-item.customer-service {
  cursor: pointer;
}

/* ==================== 移动端底部导航 ==================== */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  display: flex;
  background: var(--bg-secondary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  padding: 10px 0;
  padding-bottom: env(safe-area-inset-bottom, 10px);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  color: var(--text-muted);
  font-size: 11px;
  transition: color 0.2s ease;
}

.mobile-nav-item.active {
  color: var(--accent-purple);
}

.mobile-nav-icon {
  width: 24px;
  height: 24px;
}

/* ==================== 桌面端适配 ==================== */
@media screen and (min-width: 768px) {
  .header {
    padding: 16px 24px;
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .logo-badge {
    width: 48px;
    height: 48px;
  }

  .brand-title {
    font-size: 18px;
  }

  .brand-domain {
    font-size: 12px;
  }

  .try-btn {
    padding: 12px 20px;
    font-size: 14px;
  }

  .main-wrapper {
    display: flex;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
  }

  .main-content {
    padding: 24px;
    padding-top: 80px;
    padding-bottom: 24px;
  }

  .platforms-section {
    margin-bottom: 28px;
    margin-top: 28px;
    overflow-x: visible;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
  }

  .section-title {
    font-size: 16px;
    margin-bottom: 16px;
  }

  .platforms-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    min-width: auto;
  }

  .platform-card {
    padding: 16px 10px;
  }

  .platform-card:hover {
    transform: translateY(-2px);
  }

  .platform-card-icon {
    width: 44px;
    height: 44px;
    font-size: 14px;
  }

  .platform-card-name {
    font-size: 12px;
  }

  .emulator-section {
    margin-bottom: 24px;
    overflow-x: visible;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
  }

  .emulator-section {
    margin-bottom: 24px;
  }

  .emulator-tabs {
    gap: 10px;
  }

  .emulator-tabs::-webkit-scrollbar {
    display: none;
  }

  .emulator-tab {
    padding: 10px 16px;
    font-size: 13px;
  }

  .search-section {
    margin-bottom: 28px;
  }

  .search-box {
    padding: 14px 20px;
  }

  .search-input {
    font-size: 15px;
  }

  .games-section {
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    overflow-x: visible;
  }

  .games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    min-width: auto;
  }

  .game-card {
    gap: 10px;
  }

  .game-card:hover {
    transform: translateY(-4px);
  }

  .game-cover {
    border-radius: var(--radius-md);
  }

  .game-card:hover .game-image {
    transform: scale(1.05);
  }

  .hot-badge {
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    font-size: 10px;
  }

  .game-name {
    font-size: 13px;
    padding: 0 4px;
  }

  .game-name {
    font-size: 14px;
    padding: 0 6px;
  }

  .hot-badge {
    padding: 5px 10px;
    font-size: 11px;
  }

  .mobile-nav {
    display: none;
  }

  .desktop-only {
    display: inline-flex;
  }
}

/* ==================== 大屏幕适配 ==================== */
@media screen and (min-width: 1024px) {
  .sidebar {
    width: 260px;
  }

  .main-content {
    max-width: 1200px;
  }

  .games-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }
}

@media screen and (min-width: 1280px) {
  .games-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ==================== 隐藏桌面端元素 ==================== */
.desktop-only {
  display: none;
}
