:root {
  --bg-color: #0a0a12;
  --text-color: #ffffff;
  --primary-neon: #00f3ff;
  --secondary-neon: #ff0055;
  --accent-color: #ffe600;
  --font-main: "Rubik", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html, body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-main);
  overflow: hidden;
  height: 100%;
  width: 100%;
  position: fixed;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Shake Animation / אנימציית רעידה */
.shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }

  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }

  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#hud-top {
  position: absolute;
  top: 20px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 10;
}

.hud-item {
  font-size: 1.5rem;
  font-weight: 700;
  text-shadow: 0 0 10px var(--primary-neon);
  color: var(--primary-neon);
}

.hud-item span {
  color: var(--text-color);
}

.hud-item.high-score {
  color: var(--accent-color);
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#combo-container {
  position: absolute;
  top: 80px;
  left: 40px;
  z-index: 10;
}

#combo-display {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent-color);
  text-shadow: 0 0 20px var(--secondary-neon);
  transform: rotate(-10deg);
  transition: transform 0.1s;
}

#combo-display.pulse {
  transform: rotate(-10deg) scale(1.2);
}

#combo-display.hidden {
  opacity: 0;
  transform: scale(0);
}

#controls-hint {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 30;
  pointer-events: auto;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.3s;
}

.icon-btn:hover {
  color: #fff;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    visibility 0.3s;
  z-index: 20;
  overflow: hidden;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

h1.glitch-title {
  font-size: 6rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  text-transform: uppercase;
  letter-spacing: 5px;
  text-shadow:
    3px 3px var(--secondary-neon),
    -3px -3px var(--primary-neon);
  animation: glitch 3s infinite;
}

@keyframes glitch {
  0% {
    transform: skew(0deg);
  }

  2% {
    transform: skew(10deg);
  }

  4% {
    transform: skew(-10deg);
  }

  6% {
    transform: skew(0deg);
  }

  100% {
    transform: skew(0deg);
  }
}

.subtitle {
  font-size: 1.5rem;
  margin-bottom: 3rem;
  color: #ccc;
  font-weight: 300;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  width: 100%;
}

.content-box {
  text-align: right;
  margin-bottom: 3rem;
  font-size: 1.3rem;
  line-height: 1.8;
  max-width: 600px;
  background: rgba(255, 255, 255, 0.05);
  padding: 30px;
  border-radius: 10px;
  border: 1px solid rgba(0, 243, 255, 0.2);
}

.neon-btn {
  background: transparent;
  border: 2px solid var(--primary-neon);
  color: var(--primary-neon);
  padding: 15px 50px;
  font-size: 1.5rem;
  font-family: var(--font-main);
  font-weight: bold;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
  border-radius: 5px;
  pointer-events: auto;
  min-width: 250px;
  text-align: center;
}

.auth-buttons {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: 500px; /* Or match menu-list width */
  margin-top: 20px;
}

.auth-btn {
  min-width: 150px;
  font-size: 1.2rem;
  padding: 10px 20px;
  border-width: 2px;
}

/* Login - Accent (Yellow) */
.auth-btn.login {
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: 0 0 10px rgba(255, 230, 0, 0.3);
}

.auth-btn.login:hover,
.auth-btn.login:focus {
  background: var(--accent-color);
  color: var(--bg-color);
  box-shadow: 0 0 20px rgba(255, 230, 0, 0.6);
}

/* Register - Secondary Neon (Pink) */
.auth-btn.register {
    border-color: var(--secondary-neon);
    color: var(--secondary-neon);
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.3);
}

.auth-btn.register:hover,
.auth-btn.register:focus {
    background: var(--secondary-neon);
    color: var(--text-color);
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.6);
}

.neon-btn:hover,
.neon-btn:focus {
  background: var(--primary-neon);
  color: var(--bg-color);
  box-shadow: 0 0 30px rgba(0, 243, 255, 0.6);
  transform: scale(1.05);
  outline: none;
}

.neon-btn.secondary {
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
  box-shadow: none;
  font-size: 1.2rem;
  padding: 12px 40px;
}

.neon-btn.secondary:hover,
.neon-btn.secondary:focus {
  border-color: var(--text-color);
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

#game-over-screen h2 {
  font-size: 4rem;
  color: var(--secondary-neon);
  margin-bottom: 1rem;
  text-shadow: 0 0 20px var(--secondary-neon);
}

.new-high-score {
  color: var(--accent-color);
  font-size: 2rem;
  font-weight: bold;
  margin-top: 10px;
  margin-bottom: 20px;
  animation: blink 1s infinite alternate;
}

.hidden {
  display: none !important;
}

@keyframes blink {
  from {
    opacity: 1;
  }

  to {
    opacity: 0.5;
  }
}

/* Guide Layout / פריסת המדריך */
.guide-layout {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  text-align: right;
  max-width: 900px;
}

.guide-section {
  flex: 1 1 250px;
  background: rgba(0, 0, 0, 0.3);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(0, 243, 255, 0.1);
}

.guide-section h3 {
  color: var(--accent-color);
  margin-bottom: 15px;
  font-size: 1.4rem;
  border-bottom: 2px solid var(--secondary-neon);
  padding-bottom: 5px;
  display: inline-block;
}

.guide-section ul {
  list-style-type: none;
  padding: 0;
}

.guide-section li {
  margin-bottom: 10px;
  font-size: 1.1rem;
  position: relative;
  padding-right: 20px;
}

.guide-section li::before {
  content: "•";
  color: var(--primary-neon);
  position: absolute;
  right: 0;
  font-weight: bold;
}

/* Level Select Grid */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
  max-width: 800px;
  width: 90%;
  margin-bottom: 30px;
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.level-btn {
  background: rgba(0, 243, 255, 0.1);
  border: 1px solid var(--primary-neon);
  color: var(--text-color);
  padding: 15px 0;
  font-size: 1.2rem;
  font-family: var(--font-main);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 5px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.level-btn:hover,
.level-btn:focus {
  background: var(--primary-neon);
  color: var(--bg-color);
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
  transform: translateY(-2px);
  outline: none;
}

.level-btn.locked {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #555;
  filter: grayscale(1);
  pointer-events: none;
}

/* Scrollbar for grid */
.levels-grid::-webkit-scrollbar {
  width: 8px;
}

.levels-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.levels-grid::-webkit-scrollbar-thumb {
  background: var(--primary-neon);
  border-radius: 4px;
}

/* SEO Description */
.seo-desc {
  margin-top: 2rem;
  font-size: 1rem;
  color: #aaa;
  max-width: 600px;
  text-align: center;
  line-height: 1.6;
}

/* Login & Register Styles */
.form-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  text-align: right;
  margin-bottom: 20px;
}

.form-group label {
  color: var(--primary-neon);
  font-size: 1.2rem;
  font-weight: bold;
}

.form-group input {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--primary-neon);
  color: var(--text-color);
  padding: 15px;
  font-size: 1.1rem;
  border-radius: 5px;
  outline: none;
  font-family: var(--font-main);
  transition: all 0.3s;
  width: 100%;
}

.form-group input:focus {
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
  background: rgba(0, 243, 255, 0.05);
  border-color: #fff;
}

.message {
  margin-top: 15px;
  font-size: 1.1rem;
  text-align: center;
  min-height: 1.5em;
  font-weight: bold;
  padding: 10px;
  border-radius: 5px;
  width: 100%;
}

.message.success {
  color: #0f0;
  background: rgba(0, 255, 0, 0.1);
  border: 1px solid rgba(0, 255, 0, 0.3);
}

.message.error {
  color: #f00;
  background: rgba(255, 0, 0, 0.1);
  border: 1px solid rgba(255, 0, 0, 0.3);
}

#user-status {
  margin-top: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  background: rgba(255, 230, 0, 0.1);
  padding: 15px;
  border-radius: 10px;
  border: 1px solid rgba(255, 230, 0, 0.3);
  width: 100%;
  max-width: 300px;
}

#user-status p {
  font-size: 1.4rem;
  color: var(--accent-color);
  text-shadow: 0 0 10px rgba(255, 230, 0, 0.5);
  margin: 0;
}

.small-btn {
  padding: 8px 25px !important;
  min-width: unset !important;
  font-size: 1rem !important;
  border-width: 1px;
}

/* Splash Screen Styles / מסך פתיחה */
#splash-screen {
  background: radial-gradient(circle at center, #101026 0%, #05050a 100%);
  z-index: 100;
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1), transform 1s cubic-bezier(0.4, 0, 0.2, 1), visibility 1s;
}

#splash-screen:not(.active) {
  transform: scale(1.1);
  filter: blur(10px);
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.splash-logo-img {
  width: 90px;
  height: 90px;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 15px var(--primary-neon));
  animation: logoFloat 3s ease-in-out infinite;
}

.splash-logo {
  font-size: 6rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  text-transform: uppercase;
  letter-spacing: 5px;
  text-shadow:
    3px 3px var(--secondary-neon),
    -3px -3px var(--primary-neon);
  animation: glitch 3s infinite;
}

.splash-subtitle {
  font-size: 1.8rem;
  color: var(--accent-color);
  text-shadow: 0 0 10px rgba(255, 230, 0, 0.5);
  margin-bottom: 40px;
  letter-spacing: 4px;
  font-weight: 700;
  opacity: 0;
  animation: fadeIn 0.8s ease-out 0.5s forwards;
}

.splash-loader {
  width: 300px;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  margin-bottom: 15px;
  opacity: 0;
  animation: fadeIn 0.8s ease-out 0.8s forwards;
}

.splash-loader-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--secondary-neon), var(--primary-neon));
  box-shadow: 0 0 8px var(--primary-neon);
  animation: fillProgress 2.2s cubic-bezier(0.1, 0.8, 0.3, 1) 1s forwards;
}

.splash-status {
  font-size: 1rem;
  color: #667;
  letter-spacing: 2px;
  opacity: 0;
  animation: fadeIn 0.8s ease-out 1.2s forwards;
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes logoPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

@keyframes logoGlitch {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    text-shadow: 
      0 0 10px rgba(0, 243, 255, 0.5),
      0 0 20px rgba(0, 243, 255, 0.3),
      0 0 40px var(--primary-neon),
      3px 3px var(--secondary-neon),
      -3px -3px var(--primary-neon);
  }
  20%, 24%, 55% {
    text-shadow: 
      0 0 5px rgba(0, 243, 255, 0.8),
      -4px 2px var(--secondary-neon),
      4px -2px var(--primary-neon);
  }
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

@keyframes fillProgress {
  0% {
    width: 0%;
  }
  20% {
    width: 25%;
  }
  45% {
    width: 35%;
  }
  70% {
    width: 75%;
  }
  90% {
    width: 90%;
  }
  100% {
    width: 100%;
  }
}

/* Premium Menu Animations / מעבר מרהיב לתפריט */
#main-menu .glitch-title,
#main-menu .subtitle,
#main-menu .menu-list .neon-btn,
#main-menu .auth-buttons,
#main-menu .seo-desc,
#main-menu #user-status {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

#main-menu.active .glitch-title {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.1s;
}

#main-menu.active .subtitle {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.25s;
}

#main-menu.active .menu-list .neon-btn:nth-child(1) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.4s;
}

#main-menu.active .menu-list .neon-btn:nth-child(2) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.5s;
}

#main-menu.active .menu-list .neon-btn:nth-child(3) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.6s;
}

#main-menu.active .menu-list .neon-btn:nth-child(4) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.7s;
}

#main-menu.active .auth-buttons,
#main-menu.active #user-status {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.85s;
}

#main-menu.active .seo-desc {
  opacity: 0.7;
  transform: translateY(0);
  transition-delay: 1s;
}

/* Hidden input for mobile keyboard */
#mobile-input-field {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  opacity: 0;
  font-size: 16px; /* Prevents auto-zoom on iOS */
  pointer-events: none;
  z-index: -1000;
}

#mobile-keyboard-btn {
  font-size: 2rem;
  cursor: pointer;
  background: rgba(0, 243, 255, 0.1);
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
  transition: all 0.3s;
}

#mobile-keyboard-btn:hover {
  background: var(--primary-neon);
  color: var(--bg-color);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.6);
  transform: scale(1.1);
}

/* Media Queries for Mobile Screens / התאמה למובייל */
@media (max-width: 768px) {
  h1.glitch-title,
  .splash-logo {
    font-size: 3rem !important;
    letter-spacing: 3px !important;
  }

  .subtitle,
  .splash-subtitle {
    font-size: 1.1rem !important;
    margin-bottom: 2rem !important;
    letter-spacing: 2px !important;
  }

  .neon-btn {
    padding: 12px 30px !important;
    font-size: 1.2rem !important;
    min-width: 200px !important;
  }

  .neon-btn.secondary {
    font-size: 1rem !important;
    padding: 10px 25px !important;
  }

  .auth-buttons {
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .auth-btn {
    width: 200px !important;
    min-width: unset !important;
  }

  #hud-top {
    padding: 0 20px !important;
  }

  .hud-item {
    font-size: 1.1rem !important;
  }

  .hud-item.high-score {
    font-size: 0.9rem !important;
  }

  #combo-container {
    top: 60px !important;
    left: 20px !important;
  }

  #combo-display {
    font-size: 2rem !important;
  }

  .content-box {
    padding: 20px !important;
    font-size: 1rem !important;
    margin-bottom: 2rem !important;
    max-width: 90% !important;
  }

  .levels-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
    max-height: 50vh !important;
  }

  .level-btn {
    padding: 10px 0 !important;
    font-size: 1rem !important;
  }

  #game-over-screen h2 {
    font-size: 2.5rem !important;
  }

  #level-complete-screen h2 {
    font-size: 2.5rem !important;
  }
}

@media (max-width: 480px) {
  .levels-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}


