* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  position: relative;
  touch-action: none;
}

#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.game-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.game-header {
  text-align: center;
  margin-bottom: 30px;
  animation: fadeInDown 1s ease-out;
}

h1 {
  font-size: 3.5em;
  background: linear-gradient(45deg, #00f260, #0575e6, #00f260);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
  text-shadow: 0 0 30px rgba(0, 242, 96, 0.5);
  margin-bottom: 10px;
  font-weight: 900;
  letter-spacing: 3px;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.score-board {
  display: flex;
  gap: 30px;
  margin-bottom: 30px;
  animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.score-item {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 20px 40px;
  border-radius: 15px;
  color: white;
  font-size: 1.3em;
  font-weight: bold;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.score-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 242, 96, 0.3);
}

.score-item span {
  color: #00f260;
  font-size: 1.4em;
  text-shadow: 0 0 10px rgba(0, 242, 96, 0.8);
}

#gameCanvas {
  border-radius: 20px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 100px rgba(0, 242, 96, 0.2);
  animation: fadeIn 1s ease-out 0.5s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.controls {
  margin-top: 30px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  animation: fadeInUp 1s ease-out 0.8s both;
}

.controls p {
  margin: 12px 0;
  font-size: 1.2em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.btn {
  margin-top: 20px;
  padding: 15px 40px;
  font-size: 1.2em;
  background: linear-gradient(45deg, #00f260, #0575e6);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-weight: bold;
  box-shadow: 0 10px 30px rgba(0, 242, 96, 0.4);
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(0, 242, 96, 0.6);
}

.btn:active {
  transform: translateY(-1px);
}

.game-over {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 12, 41, 0.95);
  backdrop-filter: blur(20px);
  border: 3px solid rgba(0, 242, 96, 0.5);
  padding: 50px;
  border-radius: 30px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.7),
    0 0 100px rgba(0, 242, 96, 0.3);
  z-index: 1000;
  text-align: center;
}

.game-over.show {
  display: block;
  animation: gameOverPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes gameOverPop {
  0% {
    transform: translate(-50%, -50%) scale(0.5) rotate(-10deg);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 1;
  }
}

.game-over h2 {
  background: linear-gradient(45deg, #ff0844, #ffb199);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  font-size: 3em;
  font-weight: 900;
}

.game-over p {
  color: white;
  font-size: 1.5em;
  margin: 15px 0;
}

.game-over .final-score {
  color: #00f260;
  font-size: 2em;
  text-shadow: 0 0 20px rgba(0, 242, 96, 0.8);
  font-weight: bold;
}

.signature {
  position: fixed;
  bottom: 15px;
  right: 25px;
  font-size: 1.6em;
  font-weight: bold;
  background: linear-gradient(45deg, #00f260, #0575e6, #00f260);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
  text-shadow: 0 0 20px rgba(0, 242, 96, 0.5);
  z-index: 100;
}

.social-links {
  position: fixed;
  bottom: 15px;
  left: 25px;
  display: flex;
  gap: 20px;
  z-index: 100;
}

.social-links a {
  font-size: 1.6em;
  text-decoration: none;
  background: linear-gradient(45deg, #00f260, #0575e6, #00f260);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
  text-shadow: 0 0 20px rgba(0, 242, 96, 0.6);
  transition:
    transform 0.3s ease,
    text-shadow 0.3s ease;
}

.social-links a:hover {
  transform: scale(1.3);
  text-shadow: 0 0 35px rgba(0, 242, 96, 0.9);
}

.pause-screen {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 12, 41, 0.95);
  backdrop-filter: blur(20px);
  border: 3px solid rgba(255, 193, 7, 0.5);
  padding: 50px;
  border-radius: 30px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.7),
    0 0 100px rgba(255, 193, 7, 0.3);
  z-index: 1000;
  text-align: center;
}

.pause-screen.show {
  display: block;
  animation: gameOverPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.pause-screen h2 {
  background: linear-gradient(45deg, #ffc107, #ff8c00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  font-size: 3em;
  font-weight: 900;
}

.pause-screen p {
  color: white;
  font-size: 1.5em;
  margin: 15px 0;
}

.tutorial-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 12, 41, 0.98);
  backdrop-filter: blur(20px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.5s ease-out;
}

.tutorial-screen.hide {
  animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    pointer-events: none;
  }
}

.tutorial-content {
  text-align: center;
  animation: scaleIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.tutorial-title {
  font-size: 3em;
  background: linear-gradient(45deg, #00f260, #0575e6, #00f260);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
  font-weight: 900;
  margin-bottom: 40px;
}

.controls-display {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(0, 242, 96, 0.3);
  border-radius: 20px;
  padding: 40px 60px;
  margin: 30px 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.arrow-keys {
  display: grid;
  grid-template-columns: repeat(3, 80px);
  grid-template-rows: repeat(2, 80px);
  gap: 10px;
  margin: 20px auto;
  width: fit-content;
}

.keys-container {
  display: flex;
  gap: 50px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.wasd-keys {
  display: grid;
  grid-template-columns: repeat(3, 80px);
  grid-template-rows: repeat(2, 80px);
  gap: 10px;
}

.key-button {
  background: linear-gradient(145deg, rgba(0, 242, 96, 0.2), rgba(5, 117, 230, 0.2));
  border: 2px solid rgba(0, 242, 96, 0.5);
  border-radius: 15px;
  color: white;
  font-size: 2em;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 20px rgba(0, 242, 96, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
  animation: keyPulse 2s ease-in-out infinite;
}

@keyframes keyPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 5px 20px rgba(0, 242, 96, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 242, 96, 0.6);
  }
}

.key-button:hover {
  transform: scale(1.1);
  background: linear-gradient(145deg, rgba(0, 242, 96, 0.4), rgba(5, 117, 230, 0.4));
  box-shadow: 0 10px 40px rgba(0, 242, 96, 0.7);
}

.key-up {
  grid-column: 2;
  grid-row: 1;
}

.key-left {
  grid-column: 1;
  grid-row: 2;
}

.key-down {
  grid-column: 2;
  grid-row: 2;
}

.key-right {
  grid-column: 3;
  grid-row: 2;
}

.tutorial-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.4em;
  margin: 30px 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.start-prompt {
  color: #00f260;
  font-size: 1.6em;
  font-weight: bold;
  margin-top: 40px;
  animation: blink 1.5s ease-in-out infinite;
  text-shadow: 0 0 20px rgba(0, 242, 96, 0.8);
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Mobile Controls - Compact Directional Arrows */

.mobile-controls {
  display: none;
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  touch-action: none;
}

.directional-pad {
  display: grid;
  grid-template-columns: repeat(3, 50px);
  grid-template-rows: repeat(3, 50px);
  gap: 5px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(0, 242, 96, 0.3);
  border-radius: 15px;
  padding: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.arrow-btn {
  width: 50px;
  height: 50px;
  background: linear-gradient(145deg, rgba(0, 242, 96, 0.3), rgba(5, 117, 230, 0.3));
  border: 2px solid rgba(0, 242, 96, 0.5);
  border-radius: 10px;
  color: white;
  font-size: 1.5em;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  touch-action: manipulation;
}

.arrow-btn:active {
  background: linear-gradient(145deg, rgba(0, 242, 96, 0.6), rgba(5, 117, 230, 0.6));
  transform: scale(0.92);
  box-shadow: 0 0 15px rgba(0, 242, 96, 0.8);
}

.arrow-up {
  grid-column: 2;
  grid-row: 1;
}

.arrow-left {
  grid-column: 1;
  grid-row: 2;
}

.arrow-center {
  grid-column: 2;
  grid-row: 2;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 2px solid rgba(255, 255, 255, 0.1) !important;
  cursor: default;
  font-size: 1em;
}

.arrow-center:active {
  background: rgba(255, 255, 255, 0.05) !important;
  transform: none !important;
  box-shadow: none !important;
}

.arrow-right {
  grid-column: 3;
  grid-row: 2;
}

.arrow-down {
  grid-column: 2;
  grid-row: 3;
}

.mobile-buttons {
  position: fixed;
  bottom: 130px;
  right: 20px;
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.mobile-btn {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(0, 242, 96, 0.4);
  border-radius: 50%;
  color: white;
  font-size: 1em;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  touch-action: manipulation;
  user-select: none;
  transition: all 0.15s ease;
}

.mobile-btn:active {
  transform: scale(0.92);
  background: rgba(0, 242, 96, 0.3);
}

/* Απόκρυψη του χρωματιστού κεντρικού κουμπιού στα mobile */

@media (max-width: 768px) {
  .arrow-center {
    display: none !important;
  }
  /* Προσαρμογή του grid για να καλύψει το κενό */
  .directional-pad {
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(2, 50px);
  }
  .arrow-down {
    grid-column: 2;
    grid-row: 2;
  }
}

/* Mobile-specific styles */

@media (max-width: 768px) {
  h1 {
    font-size: 2.5em;
  }
  .score-board {
    gap: 15px;
  }
  .score-item {
    padding: 15px 25px;
    font-size: 1.1em;
  }
  #gameCanvas {
    width: 95vw;
    height: 95vw;
    max-width: 400px;
    max-height: 400px;
  }
  .tutorial-screen {
    display: none !important;
  }
  .mobile-controls {
    display: block;
    bottom: 110px;
  }
  .mobile-buttons {
    display: flex;
    bottom: 120px;
  }
  .social-links,
  .signature {
    display: none;
  }
  .controls {
    margin-bottom: 110px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2em;
  }
  .score-item {
    padding: 12px 20px;
    font-size: 1em;
  }
  #gameCanvas {
    width: 90vw;
    height: 90vw;
    max-width: 350px;
    max-height: 350px;
  }
  .directional-pad {
    grid-template-columns: repeat(3, 45px);
    grid-template-rows: repeat(2, 45px);
    gap: 4px;
    padding: 8px;
  }
  .arrow-btn {
    width: 45px;
    height: 45px;
    font-size: 1.3em;
  }
  .mobile-btn {
    width: 45px;
    height: 45px;
    font-size: 0.9em;
  }
  .mobile-controls {
    bottom: 100px;
  }
  .mobile-buttons {
    bottom: 110px;
    right: 15px;
  }
  .controls {
    margin-bottom: 100px;
  }
}

@media (max-width: 360px) {
  .directional-pad {
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(2, 40px);
    gap: 3px;
    padding: 6px;
  }
  .arrow-btn {
    width: 40px;
    height: 40px;
    font-size: 1.2em;
  }
  .mobile-btn {
    width: 40px;
    height: 40px;
    font-size: 0.8em;
  }
  .mobile-controls {
    bottom: 90px;
  }
  .mobile-buttons {
    bottom: 100px;
  }
  .controls {
    margin-bottom: 90px;
  }
}
