* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Quicksand", sans-serif;
  background: #1e272e;
  min-height: 100vh;
  color: white;
}

button {
  font-family: "Quicksand", sans-serif;
}

.game-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  text-align: center;
  background: #1e272e;
  padding: 15px 20px;
  border-radius: 16px;
}

.game-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.timer-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

#timer {
  font-size: 1.3rem;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.best-time {
  font-size: 0.9rem;
  color: #f39c12;
  font-weight: 500;
}

.game-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0px;
  background: linear-gradient(90deg, #f39c12, #e74c3c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.game-header h1 .smoke-trail {
  display: inline-block;
  position: relative;
  width: 30px;
  height: 20px;
  margin-right: 5px;
  vertical-align: middle;
}

.game-header h1 .puff {
  position: absolute;
  background: #777;
  border-radius: 50%;
  animation: puff-out 0.8s ease-out infinite;
}

.game-header h1 .puff:nth-child(1) {
  width: 7px;
  height: 7px;
  right: 0;
  top: 6px;
  animation-delay: 0s;
}

.game-header h1 .puff:nth-child(2) {
  width: 5px;
  height: 5px;
  right: 3px;
  top: 10px;
  animation-delay: 0.15s;
}

.game-header h1 .puff:nth-child(3) {
  width: 6px;
  height: 6px;
  right: 1px;
  top: 3px;
  animation-delay: 0.3s;
}

.game-header h1 .puff:nth-child(4) {
  width: 5px;
  height: 5px;
  right: 5px;
  top: 7px;
  animation-delay: 0.45s;
}

.game-header h1 .puff:nth-child(5) {
  width: 4px;
  height: 4px;
  right: 2px;
  top: 12px;
  animation-delay: 0.6s;
}

.game-header h1 .puff:nth-child(6) {
  width: 6px;
  height: 6px;
  right: 0;
  top: 8px;
  animation-delay: 0.75s;
}

@keyframes puff-out {
  0% {
    transform: translateX(0) scale(1);
    opacity: 0.7;
  }
  100% {
    transform: translateX(-25px) scale(0.2);
    opacity: 0;
  }
}

.game-instructions {
  color: #64748b;
  font-size: 0.9rem;
  margin-top: 15px;
  line-height: 1.6;
}

.game-info {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 1.2rem;
  font-weight: normal;
  margin-top: 10px;
}

#current-lane {
  font-weight: 600;
  color: #3498db;
  text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

#gameCanvas {
  border: 2px solid #485460;
  border-radius: 12px;
  background: #1e272e;
}

.game-controls {
  margin-top: 10px;
  font-size: 1.1rem;
}

.game-controls p {
  margin: 5px 0;
}

.difficulty-buttons {
  display: flex;
  justify-content: center;
  gap: 5px 10px;
  margin-bottom: 20px;
}

.difficulty-btn {
  padding: 6px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid #485460;
  background: transparent;
  color: #808e9b;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.difficulty-btn:hover {
  border-color: #808e9b;
  color: #fff;
}

.difficulty-btn.active {
  background: #485460;
  border-color: #485460;
  color: #fff;
}

.game-over {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 39, 46, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.game-over h2 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  font-weight: 600;
}

.game-over p {
  font-size: 1.2rem;
  margin-bottom: 25px;
  color: #808e9b;
}

.new-record {
  font-size: 1.3rem;
  color: #f39c12;
  font-weight: 600;
  margin-top: 5px;
  margin-bottom: 20px;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

#restart-btn {
  padding: 14px 35px;
  font-size: 1rem;
  font-weight: 600;
  background: #3498db;
  color: #fff;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.15s ease;
}

#restart-btn:hover {
  background: #2980b9;
}

.hidden {
  display: none !important;
}

.countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 39, 46, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  border-radius: 12px;
}

#countdown-text {
  font-size: 8rem;
  font-weight: 700;
  color: #fff;
  animation: countdown-pulse 1s ease-in-out;
}

@keyframes countdown-pulse {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  #countdown-text {
    font-size: 5rem;
  }
}

.lane-change-btn {
  margin-top: 20px;
  padding: 12px 28px;
  font-size: 1.1rem;
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background 0.1s, transform 0.1s;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
.lane-change-btn:hover {
  background: linear-gradient(45deg, #764ba2, #667eea);
  transform: translateY(-2px);
}
.lane-change-btn:active {
  transform: translateY(0px);
  transition: transform 0.05s;
}

@media (max-width: 768px) {
  .game-container {
    padding: 15px;
    margin: 10px;
  }

  #gameCanvas {
    width: 100%;
    max-width: 400px;
    /* height: auto; */
    height: 500px;
  }
}

/* Desktop styles - limit max width to 400px */
@media (min-width: 769px) {
  .game-container {
    max-width: 600px;
    margin: 0 auto;
  }

  #gameCanvas {
    max-width: 600px;
    width: 100%;
    height: 500px;
  }
}
