/* ==========================================================================
   ApexPlay - Modern H5 Game Arcade Stylesheet
   ========================================================================== */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --accent: #ec4899;
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --radius-md: 12px;
  --radius-lg: 20px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --max-width: 1100px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.wrap {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.35rem;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.logo img {
  width: 36px;
  height: 36px;
}

.logo span {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: #ffffff;
  background: #334155;
}

.btn-cross-promo {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff !important;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
  font-size: 0.85rem;
}

.btn-cross-promo:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.5);
}

/* Hero */
.hero {
  text-align: center;
  padding: 40px 0 24px 0;
}

.hero h1 {
  font-size: 2.3rem;
  font-weight: 900;
  margin-bottom: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Ad Cage */
.ad-box {
  margin: 24px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 4px;
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin: 32px 0 60px 0;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: #6366f1;
}

.game-thumb-wrap {
  aspect-ratio: 16 / 10;
  position: relative;
  overflow: hidden;
}

.game-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  font-size: 11px;
  font-weight: 750;
  padding: 4px 10px;
  border-radius: 20px;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.game-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.game-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: #ffffff;
}

.game-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-grow: 1;
}

.btn-play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  font-weight: 750;
  padding: 12px;
  border-radius: 8px;
  transition: opacity 0.2s ease;
}

.btn-play:hover {
  opacity: 0.9;
}

/* Play Page View */
.play-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px auto 50px auto;
  max-width: 600px;
}

.game-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.score-board {
  display: flex;
  gap: 12px;
}

.score-pill {
  background: #1e293b;
  border: 1px solid #334155;
  padding: 6px 16px;
  border-radius: 8px;
  text-align: center;
}

.score-pill .label {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
}

.score-pill .val {
  font-size: 1.2rem;
  font-weight: 850;
  color: #38bdf8;
}

.game-canvas-box {
  width: 100%;
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* 2048 Board */
.grid-2048 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  background: #0f172a;
  padding: 10px;
  border-radius: 10px;
}

.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  border-radius: 6px;
  background: #1e293b;
  color: #f8fafc;
  user-select: none;
}

/* Footer */
footer {
  background: #0b1120;
  border-top: 1px solid var(--border-color);
  padding: 36px 0;
  margin-top: auto;
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 12px;
}

.footer-links a:hover {
  color: #94a3b8;
}
