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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #000;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
}

.game-container {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-header {
  text-align: center;
  margin-bottom: 30px;
  animation: fadeInDown 0.8s ease;
}

.game-title {
  font-size: 64px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 10px;
  margin-bottom: 20px;
  background: linear-gradient(45deg, #fff, #f0f0f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: pulse 2s ease-in-out infinite;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}

.stat-item {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;
  padding: 15px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all 0.3s ease;
}

.stat-item:hover {
  transform: translateY(-5px);
}

.stat-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}

.stat-value {
  font-size: 32px;
  font-weight: 900;
  color: #fff;
}

.game-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  width: 100%;
  max-width: 1400px;
  padding: 20px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 180px;
  flex-shrink: 0;
}

.panel-section {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.3s ease;
}

.panel-section:hover {
  background: rgba(255, 255, 255, 0.08);
}

.panel-section h3 {
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-weight: 600;
}

#next-canvas {
  display: block;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  width: 100%;
  height: auto;
}

.high-score {
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  text-align: center;
}

.stats-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-item-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.stat-item-compact:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(3px);
}

.stat-item-compact .stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.stat-item-compact .stat-value {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
}

.stats-compact {
  padding: 10px 12px !important;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.stat-row:hover {
  background: rgba(255, 255, 255, 0.1);
}

.stat-label-small {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-value-small {
  font-size: 14px;
  font-weight: 900;
  color: #fff;
}

.game-board-container {
  position: relative;
  background: #111;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-canvas {
  display: block;
  background: #000;
  border-radius: 4px;
  width: 300px;
  height: 600px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #fff;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.control-item:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(5px);
}

.key {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  font-weight: 700;
  font-size: 16px;
  padding: 5px 10px;
}


.game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  z-index: 10;
  animation: fadeIn 0.5s ease;
}

.game-over.hidden {
  display: none;
}

.game-over-content {
  text-align: center;
  color: #fff;
  animation: scaleIn 0.5s ease;
}

.game-over-content h2 {
  font-size: 36px;
  margin-bottom: 20px;
  color: #fff;
  font-weight: 900;
}

.final-score {
  font-size: 20px;
  margin-bottom: 30px;
  color: #fff;
  opacity: 0.8;
}

.btn-restart {
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-restart:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.btn-restart:active {
  transform: translateY(0);
}

.mobile-controls {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.mobile-btn {
  width: 60px;
  height: 60px;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
  user-select: none;
}

.mobile-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.15);
}

.mobile-btn-large {
  width: 140px;
  font-size: 18px;
  letter-spacing: 2px;
}

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

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.2);
  }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .game-wrapper {
    flex-direction: column;
    gap: 20px;
  }

  .side-panel {
    flex-direction: row;
    width: 100%;
    max-width: 600px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .panel-section {
    flex: 1;
    min-width: 140px;
  }

  #game-canvas {
    width: 280px;
    height: 560px;
  }
}

@media (max-width: 768px) {
  .game-container {
    height: auto;
    padding: 20px 0;
    position: relative;
  }

  .game-wrapper {
    flex-direction: column;
  }

  .side-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 5;
    flex-direction: column;
    width: auto;
    min-width: auto;
  }

  /* Hide all panels except Next piece on mobile */
  .panel-section:not(:first-child) {
    display: none;
  }

  .panel-section:first-child {
    width: auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .panel-section:first-child h3 {
    font-size: 9px;
    margin-bottom: 4px;
  }

  #next-canvas {
    width: 80px !important;
    height: 80px !important;
  }

  /* Hide mobile control buttons - using swipes instead */
  .mobile-controls {
    display: none;
  }

  #game-canvas {
    width: 240px;
    height: 480px;
  }

  .game-board-container {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .game-wrapper {
    padding: 10px;
  }

  .side-panel {
    top: 10px;
    right: 10px;
  }

  .panel-section:first-child {
    padding: 6px;
  }

  .panel-section:first-child h3 {
    font-size: 8px;
    margin-bottom: 3px;
  }

  #next-canvas {
    width: 60px !important;
    height: 60px !important;
  }

  #game-canvas {
    width: 200px;
    height: 400px;
  }

  .game-board-container {
    padding: 10px;
  }
}
