/* ============================================================
   2048 GAME — style.css
   OnlineGamePlayz Premium 2048
   ============================================================ */

/* ===== GOOGLE FONTS (imported here so HTML stays clean) ===== */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
  --bg-deep:     #07080f;
  --bg-card:     rgba(255,255,255,0.04);
  --bg-glass:    rgba(255,255,255,0.06);
  --border:      rgba(255,255,255,0.08);
  --neon-cyan:   #00f5ff;
  --neon-gold:   #ffd700;
  --neon-pink:   #ff2d78;
  --neon-green:  #39ff14;
  --text-h:      #ffffff;
  --text-b:      #b0b8cc;
  --text-dim:    #5a6377;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow-neon: 0 0 20px rgba(0,245,255,0.25), 0 0 60px rgba(0,245,255,0.08);
  --shadow-gold: 0 0 20px rgba(255,215,0,0.3);
  --trans:       all 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-deep);
  color: var(--text-b);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

a { color: var(--neon-cyan); text-decoration: none; transition: var(--trans); }
a:hover { opacity: 0.8; }
h1, h2, h3, h4 { font-family: 'Orbitron', sans-serif; color: var(--text-h); line-height: 1.2; }

/* ===== ANIMATED BACKGROUND ===== */
.bg-layer {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%,  rgba(0,245,255,0.07)  0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%,  rgba(255,45,120,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%,  rgba(255,215,0,0.03)  0%, transparent 70%);
}

canvas#particles {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; opacity: 0.5;
}

/* ===== STICKY HEADER ===== */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(7,8,15,0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(16px, 4vw, 40px);
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}

.logo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900; font-size: 1.1rem;
  color: var(--text-h); letter-spacing: 1px;
}
.logo span { color: var(--neon-cyan); }

.breadcrumb {
  font-size: 0.78rem; color: var(--text-dim);
  display: flex; align-items: center; gap: 6px;
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--neon-cyan); }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--neon-cyan); }

/* ===== MAIN LAYOUT ===== */
main {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto;
  padding: 0 clamp(16px,4vw,40px) 60px;
}

/* ===== HERO ===== */
.hero { padding: 36px 0 28px; text-align: center; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,245,255,0.08); border: 1px solid rgba(0,245,255,0.2);
  color: var(--neon-cyan); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  padding: 4px 14px; border-radius: 999px; margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 900;
  background: linear-gradient(135deg, #fff 30%, var(--neon-cyan) 70%, var(--neon-gold) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

.hero-sub {
  font-size: 1rem; color: var(--text-dim);
  max-width: 480px; margin: 0 auto 20px;
}

.hero-stats {
  display: flex; justify-content: center; gap: 24px;
  flex-wrap: wrap; font-size: 0.82rem; color: var(--text-dim);
}
.hero-stats span { display: flex; align-items: center; gap: 5px; }
.hero-stats b    { color: var(--text-h); font-weight: 600; }

/* ===== GAME SHELL ===== */
.game-shell {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(20px,4vw,36px);
  box-shadow: var(--shadow-neon);
  position: relative; overflow: hidden;
  margin-bottom: 48px;
}
.game-shell::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(0,245,255,0.03) 0%, transparent 50%, rgba(255,215,0,0.02) 100%);
  pointer-events: none;
}

/* ===== SCORE ROW ===== */
.score-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.score-boxes { display: flex; gap: 10px; }

.score-box {
  background: rgba(0,0,0,0.35); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 20px;
  text-align: center; min-width: 90px;
}
.score-box .label {
  font-size: 0.62rem; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 2px;
}
.score-box .val {
  font-family: 'Orbitron', sans-serif; font-weight: 700;
  font-size: 1.3rem; color: var(--text-h); transition: var(--trans);
}
.score-box.current .val { color: var(--neon-cyan); }
.score-box.best    .val { color: var(--neon-gold); }

/* ===== BUTTONS ===== */
.ctrl-btns { display: flex; gap: 8px; }

.btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-h);
  cursor: pointer; transition: var(--trans);
  display: flex; align-items: center; gap: 6px;
}
.btn:hover  { background: rgba(255,255,255,0.1); border-color: var(--neon-cyan); box-shadow: 0 0 12px rgba(0,245,255,0.2); }
.btn:active { transform: scale(0.96); }

.btn.primary {
  background: var(--neon-cyan); color: #07080f;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 18px rgba(0,245,255,0.35);
}
.btn.primary:hover { box-shadow: 0 0 30px rgba(0,245,255,0.55); }
.btn-icon { font-size: 0.95rem; }

/* ===== BOARD ===== */
.board-area {
  display: flex; flex-direction: column; align-items: center;
}

#board-container {
  position: relative;
  background: rgba(0,0,0,0.45);
  border-radius: 18px;
  border: 1px solid rgba(0,245,255,0.15);
  box-shadow: 0 0 40px rgba(0,245,255,0.08), inset 0 1px 0 rgba(255,255,255,0.05);
  padding: 12px;
  width: min(460px, calc(100vw - 80px));
  aspect-ratio: 1;
  touch-action: none;
}

/* Empty cell background grid */
#grid-bg {
  position: absolute; inset: 12px;
  display: grid;
  grid-template-columns: repeat(4,1fr);
  grid-template-rows:    repeat(4,1fr);
  gap: 10px;
}
.cell-bg {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
}

/* Tile layer sits on top of grid-bg */
#tile-layer { position: absolute; inset: 12px; }

/* ===== TILE BASE ===== */
.tile {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  transition: left 0.12s ease, top 0.12s ease;
  will-change: transform, left, top;
  user-select: none;
  letter-spacing: -0.5px;
}

/* ===== TILE ANIMATIONS ===== */
.tile.new    { animation: tileAppear 0.18s cubic-bezier(0.34,1.56,0.64,1) forwards; }
.tile.merged { animation: tileMerge  0.22s cubic-bezier(0.34,1.56,0.64,1) forwards; }

@keyframes tileAppear {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes tileMerge {
  0%   { transform: scale(1);    }
  45%  { transform: scale(1.22); }
  100% { transform: scale(1);    }
}

/* ===== TILE COLOR MAP — unique color per value ===== */

/* 2 — Sky Blue */
.t2 {
  background: #0a1e2e;
  color: #7dd8f8;
  border: 1px solid rgba(125,216,248,0.3);
  box-shadow: 0 2px 10px rgba(125,216,248,0.15);
}

/* 4 — Electric Teal */
.t4 {
  background: #003838;
  color: #00e5cc;
  border: 1px solid rgba(0,229,204,0.35);
  box-shadow: 0 2px 14px rgba(0,229,204,0.2);
}

/* 8 — Neon Cyan */
.t8 {
  background: #002b3d;
  color: #00f5ff;
  border: 1px solid rgba(0,245,255,0.45);
  box-shadow: 0 0 18px rgba(0,245,255,0.35), inset 0 0 8px rgba(0,245,255,0.05);
  text-shadow: 0 0 10px rgba(0,245,255,0.8);
}

/* 16 — Lime Green */
.t16 {
  background: #0a2800;
  color: #6eff3a;
  border: 1px solid rgba(110,255,58,0.4);
  box-shadow: 0 0 18px rgba(110,255,58,0.3);
  text-shadow: 0 0 10px rgba(110,255,58,0.7);
}

/* 32 — Neon Green */
.t32 {
  background: #003300;
  color: #39ff14;
  border: 1px solid rgba(57,255,20,0.5);
  box-shadow: 0 0 20px rgba(57,255,20,0.35);
  text-shadow: 0 0 12px rgba(57,255,20,0.9);
}

/* 64 — Yellow-Green */
.t64 {
  background: #1a2a00;
  color: #c8ff00;
  border: 1px solid rgba(200,255,0,0.5);
  box-shadow: 0 0 22px rgba(200,255,0,0.35);
  text-shadow: 0 0 12px rgba(200,255,0,0.8);
}

/* 128 — Golden Yellow */
.t128 {
  background: #2a2000;
  color: #ffe033;
  border: 1px solid rgba(255,224,51,0.55);
  box-shadow: 0 0 24px rgba(255,224,51,0.4);
  text-shadow: 0 0 14px rgba(255,224,51,0.9);
}

/* 256 — Amber Orange */
.t256 {
  background: #2d1800;
  color: #ff9f00;
  border: 1px solid rgba(255,159,0,0.55);
  box-shadow: 0 0 26px rgba(255,159,0,0.4);
  text-shadow: 0 0 14px rgba(255,159,0,0.9);
}

/* 512 — Neon Orange */
.t512 {
  background: #2e1000;
  color: #ff6b00;
  border: 1px solid rgba(255,107,0,0.6);
  box-shadow: 0 0 28px rgba(255,107,0,0.45);
  text-shadow: 0 0 16px rgba(255,107,0,1);
}

/* 1024 — Hot Red */
.t1024 {
  background: #300000;
  color: #ff3c3c;
  border: 1px solid rgba(255,60,60,0.6);
  box-shadow: 0 0 32px rgba(255,60,60,0.5);
  text-shadow: 0 0 16px rgba(255,60,60,1);
}

/* 2048 — GOLD (win tile) — pulsing */
.t2048 {
  background: linear-gradient(135deg, #3d2800, #7a5000);
  color: #ffd700;
  border: 2px solid rgba(255,215,0,0.85);
  box-shadow:
    0 0 50px rgba(255,215,0,0.7),
    0 0 100px rgba(255,180,0,0.3),
    inset 0 0 20px rgba(255,215,0,0.1);
  text-shadow: 0 0 20px rgba(255,215,0,1);
  animation: goldenPulse 1.2s ease-in-out infinite;
}

@keyframes goldenPulse {
  0%,100% { box-shadow: 0 0 50px rgba(255,215,0,0.7), 0 0 100px rgba(255,180,0,0.3); }
  50%      { box-shadow: 0 0 70px rgba(255,215,0,0.95), 0 0 140px rgba(255,180,0,0.5); }
}

/* 4096 — Hot Magenta */
.t4096 {
  background: #2a0030;
  color: #ff40ff;
  border: 2px solid rgba(255,64,255,0.7);
  box-shadow: 0 0 50px rgba(255,64,255,0.6), 0 0 100px rgba(255,0,255,0.3);
  text-shadow: 0 0 20px rgba(255,64,255,1);
  animation: magentaPulse 1s ease-in-out infinite;
}

@keyframes magentaPulse {
  0%,100% { box-shadow: 0 0 50px rgba(255,64,255,0.6), 0 0 100px rgba(255,0,255,0.3); }
  50%      { box-shadow: 0 0 80px rgba(255,64,255,0.9), 0 0 160px rgba(255,0,255,0.5); }
}

/* 8192+ — Ultra Violet / White Nova */
.tbig {
  background: linear-gradient(135deg, #0a0015, #12003a);
  color: #fff;
  border: 2px solid rgba(200,100,255,0.8);
  box-shadow:
    0 0 60px rgba(200,100,255,0.8),
    0 0 120px rgba(100,0,255,0.4),
    inset 0 0 30px rgba(200,100,255,0.1);
  text-shadow: 0 0 20px rgba(255,255,255,1);
  animation: novaPulse 0.8s ease-in-out infinite;
}

@keyframes novaPulse {
  0%,100% { box-shadow: 0 0 60px rgba(200,100,255,0.8), 0 0 120px rgba(100,0,255,0.4); }
  50%      { box-shadow: 0 0 90px rgba(200,100,255,1),   0 0 180px rgba(100,0,255,0.6); }
}

/* ===== OVERLAYS ===== */
.overlay {
  display: none; position: absolute; inset: 0;
  background: rgba(7,8,15,0.9);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; z-index: 50;
}
.overlay.active { display: flex; animation: fadeIn 0.3s ease; }

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

.overlay-icon  { font-size: 3rem; line-height: 1; }
.overlay-title { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 1.6rem; color: var(--text-h); text-align: center; }
.overlay-sub   { font-size: 0.9rem; color: var(--text-dim); text-align: center; }
.overlay-score { font-family: 'Orbitron', sans-serif; font-size: 2.2rem; font-weight: 900; color: var(--neon-gold); }
.overlay.win      .overlay-title { color: var(--neon-gold); text-shadow: var(--shadow-gold); }
.overlay.gameover .overlay-title { color: var(--neon-pink); }

/* ===== KEYBOARD HINT ===== */
.kbd-hint {
  margin-top: 14px; display: flex; gap: 6px;
  justify-content: center; flex-wrap: wrap; align-items: center;
}
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  font-size: 0.8rem; color: var(--text-b);
}

/* ===== AD PLACEHOLDER ===== */
.ad-banner {
  background: rgba(255,255,255,0.02);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius); padding: 20px;
  text-align: center; color: var(--text-dim);
  font-size: 0.75rem; letter-spacing: 1px;
  text-transform: uppercase; margin-bottom: 40px;
}

/* ===== CONTENT SECTIONS ===== */
.section { margin-bottom: 52px; }

.section-title {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 700; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.section-title .accent { color: var(--neon-cyan); }
.section-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(0,245,255,0.3), transparent);
}

p { margin-bottom: 14px; color: var(--text-b); }

/* ===== HOW TO PLAY STEPS ===== */
.steps { display: flex; flex-direction: column; gap: 14px; }

.step {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px;
  transition: var(--trans);
}
.step:hover { border-color: rgba(0,245,255,0.25); box-shadow: 0 0 16px rgba(0,245,255,0.07); }

.step-num {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-cyan), rgba(0,245,255,0.4));
  color: #07080f; font-family: 'Orbitron', sans-serif;
  font-weight: 900; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
}
.step h3 { font-size: 0.95rem; font-family: 'DM Sans', sans-serif; color: var(--text-h); margin-bottom: 4px; }
.step p  { margin: 0; font-size: 0.88rem; }

/* ===== TIPS GRID ===== */
.tips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 14px; }

.tip-card {
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px; transition: var(--trans);
}
.tip-card:hover { border-color: rgba(255,215,0,0.3); box-shadow: 0 0 16px rgba(255,215,0,0.08); }
.tip-card .tip-icon { font-size: 1.8rem; margin-bottom: 10px; }
.tip-card h3 { font-size: 0.9rem; font-family: 'DM Sans', sans-serif; color: var(--text-h); margin-bottom: 6px; }
.tip-card p  { margin: 0; font-size: 0.84rem; }

/* ===== FEATURES GRID ===== */
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; }

.feature-card {
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px; text-align: center;
  transition: var(--trans);
}
.feature-card:hover { border-color: rgba(0,245,255,0.3); transform: translateY(-3px); }
.feature-card .fi { font-size: 2rem; margin-bottom: 10px; }
.feature-card h3  { font-size: 0.85rem; font-family: 'DM Sans', sans-serif; color: var(--text-h); margin-bottom: 4px; }
.feature-card p   { margin: 0; font-size: 0.78rem; color: var(--text-dim); }

/* ===== FAQ ===== */
.faq { display: flex; flex-direction: column; gap: 10px; }

details {
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; transition: border-color 0.2s;
}
details[open] { border-color: rgba(0,245,255,0.3); }

summary {
  padding: 16px 20px; font-weight: 600; color: var(--text-h);
  cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.95rem;
}
summary::-webkit-details-marker { display: none; }
summary::after        { content: '＋'; color: var(--neon-cyan); font-size: 1.1rem; }
details[open] summary::after { content: '－'; }

.faq-body { padding: 0 20px 16px; font-size: 0.9rem; color: var(--text-b); }

/* ===== RELATED GAMES ===== */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; }

.game-card {
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 18px; text-align: center;
  transition: var(--trans); display: block;
}
.game-card:hover {
  border-color: rgba(0,245,255,0.3); transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.game-card .gi { font-size: 2.4rem; margin-bottom: 10px; }
.game-card h3  { font-size: 0.9rem; font-family: 'Orbitron', sans-serif; color: var(--text-h); margin-bottom: 6px; }
.game-card p   { font-size: 0.78rem; color: var(--text-dim); margin: 0 0 14px; }
.game-card .play-btn {
  display: inline-block; padding: 7px 16px;
  background: rgba(0,245,255,0.1); border: 1px solid rgba(0,245,255,0.3);
  border-radius: 999px; color: var(--neon-cyan);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.5px;
}

/* ===== FOOTER ===== */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text3);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .score-row  { flex-direction: column; align-items: stretch; }
  .score-boxes { justify-content: center; }
  .ctrl-btns  { justify-content: center; }
}
