.game-container {
  position: relative;
  width: 100%;
  height: 380px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pattern-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
  width: 280px;
  height: 280px;
  padding: 20px;
}

.pattern-cell {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border: 2px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pattern-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  border-color: #9ca3af;
}

.pattern-cell.active {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  border-color: #5b21b6;
  color: white;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
  animation: cellGlow 0.3s ease-out;
}

.pattern-cell.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #059669;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.pattern-cell.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: #dc2626;
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.pattern-cell.clickable {
  cursor: pointer;
  border-color: #7c3aed;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
}

.pattern-cell.clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.3);
  border-color: #5b21b6;
}

@keyframes cellGlow {
  0% {
    transform: scale(1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.6);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
  }
}

.pattern-instructions {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  font-size: 1.2rem;
  color: #666;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  overflow: hidden;
  margin: 10px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--et-primary) 0%, var(--et-primary-light) 100%);
  transition: width 0.3s ease;
  border-radius: 5px;
}

.level-indicator {
  position: relative;
  width: 100%;
  height: 20px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin: 60px 0 80px 0;
}

.level-progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #3b82f6 50%, #ef4444 100%);
  border-radius: 10px;
  transition: width 0.8s ease-out;
  overflow: hidden;
}

.level-marker {
  position: absolute;
  height: 20px;
  width: 2px;
  top: 0;
  transform: translateX(-50%);
  z-index: 10;
}

.level-marker:before {
  content: "";
  position: absolute;
  top: -15px;
  left: -8px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 12px solid currentColor;
}

.level-marker:after {
  content: attr(data-label);
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 13px;
  font-weight: bold;
  color: var(--et-text);
  background-color: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

#userLevelMarker {
  height: 20px;
  bottom: 0;
  top: auto;
  z-index: 10;
}

#userLevelMarker:before {
  top: auto;
  bottom: -15px;
  border-top: none;
  border-bottom: 12px solid currentColor;
}

#userLevelMarker:after {
  top: auto;
  bottom: -48px;
  background-color: rgba(34, 197, 94, 0.15);
  border: 1px solid #22c55e;
}

.test-complete-message {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-transition {
  animation: fadeTransition 0.8s ease-in-out;
}

@keyframes fadeTransition {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.animate-pulse {
  animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@media (max-width: 640px) {
  .game-container {
    height: 350px;
  }

  .pattern-container {
    width: 240px;
    height: 240px;
    gap: 8px;
    padding: 15px;
  }

  .pattern-cell {
    font-size: 1rem;
    border-radius: 6px;
  }

  .level-indicator {
    margin: 50px 0 70px 0;
  }

  .level-marker:after {
    font-size: 11px;
    top: -35px;
    padding: 1px 4px;
  }

  #userLevelMarker:after {
    bottom: -40px;
  }

  .pattern-instructions {
    font-size: 1rem;
    padding: 0 20px;
  }
}

/* 스크롤바 스타일링 */
.max-h-60::-webkit-scrollbar {
  width: 6px;
}

.max-h-60::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
}

.max-h-60::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.max-h-60::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.game-message {
  animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
  0% {
    transform: translate(-50%, -20px);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.memory-card {
  position: relative;
  user-select: none;
}

.memory-card:not(.clickable) {
  cursor: default;
}