/* ============================================
   Push - 3D Sokoban
   Modern Dark Theme
   ============================================ */

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body {
  background: linear-gradient(135deg, #0f0c29 0%, #1a1a3e 50%, #24243e 100%);
  background-size: cover;
  color: #e0e0e0;
}

/* ============================================
   Loading Screen
   ============================================ */
#loading-screen {
  position: absolute;
  z-index: 10;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1a3e 50%, #24243e 100%);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   Title Overlay
   ============================================ */
#title-overlay {
  position: absolute;
  z-index: 9;
  width: 100%;
  height: 100%;
  background: rgba(15, 12, 41, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
}

.title-content {
  text-align: center;
  animation: fadeInUp 1s ease-out;
}

.game-title {
  font-size: 96px;
  font-weight: 800;
  letter-spacing: 24px;
  color: #fff;
  margin: 0;
  text-shadow: 0 0 40px rgba(100, 140, 255, 0.5), 0 0 80px rgba(100, 140, 255, 0.3);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-subtitle {
  font-size: 22px;
  color: #8888aa;
  letter-spacing: 8px;
  margin: 8px 0 40px 0;
  text-transform: uppercase;
}

.controls-hint {
  margin: 20px 0 30px 0;
  color: #aaaacc;
  font-size: 16px;
  line-height: 1.8;
}

.controls-hint p {
  margin: 4px 0;
}

#start-game {
  font-size: 20px;
  padding: 14px 60px;
  letter-spacing: 2px;
  cursor: pointer;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: #fff;
  border-radius: 200px;
  box-shadow: 0 4px 30px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
}

#start-game:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 40px rgba(102, 126, 234, 0.6);
}

/* ============================================
   Cover / Hint Overlays
   ============================================ */
#cover, #cover2 {
  position: absolute;
  height: 100%;
  width: 100%;
  background-color: rgba(15, 12, 41, 0.7);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

#hint, #hint2 {
  text-align: center;
}

#hinttext, #hinttext2 {
  color: #ffffff;
  font-size: 42px;
  font-weight: 300;
  letter-spacing: 2px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
  margin-bottom: 30px;
}

.closebtn {
  font-size: 18px;
  padding: 10px 40px;
  cursor: pointer;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: #fff;
  border-radius: 200px;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.closebtn:hover {
  box-shadow: 0 6px 30px rgba(102, 126, 234, 0.5);
}

#cover2 {
  display: none;
}

/* ============================================
   Top HUD Bar
   ============================================ */
#hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: linear-gradient(180deg, rgba(15,12,41,0.8) 0%, transparent 100%);
  pointer-events: none;
}

#game-brand {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #667eea;
  text-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

#level-display {
  font-size: 16px;
  color: #aaaacc;
  letter-spacing: 1px;
}

#level-display span {
  color: #fff;
  font-weight: 600;
}

/* ============================================
   HUD Buttons
   ============================================ */
#stepnum {
  position: absolute;
  top: 60px;
  right: 20px;
  width: auto;
  min-width: 120px;
  color: #fff;
  background: rgba(102, 126, 234, 0.15);
  border: 1px solid rgba(102, 126, 234, 0.3);
  backdrop-filter: blur(10px);
  font-size: 14px;
  letter-spacing: 1px;
  z-index: 4;
}

#back, #refresh, #recover, #prev-level, #next-level {
  z-index: 4;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #ccc !important;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

#back:hover, #refresh:hover, #recover:hover, #prev-level:hover, #next-level:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
  border-color: rgba(102, 126, 234, 0.5) !important;
}

#recover {
  position: absolute;
  right: 5%;
  top: 45%;
  visibility: hidden;
}

#prev-level {
  position: absolute;
  left: 3%;
  top: 50%;
}

#next-level {
  position: absolute;
  left: 9%;
  top: 50%;
}

#back {
  left: 25%;
  top: 89%;
}

#refresh {
  left: 66%;
  top: 89%;
}

#stepnum {
  position: absolute;
  right: 20px;
  top: 60px;
  width: auto;
  color: #fff;
  z-index: 4;
}

/* ============================================
   WASD Image
   ============================================ */
#wasd {
  z-index: 4;
  position: absolute;
  bottom: 30px;
  left: 20px;
  width: 140px;
  opacity: 0.6;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,0.5));
}

/* ============================================
   Map / Solution Buttons (bottom)
   ============================================ */
#map, #answer {
  display: inline-block;
  position: absolute;
  margin-left: 20px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #aaa !important;
  backdrop-filter: blur(8px);
  font-size: 13px;
  letter-spacing: 1px;
  width: auto;
  padding: 0 20px !important;
  transition: all 0.3s ease;
}

#map:hover, #answer:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  border-color: rgba(102, 126, 234, 0.5) !important;
}

#map, #answer {
  width: auto;
  top: 90%;
}

#map {
  right: 15%;
  left: auto;
}

#answer {
  right: 3%;
  left: auto;
}

/* File inputs hidden */
#mapfile, #answerfile {
  display: none;
}

/* ============================================
   Circle Loading Animation
   ============================================ */
.circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: -webkit-radial-gradient(bottom left, circle, #667eea, #764ba2, #24243e);
  margin: 0 auto;
  position: relative;
}

.pie_left, .pie_right {
  width: 100px;
  height: 100px;
  position: absolute;
  top: 0;
  left: 0;
}

.left, .right {
  display: block;
  width: 100px;
  height: 100px;
  background: #667eea;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
}

.pie_right, .right {
  clip: rect(0, auto, auto, 50px);
}

.pie_left, .left {
  clip: rect(0, 50px, auto, 0);
}

.mask {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  left: 10px;
  top: 10px;
  background: #1a1a3e;
  position: absolute;
  text-align: center;
  line-height: 80px;
  font-size: 16px;
  color: #fff;
}

/* ============================================
   Loading Animation
   ============================================ */
@-webkit-keyframes square-spin {
  25% { -webkit-transform: perspective(100px) rotateX(180deg) rotateY(0); transform: perspective(100px) rotateX(180deg) rotateY(0); }
  50% { -webkit-transform: perspective(100px) rotateX(180deg) rotateY(180deg); transform: perspective(100px) rotateX(180deg) rotateY(180deg); }
  75% { -webkit-transform: perspective(100px) rotateX(0) rotateY(180deg); transform: perspective(100px) rotateX(0) rotateY(180deg); }
  100% { -webkit-transform: perspective(100px) rotateX(0) rotateY(0); transform: perspective(100px) rotateX(0) rotateY(0); }
}

@keyframes square-spin {
  25% { -webkit-transform: perspective(100px) rotateX(180deg) rotateY(0); transform: perspective(100px) rotateX(180deg) rotateY(0); }
  50% { -webkit-transform: perspective(100px) rotateX(180deg) rotateY(180deg); transform: perspective(100px) rotateX(180deg) rotateY(180deg); }
  75% { -webkit-transform: perspective(100px) rotateX(0) rotateY(180deg); transform: perspective(100px) rotateX(0) rotateY(180deg); }
  100% { -webkit-transform: perspective(100px) rotateX(0) rotateY(0); transform: perspective(100px) rotateX(0) rotateY(0); }
}

.square-spin>div {
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  margin-left: -25px;
  margin-top: -25px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: 1px solid rgba(102, 126, 234, 0.5);
  -webkit-animation: square-spin 3s 0s cubic-bezier(.09, .57, .49, .9) infinite;
  animation: square-spin 3s 0s cubic-bezier(.09, .57, .49, .9) infinite;
  box-shadow: 0 0 30px rgba(102, 126, 234, 0.3);
}

.loader>.text {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translateX(-50%);
  color: #aaaacc;
  font-size: 18px;
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .game-title {
    font-size: 48px;
    letter-spacing: 12px;
  }

  #hinttext, #hinttext2 {
    font-size: 24px;
  }

  #wasd {
    width: 80px;
  }

  #prev-level {
    left: 2%;
  }

  #next-level {
    left: 14%;
  }
}
