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

body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Screen Management */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.screen.active {
  display: flex;
}

/* Start Screen */
.start-container {
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 3rem 2rem;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  max-width: 400px;
  width: 90%;
}

.game-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-subtitle {
  font-size: 1rem;
  color: #666;
  margin-bottom: 2rem;
  font-weight: 300;
}

.sound-toggle {
  margin-top: 1.5rem;
}

.sound-toggle label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: #666;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
  background: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Game Screen */
.game-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 1rem;
  border-radius: 15px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.game-stats {
  display: flex;
  gap: 2rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: #666;
  font-weight: 300;
}

.stat-label + span {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
}

.game-controls {
  display: flex;
  gap: 0.5rem;
}

.game-controls .btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Game Board */
.game-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 0;
}

/* Pyramid */
.pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.pyramid-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Cards */
.card {
  width: 60px;
  height: 84px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 2px solid transparent;
}

.card.face-up {
  background: white;
  color: #333;
}

.card.face-down {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  color: transparent;
}

.card.face-down::before {
  content: "🂠";
  font-size: 1.5rem;
  color: #a0aec0;
}

.card.red {
  color: #e53e3e;
}

.card.black {
  color: #2d3748;
}

.card.selectable {
  cursor: pointer;
}

.card.selectable:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  border-color: #667eea;
}

.card.selected {
  transform: translateY(-4px);
  border-color: #667eea;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  background: #f0f4ff;
}

.card.covered {
  opacity: 0.7;
  cursor: not-allowed;
}

.card.covered:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border-color: transparent;
}

/* Bottom Area */
.bottom-area {
  display: flex;
  justify-content: center;
  gap: 2rem;
  align-items: flex-end;
}

.pile-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.pile-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pile {
  position: relative;
  min-height: 84px;
  min-width: 60px;
}

.card-stack {
  position: relative;
  width: 60px;
  height: 84px;
}

.pile .card {
  position: absolute;
  top: 0;
  left: 0;
}

.stock-pile .card-stack {
  cursor: pointer;
}

.stock-pile .card-stack:hover .card {
  transform: translateY(-2px);
}

.stock-pile.empty .card-stack {
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.stock-pile.empty .card-stack:hover {
  border-color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
}

.stock-pile.empty .card-stack::before {
  content: "↻";
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Result Screens */
.result-container {
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 3rem 2rem;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  max-width: 400px;
  width: 90%;
}

.result-title {
  font-size: 2rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 1rem;
}

.result-message {
  font-size: 1.1rem;
  color: #666;
  margin-bottom: 2rem;
  font-weight: 300;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.result-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.result-label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 300;
}

.result-label + span {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
}

.result-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Animations */
@keyframes cardFlip {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(90deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

.card.flipping {
  animation: cardFlip 0.6s ease-in-out;
}

@keyframes cardRemove {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(0.8) rotate(10deg);
    opacity: 0;
  }
}

.card.removing {
  animation: cardRemove 0.4s ease-in-out forwards;
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-container {
    padding: 0.5rem;
  }

  .game-header {
    flex-direction: column;
    gap: 1rem;
    padding: 0.75rem;
  }

  .game-stats {
    gap: 1rem;
  }

  .game-controls .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  .card {
    width: 45px;
    height: 63px;
    font-size: 0.8rem;
  }

  .card-stack {
    width: 45px;
    height: 63px;
  }

  .pile {
    min-width: 45px;
    min-height: 63px;
  }

  .bottom-area {
    gap: 1rem;
  }

  .pyramid {
    gap: 0.3rem;
    margin-bottom: 1rem;
  }

  .pyramid-row {
    gap: 0.3rem;
  }

  .game-title {
    font-size: 2rem;
  }

  .start-container {
    padding: 2rem 1.5rem;
  }

  .result-container {
    padding: 2rem 1.5rem;
  }

  .result-buttons {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .card {
    width: 38px;
    height: 53px;
    font-size: 0.7rem;
  }

  .card-stack {
    width: 38px;
    height: 53px;
  }

  .pile {
    min-width: 38px;
    min-height: 53px;
  }

  .game-stats {
    gap: 0.5rem;
  }

  .stat {
    font-size: 0.8rem;
  }

  .bottom-area {
    gap: 0.5rem;
  }
}

/* Landscape mobile optimization */
@media (max-height: 600px) and (orientation: landscape) {
  .game-container {
    padding: 0.25rem;
  }

  .game-header {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .pyramid {
    gap: 0.2rem;
    margin-bottom: 0.5rem;
  }

  .pyramid-row {
    gap: 0.2rem;
  }

  .card {
    width: 35px;
    height: 49px;
    font-size: 0.6rem;
  }

  .card-stack {
    width: 35px;
    height: 49px;
  }

  .pile {
    min-width: 35px;
    min-height: 49px;
  }
}
