/* ===== Retro Pixel Theme - 复古像素风 ===== */

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: auto; }
body {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  background: #1a1a2e;
  color: #eaeaea;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  image-rendering: pixelated;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; image-rendering: pixelated; }

/* CRT Scanline Effect */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ===== Container ===== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ===== Header - 像素导航 ===== */
.site-header {
  background: #16213e;
  border-bottom: 4px solid #ff2e63;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 0 #ff2e63;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 1rem;
  font-weight: 400;
  color: #eaeaea;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: none;
}
.logo:hover {
  transform: translate(-2px, -2px);
  text-shadow: 2px 2px 0 #ff2e63;
}
.logo-icon {
  width: 32px;
  height: 32px;
  background: #ff2e63;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1a2e;
  font-size: 12px;
  border: 2px solid #eaeaea;
  box-shadow: 2px 2px 0 #eaeaea;
}
.logo span { color: #ff2e63; }

/* ===== Hero Section - 顶部宫格区域 ===== */
.hero-section {
  padding: 25px 0;
  position: relative;
  max-height: 250px;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  max-width: 550px;
  margin: 0 auto;
}
.hero-card {
  background: #16213e;
  border: 2px solid #ff2e63;
  padding: 0;
  text-align: center;
  color: #eaeaea;
  text-decoration: none;
  transition: none;
  position: relative;
  image-rendering: pixelated;
  border-radius: 0;
  aspect-ratio: 1/1;
  box-shadow: 4px 4px 0 #ff2e63;
}
.hero-card:hover {
  background: #ff2e63;
  color: #1a1a2e;
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #ff2e63;
}
.hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin-bottom: 0;
  image-rendering: pixelated;
  border: 0;
}
.hero-card span {
  display: none;
}
.hero-card::before {
  content: '▶';
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 8px;
  opacity: 0.5;
}
.hero-card:hover::before {
  color: #1a1a2e;
}

/* 平板端 */
@media (max-width: 768px) {
  .hero-section { padding: 20px 0; max-height: 250px; }
  .hero-grid { 
    grid-template-columns: repeat(4, 1fr); 
    max-width: 300px;
    gap: 4px;
  }
  .hero-card { padding: 0; }
  .hero-card img { height: 100%; margin-bottom: 0; }
  .hero-card span { display: none; }
}

/* 手机端 */
@media (max-width: 480px) {
  .hero-section { padding: 15px 0; max-height: 250px; }
  .hero-grid { 
    grid-template-columns: repeat(4, 1fr); 
    max-width: 280px;
    gap: 3px;
  }
  .hero-card { padding: 0; }
  .hero-card img { height: 100%; margin-bottom: 0; }
  .hero-card span { display: none; }
}

/* ===== Games Section - 全部游戏区域 ===== */
.games-section {
  padding: 8px 0 32px;
}
.section-title {
  font-size: 0.9rem;
  font-weight: 400;
  margin-bottom: 20px;
  color: #eaeaea;
  position: relative;
  display: inline-block;
  padding-left: 16px;
}
.section-title::before {
  content: '>';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #ff2e63;
}
@media (max-width: 768px) {
  .section-title { font-size: 0.75rem; }
}

/* ===== Game Grid (Home) - 像素网格 ===== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  padding: 5px 0;
}
@media (max-width: 1024px) { .game-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 768px)  { .game-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 576px)  { .game-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

/* ===== Game Card - 像素卡片 ===== */
.game-card {
  background: #0f3460;
  overflow: hidden;
  border: 2px solid #ff2e63;
  box-shadow: 4px 4px 0 #ff2e63;
  transition: none;
  cursor: pointer;
  position: relative;
}
.game-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #ff2e63;
}
.game-card-thumb {
  width: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
  background: #16213e;
  position: relative;
}
.game-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: none;
  image-rendering: pixelated;
}
.game-card-title {
  padding: 10px 8px;
  font-size: 0.55rem;
  font-weight: 400;
  color: #eaeaea;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #0f3460;
  position: relative;
  z-index: 2;
}

/* ===== Ad Slot ===== */
.ad-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
}

/* ===== Detail Page ===== */
.detail-wrap {
  display: flex;
  gap: 28px;
  padding: 32px 0;
  flex: 1;
}
.detail-main {
  flex: 7;
  min-width: 0;
}
.detail-sidebar {
  flex: 3;
  min-width: 280px;
  max-width: 360px;
}
@media (max-width: 900px) {
  .detail-wrap { flex-direction: column; }
  .detail-sidebar { max-width: 100%; min-width: 0; }
}

/* Game Frame Area - 像素游戏框 */
.game-frame-wrap {
  background: #0f3460;
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9;
  border: 4px solid #ff2e63;
  box-shadow: 6px 6px 0 #ff2e63;
}
.game-frame-wrap:fullscreen,
.game-frame-wrap:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  aspect-ratio: unset;
  border: none;
  box-shadow: none;
}
.game-frame-wrap.mobile-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  z-index: 9999;
  aspect-ratio: unset;
  border: none;
  box-shadow: none;
}
.game-frame-wrap.mobile-fullscreen .fullscreen-btn {
  display: block;
  z-index: 10;
}
.game-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  position: relative;
  z-index: 1;
}
.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 46, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  transition: none;
  z-index: 3;
}
.game-overlay.hidden { opacity: 0; pointer-events: none; }
.game-overlay-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  z-index: 0;
  filter: brightness(0.9);
  image-rendering: pixelated;
}
.play-btn {
  position: relative;
  z-index: 1;
  background: #ff2e63;
  color: #1a1a2e;
  border: 4px solid #eaeaea;
  padding: 16px 32px;
  font-size: 0.7rem;
  font-family: 'Press Start 2P', monospace;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: none;
  box-shadow: 4px 4px 0 #eaeaea;
  text-transform: uppercase;
}
.play-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #eaeaea;
}
.play-btn:active {
  transform: translate(0, 0);
  box-shadow: 2px 2px 0 #eaeaea;
}

.fullscreen-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  background: #ff2e63;
  color: #1a1a2e;
  border: 2px solid #eaeaea;
  padding: 8px 16px;
  font-size: 0.5rem;
  font-family: 'Press Start 2P', monospace;
  font-weight: 400;
  cursor: pointer;
  display: none;
  transition: none;
  box-shadow: 2px 2px 0 #eaeaea;
}
.fullscreen-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 #eaeaea;
}
.game-frame-wrap.playing .fullscreen-btn { display: block; }
.game-frame-wrap.playing .game-overlay { display: none; }
.game-frame-wrap.playing .game-overlay-thumb { display: none; }

/* 移动端隐藏全屏按钮 */
@media (max-width: 768px) {
  .game-frame-wrap .fullscreen-btn {
    display: none !important;
  }
}

/* PC端（大于768px）游戏开始后显示全屏按钮 */
@media (min-width: 769px) {
  .game-frame-wrap.playing .fullscreen-btn {
    display: block;
  }
}

/* 全屏模式下隐藏按钮 */
.game-frame-wrap:fullscreen .fullscreen-btn,
.game-frame-wrap:-webkit-full-screen .fullscreen-btn {
  display: none !important;
}

/* Sidebar - 像素侧边栏 */
.detail-title {
  font-size: 0.9rem;
  font-weight: 400;
  margin-bottom: 16px;
  color: #eaeaea;
}
.detail-desc {
  font-size: 0.6rem;
  color: #a0a0a0;
  line-height: 1.8;
  margin-bottom: 20px;
}
.tips-box {
  background: #0f3460;
  border-left: 4px solid #ff2e63;
  border-top: 2px solid #ff2e63;
  border-right: 2px solid #ff2e63;
  border-bottom: 2px solid #ff2e63;
  padding: 20px;
  margin-top: 16px;
  box-shadow: 4px 4px 0 #ff2e63;
}
.tips-box h3 {
  font-size: 0.65rem;
  font-weight: 400;
  color: #ff2e63;
  margin-bottom: 12px;
}
.tips-box ul {
  list-style: none;
  padding: 0;
}
.tips-box li {
  font-size: 0.55rem;
  color: #a0a0a0;
  padding: 6px 0;
  padding-left: 16px;
  position: relative;
  line-height: 1.6;
}
.tips-box li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: #ff2e63;
}

/* Related Games */
.related-section {
  padding: 32px 0;
}
.related-section h2 {
  font-size: 0.8rem;
  font-weight: 400;
  margin-bottom: 20px;
  color: #eaeaea;
  position: relative;
  display: inline-block;
}
.related-section h2::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #ff2e63;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 768px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }

/* ===== Footer - 像素页脚 ===== */
.site-footer {
  background: #16213e;
  border-top: 4px solid #ff2e63;
  padding: 32px 0;
  margin-top: auto;
  box-shadow: 0 -4px 0 #ff2e63;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-links a {
  font-size: 0.55rem;
  color: #a0a0a0;
  transition: none;
  font-weight: 400;
  padding: 8px 12px;
  border: 2px solid #ff2e63;
  background: #0f3460;
}
.footer-links a:hover {
  color: #1a1a2e;
  background: #ff2e63;
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 #ff2e63;
}
.footer-copy {
  font-size: 0.5rem;
  color: #a0a0a0;
  margin-top: 8px;
}

/* ===== Info Pages (Contact/Policy/About) ===== */
.info-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 20px;
  flex: 1;
  background: #0f3460;
  margin-top: 32px;
  margin-bottom: 32px;
  border: 4px solid #ff2e63;
  box-shadow: 6px 6px 0 #ff2e63;
}
.info-page h1 {
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 28px;
  color: #eaeaea;
}
.info-page h2 {
  font-size: 0.7rem;
  font-weight: 400;
  margin: 32px 0 16px;
  color: #ff2e63;
  position: relative;
  padding-left: 16px;
}
.info-page h2::before {
  content: '>';
  position: absolute;
  left: 0;
  color: #ff2e63;
}
.info-page p {
  font-size: 0.6rem;
  color: #a0a0a0;
  line-height: 1.9;
  margin-bottom: 16px;
}
.info-page a {
  color: #ff2e63;
  font-weight: 400;
  transition: none;
}
.info-page a:hover {
  color: #eaeaea;
  text-shadow: 1px 1px 0 #ff2e63;
}
.info-page ul {
  list-style: none;
  padding: 0;
}
.info-page li {
  padding: 8px 0 8px 20px;
  position: relative;
  color: #a0a0a0;
  font-size: 0.6rem;
  line-height: 1.8;
}
.info-page li::before {
  content: '>';
  position: absolute;
  left: 4px;
  color: #ff2e63;
}

/* ===== Scrollbar - 像素滚动条 ===== */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track {
  background: #1a1a2e;
}
::-webkit-scrollbar-thumb {
  background: #ff2e63;
  border: 2px solid #1a1a2e;
}
::-webkit-scrollbar-thumb:hover {
  background: #ff4f7f;
}

/* ===== Retro Pixel Decorations ===== */

/* 像素装饰元素 */
.game-card::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: #ff2e63;
  opacity: 0;
  transition: none;
  z-index: 2;
}
.game-card:hover::after {
  opacity: 1;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .site-header { padding: 12px 0; }
  .logo { font-size: 0.8rem; }
  .logo-icon { width: 28px; height: 28px; font-size: 10px; }
  .detail-title { font-size: 0.75rem; }
  .info-page { margin: 20px 16px; padding: 32px 20px; }
  .info-page h1 { font-size: 0.85rem; }
  .play-btn { padding: 12px 24px; font-size: 0.6rem; }
}
