/* ========================================
   GamePortal - Minimalist Modern Style
   极简现代风格游戏网站
   ======================================== */

/* --- CSS Variables --- */
:root {
  --white: #FFFFFF;
  --light-gray: #F8F9FA;
  --mid-gray: #E9ECEF;
  --text-dark: #2D3436;
  --text-muted: #636E72;
  --accent: #00B894;
  --accent-hover: #00A381;
  --accent-light: #E6FFF9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 8px;
  --sidebar-width: 220px;
  --header-height: 60px;
  --transition: 0.2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--white);
  color: var(--text-dark);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--mid-gray);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
}

.site-logo svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.search-box {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border: 1px solid var(--mid-gray);
  border-radius: 24px;
  font-size: 14px;
  font-family: inherit;
  background: var(--light-gray);
  color: var(--text-dark);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.15);
  background: var(--white);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.btn-random {
  padding: 10px 20px;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn-random:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--mid-gray);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 90;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 20px;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  margin: 2px 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  transition: background var(--transition), color var(--transition);
}

.sidebar-nav a:hover {
  background: var(--light-gray);
}

.sidebar-nav a.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-nav .cat-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.sidebar-nav a.active .cat-icon {
  opacity: 1;
}

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.content-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.game-count {
  font-size: 13px;
  color: var(--text-muted);
}

/* --- Game Grid --- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.game-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.game-card .thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--light-gray);
}

.game-card .card-info {
  padding: 10px 12px;
}

.game-card .card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card .card-category {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* No results */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.no-results p {
  font-size: 16px;
}

/* --- Footer --- */
.site-footer {
  margin-left: var(--sidebar-width);
  border-top: 1px solid var(--mid-gray);
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--accent);
  transition: color var(--transition);
}

.site-footer a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
}

/* --- Detail Page Styles --- */
.detail-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 20px;
  transition: color var(--transition);
}

.detail-back:hover {
  color: var(--accent);
}

.detail-layout {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 24px;
  align-items: start;
}

.game-player-area {
  background: var(--light-gray);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.game-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4/3;
  gap: 16px;
  color: var(--text-muted);
}

.game-placeholder svg {
  width: 64px;
  height: 64px;
  opacity: 0.4;
}

.btn-play {
  padding: 14px 36px;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.btn-play:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.game-iframe {
  width: 100%;
  border: none;
  display: block;
}

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.detail-description {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

.tips-box {
  background: var(--accent-light);
  border-radius: var(--radius);
  padding: 16px;
}

.tips-box h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 8px;
}

.tips-box ul {
  list-style: none;
  padding: 0;
}

.tips-box li {
  font-size: 14px;
  color: var(--text-dark);
  padding: 4px 0;
  padding-left: 16px;
  position: relative;
}

.tips-box li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--light-gray);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* --- Related Games --- */
.related-section {
  margin-top: 40px;
}

.related-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

/* --- Game Modal (for iframe) --- */
.game-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.game-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.game-modal {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.game-modal .modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 32px;
  height: 32px;
  background: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-dark);
  transition: background var(--transition);
  z-index: 10;
}

.game-modal .modal-close:hover {
  background: var(--light-gray);
}

.game-modal iframe {
  display: block;
  border: none;
}

/* --- Static Pages (About, Contact, Privacy) --- */
.static-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px;
}

.static-page h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
}

.static-page h2 {
  font-size: 20px;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 12px;
}

.static-page p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 14px;
}

.static-page ul {
  list-style: none;
  padding: 0;
  margin-bottom: 14px;
}

.static-page li {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.8;
  padding-left: 20px;
  position: relative;
}

.static-page li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.static-page a {
  color: var(--accent);
}

.static-page a:hover {
  text-decoration: underline;
}

/* --- Mobile Bottom Tab Bar --- */
.mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--mid-gray);
  z-index: 100;
  padding: 4px 0;
  padding-bottom: env(safe-area-inset-bottom, 4px);
}

.mobile-tabbar-inner {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
  padding: 0 4px;
}

.mobile-tabbar-inner::-webkit-scrollbar {
  display: none;
}

.mobile-tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 56px;
  flex-shrink: 0;
  transition: color var(--transition);
}

.mobile-tabbar a.active {
  color: var(--accent);
}

.mobile-tabbar a svg {
  width: 20px;
  height: 20px;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
  .game-grid,
  .related-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 992px) {
  .game-grid,
  .related-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content,
  .site-footer {
    margin-left: 0;
  }

  .mobile-tabbar {
    display: block;
  }

  .main-content {
    padding-bottom: 100px;
  }

  .site-footer {
    padding-bottom: 90px;
  }

  .game-grid,
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .site-header {
    padding: 0 12px;
    gap: 10px;
  }

  .site-logo span {
    display: none;
  }

  .btn-random span {
    display: none;
  }

  .search-box {
    max-width: none;
  }

  .content-header h2 {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .game-grid,
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .game-card .card-title {
    font-size: 12px;
  }
}
