/* 复古像素风格，适配PC和移动端 */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
:root {
  --primary: #1e2a78;
  --secondary: #ffe066;
  --accent: #ff3860;
  --green: #2ed573;
  --bg: #232946;
  --nav-bg: #161b33;
  --card-bg: #232946;
  --card-radius: 0;
  --card-border: 4px solid #ffe066;
  --tabbar-bg: #161b33;
  --tabbar-active: #ffe066;
  --tabbar-inactive: #b0b8c7;
  --text-main: #ffe066;
  --text-secondary: #fff;
  --btn-bg: #ffe066;
  --btn-text: #1e2a78;
  --btn-border: 4px solid #1e2a78;
}
a{
  text-decoration: none;
}

body {
  margin: 0;
  font-family: 'Press Start 2P', 'Consolas', 'monospace', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-main);
}
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  background: var(--nav-bg);
  color: var(--text-main);
  padding: 0 1.2em;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 4px solid var(--secondary);
}
.mobile-header .logo {
  font-size: 1.1em;
  font-family: 'Press Start 2P', monospace;
  color: var(--secondary);
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #1e2a78, 0 0 2px #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}
.mobile-header .search-btn {
  background: var(--secondary);
  border: var(--btn-border);
  color: var(--primary);
  font-size: 1.2em;
  cursor: pointer;
  border-radius: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  transition: background 0.18s, color 0.18s;
  flex-shrink: 0;
}
.mobile-header .search-btn:active {
  background: var(--accent);
  color: #fff;
}
.pc-nav {
  display: none;
}
@media (min-width: 900px) {
  .mobile-header {
    position: static;
    background: var(--nav-bg);
    border-bottom: 4px solid var(--secondary);
    height: 70px;
    padding: 0 2.5em;
    justify-content: flex-start;
    gap: 2.5em;
  }
  .mobile-header .logo {
    font-size: 1.3em;
    margin-right: 2.5em;
    max-width: none;
  }
  .mobile-header .search-btn {
    font-size: 1.1em;
    margin-left: auto;
  }
  .pc-nav {
    display: flex !important;
    gap: 2em;
    align-items: center;
    margin-left: 0.5em;
  }
  .pc-nav a {
    color: var(--secondary);
    font-size: 1em;
    font-family: 'Press Start 2P', monospace;
    text-decoration: none;
    padding: 0.2em 1em;
    border-radius: 0;
    background: var(--primary);
    border: 4px solid var(--secondary);
    margin-right: 0.5em;
    transition: background 0.18s, color 0.18s;
  }
  .pc-nav a.active, .pc-nav a:hover {
    background: var(--secondary);
    color: var(--primary);
  }
}
.mobile-main {
  padding: 1em 0.5em 4em 0.5em;
  max-width: 520px;
  margin: 0 auto;
}
@media (min-width: 900px) {
  .mobile-main {
    max-width: 1200px;
    margin: 2em auto 0 auto;
    padding: 2em 2em 2em 2em;
  }
}
@media (min-width: 1400px) {
  .mobile-main {
    max-width: 1400px;
    padding: 2em 0 2em 0;
  }
}
.hero-mobile, .banner-hero {
  text-align: center;
  margin: 2.5em 0 2em 0;
}
.hero-mobile h1, .banner-hero h1 {
  font-size: 1.2em;
  margin: 0 0 0.7em 0;
  color: var(--secondary);
  font-family: 'Press Start 2P', monospace;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #1e2a78, 0 0 2px #fff;
}
.hero-mobile p, .banner-hero p {
  color: var(--text-secondary);
  font-size: 0.9em;
  margin: 0;
  font-family: 'Press Start 2P', monospace;
}
.category-scroll-nav {
  display: flex;
  gap: 0.7em;
  overflow-x: auto;
  padding: 0.5em 0 1.2em 0;
  margin-bottom: 1.2em;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.category-scroll-nav::-webkit-scrollbar {
  display: none;
}
.category-scroll-nav .cat-btn {
  flex: 0 0 auto;
  font-size: 0.9em;
  font-family: 'Press Start 2P', monospace;
  font-weight: 700;
  border-radius: 0;
  padding: 0.5em 1.2em;
  background: var(--primary);
  color: var(--secondary);
  border: 4px solid var(--secondary);
  margin-bottom: 0;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.category-scroll-nav .cat-btn.active, .category-scroll-nav .cat-btn:active {
  background: var(--secondary);
  color: var(--primary);
  border: 4px solid var(--primary);
  transform: scale(1.05);
}
.game-list-mobile {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
}
@media (min-width: 900px) {
  .game-list-mobile {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2em;
  }
}
.game-card-mobile {
  display: flex;
  background: var(--card-bg);
  border-radius: var(--card-radius);
  border: var(--card-border);
  box-sizing: border-box;
  overflow: hidden;
  text-decoration: none;
  color: var(--secondary);
  position: relative;
  align-items: center;
  min-height: 110px;
  font-family: 'Press Start 2P', monospace;
  transition: border 0.18s, transform 0.15s;
}
.game-card-mobile:active, .game-card-mobile:hover {
  border: 4px solid var(--accent);
  background: var(--primary);
  color: #fff;
  transform: scale(1.02);
}
.game-card-mobile img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 0;
  background: var(--secondary);
  margin: 0.7em;
  border: 4px solid var(--primary);
}
@media (min-width: 900px) {
  .game-card-mobile {
    min-width: 0;
    max-width: 100%;
    flex-direction: column;
    align-items: stretch;
    height: 100%;
  }
  .game-card-mobile img {
    width: 100%;
    height: 120px;
    border-radius: 0;
    margin: 0;
  }
}
.game-info-mobile {
  padding: 0.7em 1em;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
@media (min-width: 900px) {
  .game-info-mobile {
    padding: 1em 1em 1.2em 1em;
    text-align: left;
  }
}
.game-info-mobile h3 {
  font-size: 0.9em;
  margin: 0 0 0.3em 0;
  font-weight: 700;
  color: var(--secondary);
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.game-info-mobile p {
  font-size: 0.8em;
  color: var(--green);
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1em;
  word-wrap: break-word;
  word-break: break-word;
}
.btn-primary {
  display: inline-block;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: var(--btn-border);
  border-radius: 0;
  padding: 0.7em 2em;
  font-size: 0.9em;
  font-family: 'Press Start 2P', monospace;
  font-weight: bold;
  cursor: pointer;
  margin: 1em 0 0.5em 0;
  transition: background 0.2s, color 0.2s, border 0.2s, transform 0.15s;
}
.btn-primary:active {
  background: var(--accent);
  color: #fff;
  border: 4px solid var(--primary);
  transform: scale(0.97);
}
.mobile-tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 54px;
  background: var(--tabbar-bg);
  border-top: 4px solid var(--secondary);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 20;
}
@media (min-width: 900px) {
  .mobile-tabbar { display: none !important; }
}
.tab-item {
  flex: 1;
  text-align: center;
  color: var(--tabbar-inactive);
  font-size: 0.9em;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  padding-top: 2px;
  font-family: 'Press Start 2P', monospace;
  border-radius: 0;
  border-right: 2px solid #1e2a78;
  background: var(--nav-bg);
  transition: color 0.18s, background 0.18s;
}
.tab-item:last-child { border-right: none; }
.tab-item.active,
.tab-item:active {
  color: var(--tabbar-active);
  font-weight: 700;
  background: var(--secondary);
}
.tab-item span {
  font-size: 0.8em;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.page-main {
  background: var(--card-bg);
  border-radius: 0;
  border: 4px solid var(--secondary);
  padding: 2em 1.2em;
  margin: 1.5em 0 2em 0;
  color: var(--text-main);
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  font-family: 'Press Start 2P', monospace;
}
@media (min-width: 900px) {
  .page-main {
    max-width: 700px;
    margin: 2em auto 2em auto;
    padding: 2em 2em;
  }
}
.page-main h1, .page-main h2 {
  color: var(--secondary);
  font-family: 'Press Start 2P', monospace;
}
.page-main a {
  color: var(--accent);
  text-decoration: underline;
}
.page-main label, .page-main input, .page-main textarea {
  color: var(--primary);
  background: #fff;
  border-radius: 0;
  border: 4px solid var(--secondary);
  padding: 0.5em 1em;
  margin-bottom: 1em;
  font-size: 0.9em;
  font-family: 'Press Start 2P', monospace;
}
.page-main button {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: var(--btn-border);
  border-radius: 0;
  padding: 0.7em 2em;
  font-size: 0.9em;
  font-family: 'Press Start 2P', monospace;
  font-weight: bold;
  cursor: pointer;
  margin-top: 1em;
  transition: background 0.2s, color 0.2s, border 0.2s, transform 0.15s;
}
.page-main button:active {
  background: var(--accent);
  color: #fff;
  border: 4px solid var(--primary);
  transform: scale(0.97);
}
@media (max-width: 400px) {
  .mobile-header, .mobile-main {
    padding-left: 0.2em;
    padding-right: 0.2em;
  }
  .game-card-mobile img {
    width: 70px;
    height: 70px;
  }
  .page-main {
    padding: 1em 0.3em;
  }
  .mobile-header .logo {
    font-size: 0.9em;
    max-width: 50%;
  }
  .game-info-mobile h3 {
    font-size: 0.8em;
  }
  .game-info-mobile p {
    font-size: 0.7em;
    -webkit-line-clamp: 1;
  }
} 

@media (max-width: 900px) {
  .game-item{
    display: flex;
    width: 100%;
  }
  .mobile-header .logo {
    font-size: 1em;
    max-width: 90vw;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.2;
    word-break: break-word;
    display: block;
    max-height: 2.6em;
  }
}

.banner-hero h1 {
  font-size: 2em;
  max-width: 95vw;
  margin: 0 auto 0.7em auto;
  white-space: normal;
  word-break: break-word;
  line-height: 1.2;
  overflow-wrap: break-word;
  text-align: center;
}

@media (max-width: 400px) {
  .banner-hero h1 {
    font-size: 1.2em;
    max-width: 98vw;
  }
  .mobile-header .logo {
    font-size: 0.8em;
    max-height: 3em;
  }
}

/* 修复游戏标题和描述的溢出问题 */
.game-item-title{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  word-wrap: break-word;
  word-break: break-word;
}

.game-item-desc{
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1em;
  word-wrap: break-word;
  word-break: break-word;
}

/* 额外的小屏幕优化 */
@media (max-width: 320px) {
  .game-card-mobile {
    min-height: 100px;
  }
  .game-card-mobile img {
    width: 60px;
    height: 60px;
    margin: 0.5em;
  }
  .game-info-mobile {
    padding: 0.5em 0.7em;
  }
  .game-info-mobile h3 {
    font-size: 0.7em;
  }
  .game-info-mobile p {
    font-size: 0.6em;
    -webkit-line-clamp: 1;
  }
}
