@font-face {
  font-family: "Clear Sans";
  src: url('../clear-sans.ttf') format('truetype');
}

html{
  scroll-behavior: smooth;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

/* Match original page body styling exactly */
body {
  background: #080808;
  color: #fff;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  font-family: "Inter", "Clear Sans", sans-serif;
}

nav, nav ul, nav ul li, nav ul li a, .container, .logo, #header, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
}

/* Match original page header styling exactly */
#header {
  width: 100%;
  height: 100vh;
  background: transparent;
}

.container {
  padding: 10px 10%;
}


nav {
  position: fixed;
  top: -20px;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  background: transparent;
  padding: 10px 10%;
  margin-left: -15px;
  z-index: 1000;
}

.logo {
  width: 200px;
}

/* Navigation headers */ 
nav ul li {
  display: inline-block;
  list-style: none;
  margin: 0px 20px;
}

nav ul li a {
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  position: relative;
}

nav ul li a::after {
  content: '';
  width: 0;
  height: 3px;
  background: #ff004f;
  position: absolute;
  left: 0;
  bottom: -6px;
  transition: 0.5s;
}

nav ul li a:hover::after {
  width: 100%;
}

/* Game container for centering the game content */
.game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-content: center;
  align-items: center;
  font-size: 21px;
  overflow: hidden;
  z-index: 1;
}

.title {
  font-size: 60px;
  margin-bottom: 20px;
  font-weight: 700;
  background: linear-gradient(45deg, #ff006e, #8338ec, #3a86ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

.header {
  display: flex;
  gap: 40px;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  justify-content: center;
}

.score-container {
  background: #1a1a1a;
  padding: 15px 30px;
  border-radius: 10px;
  border: 2px solid #262626;
  text-align: center;
}

.score-label {
  font-size: 18px;
  color: #ababab;
  margin-bottom: 5px;
}

.score-value {
  font-size: 36px;
  font-weight: 600;
  color: #ff006e;
  min-width: 80px;
}

.new-game-btn {
  padding: 15px 40px;
  font-size: 18px;
  font-weight: 500;
  background: linear-gradient(45deg, #ff006e, #8338ec);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  transform: translateY(0);
}

.new-game-btn:hover {
  background: linear-gradient(45deg, #e6005c, #7430d4);
  transform: translateY(-2px);
}

.text {
  order: 2;
  padding-top: 40px;
  width: 440px;
  font-weight: bold;
}

.board {
  order: 1;
  width: 380px;
  height: 380px;
  padding: 15px;
  background-color: #1a1a1a;
  border-radius: 15px;
  outline: none;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 2px solid #262626;
}

.board .cell, .tile {
  user-select: none;
  cursor: default;
}

.cell {
  width: 90px;
  height: 90px;
  border-radius: 8px;
  background-color: #161616;
  position: absolute;
  user-select: none;
  cursor: default;
}

.cell.position_0_0 { top: 0px; left: 0px; }
.cell.position_0_1 { top: 0px; left: 100px; }
.cell.position_0_2 { top: 0px; left: 200px; }
.cell.position_0_3 { top: 0px; left: 300px; }
.cell.position_1_0 { top: 100px; left: 0px; }
.cell.position_1_1 { top: 100px; left: 100px; }
.cell.position_1_2 { top: 100px; left: 200px; }
.cell.position_1_3 { top: 100px; left: 300px; }
.cell.position_2_0 { top: 200px; left: 0px; }
.cell.position_2_1 { top: 200px; left: 100px; }
.cell.position_2_2 { top: 200px; left: 200px; }
.cell.position_2_3 { top: 200px; left: 300px; }
.cell.position_3_0 { top: 300px; left: 0px; }
.cell.position_3_1 { top: 300px; left: 100px; }
.cell.position_3_2 { top: 300px; left: 200px; }
.cell.position_3_3 { top: 300px; left: 300px; }

.tile {
  width: 90px;
  height: 90px;
  line-height: 90px;
  display: inline-block;
  font-size: 36px;
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
  border-radius: 8px;
  font-family: "Inter", "Clear Sans", sans-serif;
  transition: all 0.6s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.tile0 {
  background-color: #1a1a1a;
  color: #aaaaaa;
  box-shadow: none;
}

.tile2 {
  background-color: #2d2d2d;
  color: #aaaaaa;
  font-size: 36px;
}

.tile4 {
  background-color: #3d3d3d;
  color: #aaaaaa;
  font-size: 36px;
}

.tile8 {
  color: #ffffff;
  background-color: #b35900;
  font-size: 36px;
}

.tile16 {
  color: #ffffff;
  background-color: #cc6633;
  font-size: 36px;
}

.tile32 {
  color: #ffffff;
  background-color: #cc8833;
  font-size: 36px;
}

.tile64 {
  color: #ffffff;
  background-color: #ccaa33;
  font-size: 36px;
}

.tile128 {
  color: #ffffff;
  background-color: #2d8c4d;
  font-size: 36px;
}

.tile256 {
  color: #ffffff;
  background-color: #31a66a;
  font-size: 36px;
}

.tile512 {
  color: #ffffff;
  background-color: #3178a6;
  font-size: 36px;
}

.tile1024 {
  color: #ffffff;
  background-color: #2d5c99;
  font-size: 36px;
}

.tile2048 {
  color: #ffffff;
  background-color: #673ab7;
  font-size: 36px;
}

.tile4096 {
  color: #ffffff;
  background-color: #8e3a69;
  font-size: 36px;
}

.tile8192 {
  color: #ffffff;
  background-color: #993333;
  font-size: 36px;
}

.tile {
  position: absolute;
}

.tile.merged {
  display: none;
}

.tile.merged.isMoving {
  display: inline;
}

.tile.new, .overlay {
  animation-duration: 0.20s;
  animation-name: newTile;
  animation-fill-mode: forwards;
  animation-delay: 0.15s;
  transform: scale(0);
}

@keyframes newTile {
  from {
    transform: scale(0);
  }

  to {
    transform: scale(1);
  }
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.overlay-content {
  background: #1a1a1a;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  border: 2px solid #ff006e;
  animation: slideIn 0.5s ease;
}

.overlay-title {
  font-size: 48px;
  margin-bottom: 20px;
  color: #ff006e;
}

.overlay-score {
  font-size: 24px;
  margin-bottom: 30px;
  color: #ababab;
}

.overlay-score-value {
  color: #ff006e;
  font-weight: 600;
}

.overlay-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.tryAgain {
  padding: 15px 40px;
  font-size: 20px;
  background: linear-gradient(45deg, #ff006e, #8338ec);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.tryAgain:hover {
  background: linear-gradient(45deg, #e6005c, #7430d4);
}

.continue-btn {
  padding: 15px 30px;
  font-size: 18px;
  background: linear-gradient(45deg, #ff006e, #8338ec);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.continue-btn:hover {
  background: linear-gradient(45deg, #e6005c, #7430d4);
}

.new-game-overlay-btn {
  padding: 15px 30px;
  font-size: 18px;
  background: #262626;
  color: #fff;
  border: 2px solid #ff006e;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.new-game-overlay-btn:hover {
  background: #363636;
}

.controls {
  margin-top: 30px;
  text-align: center;
  color: #ababab;
  font-size: 16px;
  line-height: 1.8;
}

.controls p {
  margin: 10px 0;
}

.control-key {
  color: #ff006e;
  font-weight: 600;
}

@keyframes slideIn {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}